diff -Naur linux-2.6.12/arch/ia64/hp/sim/Makefile linux-2.6.12-XenPatch/arch/ia64/hp/sim/Makefile
--- linux-2.6.12/arch/ia64/hp/sim/Makefile	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/hp/sim/Makefile	2005-07-14 14:35:54.000000000 -0600
@@ -14,3 +14,5 @@
 obj-$(CONFIG_HP_SIMSERIAL) += simserial.o
 obj-$(CONFIG_HP_SIMSERIAL_CONSOLE) += hpsim_console.o
 obj-$(CONFIG_HP_SIMSCSI) += simscsi.o
+obj-$(CONFIG_XEN) += simserial.o
+obj-$(CONFIG_XEN) += hpsim_console.o
diff -Naur linux-2.6.12/arch/ia64/ia32/elfcore32.h linux-2.6.12-XenPatch/arch/ia64/ia32/elfcore32.h
--- linux-2.6.12/arch/ia64/ia32/elfcore32.h	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/ia32/elfcore32.h	2005-07-14 14:35:54.000000000 -0600
@@ -82,7 +82,7 @@
 	pr_reg[11] = regs->r1; 				\
 	pr_reg[12] = regs->cr_iip;			\
 	pr_reg[13] = regs->r17 & 0xffff;		\
-	pr_reg[14] = ia64_getreg(_IA64_REG_AR_EFLAG);	\
+	pr_reg[14] = ia64_get_eflag();			\
 	pr_reg[15] = regs->r12;				\
 	pr_reg[16] = (regs->r17 >> 16) & 0xffff;
 
diff -Naur linux-2.6.12/arch/ia64/ia32/ia32_signal.c linux-2.6.12-XenPatch/arch/ia64/ia32/ia32_signal.c
--- linux-2.6.12/arch/ia64/ia32/ia32_signal.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/ia32/ia32_signal.c	2005-07-14 14:35:54.000000000 -0600
@@ -666,7 +666,7 @@
 	/*
 	 *  `eflags' is in an ar register for this context
 	 */
-	flag = ia64_getreg(_IA64_REG_AR_EFLAG);
+	flag = ia64_get_eflag();
 	err |= __put_user((unsigned int)flag, &sc->eflags);
 	err |= __put_user(regs->r12, &sc->esp_at_signal);
 	err |= __put_user((regs->r17 >> 16) & 0xffff, (unsigned int __user *)&sc->ss);
@@ -754,10 +754,10 @@
 		 *  IA32 process's context.
 		 */
 		err |= __get_user(tmpflags, &sc->eflags);
-		flag = ia64_getreg(_IA64_REG_AR_EFLAG);
+		flag = ia64_get_eflag();
 		flag &= ~0x40DD5;
 		flag |= (tmpflags & 0x40DD5);
-		ia64_setreg(_IA64_REG_AR_EFLAG, flag);
+		ia64_set_eflag(flag);
 
 		regs->r1 = -1;	/* disable syscall checks, r1 is orig_eax */
 	}
