lkml.org 
[lkml]   [2018]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v5 1/2] KVM: X86: Introduce handle_ud()
From
Date
On 04.04.2018 19:12, Paolo Bonzini wrote:
> On 04/04/2018 13:54, David Hildenbrand wrote:
>>> +{
>>> + enum emulation_result er;
>>> +
>>> + er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);
>>> + if (er == EMULATE_USER_EXIT)
>>> + return 0;
>>> + if (er != EMULATE_DONE)
>>> + kvm_queue_exception(vcpu, UD_VECTOR);
>>> + return 1;
>> I would now actually prefer
>>
>> if (er == EMULATE_DONE)
>> return 1 ...
>
> Why? The return statement would be duplicated.
>
> Paolo
>

I was talking about two equality checks vs. 1 equality and 1 inequality
check.

er = emulate_instruction(vcpu, EMULTYPE_TRAP_UD);
if (er == EMULATE_USER_EXIT)
return 0;
else if (er == EMULATE_DONE)
return 1;
return kvm_queue_exception(vcpu, UD_VECTOR);


--

Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2018-04-04 19:44    [W:0.080 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site