ia64/xen-unstable

changeset 15737:ae3b1331ce19

Clean up usage of 'current' in do_iret() hypercall.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Aug 09 10:01:17 2007 +0100 (2007-08-09)
parents 484848f240e8
children 918e04a982b8
files xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/compat/traps.c xen/arch/x86/x86_64/traps.c
line diff
     1.1 --- a/xen/arch/x86/x86_32/traps.c	Wed Aug 08 17:50:24 2007 +0100
     1.2 +++ b/xen/arch/x86/x86_32/traps.c	Thu Aug 09 10:01:17 2007 +0100
     1.3 @@ -172,6 +172,7 @@ asmlinkage void do_double_fault(void)
     1.4  unsigned long do_iret(void)
     1.5  {
     1.6      struct cpu_user_regs *regs = guest_cpu_user_regs();
     1.7 +    struct vcpu *v = current;
     1.8      u32 eflags;
     1.9  
    1.10      /* Check worst-case stack frame for overlap with Xen protected area. */
    1.11 @@ -215,10 +216,10 @@ unsigned long do_iret(void)
    1.12      }
    1.13  
    1.14      /* No longer in NMI context. */
    1.15 -    current->nmi_masked = 0;
    1.16 +    v->nmi_masked = 0;
    1.17  
    1.18      /* Restore upcall mask from supplied EFLAGS.IF. */
    1.19 -    current->vcpu_info->evtchn_upcall_mask = !(eflags & X86_EFLAGS_IF);
    1.20 +    vcpu_info(v, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
    1.21  
    1.22      /*
    1.23       * The hypercall exit path will overwrite EAX with this return
    1.24 @@ -228,7 +229,7 @@ unsigned long do_iret(void)
    1.25  
    1.26   exit_and_crash:
    1.27      gdprintk(XENLOG_ERR, "Fatal error\n");
    1.28 -    domain_crash(current->domain);
    1.29 +    domain_crash(v->domain);
    1.30      return 0;
    1.31  }
    1.32  
     2.1 --- a/xen/arch/x86/x86_64/compat/traps.c	Wed Aug 08 17:50:24 2007 +0100
     2.2 +++ b/xen/arch/x86/x86_64/compat/traps.c	Thu Aug 09 10:01:17 2007 +0100
     2.3 @@ -37,6 +37,7 @@ void compat_show_guest_stack(struct cpu_
     2.4  unsigned int compat_iret(void)
     2.5  {
     2.6      struct cpu_user_regs *regs = guest_cpu_user_regs();
     2.7 +    struct vcpu *v = current;
     2.8      u32 eflags;
     2.9  
    2.10      /* Trim stack pointer to 32 bits. */
    2.11 @@ -70,7 +71,7 @@ unsigned int compat_iret(void)
    2.12           * mode frames).
    2.13           */
    2.14          const struct trap_info *ti;
    2.15 -        u32 x, ksp = current->arch.guest_context.kernel_sp - 40;
    2.16 +        u32 x, ksp = v->arch.guest_context.kernel_sp - 40;
    2.17          unsigned int i;
    2.18          int rc = 0;
    2.19  
    2.20 @@ -95,9 +96,9 @@ unsigned int compat_iret(void)
    2.21          if ( rc )
    2.22              goto exit_and_crash;
    2.23          regs->_esp = ksp;
    2.24 -        regs->ss = current->arch.guest_context.kernel_ss;
    2.25 +        regs->ss = v->arch.guest_context.kernel_ss;
    2.26  
    2.27 -        ti = &current->arch.guest_context.trap_ctxt[13];
    2.28 +        ti = &v->arch.guest_context.trap_ctxt[13];
    2.29          if ( TI_GET_IF(ti) )
    2.30              eflags &= ~X86_EFLAGS_IF;
    2.31          regs->_eflags = eflags & ~(X86_EFLAGS_VM|X86_EFLAGS_RF|
    2.32 @@ -121,10 +122,10 @@ unsigned int compat_iret(void)
    2.33          regs->_esp += 16;
    2.34  
    2.35      /* No longer in NMI context. */
    2.36 -    current->nmi_masked = 0;
    2.37 +    v->nmi_masked = 0;
    2.38  
    2.39      /* Restore upcall mask from supplied EFLAGS.IF. */
    2.40 -    vcpu_info(current, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
    2.41 +    vcpu_info(v, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
    2.42  
    2.43      /*
    2.44       * The hypercall exit path will overwrite EAX with this return
    2.45 @@ -134,11 +135,12 @@ unsigned int compat_iret(void)
    2.46  
    2.47   exit_and_crash:
    2.48      gdprintk(XENLOG_ERR, "Fatal error\n");
    2.49 -    domain_crash(current->domain);
    2.50 +    domain_crash(v->domain);
    2.51      return 0;
    2.52  }
    2.53  
    2.54 -static long compat_register_guest_callback(struct compat_callback_register *reg)
    2.55 +static long compat_register_guest_callback(
    2.56 +    struct compat_callback_register *reg)
    2.57  {
    2.58      long ret = 0;
    2.59      struct vcpu *v = current;
    2.60 @@ -175,7 +177,8 @@ static long compat_register_guest_callba
    2.61      return ret;
    2.62  }
    2.63  
    2.64 -static long compat_unregister_guest_callback(struct compat_callback_unregister *unreg)
    2.65 +static long compat_unregister_guest_callback(
    2.66 +    struct compat_callback_unregister *unreg)
    2.67  {
    2.68      long ret;
    2.69  
     3.1 --- a/xen/arch/x86/x86_64/traps.c	Wed Aug 08 17:50:24 2007 +0100
     3.2 +++ b/xen/arch/x86/x86_64/traps.c	Thu Aug 09 10:01:17 2007 +0100
     3.3 @@ -235,10 +235,10 @@ unsigned long do_iret(void)
     3.4      }
     3.5  
     3.6      /* No longer in NMI context. */
     3.7 -    current->nmi_masked = 0;
     3.8 +    v->nmi_masked = 0;
     3.9  
    3.10      /* Restore upcall mask from supplied EFLAGS.IF. */
    3.11 -    vcpu_info(current, evtchn_upcall_mask) = !(iret_saved.rflags & EF_IE);
    3.12 +    vcpu_info(v, evtchn_upcall_mask) = !(iret_saved.rflags & EF_IE);
    3.13  
    3.14      /* Saved %rax gets written back to regs->rax in entry.S. */
    3.15      return iret_saved.rax;