ia64/xen-unstable

changeset 15412:1fd90169f268

[MINIOS][IA64] mini-os without linux-optimization in hypervisor

Make mini-os runnable again without the special linux optimization for the
identity mapping in the hypervisor.

Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
author Alex Williamson <alex.williamson@hp.com>
date Tue Jun 26 16:24:41 2007 -0600 (2007-06-26)
parents 2a7339251e4d
children eb21b7274ab8
files extras/mini-os/arch/ia64/ia64.S extras/mini-os/arch/ia64/ivt.S extras/mini-os/include/ia64/ia64_cpu.h
line diff
     1.1 --- a/extras/mini-os/arch/ia64/ia64.S	Tue Jun 26 16:18:28 2007 -0600
     1.2 +++ b/extras/mini-os/arch/ia64/ia64.S	Tue Jun 26 16:24:41 2007 -0600
     1.3 @@ -105,7 +105,7 @@ ENTRY(_start)
     1.4  	/*
     1.5  	 * Now pin mappings into the TLB for kernel text and data
     1.6  	 */
     1.7 -	mov	r18=KERNEL_TR_PAGE_SIZE<<2
     1.8 +	mov	r18=KERNEL_TR_PAGE_SIZE<<IA64_ITIR_PS
     1.9  	movl	r17=KERNEL_START
    1.10  	;;
    1.11  	mov	cr.itir=r18
    1.12 @@ -204,7 +204,10 @@ 1:	/* now we are in virtual mode */
    1.13  	;;
    1.14  	or	out0=r16, r15			// make a region 7 address
    1.15  	;;
    1.16 -
    1.17 +	ssm	psr.i | psr.ic
    1.18 +	;;
    1.19 +	srlz.i
    1.20 +	;;
    1.21  	br.call.sptk.many rp=start_kernel
    1.22  	;;
    1.23  	add	r2=3,r0
     2.1 --- a/extras/mini-os/arch/ia64/ivt.S	Tue Jun 26 16:18:28 2007 -0600
     2.2 +++ b/extras/mini-os/arch/ia64/ivt.S	Tue Jun 26 16:24:41 2007 -0600
     2.3 @@ -587,13 +587,11 @@ END(save_special_regs)
     2.4  
     2.5  
     2.6  ENTRY(hypervisor_callback)
     2.7 -		// Calculate the stack address for storing.
     2.8 -		// Use the kernel stack here because it's mapped wired!
     2.9 -		// -> no nested tlb faults!
    2.10 -	movl	r18=kstack+KSTACK_PAGES * PAGE_SIZE - 16 - TF_SIZE
    2.11 -
    2.12 -	//add	r18=-TF_SIZE,sp
    2.13 -	add	r30=0xabab,r0
    2.14 +	/*
    2.15 +	 * Use the thread stack here for storing the trap frame.
    2.16 +	 * It's not wired mapped, so nested data tlb faults may occur!
    2.17 +	 */
    2.18 +	add	r18=-TF_SIZE,sp
    2.19  	;;
    2.20  {	.mib
    2.21  	nop	0x02
    2.22 @@ -602,7 +600,7 @@ ENTRY(hypervisor_callback)
    2.23  	;;
    2.24  }
    2.25  	add	sp=-16,r18		// the new stack
    2.26 -	alloc	r15=ar.pfs,0,0,1,0	// 1 out for do_trap_error
    2.27 +	alloc	r15=ar.pfs,0,0,1,0	// 1 out for do_hypervisor_callback
    2.28  	;;
    2.29  	mov	out0=r18		// the trap frame
    2.30  	movl	r22=XSI_PSR_IC
    2.31 @@ -617,13 +615,8 @@ ENTRY(hypervisor_callback)
    2.32  	movl	r22=XSI_PSR_IC
    2.33  	;;
    2.34  	st4	[r22]=r0		// rsm psr.ic
    2.35 -
    2.36 -	add	r16=16,sp		// load EF-pointer again
    2.37 +	add	r18=16,sp		// load EF-pointer again
    2.38  	;;
    2.39 -	//mov	r18=sp
    2.40 -	movl	r18=kstack+KSTACK_PAGES * PAGE_SIZE - 16 - TF_SIZE
    2.41 -	;;
    2.42 -
    2.43  			// must have r18-efp, calls rfi at the end.
    2.44  	br.sptk	restore_tf_rse_switch
    2.45  	;;
    2.46 @@ -654,9 +647,7 @@ ENTRY(trap_error)
    2.47  	mov	out0=r18		// the trap frame
    2.48  	add	sp=-16,r18		// C-call abi
    2.49  	;;
    2.50 -
    2.51 -	//bsw.1
    2.52 -	movl r30=XSI_BANKNUM
    2.53 +	movl r30=XSI_BANKNUM		// bsw.1
    2.54  	mov r31=1;;
    2.55  #if defined(BIG_ENDIAN)			// swap because mini-os is in BE
    2.56  	mux1	r31=r31,@rev;;
    2.57 @@ -752,6 +743,7 @@ IVT_ERR(Alternate_Instruction_TLB, 3, 0x
    2.58  
    2.59  IVT_ENTRY(Alternate_Data_TLB, 0x1000)
    2.60  	mov	r30=4			// trap number
    2.61 +adt_common:
    2.62  	mov	r16=cr.ifa		// where did it happen
    2.63  	mov	r31=pr			// save predicates
    2.64  	;;
    2.65 @@ -765,7 +757,7 @@ IVT_ENTRY(Alternate_Data_TLB, 0x1000)
    2.66  //		// No return
    2.67  //
    2.68  //adt_regf_addr:
    2.69 -//	extr.u	r17=r16,60,4	// get region number
    2.70 +//	extr.u	r17=r16,60,4		// get region number
    2.71  //	;;
    2.72  //	cmp.eq	p14,p15=0xf,r17
    2.73  //	;;
    2.74 @@ -799,8 +791,23 @@ adt_reg7_addr:
    2.75  
    2.76  IVT_END(Alternate_Data_TLB)
    2.77  
    2.78 +/*
    2.79 + * Handling of nested data tlb is needed, because in hypervisor_callback()
    2.80 + * the stack is used to store the register trap frame. This stack is allocated
    2.81 + * dynamically (as identity mapped address) and therewidth no tr mapped page!
    2.82 + */
    2.83 +IVT_ENTRY(Data_Nested_TLB, 0x1400)
    2.84  
    2.85 -IVT_ERR(Data_Nested_TLB, 5, 0x1400)
    2.86 +	mov	r30=5			// trap number
    2.87 +	add	r28=-TF_SIZE,sp		// r28 is never used in trap handling
    2.88 +	;;
    2.89 +	mov	cr.ifa=r28
    2.90 +	;;
    2.91 +	br.sptk	adt_common
    2.92 +IVT_END(Data_Nested_TLB)
    2.93 +
    2.94 +
    2.95 +
    2.96  IVT_ERR(Instruction_Key_Miss, 6, 0x1800)
    2.97  IVT_ERR(Data_Key_Miss, 7, 0x1c00)
    2.98  IVT_ERR(Dirty_Bit, 8, 0x2000)
     3.1 --- a/extras/mini-os/include/ia64/ia64_cpu.h	Tue Jun 26 16:18:28 2007 -0600
     3.2 +++ b/extras/mini-os/include/ia64/ia64_cpu.h	Tue Jun 26 16:24:41 2007 -0600
     3.3 @@ -143,11 +143,11 @@
     3.4  
     3.5  #define STARTUP_PSR (IA64_PSR_IT | \
     3.6              	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \
     3.7 -		     IA64_PSR_BN | IA64_PSR_CPL_2 | IA64_PSR_AC)
     3.8 +		     IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC)
     3.9  
    3.10  #define MOS_SYS_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \
    3.11              	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \
    3.12 -		     IA64_PSR_BN | IA64_PSR_CPL_2 | IA64_PSR_AC)
    3.13 +		     IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC)
    3.14  
    3.15  #define MOS_USR_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \
    3.16              	     IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \