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

[Xen-changelog] [xen-unstable] hvm: Save/restore register state across hypercalls.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1178721097 -3600
# Node ID 8df600f56acd31b28ee7d514812605ef8e1862a4
# Parent  00618037d37d04e614080d3067cc5ba6b1b1ef9e
hvm: Save/restore register state across hypercalls.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff -r 00618037d37d -r 8df600f56acd xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Wed May 09 14:17:15 2007 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Wed May 09 15:31:37 2007 +0100
@@ -778,14 +778,16 @@ static void __hvm_do_hypercall(struct cp
 
 #endif /* defined(__x86_64__) */
 
-int hvm_do_hypercall(struct cpu_user_regs *pregs)
+int hvm_do_hypercall(struct cpu_user_regs *regs)
 {
     int flush, preempted;
     unsigned long old_eip;
 
-    if ( unlikely(ring_3(pregs)) )
-    {
-        pregs->eax = -EPERM;
+    hvm_store_cpu_guest_regs(current, regs, NULL);
+
+    if ( unlikely(ring_3(regs)) )
+    {
+        regs->eax = -EPERM;
         return 0;
     }
 
@@ -794,16 +796,18 @@ int hvm_do_hypercall(struct cpu_user_reg
      * For now we also need to flush when pages are added, as qemu-dm is not
      * yet capable of faulting pages into an existing valid mapcache bucket.
      */
-    flush = ((uint32_t)pregs->eax == __HYPERVISOR_memory_op);
+    flush = ((uint32_t)regs->eax == __HYPERVISOR_memory_op);
 
     /* Check for preemption: RIP will be modified from this dummy value. */
-    old_eip = pregs->eip;
-    pregs->eip = 0xF0F0F0FF;
-
-    __hvm_do_hypercall(pregs);
-
-    preempted = (pregs->eip != 0xF0F0F0FF);
-    pregs->eip = old_eip;
+    old_eip = regs->eip;
+    regs->eip = 0xF0F0F0FF;
+
+    __hvm_do_hypercall(regs);
+
+    preempted = (regs->eip != 0xF0F0F0FF);
+    regs->eip = old_eip;
+
+    hvm_load_cpu_guest_regs(current, regs);
 
     return (preempted ? HVM_HCALL_preempted :
             flush ? HVM_HCALL_invalidate : HVM_HCALL_completed);

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