Message ID | 1480932571-23547-4-git-send-email-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 05.12.16 at 11:09, <andrew.cooper3@citrix.com> wrote: > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -1679,6 +1679,15 @@ void hvm_triple_fault(void) > void hvm_inject_event(const struct x86_event *event) > { > struct vcpu *curr = current; > + const uint8_t vector = event->vector; > + const bool has_ec = ((event->type == X86_EVENTTYPE_HW_EXCEPTION) && > + (vector < 32) && ((TRAP_HAVE_EC & 1u << vector))); With the operands of << parenthesized Reviewed-by: Jan Beulich <jbeulich@suse.com> Jan
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index e0f936b..ac207e4 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1679,6 +1679,15 @@ void hvm_triple_fault(void) void hvm_inject_event(const struct x86_event *event) { struct vcpu *curr = current; + const uint8_t vector = event->vector; + const bool has_ec = ((event->type == X86_EVENTTYPE_HW_EXCEPTION) && + (vector < 32) && ((TRAP_HAVE_EC & 1u << vector))); + + ASSERT(vector == event->vector); /* Confirm no truncation. */ + if ( has_ec ) + ASSERT(event->error_code != X86_EVENT_NO_EC); + else + ASSERT(event->error_code == X86_EVENT_NO_EC); if ( nestedhvm_enabled(curr->domain) && !nestedhvm_vmswitch_in_progress(curr) &&
Check that event->error_code is appropriate for the type/vector combination. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> --- xen/arch/x86/hvm/hvm.c | 9 +++++++++ 1 file changed, 9 insertions(+)