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

[Xen-changelog] [xen master] x86: streamline hypercall_create_continuation()



commit c109909720fa49cc1bb71c729fd5a14e17163306
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Jan 9 17:25:55 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 9 17:25:55 2015 +0100

    x86: streamline hypercall_create_continuation()
    
    - drop clearing of excessive multicall arguments in compat case (no
      longer needed now that hypercall_xlat_continuation() only checks the
      actual arguments)
    - latch current into a local variable
    - use the cached value of hvm_guest_x86_mode() instead of re-executing
      it
    - scope restrict "regs"
    - while at it, convert the remaining two argument checking BUG_ON()s in
      hypercall_xlat_continuation() to ASSERT()s
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Tim Deegan <tim@xxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/domain.c |   27 +++++++++++----------------
 1 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index b699510..c8832c6 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1675,7 +1675,6 @@ unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...)
 {
     struct mc_state *mcs = &current->mc_state;
-    struct cpu_user_regs *regs;
     const char *p = format;
     unsigned long arg;
     unsigned int i;
@@ -1689,26 +1688,23 @@ unsigned long hypercall_create_continuation(
 
         for ( i = 0; *p != '\0'; i++ )
             mcs->call.args[i] = next_arg(p, args);
-        if ( is_pv_32on64_domain(current->domain) )
-        {
-            for ( ; i < 6; i++ )
-                mcs->call.args[i] = 0;
-        }
     }
     else
     {
-        regs       = guest_cpu_user_regs();
-        regs->eax  = op;
+        struct cpu_user_regs *regs = guest_cpu_user_regs();
+        struct vcpu *curr = current;
+
+        regs->eax = op;
 
         /* Ensure the hypercall trap instruction is re-executed. */
-        if ( is_pv_vcpu(current) )
+        if ( is_pv_vcpu(curr) )
             regs->eip -= 2;  /* re-execute 'syscall' / 'int $xx' */
         else
-            current->arch.hvm_vcpu.hcall_preempted = 1;
+            curr->arch.hvm_vcpu.hcall_preempted = 1;
 
-        if ( is_pv_vcpu(current) ?
-             !is_pv_32on64_vcpu(current) :
-             (hvm_guest_x86_mode(current) == 8) )
+        if ( is_pv_vcpu(curr) ?
+             !is_pv_32on64_vcpu(curr) :
+             curr->arch.hvm_vcpu.hcall_64bit )
         {
             for ( i = 0; *p != '\0'; i++ )
             {
@@ -1759,9 +1755,8 @@ int hypercall_xlat_continuation(unsigned int *id, 
unsigned int nr,
 
     ASSERT(nr <= ARRAY_SIZE(mcs->call.args));
     ASSERT(!(mask >> nr));
-
-    BUG_ON(id && *id >= nr);
-    BUG_ON(id && (mask & (1U << *id)));
+    ASSERT(!id || *id < nr);
+    ASSERT(!id || !(mask & (1U << *id)));
 
     va_start(args, mask);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.