ia64/xen-unstable

changeset 8994:e0f563e8db9f

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@xensource.com>
author Ian.Campbell@xensource.com
date Fri Feb 24 11:05:52 2006 +0000 (2006-02-24)
parents e33ebd143767
children 4f838d2ac31a
files linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Feb 24 10:29:09 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S	Fri Feb 24 11:05:52 2006 +0000
     1.3 @@ -61,6 +61,8 @@
     1.4  #ifndef CONFIG_PREEMPT
     1.5  #define retint_kernel retint_restore_args
     1.6  #endif	
     1.7 +
     1.8 +NMI_MASK = 0x80000000
     1.9  	
    1.10  /*
    1.11   * C code is not supposed to know about undefined top of stack. Every time 
    1.12 @@ -143,6 +145,18 @@
    1.13           * #define VGCF_IN_SYSCALL (1<<8) 
    1.14           */
    1.15  	.macro HYPERVISOR_IRET flag
    1.16 +	testb $3,1*8(%rsp)
    1.17 +	jnz   1f
    1.18 +	testl $NMI_MASK,2*8(%rsp)
    1.19 +	jnz   1f
    1.20 +
    1.21 +	/* Direct iret to kernel space. Correct CS and SS. */
    1.22 +	orb   $3,1*8(%rsp)
    1.23 +	orb   $3,4*8(%rsp)
    1.24 +	iretq
    1.25 +
    1.26 +1:	/* Slow iret via hypervisor. */
    1.27 +	andl  $~NMI_MASK, 16(%rsp)
    1.28  	pushq $\flag
    1.29  	jmp  hypercall_page + (__HYPERVISOR_iret * 32)
    1.30  	.endm
    1.31 @@ -805,6 +819,7 @@ ENTRY(nmi)
    1.32  ENTRY(do_nmi_callback)
    1.33          addq $8, %rsp
    1.34          call do_nmi
    1.35 +        orl  $NMI_MASK,EFLAGS(%rsp)
    1.36          RESTORE_REST
    1.37          XEN_BLOCK_EVENTS(%rsi)
    1.38          GET_THREAD_INFO(%rcx)