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

[Xen-changelog] vcpu_regs defined in ptrace.h (get regs from vcpu). Manual conversions and duplicate declarations removed. (by Tristan Gingold)



# HG changeset patch
# User djm@xxxxxxxxxxxxxxx
# Node ID 3eaab414bdfdb850c6d2e1451410cce82b89a9f9
# Parent  4f36357947d7c17a582e8993b7053956aa7228a0
vcpu_regs defined in ptrace.h (get regs from vcpu).  Manual conversions and 
duplicate declarations removed. (by Tristan Gingold)

diff -r 4f36357947d7 -r 3eaab414bdfd xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Wed Nov 23 02:48:14 2005
+++ b/xen/arch/ia64/xen/domain.c        Wed Nov 23 20:43:05 2005
@@ -165,7 +165,7 @@
 
 static void init_switch_stack(struct vcpu *v)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + 
IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
        struct switch_stack *sw = (struct switch_stack *) regs - 1;
        extern void ia64_ret_from_clone;
 
@@ -253,7 +253,7 @@
 
 void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + 
IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
 
        printf("arch_getdomaininfo_ctxt\n");
        c->regs = *regs;
@@ -264,7 +264,7 @@
 
 int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
 {
-       struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + 
IA64_STK_OFFSET) - 1;
+       struct pt_regs *regs = vcpu_regs (v);
        struct domain *d = v->domain;
        int i, rc, ret;
        unsigned long progress = 0;
@@ -335,7 +335,7 @@
        if (d == dom0) start_pc += dom0_start;
 #endif
 
-       regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+       regs = vcpu_regs (v);
        if (VMX_DOMAIN(v)) {
                /* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */
                regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro 
*/
diff -r 4f36357947d7 -r 3eaab414bdfd xen/arch/ia64/xen/vcpu.c
--- a/xen/arch/ia64/xen/vcpu.c  Wed Nov 23 02:48:14 2005
+++ b/xen/arch/ia64/xen/vcpu.c  Wed Nov 23 20:43:05 2005
@@ -33,7 +33,6 @@
 
 // this def for vcpu_regs won't work if kernel stack is present
 //#define      vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs
-#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + 
IA64_STK_OFFSET)) - 1)
 #define        PSCB(x,y)       VCPU(x,y)
 #define        PSCBX(x,y)      x->arch.y
 
diff -r 4f36357947d7 -r 3eaab414bdfd xen/arch/ia64/xen/xenmisc.c
--- a/xen/arch/ia64/xen/xenmisc.c       Wed Nov 23 02:48:14 2005
+++ b/xen/arch/ia64/xen/xenmisc.c       Wed Nov 23 20:43:05 2005
@@ -72,7 +72,7 @@
 void grant_table_destroy(struct domain *d) { return; }
 #endif
 
-struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
+struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
 
 void raise_actimer_softirq(void)
 {
diff -r 4f36357947d7 -r 3eaab414bdfd xen/include/asm-ia64/linux-xen/asm/ptrace.h
--- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h       Wed Nov 23 02:48:14 2005
+++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h       Wed Nov 23 20:43:05 2005
@@ -98,6 +98,19 @@
 #ifdef XEN
 #include <public/arch-ia64.h>
 #define pt_regs cpu_user_regs
+
+/*  User regs at placed at the end of the vcpu area.
+    Convert a vcpu pointer to a regs pointer.
+    Note: this is the same as ia64_task_regs, but it uses a Xen-friendly name.
+*/
+struct vcpu;
+static inline struct cpu_user_regs *
+vcpu_regs (struct vcpu *v)
+{
+  return (struct cpu_user_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
+}
+
+
 #else
 struct pt_regs {
        /* The following registers are saved by SAVE_MIN: */
diff -r 4f36357947d7 -r 3eaab414bdfd xen/include/asm-ia64/vmx_vcpu.h
--- a/xen/include/asm-ia64/vmx_vcpu.h   Wed Nov 23 02:48:14 2005
+++ b/xen/include/asm-ia64/vmx_vcpu.h   Wed Nov 23 20:43:05 2005
@@ -44,8 +44,6 @@
 #define VRN7    0x7UL
 // for vlsapic
 #define  VLSAPIC_INSVC(vcpu, i) ((vcpu)->arch.insvc[i])
-// this def for vcpu_regs won't work if kernel stack is present
-#define        vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + 
IA64_STK_OFFSET)) - 1)
 //#define      VMX_VPD(x,y)    ((x)->arch.arch_vmx.vpd->y)
 
 #define VMX(x,y)  ((x)->arch.arch_vmx.y)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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