ia64/xen-unstable

changeset 16771:e8d933b33f4b

[IA64] Fix ia64_reload_tr in mca_asm.S

- DTR for stack comparison should be done with xen heap.
- cpu_kr current offset contains (physicall address >> IA64_GRANULE_SHIFT)
so the comparison was done with the wrong value.
- When mapping VHPT area, overlapping should be avoided.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu Jan 17 12:05:43 2008 -0700 (2008-01-17)
parents fd56e24b07c8
children 64653720c9e4
files xen/arch/ia64/linux-xen/mca_asm.S
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/mca_asm.S	Thu Jan 17 12:05:43 2008 -0700
     1.2 +++ b/xen/arch/ia64/linux-xen/mca_asm.S	Thu Jan 17 12:05:43 2008 -0700
     1.3 @@ -479,14 +479,26 @@ ia64_reload_tr:
     1.4  	;;
     1.5  	// 4. Reload DTR for stack.
     1.6  #ifdef XEN
     1.7 -	// avoid overlapping with kernel TR
     1.8 -	movl r17=KERNEL_START
     1.9 +	// avoid overlapping with xenheap TR
    1.10 +	mov r17=ip
    1.11 +	;;
    1.12 +	tpa r17=r17
    1.13 +	;;
    1.14 +	dep r17=0,r17,0,KERNEL_TR_PAGE_SHIFT
    1.15 +	;;
    1.16 +	shr.u r17=r17,IA64_GRANULE_SHIFT
    1.17 +	;; 
    1.18  	GET_THIS_PADDR(r2,cpu_kr);;
    1.19  	add r2=IA64_KR_CURRENT_OFFSET,r2;;
    1.20  	ld8 r16=[r2];;
    1.21  	;;
    1.22 -	dep  r16=0,r16,0,KERNEL_TR_PAGE_SHIFT
    1.23 +#if KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT
    1.24 +# error "KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT shouldn't happen"
    1.25 +#endif
    1.26 +#if KERNEL_TR_PAGE_SHIFT > IA64_GRANULE_SHIFT
    1.27 +	dep  r16=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT
    1.28  	;;
    1.29 +#endif
    1.30  	cmp.eq p7,p0=r17,r16
    1.31  (p7)	br.cond.sptk	.reload_vhpt
    1.32  	
    1.33 @@ -522,6 +534,25 @@ ia64_reload_tr:
    1.34  	// 5. VHPT
    1.35  #if VHPT_ENABLED
    1.36  	GET_VA_VCPU_VHPT_MADDR(r2,r3);;
    1.37 +	dep r3=0,r2,0,KERNEL_TR_PAGE_SHIFT
    1.38 +	;;
    1.39 +	shr.u r3=r3,IA64_GRANULE_SHIFT
    1.40 +	;;
    1.41 +	cmp.eq p7,p0=r3,r17
    1.42 +(p7)	br.cond.sptk	.overlap_vhpt
    1.43 +	;;
    1.44 +
    1.45 +	// avoid overlapping with stack TR
    1.46 +	shr.u r17=r2,IA64_GRANULE_SHIFT
    1.47 +	GET_THIS_PADDR(r3, cpu_kr);;
    1.48 +	add r3=IA64_KR_CURRENT_STACK_OFFSET,r3
    1.49 +	;;
    1.50 +	ld8 r3=[r3]
    1.51 +	;;
    1.52 +	cmp.eq p7,p0=r3,r17
    1.53 +(p7)	br.cond.sptk	.overlap_vhpt
    1.54 +	;;
    1.55 +
    1.56  	dep r16=0,r2,0,IA64_GRANULE_SHIFT
    1.57  	movl r20=PAGE_KERNEL
    1.58  	;;
    1.59 @@ -538,6 +569,7 @@ ia64_reload_tr:
    1.60  	;;
    1.61  	srlz.d
    1.62  	;;
    1.63 +.overlap_vhpt:
    1.64  #endif
    1.65  #endif
    1.66  	br.sptk.many done_tlb_purge_and_reload