Index: xen-unstable.hg/xen/arch/ia64/linux-xen/entry.S
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/entry.S	2007-12-06 12:22:27.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/linux-xen/entry.S	2007-12-06 12:22:38.000000000 +0900
@@ -259,6 +259,16 @@ GLOBAL_ENTRY(ia64_switch_to)
 (p7)	movl r8=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
 (p7)	st8 [r8]=r26
 (p7)	br.cond.sptk .done
+	// avoid overlapping with xen heap TR
+	// XXX: Fixme: needs to be calculated
+	movl r25=XEN_HEAP_ADDR
+	dep  r23=0,in0,0,KERNEL_TR_PAGE_SHIFT
+	;;
+	cmp.eq p7,p0=r25,r23
+	;;
+(p7)	movl r8=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
+(p7)	st8 [r8]=r26
+(p7)	br.cond.sptk .done
 #endif
 	rsm psr.ic			// interrupts (psr.i) are already disabled here
 	movl r25=PAGE_KERNEL