diff -Naur linux-2.6.12/arch/ia64/ia32/ia32_support.c linux-2.6.12-XenPatch/arch/ia64/ia32/ia32_support.c
--- linux-2.6.12/arch/ia64/ia32/ia32_support.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/ia32/ia32_support.c	2005-07-14 14:35:54.000000000 -0600
@@ -100,7 +100,7 @@
 void
 ia32_save_state (struct task_struct *t)
 {
-	t->thread.eflag = ia64_getreg(_IA64_REG_AR_EFLAG);
+	t->thread.eflag = ia64_get_eflag();
 	t->thread.fsr   = ia64_getreg(_IA64_REG_AR_FSR);
 	t->thread.fcr   = ia64_getreg(_IA64_REG_AR_FCR);
 	t->thread.fir   = ia64_getreg(_IA64_REG_AR_FIR);
@@ -122,7 +122,7 @@
 	fdr = t->thread.fdr;
 	tssd = load_desc(_TSS);					/* TSSD */
 
-	ia64_setreg(_IA64_REG_AR_EFLAG, eflag);
+	ia64_set_eflag(eflag);
 	ia64_setreg(_IA64_REG_AR_FSR, fsr);
 	ia64_setreg(_IA64_REG_AR_FCR, fcr);
 	ia64_setreg(_IA64_REG_AR_FIR, fir);
diff -Naur linux-2.6.12/arch/ia64/Kconfig linux-2.6.12-XenPatch/arch/ia64/Kconfig
--- linux-2.6.12/arch/ia64/Kconfig	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/Kconfig	2005-07-14 14:35:54.000000000 -0600
@@ -46,6 +46,13 @@
 	bool
 	default y
 
+config XEN
+	bool
+	default n
+	help
+	  Enable Xen hypervisor support.  Resulting kernel runs
+	  both as a guest OS on Xen and natively on hardware.
+
 config SCHED_NO_NO_OMIT_FRAME_POINTER
 	bool
 	default y
diff -Naur linux-2.6.12/arch/ia64/kernel/entry.S linux-2.6.12-XenPatch/arch/ia64/kernel/entry.S
--- linux-2.6.12/arch/ia64/kernel/entry.S	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/kernel/entry.S	2005-07-14 14:35:58.000000000 -0600
@@ -181,7 +181,7 @@
  *	called.  The code starting at .map relies on this.  The rest of the code
  *	doesn't care about the interrupt masking status.
  */
-GLOBAL_ENTRY(ia64_switch_to)
+GLOBAL_ENTRY(__ia64_switch_to)
 	.prologue
 	alloc r16=ar.pfs,1,0,0,0
 	DO_SAVE_SWITCH_STACK
@@ -235,7 +235,7 @@
 	;;
 	itr.d dtr[r25]=r23		// wire in new mapping...
 	br.cond.sptk .done
-END(ia64_switch_to)
+END(__ia64_switch_to)
 
 /*
  * Note that interrupts are enabled during save_switch_stack and load_switch_stack.  This
@@ -376,7 +376,7 @@
  *	- b7 holds address to return to
  *	- must not touch r8-r11
  */
-ENTRY(load_switch_stack)
+GLOBAL_ENTRY(load_switch_stack)
 	.prologue
 	.altrp b7
 
@@ -500,7 +500,7 @@
 	 * because some system calls (such as ia64_execve) directly
 	 * manipulate ar.pfs.
 	 */
-GLOBAL_ENTRY(ia64_trace_syscall)
+GLOBAL_ENTRY(__ia64_trace_syscall)
 	PT_REGS_UNWIND_INFO(0)
 	/*
 	 * We need to preserve the scratch registers f6-f11 in case the system
@@ -570,7 +570,7 @@
 (p6)	mov r10=-1
 (p6)	mov r8=r9
 	br.cond.sptk .strace_save_retval
-END(ia64_trace_syscall)
+END(__ia64_trace_syscall)
 
 	/*
 	 * When traced and returning from sigreturn, we invoke syscall_trace but then
@@ -623,8 +623,11 @@
 	adds r2=PT(R8)+16,sp			// r2 = &pt_regs.r8
 	mov r10=r0				// clear error indication in r10
 (p7)	br.cond.spnt handle_syscall_error	// handle potential syscall failure
+	;;
+	// don't fall through, ia64_leave_syscall may be #define'd
+	br.cond.sptk.few ia64_leave_syscall
+	;;
 END(ia64_ret_from_syscall)
-	// fall through
 /*
  * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
  *	need to switch to bank 0 and doesn't restore the scratch registers.
@@ -669,7 +672,7 @@
  *	      ar.csd: cleared
  *	      ar.ssd: cleared
  */
-ENTRY(ia64_leave_syscall)
+GLOBAL_ENTRY(__ia64_leave_syscall)
 	PT_REGS_UNWIND_INFO(0)
 	/*
 	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
@@ -770,7 +773,7 @@
 	mov.m ar.ccv=r0		// clear ar.ccv
 (pNonSys) br.cond.dpnt.many dont_preserve_current_frame
 	br.cond.sptk.many rbs_switch
-END(ia64_leave_syscall)
+END(__ia64_leave_syscall)
 
 #ifdef CONFIG_IA32_SUPPORT
 GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
@@ -782,10 +785,13 @@
 	st8.spill [r2]=r8	// store return value in slot for r8 and set unat bit
 	.mem.offset 8,0
 	st8.spill [r3]=r0	// clear error indication in slot for r10 and set unat bit
+	;;
+	// don't fall through, ia64_leave_kernel may be #define'd
+	br.cond.sptk.few ia64_leave_kernel
+	;;
 END(ia64_ret_from_ia32_execve)
-	// fall through
 #endif /* CONFIG_IA32_SUPPORT */
-GLOBAL_ENTRY(ia64_leave_kernel)
+GLOBAL_ENTRY(__ia64_leave_kernel)
 	PT_REGS_UNWIND_INFO(0)
 	/*
 	 * work.need_resched etc. mustn't get changed by this CPU before it returns to
@@ -1131,7 +1137,7 @@
 	ld8 r10=[r3]
 	br.cond.sptk.many .work_processed_syscall	// re-check
 
-END(ia64_leave_kernel)
+END(__ia64_leave_kernel)
 
 ENTRY(handle_syscall_error)
 	/*
@@ -1171,7 +1177,7 @@
 	 * be set up by the caller.  We declare 8 input registers so the system call
 	 * args get preserved, in case we need to restart a system call.
 	 */
-ENTRY(notify_resume_user)
+GLOBAL_ENTRY(notify_resume_user)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
 	alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
 	mov r9=ar.unat
diff -Naur linux-2.6.12/arch/ia64/kernel/head.S linux-2.6.12-XenPatch/arch/ia64/kernel/head.S
--- linux-2.6.12/arch/ia64/kernel/head.S	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/kernel/head.S	2005-07-14 14:35:54.000000000 -0600
@@ -370,6 +370,10 @@
 
 	// This is executed by the bootstrap processor (bsp) only:
 
+#ifdef CONFIG_XEN
+	br.call.sptk.many rp=early_xen_setup
+	;;
+#endif
 #ifdef CONFIG_IA64_FW_EMU
 	// initialize PAL & SAL emulator:
 	br.call.sptk.many rp=sys_fw_init
diff -Naur linux-2.6.12/arch/ia64/kernel/irq_ia64.c linux-2.6.12-XenPatch/arch/ia64/kernel/irq_ia64.c
--- linux-2.6.12/arch/ia64/kernel/irq_ia64.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/kernel/irq_ia64.c	2005-07-14 14:35:54.000000000 -0600
@@ -151,11 +151,11 @@
 	 * to kernel stack overflows).
 	 */
 	irq_enter();
