ia64/xen-unstable

changeset 14776:7158623a1b3d

[IA64] Handle NAT bit for dom0 and domU

This fixes ia32 apps running under the IA32-EL.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author Alex Williamson <alex.williamson@hp.com>
date Wed Apr 11 07:24:44 2007 -0600 (2007-04-11)
parents 1bde28f762a6
children a6800d989059
files linux-2.6-xen-sparse/arch/ia64/kernel/asm-offsets.c linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h xen/arch/ia64/xen/hyperprivop.S
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/asm-offsets.c	Mon Apr 09 13:40:25 2007 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/asm-offsets.c	Wed Apr 11 07:24:44 2007 -0600
     1.3 @@ -290,5 +290,7 @@ void foo(void)
     1.4  	DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum);
     1.5  	DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]);
     1.6  	DEFINE_MAPPED_REG_OFS(XSI_BANK1_R16_OFS, bank1_regs[0]);
     1.7 +	DEFINE_MAPPED_REG_OFS(XSI_B0NATS_OFS, vbnat);
     1.8 +	DEFINE_MAPPED_REG_OFS(XSI_B1NATS_OFS, vnat);    
     1.9  #endif /* CONFIG_XEN */
    1.10  }
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Mon Apr 09 13:40:25 2007 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Wed Apr 11 07:24:44 2007 -0600
     2.3 @@ -614,6 +614,7 @@ GLOBAL_ENTRY(ia64_leave_kernel)
     2.4  #ifdef CONFIG_XEN
     2.5  	;;
     2.6  	// r16-r31 all now hold bank1 values
     2.7 +	mov r15=ar.unat
     2.8  	movl r2=XSI_BANK1_R16
     2.9  	movl r3=XSI_BANK1_R16+8
    2.10  	;;
    2.11 @@ -641,6 +642,11 @@ GLOBAL_ENTRY(ia64_leave_kernel)
    2.12  .mem.offset 0,0; st8.spill [r2]=r30,16
    2.13  .mem.offset 8,0; st8.spill [r3]=r31,16
    2.14  	;;
    2.15 +	mov r3=ar.unat
    2.16 +	movl r2=XSI_B1NAT
    2.17 +	;;
    2.18 +	st8 [r2]=r3
    2.19 +	mov ar.unat=r15
    2.20  	movl r2=XSI_BANKNUM;;
    2.21  	st4 [r2]=r0;
    2.22  #else
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S	Mon Apr 09 13:40:25 2007 -0600
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S	Wed Apr 11 07:24:44 2007 -0600
     3.3 @@ -2013,33 +2013,6 @@ END(ia32_interrupt)
     3.4  	DBG_FAULT(66)
     3.5  	FAULT(66)
     3.6  
     3.7 -#ifdef CONFIG_XEN
     3.8 -	/*
     3.9 -	 * There is no particular reason for this code to be here, other than that
    3.10 -	 * there happens to be space here that would go unused otherwise.  If this
    3.11 -	 * fault ever gets "unreserved", simply moved the following code to a more
    3.12 -	 * suitable spot...
    3.13 -	 */
    3.14 -
    3.15 -GLOBAL_ENTRY(xen_bsw1)
    3.16 -	/* FIXME: THIS CODE IS NOT NaT SAFE! */
    3.17 -	movl r30=XSI_BANKNUM;
    3.18 -	mov r31=1;;
    3.19 -	st4 [r30]=r31;
    3.20 -	movl r30=XSI_BANK1_R16;
    3.21 -	movl r31=XSI_BANK1_R16+8;;
    3.22 -	ld8 r16=[r30],16; ld8 r17=[r31],16;;
    3.23 -	ld8 r18=[r30],16; ld8 r19=[r31],16;;
    3.24 -	ld8 r20=[r30],16; ld8 r21=[r31],16;;
    3.25 -	ld8 r22=[r30],16; ld8 r23=[r31],16;;
    3.26 -	ld8 r24=[r30],16; ld8 r25=[r31],16;;
    3.27 -	ld8 r26=[r30],16; ld8 r27=[r31],16;;
    3.28 -	ld8 r28=[r30],16; ld8 r29=[r31],16;;
    3.29 -	ld8 r30=[r30]; ld8 r31=[r31];;
    3.30 -	br.ret.sptk.many b0
    3.31 -END(xen_bsw1)
    3.32 -#endif
    3.33 -
    3.34  	.org ia64_ivt+0x7f00
    3.35  /////////////////////////////////////////////////////////////////////////////////////////
    3.36  // 0x7f00 Entry 67 (size 16 bundles) Reserved
    3.37 @@ -2167,4 +2140,38 @@ 1:
    3.38  	(p6) br.spnt.few 1b	// call evtchn_do_upcall again.
    3.39  	br.sptk.many ia64_leave_kernel   
    3.40  END(xen_event_callback)
    3.41 +
    3.42 +
    3.43 +	/*
    3.44 +	 * There is no particular reason for this code to be here, other than that
    3.45 +	 * there happens to be space here that would go unused otherwise.  If this
    3.46 +	 * fault ever gets "unreserved", simply moved the following code to a more
    3.47 +	 * suitable spot...
    3.48 +	 */
    3.49 +
    3.50 +GLOBAL_ENTRY(xen_bsw1)
    3.51 +	/* FIXME: THIS CODE IS NOT NaT SAFE! */
    3.52 +	mov r14=ar.unat
    3.53 +	movl r30=XSI_B1NAT
    3.54 +	;;
    3.55 +	ld8 r30=[r30];;
    3.56 +	mov ar.unat=r30
    3.57 +	movl r30=XSI_BANKNUM;
    3.58 +	mov r31=1;;
    3.59 +	st4 [r30]=r31;
    3.60 +	movl r30=XSI_BANK1_R16;
    3.61 +	movl r31=XSI_BANK1_R16+8;;
    3.62 +	ld8.fill r16=[r30],16; ld8.fill r17=[r31],16;;
    3.63 +	ld8.fill r18=[r30],16; ld8.fill r19=[r31],16;;
    3.64 +	ld8.fill r20=[r30],16; ld8.fill r21=[r31],16;;
    3.65 +	ld8.fill r22=[r30],16; ld8.fill r23=[r31],16;;
    3.66 +	ld8.fill r24=[r30],16; ld8.fill r25=[r31],16;;
    3.67 +	ld8.fill r26=[r30],16; ld8.fill r27=[r31],16;;
    3.68 +	ld8.fill r28=[r30],16; ld8.fill r29=[r31],16;;
    3.69 +	ld8.fill r30=[r30]; ld8.fill r31=[r31];;
    3.70 +	mov ar.unat=r14
    3.71 +	br.ret.sptk.many b0
    3.72 +END(xen_bsw1)
    3.73 +
    3.74 +   
    3.75  #endif
     4.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Mon Apr 09 13:40:25 2007 -0600
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Wed Apr 11 07:24:44 2007 -0600
     4.3 @@ -57,6 +57,7 @@
     4.4  #define XSI_PSR_IC		(XSI_BASE + XSI_PSR_IC_OFS)
     4.5  #define XSI_IPSR		(XSI_BASE + XSI_IPSR_OFS)
     4.6  #define XSI_IIP			(XSI_BASE + XSI_IIP_OFS)
     4.7 +#define XSI_B1NAT		(XSI_BASE + XSI_B1NATS_OFS)
     4.8  #define XSI_BANK1_R16		(XSI_BASE + XSI_BANK1_R16_OFS)
     4.9  #define XSI_BANKNUM		(XSI_BASE + XSI_BANKNUM_OFS)
    4.10  #define XSI_IHA			(XSI_BASE + XSI_IHA_OFS)
     5.1 --- a/xen/arch/ia64/xen/hyperprivop.S	Mon Apr 09 13:40:25 2007 -0600
     5.2 +++ b/xen/arch/ia64/xen/hyperprivop.S	Wed Apr 11 07:24:44 2007 -0600
     5.3 @@ -304,6 +304,8 @@ ENTRY(hyper_ssm_i)
     5.4  	;;
     5.5  	adds r2=XSI_BANK1_R16_OFS-XSI_PSR_IC_OFS,r18;
     5.6  	adds r3=(XSI_BANK1_R16_OFS+8)-XSI_PSR_IC_OFS,r18;;
     5.7 +	// temporarily save ar.unat
     5.8 +	mov r28=ar.unat   
     5.9  	bsw.1;;
    5.10  	// FIXME?: ar.unat is not really handled correctly,
    5.11  	// but may not matter if the OS is NaT-clean
    5.12 @@ -324,6 +326,12 @@ ENTRY(hyper_ssm_i)
    5.13  	.mem.offset 0,0; st8.spill [r2]=r30,16;
    5.14  	.mem.offset 8,0; st8.spill [r3]=r31,16 ;;
    5.15  	bsw.0 ;;
    5.16 +	mov r27=ar.unat
    5.17 +	adds r26=XSI_B1NATS_OFS-XSI_PSR_IC_OFS,r18 ;;
    5.18 +	//save bank1 ar.unat
    5.19 +	st8 [r26]=r27
    5.20 +	//restore ar.unat
    5.21 +	mov ar.unat=r28
    5.22  	mov r2=r30
    5.23  	mov r3=r29
    5.24  	adds r20=XSI_BANKNUM_OFS-XSI_PSR_IC_OFS,r18 ;;