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

[Xen-changelog] [xen-unstable] Clean up usage of 'current' in do_iret() hypercall.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1186650077 -3600
# Node ID ae3b1331ce19ce6bc985e8ce56084a934cf65e6b
# Parent  484848f240e80cd403b0425fa35d7257bbc18cc2
Clean up usage of 'current' in do_iret() hypercall.
Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_32/traps.c        |    7 ++++---
 xen/arch/x86/x86_64/compat/traps.c |   21 ++++++++++++---------
 xen/arch/x86/x86_64/traps.c        |    4 ++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff -r 484848f240e8 -r ae3b1331ce19 xen/arch/x86/x86_32/traps.c
--- a/xen/arch/x86/x86_32/traps.c       Wed Aug 08 17:50:24 2007 +0100
+++ b/xen/arch/x86/x86_32/traps.c       Thu Aug 09 10:01:17 2007 +0100
@@ -172,6 +172,7 @@ unsigned long do_iret(void)
 unsigned long do_iret(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
+    struct vcpu *v = current;
     u32 eflags;
 
     /* Check worst-case stack frame for overlap with Xen protected area. */
@@ -215,10 +216,10 @@ unsigned long do_iret(void)
     }
 
     /* No longer in NMI context. */
-    current->nmi_masked = 0;
+    v->nmi_masked = 0;
 
     /* Restore upcall mask from supplied EFLAGS.IF. */
-    current->vcpu_info->evtchn_upcall_mask = !(eflags & X86_EFLAGS_IF);
+    vcpu_info(v, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
 
     /*
      * The hypercall exit path will overwrite EAX with this return
@@ -228,7 +229,7 @@ unsigned long do_iret(void)
 
  exit_and_crash:
     gdprintk(XENLOG_ERR, "Fatal error\n");
-    domain_crash(current->domain);
+    domain_crash(v->domain);
     return 0;
 }
 
diff -r 484848f240e8 -r ae3b1331ce19 xen/arch/x86/x86_64/compat/traps.c
--- a/xen/arch/x86/x86_64/compat/traps.c        Wed Aug 08 17:50:24 2007 +0100
+++ b/xen/arch/x86/x86_64/compat/traps.c        Thu Aug 09 10:01:17 2007 +0100
@@ -37,6 +37,7 @@ unsigned int compat_iret(void)
 unsigned int compat_iret(void)
 {
     struct cpu_user_regs *regs = guest_cpu_user_regs();
+    struct vcpu *v = current;
     u32 eflags;
 
     /* Trim stack pointer to 32 bits. */
@@ -70,7 +71,7 @@ unsigned int compat_iret(void)
          * mode frames).
          */
         const struct trap_info *ti;
-        u32 x, ksp = current->arch.guest_context.kernel_sp - 40;
+        u32 x, ksp = v->arch.guest_context.kernel_sp - 40;
         unsigned int i;
         int rc = 0;
 
@@ -95,9 +96,9 @@ unsigned int compat_iret(void)
         if ( rc )
             goto exit_and_crash;
         regs->_esp = ksp;
-        regs->ss = current->arch.guest_context.kernel_ss;
-
-        ti = &current->arch.guest_context.trap_ctxt[13];
+        regs->ss = v->arch.guest_context.kernel_ss;
+
+        ti = &v->arch.guest_context.trap_ctxt[13];
         if ( TI_GET_IF(ti) )
             eflags &= ~X86_EFLAGS_IF;
         regs->_eflags = eflags & ~(X86_EFLAGS_VM|X86_EFLAGS_RF|
@@ -121,10 +122,10 @@ unsigned int compat_iret(void)
         regs->_esp += 16;
 
     /* No longer in NMI context. */
-    current->nmi_masked = 0;
+    v->nmi_masked = 0;
 
     /* Restore upcall mask from supplied EFLAGS.IF. */
-    vcpu_info(current, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
+    vcpu_info(v, evtchn_upcall_mask) = !(eflags & X86_EFLAGS_IF);
 
     /*
      * The hypercall exit path will overwrite EAX with this return
@@ -134,11 +135,12 @@ unsigned int compat_iret(void)
 
  exit_and_crash:
     gdprintk(XENLOG_ERR, "Fatal error\n");
-    domain_crash(current->domain);
+    domain_crash(v->domain);
     return 0;
 }
 
-static long compat_register_guest_callback(struct compat_callback_register 
*reg)
+static long compat_register_guest_callback(
+    struct compat_callback_register *reg)
 {
     long ret = 0;
     struct vcpu *v = current;
@@ -175,7 +177,8 @@ static long compat_register_guest_callba
     return ret;
 }
 
-static long compat_unregister_guest_callback(struct compat_callback_unregister 
*unreg)
+static long compat_unregister_guest_callback(
+    struct compat_callback_unregister *unreg)
 {
     long ret;
 
diff -r 484848f240e8 -r ae3b1331ce19 xen/arch/x86/x86_64/traps.c
--- a/xen/arch/x86/x86_64/traps.c       Wed Aug 08 17:50:24 2007 +0100
+++ b/xen/arch/x86/x86_64/traps.c       Thu Aug 09 10:01:17 2007 +0100
@@ -235,10 +235,10 @@ unsigned long do_iret(void)
     }
 
     /* No longer in NMI context. */
-    current->nmi_masked = 0;
+    v->nmi_masked = 0;
 
     /* Restore upcall mask from supplied EFLAGS.IF. */
-    vcpu_info(current, evtchn_upcall_mask) = !(iret_saved.rflags & EF_IE);
+    vcpu_info(v, evtchn_upcall_mask) = !(iret_saved.rflags & EF_IE);
 
     /* Saved %rax gets written back to regs->rax in entry.S. */
     return iret_saved.rax;

_______________________________________________
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®.