# HG changeset patch
# User Aravindh Puthiyaparambil <aravindh@xxxxxxxxxxxx>
# Date 1306846997 -3600
# Node ID 72aec6838f0cf4394845c09d445b72c4bd278f94
# Parent dbe9e02a1f75ea88e93e0f154feb01c570f0195d
mem_event: Revert pointless, unrelated, and broken (on i386) change in
23434:ef410f262299
vcpu_pause() is nestable in the hypervisor, hence checking for
already-paused is not required.
Signed-off-by: Keir Fraser <keir@xxxxxxx>
xen-unstable changeset: 23435:c15f06b99bbe
xen-unstable date: Sat May 28 08:33:54 2011 +0100
mem_event: Allow memory access listener to perform single step execution.
Add a new memory event that handles single step. This allows the
memory access listener to handle instructions that modify data within
the execution page. This can be enabled in the listener by doing:
xc_set_hvm_param(xch, domain_id, HVM_PARAM_MEMORY_EVENT_SINGLE_STEP,
HVMPME_mode_sync)
Now the listener can start single stepping by:
xc_domain_debug_control(xch, domain_id,
XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON, vcpu_id)
And stop single stepping by: xc_domain_debug_control(xch, domain_id,
XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF, vcpu_id)
Signed-off-by: Aravindh Puthiyaparambil <aravindh@xxxxxxxxxxxx>
Acked-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
xen-unstable changeset: 23434:ef410f262299
xen-unstable date: Fri May 27 18:44:26 2011 +0100
---
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Sat May 28 09:22:55 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c Tue May 31 14:03:17 2011 +0100
@@ -3257,7 +3257,8 @@
rc = -EPERM;
break;
case HVM_PARAM_MEMORY_EVENT_INT3:
- if ( d == current->domain )
+ case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
+ if ( d == current->domain )
{
rc = -EPERM;
break;
@@ -3274,6 +3275,7 @@
switch( a.index )
{
case HVM_PARAM_MEMORY_EVENT_INT3:
+ case HVM_PARAM_MEMORY_EVENT_SINGLE_STEP:
{
domain_pause(d);
domain_unpause(d); /* Causes guest to latch new status */
@@ -3885,6 +3887,18 @@
MEM_EVENT_REASON_INT3,
gfn, 0, 1, gla);
}
+
+int hvm_memory_event_single_step(unsigned long gla)
+{
+ uint32_t pfec = PFEC_page_present;
+ unsigned long gfn;
+ gfn = paging_gva_to_gfn(current, gla, &pfec);
+
+ return hvm_memory_event_traps(current->domain->arch.hvm_domain
+ .params[HVM_PARAM_MEMORY_EVENT_SINGLE_STEP],
+ MEM_EVENT_REASON_SINGLESTEP,
+ gfn, 0, 1, gla);
+}
#endif /* __x86_64__ */
/*
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Sat May 28 09:22:55 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Tue May 31 14:03:17 2011 +0100
@@ -1083,8 +1083,9 @@
hvm_asid_flush_vcpu(v);
}
- debug_state = v->domain->debugger_attached
- ||
v->domain->arch.hvm_domain.params[HVM_PARAM_MEMORY_EVENT_INT3];
+ debug_state = v->domain->debugger_attached
+ ||
v->domain->arch.hvm_domain.params[HVM_PARAM_MEMORY_EVENT_INT3]
+ ||
v->domain->arch.hvm_domain.params[HVM_PARAM_MEMORY_EVENT_SINGLE_STEP];
if ( unlikely(v->arch.hvm_vcpu.debug_state_latch != debug_state) )
{
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Sat May 28 09:22:55 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c Tue May 31 14:03:17 2011 +0100
@@ -2626,8 +2626,12 @@
case EXIT_REASON_MONITOR_TRAP_FLAG:
v->arch.hvm_vmx.exec_control &= ~CPU_BASED_MONITOR_TRAP_FLAG;
vmx_update_cpu_exec_control(v);
- if ( v->domain->debugger_attached && v->arch.hvm_vcpu.single_step )
- domain_pause_for_debugger();
+ if ( v->arch.hvm_vcpu.single_step ) {
+ hvm_memory_event_single_step(regs->eip);
+ if ( v->domain->debugger_attached )
+ domain_pause_for_debugger();
+ }
+
break;
case EXIT_REASON_PAUSE_INSTRUCTION:
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h Sat May 28 09:22:55 2011 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h Tue May 31 14:03:17 2011 +0100
@@ -380,6 +380,10 @@
/* Called for current VCPU on int3: returns -1 if no listener */
int hvm_memory_event_int3(unsigned long gla);
+
+/* Called for current VCPU on single step: returns -1 if no listener */
+int hvm_memory_event_single_step(unsigned long gla);
+
#else
static inline void hvm_memory_event_cr0(unsigned long value, unsigned long old)
{ }
@@ -389,6 +393,8 @@
{ }
static inline int hvm_memory_event_int3(unsigned long gla)
{ return 0; }
+static inline int hvm_memory_event_single_step(unsigned long gla)
+{ return 0; }
#endif
#endif /* __ASM_X86_HVM_HVM_H__ */
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h Sat May 28 09:22:55 2011 +0100
+++ b/xen/include/public/hvm/params.h Tue May 31 14:03:17 2011 +0100
@@ -126,10 +126,11 @@
/* Enable blocking memory events, async or sync (pause vcpu until response)
* onchangeonly indicates messages only on a change of value */
-#define HVM_PARAM_MEMORY_EVENT_CR0 20
-#define HVM_PARAM_MEMORY_EVENT_CR3 21
-#define HVM_PARAM_MEMORY_EVENT_CR4 22
-#define HVM_PARAM_MEMORY_EVENT_INT3 23
+#define HVM_PARAM_MEMORY_EVENT_CR0 20
+#define HVM_PARAM_MEMORY_EVENT_CR3 21
+#define HVM_PARAM_MEMORY_EVENT_CR4 22
+#define HVM_PARAM_MEMORY_EVENT_INT3 23
+#define HVM_PARAM_MEMORY_EVENT_SINGLE_STEP 25
#define HVMPME_MODE_MASK (3 << 0)
#define HVMPME_mode_disabled 0
@@ -137,6 +138,6 @@
#define HVMPME_mode_sync 2
#define HVMPME_onchangeonly (1 << 2)
-#define HVM_NR_PARAMS 24
+#define HVM_NR_PARAMS 26
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
diff -r dbe9e02a1f75 -r 72aec6838f0c xen/include/public/mem_event.h
--- a/xen/include/public/mem_event.h Sat May 28 09:22:55 2011 +0100
+++ b/xen/include/public/mem_event.h Tue May 31 14:03:17 2011 +0100
@@ -46,6 +46,7 @@
#define MEM_EVENT_REASON_CR3 3 /* CR3 was hit: gfn is CR3 value */
#define MEM_EVENT_REASON_CR4 4 /* CR4 was hit: gfn is CR4 value */
#define MEM_EVENT_REASON_INT3 5 /* int3 was hit: gla/gfn are RIP */
+#define MEM_EVENT_REASON_SINGLESTEP 6 /* single step was invoked: gla/gfn
are RIP */
typedef struct mem_event_shared_page {
uint32_t port;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|