ia64/xen-unstable

changeset 7921:3eaab414bdfd

vcpu_regs defined in ptrace.h (get regs from vcpu). Manual conversions and duplicate declarations removed. (by Tristan Gingold)
author djm@kirby.fc.hp.com
date Wed Nov 23 14:43:05 2005 -0600 (2005-11-23)
parents 4f36357947d7
children 0ee00faf332d
files xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/vcpu.c xen/arch/ia64/xen/xenmisc.c xen/include/asm-ia64/linux-xen/asm/ptrace.h xen/include/asm-ia64/vmx_vcpu.h
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Tue Nov 22 20:48:14 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Nov 23 14:43:05 2005 -0600
     1.3 @@ -165,7 +165,7 @@ void free_vcpu_struct(struct vcpu *v)
     1.4  
     1.5  static void init_switch_stack(struct vcpu *v)
     1.6  {
     1.7 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
     1.8 +	struct pt_regs *regs = vcpu_regs (v);
     1.9  	struct switch_stack *sw = (struct switch_stack *) regs - 1;
    1.10  	extern void ia64_ret_from_clone;
    1.11  
    1.12 @@ -253,7 +253,7 @@ void arch_do_createdomain(struct vcpu *v
    1.13  
    1.14  void arch_getdomaininfo_ctxt(struct vcpu *v, struct vcpu_guest_context *c)
    1.15  {
    1.16 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
    1.17 +	struct pt_regs *regs = vcpu_regs (v);
    1.18  
    1.19  	printf("arch_getdomaininfo_ctxt\n");
    1.20  	c->regs = *regs;
    1.21 @@ -264,7 +264,7 @@ void arch_getdomaininfo_ctxt(struct vcpu
    1.22  
    1.23  int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
    1.24  {
    1.25 -	struct pt_regs *regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
    1.26 +	struct pt_regs *regs = vcpu_regs (v);
    1.27  	struct domain *d = v->domain;
    1.28  	int i, rc, ret;
    1.29  	unsigned long progress = 0;
    1.30 @@ -335,7 +335,7 @@ void new_thread(struct vcpu *v,
    1.31  	if (d == dom0) start_pc += dom0_start;
    1.32  #endif
    1.33  
    1.34 -	regs = (struct pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
    1.35 +	regs = vcpu_regs (v);
    1.36  	if (VMX_DOMAIN(v)) {
    1.37  		/* dt/rt/it:1;i/ic:1, si:1, vm/bn:1, ac:1 */
    1.38  		regs->cr_ipsr = 0x501008826008; /* Need to be expanded as macro */
     2.1 --- a/xen/arch/ia64/xen/vcpu.c	Tue Nov 22 20:48:14 2005 -0600
     2.2 +++ b/xen/arch/ia64/xen/vcpu.c	Wed Nov 23 14:43:05 2005 -0600
     2.3 @@ -33,7 +33,6 @@ typedef	union {
     2.4  
     2.5  // this def for vcpu_regs won't work if kernel stack is present
     2.6  //#define	vcpu_regs(vcpu) ((struct pt_regs *) vcpu->arch.regs
     2.7 -#define vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
     2.8  #define	PSCB(x,y)	VCPU(x,y)
     2.9  #define	PSCBX(x,y)	x->arch.y
    2.10  
     3.1 --- a/xen/arch/ia64/xen/xenmisc.c	Tue Nov 22 20:48:14 2005 -0600
     3.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Wed Nov 23 14:43:05 2005 -0600
     3.3 @@ -72,7 +72,7 @@ int grant_table_create(struct domain *d)
     3.4  void grant_table_destroy(struct domain *d) { return; }
     3.5  #endif
     3.6  
     3.7 -struct pt_regs *guest_cpu_user_regs(void) { return ia64_task_regs(current); }
     3.8 +struct pt_regs *guest_cpu_user_regs(void) { return vcpu_regs(current); }
     3.9  
    3.10  void raise_actimer_softirq(void)
    3.11  {
     4.1 --- a/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Tue Nov 22 20:48:14 2005 -0600
     4.2 +++ b/xen/include/asm-ia64/linux-xen/asm/ptrace.h	Wed Nov 23 14:43:05 2005 -0600
     4.3 @@ -98,6 +98,19 @@
     4.4  #ifdef XEN
     4.5  #include <public/arch-ia64.h>
     4.6  #define pt_regs cpu_user_regs
     4.7 +
     4.8 +/*  User regs at placed at the end of the vcpu area.
     4.9 +    Convert a vcpu pointer to a regs pointer.
    4.10 +    Note: this is the same as ia64_task_regs, but it uses a Xen-friendly name.
    4.11 +*/
    4.12 +struct vcpu;
    4.13 +static inline struct cpu_user_regs *
    4.14 +vcpu_regs (struct vcpu *v)
    4.15 +{
    4.16 +  return (struct cpu_user_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1;
    4.17 +}
    4.18 +
    4.19 +
    4.20  #else
    4.21  struct pt_regs {
    4.22  	/* The following registers are saved by SAVE_MIN: */
     5.1 --- a/xen/include/asm-ia64/vmx_vcpu.h	Tue Nov 22 20:48:14 2005 -0600
     5.2 +++ b/xen/include/asm-ia64/vmx_vcpu.h	Wed Nov 23 14:43:05 2005 -0600
     5.3 @@ -44,8 +44,6 @@
     5.4  #define VRN7    0x7UL
     5.5  // for vlsapic
     5.6  #define  VLSAPIC_INSVC(vcpu, i) ((vcpu)->arch.insvc[i])
     5.7 -// this def for vcpu_regs won't work if kernel stack is present
     5.8 -#define	vcpu_regs(vcpu) (((struct pt_regs *) ((char *) (vcpu) + IA64_STK_OFFSET)) - 1)
     5.9  //#define	VMX_VPD(x,y)	((x)->arch.arch_vmx.vpd->y)
    5.10  
    5.11  #define VMX(x,y)  ((x)->arch.arch_vmx.y)