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

[Xen-devel] [RFC PATCH 2/4] arm/domctl: Add XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_{ON|OFF}



This commit adds the domctl that is required to enable single-stepping
on ARM.

Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/domctl.c        | 35 +++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/domain.h |  2 ++
 2 files changed, 37 insertions(+)

diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 971caecd58..f640519b5c 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -20,6 +20,28 @@ void arch_get_domain_info(const struct domain *d,
     info->flags |= XEN_DOMINF_hap;
 }
 
+int debug_do_domctl(struct vcpu *v, int32_t op)
+{
+    int rc;
+
+    switch ( op )
+    {
+    case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
+    case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
+        /* XXX: check whether the cpu supports singlestepping. */
+
+        rc = 0;
+        vcpu_pause(v);
+        v->arch.single_step = (op == XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON);
+        vcpu_unpause(v); /* guest will latch new state */
+        break;
+    default:
+        rc = -ENOSYS;
+    }
+
+    return rc;
+}
+
 long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
 {
@@ -114,6 +136,19 @@ long arch_do_domctl(struct xen_domctl *domctl, struct 
domain *d,
 
         return 0;
     }
+    case XEN_DOMCTL_debug_op:
+    {
+        struct vcpu *v;
+
+        if ( (domctl->u.debug_op.vcpu >= d->max_vcpus) ||
+             ((v = d->vcpu[domctl->u.debug_op.vcpu]) == NULL) )
+            return -EINVAL;
+
+        if ( (v == current) )
+            return -EINVAL;
+
+        return debug_do_domctl(v, domctl->u.debug_op.op);
+    }
 
     case XEN_DOMCTL_disable_migrate:
         d->disable_migrate = domctl->u.disable_migrate.disable;
diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h
index 0e4ee2956e..105bad0b5b 100644
--- a/xen/include/asm-arm/domain.h
+++ b/xen/include/asm-arm/domain.h
@@ -282,6 +282,8 @@ struct arch_vcpu
     struct vtimer phys_timer;
     struct vtimer virt_timer;
     bool_t vtimer_initialized;
+
+    bool single_step;
 }  __cacheline_aligned;
 
 void vcpu_show_execution_state(struct vcpu *);
-- 
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®.