]> xenbits.xensource.com Git - xen.git/commitdiff
x86/pv: Fix the determiniation of whether to inject #DB
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 12 Sep 2023 21:31:43 +0000 (22:31 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 22 Sep 2023 15:00:17 +0000 (16:00 +0100)
We long ago fixed the emulator to not inject exceptions behind our back.
Therefore, assert that that a PV event (including interrupts, because that
would be buggy too) isn't pending, rather than skipping the #DB injection if
one is.

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 142bc4818cb5579fb6c8818352d8e4f8ad5f83d8..0d9f84f458ba884d9cb8c04b6ca68fe7a50dd960 100644 (file)
@@ -1358,14 +1358,17 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
     switch ( rc )
     {
     case X86EMUL_OKAY:
+        ASSERT(!curr->arch.pv.trap_bounce.flags);
+
         if ( ctxt.ctxt.retire.singlestep )
             ctxt.bpmatch |= DR_STEP;
+
         if ( ctxt.bpmatch )
         {
             curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            if ( !(curr->arch.pv.trap_bounce.flags & TBF_EXCEPTION) )
-                pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
         }
+
         /* fall through */
     case X86EMUL_RETRY:
         return EXCRET_fault_fixed;