# HG changeset patch # User tristan.gingold@xxxxxxxx # Node ID 240375de0c632beb71146c968424e8141baf4e1d # Parent 4f36357947d7c17a582e8993b7053956aa7228a0 vcpu_regs defined in ptrace.h (get regs from vcpu). Manual conversions and duplicate declarations removed. diff -r 4f36357947d7 -r 240375de0c63 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 13:56:27 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 240375de0c63 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 13:56:27 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 240375de0c63 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 13:56:27 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 240375de0c63 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 13:56:27 2005 @@ -98,6 +98,19 @@ #ifdef XEN #include #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 240375de0c63 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 13:56:27 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)