-	saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
+	saved_tpr = ia64_get_tpr();
 	ia64_srlz_d();
 	while (vector != IA64_SPURIOUS_INT_VECTOR) {
 		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
+			ia64_set_tpr(vector);
 			ia64_srlz_d();
 
 			__do_IRQ(local_vector_to_irq(vector), regs);
@@ -164,7 +164,7 @@
 			 * Disable interrupts and send EOI:
 			 */
 			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
+			ia64_set_tpr(saved_tpr);
 		}
 		ia64_eoi();
 		vector = ia64_get_ivr();
@@ -191,7 +191,7 @@
 	vector = ia64_get_ivr();
 
 	 irq_enter();
-	 saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
+	 saved_tpr = ia64_get_tpr();
 	 ia64_srlz_d();
 
 	 /*
@@ -199,7 +199,7 @@
 	  */
 	while (vector != IA64_SPURIOUS_INT_VECTOR) {
 		if (!IS_RESCHEDULE(vector)) {
-			ia64_setreg(_IA64_REG_CR_TPR, vector);
+			ia64_set_tpr(vector);
 			ia64_srlz_d();
 
 			/*
@@ -215,7 +215,7 @@
 			 * Disable interrupts and send EOI
 			 */
 			local_irq_disable();
-			ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
+			ia64_set_tpr(saved_tpr);
 		}
 		ia64_eoi();
 		vector = ia64_get_ivr();
diff -Naur linux-2.6.12/arch/ia64/kernel/pal.S linux-2.6.12-XenPatch/arch/ia64/kernel/pal.S
--- linux-2.6.12/arch/ia64/kernel/pal.S	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/kernel/pal.S	2005-07-14 14:35:54.000000000 -0600
@@ -16,6 +16,7 @@
 #include <asm/processor.h>
 
 	.data
+	.globl pal_entry_point
 pal_entry_point:
 	data8 ia64_pal_default_handler
 	.text
@@ -53,7 +54,7 @@
  * in4	       1 ==> clear psr.ic,  0 ==> don't clear psr.ic
  *
  */
-GLOBAL_ENTRY(ia64_pal_call_static)
+GLOBAL_ENTRY(__ia64_pal_call_static)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
 	alloc loc1 = ar.pfs,5,5,0,0
 	movl loc2 = pal_entry_point
@@ -90,7 +91,7 @@
 	;;
 	srlz.d				// seralize restoration of psr.l
 	br.ret.sptk.many b0
-END(ia64_pal_call_static)
+END(__ia64_pal_call_static)
 
 /*
  * Make a PAL call using the stacked registers calling convention.
diff -Naur linux-2.6.12/arch/ia64/kernel/setup.c linux-2.6.12-XenPatch/arch/ia64/kernel/setup.c
--- linux-2.6.12/arch/ia64/kernel/setup.c	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/kernel/setup.c	2005-07-14 14:35:54.000000000 -0600
@@ -273,6 +273,9 @@
 static inline int __init
 early_console_setup (char *cmdline)
 {
+#ifdef CONFIG_XEN
+	if (!early_xen_console_setup(cmdline)) return 0;
+#endif
 #ifdef CONFIG_SERIAL_SGI_L1_CONSOLE
 	{
 		extern int sn_serial_console_early_setup(void);
diff -Naur linux-2.6.12/arch/ia64/Makefile linux-2.6.12-XenPatch/arch/ia64/Makefile
--- linux-2.6.12/arch/ia64/Makefile	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/arch/ia64/Makefile	2005-07-14 14:35:54.000000000 -0600
@@ -57,6 +57,7 @@
 core-$(CONFIG_IA64_HP_ZX1)	+= arch/ia64/dig/
 core-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += arch/ia64/dig/
 core-$(CONFIG_IA64_SGI_SN2)	+= arch/ia64/sn/
+core-$(CONFIG_XEN)		+= arch/ia64/xen/ arch/ia64/hp/sim/
 
 drivers-$(CONFIG_PCI)		+= arch/ia64/pci/
 drivers-$(CONFIG_IA64_HP_SIM)	+= arch/ia64/hp/sim/
diff -Naur linux-2.6.12/include/asm-ia64/delay.h linux-2.6.12-XenPatch/include/asm-ia64/delay.h
--- linux-2.6.12/include/asm-ia64/delay.h	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/include/asm-ia64/delay.h	2005-07-14 14:35:54.000000000 -0600
@@ -20,59 +20,6 @@
 #include <asm/intrinsics.h>
 #include <asm/processor.h>
 
-static __inline__ void
-ia64_set_itm (unsigned long val)
-{
-	ia64_setreg(_IA64_REG_CR_ITM, val);
-	ia64_srlz_d();
-}
-
-static __inline__ unsigned long
-ia64_get_itm (void)
-{
-	unsigned long result;
-
-	result = ia64_getreg(_IA64_REG_CR_ITM);
-	ia64_srlz_d();
-	return result;
-}
-
-static __inline__ void
-ia64_set_itv (unsigned long val)
-{
-	ia64_setreg(_IA64_REG_CR_ITV, val);
-	ia64_srlz_d();
-}
-
-static __inline__ unsigned long
-ia64_get_itv (void)
-{
-	return ia64_getreg(_IA64_REG_CR_ITV);
-}
-
-static __inline__ void
-ia64_set_itc (unsigned long val)
-{
-	ia64_setreg(_IA64_REG_AR_ITC, val);
-	ia64_srlz_d();
-}
-
-static __inline__ unsigned long
-ia64_get_itc (void)
-{
-	unsigned long result;
-
-	result = ia64_getreg(_IA64_REG_AR_ITC);
-	ia64_barrier();
-#ifdef CONFIG_ITANIUM
-	while (unlikely((__s32) result == -1)) {
-		result = ia64_getreg(_IA64_REG_AR_ITC);
-		ia64_barrier();
-	}
-#endif
-	return result;
-}
-
 extern void ia64_delay_loop (unsigned long loops);
 
 static __inline__ void
diff -Naur linux-2.6.12/include/asm-ia64/privop.h linux-2.6.12-XenPatch/include/asm-ia64/privop.h
--- linux-2.6.12/include/asm-ia64/privop.h	1969-12-31 17:00:00.000000000 -0700
+++ linux-2.6.12-XenPatch/include/asm-ia64/privop.h	2005-07-14 14:35:54.000000000 -0600
@@ -0,0 +1,160 @@
+#ifndef _ASM_IA64_PRIVOP_H
+#define _ASM_IA64_PRIVOP_H
+
+/*
+ * Copyright (C) 2005 Hewlett-Packard Co
+ *	Dan Magenheimer <dan.magenheimer@hp.com>
+ * Reorganization from asm-ia64/processor.h
+ *
+ */
+
+#include <linux/config.h>
+
+#include <asm/intrinsics.h>
+
+#ifndef __ASSEMBLY__
+extern void ia64_getreg_unknown_kr (void);
+extern void ia64_setreg_unknown_kr (void);
+
+#define __ia64_get_kr(regnum)					\
+({								\
+	unsigned long r = 0;					\
+								\
+	switch (regnum) {					\
+	    case 0: r = ia64_getreg(_IA64_REG_AR_KR0); break;	\
+	    case 1: r = ia64_getreg(_IA64_REG_AR_KR1); break;	\
+	    case 2: r = ia64_getreg(_IA64_REG_AR_KR2); break;	\
+	    case 3: r = ia64_getreg(_IA64_REG_AR_KR3); break;	\
+	    case 4: r = ia64_getreg(_IA64_REG_AR_KR4); break;	\
+	    case 5: r = ia64_getreg(_IA64_REG_AR_KR5); break;	\
+	    case 6: r = ia64_getreg(_IA64_REG_AR_KR6); break;	\
+	    case 7: r = ia64_getreg(_IA64_REG_AR_KR7); break;	\
+	    default: ia64_getreg_unknown_kr(); break;		\
+	}							\
+	r;							\
+})
+
+#define __ia64_set_kr(regnum,r)					\
+({								\
+	switch (regnum) {					\
+	    case 0: ia64_setreg(_IA64_REG_AR_KR0, r); break;	\
+	    case 1: ia64_setreg(_IA64_REG_AR_KR1, r); break;	\
+	    case 2: ia64_setreg(_IA64_REG_AR_KR2, r); break;	\
+	    case 3: ia64_setreg(_IA64_REG_AR_KR3, r); break;	\
+	    case 4: ia64_setreg(_IA64_REG_AR_KR4, r); break;	\
+	    case 5: ia64_setreg(_IA64_REG_AR_KR5, r); break;	\
+	    case 6: ia64_setreg(_IA64_REG_AR_KR6, r); break;	\
+	    case 7: ia64_setreg(_IA64_REG_AR_KR7, r); break;	\
+	    default: ia64_setreg_unknown_kr(); break;		\
+	}							\
+})
+
+static inline unsigned long
+__ia64_get_ivr (void)
+{
+	unsigned long r;
+	ia64_srlz_d();
+	r = ia64_getreg(_IA64_REG_CR_IVR);
+	ia64_srlz_d();
+	return r;
+}
+
+static inline void
+__ia64_eoi (void)
+{
+	ia64_setreg(_IA64_REG_CR_EOI, 0);
+	ia64_srlz_d();
+}
+
+#define __cpu_relax()	ia64_hint(ia64_hint_pause)
+
+#define __ia64_get_tpr(vector)	ia64_getreg(_IA64_REG_CR_TPR)
+#define __ia64_set_tpr(vector)	ia64_setreg(_IA64_REG_CR_TPR,vector)
+
+#define __ia64_get_eflag()	ia64_getreg(_IA64_REG_AR_EFLAG)
+#define __ia64_set_eflag(eflag)	ia64_setreg(_IA64_REG_AR_EFLAG,eflag)
+
+#define	__ia64_get_psr_i()	ia64_getreg(_IA64_REG_PSR)
+#define __ia64_rsm_i()		ia64_rsm(IA64_PSR_I)
+#define __ia64_ssm_i()		ia64_ssm(IA64_PSR_I)
+#define	__ia64_local_irq_restore(x)	ia64_intrin_local_irq_restore(x)
+
+static __inline__ void
+__ia64_set_itm (unsigned long val)
+{
+	ia64_setreg(_IA64_REG_CR_ITM, val);
+	ia64_srlz_d();
+}
+
+static __inline__ unsigned long
+ia64_get_itm (void)
+{
+	unsigned long result;
+
+	result = ia64_getreg(_IA64_REG_CR_ITM);
+	ia64_srlz_d();
+	return result;
+}
+
+static __inline__ void
+ia64_set_itv (unsigned long val)
+{
+	ia64_setreg(_IA64_REG_CR_ITV, val);
+	ia64_srlz_d();
+}
+
+static __inline__ unsigned long
+ia64_get_itv (void)
+{
+	return ia64_getreg(_IA64_REG_CR_ITV);
+}
+
+static __inline__ void
+ia64_set_itc (unsigned long val)
+{
+	ia64_setreg(_IA64_REG_AR_ITC, val);
+	ia64_srlz_d();
+}
+
+static __inline__ unsigned long
+ia64_get_itc (void)
+{
+	unsigned long result;
+
+	result = ia64_getreg(_IA64_REG_AR_ITC);
+	ia64_barrier();
+#ifdef CONFIG_ITANIUM
+	while (unlikely((__s32) result == -1)) {
+		result = ia64_getreg(_IA64_REG_AR_ITC);
+		ia64_barrier();
+	}
+#endif
+	return result;
+}
+#endif /* !__ASSEMBLY__ */
+
+#ifdef CONFIG_XEN
+#include <asm/xen/privop.h>
+#else
+#define ia64_get_kr(regnum)		__ia64_get_kr(regnum)
+#define ia64_set_kr(regnum, r)		__ia64_set_kr(regnum,r)
+#define ia64_get_ivr			__ia64_get_ivr
+#define ia64_eoi			__ia64_eoi
+#define ia64_set_itm(val)		__ia64_set_itm(val)
+#define cpu_relax			__cpu_relax
+#define ia64_get_tpr			__ia64_get_tpr
+#define ia64_set_tpr(vector)		__ia64_set_tpr(vector)
+#define ia64_get_eflag			__ia64_get_eflag
+#define ia64_set_eflag(eflag)		__ia64_set_eflag(eflag)
+#define ia64_pal_halt_light		__ia64_pal_halt_light
+#define	ia64_get_psr_i			__ia64_get_psr_i
+#define ia64_rsm_i			__ia64_rsm_i
+#define ia64_ssm_i			__ia64_ssm_i
+#define	ia64_local_irq_restore(x)	__ia64_local_irq_restore(x)
+#define	ia64_leave_kernel		__ia64_leave_kernel
+#define	ia64_leave_syscall		__ia64_leave_syscall
+#define	ia64_switch_to			__ia64_switch_to
+#define	ia64_pal_call_static		__ia64_pal_call_static
+#endif
+
+#endif /* _ASM_IA64_PRIVOP_H */
diff -Naur linux-2.6.12/include/asm-ia64/processor.h linux-2.6.12-XenPatch/include/asm-ia64/processor.h
--- linux-2.6.12/include/asm-ia64/processor.h	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/include/asm-ia64/processor.h	2005-07-14 14:35:54.000000000 -0600
@@ -19,6 +19,7 @@
 #include <asm/kregs.h>
 #include <asm/ptrace.h>
 #include <asm/ustack.h>
+#include <asm/privop.h>
 
 /* Our arch specific arch_init_sched_domain is in arch/ia64/kernel/domain.c */
 #define ARCH_HAS_SCHED_DOMAIN
@@ -362,42 +363,6 @@
 /* Return stack pointer of blocked task TSK.  */
 #define KSTK_ESP(tsk)  ((tsk)->thread.ksp)
 
-extern void ia64_getreg_unknown_kr (void);
-extern void ia64_setreg_unknown_kr (void);
-
-#define ia64_get_kr(regnum)					\
-({								\
-	unsigned long r = 0;					\
-								\
-	switch (regnum) {					\
-	    case 0: r = ia64_getreg(_IA64_REG_AR_KR0); break;	\
-	    case 1: r = ia64_getreg(_IA64_REG_AR_KR1); break;	\
-	    case 2: r = ia64_getreg(_IA64_REG_AR_KR2); break;	\
-	    case 3: r = ia64_getreg(_IA64_REG_AR_KR3); break;	\
-	    case 4: r = ia64_getreg(_IA64_REG_AR_KR4); break;	\
-	    case 5: r = ia64_getreg(_IA64_REG_AR_KR5); break;	\
-	    case 6: r = ia64_getreg(_IA64_REG_AR_KR6); break;	\
-	    case 7: r = ia64_getreg(_IA64_REG_AR_KR7); break;	\
-	    default: ia64_getreg_unknown_kr(); break;		\
-	}							\
-	r;							\
-})
-
-#define ia64_set_kr(regnum, r) 					\
-({								\
-	switch (regnum) {					\
-	    case 0: ia64_setreg(_IA64_REG_AR_KR0, r); break;	\
-	    case 1: ia64_setreg(_IA64_REG_AR_KR1, r); break;	\
-	    case 2: ia64_setreg(_IA64_REG_AR_KR2, r); break;	\
-	    case 3: ia64_setreg(_IA64_REG_AR_KR3, r); break;	\
-	    case 4: ia64_setreg(_IA64_REG_AR_KR4, r); break;	\
-	    case 5: ia64_setreg(_IA64_REG_AR_KR5, r); break;	\
-	    case 6: ia64_setreg(_IA64_REG_AR_KR6, r); break;	\
-	    case 7: ia64_setreg(_IA64_REG_AR_KR7, r); break;	\
-	    default: ia64_setreg_unknown_kr(); break;		\
-	}							\
-})
-
 /*
  * The following three macros can't be inline functions because we don't have struct
  * task_struct at this point.
@@ -554,15 +519,6 @@
 }
 
 static inline void
-ia64_eoi (void)
-{
-	ia64_setreg(_IA64_REG_CR_EOI, 0);
-	ia64_srlz_d();
-}
-
-#define cpu_relax()	ia64_hint(ia64_hint_pause)
-
-static inline void
 ia64_set_lrr0 (unsigned long val)
 {
 	ia64_setreg(_IA64_REG_CR_LRR0, val);
@@ -623,16 +579,6 @@
 #define current_text_addr() \
 	({ void *_pc; _pc = (void *)ia64_getreg(_IA64_REG_IP); _pc; })
 
-static inline __u64
-ia64_get_ivr (void)
-{
-	__u64 r;
-	ia64_srlz_d();
-	r = ia64_getreg(_IA64_REG_CR_IVR);
-	ia64_srlz_d();
-	return r;
-}
-
 static inline void
 ia64_set_dbr (__u64 regnum, __u64 value)
 {
diff -Naur linux-2.6.12/include/asm-ia64/system.h linux-2.6.12-XenPatch/include/asm-ia64/system.h
--- linux-2.6.12/include/asm-ia64/system.h	2005-06-17 13:48:29.000000000 -0600
+++ linux-2.6.12-XenPatch/include/asm-ia64/system.h	2005-07-14 14:35:54.000000000 -0600
@@ -124,18 +124,18 @@
 #define __local_irq_save(x)			\
 do {						\
 	ia64_stop();				\
-	(x) = ia64_getreg(_IA64_REG_PSR);	\
+	(x) = ia64_get_psr_i();			\
 	ia64_stop();				\
-	ia64_rsm(IA64_PSR_I);			\
+	ia64_rsm_i();				\
 } while (0)
 
 #define __local_irq_disable()			\
 do {						\
 	ia64_stop();				\
-	ia64_rsm(IA64_PSR_I);			\
+	ia64_rsm_i();				\
 } while (0)
 
-#define __local_irq_restore(x)	ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
+#define __local_irq_restore(x)	ia64_local_irq_restore((x) & IA64_PSR_I)
 
 #ifdef CONFIG_IA64_DEBUG_IRQ
 
@@ -171,8 +171,8 @@
 # define local_irq_restore(x)	__local_irq_restore(x)
 #endif /* !CONFIG_IA64_DEBUG_IRQ */
 
-#define local_irq_enable()	({ ia64_stop(); ia64_ssm(IA64_PSR_I); ia64_srlz_d(); })
-#define local_save_flags(flags)	({ ia64_stop(); (flags) = ia64_getreg(_IA64_REG_PSR); })
+#define local_irq_enable()	({ ia64_stop(); ia64_ssm_i(); ia64_srlz_d(); })
+#define local_save_flags(flags)	({ ia64_stop(); (flags) = ia64_get_psr_i(); })
 
 #define irqs_disabled()				\
 ({						\
