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

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



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1178721175 -3600
# Node ID c00b2ab8af2ccbb043ba7bd8c965c0682f1c7f10
# Parent  97286205ee2631e3eb811d2001388892ddd1076c
hvm: Save/restore register state across hypercalls.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

xen-unstable changeset:   15022:8df600f56acd31b28ee7d514812605ef8e1862a4
xen-unstable date:        Wed May 09 15:31:37 2007 +0100
---
 xen/arch/x86/hvm/hvm.c |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff -r 97286205ee26 -r c00b2ab8af2c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue May 08 13:39:52 2007 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Wed May 09 15:32:55 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®.