[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH 1/4] arm/monitor: Introduce monitoring of single-step events



In this commit, we extend the capabilities of the monitor to allow
tracing of single-step events on ARM.

Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/monitor.c        | 23 +++++++++++++++++++++++
 xen/include/asm-arm/domain.h  |  1 +
 xen/include/asm-arm/monitor.h |  5 ++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c
index 59ce8f635f..a4466c9574 100644
--- a/xen/arch/arm/monitor.c
+++ b/xen/arch/arm/monitor.c
@@ -32,6 +32,20 @@ int arch_monitor_domctl_event(struct domain *d,
 
     switch ( mop->event )
     {
+    case XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP:
+    {
+        bool old_status = ad->monitor.single_step_enabled;
+
+        if ( unlikely(old_status == requested_status) )
+            return -EEXIST;
+
+        domain_pause(d);
+        ad->monitor.single_step_enabled = requested_status;
+        domain_unpause(d);
+
+        break;
+    }
+
     case XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL:
     {
         bool_t old_status = ad->monitor.privileged_call_enabled;
@@ -66,6 +80,15 @@ int monitor_smc(void)
     return monitor_traps(current, 1, &req);
 }
 
+int monitor_ss(void)
+{
+    vm_event_request_t req = {
+        .reason = VM_EVENT_REASON_SINGLESTEP,
+    };
+
+    return monitor_traps(current, 1, &req);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 8dfc1d1ec2..0e4ee2956e 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -143,6 +143,7 @@ struct arch_domain
 
     /* Monitor options */
     struct {
+        uint8_t single_step_enabled     : 1;
         uint8_t privileged_call_enabled : 1;
     } monitor;
 }  __cacheline_aligned;
diff --git a/xen/include/asm-arm/monitor.h b/xen/include/asm-arm/monitor.h
index 7567be66bd..66c7fe14fe 100644
--- a/xen/include/asm-arm/monitor.h
+++ b/xen/include/asm-arm/monitor.h
@@ -57,12 +57,15 @@ static inline uint32_t arch_monitor_get_capabilities(struct 
domain *d)
 {
     uint32_t capabilities = 0;
 
-    capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST |
+    capabilities = (1U << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP |
+                    1U << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST |
                     1U << XEN_DOMCTL_MONITOR_EVENT_PRIVILEGED_CALL);
 
     return capabilities;
 }
 
+int monitor_ss(void);
+
 int monitor_smc(void);
 
 #endif /* __ASM_ARM_MONITOR_H__ */
-- 
2.13.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.