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

[Xen-changelog] Implement direct iret to guest kernel where possible in HYPERVISOR_IRET macro.



# HG changeset patch
# User Ian.Campbell@xxxxxxxxxxxxx
# Node ID e0f563e8db9fb9e15f3a28068d217eca24ad0960
# Parent  e33ebd1437675bc2a4a01f63de359783fc14653f
Implement direct iret to guest kernel where possible in HYPERVISOR_IRET macro.

Returns to guest userspace and from an NMI must still go via the hypervisor.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>

diff -r e33ebd143767 -r e0f563e8db9f 
linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Fri Feb 24 
09:29:09 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Fri Feb 24 
11:05:52 2006
@@ -61,6 +61,8 @@
 #ifndef CONFIG_PREEMPT
 #define retint_kernel retint_restore_args
 #endif 
+
+NMI_MASK = 0x80000000
        
 /*
  * C code is not supposed to know about undefined top of stack. Every time 
@@ -143,6 +145,18 @@
          * #define VGCF_IN_SYSCALL (1<<8) 
          */
        .macro HYPERVISOR_IRET flag
+       testb $3,1*8(%rsp)
+       jnz   1f
+       testl $NMI_MASK,2*8(%rsp)
+       jnz   1f
+
+       /* Direct iret to kernel space. Correct CS and SS. */
+       orb   $3,1*8(%rsp)
+       orb   $3,4*8(%rsp)
+       iretq
+
+1:     /* Slow iret via hypervisor. */
+       andl  $~NMI_MASK, 16(%rsp)
        pushq $\flag
        jmp  hypercall_page + (__HYPERVISOR_iret * 32)
        .endm
@@ -805,6 +819,7 @@
 ENTRY(do_nmi_callback)
         addq $8, %rsp
         call do_nmi
+        orl  $NMI_MASK,EFLAGS(%rsp)
         RESTORE_REST
         XEN_BLOCK_EVENTS(%rsi)
         GET_THREAD_INFO(%rcx)

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