diff mbox series

[4/6] x86/pv: set DR_STEP if single-stepping after ro page fault emulation

Message ID 2c68b5aa-843c-7d59-7137-5ea72363ea0d@gmail.com (mailing list archive)
State New, archived
Headers show
Series x86/debug: fix guest dr6 value for single stepping and HW breakpoints | expand

Commit Message

Jinoh Kang Aug. 18, 2023, 3:47 p.m. UTC
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
---
 xen/arch/x86/pv/ro-page-fault.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928ad..238bfbeb4ac4 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -10,6 +10,7 @@ 
 
 #include <asm/pv/trace.h>
 #include <asm/shadow.h>
+#include <asm/debugreg.h>
 
 #include "emulate.h"
 #include "mm.h"
@@ -390,7 +391,10 @@  int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
+        {
+            current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
             pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        }
 
         /* Fallthrough */
     case X86EMUL_RETRY: