]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/pv: Fix assertion failure in pv_emulate_privileged_op()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 25 Sep 2017 17:19:01 +0000 (18:19 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 26 Sep 2017 09:33:39 +0000 (10:33 +0100)
The ABI of {read,write}_msr() requires them to use x86_emul_hw_exception() if
they report an exception with the emulator core.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/pv/emul-priv-op.c

index ef13d992f0c8619246a5d0b63ec7d0df8c05593d..dd90713acfd93f02d333006e7d42d292a807d894 100644 (file)
@@ -844,7 +844,12 @@ static int read_msr(unsigned int reg, uint64_t *val,
     int ret;
 
     if ( (ret = guest_rdmsr(curr, reg, val)) != X86EMUL_UNHANDLEABLE )
+    {
+        if ( ret == X86EMUL_EXCEPTION )
+            x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt);
+
         return ret;
+    }
 
     switch ( reg )
     {
@@ -993,7 +998,12 @@ static int write_msr(unsigned int reg, uint64_t val,
     int ret;
 
     if ( (ret = guest_wrmsr(curr, reg, val)) != X86EMUL_UNHANDLEABLE )
+    {
+        if ( ret == X86EMUL_EXCEPTION )
+            x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt);
+
         return ret;
+    }
 
     switch ( reg )
     {