direct-io.hg

changeset 6451:2b95125015a5

Remove the unused ia64 patch directory.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Aug 26 13:06:49 2005 +0000 (2005-08-26)
parents 5978be010bec
children 37e9c9cd6c14 f5c4042212b0
files
line diff
     1.1 --- a/xen/arch/ia64/patch/linux-2.6.11/cpumask.h	Fri Aug 26 11:02:14 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,12 +0,0 @@
     1.4 ---- ../../linux-2.6.11/include/linux/cpumask.h	2005-03-02 00:38:00.000000000 -0700
     1.5 -+++ include/asm-ia64/linux/cpumask.h	2005-04-28 13:21:20.000000000 -0600
     1.6 -@@ -342,7 +342,9 @@
     1.7 -  */
     1.8 - 
     1.9 - extern cpumask_t cpu_possible_map;
    1.10 -+#ifndef XEN
    1.11 - extern cpumask_t cpu_online_map;
    1.12 -+#endif
    1.13 - extern cpumask_t cpu_present_map;
    1.14 - 
    1.15 - #if NR_CPUS > 1
     2.1 --- a/xen/arch/ia64/patch/linux-2.6.11/efi.c	Fri Aug 26 11:02:14 2005 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,50 +0,0 @@
     2.4 ---- ../../linux-2.6.11/arch/ia64/kernel/efi.c	2005-03-02 00:37:47.000000000 -0700
     2.5 -+++ arch/ia64/efi.c	2005-06-09 06:15:36.000000000 -0600
     2.6 -@@ -320,6 +320,16 @@
     2.7 - 		if (!(md->attribute & EFI_MEMORY_WB))
     2.8 - 			continue;
     2.9 - 
    2.10 -+#ifdef XEN
    2.11 -+// this works around a problem in the ski bootloader
    2.12 -+{
    2.13 -+		extern long running_on_sim;
    2.14 -+		if (running_on_sim && md->type != EFI_CONVENTIONAL_MEMORY)
    2.15 -+			continue;
    2.16 -+}
    2.17 -+// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
    2.18 -+		if (md->phys_addr >= 0x100000000) continue;
    2.19 -+#endif
    2.20 - 		/*
    2.21 - 		 * granule_addr is the base of md's first granule.
    2.22 - 		 * [granule_addr - first_non_wb_addr) is guaranteed to
    2.23 -@@ -719,6 +729,30 @@
    2.24 - 	return 0;
    2.25 - }
    2.26 - 
    2.27 -+#ifdef XEN
    2.28 -+// variation of efi_get_iobase which returns entire memory descriptor
    2.29 -+efi_memory_desc_t *
    2.30 -+efi_get_io_md (void)
    2.31 -+{
    2.32 -+	void *efi_map_start, *efi_map_end, *p;
    2.33 -+	efi_memory_desc_t *md;
    2.34 -+	u64 efi_desc_size;
    2.35 -+
    2.36 -+	efi_map_start = __va(ia64_boot_param->efi_memmap);
    2.37 -+	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
    2.38 -+	efi_desc_size = ia64_boot_param->efi_memdesc_size;
    2.39 -+
    2.40 -+	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
    2.41 -+		md = p;
    2.42 -+		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
    2.43 -+			if (md->attribute & EFI_MEMORY_UC)
    2.44 -+				return md;
    2.45 -+		}
    2.46 -+	}
    2.47 -+	return 0;
    2.48 -+}
    2.49 -+#endif
    2.50 -+
    2.51 - u32
    2.52 - efi_mem_type (unsigned long phys_addr)
    2.53 - {
     3.1 --- a/xen/arch/ia64/patch/linux-2.6.11/entry.S	Fri Aug 26 11:02:14 2005 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,237 +0,0 @@
     3.4 ---- ../../linux-2.6.11/arch/ia64/kernel/entry.S	2005-03-02 00:37:50.000000000 -0700
     3.5 -+++ arch/ia64/entry.S	2005-05-23 16:49:23.000000000 -0600
     3.6 -@@ -46,6 +46,7 @@
     3.7 - 
     3.8 - #include "minstate.h"
     3.9 - 
    3.10 -+#ifndef XEN
    3.11 - 	/*
    3.12 - 	 * execve() is special because in case of success, we need to
    3.13 - 	 * setup a null register window frame.
    3.14 -@@ -174,6 +175,7 @@
    3.15 - 	mov rp=loc0
    3.16 - 	br.ret.sptk.many rp
    3.17 - END(sys_clone)
    3.18 -+#endif /* !XEN */
    3.19 - 
    3.20 - /*
    3.21 -  * prev_task <- ia64_switch_to(struct task_struct *next)
    3.22 -@@ -191,7 +193,11 @@
    3.23 - 	movl r25=init_task
    3.24 - 	mov r27=IA64_KR(CURRENT_STACK)
    3.25 - 	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
    3.26 -+#ifdef XEN
    3.27 -+	dep r20=0,in0,60,4		// physical address of "next"
    3.28 -+#else
    3.29 - 	dep r20=0,in0,61,3		// physical address of "next"
    3.30 -+#endif
    3.31 - 	;;
    3.32 - 	st8 [r22]=sp			// save kernel stack pointer of old task
    3.33 - 	shr.u r26=r20,IA64_GRANULE_SHIFT
    3.34 -@@ -220,6 +226,16 @@
    3.35 - 	br.ret.sptk.many rp		// boogie on out in new context
    3.36 - 
    3.37 - .map:
    3.38 -+#ifdef XEN
    3.39 -+	// avoid overlapping with kernel TR
    3.40 -+	movl r25=KERNEL_START
    3.41 -+	dep  r23=0,in0,0,KERNEL_TR_PAGE_SHIFT
    3.42 -+	;;
    3.43 -+	cmp.eq p7,p0=r25,r23
    3.44 -+	;;
    3.45 -+(p7)	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
    3.46 -+(p7)	br.cond.sptk .done
    3.47 -+#endif
    3.48 - 	rsm psr.ic			// interrupts (psr.i) are already disabled here
    3.49 - 	movl r25=PAGE_KERNEL
    3.50 - 	;;
    3.51 -@@ -376,7 +392,11 @@
    3.52 -  *	- b7 holds address to return to
    3.53 -  *	- must not touch r8-r11
    3.54 -  */
    3.55 -+#ifdef XEN
    3.56 -+GLOBAL_ENTRY(load_switch_stack)
    3.57 -+#else
    3.58 - ENTRY(load_switch_stack)
    3.59 -+#endif
    3.60 - 	.prologue
    3.61 - 	.altrp b7
    3.62 - 
    3.63 -@@ -470,6 +490,7 @@
    3.64 - 	br.cond.sptk.many b7
    3.65 - END(load_switch_stack)
    3.66 - 
    3.67 -+#ifndef XEN
    3.68 - GLOBAL_ENTRY(__ia64_syscall)
    3.69 - 	.regstk 6,0,0,0
    3.70 - 	mov r15=in5				// put syscall number in place
    3.71 -@@ -588,6 +609,7 @@
    3.72 - }
    3.73 - .ret4:	br.cond.sptk ia64_leave_kernel
    3.74 - END(ia64_strace_leave_kernel)
    3.75 -+#endif
    3.76 - 
    3.77 - GLOBAL_ENTRY(ia64_ret_from_clone)
    3.78 - 	PT_REGS_UNWIND_INFO(0)
    3.79 -@@ -604,6 +626,15 @@
    3.80 - 	 */
    3.81 - 	br.call.sptk.many rp=ia64_invoke_schedule_tail
    3.82 - }
    3.83 -+#ifdef XEN
    3.84 -+	// new domains are cloned but not exec'ed so switch to user mode here
    3.85 -+	cmp.ne pKStk,pUStk=r0,r0
    3.86 -+#ifdef CONFIG_VTI
    3.87 -+	br.cond.spnt ia64_leave_hypervisor
    3.88 -+#else // CONFIG_VTI
    3.89 -+	br.cond.spnt ia64_leave_kernel
    3.90 -+#endif // CONFIG_VTI
    3.91 -+#else
    3.92 - .ret8:
    3.93 - 	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
    3.94 - 	;;
    3.95 -@@ -614,6 +645,7 @@
    3.96 - 	;;
    3.97 - 	cmp.ne p6,p0=r2,r0
    3.98 - (p6)	br.cond.spnt .strace_check_retval
    3.99 -+#endif
   3.100 - 	;;					// added stop bits to prevent r8 dependency
   3.101 - END(ia64_ret_from_clone)
   3.102 - 	// fall through
   3.103 -@@ -700,19 +732,27 @@
   3.104 - .work_processed_syscall:
   3.105 - 	adds r2=PT(LOADRS)+16,r12
   3.106 - 	adds r3=PT(AR_BSPSTORE)+16,r12
   3.107 -+#ifdef XEN
   3.108 -+	;;
   3.109 -+#else
   3.110 - 	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
   3.111 - 	;;
   3.112 - (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
   3.113 -+#endif
   3.114 - 	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
   3.115 - 	mov b7=r0		// clear b7
   3.116 - 	;;
   3.117 - 	ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)	// load ar.bspstore (may be garbage)
   3.118 - 	ld8 r18=[r2],PT(R9)-PT(B6)		// load b6
   3.119 -+#ifndef XEN
   3.120 - (p6)	and r15=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
   3.121 -+#endif
   3.122 - 	;;
   3.123 - 	mov r16=ar.bsp				// M2  get existing backing store pointer
   3.124 -+#ifndef XEN
   3.125 - (p6)	cmp4.ne.unc p6,p0=r15, r0		// any special work pending?
   3.126 - (p6)	br.cond.spnt .work_pending_syscall
   3.127 -+#endif
   3.128 - 	;;
   3.129 - 	// start restoring the state saved on the kernel stack (struct pt_regs):
   3.130 - 	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
   3.131 -@@ -757,7 +797,11 @@
   3.132 - 	;;
   3.133 - 	ld8.fill r12=[r2]	// restore r12 (sp)
   3.134 - 	ld8.fill r15=[r3]	// restore r15
   3.135 -+#ifdef XEN
   3.136 -+	movl r3=THIS_CPU(ia64_phys_stacked_size_p8)
   3.137 -+#else
   3.138 - 	addl r3=THIS_CPU(ia64_phys_stacked_size_p8),r0
   3.139 -+#endif
   3.140 - 	;;
   3.141 - (pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
   3.142 - (pUStk) st1 [r14]=r17
   3.143 -@@ -814,9 +858,18 @@
   3.144 - (pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
   3.145 - #endif
   3.146 - .work_processed_kernel:
   3.147 -+#ifdef XEN
   3.148 -+	alloc loc0=ar.pfs,0,1,1,0
   3.149 -+	adds out0=16,r12
   3.150 -+	;;
   3.151 -+(p6)	br.call.sptk.many b0=deliver_pending_interrupt
   3.152 -+	mov ar.pfs=loc0
   3.153 -+	mov r31=r0
   3.154 -+#else
   3.155 - 	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
   3.156 - 	;;
   3.157 - (p6)	ld4 r31=[r17]				// load current_thread_info()->flags
   3.158 -+#endif
   3.159 - 	adds r21=PT(PR)+16,r12
   3.160 - 	;;
   3.161 - 
   3.162 -@@ -828,17 +881,20 @@
   3.163 - 	ld8 r28=[r2],8		// load b6
   3.164 - 	adds r29=PT(R24)+16,r12
   3.165 - 
   3.166 --	ld8.fill r16=[r3],PT(AR_CSD)-PT(R16)
   3.167 -+	ld8.fill r16=[r3]
   3.168 - 	adds r30=PT(AR_CCV)+16,r12
   3.169 - (p6)	and r19=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
   3.170 - 	;;
   3.171 -+	adds r3=PT(AR_CSD)-PT(R16),r3
   3.172 - 	ld8.fill r24=[r29]
   3.173 - 	ld8 r15=[r30]		// load ar.ccv
   3.174 - (p6)	cmp4.ne.unc p6,p0=r19, r0		// any special work pending?
   3.175 - 	;;
   3.176 - 	ld8 r29=[r2],16		// load b7
   3.177 - 	ld8 r30=[r3],16		// load ar.csd
   3.178 -+#ifndef XEN
   3.179 - (p6)	br.cond.spnt .work_pending
   3.180 -+#endif
   3.181 - 	;;
   3.182 - 	ld8 r31=[r2],16		// load ar.ssd
   3.183 - 	ld8.fill r8=[r3],16
   3.184 -@@ -934,7 +990,11 @@
   3.185 - 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
   3.186 - 	;;
   3.187 - 	mov r16=ar.bsp		// get existing backing store pointer
   3.188 -+#ifdef XEN
   3.189 -+	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
   3.190 -+#else
   3.191 - 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
   3.192 -+#endif
   3.193 - 	;;
   3.194 - 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
   3.195 - (pKStk)	br.cond.dpnt skip_rbs_switch
   3.196 -@@ -1069,6 +1129,7 @@
   3.197 - 	mov pr=r31,-1		// I0
   3.198 - 	rfi			// B
   3.199 - 
   3.200 -+#ifndef XEN
   3.201 - 	/*
   3.202 - 	 * On entry:
   3.203 - 	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
   3.204 -@@ -1130,6 +1191,7 @@
   3.205 - 	ld8 r8=[r2]
   3.206 - 	ld8 r10=[r3]
   3.207 - 	br.cond.sptk.many .work_processed_syscall	// re-check
   3.208 -+#endif
   3.209 - 
   3.210 - END(ia64_leave_kernel)
   3.211 - 
   3.212 -@@ -1166,6 +1228,7 @@
   3.213 - 	br.ret.sptk.many rp
   3.214 - END(ia64_invoke_schedule_tail)
   3.215 - 
   3.216 -+#ifndef XEN
   3.217 - 	/*
   3.218 - 	 * Setup stack and call do_notify_resume_user().  Note that pSys and pNonSys need to
   3.219 - 	 * be set up by the caller.  We declare 8 input registers so the system call
   3.220 -@@ -1264,6 +1327,7 @@
   3.221 - 	mov ar.unat=r9
   3.222 - 	br.many b7
   3.223 - END(sys_rt_sigreturn)
   3.224 -+#endif
   3.225 - 
   3.226 - GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
   3.227 - 	.prologue
   3.228 -@@ -1278,6 +1342,7 @@
   3.229 - 	br.cond.sptk.many rp				// goes to ia64_leave_kernel
   3.230 - END(ia64_prepare_handle_unaligned)
   3.231 - 
   3.232 -+#ifndef XEN
   3.233 - 	//
   3.234 - 	// unw_init_running(void (*callback)(info, arg), void *arg)
   3.235 - 	//
   3.236 -@@ -1585,3 +1650,4 @@
   3.237 - 	data8 sys_ni_syscall
   3.238 - 
   3.239 - 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
   3.240 -+#endif
     4.1 --- a/xen/arch/ia64/patch/linux-2.6.11/entry.h	Fri Aug 26 11:02:14 2005 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,37 +0,0 @@
     4.4 ---- /home/adsharma/disk2/xen-ia64/test3.bk/xen/../../linux-2.6.11/arch/ia64/kernel/entry.h	2005-03-01 23:38:07.000000000 -0800
     4.5 -+++ /home/adsharma/disk2/xen-ia64/test3.bk/xen/arch/ia64/entry.h	2005-05-18 14:00:53.000000000 -0700
     4.6 -@@ -7,6 +7,12 @@
     4.7 - #define PRED_LEAVE_SYSCALL	1 /* TRUE iff leave from syscall */
     4.8 - #define PRED_KERNEL_STACK	2 /* returning to kernel-stacks? */
     4.9 - #define PRED_USER_STACK		3 /* returning to user-stacks? */
    4.10 -+#ifdef CONFIG_VTI
    4.11 -+#define PRED_EMUL		2 /* Need to save r4-r7 for inst emulation */
    4.12 -+#define PRED_NON_EMUL		3 /* No need to save r4-r7 for normal path */
    4.13 -+#define PRED_BN0		6 /* Guest is in bank 0 */
    4.14 -+#define PRED_BN1		7 /* Guest is in bank 1 */
    4.15 -+#endif // CONFIG_VTI
    4.16 - #define PRED_SYSCALL		4 /* inside a system call? */
    4.17 - #define PRED_NON_SYSCALL	5 /* complement of PRED_SYSCALL */
    4.18 - 
    4.19 -@@ -17,12 +23,21 @@
    4.20 - # define pLvSys		PASTE(p,PRED_LEAVE_SYSCALL)
    4.21 - # define pKStk		PASTE(p,PRED_KERNEL_STACK)
    4.22 - # define pUStk		PASTE(p,PRED_USER_STACK)
    4.23 -+#ifdef CONFIG_VTI
    4.24 -+# define pEml		PASTE(p,PRED_EMUL)
    4.25 -+# define pNonEml	PASTE(p,PRED_NON_EMUL)
    4.26 -+# define pBN0		PASTE(p,PRED_BN0)
    4.27 -+# define pBN1		PASTE(p,PRED_BN1)
    4.28 -+#endif // CONFIG_VTI
    4.29 - # define pSys		PASTE(p,PRED_SYSCALL)
    4.30 - # define pNonSys	PASTE(p,PRED_NON_SYSCALL)
    4.31 - #endif
    4.32 - 
    4.33 - #define PT(f)		(IA64_PT_REGS_##f##_OFFSET)
    4.34 - #define SW(f)		(IA64_SWITCH_STACK_##f##_OFFSET)
    4.35 -+#ifdef CONFIG_VTI
    4.36 -+#define VPD(f)      (VPD_##f##_START_OFFSET)
    4.37 -+#endif // CONFIG_VTI
    4.38 - 
    4.39 - #define PT_REGS_SAVES(off)			\
    4.40 - 	.unwabi 3, 'i';				\
     5.1 --- a/xen/arch/ia64/patch/linux-2.6.11/gcc_intrin.h	Fri Aug 26 11:02:14 2005 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,69 +0,0 @@
     5.4 ---- /home/adsharma/disk2/xen-ia64/test3.bk/xen/../../linux-2.6.11/include/asm-ia64/gcc_intrin.h	2005-03-01 23:38:08.000000000 -0800
     5.5 -+++ /home/adsharma/disk2/xen-ia64/test3.bk/xen/include/asm-ia64/gcc_intrin.h	2005-05-18 14:00:53.000000000 -0700
     5.6 -@@ -368,6 +368,66 @@
     5.7 - #define ia64_mf()	asm volatile ("mf" ::: "memory")
     5.8 - #define ia64_mfa()	asm volatile ("mf.a" ::: "memory")
     5.9 - 
    5.10 -+#ifdef CONFIG_VTI
    5.11 -+/*
    5.12 -+ * Flushrs instruction stream.
    5.13 -+ */
    5.14 -+#define ia64_flushrs() asm volatile ("flushrs;;":::"memory")
    5.15 -+
    5.16 -+#define ia64_loadrs() asm volatile ("loadrs;;":::"memory")
    5.17 -+
    5.18 -+#define ia64_get_rsc()                          \
    5.19 -+({                                  \
    5.20 -+    unsigned long val;                     \
    5.21 -+    asm volatile ("mov %0=ar.rsc;;" : "=r"(val) :: "memory");  \
    5.22 -+    val;                               \
    5.23 -+})
    5.24 -+
    5.25 -+#define ia64_set_rsc(val)                       \
    5.26 -+    asm volatile ("mov ar.rsc=%0;;" :: "r"(val) : "memory")
    5.27 -+
    5.28 -+#define ia64_get_bspstore()     \
    5.29 -+({                                  \
    5.30 -+    unsigned long val;                     \
    5.31 -+    asm volatile ("mov %0=ar.bspstore;;" : "=r"(val) :: "memory");  \
    5.32 -+    val;                               \
    5.33 -+})
    5.34 -+
    5.35 -+#define ia64_set_bspstore(val)                       \
    5.36 -+    asm volatile ("mov ar.bspstore=%0;;" :: "r"(val) : "memory")
    5.37 -+
    5.38 -+#define ia64_get_rnat()     \
    5.39 -+({                                  \
    5.40 -+    unsigned long val;                     \
    5.41 -+    asm volatile ("mov %0=ar.rnat;" : "=r"(val) :: "memory");  \
    5.42 -+    val;                               \
    5.43 -+})
    5.44 -+
    5.45 -+#define ia64_set_rnat(val)                       \
    5.46 -+    asm volatile ("mov ar.rnat=%0;;" :: "r"(val) : "memory")
    5.47 -+
    5.48 -+#define ia64_ttag(addr)							\
    5.49 -+({										\
    5.50 -+	__u64 ia64_intri_res;							\
    5.51 -+	asm volatile ("ttag %0=%1" : "=r"(ia64_intri_res) : "r" (addr));	\
    5.52 -+	ia64_intri_res;								\
    5.53 -+})
    5.54 -+
    5.55 -+#define ia64_get_dcr()                          \
    5.56 -+({                                      \
    5.57 -+    __u64 result;                               \
    5.58 -+    asm volatile ("mov %0=cr.dcr" : "=r"(result) : );           \
    5.59 -+    result;                                 \
    5.60 -+})
    5.61 -+
    5.62 -+#define ia64_set_dcr(val)                           \
    5.63 -+({                                      \
    5.64 -+    asm volatile ("mov cr.dcr=%0" :: "r"(val) );            \
    5.65 -+})
    5.66 -+
    5.67 -+#endif // CONFIG_VTI
    5.68 -+
    5.69 -+
    5.70 - #define ia64_invala() asm volatile ("invala" ::: "memory")
    5.71 - 
    5.72 - #define ia64_thash(addr)							\
     6.1 --- a/xen/arch/ia64/patch/linux-2.6.11/hardirq.h	Fri Aug 26 11:02:14 2005 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,14 +0,0 @@
     6.4 ---- ../../linux-2.6.11/include/linux/hardirq.h	2005-03-02 00:38:00.000000000 -0700
     6.5 -+++ include/asm-ia64/linux/hardirq.h	2005-04-28 16:34:39.000000000 -0600
     6.6 -@@ -60,7 +60,11 @@
     6.7 -  */
     6.8 - #define in_irq()		(hardirq_count())
     6.9 - #define in_softirq()		(softirq_count())
    6.10 -+#ifndef XEN
    6.11 - #define in_interrupt()		(irq_count())
    6.12 -+#else
    6.13 -+#define in_interrupt()		0		// FIXME LATER
    6.14 -+#endif
    6.15 - 
    6.16 - #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
    6.17 - # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
     7.1 --- a/xen/arch/ia64/patch/linux-2.6.11/head.S	Fri Aug 26 11:02:14 2005 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,120 +0,0 @@
     7.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/kernel/head.S	2005-03-01 23:38:13.000000000 -0800
     7.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/head.S	2005-05-18 12:40:50.000000000 -0700
     7.6 -@@ -76,21 +76,21 @@
     7.7 - 	 * We initialize all of them to prevent inadvertently assuming
     7.8 - 	 * something about the state of address translation early in boot.
     7.9 - 	 */
    7.10 --	mov r6=((ia64_rid(IA64_REGION_ID_KERNEL, (0<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.11 -+	movl r6=((ia64_rid(IA64_REGION_ID_KERNEL, (0<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.12 - 	movl r7=(0<<61)
    7.13 --	mov r8=((ia64_rid(IA64_REGION_ID_KERNEL, (1<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.14 -+	movl r8=((ia64_rid(IA64_REGION_ID_KERNEL, (1<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.15 - 	movl r9=(1<<61)
    7.16 --	mov r10=((ia64_rid(IA64_REGION_ID_KERNEL, (2<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.17 -+	movl r10=((ia64_rid(IA64_REGION_ID_KERNEL, (2<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.18 - 	movl r11=(2<<61)
    7.19 --	mov r12=((ia64_rid(IA64_REGION_ID_KERNEL, (3<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.20 -+	movl r12=((ia64_rid(IA64_REGION_ID_KERNEL, (3<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.21 - 	movl r13=(3<<61)
    7.22 --	mov r14=((ia64_rid(IA64_REGION_ID_KERNEL, (4<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.23 -+	movl r14=((ia64_rid(IA64_REGION_ID_KERNEL, (4<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.24 - 	movl r15=(4<<61)
    7.25 --	mov r16=((ia64_rid(IA64_REGION_ID_KERNEL, (5<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.26 -+	movl r16=((ia64_rid(IA64_REGION_ID_KERNEL, (5<<61)) << 8) | (PAGE_SHIFT << 2) | 1)
    7.27 - 	movl r17=(5<<61)
    7.28 --	mov r18=((ia64_rid(IA64_REGION_ID_KERNEL, (6<<61)) << 8) | (IA64_GRANULE_SHIFT << 2))
    7.29 -+	movl r18=((ia64_rid(IA64_REGION_ID_KERNEL, (6<<61)) << 8) | (IA64_GRANULE_SHIFT << 2))
    7.30 - 	movl r19=(6<<61)
    7.31 --	mov r20=((ia64_rid(IA64_REGION_ID_KERNEL, (7<<61)) << 8) | (IA64_GRANULE_SHIFT << 2))
    7.32 -+	movl r20=((ia64_rid(IA64_REGION_ID_KERNEL, (7<<61)) << 8) | (IA64_GRANULE_SHIFT << 2))
    7.33 - 	movl r21=(7<<61)
    7.34 - 	;;
    7.35 - 	mov rr[r7]=r6
    7.36 -@@ -129,8 +129,13 @@
    7.37 - 	/*
    7.38 - 	 * Switch into virtual mode:
    7.39 - 	 */
    7.40 -+#ifdef CONFIG_VTI
    7.41 -+	movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH \
    7.42 -+		  |IA64_PSR_DI)
    7.43 -+#else // CONFIG_VTI
    7.44 - 	movl r16=(IA64_PSR_IT|IA64_PSR_IC|IA64_PSR_DT|IA64_PSR_RT|IA64_PSR_DFH|IA64_PSR_BN \
    7.45 - 		  |IA64_PSR_DI)
    7.46 -+#endif // CONFIG_VTI
    7.47 - 	;;
    7.48 - 	mov cr.ipsr=r16
    7.49 - 	movl r17=1f
    7.50 -@@ -143,7 +148,11 @@
    7.51 - 1:	// now we are in virtual mode
    7.52 - 
    7.53 - 	// set IVT entry point---can't access I/O ports without it
    7.54 -+#ifdef CONFIG_VTI
    7.55 -+    movl r3=vmx_ia64_ivt
    7.56 -+#else // CONFIG_VTI
    7.57 - 	movl r3=ia64_ivt
    7.58 -+#endif // CONFIG_VTI
    7.59 - 	;;
    7.60 - 	mov cr.iva=r3
    7.61 - 	movl r2=FPSR_DEFAULT
    7.62 -@@ -187,7 +196,11 @@
    7.63 - 	dep r18=0,r3,0,12
    7.64 - 	;;
    7.65 - 	or r18=r17,r18
    7.66 -+#ifdef XEN
    7.67 -+	dep r2=-1,r3,60,4	// IMVA of task
    7.68 -+#else
    7.69 - 	dep r2=-1,r3,61,3	// IMVA of task
    7.70 -+#endif
    7.71 - 	;;
    7.72 - 	mov r17=rr[r2]
    7.73 - 	shr.u r16=r3,IA64_GRANULE_SHIFT
    7.74 -@@ -207,8 +220,15 @@
    7.75 - 
    7.76 - .load_current:
    7.77 - 	// load the "current" pointer (r13) and ar.k6 with the current task
    7.78 -+#ifdef CONFIG_VTI
    7.79 -+	mov r21=r2		// virtual address
    7.80 -+	;;
    7.81 -+	bsw.1
    7.82 -+	;;
    7.83 -+#else // CONFIG_VTI
    7.84 - 	mov IA64_KR(CURRENT)=r2		// virtual address
    7.85 - 	mov IA64_KR(CURRENT_STACK)=r16
    7.86 -+#endif // CONFIG_VTI
    7.87 - 	mov r13=r2
    7.88 - 	/*
    7.89 - 	 * Reserve space at the top of the stack for "struct pt_regs".  Kernel threads
    7.90 -@@ -227,7 +247,11 @@
    7.91 - 	;;
    7.92 - 	mov ar.rsc=0x3		// place RSE in eager mode
    7.93 - 
    7.94 -+#ifdef XEN
    7.95 -+(isBP)	dep r28=-1,r28,60,4	// make address virtual
    7.96 -+#else
    7.97 - (isBP)	dep r28=-1,r28,61,3	// make address virtual
    7.98 -+#endif
    7.99 - (isBP)	movl r2=ia64_boot_param
   7.100 - 	;;
   7.101 - (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
   7.102 -@@ -254,7 +278,9 @@
   7.103 - 	br.call.sptk.many b0=console_print
   7.104 - 
   7.105 - self:	hint @pause
   7.106 -+	;;
   7.107 - 	br.sptk.many self		// endless loop
   7.108 -+	;;
   7.109 - END(_start)
   7.110 - 
   7.111 - GLOBAL_ENTRY(ia64_save_debug_regs)
   7.112 -@@ -850,7 +876,11 @@
   7.113 -  * intermediate precision so that we can produce a full 64-bit result.
   7.114 -  */
   7.115 - GLOBAL_ENTRY(sched_clock)
   7.116 -+#ifdef XEN
   7.117 -+	movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   7.118 -+#else
   7.119 - 	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
   7.120 -+#endif
   7.121 - 	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
   7.122 - 	;;
   7.123 - 	ldf8 f8=[r8]
     8.1 --- a/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h	Fri Aug 26 11:02:14 2005 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,26 +0,0 @@
     8.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h	2005-03-01 23:38:17.000000000 -0800
     8.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/include/asm-ia64/hpsim_ssc.h	2005-05-18 12:40:19.000000000 -0700
     8.6 -@@ -33,4 +33,23 @@
     8.7 -  */
     8.8 - extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
     8.9 - 
    8.10 -+#ifdef XEN
    8.11 -+/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
    8.12 -+ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
    8.13 -+#define SSC_OPEN			50
    8.14 -+#define SSC_CLOSE			51
    8.15 -+#define SSC_READ			52
    8.16 -+#define SSC_WRITE			53
    8.17 -+#define SSC_GET_COMPLETION		54
    8.18 -+#define SSC_WAIT_COMPLETION		55
    8.19 -+
    8.20 -+#define SSC_WRITE_ACCESS		2
    8.21 -+#define SSC_READ_ACCESS			1
    8.22 -+
    8.23 -+struct ssc_disk_req {
    8.24 -+	unsigned long addr;
    8.25 -+	unsigned long len;
    8.26 -+};
    8.27 -+#endif
    8.28 -+
    8.29 - #endif /* _IA64_PLATFORM_HPSIM_SSC_H */
     9.1 --- a/xen/arch/ia64/patch/linux-2.6.11/ia64regs.h	Fri Aug 26 11:02:14 2005 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,38 +0,0 @@
     9.4 ---- /home/adsharma/disk2/xen-ia64/test3.bk/xen/../../linux-2.6.11/include/asm-ia64/ia64regs.h	2005-03-01 23:38:07.000000000 -0800
     9.5 -+++ /home/adsharma/disk2/xen-ia64/test3.bk/xen/include/asm-ia64/ia64regs.h	2005-05-18 14:00:53.000000000 -0700
     9.6 -@@ -87,6 +87,35 @@
     9.7 - #define _IA64_REG_CR_LRR0	4176
     9.8 - #define _IA64_REG_CR_LRR1	4177
     9.9 - 
    9.10 -+#ifdef  CONFIG_VTI
    9.11 -+#define IA64_REG_CR_DCR   0
    9.12 -+#define IA64_REG_CR_ITM   1
    9.13 -+#define IA64_REG_CR_IVA   2
    9.14 -+#define IA64_REG_CR_PTA   8
    9.15 -+#define IA64_REG_CR_IPSR  16
    9.16 -+#define IA64_REG_CR_ISR   17
    9.17 -+#define IA64_REG_CR_IIP   19
    9.18 -+#define IA64_REG_CR_IFA   20
    9.19 -+#define IA64_REG_CR_ITIR  21
    9.20 -+#define IA64_REG_CR_IIPA  22
    9.21 -+#define IA64_REG_CR_IFS   23
    9.22 -+#define IA64_REG_CR_IIM   24
    9.23 -+#define IA64_REG_CR_IHA   25
    9.24 -+#define IA64_REG_CR_LID   64
    9.25 -+#define IA64_REG_CR_IVR   65
    9.26 -+#define IA64_REG_CR_TPR   66
    9.27 -+#define IA64_REG_CR_EOI   67
    9.28 -+#define IA64_REG_CR_IRR0  68
    9.29 -+#define IA64_REG_CR_IRR1  69
    9.30 -+#define IA64_REG_CR_IRR2  70
    9.31 -+#define IA64_REG_CR_IRR3  71
    9.32 -+#define IA64_REG_CR_ITV   72
    9.33 -+#define IA64_REG_CR_PMV   73
    9.34 -+#define IA64_REG_CR_CMCV  74
    9.35 -+#define IA64_REG_CR_LRR0  80
    9.36 -+#define IA64_REG_CR_LRR1  81
    9.37 -+#endif  //  CONFIG_VTI
    9.38 -+
    9.39 - /* Indirect Registers for getindreg() and setindreg() */
    9.40 - 
    9.41 - #define _IA64_REG_INDR_CPUID	9000	/* getindreg only */
    10.1 --- a/xen/arch/ia64/patch/linux-2.6.11/interrupt.h	Fri Aug 26 11:02:14 2005 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,27 +0,0 @@
    10.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/include/linux/interrupt.h	2005-03-01 23:38:09.000000000 -0800
    10.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/include/asm-ia64/linux/interrupt.h	2005-05-18 12:40:50.000000000 -0700
    10.6 -@@ -33,6 +33,7 @@
    10.7 - #define IRQ_HANDLED	(1)
    10.8 - #define IRQ_RETVAL(x)	((x) != 0)
    10.9 - 
   10.10 -+#ifndef XEN
   10.11 - struct irqaction {
   10.12 - 	irqreturn_t (*handler)(int, void *, struct pt_regs *);
   10.13 - 	unsigned long flags;
   10.14 -@@ -49,6 +50,7 @@
   10.15 - 		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
   10.16 - 		       unsigned long, const char *, void *);
   10.17 - extern void free_irq(unsigned int, void *);
   10.18 -+#endif
   10.19 - 
   10.20 - 
   10.21 - #ifdef CONFIG_GENERIC_HARDIRQS
   10.22 -@@ -121,7 +123,7 @@
   10.23 - };
   10.24 - 
   10.25 - asmlinkage void do_softirq(void);
   10.26 --extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
   10.27 -+//extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
   10.28 - extern void softirq_init(void);
   10.29 - #define __raise_softirq_irqoff(nr) do { local_softirq_pending() |= 1UL << (nr); } while (0)
   10.30 - extern void FASTCALL(raise_softirq_irqoff(unsigned int nr));
    11.1 --- a/xen/arch/ia64/patch/linux-2.6.11/io.h	Fri Aug 26 11:02:14 2005 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,14 +0,0 @@
    11.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/include/asm-ia64/io.h	2005-03-01 23:38:34.000000000 -0800
    11.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/include/asm-ia64/io.h	2005-05-18 12:40:50.000000000 -0700
    11.6 -@@ -23,7 +23,11 @@
    11.7 - #define __SLOW_DOWN_IO	do { } while (0)
    11.8 - #define SLOW_DOWN_IO	do { } while (0)
    11.9 - 
   11.10 -+#ifdef XEN
   11.11 -+#define __IA64_UNCACHED_OFFSET	0xe800000000000000UL
   11.12 -+#else
   11.13 - #define __IA64_UNCACHED_OFFSET	0xc000000000000000UL	/* region 6 */
   11.14 -+#endif
   11.15 - 
   11.16 - /*
   11.17 -  * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
    12.1 --- a/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c	Fri Aug 26 11:02:14 2005 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,126 +0,0 @@
    12.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/kernel/irq_ia64.c	2005-03-01 23:38:07.000000000 -0800
    12.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/irq_ia64.c	2005-05-18 12:40:51.000000000 -0700
    12.6 -@@ -106,6 +106,9 @@
    12.7 - 	unsigned long saved_tpr;
    12.8 - 
    12.9 - #if IRQ_DEBUG
   12.10 -+#ifdef XEN
   12.11 -+	xen_debug_irq(vector, regs);
   12.12 -+#endif
   12.13 - 	{
   12.14 - 		unsigned long bsp, sp;
   12.15 - 
   12.16 -@@ -148,6 +151,9 @@
   12.17 - 			ia64_setreg(_IA64_REG_CR_TPR, vector);
   12.18 - 			ia64_srlz_d();
   12.19 - 
   12.20 -+#ifdef XEN
   12.21 -+			if (!xen_do_IRQ(vector))
   12.22 -+#endif
   12.23 - 			__do_IRQ(local_vector_to_irq(vector), regs);
   12.24 - 
   12.25 - 			/*
   12.26 -@@ -167,6 +173,103 @@
   12.27 - 	irq_exit();
   12.28 - }
   12.29 - 
   12.30 -+#ifdef  CONFIG_VTI
   12.31 -+#define vmx_irq_enter()		\
   12.32 -+	add_preempt_count(HARDIRQ_OFFSET);
   12.33 -+
   12.34 -+/* Now softirq will be checked when leaving hypervisor, or else
   12.35 -+ * scheduler irq will be executed too early.
   12.36 -+ */
   12.37 -+#define vmx_irq_exit(void)	\
   12.38 -+	sub_preempt_count(HARDIRQ_OFFSET);
   12.39 -+/*
   12.40 -+ * That's where the IVT branches when we get an external
   12.41 -+ * interrupt. This branches to the correct hardware IRQ handler via
   12.42 -+ * function ptr.
   12.43 -+ */
   12.44 -+void
   12.45 -+vmx_ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
   12.46 -+{
   12.47 -+	unsigned long saved_tpr;
   12.48 -+	int	wake_dom0 = 0;
   12.49 -+
   12.50 -+
   12.51 -+#if IRQ_DEBUG
   12.52 -+	{
   12.53 -+		unsigned long bsp, sp;
   12.54 -+
   12.55 -+		/*
   12.56 -+		 * Note: if the interrupt happened while executing in
   12.57 -+		 * the context switch routine (ia64_switch_to), we may
   12.58 -+		 * get a spurious stack overflow here.  This is
   12.59 -+		 * because the register and the memory stack are not
   12.60 -+		 * switched atomically.
   12.61 -+		 */
   12.62 -+		bsp = ia64_getreg(_IA64_REG_AR_BSP);
   12.63 -+		sp = ia64_getreg(_IA64_REG_AR_SP);
   12.64 -+
   12.65 -+		if ((sp - bsp) < 1024) {
   12.66 -+			static unsigned char count;
   12.67 -+			static long last_time;
   12.68 -+
   12.69 -+			if (jiffies - last_time > 5*HZ)
   12.70 -+				count = 0;
   12.71 -+			if (++count < 5) {
   12.72 -+				last_time = jiffies;
   12.73 -+				printk("ia64_handle_irq: DANGER: less than "
   12.74 -+				       "1KB of free stack space!!\n"
   12.75 -+				       "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
   12.76 -+			}
   12.77 -+		}
   12.78 -+	}
   12.79 -+#endif /* IRQ_DEBUG */
   12.80 -+
   12.81 -+	/*
   12.82 -+	 * Always set TPR to limit maximum interrupt nesting depth to
   12.83 -+	 * 16 (without this, it would be ~240, which could easily lead
   12.84 -+	 * to kernel stack overflows).
   12.85 -+	 */
   12.86 -+	vmx_irq_enter();
   12.87 -+	saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
   12.88 -+	ia64_srlz_d();
   12.89 -+	while (vector != IA64_SPURIOUS_INT_VECTOR) {
   12.90 -+	    if (!IS_RESCHEDULE(vector)) {
   12.91 -+		ia64_setreg(_IA64_REG_CR_TPR, vector);
   12.92 -+		ia64_srlz_d();
   12.93 -+
   12.94 -+		if (vector != IA64_TIMER_VECTOR) {
   12.95 -+			/* FIXME: Leave IRQ re-route later */
   12.96 -+			vmx_vcpu_pend_interrupt(dom0->vcpu[0],vector);
   12.97 -+			wake_dom0 = 1;
   12.98 -+		}
   12.99 -+		else {	// FIXME: Handle Timer only now
  12.100 -+			__do_IRQ(local_vector_to_irq(vector), regs);
  12.101 -+		}
  12.102 -+		
  12.103 -+		/*
  12.104 -+		 * Disable interrupts and send EOI:
  12.105 -+		 */
  12.106 -+		local_irq_disable();
  12.107 -+		ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
  12.108 -+	    }
  12.109 -+	    else {
  12.110 -+                printf("Oops: RESCHEDULE IPI absorbed by HV\n");
  12.111 -+            }
  12.112 -+	    ia64_eoi();
  12.113 -+	    vector = ia64_get_ivr();
  12.114 -+	}
  12.115 -+	/*
  12.116 -+	 * This must be done *after* the ia64_eoi().  For example, the keyboard softirq
  12.117 -+	 * handler needs to be able to wait for further keyboard interrupts, which can't
  12.118 -+	 * come through until ia64_eoi() has been done.
  12.119 -+	 */
  12.120 -+	vmx_irq_exit();
  12.121 -+	if ( wake_dom0 && current != dom0 ) 
  12.122 -+		vcpu_wake(dom0->vcpu[0]);
  12.123 -+}
  12.124 -+#endif
  12.125 -+
  12.126 -+
  12.127 - #ifdef CONFIG_HOTPLUG_CPU
  12.128 - /*
  12.129 -  * This function emulates a interrupt processing when a cpu is about to be
    13.1 --- a/xen/arch/ia64/patch/linux-2.6.11/kregs.h	Fri Aug 26 11:02:14 2005 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,66 +0,0 @@
    13.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/include/asm-ia64/kregs.h	2005-03-01 23:37:49.000000000 -0800
    13.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/include/asm-ia64/kregs.h	2005-05-18 12:40:50.000000000 -0700
    13.6 -@@ -29,8 +29,21 @@
    13.7 -  */
    13.8 - #define IA64_TR_KERNEL		0	/* itr0, dtr0: maps kernel image (code & data) */
    13.9 - #define IA64_TR_PALCODE		1	/* itr1: maps PALcode as required by EFI */
   13.10 -+#ifdef CONFIG_VTI
   13.11 -+#define IA64_TR_XEN_IN_DOM	6	/* itr6, dtr6: Double mapping for xen image in domain space */
   13.12 -+#endif // CONFIG_VTI
   13.13 - #define IA64_TR_PERCPU_DATA	1	/* dtr1: percpu data */
   13.14 - #define IA64_TR_CURRENT_STACK	2	/* dtr2: maps kernel's memory- & register-stacks */
   13.15 -+#ifdef XEN
   13.16 -+#define IA64_TR_SHARED_INFO	3	/* dtr3: page shared with domain */
   13.17 -+#define	IA64_TR_VHPT		4	/* dtr4: vhpt */
   13.18 -+#define IA64_TR_ARCH_INFO      5
   13.19 -+#ifdef CONFIG_VTI
   13.20 -+#define IA64_TR_VHPT_IN_DOM	5	/* dtr5: Double mapping for vhpt table in domain space */
   13.21 -+#define IA64_TR_RR7_SWITCH_STUB	7	/* dtr7: mapping for rr7 switch stub */
   13.22 -+#define IA64_TEMP_PHYSICAL	8	/* itr8, dtr8: temp mapping for guest physical memory 256M */
   13.23 -+#endif // CONFIG_VTI
   13.24 -+#endif
   13.25 - 
   13.26 - /* Processor status register bits: */
   13.27 - #define IA64_PSR_BE_BIT		1
   13.28 -@@ -66,6 +78,9 @@
   13.29 - #define IA64_PSR_ED_BIT		43
   13.30 - #define IA64_PSR_BN_BIT		44
   13.31 - #define IA64_PSR_IA_BIT		45
   13.32 -+#ifdef CONFIG_VTI
   13.33 -+#define IA64_PSR_VM_BIT		46
   13.34 -+#endif // CONFIG_VTI
   13.35 - 
   13.36 - /* A mask of PSR bits that we generally don't want to inherit across a clone2() or an
   13.37 -    execve().  Only list flags here that need to be cleared/set for BOTH clone2() and
   13.38 -@@ -107,6 +122,9 @@
   13.39 - #define IA64_PSR_ED	(__IA64_UL(1) << IA64_PSR_ED_BIT)
   13.40 - #define IA64_PSR_BN	(__IA64_UL(1) << IA64_PSR_BN_BIT)
   13.41 - #define IA64_PSR_IA	(__IA64_UL(1) << IA64_PSR_IA_BIT)
   13.42 -+#ifdef CONFIG_VTI
   13.43 -+#define IA64_PSR_VM	(__IA64_UL(1) << IA64_PSR_VM_BIT)
   13.44 -+#endif // CONFIG_VTI
   13.45 - 
   13.46 - /* User mask bits: */
   13.47 - #define IA64_PSR_UM	(IA64_PSR_BE | IA64_PSR_UP | IA64_PSR_AC | IA64_PSR_MFL | IA64_PSR_MFH)
   13.48 -@@ -160,4 +178,21 @@
   13.49 - #define IA64_ISR_CODE_LFETCH	4
   13.50 - #define IA64_ISR_CODE_PROBEF	5
   13.51 - 
   13.52 -+#ifdef XEN
   13.53 -+/* Interruption Function State */
   13.54 -+#define IA64_IFS_V_BIT		63
   13.55 -+#define IA64_IFS_V	(__IA64_UL(1) << IA64_IFS_V_BIT)
   13.56 -+
   13.57 -+/* Page Table Address */
   13.58 -+#define IA64_PTA_VE_BIT 0
   13.59 -+#define IA64_PTA_SIZE_BIT 2
   13.60 -+#define IA64_PTA_VF_BIT 8
   13.61 -+#define IA64_PTA_BASE_BIT 15
   13.62 -+
   13.63 -+#define IA64_PTA_VE     (__IA64_UL(1) << IA64_PTA_VE_BIT)
   13.64 -+#define IA64_PTA_SIZE   (__IA64_UL(0x3f) << IA64_PTA_SIZE_BIT)
   13.65 -+#define IA64_PTA_VF     (__IA64_UL(1) << IA64_PTA_VF_BIT)
   13.66 -+#define IA64_PTA_BASE   (__IA64_UL(0) - ((__IA64_UL(1) << IA64_PTA_BASE_BIT)))
   13.67 -+#endif
   13.68 -+
   13.69 - #endif /* _ASM_IA64_kREGS_H */
    14.1 --- a/xen/arch/ia64/patch/linux-2.6.11/mca_asm.h	Fri Aug 26 11:02:14 2005 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,32 +0,0 @@
    14.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/include/asm-ia64/mca_asm.h	2005-03-01 23:38:38.000000000 -0800
    14.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/include/asm-ia64/mca_asm.h	2005-05-18 12:40:19.000000000 -0700
    14.6 -@@ -26,8 +26,13 @@
    14.7 -  * direct mapped to physical addresses.
    14.8 -  *	1. Lop off bits 61 thru 63 in the virtual address
    14.9 -  */
   14.10 -+#ifdef XEN
   14.11 -+#define INST_VA_TO_PA(addr)							\
   14.12 -+	dep	addr	= 0, addr, 60, 4
   14.13 -+#else // XEN
   14.14 - #define INST_VA_TO_PA(addr)							\
   14.15 - 	dep	addr	= 0, addr, 61, 3
   14.16 -+#endif // XEN
   14.17 - /*
   14.18 -  * This macro converts a data virtual address to a physical address
   14.19 -  * Right now for simulation purposes the virtual addresses are
   14.20 -@@ -42,9 +47,15 @@
   14.21 -  * direct mapped to physical addresses.
   14.22 -  *	1. Put 0x7 in bits 61 thru 63.
   14.23 -  */
   14.24 -+#ifdef XEN
   14.25 -+#define DATA_PA_TO_VA(addr,temp)							\
   14.26 -+	mov	temp	= 0xf	;;							\
   14.27 -+	dep	addr	= temp, addr, 60, 4
   14.28 -+#else // XEN
   14.29 - #define DATA_PA_TO_VA(addr,temp)							\
   14.30 - 	mov	temp	= 0x7	;;							\
   14.31 - 	dep	addr	= temp, addr, 61, 3
   14.32 -+#endif // XEN
   14.33 - 
   14.34 - #define GET_THIS_PADDR(reg, var)		\
   14.35 - 	mov	reg = IA64_KR(PER_CPU_DATA);;	\
    15.1 --- a/xen/arch/ia64/patch/linux-2.6.11/minstate.h	Fri Aug 26 11:02:14 2005 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,25 +0,0 @@
    15.4 - minstate.h |    4 ++--
    15.5 - 1 files changed, 2 insertions(+), 2 deletions(-)
    15.6 -
    15.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h
    15.8 -===================================================================
    15.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/minstate.h	2005-04-06 22:51:31.170261541 -0500
   15.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h	2005-04-06 22:54:03.210575034 -0500
   15.11 -@@ -48,7 +48,7 @@
   15.12 - (pUStk)	mov r24=ar.rnat;									\
   15.13 - (pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
   15.14 - (pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
   15.15 --(pUStk)	dep r22=-1,r22,61,3;			/* compute kernel virtual addr of RBS */	\
   15.16 -+(pUStk)	dep r22=-1,r22,60,4;			/* compute kernel virtual addr of RBS */	\
   15.17 - 	;;											\
   15.18 - (pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;		/* if in kernel mode, use sp (r12) */		\
   15.19 - (pUStk)	mov ar.bspstore=r22;			/* switch to kernel RBS */			\
   15.20 -@@ -57,7 +57,7 @@
   15.21 - (pUStk)	mov ar.rsc=0x3;		/* set eager mode, pl 0, little-endian, loadrs=0 */		\
   15.22 - 
   15.23 - #define MINSTATE_END_SAVE_MIN_PHYS								\
   15.24 --	dep r12=-1,r12,61,3;		/* make sp a kernel virtual address */			\
   15.25 -+	dep r12=-1,r12,60,4;		/* make sp a kernel virtual address */			\
   15.26 - 	;;
   15.27 - 
   15.28 - #ifdef MINSTATE_VIRT
    16.1 --- a/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c	Fri Aug 26 11:02:14 2005 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,47 +0,0 @@
    16.4 ---- ../../linux-2.6.11/arch/ia64/mm/contig.c	2005-03-02 00:37:55.000000000 -0700
    16.5 -+++ arch/ia64/mm_contig.c	2005-04-28 16:13:52.000000000 -0600
    16.6 -@@ -35,6 +35,7 @@
    16.7 -  *
    16.8 -  * Just walks the pages in the system and describes where they're allocated.
    16.9 -  */
   16.10 -+#ifndef XEN
   16.11 - void
   16.12 - show_mem (void)
   16.13 - {
   16.14 -@@ -63,6 +64,7 @@
   16.15 - 	printk("%d pages swap cached\n", cached);
   16.16 - 	printk("%ld pages in page table cache\n", pgtable_cache_size);
   16.17 - }
   16.18 -+#endif
   16.19 - 
   16.20 - /* physical address where the bootmem map is located */
   16.21 - unsigned long bootmap_start;
   16.22 -@@ -140,6 +142,7 @@
   16.23 -  * Walk the EFI memory map and find usable memory for the system, taking
   16.24 -  * into account reserved areas.
   16.25 -  */
   16.26 -+#ifndef XEN
   16.27 - void
   16.28 - find_memory (void)
   16.29 - {
   16.30 -@@ -168,6 +171,7 @@
   16.31 - 
   16.32 - 	find_initrd();
   16.33 - }
   16.34 -+#endif
   16.35 - 
   16.36 - #ifdef CONFIG_SMP
   16.37 - /**
   16.38 -@@ -225,6 +229,7 @@
   16.39 -  * Set up the page tables.
   16.40 -  */
   16.41 - 
   16.42 -+#ifndef XEN
   16.43 - void
   16.44 - paging_init (void)
   16.45 - {
   16.46 -@@ -297,3 +302,4 @@
   16.47 - #endif /* !CONFIG_VIRTUAL_MEM_MAP */
   16.48 - 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
   16.49 - }
   16.50 -+#endif /* !CONFIG_XEN */
    17.1 --- a/xen/arch/ia64/patch/linux-2.6.11/page.h	Fri Aug 26 11:02:14 2005 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,74 +0,0 @@
    17.4 ---- /home/adsharma/xeno-unstable-ia64-staging.bk/xen/../../linux-2.6.11/include/asm-ia64/page.h	2005-03-01 23:37:48.000000000 -0800
    17.5 -+++ /home/adsharma/xeno-unstable-ia64-staging.bk/xen/include/asm-ia64/page.h	2005-05-20 09:36:02.000000000 -0700
    17.6 -@@ -32,6 +32,7 @@
    17.7 - #define PAGE_ALIGN(addr)	(((addr) + PAGE_SIZE - 1) & PAGE_MASK)
    17.8 - 
    17.9 - #define PERCPU_PAGE_SHIFT	16	/* log2() of max. size of per-CPU area */
   17.10 -+
   17.11 - #define PERCPU_PAGE_SIZE	(__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
   17.12 - 
   17.13 - #define RGN_MAP_LIMIT	((1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE)	/* per region addr limit */
   17.14 -@@ -95,9 +96,15 @@
   17.15 - #endif
   17.16 - 
   17.17 - #ifndef CONFIG_DISCONTIGMEM
   17.18 -+#ifdef XEN
   17.19 -+# define pfn_valid(pfn)		(0)
   17.20 -+# define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
   17.21 -+# define pfn_to_page(_pfn)	(frame_table + (_pfn))
   17.22 -+#else
   17.23 - # define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
   17.24 - # define page_to_pfn(page)	((unsigned long) (page - mem_map))
   17.25 - # define pfn_to_page(pfn)	(mem_map + (pfn))
   17.26 -+#endif
   17.27 - #else
   17.28 - extern struct page *vmem_map;
   17.29 - extern unsigned long max_low_pfn;
   17.30 -@@ -109,6 +116,11 @@
   17.31 - #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   17.32 - #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
   17.33 - 
   17.34 -+#ifdef XEN
   17.35 -+#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
   17.36 -+#define phys_to_page(kaddr)	pfn_to_page(((kaddr) >> PAGE_SHIFT))
   17.37 -+#endif
   17.38 -+
   17.39 - typedef union ia64_va {
   17.40 - 	struct {
   17.41 - 		unsigned long off : 61;		/* intra-region offset */
   17.42 -@@ -124,8 +136,23 @@
   17.43 -  * expressed in this way to ensure they result in a single "dep"
   17.44 -  * instruction.
   17.45 -  */
   17.46 -+#ifdef XEN
   17.47 -+typedef union xen_va {
   17.48 -+	struct {
   17.49 -+		unsigned long off : 60;
   17.50 -+		unsigned long reg : 4;
   17.51 -+	} f;
   17.52 -+	unsigned long l;
   17.53 -+	void *p;
   17.54 -+} xen_va;
   17.55 -+
   17.56 -+// xen/drivers/console.c uses __va in a declaration (should be fixed!)
   17.57 -+#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   17.58 -+#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   17.59 -+#else
   17.60 - #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   17.61 - #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   17.62 -+#endif
   17.63 - 
   17.64 - #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
   17.65 - #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
   17.66 -@@ -197,7 +224,11 @@
   17.67 - # define __pgprot(x)	(x)
   17.68 - #endif /* !STRICT_MM_TYPECHECKS */
   17.69 - 
   17.70 -+#ifdef XEN
   17.71 -+#define PAGE_OFFSET			__IA64_UL_CONST(0xf000000000000000)
   17.72 -+#else
   17.73 - #define PAGE_OFFSET			__IA64_UL_CONST(0xe000000000000000)
   17.74 -+#endif
   17.75 - 
   17.76 - #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
   17.77 - 					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
    18.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pal.S	Fri Aug 26 11:02:14 2005 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,26 +0,0 @@
    18.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/kernel/pal.S	2005-03-01 23:38:33.000000000 -0800
    18.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/pal.S	2005-05-18 12:40:19.000000000 -0700
    18.6 -@@ -166,7 +166,11 @@
    18.7 - 	adds r8  = 1f-1b,r8		// calculate return address for call
    18.8 - 	;;
    18.9 - 	mov loc4=ar.rsc			// save RSE configuration
   18.10 -+#ifdef XEN
   18.11 -+	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   18.12 -+#else // XEN
   18.13 - 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   18.14 -+#endif // XEN
   18.15 - 	tpa r8=r8			// convert rp to physical
   18.16 - 	;;
   18.17 - 	mov b7 = loc2			// install target to branch reg
   18.18 -@@ -225,7 +229,11 @@
   18.19 - 	mov loc3 = psr		// save psr
   18.20 - 	;;
   18.21 - 	mov loc4=ar.rsc			// save RSE configuration
   18.22 -+#ifdef XEN
   18.23 -+	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   18.24 -+#else // XEN
   18.25 - 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   18.26 -+#endif // XEN
   18.27 - 	;;
   18.28 - 	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
   18.29 - 	movl r16=PAL_PSR_BITS_TO_CLEAR
    19.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pal.h	Fri Aug 26 11:02:14 2005 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,12 +0,0 @@
    19.4 ---- /home/adsharma/disk2/xen-ia64/test3.bk/xen/../../linux-2.6.11/include/asm-ia64/pal.h	2005-03-01 23:38:13.000000000 -0800
    19.5 -+++ /home/adsharma/disk2/xen-ia64/test3.bk/xen/include/asm-ia64/pal.h	2005-05-18 14:00:53.000000000 -0700
    19.6 -@@ -1559,6 +1559,9 @@
    19.7 - 	return iprv.status;
    19.8 - }
    19.9 - 
   19.10 -+#ifdef CONFIG_VTI
   19.11 -+#include <asm/vmx_pal.h>
   19.12 -+#endif // CONFIG_VTI
   19.13 - #endif /* __ASSEMBLY__ */
   19.14 - 
   19.15 - #endif /* _ASM_IA64_PAL_H */
    20.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Fri Aug 26 11:02:14 2005 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,76 +0,0 @@
    20.4 ---- ../../linux-2.6.11/include/asm-ia64/pgalloc.h	2005-03-02 00:37:31.000000000 -0700
    20.5 -+++ include/asm-ia64/pgalloc.h	2005-06-09 13:40:48.000000000 -0600
    20.6 -@@ -61,7 +61,12 @@
    20.7 - 	pgd_t *pgd = pgd_alloc_one_fast(mm);
    20.8 - 
    20.9 - 	if (unlikely(pgd == NULL)) {
   20.10 -+#ifdef XEN
   20.11 -+		pgd = (pgd_t *)alloc_xenheap_page();
   20.12 -+		memset(pgd,0,PAGE_SIZE);
   20.13 -+#else
   20.14 - 		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
   20.15 -+#endif
   20.16 - 	}
   20.17 - 	return pgd;
   20.18 - }
   20.19 -@@ -104,7 +109,12 @@
   20.20 - static inline pmd_t*
   20.21 - pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
   20.22 - {
   20.23 -+#ifdef XEN
   20.24 -+	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
   20.25 -+	memset(pmd,0,PAGE_SIZE);
   20.26 -+#else
   20.27 - 	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   20.28 -+#endif
   20.29 - 
   20.30 - 	return pmd;
   20.31 - }
   20.32 -@@ -136,7 +146,12 @@
   20.33 - static inline struct page *
   20.34 - pte_alloc_one (struct mm_struct *mm, unsigned long addr)
   20.35 - {
   20.36 -+#ifdef XEN
   20.37 -+	struct page *pte = alloc_xenheap_page();
   20.38 -+	memset(pte,0,PAGE_SIZE);
   20.39 -+#else
   20.40 - 	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
   20.41 -+#endif
   20.42 - 
   20.43 - 	return pte;
   20.44 - }
   20.45 -@@ -144,7 +159,12 @@
   20.46 - static inline pte_t *
   20.47 - pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
   20.48 - {
   20.49 -+#ifdef XEN
   20.50 -+	pte_t *pte = (pte_t *)alloc_xenheap_page();
   20.51 -+	memset(pte,0,PAGE_SIZE);
   20.52 -+#else
   20.53 - 	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   20.54 -+#endif
   20.55 - 
   20.56 - 	return pte;
   20.57 - }
   20.58 -@@ -152,13 +172,21 @@
   20.59 - static inline void
   20.60 - pte_free (struct page *pte)
   20.61 - {
   20.62 -+#ifdef XEN
   20.63 -+	free_xenheap_page(pte);
   20.64 -+#else
   20.65 - 	__free_page(pte);
   20.66 -+#endif
   20.67 - }
   20.68 - 
   20.69 - static inline void
   20.70 - pte_free_kernel (pte_t *pte)
   20.71 - {
   20.72 -+#ifdef XEN
   20.73 -+	free_xenheap_page((unsigned long) pte);
   20.74 -+#else
   20.75 - 	free_page((unsigned long) pte);
   20.76 -+#endif
   20.77 - }
   20.78 - 
   20.79 - #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
    21.1 --- a/xen/arch/ia64/patch/linux-2.6.11/processor.h	Fri Aug 26 11:02:14 2005 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,37 +0,0 @@
    21.4 ---- /home/adsharma/xeno-unstable-ia64-staging.bk/xen/../../linux-2.6.11/include/asm-ia64/processor.h	2005-03-01 23:37:58.000000000 -0800
    21.5 -+++ /home/adsharma/xeno-unstable-ia64-staging.bk/xen/include/asm-ia64/processor.h	2005-05-20 09:36:02.000000000 -0700
    21.6 -@@ -94,7 +94,11 @@
    21.7 - #ifdef CONFIG_NUMA
    21.8 - #include <asm/nodedata.h>
    21.9 - #endif
   21.10 -+#ifdef XEN
   21.11 -+#include <asm/xenprocessor.h>
   21.12 -+#endif
   21.13 - 
   21.14 -+#ifndef XEN
   21.15 - /* like above but expressed as bitfields for more efficient access: */
   21.16 - struct ia64_psr {
   21.17 - 	__u64 reserved0 : 1;
   21.18 -@@ -133,6 +137,7 @@
   21.19 - 	__u64 bn : 1;
   21.20 - 	__u64 reserved4 : 19;
   21.21 - };
   21.22 -+#endif
   21.23 - 
   21.24 - /*
   21.25 -  * CPU type, hardware bug flags, and per-CPU state.  Frequently used
   21.26 -@@ -408,12 +413,14 @@
   21.27 -  */
   21.28 - 
   21.29 - /* Return TRUE if task T owns the fph partition of the CPU we're running on. */
   21.30 -+#ifndef XEN
   21.31 - #define ia64_is_local_fpu_owner(t)								\
   21.32 - ({												\
   21.33 - 	struct task_struct *__ia64_islfo_task = (t);						\
   21.34 - 	(__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id()				\
   21.35 - 	 && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER));	\
   21.36 - })
   21.37 -+#endif
   21.38 - 
   21.39 - /* Mark task T as owning the fph partition of the CPU we're running on. */
   21.40 - #define ia64_set_local_fpu_owner(t) do {						\
    22.1 --- a/xen/arch/ia64/patch/linux-2.6.11/ptrace.h	Fri Aug 26 11:02:14 2005 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,20 +0,0 @@
    22.4 ---- /home/adsharma/disk2/xen-ia64/test3.bk/xen/../../linux-2.6.11/include/asm-ia64/ptrace.h	2005-03-01 23:38:38.000000000 -0800
    22.5 -+++ /home/adsharma/disk2/xen-ia64/test3.bk/xen/include/asm-ia64/ptrace.h	2005-05-18 14:00:53.000000000 -0700
    22.6 -@@ -95,6 +95,9 @@
    22.7 -  * (because the memory stack pointer MUST ALWAYS be aligned this way)
    22.8 -  *
    22.9 -  */
   22.10 -+#ifdef XEN
   22.11 -+#include <public/arch-ia64.h>
   22.12 -+#else
   22.13 - struct pt_regs {
   22.14 - 	/* The following registers are saved by SAVE_MIN: */
   22.15 - 	unsigned long b6;		/* scratch */
   22.16 -@@ -170,6 +173,7 @@
   22.17 - 	struct ia64_fpreg f10;		/* scratch */
   22.18 - 	struct ia64_fpreg f11;		/* scratch */
   22.19 - };
   22.20 -+#endif
   22.21 - 
   22.22 - /*
   22.23 -  * This structure contains the addition registers that need to
    23.1 --- a/xen/arch/ia64/patch/linux-2.6.11/series	Fri Aug 26 11:02:14 2005 +0000
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,40 +0,0 @@
    23.4 -bootmem.h
    23.5 -current.h
    23.6 -efi.c
    23.7 -efi.h
    23.8 -entry.S
    23.9 -gcc_intrin.h
   23.10 -hardirq.h
   23.11 -head.S
   23.12 -hpsim_irq.c
   23.13 -hpsim_ssc.h
   23.14 -hw_irq.h
   23.15 -ide.h
   23.16 -init_task.c
   23.17 -init_task.h
   23.18 -interrupt.h
   23.19 -io.h
   23.20 -irq.h
   23.21 -irq_ia64.c
   23.22 -ivt.S
   23.23 -kregs.h
   23.24 -lds.S
   23.25 -linuxtime.h
   23.26 -minstate.h
   23.27 -mm_bootmem.c
   23.28 -mm_contig.c
   23.29 -mmzone.h
   23.30 -page_alloc.c
   23.31 -page.h
   23.32 -processor.h
   23.33 -sal.h
   23.34 -setup.c
   23.35 -slab.c
   23.36 -slab.h
   23.37 -system.h
   23.38 -time.c
   23.39 -kernel-time.c
   23.40 -tlb.c
   23.41 -types.h
   23.42 -unaligned.c
   23.43 -wait.h
    24.1 --- a/xen/arch/ia64/patch/linux-2.6.11/setup.c	Fri Aug 26 11:02:14 2005 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,151 +0,0 @@
    24.4 ---- ../../linux-2.6.11/arch/ia64/kernel/setup.c	2005-03-02 00:37:49.000000000 -0700
    24.5 -+++ arch/ia64/setup.c	2005-06-03 10:14:24.000000000 -0600
    24.6 -@@ -51,6 +51,10 @@
    24.7 - #include <asm/smp.h>
    24.8 - #include <asm/system.h>
    24.9 - #include <asm/unistd.h>
   24.10 -+#ifdef CONFIG_VTI
   24.11 -+#include <asm/vmx.h>
   24.12 -+#endif // CONFIG_VTI
   24.13 -+#include <asm/io.h>
   24.14 - 
   24.15 - #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
   24.16 - # error "struct cpuinfo_ia64 too big!"
   24.17 -@@ -127,7 +131,16 @@
   24.18 - 		range_end   = min(end, rsvd_region[i].start);
   24.19 - 
   24.20 - 		if (range_start < range_end)
   24.21 -+#ifdef XEN
   24.22 -+		{
   24.23 -+		/* init_boot_pages requires "ps, pe" */
   24.24 -+			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
   24.25 -+				__pa(range_start), __pa(range_end));
   24.26 -+			(*func)(__pa(range_start), __pa(range_end), 0);
   24.27 -+		}
   24.28 -+#else
   24.29 - 			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   24.30 -+#endif
   24.31 - 
   24.32 - 		/* nothing more available in this segment */
   24.33 - 		if (range_end == end) return 0;
   24.34 -@@ -185,7 +198,12 @@
   24.35 - 	n++;
   24.36 - 
   24.37 - 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   24.38 -+#ifdef XEN
   24.39 -+	/* Reserve xen image/bitmap/xen-heap */
   24.40 -+	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   24.41 -+#else
   24.42 - 	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   24.43 -+#endif
   24.44 - 	n++;
   24.45 - 
   24.46 - #ifdef CONFIG_BLK_DEV_INITRD
   24.47 -@@ -299,17 +317,25 @@
   24.48 - }
   24.49 - 
   24.50 - void __init
   24.51 -+#ifdef XEN
   24.52 -+early_setup_arch (char **cmdline_p)
   24.53 -+#else
   24.54 - setup_arch (char **cmdline_p)
   24.55 -+#endif
   24.56 - {
   24.57 - 	unw_init();
   24.58 - 
   24.59 - 	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
   24.60 - 
   24.61 - 	*cmdline_p = __va(ia64_boot_param->command_line);
   24.62 -+#ifdef XEN
   24.63 -+	efi_init();
   24.64 -+#else
   24.65 - 	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
   24.66 - 
   24.67 - 	efi_init();
   24.68 - 	io_port_init();
   24.69 -+#endif
   24.70 - 
   24.71 - #ifdef CONFIG_IA64_GENERIC
   24.72 - 	{
   24.73 -@@ -336,6 +362,11 @@
   24.74 - 	}
   24.75 - #endif
   24.76 - 
   24.77 -+#ifdef XEN
   24.78 -+	early_cmdline_parse(cmdline_p);
   24.79 -+	cmdline_parse(*cmdline_p);
   24.80 -+#undef CONFIG_ACPI_BOOT
   24.81 -+#endif
   24.82 - 	if (early_console_setup(*cmdline_p) == 0)
   24.83 - 		mark_bsp_online();
   24.84 - 
   24.85 -@@ -351,8 +382,18 @@
   24.86 - # endif
   24.87 - #endif /* CONFIG_APCI_BOOT */
   24.88 - 
   24.89 -+#ifndef XEN
   24.90 - 	find_memory();
   24.91 -+#else
   24.92 -+	io_port_init();
   24.93 -+}
   24.94 - 
   24.95 -+void __init
   24.96 -+late_setup_arch (char **cmdline_p)
   24.97 -+{
   24.98 -+#undef CONFIG_ACPI_BOOT
   24.99 -+	acpi_table_init();
  24.100 -+#endif
  24.101 - 	/* process SAL system table: */
  24.102 - 	ia64_sal_init(efi.sal_systab);
  24.103 - 
  24.104 -@@ -360,6 +401,10 @@
  24.105 - 	cpu_physical_id(0) = hard_smp_processor_id();
  24.106 - #endif
  24.107 - 
  24.108 -+#ifdef CONFIG_VTI
  24.109 -+	identify_vmx_feature();
  24.110 -+#endif // CONFIG_VTI
  24.111 -+
  24.112 - 	cpu_init();	/* initialize the bootstrap CPU */
  24.113 - 
  24.114 - #ifdef CONFIG_ACPI_BOOT
  24.115 -@@ -492,12 +537,14 @@
  24.116 - {
  24.117 - }
  24.118 - 
  24.119 -+#ifndef XEN
  24.120 - struct seq_operations cpuinfo_op = {
  24.121 - 	.start =	c_start,
  24.122 - 	.next =		c_next,
  24.123 - 	.stop =		c_stop,
  24.124 - 	.show =		show_cpuinfo
  24.125 - };
  24.126 -+#endif
  24.127 - 
  24.128 - void
  24.129 - identify_cpu (struct cpuinfo_ia64 *c)
  24.130 -@@ -551,6 +598,12 @@
  24.131 - 	}
  24.132 - 	c->unimpl_va_mask = ~((7L<<61) | ((1L << (impl_va_msb + 1)) - 1));
  24.133 - 	c->unimpl_pa_mask = ~((1L<<63) | ((1L << phys_addr_size) - 1));
  24.134 -+
  24.135 -+#ifdef CONFIG_VTI
  24.136 -+	/* If vmx feature is on, do necessary initialization for vmx */
  24.137 -+	if (vmx_enabled)
  24.138 -+		vmx_init_env();
  24.139 -+#endif
  24.140 - }
  24.141 - 
  24.142 - void
  24.143 -@@ -659,7 +712,11 @@
  24.144 - 					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
  24.145 - 	atomic_inc(&init_mm.mm_count);
  24.146 - 	current->active_mm = &init_mm;
  24.147 -+#ifdef XEN
  24.148 -+	if (current->domain->arch.mm)
  24.149 -+#else
  24.150 - 	if (current->mm)
  24.151 -+#endif
  24.152 - 		BUG();
  24.153 - 
  24.154 - 	ia64_mmu_init(ia64_imva(cpu_data));
    25.1 --- a/xen/arch/ia64/patch/linux-2.6.11/sn_sal.h	Fri Aug 26 11:02:14 2005 +0000
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,33 +0,0 @@
    25.4 ---- /data/lwork/attica1/edwardsg/linux-2.6.11/include/asm-ia64/sn/sn_sal.h	2005-03-02 01:38:33 -06:00
    25.5 -+++ include/asm-ia64/sn/sn_sal.h	2005-06-01 14:31:47 -05:00
    25.6 -@@ -123,6 +123,7 @@
    25.7 - #define SALRET_ERROR		(-3)
    25.8 -
    25.9 -
   25.10 -+#ifndef XEN
   25.11 - /**
   25.12 -  * sn_sal_rev_major - get the major SGI SAL revision number
   25.13 -  *
   25.14 -@@ -226,6 +227,7 @@ ia64_sn_get_klconfig_addr(nasid_t nasid)
   25.15 - 	}
   25.16 - 	return ret_stuff.v0 ? __va(ret_stuff.v0) : NULL;
   25.17 - }
   25.18 -+#endif /* !XEN */
   25.19 -
   25.20 - /*
   25.21 -  * Returns the next console character.
   25.22 -@@ -304,6 +306,7 @@ ia64_sn_console_putb(const char *buf, in
   25.23 - 	return (u64)0;
   25.24 - }
   25.25 -
   25.26 -+#ifndef XEN
   25.27 - /*
   25.28 -  * Print a platform error record
   25.29 -  */
   25.30 -@@ -987,5 +990,5 @@ ia64_sn_hwperf_op(nasid_t nasid, u64 opc
   25.31 - 		*v0 = (int) rv.v0;
   25.32 - 	return (int) rv.status;
   25.33 - }
   25.34 --
   25.35 -+#endif /* !XEN */
   25.36 - #endif /* _ASM_IA64_SN_SN_SAL_H */
    26.1 --- a/xen/arch/ia64/patch/linux-2.6.11/system.h	Fri Aug 26 11:02:14 2005 +0000
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,38 +0,0 @@
    26.4 ---- /home/adsharma/xeno-unstable-ia64-staging.bk/xen/../../linux-2.6.11/include/asm-ia64/system.h	2005-03-01 23:38:07.000000000 -0800
    26.5 -+++ /home/adsharma/xeno-unstable-ia64-staging.bk/xen/include/asm-ia64/system.h	2005-05-20 09:36:02.000000000 -0700
    26.6 -@@ -18,14 +18,19 @@
    26.7 - #include <asm/page.h>
    26.8 - #include <asm/pal.h>
    26.9 - #include <asm/percpu.h>
   26.10 -+#ifdef XEN
   26.11 -+#include <asm/xensystem.h>
   26.12 -+#endif
   26.13 - 
   26.14 - #define GATE_ADDR		__IA64_UL_CONST(0xa000000000000000)
   26.15 - /*
   26.16 -  * 0xa000000000000000+2*PERCPU_PAGE_SIZE
   26.17 -  * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
   26.18 -  */
   26.19 -+#ifndef XEN
   26.20 - #define KERNEL_START		 __IA64_UL_CONST(0xa000000100000000)
   26.21 - #define PERCPU_ADDR		(-PERCPU_PAGE_SIZE)
   26.22 -+#endif
   26.23 - 
   26.24 - #ifndef __ASSEMBLY__
   26.25 - 
   26.26 -@@ -218,6 +223,7 @@
   26.27 - # define PERFMON_IS_SYSWIDE() (0)
   26.28 - #endif
   26.29 - 
   26.30 -+#ifndef XEN
   26.31 - #define IA64_HAS_EXTRA_STATE(t)							\
   26.32 - 	((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)	\
   26.33 - 	 || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE())
   26.34 -@@ -230,6 +236,7 @@
   26.35 - 	ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next);			 \
   26.36 - 	(last) = ia64_switch_to((next));							 \
   26.37 - } while (0)
   26.38 -+#endif 
   26.39 - 
   26.40 - #ifdef CONFIG_SMP
   26.41 - /*
    27.1 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c	Fri Aug 26 11:02:14 2005 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,56 +0,0 @@
    27.4 ---- ../../linux-2.6.11/arch/ia64/kernel/time.c	2005-03-02 00:37:50.000000000 -0700
    27.5 -+++ arch/ia64/time.c	2005-05-02 11:19:29.000000000 -0600
    27.6 -@@ -29,6 +29,9 @@
    27.7 - #include <asm/sal.h>
    27.8 - #include <asm/sections.h>
    27.9 - #include <asm/system.h>
   27.10 -+#ifdef XEN
   27.11 -+#include <linux/jiffies.h>	// not included by xen/sched.h
   27.12 -+#endif
   27.13 - 
   27.14 - extern unsigned long wall_jiffies;
   27.15 - 
   27.16 -@@ -45,6 +48,7 @@
   27.17 - 
   27.18 - #endif
   27.19 - 
   27.20 -+#ifndef XEN
   27.21 - static struct time_interpolator itc_interpolator = {
   27.22 - 	.shift = 16,
   27.23 - 	.mask = 0xffffffffffffffffLL,
   27.24 -@@ -110,6 +114,7 @@
   27.25 - 	} while (time_after_eq(ia64_get_itc(), new_itm));
   27.26 - 	return IRQ_HANDLED;
   27.27 - }
   27.28 -+#endif
   27.29 - 
   27.30 - /*
   27.31 -  * Encapsulate access to the itm structure for SMP.
   27.32 -@@ -212,6 +217,7 @@
   27.33 - 					+ itc_freq/2)/itc_freq;
   27.34 - 
   27.35 - 	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
   27.36 -+#ifndef XEN
   27.37 - 		itc_interpolator.frequency = local_cpu_data->itc_freq;
   27.38 - 		itc_interpolator.drift = itc_drift;
   27.39 - #ifdef CONFIG_SMP
   27.40 -@@ -228,12 +234,14 @@
   27.41 - 		if (!nojitter) itc_interpolator.jitter = 1;
   27.42 - #endif
   27.43 - 		register_time_interpolator(&itc_interpolator);
   27.44 -+#endif
   27.45 - 	}
   27.46 - 
   27.47 - 	/* Setup the CPU local timer tick */
   27.48 - 	ia64_cpu_local_tick();
   27.49 - }
   27.50 - 
   27.51 -+#ifndef XEN
   27.52 - static struct irqaction timer_irqaction = {
   27.53 - 	.handler =	timer_interrupt,
   27.54 - 	.flags =	SA_INTERRUPT,
   27.55 -@@ -253,3 +261,4 @@
   27.56 - 	 */
   27.57 - 	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
   27.58 - }
   27.59 -+#endif
    28.1 --- a/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Fri Aug 26 11:02:14 2005 +0000
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,38 +0,0 @@
    28.4 ---- ../../linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-02 00:38:38.000000000 -0700
    28.5 -+++ arch/ia64/tlb.c	2005-05-02 10:23:09.000000000 -0600
    28.6 -@@ -43,6 +43,9 @@
    28.7 - void
    28.8 - wrap_mmu_context (struct mm_struct *mm)
    28.9 - {
   28.10 -+#ifdef XEN
   28.11 -+printf("wrap_mmu_context: called, not implemented\n");
   28.12 -+#else
   28.13 - 	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
   28.14 - 	struct task_struct *tsk;
   28.15 - 	int i;
   28.16 -@@ -83,6 +86,7 @@
   28.17 - 		put_cpu();
   28.18 - 	}
   28.19 - 	local_flush_tlb_all();
   28.20 -+#endif
   28.21 - }
   28.22 - 
   28.23 - void
   28.24 -@@ -132,6 +136,9 @@
   28.25 - void
   28.26 - flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
   28.27 - {
   28.28 -+#ifdef XEN
   28.29 -+printf("flush_tlb_range: called, not implemented\n");
   28.30 -+#else
   28.31 - 	struct mm_struct *mm = vma->vm_mm;
   28.32 - 	unsigned long size = end - start;
   28.33 - 	unsigned long nbits;
   28.34 -@@ -163,6 +170,7 @@
   28.35 - # endif
   28.36 - 
   28.37 - 	ia64_srlz_i();			/* srlz.i implies srlz.d */
   28.38 -+#endif
   28.39 - }
   28.40 - EXPORT_SYMBOL(flush_tlb_range);
   28.41 - 
    29.1 --- a/xen/arch/ia64/patch/linux-2.6.11/types.h	Fri Aug 26 11:02:14 2005 +0000
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,44 +0,0 @@
    29.4 ---- ../../linux-2.6.11/include/asm-ia64/types.h	2005-03-04 10:26:30.000000000 -0700
    29.5 -+++ include/asm-ia64/types.h	2005-04-11 15:23:49.000000000 -0600
    29.6 -@@ -1,5 +1,12 @@
    29.7 - #ifndef _ASM_IA64_TYPES_H
    29.8 - #define _ASM_IA64_TYPES_H
    29.9 -+#ifdef XEN
   29.10 -+#ifndef __ASSEMBLY__
   29.11 -+typedef unsigned long ssize_t;
   29.12 -+typedef unsigned long size_t;
   29.13 -+typedef long long loff_t;
   29.14 -+#endif
   29.15 -+#endif
   29.16 - 
   29.17 - /*
   29.18 -  * This file is never included by application software unless explicitly requested (e.g.,
   29.19 -@@ -61,6 +68,28 @@
   29.20 - typedef __s64 s64;
   29.21 - typedef __u64 u64;
   29.22 - 
   29.23 -+#ifdef XEN
   29.24 -+/*
   29.25 -+ * Below are truly Linux-specific types that should never collide with
   29.26 -+ * any application/library that wants linux/types.h.
   29.27 -+ */
   29.28 -+
   29.29 -+#ifdef __CHECKER__
   29.30 -+#define __bitwise __attribute__((bitwise))
   29.31 -+#else
   29.32 -+#define __bitwise
   29.33 -+#endif
   29.34 -+
   29.35 -+typedef __u16 __bitwise __le16;
   29.36 -+typedef __u16 __bitwise __be16;
   29.37 -+typedef __u32 __bitwise __le32;
   29.38 -+typedef __u32 __bitwise __be32;
   29.39 -+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
   29.40 -+typedef __u64 __bitwise __le64;
   29.41 -+typedef __u64 __bitwise __be64;
   29.42 -+#endif
   29.43 -+#endif
   29.44 -+
   29.45 - #define BITS_PER_LONG 64
   29.46 - 
   29.47 - /* DMA addresses are 64-bits wide, in general.  */
    30.1 --- a/xen/arch/ia64/patch/linux-2.6.11/uaccess.h	Fri Aug 26 11:02:14 2005 +0000
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,41 +0,0 @@
    30.4 ---- ../../linux-2.6.11/include/asm-ia64/uaccess.h	2005-03-02 00:37:53.000000000 -0700
    30.5 -+++ include/asm-ia64/uaccess.h	2005-06-21 21:53:20.000000000 -0600
    30.6 -@@ -32,6 +32,10 @@
    30.7 -  *	David Mosberger-Tang <davidm@hpl.hp.com>
    30.8 -  */
    30.9 - 
   30.10 -+#ifdef CONFIG_VTI
   30.11 -+#include <asm/vmx_uaccess.h>
   30.12 -+#else // CONFIG_VTI
   30.13 -+
   30.14 - #include <linux/compiler.h>
   30.15 - #include <linux/errno.h>
   30.16 - #include <linux/sched.h>
   30.17 -@@ -60,6 +64,11 @@
   30.18 -  * address TASK_SIZE is never valid.  We also need to make sure that the address doesn't
   30.19 -  * point inside the virtually mapped linear page table.
   30.20 -  */
   30.21 -+#ifdef XEN
   30.22 -+/* VT-i reserves bit 60 for the VMM; guest addresses have bit 60 = bit 59 */
   30.23 -+#define IS_VMM_ADDRESS(addr) ((((addr) >> 60) ^ ((addr) >> 59)) & 1)
   30.24 -+#define __access_ok(addr, size, segment) (!IS_VMM_ADDRESS((unsigned long)(addr)))
   30.25 -+#else
   30.26 - #define __access_ok(addr, size, segment)						\
   30.27 - ({											\
   30.28 - 	__chk_user_ptr(addr);								\
   30.29 -@@ -67,6 +76,7 @@
   30.30 - 	 && ((segment).seg == KERNEL_DS.seg						\
   30.31 - 	     || likely(REGION_OFFSET((unsigned long) (addr)) < RGN_MAP_LIMIT)));	\
   30.32 - })
   30.33 -+#endif
   30.34 - #define access_ok(type, addr, size)	__access_ok((addr), (size), get_fs())
   30.35 - 
   30.36 - static inline int
   30.37 -@@ -343,6 +353,7 @@
   30.38 - 	__su_ret;						\
   30.39 - })
   30.40 - 
   30.41 -+#endif // CONFIG_VTI
   30.42 - /* Generic code can't deal with the location-relative format that we use for compactness.  */
   30.43 - #define ARCH_HAS_SORT_EXTABLE
   30.44 - #define ARCH_HAS_SEARCH_EXTABLE
    31.1 --- a/xen/arch/ia64/patch/linux-2.6.11/unaligned.c	Fri Aug 26 11:02:14 2005 +0000
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,227 +0,0 @@
    31.4 ---- /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/../../linux-2.6.11/arch/ia64/kernel/unaligned.c	2005-03-01 23:38:25.000000000 -0800
    31.5 -+++ /home/adsharma/disk2/xen-ia64/xeno-unstable-rebase.bk/xen/arch/ia64/unaligned.c	2005-05-18 12:40:50.000000000 -0700
    31.6 -@@ -201,7 +201,11 @@
    31.7 - 
    31.8 - 	RPT(r1), RPT(r2), RPT(r3),
    31.9 - 
   31.10 -+#ifdef  CONFIG_VTI
   31.11 -+	RPT(r4), RPT(r5), RPT(r6), RPT(r7),
   31.12 -+#else   //CONFIG_VTI
   31.13 - 	RSW(r4), RSW(r5), RSW(r6), RSW(r7),
   31.14 -+#endif  //CONFIG_VTI
   31.15 - 
   31.16 - 	RPT(r8), RPT(r9), RPT(r10), RPT(r11),
   31.17 - 	RPT(r12), RPT(r13), RPT(r14), RPT(r15),
   31.18 -@@ -291,6 +295,121 @@
   31.19 - 	return reg;
   31.20 - }
   31.21 - 
   31.22 -+#ifdef CONFIG_VTI
   31.23 -+static void
   31.24 -+set_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long val, unsigned long nat)
   31.25 -+{
   31.26 -+	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   31.27 -+	unsigned long *bsp, *bspstore, *addr, *rnat_addr, *ubs_end;
   31.28 -+	unsigned long *kbs = (void *) current + IA64_RBS_OFFSET;
   31.29 -+	unsigned long rnats, nat_mask;
   31.30 -+    unsigned long old_rsc,new_rsc;
   31.31 -+	unsigned long on_kbs,rnat;
   31.32 -+	long sof = (regs->cr_ifs) & 0x7f;
   31.33 -+	long sor = 8 * ((regs->cr_ifs >> 14) & 0xf);
   31.34 -+	long rrb_gr = (regs->cr_ifs >> 18) & 0x7f;
   31.35 -+	long ridx = r1 - 32;
   31.36 -+
   31.37 -+	if (ridx >= sof) {
   31.38 -+		/* this should never happen, as the "rsvd register fault" has higher priority */
   31.39 -+		DPRINT("ignoring write to r%lu; only %lu registers are allocated!\n", r1, sof);
   31.40 -+		return;
   31.41 -+	}
   31.42 -+
   31.43 -+	if (ridx < sor)
   31.44 -+		ridx = rotate_reg(sor, rrb_gr, ridx);
   31.45 -+
   31.46 -+    old_rsc=ia64_get_rsc();
   31.47 -+    new_rsc=old_rsc&(~0x3);
   31.48 -+    ia64_set_rsc(new_rsc);
   31.49 -+
   31.50 -+    bspstore = ia64_get_bspstore();
   31.51 -+    bsp =kbs + (regs->loadrs >> 19);//16+3
   31.52 -+
   31.53 -+	addr = ia64_rse_skip_regs(bsp, -sof + ridx);
   31.54 -+    nat_mask = 1UL << ia64_rse_slot_num(addr);
   31.55 -+	rnat_addr = ia64_rse_rnat_addr(addr);
   31.56 -+
   31.57 -+    if(addr >= bspstore){
   31.58 -+
   31.59 -+        ia64_flushrs ();
   31.60 -+        ia64_mf ();
   31.61 -+		*addr = val;
   31.62 -+        bspstore = ia64_get_bspstore();
   31.63 -+    	rnat = ia64_get_rnat ();
   31.64 -+        if(bspstore < rnat_addr){
   31.65 -+            rnat=rnat&(~nat_mask);
   31.66 -+        }else{
   31.67 -+            *rnat_addr = (*rnat_addr)&(~nat_mask);
   31.68 -+        }
   31.69 -+        ia64_mf();
   31.70 -+        ia64_loadrs();
   31.71 -+        ia64_set_rnat(rnat);
   31.72 -+    }else{
   31.73 -+
   31.74 -+    	rnat = ia64_get_rnat ();
   31.75 -+		*addr = val;
   31.76 -+        if(bspstore < rnat_addr){
   31.77 -+            rnat=rnat&(~nat_mask);
   31.78 -+        }else{
   31.79 -+            *rnat_addr = (*rnat_addr)&(~nat_mask);
   31.80 -+        }
   31.81 -+        ia64_set_bspstore (bspstore);
   31.82 -+        ia64_set_rnat(rnat);
   31.83 -+    }
   31.84 -+    ia64_set_rsc(old_rsc);
   31.85 -+}
   31.86 -+
   31.87 -+
   31.88 -+static void
   31.89 -+get_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long *val, unsigned long *nat)
   31.90 -+{
   31.91 -+	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   31.92 -+	unsigned long *bsp, *addr, *rnat_addr, *ubs_end, *bspstore;
   31.93 -+	unsigned long *kbs = (void *) current + IA64_RBS_OFFSET;
   31.94 -+	unsigned long rnats, nat_mask;
   31.95 -+	unsigned long on_kbs;
   31.96 -+    unsigned long old_rsc, new_rsc;
   31.97 -+	long sof = (regs->cr_ifs) & 0x7f;
   31.98 -+	long sor = 8 * ((regs->cr_ifs >> 14) & 0xf);
   31.99 -+	long rrb_gr = (regs->cr_ifs >> 18) & 0x7f;
  31.100 -+	long ridx = r1 - 32;
  31.101 -+
  31.102 -+	if (ridx >= sof) {
  31.103 -+		/* read of out-of-frame register returns an undefined value; 0 in our case.  */
  31.104 -+		DPRINT("ignoring read from r%lu; only %lu registers are allocated!\n", r1, sof);
  31.105 -+		panic("wrong stack register number");
  31.106 -+	}
  31.107 -+
  31.108 -+	if (ridx < sor)
  31.109 -+		ridx = rotate_reg(sor, rrb_gr, ridx);
  31.110 -+
  31.111 -+    old_rsc=ia64_get_rsc();
  31.112 -+    new_rsc=old_rsc&(~(0x3));
  31.113 -+    ia64_set_rsc(new_rsc);
  31.114 -+
  31.115 -+    bspstore = ia64_get_bspstore();
  31.116 -+    bsp =kbs + (regs->loadrs >> 19); //16+3;
  31.117 -+
  31.118 -+	addr = ia64_rse_skip_regs(bsp, -sof + ridx);
  31.119 -+    nat_mask = 1UL << ia64_rse_slot_num(addr);
  31.120 -+	rnat_addr = ia64_rse_rnat_addr(addr);
  31.121 -+
  31.122 -+    if(addr >= bspstore){
  31.123 -+
  31.124 -+        ia64_flushrs ();
  31.125 -+        ia64_mf ();
  31.126 -+        bspstore = ia64_get_bspstore();
  31.127 -+    }
  31.128 -+	*val=*addr;
  31.129 -+    if(bspstore < rnat_addr){
  31.130 -+        *nat=!!(ia64_get_rnat()&nat_mask);
  31.131 -+    }else{
  31.132 -+        *nat = !!((*rnat_addr)&nat_mask);
  31.133 -+    }
  31.134 -+    ia64_set_rsc(old_rsc);
  31.135 -+}
  31.136 -+#else // CONFIG_VTI
  31.137 - static void
  31.138 - set_rse_reg (struct pt_regs *regs, unsigned long r1, unsigned long val, int nat)
  31.139 - {
  31.140 -@@ -435,9 +554,14 @@
  31.141 - 		*nat = 0;
  31.142 - 	return;
  31.143 - }
  31.144 -+#endif // CONFIG_VTI
  31.145 - 
  31.146 - 
  31.147 -+#ifdef XEN
  31.148 -+void
  31.149 -+#else
  31.150 - static void
  31.151 -+#endif
  31.152 - setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
  31.153 - {
  31.154 - 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
  31.155 -@@ -466,7 +590,11 @@
  31.156 - 		unat = &sw->ar_unat;
  31.157 - 	} else {
  31.158 - 		addr = (unsigned long)regs;
  31.159 -+#ifdef CONFIG_VTI
  31.160 -+		unat = &regs->eml_unat;
  31.161 -+#else //CONFIG_VTI
  31.162 - 		unat = &sw->caller_unat;
  31.163 -+#endif  //CONFIG_VTI
  31.164 - 	}
  31.165 - 	DPRINT("tmp_base=%lx switch_stack=%s offset=%d\n",
  31.166 - 	       addr, unat==&sw->ar_unat ? "yes":"no", GR_OFFS(regnum));
  31.167 -@@ -522,7 +650,11 @@
  31.168 - 	 */
  31.169 - 	if (regnum >= IA64_FIRST_ROTATING_FR) {
  31.170 - 		ia64_sync_fph(current);
  31.171 -+#ifdef XEN
  31.172 -+		current->arch._thread.fph[fph_index(regs, regnum)] = *fpval;
  31.173 -+#else
  31.174 - 		current->thread.fph[fph_index(regs, regnum)] = *fpval;
  31.175 -+#endif
  31.176 - 	} else {
  31.177 - 		/*
  31.178 - 		 * pt_regs or switch_stack ?
  31.179 -@@ -581,7 +713,11 @@
  31.180 - 	 */
  31.181 - 	if (regnum >= IA64_FIRST_ROTATING_FR) {
  31.182 - 		ia64_flush_fph(current);
  31.183 -+#ifdef XEN
  31.184 -+		*fpval = current->arch._thread.fph[fph_index(regs, regnum)];
  31.185 -+#else
  31.186 - 		*fpval = current->thread.fph[fph_index(regs, regnum)];
  31.187 -+#endif
  31.188 - 	} else {
  31.189 - 		/*
  31.190 - 		 * f0 = 0.0, f1= 1.0. Those registers are constant and are thus
  31.191 -@@ -611,7 +747,11 @@
  31.192 - }
  31.193 - 
  31.194 - 
  31.195 -+#ifdef XEN
  31.196 -+void
  31.197 -+#else
  31.198 - static void
  31.199 -+#endif
  31.200 - getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs)
  31.201 - {
  31.202 - 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
  31.203 -@@ -640,7 +780,11 @@
  31.204 - 		unat = &sw->ar_unat;
  31.205 - 	} else {
  31.206 - 		addr = (unsigned long)regs;
  31.207 -+#ifdef  CONFIG_VTI
  31.208 -+		unat = &regs->eml_unat;;
  31.209 -+#else   //CONFIG_VTI
  31.210 - 		unat = &sw->caller_unat;
  31.211 -+#endif  //CONFIG_VTI
  31.212 - 	}
  31.213 - 
  31.214 - 	DPRINT("addr_base=%lx offset=0x%x\n", addr,  GR_OFFS(regnum));
  31.215 -@@ -1294,6 +1438,9 @@
  31.216 - void
  31.217 - ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
  31.218 - {
  31.219 -+#ifdef XEN
  31.220 -+printk("ia64_handle_unaligned: called, not working yet\n");
  31.221 -+#else
  31.222 - 	struct ia64_psr *ipsr = ia64_psr(regs);
  31.223 - 	mm_segment_t old_fs = get_fs();
  31.224 - 	unsigned long bundle[2];
  31.225 -@@ -1502,4 +1649,5 @@
  31.226 - 	si.si_imm = 0;
  31.227 - 	force_sig_info(SIGBUS, &si, current);
  31.228 - 	goto done;
  31.229 -+#endif
  31.230 - }
    32.1 --- a/xen/arch/ia64/patch/linux-2.6.7/bootmem.h	Fri Aug 26 11:02:14 2005 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,12 +0,0 @@
    32.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/bootmem.h	2004-06-15 23:19:52.000000000 -0600
    32.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/bootmem.h	2004-08-25 19:28:13.000000000 -0600
    32.6 -@@ -41,7 +41,9 @@
    32.7 - extern void __init free_bootmem (unsigned long addr, unsigned long size);
    32.8 - extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
    32.9 - #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
   32.10 -+#ifndef XEN
   32.11 - extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
   32.12 -+#endif
   32.13 - #define alloc_bootmem(x) \
   32.14 - 	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
   32.15 - #define alloc_bootmem_low(x) \
    33.1 --- a/xen/arch/ia64/patch/linux-2.6.7/current.h	Fri Aug 26 11:02:14 2005 +0000
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,17 +0,0 @@
    33.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/current.h	2004-06-15 23:19:52.000000000 -0600
    33.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/current.h	2004-08-25 19:28:12.000000000 -0600
    33.6 -@@ -12,6 +12,14 @@
    33.7 -  * In kernel mode, thread pointer (r13) is used to point to the current task
    33.8 -  * structure.
    33.9 -  */
   33.10 -+#ifdef XEN
   33.11 -+struct domain;
   33.12 -+#define get_current()	((struct vcpu *) ia64_getreg(_IA64_REG_TP))
   33.13 -+#define current get_current()
   33.14 -+//#define set_current(d)	ia64_setreg(_IA64_REG_TP,(void *)d);
   33.15 -+#define set_current(d)		(ia64_r13 = (void *)d)
   33.16 -+#else
   33.17 - #define current	((struct task_struct *) ia64_getreg(_IA64_REG_TP))
   33.18 -+#endif
   33.19 - 
   33.20 - #endif /* _ASM_IA64_CURRENT_H */
    34.1 --- a/xen/arch/ia64/patch/linux-2.6.7/efi.c	Fri Aug 26 11:02:14 2005 +0000
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,85 +0,0 @@
    34.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/kernel/efi.c	2004-06-15 23:18:55.000000000 -0600
    34.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/efi.c	2004-12-17 13:47:03.000000000 -0700
    34.6 -@@ -25,6 +25,9 @@
    34.7 - #include <linux/types.h>
    34.8 - #include <linux/time.h>
    34.9 - #include <linux/efi.h>
   34.10 -+#ifdef XEN
   34.11 -+#include <xen/sched.h>
   34.12 -+#endif
   34.13 - 
   34.14 - #include <asm/io.h>
   34.15 - #include <asm/kregs.h>
   34.16 -@@ -49,7 +52,10 @@
   34.17 - {												\
   34.18 - 	struct ia64_fpreg fr[6];								\
   34.19 - 	efi_status_t ret;									\
   34.20 -+	efi_time_cap_t *atc = NULL;								\
   34.21 - 												\
   34.22 -+	if (tc)											\
   34.23 -+		atc = adjust_arg(tc);								\
   34.24 - 	ia64_save_scratch_fpregs(fr);								\
   34.25 - 	ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), adjust_arg(tm),	\
   34.26 - 				adjust_arg(tc));						\
   34.27 -@@ -201,6 +207,7 @@
   34.28 - 	if ((*efi.get_time)(&tm, 0) != EFI_SUCCESS)
   34.29 - 		return;
   34.30 - 
   34.31 -+	dummy();
   34.32 - 	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
   34.33 - 	ts->tv_nsec = tm.nanosecond;
   34.34 - }
   34.35 -@@ -303,6 +310,10 @@
   34.36 - 		if (!(md->attribute & EFI_MEMORY_WB))
   34.37 - 			continue;
   34.38 - 
   34.39 -+#ifdef XEN
   34.40 -+// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
   34.41 -+		if (md->phys_addr >= 0x100000000) continue;
   34.42 -+#endif
   34.43 - 		/*
   34.44 - 		 * granule_addr is the base of md's first granule.
   34.45 - 		 * [granule_addr - first_non_wb_addr) is guaranteed to
   34.46 -@@ -456,9 +467,11 @@
   34.47 - 
   34.48 - 		cpu = smp_processor_id();
   34.49 - 
   34.50 -+#ifndef XEN
   34.51 - 		/* insert this TR into our list for MCA recovery purposes */
   34.52 - 		ia64_mca_tlb_list[cpu].pal_base = vaddr & mask;
   34.53 - 		ia64_mca_tlb_list[cpu].pal_paddr = pte_val(mk_pte_phys(md->phys_addr, PAGE_KERNEL));
   34.54 -+#endif
   34.55 - 	}
   34.56 - }
   34.57 - 
   34.58 -@@ -680,6 +693,30 @@
   34.59 - 	return 0;
   34.60 - }
   34.61 - 
   34.62 -+#ifdef XEN
   34.63 -+// variation of efi_get_iobase which returns entire memory descriptor
   34.64 -+efi_memory_desc_t *
   34.65 -+efi_get_io_md (void)
   34.66 -+{
   34.67 -+	void *efi_map_start, *efi_map_end, *p;
   34.68 -+	efi_memory_desc_t *md;
   34.69 -+	u64 efi_desc_size;
   34.70 -+
   34.71 -+	efi_map_start = __va(ia64_boot_param->efi_memmap);
   34.72 -+	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
   34.73 -+	efi_desc_size = ia64_boot_param->efi_memdesc_size;
   34.74 -+
   34.75 -+	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
   34.76 -+		md = p;
   34.77 -+		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
   34.78 -+			if (md->attribute & EFI_MEMORY_UC)
   34.79 -+				return md;
   34.80 -+		}
   34.81 -+	}
   34.82 -+	return 0;
   34.83 -+}
   34.84 -+#endif
   34.85 -+
   34.86 - u32
   34.87 - efi_mem_type (unsigned long phys_addr)
   34.88 - {
    35.1 --- a/xen/arch/ia64/patch/linux-2.6.7/efi.h	Fri Aug 26 11:02:14 2005 +0000
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,13 +0,0 @@
    35.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/efi.h	2004-06-15 23:20:03.000000000 -0600
    35.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/efi.h	2004-08-25 19:28:13.000000000 -0600
    35.6 -@@ -15,8 +15,10 @@
    35.7 - #include <linux/string.h>
    35.8 - #include <linux/time.h>
    35.9 - #include <linux/types.h>
   35.10 -+#ifndef XEN
   35.11 - #include <linux/proc_fs.h>
   35.12 - #include <linux/rtc.h>
   35.13 -+#endif
   35.14 - #include <linux/ioport.h>
   35.15 - 
   35.16 - #include <asm/page.h>
    36.1 --- a/xen/arch/ia64/patch/linux-2.6.7/entry.S	Fri Aug 26 11:02:14 2005 +0000
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,195 +0,0 @@
    36.4 ---- ../../linux-2.6.7/arch/ia64/kernel/entry.S	2005-03-24 19:39:56.000000000 -0700
    36.5 -+++ arch/ia64/entry.S	2005-04-01 12:56:01.000000000 -0700
    36.6 -@@ -35,7 +35,9 @@
    36.7 - 
    36.8 - #include <asm/asmmacro.h>
    36.9 - #include <asm/cache.h>
   36.10 -+#ifndef XEN
   36.11 - #include <asm/errno.h>
   36.12 -+#endif
   36.13 - #include <asm/kregs.h>
   36.14 - #include <asm/offsets.h>
   36.15 - #include <asm/pgtable.h>
   36.16 -@@ -46,6 +48,23 @@
   36.17 - 
   36.18 - #include "minstate.h"
   36.19 - 
   36.20 -+#ifdef XEN
   36.21 -+#define	sys_execve 0
   36.22 -+#define do_fork 0
   36.23 -+#define	syscall_trace 0
   36.24 -+#define schedule 0
   36.25 -+#define do_notify_resume_user 0
   36.26 -+#define ia64_rt_sigsuspend 0
   36.27 -+#define ia64_rt_sigreturn 0
   36.28 -+#define	ia64_handle_unaligned 0
   36.29 -+#define	errno 0
   36.30 -+#define	sys_ni_syscall 0
   36.31 -+#define unw_init_frame_info 0
   36.32 -+#define sys_call_table 0
   36.33 -+#endif
   36.34 -+
   36.35 -+	/*
   36.36 -+
   36.37 - 	/*
   36.38 - 	 * execve() is special because in case of success, we need to
   36.39 - 	 * setup a null register window frame.
   36.40 -@@ -178,11 +197,14 @@
   36.41 - 	DO_SAVE_SWITCH_STACK
   36.42 - 	.body
   36.43 - 
   36.44 -+#ifdef XEN
   36.45 -+//#undef IA64_TASK_THREAD_KSP_OFFSET
   36.46 -+//#define	IA64_TASK_THREAD_KSP_OFFSET	0x38
   36.47 - 	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   36.48 - 	movl r25=init_task
   36.49 - 	mov r27=IA64_KR(CURRENT_STACK)
   36.50 - 	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   36.51 --	dep r20=0,in0,61,3		// physical address of "current"
   36.52 -+	dep r20=0,in0,60,4		// physical address of "current"
   36.53 - 	;;
   36.54 - 	st8 [r22]=sp			// save kernel stack pointer of old task
   36.55 - 	shr.u r26=r20,IA64_GRANULE_SHIFT
   36.56 -@@ -194,6 +216,22 @@
   36.57 - (p6)	cmp.eq p7,p6=r26,r27
   36.58 - (p6)	br.cond.dpnt .map
   36.59 - 	;;
   36.60 -+#else
   36.61 -+	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   36.62 -+	mov r27=IA64_KR(CURRENT_STACK)
   36.63 -+	dep r20=0,in0,61,3		// physical address of "current"
   36.64 -+	;;
   36.65 -+	st8 [r22]=sp			// save kernel stack pointer of old task
   36.66 -+	shr.u r26=r20,IA64_GRANULE_SHIFT
   36.67 -+	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   36.68 -+	;;
   36.69 -+	/*
   36.70 -+	 * If we've already mapped this task's page, we can skip doing it again.
   36.71 -+	 */
   36.72 -+	cmp.eq p7,p6=r26,r27
   36.73 -+(p6)	br.cond.dpnt .map
   36.74 -+	;;
   36.75 -+#endif
   36.76 - .done:
   36.77 - (p6)	ssm psr.ic			// if we we had to map, renable the psr.ic bit FIRST!!!
   36.78 - 	;;
   36.79 -@@ -211,6 +249,16 @@
   36.80 - 	br.ret.sptk.many rp		// boogie on out in new context
   36.81 - 
   36.82 - .map:
   36.83 -+#ifdef XEN
   36.84 -+	// avoid overlapping with kernel TR
   36.85 -+	movl r25=KERNEL_START
   36.86 -+	dep  r23=0,in0,0,KERNEL_TR_PAGE_SHIFT
   36.87 -+	;;
   36.88 -+	cmp.eq p7,p0=r25,r23
   36.89 -+	;;
   36.90 -+(p7)	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
   36.91 -+(p7)	br.cond.sptk .done
   36.92 -+#endif
   36.93 - 	rsm psr.ic			// interrupts (psr.i) are already disabled here
   36.94 - 	movl r25=PAGE_KERNEL
   36.95 - 	;;
   36.96 -@@ -367,7 +415,11 @@
   36.97 -  *	- b7 holds address to return to
   36.98 -  *	- must not touch r8-r11
   36.99 -  */
  36.100 -+#ifdef XEN
  36.101 -+GLOBAL_ENTRY(load_switch_stack)
  36.102 -+#else
  36.103 - ENTRY(load_switch_stack)
  36.104 -+#endif
  36.105 - 	.prologue
  36.106 - 	.altrp b7
  36.107 - 
  36.108 -@@ -595,6 +647,11 @@
  36.109 - 	 */
  36.110 - 	br.call.sptk.many rp=ia64_invoke_schedule_tail
  36.111 - }
  36.112 -+#ifdef XEN
  36.113 -+	// new domains are cloned but not exec'ed so switch to user mode here
  36.114 -+	cmp.ne pKStk,pUStk=r0,r0
  36.115 -+	br.cond.spnt ia64_leave_kernel
  36.116 -+#else
  36.117 - .ret8:
  36.118 - 	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
  36.119 - 	;;
  36.120 -@@ -603,6 +660,7 @@
  36.121 - 	mov r8=0
  36.122 - 	tbit.nz p6,p0=r2,TIF_SYSCALL_TRACE
  36.123 - (p6)	br.cond.spnt .strace_check_retval
  36.124 -+#endif
  36.125 - 	;;					// added stop bits to prevent r8 dependency
  36.126 - END(ia64_ret_from_clone)
  36.127 - 	// fall through
  36.128 -@@ -684,9 +742,14 @@
  36.129 - #endif /* CONFIG_PREEMPT */
  36.130 - 	adds r16=PT(LOADRS)+16,r12
  36.131 - 	adds r17=PT(AR_BSPSTORE)+16,r12
  36.132 -+#ifdef XEN
  36.133 -+	mov r31=r0
  36.134 -+	;;
  36.135 -+#else
  36.136 - 	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
  36.137 - 	;;
  36.138 - (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
  36.139 -+#endif
  36.140 - 	ld8 r19=[r16],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
  36.141 - 	nop.i 0
  36.142 - 	;;
  36.143 -@@ -745,7 +808,11 @@
  36.144 - 	mov b7=r0		// clear b7
  36.145 - 	;;
  36.146 - (pUStk) st1 [r14]=r3
  36.147 -+#ifdef XEN
  36.148 -+	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
  36.149 -+#else
  36.150 - 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
  36.151 -+#endif
  36.152 - 	;;
  36.153 - 	mov r16=ar.bsp		// get existing backing store pointer
  36.154 - 	srlz.i			// ensure interruption collection is off
  36.155 -@@ -796,9 +863,18 @@
  36.156 - 	;;
  36.157 - (p6)	cmp.eq.unc p6,p0=r21,r0		// p6 <- p6 && (r21 == 0)
  36.158 - #endif /* CONFIG_PREEMPT */
  36.159 -+#ifdef XEN
  36.160 -+	alloc loc0=ar.pfs,0,1,1,0
  36.161 -+	adds out0=16,r12
  36.162 -+	;;
  36.163 -+(p6)	br.call.sptk.many b0=deliver_pending_interrupt
  36.164 -+	mov ar.pfs=loc0
  36.165 -+	mov r31=r0
  36.166 -+#else
  36.167 - 	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
  36.168 - 	;;
  36.169 - (p6)	ld4 r31=[r17]				// load current_thread_info()->flags
  36.170 -+#endif
  36.171 - 	adds r21=PT(PR)+16,r12
  36.172 - 	;;
  36.173 - 
  36.174 -@@ -912,7 +988,11 @@
  36.175 - 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
  36.176 - 	;;
  36.177 - 	mov r16=ar.bsp		// get existing backing store pointer
  36.178 -+#ifdef XEN
  36.179 -+	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
  36.180 -+#else
  36.181 - 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
  36.182 -+#endif
  36.183 - 	;;
  36.184 - 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
  36.185 - (pKStk)	br.cond.dpnt skip_rbs_switch
  36.186 -@@ -1264,6 +1344,7 @@
  36.187 - 	br.ret.sptk.many rp
  36.188 - END(unw_init_running)
  36.189 - 
  36.190 -+#ifndef XEN
  36.191 - 	.rodata
  36.192 - 	.align 8
  36.193 - 	.globl sys_call_table
  36.194 -@@ -1526,3 +1607,4 @@
  36.195 - 	data8 sys_ni_syscall
  36.196 - 
  36.197 - 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
  36.198 -+#endif
    37.1 --- a/xen/arch/ia64/patch/linux-2.6.7/gcc_intrin.h	Fri Aug 26 11:02:14 2005 +0000
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,20 +0,0 @@
    37.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/gcc_intrin.h	2005-01-23 13:23:36.000000000 -0700
    37.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/gcc_intrin.h	2004-08-25 19:28:13.000000000 -0600
    37.6 -@@ -92,6 +92,9 @@
    37.7 - 
    37.8 - #define ia64_hint_pause 0
    37.9 - 
   37.10 -+#ifdef XEN
   37.11 -+#define ia64_hint(mode)	0
   37.12 -+#else
   37.13 - #define ia64_hint(mode)						\
   37.14 - ({								\
   37.15 - 	switch (mode) {						\
   37.16 -@@ -100,6 +103,7 @@
   37.17 - 		break;						\
   37.18 - 	}							\
   37.19 - })
   37.20 -+#endif
   37.21 - 
   37.22 - 
   37.23 - /* Integer values for mux1 instruction */
    38.1 --- a/xen/arch/ia64/patch/linux-2.6.7/hardirq.h	Fri Aug 26 11:02:14 2005 +0000
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,22 +0,0 @@
    38.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/hardirq.h	2004-06-15 23:19:02.000000000 -0600
    38.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/hardirq.h	2004-12-17 13:47:03.000000000 -0700
    38.6 -@@ -81,10 +81,19 @@
    38.7 -  */
    38.8 - #define in_irq()		(hardirq_count())
    38.9 - #define in_softirq()		(softirq_count())
   38.10 -+#ifdef XEN
   38.11 - #define in_interrupt()		(irq_count())
   38.12 -+#else
   38.13 -+#define in_interrupt()		0		// FIXME LATER
   38.14 -+#endif
   38.15 - 
   38.16 -+#ifdef XEN
   38.17 -+#define hardirq_trylock(cpu)	(!in_interrupt())
   38.18 -+#define hardirq_endlock(cpu)	do { } while (0)
   38.19 -+#else
   38.20 - #define hardirq_trylock()	(!in_interrupt())
   38.21 - #define hardirq_endlock()	do { } while (0)
   38.22 -+#endif
   38.23 - 
   38.24 - #ifdef CONFIG_PREEMPT
   38.25 - # include <linux/smp_lock.h>
    39.1 --- a/xen/arch/ia64/patch/linux-2.6.7/head.S	Fri Aug 26 11:02:14 2005 +0000
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,93 +0,0 @@
    39.4 ---- ../../linux-2.6.7/arch/ia64/kernel/head.S	2005-03-24 19:39:56.000000000 -0700
    39.5 -+++ arch/ia64/head.S	2005-04-01 12:56:01.000000000 -0700
    39.6 -@@ -1,3 +1,8 @@
    39.7 -+#ifdef XEN
    39.8 -+#define	console_print	printf
    39.9 -+#define kernel_thread_helper 0
   39.10 -+#define sys_exit 0
   39.11 -+#endif
   39.12 - /*
   39.13 -  * Here is where the ball gets rolling as far as the kernel is concerned.
   39.14 -  * When control is transferred to _start, the bootload has already
   39.15 -@@ -166,7 +171,11 @@
   39.16 - 	dep r18=0,r3,0,12
   39.17 - 	;;
   39.18 - 	or r18=r17,r18
   39.19 -+#ifdef XEN
   39.20 -+	dep r2=-1,r3,60,4	// IMVA of task
   39.21 -+#else
   39.22 - 	dep r2=-1,r3,61,3	// IMVA of task
   39.23 -+#endif
   39.24 - 	;;
   39.25 - 	mov r17=rr[r2]
   39.26 - 	;;
   39.27 -@@ -205,7 +214,11 @@
   39.28 - 	;;
   39.29 - 	mov ar.rsc=0x3		// place RSE in eager mode
   39.30 - 
   39.31 -+#ifdef XEN
   39.32 -+(isBP)	dep r28=-1,r28,60,4	// make address virtual
   39.33 -+#else
   39.34 - (isBP)	dep r28=-1,r28,61,3	// make address virtual
   39.35 -+#endif
   39.36 - (isBP)	movl r2=ia64_boot_param
   39.37 - 	;;
   39.38 - (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
   39.39 -@@ -238,14 +251,30 @@
   39.40 - 	br.call.sptk.many rp=sys_fw_init
   39.41 - .ret1:
   39.42 - #endif
   39.43 -+#ifdef XEN
   39.44 -+	alloc r2=ar.pfs,8,0,2,0
   39.45 -+	;;
   39.46 -+#define fake_mbi_magic 0
   39.47 -+#define MULTIBOOT_INFO_SIZE	1024
   39.48 -+	.rodata
   39.49 -+fake_mbi:
   39.50 -+	.skip MULTIBOOT_INFO_SIZE
   39.51 -+	.previous
   39.52 -+	movl out0=fake_mbi
   39.53 -+	;;
   39.54 -+	br.call.sptk.many rp=cmain
   39.55 -+#else
   39.56 - 	br.call.sptk.many rp=start_kernel
   39.57 -+#endif
   39.58 - .ret2:	addl r3=@ltoff(halt_msg),gp
   39.59 - 	;;
   39.60 - 	alloc r2=ar.pfs,8,0,2,0
   39.61 - 	;;
   39.62 - 	ld8 out0=[r3]
   39.63 - 	br.call.sptk.many b0=console_print
   39.64 -+	;;
   39.65 - self:	br.sptk.many self		// endless loop
   39.66 -+	;;
   39.67 - END(_start)
   39.68 - 
   39.69 - GLOBAL_ENTRY(ia64_save_debug_regs)
   39.70 -@@ -781,8 +810,13 @@
   39.71 - 	movl r18=KERNEL_START
   39.72 - 	dep r3=0,r3,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
   39.73 - 	dep r14=0,r14,KERNEL_TR_PAGE_SHIFT,64-KERNEL_TR_PAGE_SHIFT
   39.74 -+#ifdef XEN
   39.75 -+	dep r17=-1,r17,60,4
   39.76 -+	dep sp=-1,sp,60,4
   39.77 -+#else
   39.78 - 	dep r17=-1,r17,61,3
   39.79 - 	dep sp=-1,sp,61,3
   39.80 -+#endif
   39.81 - 	;;
   39.82 - 	or r3=r3,r18
   39.83 - 	or r14=r14,r18
   39.84 -@@ -838,7 +872,12 @@
   39.85 -  * intermediate precision so that we can produce a full 64-bit result.
   39.86 -  */
   39.87 - GLOBAL_ENTRY(sched_clock)
   39.88 -+#ifdef XEN
   39.89 -+	break 0;;	// FIX IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   39.90 -+	//movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   39.91 -+#else
   39.92 - 	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
   39.93 -+#endif
   39.94 - 	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
   39.95 - 	;;
   39.96 - 	ldf8 f8=[r8]
    40.1 --- a/xen/arch/ia64/patch/linux-2.6.7/hpsim_irq.c	Fri Aug 26 11:02:14 2005 +0000
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,36 +0,0 @@
    40.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/hp/sim/hpsim_irq.c	2004-06-15 23:20:26.000000000 -0600
    40.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/hpsim_irq.c	2004-11-01 17:54:15.000000000 -0700
    40.6 -@@ -9,7 +9,17 @@
    40.7 - #include <linux/kernel.h>
    40.8 - #include <linux/sched.h>
    40.9 - #include <linux/irq.h>
   40.10 -+#ifdef XEN
   40.11 -+#include <asm/hw_irq.h>
   40.12 -+#endif
   40.13 - 
   40.14 -+#if 1
   40.15 -+void __init
   40.16 -+hpsim_irq_init (void)
   40.17 -+{
   40.18 -+	printf("*** hpsim_irq_init called: NOT NEEDED?!?!?\n");
   40.19 -+}
   40.20 -+#else
   40.21 - static unsigned int
   40.22 - hpsim_irq_startup (unsigned int irq)
   40.23 - {
   40.24 -@@ -19,6 +29,10 @@
   40.25 - static void
   40.26 - hpsim_irq_noop (unsigned int irq)
   40.27 - {
   40.28 -+#if 1
   40.29 -+printf("hpsim_irq_noop: irq=%d\n",irq);
   40.30 -+while(irq);
   40.31 -+#endif
   40.32 - }
   40.33 - 
   40.34 - static struct hw_interrupt_type irq_type_hp_sim = {
   40.35 -@@ -44,3 +58,4 @@
   40.36 - 			idesc->handler = &irq_type_hp_sim;
   40.37 - 	}
   40.38 - }
   40.39 -+#endif
    41.1 --- a/xen/arch/ia64/patch/linux-2.6.7/hpsim_ssc.h	Fri Aug 26 11:02:14 2005 +0000
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,26 +0,0 @@
    41.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/hp/sim/hpsim_ssc.h	2004-06-15 23:19:43.000000000 -0600
    41.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/hpsim_ssc.h	2004-08-29 01:04:23.000000000 -0600
    41.6 -@@ -33,4 +33,23 @@
    41.7 -  */
    41.8 - extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
    41.9 - 
   41.10 -+#ifdef XEN
   41.11 -+/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
   41.12 -+ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
   41.13 -+#define SSC_OPEN			50
   41.14 -+#define SSC_CLOSE			51
   41.15 -+#define SSC_READ			52
   41.16 -+#define SSC_WRITE			53
   41.17 -+#define SSC_GET_COMPLETION		54
   41.18 -+#define SSC_WAIT_COMPLETION		55
   41.19 -+
   41.20 -+#define SSC_WRITE_ACCESS		2
   41.21 -+#define SSC_READ_ACCESS			1
   41.22 -+
   41.23 -+struct ssc_disk_req {
   41.24 -+	unsigned long addr;
   41.25 -+	unsigned long len;
   41.26 -+};
   41.27 -+#endif
   41.28 -+
   41.29 - #endif /* _IA64_PLATFORM_HPSIM_SSC_H */
    42.1 --- a/xen/arch/ia64/patch/linux-2.6.7/hw_irq.h	Fri Aug 26 11:02:14 2005 +0000
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,24 +0,0 @@
    42.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/hw_irq.h	2004-06-15 23:19:22.000000000 -0600
    42.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/hw_irq.h	2004-08-27 09:07:38.000000000 -0600
    42.6 -@@ -9,7 +9,9 @@
    42.7 - #include <linux/interrupt.h>
    42.8 - #include <linux/sched.h>
    42.9 - #include <linux/types.h>
   42.10 -+#ifndef XEN
   42.11 - #include <linux/profile.h>
   42.12 -+#endif
   42.13 - 
   42.14 - #include <asm/machvec.h>
   42.15 - #include <asm/ptrace.h>
   42.16 -@@ -96,7 +98,11 @@
   42.17 -  * Default implementations for the irq-descriptor API:
   42.18 -  */
   42.19 - 
   42.20 -+#ifdef XEN
   42.21 -+#define _irq_desc irq_desc
   42.22 -+#else
   42.23 - extern irq_desc_t _irq_desc[NR_IRQS];
   42.24 -+#endif
   42.25 - 
   42.26 - #ifndef CONFIG_IA64_GENERIC
   42.27 - static inline irq_desc_t *
    43.1 --- a/xen/arch/ia64/patch/linux-2.6.7/ide.h	Fri Aug 26 11:02:14 2005 +0000
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,35 +0,0 @@
    43.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/ide.h	2004-06-15 23:19:36.000000000 -0600
    43.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/ide.h	2004-08-25 19:28:13.000000000 -0600
    43.6 -@@ -64,6 +64,32 @@
    43.7 - #define ide_init_default_irq(base)	ide_default_irq(base)
    43.8 - #endif
    43.9 - 
   43.10 -+#ifdef XEN
   43.11 -+// this is moved to linux/ide.h in newer versions of linux
   43.12 -+typedef union {
   43.13 -+	unsigned all			: 8;	/* all of the bits together */
   43.14 -+	struct {
   43.15 -+		unsigned head		: 4;	/* always zeros here */
   43.16 -+		unsigned unit		: 1;	/* drive select number, 0 or 1 */
   43.17 -+		unsigned bit5		: 1;	/* always 1 */
   43.18 -+		unsigned lba		: 1;	/* using LBA instead of CHS */
   43.19 -+		unsigned bit7		: 1;	/* always 1 */
   43.20 -+	} b;
   43.21 -+} select_t;
   43.22 -+
   43.23 -+typedef union {
   43.24 -+	unsigned all			: 8;	/* all of the bits together */
   43.25 -+	struct {
   43.26 -+		unsigned bit0		: 1;
   43.27 -+		unsigned nIEN		: 1;	/* device INTRQ to host */
   43.28 -+		unsigned SRST		: 1;	/* host soft reset bit */
   43.29 -+		unsigned bit3		: 1;	/* ATA-2 thingy */
   43.30 -+		unsigned reserved456	: 3;
   43.31 -+		unsigned HOB		: 1;	/* 48-bit address ordering */
   43.32 -+	} b;
   43.33 -+} control_t;
   43.34 -+#endif
   43.35 -+
   43.36 - #include <asm-generic/ide_iops.h>
   43.37 - 
   43.38 - #endif /* __KERNEL__ */
    44.1 --- a/xen/arch/ia64/patch/linux-2.6.7/init_task.c	Fri Aug 26 11:02:14 2005 +0000
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,35 +0,0 @@
    44.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/kernel/init_task.c	2004-06-15 23:20:26.000000000 -0600
    44.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/init_task.c	2004-08-27 00:06:35.000000000 -0600
    44.6 -@@ -15,10 +15,12 @@
    44.7 - #include <asm/uaccess.h>
    44.8 - #include <asm/pgtable.h>
    44.9 - 
   44.10 -+#ifndef XEN
   44.11 - static struct fs_struct init_fs = INIT_FS;
   44.12 - static struct files_struct init_files = INIT_FILES;
   44.13 - static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
   44.14 - static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
   44.15 -+#endif
   44.16 - struct mm_struct init_mm = INIT_MM(init_mm);
   44.17 - 
   44.18 - EXPORT_SYMBOL(init_mm);
   44.19 -@@ -33,13 +35,19 @@
   44.20 - 
   44.21 - union {
   44.22 - 	struct {
   44.23 -+#ifdef XEN
   44.24 -+		struct domain task;
   44.25 -+#else
   44.26 - 		struct task_struct task;
   44.27 - 		struct thread_info thread_info;
   44.28 -+#endif
   44.29 - 	} s;
   44.30 - 	unsigned long stack[KERNEL_STACK_SIZE/sizeof (unsigned long)];
   44.31 - } init_task_mem asm ("init_task") __attribute__((section(".data.init_task"))) = {{
   44.32 - 	.task =		INIT_TASK(init_task_mem.s.task),
   44.33 -+#ifndef XEN
   44.34 - 	.thread_info =	INIT_THREAD_INFO(init_task_mem.s.task)
   44.35 -+#endif
   44.36 - }};
   44.37 - 
   44.38 - EXPORT_SYMBOL(init_task);
    45.1 --- a/xen/arch/ia64/patch/linux-2.6.7/init_task.h	Fri Aug 26 11:02:14 2005 +0000
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,53 +0,0 @@
    45.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/init_task.h	2004-06-15 23:18:57.000000000 -0600
    45.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/init_task.h	2004-11-15 17:06:20.000000000 -0700
    45.6 -@@ -31,6 +31,18 @@
    45.7 - 	.max_reqs	= ~0U,				\
    45.8 - }
    45.9 - 
   45.10 -+#ifdef XEN
   45.11 -+#define INIT_MM(name) \
   45.12 -+{			 					\
   45.13 -+	.mm_rb		= RB_ROOT,				\
   45.14 -+	.pgd		= swapper_pg_dir, 			\
   45.15 -+	.mm_users	= ATOMIC_INIT(2), 			\
   45.16 -+	.mm_count	= ATOMIC_INIT(1), 			\
   45.17 -+	.page_table_lock =  SPIN_LOCK_UNLOCKED, 		\
   45.18 -+	.mmlist		= LIST_HEAD_INIT(name.mmlist),		\
   45.19 -+	.cpu_vm_mask	= CPU_MASK_ALL,				\
   45.20 -+}
   45.21 -+#else
   45.22 - #define INIT_MM(name) \
   45.23 - {			 					\
   45.24 - 	.mm_rb		= RB_ROOT,				\
   45.25 -@@ -43,6 +55,7 @@
   45.26 - 	.cpu_vm_mask	= CPU_MASK_ALL,				\
   45.27 - 	.default_kioctx = INIT_KIOCTX(name.default_kioctx, name),	\
   45.28 - }
   45.29 -+#endif
   45.30 - 
   45.31 - #define INIT_SIGNALS(sig) {	\
   45.32 - 	.count		= ATOMIC_INIT(1), 		\
   45.33 -@@ -64,6 +77,15 @@
   45.34 -  *  INIT_TASK is used to set up the first task table, touch at
   45.35 -  * your own risk!. Base=0, limit=0x1fffff (=2MB)
   45.36 -  */
   45.37 -+#ifdef XEN
   45.38 -+#define INIT_TASK(tsk) \
   45.39 -+{							\
   45.40 -+	/*processor:	0,*/				\
   45.41 -+	/*domain_id:	IDLE_DOMAIN_ID,*/		\
   45.42 -+	/*domain_flags:	DOMF_idle_domain,*/		\
   45.43 -+	refcnt:		ATOMIC_INIT(1)			\
   45.44 -+}
   45.45 -+#else
   45.46 - #define INIT_TASK(tsk)	\
   45.47 - {									\
   45.48 - 	.state		= 0,						\
   45.49 -@@ -113,6 +135,7 @@
   45.50 - 	.switch_lock	= SPIN_LOCK_UNLOCKED,				\
   45.51 - 	.journal_info	= NULL,						\
   45.52 - }
   45.53 -+#endif
   45.54 - 
   45.55 - 
   45.56 - 
    46.1 --- a/xen/arch/ia64/patch/linux-2.6.7/interrupt.h	Fri Aug 26 11:02:14 2005 +0000
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,18 +0,0 @@
    46.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/interrupt.h	2004-06-15 23:19:29.000000000 -0600
    46.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/interrupt.h	2004-08-25 19:28:13.000000000 -0600
    46.6 -@@ -32,6 +32,7 @@
    46.7 - #define IRQ_HANDLED	(1)
    46.8 - #define IRQ_RETVAL(x)	((x) != 0)
    46.9 - 
   46.10 -+#ifndef XEN
   46.11 - struct irqaction {
   46.12 - 	irqreturn_t (*handler)(int, void *, struct pt_regs *);
   46.13 - 	unsigned long flags;
   46.14 -@@ -46,6 +47,7 @@
   46.15 - 		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
   46.16 - 		       unsigned long, const char *, void *);
   46.17 - extern void free_irq(unsigned int, void *);
   46.18 -+#endif
   46.19 - 
   46.20 - /*
   46.21 -  * Temporary defines for UP kernels, until all code gets fixed.
    47.1 --- a/xen/arch/ia64/patch/linux-2.6.7/io.h	Fri Aug 26 11:02:14 2005 +0000
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,14 +0,0 @@
    47.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/io.h	2004-06-15 23:18:57.000000000 -0600
    47.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/io.h	2004-11-05 16:53:36.000000000 -0700
    47.6 -@@ -23,7 +23,11 @@
    47.7 - #define __SLOW_DOWN_IO	do { } while (0)
    47.8 - #define SLOW_DOWN_IO	do { } while (0)
    47.9 - 
   47.10 -+#ifdef XEN
   47.11 -+#define __IA64_UNCACHED_OFFSET	0xdffc000000000000	/* region 6 */
   47.12 -+#else
   47.13 - #define __IA64_UNCACHED_OFFSET	0xc000000000000000	/* region 6 */
   47.14 -+#endif
   47.15 - 
   47.16 - /*
   47.17 -  * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
    48.1 --- a/xen/arch/ia64/patch/linux-2.6.7/irq.h	Fri Aug 26 11:02:14 2005 +0000
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,18 +0,0 @@
    48.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/irq.h	2005-01-23 13:23:36.000000000 -0700
    48.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/irq.h	2004-08-25 19:28:13.000000000 -0600
    48.6 -@@ -30,6 +30,15 @@
    48.7 - extern void enable_irq (unsigned int);
    48.8 - extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
    48.9 - 
   48.10 -+#ifdef XEN
   48.11 -+// dup'ed from signal.h to avoid changes to includes
   48.12 -+#define	SA_NOPROFILE	0x02000000
   48.13 -+#define	SA_SHIRQ	0x04000000
   48.14 -+#define	SA_RESTART	0x10000000
   48.15 -+#define	SA_INTERRUPT	0x20000000
   48.16 -+#define	SA_SAMPLE_RANDOM	SA_RESTART
   48.17 -+#endif
   48.18 -+
   48.19 - #ifdef CONFIG_SMP
   48.20 - extern void move_irq(int irq);
   48.21 - #else
    49.1 --- a/xen/arch/ia64/patch/linux-2.6.7/irq_ia64.c	Fri Aug 26 11:02:14 2005 +0000
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,82 +0,0 @@
    49.4 ---- /home/djm/linux-2.6.7/arch/ia64/kernel/irq_ia64.c	2004-06-15 23:19:13.000000000 -0600
    49.5 -+++ arch/ia64/irq_ia64.c	2005-02-17 13:17:16.000000000 -0700
    49.6 -@@ -17,18 +17,26 @@
    49.7 - #include <linux/config.h>
    49.8 - #include <linux/module.h>
    49.9 - 
   49.10 -+#ifndef XEN
   49.11 - #include <linux/jiffies.h>
   49.12 -+#endif
   49.13 - #include <linux/errno.h>
   49.14 - #include <linux/init.h>
   49.15 - #include <linux/interrupt.h>
   49.16 - #include <linux/ioport.h>
   49.17 -+#ifndef XEN
   49.18 - #include <linux/kernel_stat.h>
   49.19 -+#endif
   49.20 - #include <linux/slab.h>
   49.21 -+#ifndef XEN
   49.22 - #include <linux/ptrace.h>
   49.23 - #include <linux/random.h>	/* for rand_initialize_irq() */
   49.24 - #include <linux/signal.h>
   49.25 -+#endif
   49.26 - #include <linux/smp.h>
   49.27 -+#ifndef XEN
   49.28 - #include <linux/smp_lock.h>
   49.29 -+#endif
   49.30 - #include <linux/threads.h>
   49.31 - 
   49.32 - #include <asm/bitops.h>
   49.33 -@@ -101,6 +109,24 @@
   49.34 - ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
   49.35 - {
   49.36 - 	unsigned long saved_tpr;
   49.37 -+#if 0
   49.38 -+//FIXME: For debug only, can be removed
   49.39 -+	static char firstirq = 1;
   49.40 -+	static char firsttime[256];
   49.41 -+	static char firstpend[256];
   49.42 -+	if (firstirq) {
   49.43 -+		int i;
   49.44 -+		for (i=0;i<256;i++) firsttime[i] = 1;
   49.45 -+		for (i=0;i<256;i++) firstpend[i] = 1;
   49.46 -+		firstirq = 0;
   49.47 -+	}
   49.48 -+	if (firsttime[vector]) {
   49.49 -+		printf("**** (entry) First received int on vector=%d,itc=%lx\n",
   49.50 -+			(unsigned long) vector, ia64_get_itc());
   49.51 -+		firsttime[vector] = 0;
   49.52 -+	}
   49.53 -+#endif
   49.54 -+
   49.55 - 
   49.56 - #if IRQ_DEBUG
   49.57 - 	{
   49.58 -@@ -145,6 +171,27 @@
   49.59 - 			ia64_setreg(_IA64_REG_CR_TPR, vector);
   49.60 - 			ia64_srlz_d();
   49.61 - 
   49.62 -+#ifdef XEN
   49.63 -+	if (vector != 0xef) {
   49.64 -+		extern void vcpu_pend_interrupt(void *, int);
   49.65 -+#if 0
   49.66 -+		if (firsttime[vector]) {
   49.67 -+			printf("**** (iterate) First received int on vector=%d,itc=%lx\n",
   49.68 -+			(unsigned long) vector, ia64_get_itc());
   49.69 -+			firsttime[vector] = 0;
   49.70 -+		}
   49.71 -+		if (firstpend[vector]) {
   49.72 -+			printf("**** First pended int on vector=%d,itc=%lx\n",
   49.73 -+				(unsigned long) vector,ia64_get_itc());
   49.74 -+			firstpend[vector] = 0;
   49.75 -+		}
   49.76 -+#endif
   49.77 -+		//FIXME: TEMPORARY HACK!!!!
   49.78 -+		vcpu_pend_interrupt(dom0->vcpu[0],vector);
   49.79 -+		vcpu_wake(dom0->vcpu[0]);
   49.80 -+	}
   49.81 -+	else
   49.82 -+#endif
   49.83 - 			do_IRQ(local_vector_to_irq(vector), regs);
   49.84 - 
   49.85 - 			/*
    50.1 --- a/xen/arch/ia64/patch/linux-2.6.7/ivt.S	Fri Aug 26 11:02:14 2005 +0000
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,528 +0,0 @@
    50.4 ---- ../../linux-2.6.7/arch/ia64/kernel/ivt.S	2004-06-15 23:18:59.000000000 -0600
    50.5 -+++ arch/ia64/ivt.S	2005-04-01 12:56:01.000000000 -0700
    50.6 -@@ -1,3 +1,21 @@
    50.7 -+
    50.8 -+#ifdef XEN
    50.9 -+//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
   50.10 -+// these are all hacked out for now as the entire IVT
   50.11 -+// will eventually be replaced... just want to use it
   50.12 -+// for startup code to handle TLB misses
   50.13 -+//#define ia64_leave_kernel 0
   50.14 -+//#define ia64_ret_from_syscall 0
   50.15 -+//#define ia64_handle_irq 0
   50.16 -+//#define ia64_fault 0
   50.17 -+#define ia64_illegal_op_fault 0
   50.18 -+#define ia64_prepare_handle_unaligned 0
   50.19 -+#define ia64_bad_break 0
   50.20 -+#define ia64_trace_syscall 0
   50.21 -+#define sys_call_table 0
   50.22 -+#define sys_ni_syscall 0
   50.23 -+#include <asm/vhpt.h>
   50.24 -+#endif
   50.25 - /*
   50.26 -  * arch/ia64/kernel/ivt.S
   50.27 -  *
   50.28 -@@ -76,6 +94,13 @@
   50.29 - 	mov r19=n;;			/* prepare to save predicates */		\
   50.30 - 	br.sptk.many dispatch_to_fault_handler
   50.31 - 
   50.32 -+#ifdef XEN
   50.33 -+#define REFLECT(n)									\
   50.34 -+	mov r31=pr;									\
   50.35 -+	mov r19=n;;			/* prepare to save predicates */		\
   50.36 -+	br.sptk.many dispatch_reflection
   50.37 -+#endif
   50.38 -+
   50.39 - 	.section .text.ivt,"ax"
   50.40 - 
   50.41 - 	.align 32768	// align on 32KB boundary
   50.42 -@@ -213,6 +238,13 @@
   50.43 - // 0x0400 Entry 1 (size 64 bundles) ITLB (21)
   50.44 - ENTRY(itlb_miss)
   50.45 - 	DBG_FAULT(1)
   50.46 -+#ifdef XEN
   50.47 -+	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
   50.48 -+#ifdef VHPT_GLOBAL
   50.49 -+	br.cond.sptk page_fault
   50.50 -+	;;
   50.51 -+#endif
   50.52 -+#endif
   50.53 - 	/*
   50.54 - 	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
   50.55 - 	 * page table.  If a nested TLB miss occurs, we switch into physical
   50.56 -@@ -257,6 +289,13 @@
   50.57 - // 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
   50.58 - ENTRY(dtlb_miss)
   50.59 - 	DBG_FAULT(2)
   50.60 -+#ifdef XEN
   50.61 -+	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
   50.62 -+#ifdef VHPT_GLOBAL
   50.63 -+	br.cond.sptk page_fault
   50.64 -+	;;
   50.65 -+#endif
   50.66 -+#endif
   50.67 - 	/*
   50.68 - 	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
   50.69 - 	 * page table.  If a nested TLB miss occurs, we switch into physical
   50.70 -@@ -301,6 +340,13 @@
   50.71 - // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
   50.72 - ENTRY(alt_itlb_miss)
   50.73 - 	DBG_FAULT(3)
   50.74 -+#ifdef XEN
   50.75 -+//#ifdef VHPT_GLOBAL
   50.76 -+//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
   50.77 -+//	br.cond.sptk page_fault
   50.78 -+//	;;
   50.79 -+//#endif
   50.80 -+#endif
   50.81 - 	mov r16=cr.ifa		// get address that caused the TLB miss
   50.82 - 	movl r17=PAGE_KERNEL
   50.83 - 	mov r21=cr.ipsr
   50.84 -@@ -339,6 +385,13 @@
   50.85 - // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
   50.86 - ENTRY(alt_dtlb_miss)
   50.87 - 	DBG_FAULT(4)
   50.88 -+#ifdef XEN
   50.89 -+//#ifdef VHPT_GLOBAL
   50.90 -+//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
   50.91 -+//	br.cond.sptk page_fault
   50.92 -+//	;;
   50.93 -+//#endif
   50.94 -+#endif
   50.95 - 	mov r16=cr.ifa		// get address that caused the TLB miss
   50.96 - 	movl r17=PAGE_KERNEL
   50.97 - 	mov r20=cr.isr
   50.98 -@@ -368,6 +421,17 @@
   50.99 - 	cmp.ne p8,p0=r0,r23
  50.100 - (p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
  50.101 - (p8)	br.cond.spnt page_fault
  50.102 -+#ifdef XEN
  50.103 -+	;;
  50.104 -+	// FIXME: inadequate test, this is where we test for Xen address
  50.105 -+	// note that 0xf000 (cached) and 0xd000 (uncached) addresses
  50.106 -+	// should be OK.  (Though no I/O is done in Xen, EFI needs uncached
  50.107 -+	// addresses and some domain EFI calls are passed through)
  50.108 -+	tbit.nz p0,p8=r16,60
  50.109 -+(p8)	br.cond.spnt page_fault
  50.110 -+//(p8)	br.cond.spnt 0
  50.111 -+	;;
  50.112 -+#endif
  50.113 - 
  50.114 - 	dep r21=-1,r21,IA64_PSR_ED_BIT,1
  50.115 - 	or r19=r19,r17		// insert PTE control bits into r19
  50.116 -@@ -448,6 +512,9 @@
  50.117 - /////////////////////////////////////////////////////////////////////////////////////////
  50.118 - // 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
  50.119 - ENTRY(ikey_miss)
  50.120 -+#ifdef XEN
  50.121 -+	REFLECT(6)
  50.122 -+#endif
  50.123 - 	DBG_FAULT(6)
  50.124 - 	FAULT(6)
  50.125 - END(ikey_miss)
  50.126 -@@ -460,9 +527,16 @@
  50.127 - 	srlz.i
  50.128 - 	;;
  50.129 - 	SAVE_MIN_WITH_COVER
  50.130 -+#ifdef XEN
  50.131 -+	alloc r15=ar.pfs,0,0,4,0
  50.132 -+	mov out0=cr.ifa
  50.133 -+	mov out1=cr.isr
  50.134 -+	mov out3=cr.itir
  50.135 -+#else
  50.136 - 	alloc r15=ar.pfs,0,0,3,0
  50.137 - 	mov out0=cr.ifa
  50.138 - 	mov out1=cr.isr
  50.139 -+#endif
  50.140 - 	adds r3=8,r2				// set up second base pointer
  50.141 - 	;;
  50.142 - 	ssm psr.ic | PSR_DEFAULT_BITS
  50.143 -@@ -483,6 +557,9 @@
  50.144 - /////////////////////////////////////////////////////////////////////////////////////////
  50.145 - // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
  50.146 - ENTRY(dkey_miss)
  50.147 -+#ifdef XEN
  50.148 -+	REFLECT(7)
  50.149 -+#endif
  50.150 - 	DBG_FAULT(7)
  50.151 - 	FAULT(7)
  50.152 - END(dkey_miss)
  50.153 -@@ -491,6 +568,9 @@
  50.154 - /////////////////////////////////////////////////////////////////////////////////////////
  50.155 - // 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
  50.156 - ENTRY(dirty_bit)
  50.157 -+#ifdef XEN
  50.158 -+	REFLECT(8)
  50.159 -+#endif
  50.160 - 	DBG_FAULT(8)
  50.161 - 	/*
  50.162 - 	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
  50.163 -@@ -553,6 +633,9 @@
  50.164 - /////////////////////////////////////////////////////////////////////////////////////////
  50.165 - // 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
  50.166 - ENTRY(iaccess_bit)
  50.167 -+#ifdef XEN
  50.168 -+	REFLECT(9)
  50.169 -+#endif
  50.170 - 	DBG_FAULT(9)
  50.171 - 	// Like Entry 8, except for instruction access
  50.172 - 	mov r16=cr.ifa				// get the address that caused the fault
  50.173 -@@ -618,6 +701,9 @@
  50.174 - /////////////////////////////////////////////////////////////////////////////////////////
  50.175 - // 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
  50.176 - ENTRY(daccess_bit)
  50.177 -+#ifdef XEN
  50.178 -+	REFLECT(10)
  50.179 -+#endif
  50.180 - 	DBG_FAULT(10)
  50.181 - 	// Like Entry 8, except for data access
  50.182 - 	mov r16=cr.ifa				// get the address that caused the fault
  50.183 -@@ -686,6 +772,16 @@
  50.184 - 	 * to prevent leaking bits from kernel to user level.
  50.185 - 	 */
  50.186 - 	DBG_FAULT(11)
  50.187 -+#ifdef XEN
  50.188 -+	mov r16=cr.isr
  50.189 -+	mov r17=cr.iim
  50.190 -+	mov r31=pr
  50.191 -+	;;
  50.192 -+	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
  50.193 -+	// FIXME: may also need to check slot==2?
  50.194 -+(p7)	br.sptk.many dispatch_privop_fault
  50.195 -+	br.sptk.many dispatch_break_fault
  50.196 -+#endif
  50.197 - 	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
  50.198 - 	mov r17=cr.iim
  50.199 - 	mov r18=__IA64_BREAK_SYSCALL
  50.200 -@@ -696,7 +792,9 @@
  50.201 - 	mov r27=ar.rsc
  50.202 - 	mov r26=ar.pfs
  50.203 - 	mov r28=cr.iip
  50.204 -+#ifndef XEN
  50.205 - 	mov r31=pr				// prepare to save predicates
  50.206 -+#endif
  50.207 - 	mov r20=r1
  50.208 - 	;;
  50.209 - 	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
  50.210 -@@ -792,6 +890,36 @@
  50.211 - 	DBG_FAULT(13)
  50.212 - 	FAULT(13)
  50.213 - 
  50.214 -+#ifdef XEN
  50.215 -+	// There is no particular reason for this code to be here, other than that
  50.216 -+	// there happens to be space here that would go unused otherwise.  If this
  50.217 -+	// fault ever gets "unreserved", simply moved the following code to a more
  50.218 -+	// suitable spot...
  50.219 -+
  50.220 -+ENTRY(dispatch_break_fault)
  50.221 -+	SAVE_MIN_WITH_COVER
  50.222 -+	;;
  50.223 -+	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
  50.224 -+	mov out0=cr.ifa
  50.225 -+	adds out1=16,sp
  50.226 -+	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  50.227 -+	mov out3=cr.iim		// FIXME: pity to make this slow access twice
  50.228 -+
  50.229 -+	ssm psr.ic | PSR_DEFAULT_BITS
  50.230 -+	;;
  50.231 -+	srlz.i					// guarantee that interruption collection is on
  50.232 -+	;;
  50.233 -+(p15)	ssm psr.i				// restore psr.i
  50.234 -+	adds r3=8,r2				// set up second base pointer
  50.235 -+	;;
  50.236 -+	SAVE_REST
  50.237 -+	movl r14=ia64_leave_kernel
  50.238 -+	;;
  50.239 -+	mov rp=r14
  50.240 -+	br.sptk.many ia64_prepare_handle_break
  50.241 -+END(dispatch_break_fault)
  50.242 -+#endif
  50.243 -+
  50.244 - 	.org ia64_ivt+0x3800
  50.245 - /////////////////////////////////////////////////////////////////////////////////////////
  50.246 - // 0x3800 Entry 14 (size 64 bundles) Reserved
  50.247 -@@ -842,9 +970,11 @@
  50.248 - 	 *	- ar.fpsr: set to kernel settings
  50.249 - 	 */
  50.250 - GLOBAL_ENTRY(ia64_syscall_setup)
  50.251 -+#ifndef XEN
  50.252 - #if PT(B6) != 0
  50.253 - # error This code assumes that b6 is the first field in pt_regs.
  50.254 - #endif
  50.255 -+#endif
  50.256 - 	st8 [r1]=r19				// save b6
  50.257 - 	add r16=PT(CR_IPSR),r1			// initialize first base pointer
  50.258 - 	add r17=PT(R11),r1			// initialize second base pointer
  50.259 -@@ -974,6 +1104,37 @@
  50.260 - 	DBG_FAULT(16)
  50.261 - 	FAULT(16)
  50.262 - 
  50.263 -+#ifdef XEN
  50.264 -+	// There is no particular reason for this code to be here, other than that
  50.265 -+	// there happens to be space here that would go unused otherwise.  If this
  50.266 -+	// fault ever gets "unreserved", simply moved the following code to a more
  50.267 -+	// suitable spot...
  50.268 -+
  50.269 -+ENTRY(dispatch_privop_fault)
  50.270 -+	SAVE_MIN_WITH_COVER
  50.271 -+	;;
  50.272 -+	alloc r14=ar.pfs,0,0,4,0		// now it's safe (must be first in insn group!)
  50.273 -+	mov out0=cr.ifa
  50.274 -+	adds out1=16,sp
  50.275 -+	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  50.276 -+	mov out3=cr.itir
  50.277 -+
  50.278 -+	ssm psr.ic | PSR_DEFAULT_BITS
  50.279 -+	;;
  50.280 -+	srlz.i					// guarantee that interruption collection is on
  50.281 -+	;;
  50.282 -+(p15)	ssm psr.i				// restore psr.i
  50.283 -+	adds r3=8,r2				// set up second base pointer
  50.284 -+	;;
  50.285 -+	SAVE_REST
  50.286 -+	movl r14=ia64_leave_kernel
  50.287 -+	;;
  50.288 -+	mov rp=r14
  50.289 -+	br.sptk.many ia64_prepare_handle_privop
  50.290 -+END(dispatch_privop_fault)
  50.291 -+#endif
  50.292 -+
  50.293 -+
  50.294 - 	.org ia64_ivt+0x4400
  50.295 - /////////////////////////////////////////////////////////////////////////////////////////
  50.296 - // 0x4400 Entry 17 (size 64 bundles) Reserved
  50.297 -@@ -1090,6 +1251,9 @@
  50.298 - /////////////////////////////////////////////////////////////////////////////////////////
  50.299 - // 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
  50.300 - ENTRY(page_not_present)
  50.301 -+#ifdef XEN
  50.302 -+	REFLECT(20)
  50.303 -+#endif
  50.304 - 	DBG_FAULT(20)
  50.305 - 	mov r16=cr.ifa
  50.306 - 	rsm psr.dt
  50.307 -@@ -1110,6 +1274,9 @@
  50.308 - /////////////////////////////////////////////////////////////////////////////////////////
  50.309 - // 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
  50.310 - ENTRY(key_permission)
  50.311 -+#ifdef XEN
  50.312 -+	REFLECT(21)
  50.313 -+#endif
  50.314 - 	DBG_FAULT(21)
  50.315 - 	mov r16=cr.ifa
  50.316 - 	rsm psr.dt
  50.317 -@@ -1123,6 +1290,9 @@
  50.318 - /////////////////////////////////////////////////////////////////////////////////////////
  50.319 - // 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
  50.320 - ENTRY(iaccess_rights)
  50.321 -+#ifdef XEN
  50.322 -+	REFLECT(22)
  50.323 -+#endif
  50.324 - 	DBG_FAULT(22)
  50.325 - 	mov r16=cr.ifa
  50.326 - 	rsm psr.dt
  50.327 -@@ -1136,6 +1306,9 @@
  50.328 - /////////////////////////////////////////////////////////////////////////////////////////
  50.329 - // 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
  50.330 - ENTRY(daccess_rights)
  50.331 -+#ifdef XEN
  50.332 -+	REFLECT(23)
  50.333 -+#endif
  50.334 - 	DBG_FAULT(23)
  50.335 - 	mov r16=cr.ifa
  50.336 - 	rsm psr.dt
  50.337 -@@ -1153,8 +1326,13 @@
  50.338 - 	mov r16=cr.isr
  50.339 - 	mov r31=pr
  50.340 - 	;;
  50.341 -+#ifdef XEN
  50.342 -+	cmp4.ge p6,p0=0x20,r16
  50.343 -+(p6)	br.sptk.many dispatch_privop_fault
  50.344 -+#else
  50.345 - 	cmp4.eq p6,p0=0,r16
  50.346 - (p6)	br.sptk.many dispatch_illegal_op_fault
  50.347 -+#endif
  50.348 - 	;;
  50.349 - 	mov r19=24		// fault number
  50.350 - 	br.sptk.many dispatch_to_fault_handler
  50.351 -@@ -1164,6 +1342,9 @@
  50.352 - /////////////////////////////////////////////////////////////////////////////////////////
  50.353 - // 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
  50.354 - ENTRY(disabled_fp_reg)
  50.355 -+#ifdef XEN
  50.356 -+	REFLECT(25)
  50.357 -+#endif
  50.358 - 	DBG_FAULT(25)
  50.359 - 	rsm psr.dfh		// ensure we can access fph
  50.360 - 	;;
  50.361 -@@ -1177,6 +1358,9 @@
  50.362 - /////////////////////////////////////////////////////////////////////////////////////////
  50.363 - // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
  50.364 - ENTRY(nat_consumption)
  50.365 -+#ifdef XEN
  50.366 -+	REFLECT(26)
  50.367 -+#endif
  50.368 - 	DBG_FAULT(26)
  50.369 - 	FAULT(26)
  50.370 - END(nat_consumption)
  50.371 -@@ -1185,6 +1369,10 @@
  50.372 - /////////////////////////////////////////////////////////////////////////////////////////
  50.373 - // 0x5700 Entry 27 (size 16 bundles) Speculation (40)
  50.374 - ENTRY(speculation_vector)
  50.375 -+#ifdef XEN
  50.376 -+	// this probably need not reflect...
  50.377 -+	REFLECT(27)
  50.378 -+#endif
  50.379 - 	DBG_FAULT(27)
  50.380 - 	/*
  50.381 - 	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
  50.382 -@@ -1228,6 +1416,9 @@
  50.383 - /////////////////////////////////////////////////////////////////////////////////////////
  50.384 - // 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
  50.385 - ENTRY(debug_vector)
  50.386 -+#ifdef XEN
  50.387 -+	REFLECT(29)
  50.388 -+#endif
  50.389 - 	DBG_FAULT(29)
  50.390 - 	FAULT(29)
  50.391 - END(debug_vector)
  50.392 -@@ -1236,6 +1427,9 @@
  50.393 - /////////////////////////////////////////////////////////////////////////////////////////
  50.394 - // 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
  50.395 - ENTRY(unaligned_access)
  50.396 -+#ifdef XEN
  50.397 -+	REFLECT(30)
  50.398 -+#endif
  50.399 - 	DBG_FAULT(30)
  50.400 - 	mov r16=cr.ipsr
  50.401 - 	mov r31=pr		// prepare to save predicates
  50.402 -@@ -1247,6 +1441,9 @@
  50.403 - /////////////////////////////////////////////////////////////////////////////////////////
  50.404 - // 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
  50.405 - ENTRY(unsupported_data_reference)
  50.406 -+#ifdef XEN
  50.407 -+	REFLECT(31)
  50.408 -+#endif
  50.409 - 	DBG_FAULT(31)
  50.410 - 	FAULT(31)
  50.411 - END(unsupported_data_reference)
  50.412 -@@ -1255,6 +1452,9 @@
  50.413 - /////////////////////////////////////////////////////////////////////////////////////////
  50.414 - // 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
  50.415 - ENTRY(floating_point_fault)
  50.416 -+#ifdef XEN
  50.417 -+	REFLECT(32)
  50.418 -+#endif
  50.419 - 	DBG_FAULT(32)
  50.420 - 	FAULT(32)
  50.421 - END(floating_point_fault)
  50.422 -@@ -1263,6 +1463,9 @@
  50.423 - /////////////////////////////////////////////////////////////////////////////////////////
  50.424 - // 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
  50.425 - ENTRY(floating_point_trap)
  50.426 -+#ifdef XEN
  50.427 -+	REFLECT(33)
  50.428 -+#endif
  50.429 - 	DBG_FAULT(33)
  50.430 - 	FAULT(33)
  50.431 - END(floating_point_trap)
  50.432 -@@ -1271,6 +1474,9 @@
  50.433 - /////////////////////////////////////////////////////////////////////////////////////////
  50.434 - // 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
  50.435 - ENTRY(lower_privilege_trap)
  50.436 -+#ifdef XEN
  50.437 -+	REFLECT(34)
  50.438 -+#endif
  50.439 - 	DBG_FAULT(34)
  50.440 - 	FAULT(34)
  50.441 - END(lower_privilege_trap)
  50.442 -@@ -1279,6 +1485,9 @@
  50.443 - /////////////////////////////////////////////////////////////////////////////////////////
  50.444 - // 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
  50.445 - ENTRY(taken_branch_trap)
  50.446 -+#ifdef XEN
  50.447 -+	REFLECT(35)
  50.448 -+#endif
  50.449 - 	DBG_FAULT(35)
  50.450 - 	FAULT(35)
  50.451 - END(taken_branch_trap)
  50.452 -@@ -1287,6 +1496,9 @@
  50.453 - /////////////////////////////////////////////////////////////////////////////////////////
  50.454 - // 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
  50.455 - ENTRY(single_step_trap)
  50.456 -+#ifdef XEN
  50.457 -+	REFLECT(36)
  50.458 -+#endif
  50.459 - 	DBG_FAULT(36)
  50.460 - 	FAULT(36)
  50.461 - END(single_step_trap)
  50.462 -@@ -1343,6 +1555,9 @@
  50.463 - /////////////////////////////////////////////////////////////////////////////////////////
  50.464 - // 0x6900 Entry 45 (size 16 bundles) IA-32 Exeception (17,18,29,41,42,43,44,58,60,61,62,72,73,75,76,77)
  50.465 - ENTRY(ia32_exception)
  50.466 -+#ifdef XEN
  50.467 -+	REFLECT(45)
  50.468 -+#endif
  50.469 - 	DBG_FAULT(45)
  50.470 - 	FAULT(45)
  50.471 - END(ia32_exception)
  50.472 -@@ -1351,6 +1566,9 @@
  50.473 - /////////////////////////////////////////////////////////////////////////////////////////
  50.474 - // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
  50.475 - ENTRY(ia32_intercept)
  50.476 -+#ifdef XEN
  50.477 -+	REFLECT(46)
  50.478 -+#endif
  50.479 - 	DBG_FAULT(46)
  50.480 - #ifdef	CONFIG_IA32_SUPPORT
  50.481 - 	mov r31=pr
  50.482 -@@ -1381,6 +1599,9 @@
  50.483 - /////////////////////////////////////////////////////////////////////////////////////////
  50.484 - // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
  50.485 - ENTRY(ia32_interrupt)
  50.486 -+#ifdef XEN
  50.487 -+	REFLECT(47)
  50.488 -+#endif
  50.489 - 	DBG_FAULT(47)
  50.490 - #ifdef CONFIG_IA32_SUPPORT
  50.491 - 	mov r31=pr
  50.492 -@@ -1510,6 +1731,39 @@
  50.493 - 	DBG_FAULT(67)
  50.494 - 	FAULT(67)
  50.495 - 
  50.496 -+#ifdef XEN
  50.497 -+	.org ia64_ivt+0x8000
  50.498 -+ENTRY(dispatch_reflection)
  50.499 -+	/*
  50.500 -+	 * Input:
  50.501 -+	 *	psr.ic:	off
  50.502 -+	 *	r19:	intr type (offset into ivt, see ia64_int.h)
  50.503 -+	 *	r31:	contains saved predicates (pr)
  50.504 -+	 */
  50.505 -+	SAVE_MIN_WITH_COVER_R19
  50.506 -+	alloc r14=ar.pfs,0,0,5,0
  50.507 -+	mov out4=r15
  50.508 -+	mov out0=cr.ifa
  50.509 -+	adds out1=16,sp
  50.510 -+	mov out2=cr.isr
  50.511 -+	mov out3=cr.iim
  50.512 -+//	mov out3=cr.itir
  50.513 -+
  50.514 -+	ssm psr.ic | PSR_DEFAULT_BITS
  50.515 -+	;;
  50.516 -+	srlz.i					// guarantee that interruption collection is on
  50.517 -+	;;
  50.518 -+(p15)	ssm psr.i				// restore psr.i
  50.519 -+	adds r3=8,r2				// set up second base pointer
  50.520 -+	;;
  50.521 -+	SAVE_REST
  50.522 -+	movl r14=ia64_leave_kernel
  50.523 -+	;;
  50.524 -+	mov rp=r14
  50.525 -+	br.sptk.many ia64_prepare_handle_reflection
  50.526 -+END(dispatch_reflection)
  50.527 -+#endif
  50.528 -+
  50.529 - #ifdef CONFIG_IA32_SUPPORT
  50.530 - 
  50.531 - 	/*
    51.1 --- a/xen/arch/ia64/patch/linux-2.6.7/kregs.h	Fri Aug 26 11:02:14 2005 +0000
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,13 +0,0 @@
    51.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/kregs.h	2004-06-15 23:19:01.000000000 -0600
    51.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/kregs.h	2004-09-17 18:27:22.000000000 -0600
    51.6 -@@ -30,6 +30,10 @@
    51.7 - #define IA64_TR_PALCODE		1	/* itr1: maps PALcode as required by EFI */
    51.8 - #define IA64_TR_PERCPU_DATA	1	/* dtr1: percpu data */
    51.9 - #define IA64_TR_CURRENT_STACK	2	/* dtr2: maps kernel's memory- & register-stacks */
   51.10 -+#ifdef XEN
   51.11 -+#define IA64_TR_SHARED_INFO	3	/* dtr3: page shared with domain */
   51.12 -+#define	IA64_TR_VHPT		4	/* dtr4: vhpt */
   51.13 -+#endif
   51.14 - 
   51.15 - /* Processor status register bits: */
   51.16 - #define IA64_PSR_BE_BIT		1
    52.1 --- a/xen/arch/ia64/patch/linux-2.6.7/lds.S	Fri Aug 26 11:02:14 2005 +0000
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,17 +0,0 @@
    52.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/kernel/vmlinux.lds.S	2004-06-15 23:19:52.000000000 -0600
    52.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/xen.lds.S	2004-08-25 19:28:12.000000000 -0600
    52.6 -@@ -11,12 +11,14 @@
    52.7 - OUTPUT_FORMAT("elf64-ia64-little")
    52.8 - OUTPUT_ARCH(ia64)
    52.9 - ENTRY(phys_start)
   52.10 -+#ifndef XEN
   52.11 - jiffies = jiffies_64;
   52.12 - PHDRS {
   52.13 -   code   PT_LOAD;
   52.14 -   percpu PT_LOAD;
   52.15 -   data   PT_LOAD;
   52.16 - }
   52.17 -+#endif
   52.18 - SECTIONS
   52.19 - {
   52.20 -   /* Sections to be discarded */
    53.1 --- a/xen/arch/ia64/patch/linux-2.6.7/linuxtime.h	Fri Aug 26 11:02:14 2005 +0000
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,34 +0,0 @@
    53.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/time.h	2004-06-15 23:19:37.000000000 -0600
    53.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/xen/linuxtime.h	2004-11-15 17:42:04.000000000 -0700
    53.6 -@@ -1,6 +1,11 @@
    53.7 - #ifndef _LINUX_TIME_H
    53.8 - #define _LINUX_TIME_H
    53.9 - 
   53.10 -+#ifdef XEN
   53.11 -+typedef	s64 time_t;
   53.12 -+typedef	s64 suseconds_t;
   53.13 -+#endif
   53.14 -+
   53.15 - #include <asm/param.h>
   53.16 - #include <linux/types.h>
   53.17 - 
   53.18 -@@ -25,7 +30,9 @@
   53.19 - #ifdef __KERNEL__
   53.20 - 
   53.21 - #include <linux/spinlock.h>
   53.22 -+#ifndef XEN
   53.23 - #include <linux/seqlock.h>
   53.24 -+#endif
   53.25 - #include <linux/timex.h>
   53.26 - #include <asm/div64.h>
   53.27 - #ifndef div_long_long_rem
   53.28 -@@ -322,7 +329,9 @@
   53.29 - 
   53.30 - extern struct timespec xtime;
   53.31 - extern struct timespec wall_to_monotonic;
   53.32 -+#ifndef XEN
   53.33 - extern seqlock_t xtime_lock;
   53.34 -+#endif
   53.35 - 
   53.36 - static inline unsigned long get_seconds(void)
   53.37 - { 
    54.1 --- a/xen/arch/ia64/patch/linux-2.6.7/mca_asm.h	Fri Aug 26 11:02:14 2005 +0000
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,32 +0,0 @@
    54.4 ---- ../../linux-2.6.7/include/asm-ia64/mca_asm.h	2004-06-15 23:20:03.000000000 -0600
    54.5 -+++ include/asm-ia64/mca_asm.h	2005-04-01 12:56:37.000000000 -0700
    54.6 -@@ -26,8 +26,13 @@
    54.7 -  * direct mapped to physical addresses.
    54.8 -  *	1. Lop off bits 61 thru 63 in the virtual address
    54.9 -  */
   54.10 -+#ifdef XEN
   54.11 -+#define INST_VA_TO_PA(addr)							\
   54.12 -+	dep	addr	= 0, addr, 60, 4
   54.13 -+#else // XEN
   54.14 - #define INST_VA_TO_PA(addr)							\
   54.15 - 	dep	addr	= 0, addr, 61, 3
   54.16 -+#endif // XEN
   54.17 - /*
   54.18 -  * This macro converts a data virtual address to a physical address
   54.19 -  * Right now for simulation purposes the virtual addresses are
   54.20 -@@ -42,9 +47,15 @@
   54.21 -  * direct mapped to physical addresses.
   54.22 -  *	1. Put 0x7 in bits 61 thru 63.
   54.23 -  */
   54.24 -+#ifdef XEN
   54.25 -+#define DATA_PA_TO_VA(addr,temp)							\
   54.26 -+	mov	temp	= 0xf	;;							\
   54.27 -+	dep	addr	= temp, addr, 60, 4
   54.28 -+#else // XEN
   54.29 - #define DATA_PA_TO_VA(addr,temp)							\
   54.30 - 	mov	temp	= 0x7	;;							\
   54.31 - 	dep	addr	= temp, addr, 61, 3
   54.32 -+#endif // XEN
   54.33 - 
   54.34 - /*
   54.35 -  * This macro jumps to the instruction at the given virtual address
    55.1 --- a/xen/arch/ia64/patch/linux-2.6.7/minstate.h	Fri Aug 26 11:02:14 2005 +0000
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,29 +0,0 @@
    55.4 ---- ../../linux-2.6.7/arch/ia64/kernel/minstate.h	2004-06-15 23:19:52.000000000 -0600
    55.5 -+++ arch/ia64/minstate.h	2005-04-01 12:56:01.000000000 -0700
    55.6 -@@ -45,7 +45,7 @@
    55.7 - (pKStk) tpa r1=sp;				/* compute physical addr of sp	*/		\
    55.8 - (pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
    55.9 - (pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
   55.10 --(pUStk)	dep r22=-1,r22,61,3;			/* compute kernel virtual addr of RBS */	\
   55.11 -+(pUStk)	dep r22=-1,r22,60,4;			/* compute kernel virtual addr of RBS */	\
   55.12 - 	;;											\
   55.13 - (pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;		/* if in kernel mode, use sp (r12) */		\
   55.14 - (pUStk)	mov ar.bspstore=r22;			/* switch to kernel RBS */			\
   55.15 -@@ -65,7 +65,7 @@
   55.16 - #endif
   55.17 - 
   55.18 - #ifdef MINSTATE_PHYS
   55.19 --# define MINSTATE_GET_CURRENT(reg)	mov reg=IA64_KR(CURRENT);; dep reg=0,reg,61,3
   55.20 -+# define MINSTATE_GET_CURRENT(reg)	mov reg=IA64_KR(CURRENT);; dep reg=0,reg,60,4
   55.21 - # define MINSTATE_START_SAVE_MIN	MINSTATE_START_SAVE_MIN_PHYS
   55.22 - # define MINSTATE_END_SAVE_MIN		MINSTATE_END_SAVE_MIN_PHYS
   55.23 - #endif
   55.24 -@@ -172,7 +172,7 @@
   55.25 - 	;;											\
   55.26 - .mem.offset 0,0; st8.spill [r16]=r15,16;							\
   55.27 - .mem.offset 8,0; st8.spill [r17]=r14,16;							\
   55.28 --	dep r14=-1,r0,61,3;									\
   55.29 -+	dep r14=-1,r0,60,4;									\
   55.30 - 	;;											\
   55.31 - .mem.offset 0,0; st8.spill [r16]=r2,16;								\
   55.32 - .mem.offset 8,0; st8.spill [r17]=r3,16;								\
    56.1 --- a/xen/arch/ia64/patch/linux-2.6.7/mm_bootmem.c	Fri Aug 26 11:02:14 2005 +0000
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,92 +0,0 @@
    56.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/mm/bootmem.c	2004-06-15 23:19:09.000000000 -0600
    56.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/mm_bootmem.c	2004-12-17 13:47:03.000000000 -0700
    56.6 -@@ -10,7 +10,9 @@
    56.7 -  */
    56.8 - 
    56.9 - #include <linux/mm.h>
   56.10 -+#ifndef XEN
   56.11 - #include <linux/kernel_stat.h>
   56.12 -+#endif
   56.13 - #include <linux/swap.h>
   56.14 - #include <linux/interrupt.h>
   56.15 - #include <linux/init.h>
   56.16 -@@ -55,6 +57,9 @@
   56.17 - 	bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
   56.18 - 	bdata->node_boot_start = (start << PAGE_SHIFT);
   56.19 - 	bdata->node_low_pfn = end;
   56.20 -+#ifdef XEN
   56.21 -+//printk("init_bootmem_core: mapstart=%lx,start=%lx,end=%lx,bdata->node_bootmem_map=%lx,bdata->node_boot_start=%lx,bdata->node_low_pfn=%lx\n",mapstart,start,end,bdata->node_bootmem_map,bdata->node_boot_start,bdata->node_low_pfn);
   56.22 -+#endif
   56.23 - 
   56.24 - 	/*
   56.25 - 	 * Initially all pages are reserved - setup_arch() has to
   56.26 -@@ -146,6 +151,9 @@
   56.27 - 	unsigned long i, start = 0, incr, eidx;
   56.28 - 	void *ret;
   56.29 - 
   56.30 -+#ifdef XEN
   56.31 -+//printf("__alloc_bootmem_core(%lx,%lx,%lx,%lx) called\n",bdata,size,align,goal);
   56.32 -+#endif
   56.33 - 	if(!size) {
   56.34 - 		printk("__alloc_bootmem_core(): zero-sized request\n");
   56.35 - 		BUG();
   56.36 -@@ -153,6 +161,9 @@
   56.37 - 	BUG_ON(align & (align-1));
   56.38 - 
   56.39 - 	eidx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
   56.40 -+#ifdef XEN
   56.41 -+//printf("__alloc_bootmem_core: eidx=%lx\n",eidx);
   56.42 -+#endif
   56.43 - 	offset = 0;
   56.44 - 	if (align &&
   56.45 - 	    (bdata->node_boot_start & (align - 1UL)) != 0)
   56.46 -@@ -182,6 +193,9 @@
   56.47 - 		unsigned long j;
   56.48 - 		i = find_next_zero_bit(bdata->node_bootmem_map, eidx, i);
   56.49 - 		i = ALIGN(i, incr);
   56.50 -+#ifdef XEN
   56.51 -+//if (i >= eidx) goto fail_block;
   56.52 -+#endif
   56.53 - 		if (test_bit(i, bdata->node_bootmem_map))
   56.54 - 			continue;
   56.55 - 		for (j = i + 1; j < i + areasize; ++j) {
   56.56 -@@ -203,6 +217,9 @@
   56.57 - 	return NULL;
   56.58 - 
   56.59 - found:
   56.60 -+#ifdef XEN
   56.61 -+//printf("__alloc_bootmem_core: start=%lx\n",start);
   56.62 -+#endif
   56.63 - 	bdata->last_success = start << PAGE_SHIFT;
   56.64 - 	BUG_ON(start >= eidx);
   56.65 - 
   56.66 -@@ -262,6 +279,9 @@
   56.67 - 	page = virt_to_page(phys_to_virt(bdata->node_boot_start));
   56.68 - 	idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
   56.69 - 	map = bdata->node_bootmem_map;
   56.70 -+#ifdef XEN
   56.71 -+//printk("free_all_bootmem_core: bdata=%lx, bdata->node_boot_start=%lx, bdata->node_low_pfn=%lx, bdata->node_bootmem_map=%lx\n",bdata,bdata->node_boot_start,bdata->node_low_pfn,bdata->node_bootmem_map);
   56.72 -+#endif
   56.73 - 	for (i = 0; i < idx; ) {
   56.74 - 		unsigned long v = ~map[i / BITS_PER_LONG];
   56.75 - 		if (v) {
   56.76 -@@ -285,6 +305,9 @@
   56.77 - 	 * Now free the allocator bitmap itself, it's not
   56.78 - 	 * needed anymore:
   56.79 - 	 */
   56.80 -+#ifdef XEN
   56.81 -+//printk("About to free the allocator bitmap itself\n");
   56.82 -+#endif
   56.83 - 	page = virt_to_page(bdata->node_bootmem_map);
   56.84 - 	count = 0;
   56.85 - 	for (i = 0; i < ((bdata->node_low_pfn-(bdata->node_boot_start >> PAGE_SHIFT))/8 + PAGE_SIZE-1)/PAGE_SIZE; i++,page++) {
   56.86 -@@ -327,6 +350,9 @@
   56.87 - 	return(init_bootmem_core(&contig_page_data, start, 0, pages));
   56.88 - }
   56.89 - 
   56.90 -+#ifdef XEN
   56.91 -+#undef reserve_bootmem
   56.92 -+#endif
   56.93 - #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
   56.94 - void __init reserve_bootmem (unsigned long addr, unsigned long size)
   56.95 - {
    57.1 --- a/xen/arch/ia64/patch/linux-2.6.7/mm_contig.c	Fri Aug 26 11:02:14 2005 +0000
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,216 +0,0 @@
    57.4 ---- ../../linux-2.6.7/arch/ia64/mm/contig.c	2004-06-15 23:19:12.000000000 -0600
    57.5 -+++ arch/ia64/mm_contig.c	2005-03-23 14:54:06.000000000 -0700
    57.6 -@@ -15,11 +15,21 @@
    57.7 -  * memory.
    57.8 -  */
    57.9 - #include <linux/config.h>
   57.10 -+#ifdef XEN
   57.11 -+#include <xen/sched.h>
   57.12 -+#endif
   57.13 - #include <linux/bootmem.h>
   57.14 - #include <linux/efi.h>
   57.15 - #include <linux/mm.h>
   57.16 - #include <linux/swap.h>
   57.17 - 
   57.18 -+#ifdef XEN
   57.19 -+#undef reserve_bootmem
   57.20 -+extern struct page *zero_page_memmap_ptr;
   57.21 -+struct page *mem_map;
   57.22 -+#define MAX_DMA_ADDRESS ~0UL	// FIXME???
   57.23 -+#endif
   57.24 -+
   57.25 - #include <asm/meminit.h>
   57.26 - #include <asm/pgalloc.h>
   57.27 - #include <asm/pgtable.h>
   57.28 -@@ -37,30 +47,7 @@
   57.29 - void
   57.30 - show_mem (void)
   57.31 - {
   57.32 --	int i, total = 0, reserved = 0;
   57.33 --	int shared = 0, cached = 0;
   57.34 --
   57.35 --	printk("Mem-info:\n");
   57.36 --	show_free_areas();
   57.37 --
   57.38 --	printk("Free swap:       %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
   57.39 --	i = max_mapnr;
   57.40 --	while (i-- > 0) {
   57.41 --		if (!pfn_valid(i))
   57.42 --			continue;
   57.43 --		total++;
   57.44 --		if (PageReserved(mem_map+i))
   57.45 --			reserved++;
   57.46 --		else if (PageSwapCache(mem_map+i))
   57.47 --			cached++;
   57.48 --		else if (page_count(mem_map + i))
   57.49 --			shared += page_count(mem_map + i) - 1;
   57.50 --	}
   57.51 --	printk("%d pages of RAM\n", total);
   57.52 --	printk("%d reserved pages\n", reserved);
   57.53 --	printk("%d pages shared\n", shared);
   57.54 --	printk("%d pages swap cached\n", cached);
   57.55 --	printk("%ld pages in page table cache\n", pgtable_cache_size);
   57.56 -+	printk("Dummy show_mem\n");
   57.57 - }
   57.58 - 
   57.59 - /* physical address where the bootmem map is located */
   57.60 -@@ -80,6 +67,9 @@
   57.61 - {
   57.62 - 	unsigned long *max_pfnp = arg, pfn;
   57.63 - 
   57.64 -+#ifdef XEN
   57.65 -+//printf("find_max_pfn: start=%lx, end=%lx, *arg=%lx\n",start,end,*(unsigned long *)arg);
   57.66 -+#endif
   57.67 - 	pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT;
   57.68 - 	if (pfn > *max_pfnp)
   57.69 - 		*max_pfnp = pfn;
   57.70 -@@ -133,41 +123,6 @@
   57.71 - 	return 0;
   57.72 - }
   57.73 - 
   57.74 --/**
   57.75 -- * find_memory - setup memory map
   57.76 -- *
   57.77 -- * Walk the EFI memory map and find usable memory for the system, taking
   57.78 -- * into account reserved areas.
   57.79 -- */
   57.80 --void
   57.81 --find_memory (void)
   57.82 --{
   57.83 --	unsigned long bootmap_size;
   57.84 --
   57.85 --	reserve_memory();
   57.86 --
   57.87 --	/* first find highest page frame number */
   57.88 --	max_pfn = 0;
   57.89 --	efi_memmap_walk(find_max_pfn, &max_pfn);
   57.90 --
   57.91 --	/* how many bytes to cover all the pages */
   57.92 --	bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT;
   57.93 --
   57.94 --	/* look for a location to hold the bootmap */
   57.95 --	bootmap_start = ~0UL;
   57.96 --	efi_memmap_walk(find_bootmap_location, &bootmap_size);
   57.97 --	if (bootmap_start == ~0UL)
   57.98 --		panic("Cannot find %ld bytes for bootmap\n", bootmap_size);
   57.99 --
  57.100 --	bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn);
  57.101 --
  57.102 --	/* Free all available memory, then mark bootmem-map as being in use. */
  57.103 --	efi_memmap_walk(filter_rsvd_memory, free_bootmem);
  57.104 --	reserve_bootmem(bootmap_start, bootmap_size);
  57.105 --
  57.106 --	find_initrd();
  57.107 --}
  57.108 --
  57.109 - #ifdef CONFIG_SMP
  57.110 - /**
  57.111 -  * per_cpu_init - setup per-cpu variables
  57.112 -@@ -227,73 +182,42 @@
  57.113 - void
  57.114 - paging_init (void)
  57.115 - {
  57.116 --	unsigned long max_dma;
  57.117 --	unsigned long zones_size[MAX_NR_ZONES];
  57.118 --#ifdef CONFIG_VIRTUAL_MEM_MAP
  57.119 --	unsigned long zholes_size[MAX_NR_ZONES];
  57.120 --	unsigned long max_gap;
  57.121 --#endif
  57.122 --
  57.123 --	/* initialize mem_map[] */
  57.124 -+	struct pfn_info *pg;
  57.125 -+	/* Allocate and map the machine-to-phys table */
  57.126 -+	if ((pg = alloc_domheap_pages(NULL, 10)) == NULL)
  57.127 -+		panic("Not enough memory to bootstrap Xen.\n");
  57.128 -+	memset(page_to_virt(pg), 0x55, 16UL << 20);
  57.129 - 
  57.130 --	memset(zones_size, 0, sizeof(zones_size));
  57.131 -+	/* Other mapping setup */
  57.132 - 
  57.133 --	num_physpages = 0;
  57.134 --	efi_memmap_walk(count_pages, &num_physpages);
  57.135 - 
  57.136 --	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  57.137 --
  57.138 --#ifdef CONFIG_VIRTUAL_MEM_MAP
  57.139 --	memset(zholes_size, 0, sizeof(zholes_size));
  57.140 --
  57.141 --	num_dma_physpages = 0;
  57.142 --	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
  57.143 --
  57.144 --	if (max_low_pfn < max_dma) {
  57.145 --		zones_size[ZONE_DMA] = max_low_pfn;
  57.146 --		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
  57.147 --	} else {
  57.148 --		zones_size[ZONE_DMA] = max_dma;
  57.149 --		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
  57.150 --		if (num_physpages > num_dma_physpages) {
  57.151 --			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  57.152 --			zholes_size[ZONE_NORMAL] =
  57.153 --				((max_low_pfn - max_dma) -
  57.154 --				 (num_physpages - num_dma_physpages));
  57.155 --		}
  57.156 --	}
  57.157 --
  57.158 --	max_gap = 0;
  57.159 --	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
  57.160 --	if (max_gap < LARGE_GAP) {
  57.161 --		vmem_map = (struct page *) 0;
  57.162 --		free_area_init_node(0, &contig_page_data, NULL, zones_size, 0,
  57.163 --				    zholes_size);
  57.164 --		mem_map = contig_page_data.node_mem_map;
  57.165 --	} else {
  57.166 --		unsigned long map_size;
  57.167 --
  57.168 --		/* allocate virtual_mem_map */
  57.169 --
  57.170 --		map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
  57.171 --		vmalloc_end -= map_size;
  57.172 --		vmem_map = (struct page *) vmalloc_end;
  57.173 --		efi_memmap_walk(create_mem_map_page_table, 0);
  57.174 --
  57.175 --		free_area_init_node(0, &contig_page_data, vmem_map, zones_size,
  57.176 --				    0, zholes_size);
  57.177 --
  57.178 --		mem_map = contig_page_data.node_mem_map;
  57.179 --		printk("Virtual mem_map starts at 0x%p\n", mem_map);
  57.180 --	}
  57.181 --#else /* !CONFIG_VIRTUAL_MEM_MAP */
  57.182 --	if (max_low_pfn < max_dma)
  57.183 --		zones_size[ZONE_DMA] = max_low_pfn;
  57.184 --	else {
  57.185 --		zones_size[ZONE_DMA] = max_dma;
  57.186 --		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  57.187 --	}
  57.188 --	free_area_init(zones_size);
  57.189 --#endif /* !CONFIG_VIRTUAL_MEM_MAP */
  57.190 - 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
  57.191 - }
  57.192 -+
  57.193 -+struct pfn_info *frame_table;
  57.194 -+unsigned long frame_table_size;
  57.195 -+unsigned long max_page;
  57.196 -+
  57.197 -+/* FIXME: postpone support to machines with big holes between physical memorys.
  57.198 -+ * Current hack allows only efi memdesc upto 4G place. (See efi.c)
  57.199 -+ */ 
  57.200 -+#ifndef CONFIG_VIRTUAL_MEM_MAP
  57.201 -+#define FT_ALIGN_SIZE	(16UL << 20)
  57.202 -+void __init init_frametable(void)
  57.203 -+{
  57.204 -+	unsigned long i, p;
  57.205 -+	frame_table_size = max_page * sizeof(struct pfn_info);
  57.206 -+	frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
  57.207 -+
  57.208 -+	/* Request continuous trunk from boot allocator, since HV
  57.209 -+	 * address is identity mapped */
  57.210 -+	p = alloc_boot_pages(frame_table_size>>PAGE_SHIFT, FT_ALIGN_SIZE>>PAGE_SHIFT) << PAGE_SHIFT;
  57.211 -+	if (p == 0)
  57.212 -+		panic("Not enough memory for frame table.\n");
  57.213 -+
  57.214 -+	frame_table = __va(p);
  57.215 -+	memset(frame_table, 0, frame_table_size);
  57.216 -+	printk("size of frame_table: %lukB\n",
  57.217 -+		frame_table_size >> 10);
  57.218 -+}
  57.219 -+#endif
    58.1 --- a/xen/arch/ia64/patch/linux-2.6.7/mmzone.h	Fri Aug 26 11:02:14 2005 +0000
    58.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.3 @@ -1,14 +0,0 @@
    58.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/mmzone.h	2004-06-15 23:19:36.000000000 -0600
    58.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/mmzone.h	2004-08-25 19:28:13.000000000 -0600
    58.6 -@@ -185,7 +185,11 @@
    58.7 - 	char			*name;
    58.8 - 	unsigned long		spanned_pages;	/* total size, including holes */
    58.9 - 	unsigned long		present_pages;	/* amount of memory (excluding holes) */
   58.10 -+#ifdef XEN
   58.11 -+};
   58.12 -+#else
   58.13 - } ____cacheline_maxaligned_in_smp;
   58.14 -+#endif
   58.15 - 
   58.16 - 
   58.17 - /*
    59.1 --- a/xen/arch/ia64/patch/linux-2.6.7/page.h	Fri Aug 26 11:02:14 2005 +0000
    59.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.3 @@ -1,84 +0,0 @@
    59.4 ---- ../../linux-2.6.7/include/asm-ia64/page.h	2004-06-15 23:18:58.000000000 -0600
    59.5 -+++ include/asm-ia64/page.h	2005-04-01 12:56:37.000000000 -0700
    59.6 -@@ -12,6 +12,9 @@
    59.7 - #include <asm/intrinsics.h>
    59.8 - #include <asm/types.h>
    59.9 - 
   59.10 -+#ifndef __ASSEMBLY__
   59.11 -+#include <asm/flushtlb.h>
   59.12 -+#endif
   59.13 - /*
   59.14 -  * PAGE_SHIFT determines the actual kernel page size.
   59.15 -  */
   59.16 -@@ -84,14 +87,22 @@
   59.17 - #endif
   59.18 - 
   59.19 - #ifndef CONFIG_DISCONTIGMEM
   59.20 -+#ifdef XEN
   59.21 -+#define pfn_valid(pfn)		(0)
   59.22 -+#else
   59.23 - #define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
   59.24 --#define page_to_pfn(page)	((unsigned long) (page - mem_map))
   59.25 --#define pfn_to_page(pfn)	(mem_map + (pfn))
   59.26 -+#endif
   59.27 - #endif /* CONFIG_DISCONTIGMEM */
   59.28 - 
   59.29 --#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   59.30 -+#define page_to_pfn(_page)  ((unsigned long)((_page) - frame_table))
   59.31 -+#define page_to_virt(_page) phys_to_virt(page_to_phys(_page))
   59.32 -+
   59.33 -+#define page_to_phys(_page)	(page_to_pfn(_page) << PAGE_SHIFT)
   59.34 - #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
   59.35 - 
   59.36 -+#define pfn_to_page(_pfn)   	(frame_table + (_pfn))
   59.37 -+#define phys_to_page(kaddr) 	pfn_to_page(((kaddr) >> PAGE_SHIFT))
   59.38 -+
   59.39 - typedef union ia64_va {
   59.40 - 	struct {
   59.41 - 		unsigned long off : 61;		/* intra-region offset */
   59.42 -@@ -107,8 +118,25 @@
   59.43 -  * expressed in this way to ensure they result in a single "dep"
   59.44 -  * instruction.
   59.45 -  */
   59.46 -+#ifdef XEN
   59.47 -+typedef union xen_va {
   59.48 -+	struct {
   59.49 -+		unsigned long off : 60;
   59.50 -+		unsigned long reg : 4;
   59.51 -+	} f;
   59.52 -+	unsigned long l;
   59.53 -+	void *p;
   59.54 -+} xen_va;
   59.55 -+
   59.56 -+// xen/drivers/console.c uses __va in a declaration (should be fixed!)
   59.57 -+#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   59.58 -+#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   59.59 -+//# define __pa(x)	((unsigned long)(((unsigned long)x) - PAGE_OFFSET))
   59.60 -+//# define __va(x)	((void *)((char *)(x) + PAGE_OFFSET))
   59.61 -+#else
   59.62 - #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   59.63 - #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   59.64 -+#endif
   59.65 - 
   59.66 - #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
   59.67 - #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
   59.68 -@@ -180,11 +208,19 @@
   59.69 - # define __pgprot(x)	(x)
   59.70 - #endif /* !STRICT_MM_TYPECHECKS */
   59.71 - 
   59.72 -+#ifdef XEN
   59.73 -+#define PAGE_OFFSET			0xf000000000000000
   59.74 -+#else
   59.75 - #define PAGE_OFFSET			0xe000000000000000
   59.76 -+#endif
   59.77 - 
   59.78 - #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
   59.79 - 					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
   59.80 - 					 (((current->thread.flags & IA64_THREAD_XSTACK) != 0)	\
   59.81 - 					  ? VM_EXEC : 0))
   59.82 - 
   59.83 -+#ifdef XEN
   59.84 -+#define __flush_tlb()	do {} while(0);
   59.85 -+#endif
   59.86 -+
   59.87 - #endif /* _ASM_IA64_PAGE_H */
    60.1 --- a/xen/arch/ia64/patch/linux-2.6.7/page_alloc.c	Fri Aug 26 11:02:14 2005 +0000
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,305 +0,0 @@
    60.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/mm/page_alloc.c	2004-06-15 23:18:57.000000000 -0600
    60.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/page_alloc.c	2004-12-17 13:47:03.000000000 -0700
    60.6 -@@ -19,20 +19,28 @@
    60.7 - #include <linux/mm.h>
    60.8 - #include <linux/swap.h>
    60.9 - #include <linux/interrupt.h>
   60.10 -+#ifndef XEN
   60.11 - #include <linux/pagemap.h>
   60.12 -+#endif
   60.13 - #include <linux/bootmem.h>
   60.14 - #include <linux/compiler.h>
   60.15 - #include <linux/module.h>
   60.16 -+#ifndef XEN
   60.17 - #include <linux/suspend.h>
   60.18 - #include <linux/pagevec.h>
   60.19 - #include <linux/blkdev.h>
   60.20 -+#endif
   60.21 - #include <linux/slab.h>
   60.22 -+#ifndef XEN
   60.23 - #include <linux/notifier.h>
   60.24 -+#endif
   60.25 - #include <linux/topology.h>
   60.26 -+#ifndef XEN
   60.27 - #include <linux/sysctl.h>
   60.28 - #include <linux/cpu.h>
   60.29 - 
   60.30 - #include <asm/tlbflush.h>
   60.31 -+#endif
   60.32 - 
   60.33 - DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
   60.34 - struct pglist_data *pgdat_list;
   60.35 -@@ -71,6 +79,9 @@
   60.36 - 
   60.37 - static void bad_page(const char *function, struct page *page)
   60.38 - {
   60.39 -+#ifdef XEN
   60.40 -+printk("bad_page: called but disabled\n");
   60.41 -+#else
   60.42 - 	printk(KERN_EMERG "Bad page state at %s (in process '%s', page %p)\n",
   60.43 - 		function, current->comm, page);
   60.44 - 	printk(KERN_EMERG "flags:0x%08lx mapping:%p mapcount:%d count:%d\n",
   60.45 -@@ -91,6 +102,7 @@
   60.46 - 	set_page_count(page, 0);
   60.47 - 	page->mapping = NULL;
   60.48 - 	page->mapcount = 0;
   60.49 -+#endif
   60.50 - }
   60.51 - 
   60.52 - #ifndef CONFIG_HUGETLB_PAGE
   60.53 -@@ -218,6 +230,7 @@
   60.54 - 
   60.55 - static inline void free_pages_check(const char *function, struct page *page)
   60.56 - {
   60.57 -+#ifndef XEN
   60.58 - 	if (	page_mapped(page) ||
   60.59 - 		page->mapping != NULL ||
   60.60 - 		page_count(page) != 0 ||
   60.61 -@@ -233,6 +246,7 @@
   60.62 - 			1 << PG_swapcache |
   60.63 - 			1 << PG_writeback )))
   60.64 - 		bad_page(function, page);
   60.65 -+#endif
   60.66 - 	if (PageDirty(page))
   60.67 - 		ClearPageDirty(page);
   60.68 - }
   60.69 -@@ -276,6 +290,9 @@
   60.70 - 
   60.71 - void __free_pages_ok(struct page *page, unsigned int order)
   60.72 - {
   60.73 -+#ifdef XEN
   60.74 -+printk("__free_pages_ok: called but disabled\n");
   60.75 -+#else
   60.76 - 	LIST_HEAD(list);
   60.77 - 	int i;
   60.78 - 
   60.79 -@@ -285,6 +302,7 @@
   60.80 - 	list_add(&page->lru, &list);
   60.81 - 	kernel_map_pages(page, 1<<order, 0);
   60.82 - 	free_pages_bulk(page_zone(page), 1, &list, order);
   60.83 -+#endif
   60.84 - }
   60.85 - 
   60.86 - #define MARK_USED(index, order, area) \
   60.87 -@@ -330,6 +348,7 @@
   60.88 -  */
   60.89 - static void prep_new_page(struct page *page, int order)
   60.90 - {
   60.91 -+#ifndef XEN
   60.92 - 	if (page->mapping || page_mapped(page) ||
   60.93 - 	    (page->flags & (
   60.94 - 			1 << PG_private	|
   60.95 -@@ -343,11 +362,14 @@
   60.96 - 			1 << PG_swapcache |
   60.97 - 			1 << PG_writeback )))
   60.98 - 		bad_page(__FUNCTION__, page);
   60.99 -+#endif
  60.100 - 
  60.101 - 	page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
  60.102 - 			1 << PG_referenced | 1 << PG_arch_1 |
  60.103 - 			1 << PG_checked | 1 << PG_mappedtodisk);
  60.104 -+#ifndef XEN
  60.105 - 	page->private = 0;
  60.106 -+#endif
  60.107 - 	set_page_refs(page, order);
  60.108 - }
  60.109 - 
  60.110 -@@ -590,13 +612,17 @@
  60.111 - 	unsigned long min;
  60.112 - 	struct zone **zones;
  60.113 - 	struct page *page;
  60.114 -+#ifndef XEN
  60.115 - 	struct reclaim_state reclaim_state;
  60.116 -+#endif
  60.117 - 	struct task_struct *p = current;
  60.118 - 	int i;
  60.119 - 	int alloc_type;
  60.120 - 	int do_retry;
  60.121 - 
  60.122 -+#ifndef XEN
  60.123 - 	might_sleep_if(wait);
  60.124 -+#endif
  60.125 - 
  60.126 - 	zones = zonelist->zones;  /* the list of zones suitable for gfp_mask */
  60.127 - 	if (zones[0] == NULL)     /* no zones in the zonelist */
  60.128 -@@ -610,12 +636,14 @@
  60.129 - 
  60.130 - 		min = (1<<order) + z->protection[alloc_type];
  60.131 - 
  60.132 -+#ifndef XEN
  60.133 - 		/*
  60.134 - 		 * We let real-time tasks dip their real-time paws a little
  60.135 - 		 * deeper into reserves.
  60.136 - 		 */
  60.137 - 		if (rt_task(p))
  60.138 - 			min -= z->pages_low >> 1;
  60.139 -+#endif
  60.140 - 
  60.141 - 		if (z->free_pages >= min ||
  60.142 - 				(!wait && z->free_pages >= z->pages_high)) {
  60.143 -@@ -627,9 +655,11 @@
  60.144 - 		}
  60.145 - 	}
  60.146 - 
  60.147 -+#ifndef XEN
  60.148 - 	/* we're somewhat low on memory, failed to find what we needed */
  60.149 - 	for (i = 0; zones[i] != NULL; i++)
  60.150 - 		wakeup_kswapd(zones[i]);
  60.151 -+#endif
  60.152 - 
  60.153 - 	/* Go through the zonelist again, taking __GFP_HIGH into account */
  60.154 - 	for (i = 0; zones[i] != NULL; i++) {
  60.155 -@@ -639,8 +669,10 @@
  60.156 - 
  60.157 - 		if (gfp_mask & __GFP_HIGH)
  60.158 - 			min -= z->pages_low >> 2;
  60.159 -+#ifndef XEN
  60.160 - 		if (rt_task(p))
  60.161 - 			min -= z->pages_low >> 1;
  60.162 -+#endif
  60.163 - 
  60.164 - 		if (z->free_pages >= min ||
  60.165 - 				(!wait && z->free_pages >= z->pages_high)) {
  60.166 -@@ -654,6 +686,7 @@
  60.167 - 
  60.168 - 	/* here we're in the low on memory slow path */
  60.169 - 
  60.170 -+#ifndef XEN
  60.171 - rebalance:
  60.172 - 	if ((p->flags & (PF_MEMALLOC | PF_MEMDIE)) && !in_interrupt()) {
  60.173 - 		/* go through the zonelist yet again, ignoring mins */
  60.174 -@@ -681,6 +714,7 @@
  60.175 - 
  60.176 - 	p->reclaim_state = NULL;
  60.177 - 	p->flags &= ~PF_MEMALLOC;
  60.178 -+#endif
  60.179 - 
  60.180 - 	/* go through the zonelist yet one more time */
  60.181 - 	for (i = 0; zones[i] != NULL; i++) {
  60.182 -@@ -698,6 +732,11 @@
  60.183 - 		}
  60.184 - 	}
  60.185 - 
  60.186 -+#ifdef XEN
  60.187 -+printk(KERN_WARNING "%s: page allocation failure."
  60.188 -+			" order:%d, mode:0x%x\n",
  60.189 -+			"(xen tasks have no comm)", order, gfp_mask);
  60.190 -+#else
  60.191 - 	/*
  60.192 - 	 * Don't let big-order allocations loop unless the caller explicitly
  60.193 - 	 * requests that.  Wait for some write requests to complete then retry.
  60.194 -@@ -724,6 +763,7 @@
  60.195 - 			p->comm, order, gfp_mask);
  60.196 - 		dump_stack();
  60.197 - 	}
  60.198 -+#endif
  60.199 - 	return NULL;
  60.200 - got_pg:
  60.201 - 	kernel_map_pages(page, 1 << order, 1);
  60.202 -@@ -808,6 +848,7 @@
  60.203 - 
  60.204 - EXPORT_SYMBOL(get_zeroed_page);
  60.205 - 
  60.206 -+#ifndef XEN
  60.207 - void __pagevec_free(struct pagevec *pvec)
  60.208 - {
  60.209 - 	int i = pagevec_count(pvec);
  60.210 -@@ -815,10 +856,15 @@
  60.211 - 	while (--i >= 0)
  60.212 - 		free_hot_cold_page(pvec->pages[i], pvec->cold);
  60.213 - }
  60.214 -+#endif
  60.215 - 
  60.216 - fastcall void __free_pages(struct page *page, unsigned int order)
  60.217 - {
  60.218 -+#ifdef XEN
  60.219 -+	if (!PageReserved(page)) {
  60.220 -+#else
  60.221 - 	if (!PageReserved(page) && put_page_testzero(page)) {
  60.222 -+#endif
  60.223 - 		if (order == 0)
  60.224 - 			free_hot_page(page);
  60.225 - 		else
  60.226 -@@ -914,6 +960,13 @@
  60.227 - 	return nr_free_zone_pages(GFP_HIGHUSER & GFP_ZONEMASK);
  60.228 - }
  60.229 - 
  60.230 -+#ifdef XEN
  60.231 -+unsigned int nr_free_highpages (void)
  60.232 -+{
  60.233 -+printf("nr_free_highpages: called but not implemented\n");
  60.234 -+}
  60.235 -+#endif
  60.236 -+
  60.237 - #ifdef CONFIG_HIGHMEM
  60.238 - unsigned int nr_free_highpages (void)
  60.239 - {
  60.240 -@@ -1022,6 +1075,7 @@
  60.241 - 
  60.242 - void si_meminfo(struct sysinfo *val)
  60.243 - {
  60.244 -+#ifndef XEN
  60.245 - 	val->totalram = totalram_pages;
  60.246 - 	val->sharedram = 0;
  60.247 - 	val->freeram = nr_free_pages();
  60.248 -@@ -1034,6 +1088,7 @@
  60.249 - 	val->freehigh = 0;
  60.250 - #endif
  60.251 - 	val->mem_unit = PAGE_SIZE;
  60.252 -+#endif
  60.253 - }
  60.254 - 
  60.255 - EXPORT_SYMBOL(si_meminfo);
  60.256 -@@ -1165,7 +1220,9 @@
  60.257 - 		printk("= %lukB\n", K(total));
  60.258 - 	}
  60.259 - 
  60.260 -+#ifndef XEN
  60.261 - 	show_swap_cache_info();
  60.262 -+#endif
  60.263 - }
  60.264 - 
  60.265 - /*
  60.266 -@@ -1530,6 +1587,9 @@
  60.267 - 		zone->wait_table_size = wait_table_size(size);
  60.268 - 		zone->wait_table_bits =
  60.269 - 			wait_table_bits(zone->wait_table_size);
  60.270 -+#ifdef XEN
  60.271 -+//printf("free_area_init_core-1: calling alloc_bootmem_node(%lx,%lx)\n",pgdat,zone->wait_table_size * sizeof(wait_queue_head_t));
  60.272 -+#endif
  60.273 - 		zone->wait_table = (wait_queue_head_t *)
  60.274 - 			alloc_bootmem_node(pgdat, zone->wait_table_size
  60.275 - 						* sizeof(wait_queue_head_t));
  60.276 -@@ -1584,6 +1644,9 @@
  60.277 - 			 */
  60.278 - 			bitmap_size = (size-1) >> (i+4);
  60.279 - 			bitmap_size = LONG_ALIGN(bitmap_size+1);
  60.280 -+#ifdef XEN
  60.281 -+//printf("free_area_init_core-2: calling alloc_bootmem_node(%lx,%lx)\n",pgdat, bitmap_size);
  60.282 -+#endif
  60.283 - 			zone->free_area[i].map = 
  60.284 - 			  (unsigned long *) alloc_bootmem_node(pgdat, bitmap_size);
  60.285 - 		}
  60.286 -@@ -1601,6 +1664,9 @@
  60.287 - 	calculate_zone_totalpages(pgdat, zones_size, zholes_size);
  60.288 - 	if (!node_mem_map) {
  60.289 - 		size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
  60.290 -+#ifdef XEN
  60.291 -+//printf("free_area_init_node: calling alloc_bootmem_node(%lx,%lx)\n",pgdat,size);
  60.292 -+#endif
  60.293 - 		node_mem_map = alloc_bootmem_node(pgdat, size);
  60.294 - 	}
  60.295 - 	pgdat->node_mem_map = node_mem_map;
  60.296 -@@ -1784,6 +1850,7 @@
  60.297 - 
  60.298 - #endif /* CONFIG_PROC_FS */
  60.299 - 
  60.300 -+#ifndef XEN
  60.301 - #ifdef CONFIG_HOTPLUG_CPU
  60.302 - static int page_alloc_cpu_notify(struct notifier_block *self,
  60.303 - 				 unsigned long action, void *hcpu)
  60.304 -@@ -2011,3 +2078,4 @@
  60.305 - 	setup_per_zone_protection();
  60.306 - 	return 0;
  60.307 - }
  60.308 -+#endif
    61.1 --- a/xen/arch/ia64/patch/linux-2.6.7/pal.S	Fri Aug 26 11:02:14 2005 +0000
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,26 +0,0 @@
    61.4 ---- ../../linux-2.6.7/arch/ia64/kernel/pal.S	2004-06-15 23:20:25.000000000 -0600
    61.5 -+++ arch/ia64/pal.S	2005-04-01 12:56:01.000000000 -0700
    61.6 -@@ -163,7 +163,11 @@
    61.7 - 	adds r8  = 1f-1b,r8		// calculate return address for call
    61.8 - 	;;
    61.9 - 	mov loc4=ar.rsc			// save RSE configuration
   61.10 -+#ifdef XEN
   61.11 -+	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   61.12 -+#else // XEN
   61.13 - 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   61.14 -+#endif // XEN
   61.15 - 	tpa r8=r8			// convert rp to physical
   61.16 - 	;;
   61.17 - 	mov b7 = loc2			// install target to branch reg
   61.18 -@@ -218,7 +222,11 @@
   61.19 - 	mov loc3 = psr		// save psr
   61.20 - 	;;
   61.21 - 	mov loc4=ar.rsc			// save RSE configuration
   61.22 -+#ifdef XEN
   61.23 -+	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   61.24 -+#else // XEN
   61.25 - 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   61.26 -+#endif // XEN
   61.27 - 	;;
   61.28 - 	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
   61.29 - 	movl r16=PAL_PSR_BITS_TO_CLEAR
    62.1 --- a/xen/arch/ia64/patch/linux-2.6.7/pgalloc.h	Fri Aug 26 11:02:14 2005 +0000
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,65 +0,0 @@
    62.4 ---- ../../linux-2.6.7/include/asm-ia64/pgalloc.h	2004-06-15 23:18:54.000000000 -0600
    62.5 -+++ include/asm-ia64/pgalloc.h	2005-03-23 14:54:11.000000000 -0700
    62.6 -@@ -34,6 +34,10 @@
    62.7 - #define pmd_quicklist		(local_cpu_data->pmd_quick)
    62.8 - #define pgtable_cache_size	(local_cpu_data->pgtable_cache_sz)
    62.9 - 
   62.10 -+/* FIXME: Later 3 level page table should be over, to create 
   62.11 -+ * new interface upon xen memory allocator. To simplify first
   62.12 -+ * effort moving to xen allocator, use xenheap pages temporarily. 
   62.13 -+ */
   62.14 - static inline pgd_t*
   62.15 - pgd_alloc_one_fast (struct mm_struct *mm)
   62.16 - {
   62.17 -@@ -55,7 +59,7 @@
   62.18 - 	pgd_t *pgd = pgd_alloc_one_fast(mm);
   62.19 - 
   62.20 - 	if (unlikely(pgd == NULL)) {
   62.21 --		pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
   62.22 -+		pgd = (pgd_t *)alloc_xenheap_page();
   62.23 - 		if (likely(pgd != NULL))
   62.24 - 			clear_page(pgd);
   62.25 - 	}
   62.26 -@@ -93,7 +97,7 @@
   62.27 - static inline pmd_t*
   62.28 - pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
   62.29 - {
   62.30 --	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
   62.31 -+	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
   62.32 - 
   62.33 - 	if (likely(pmd != NULL))
   62.34 - 		clear_page(pmd);
   62.35 -@@ -125,7 +129,7 @@
   62.36 - static inline struct page *
   62.37 - pte_alloc_one (struct mm_struct *mm, unsigned long addr)
   62.38 - {
   62.39 --	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0);
   62.40 -+	struct page *pte = alloc_xenheap_page();
   62.41 - 
   62.42 - 	if (likely(pte != NULL))
   62.43 - 		clear_page(page_address(pte));
   62.44 -@@ -135,7 +139,7 @@
   62.45 - static inline pte_t *
   62.46 - pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
   62.47 - {
   62.48 --	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
   62.49 -+	pte_t *pte = (pte_t *)alloc_xenheap_page();
   62.50 - 
   62.51 - 	if (likely(pte != NULL))
   62.52 - 		clear_page(pte);
   62.53 -@@ -145,13 +149,13 @@
   62.54 - static inline void
   62.55 - pte_free (struct page *pte)
   62.56 - {
   62.57 --	__free_page(pte);
   62.58 -+	free_xenheap_page(pte);
   62.59 - }
   62.60 - 
   62.61 - static inline void
   62.62 - pte_free_kernel (pte_t *pte)
   62.63 - {
   62.64 --	free_page((unsigned long) pte);
   62.65 -+	free_xenheap_page((unsigned long) pte);
   62.66 - }
   62.67 - 
   62.68 - #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
    63.1 --- a/xen/arch/ia64/patch/linux-2.6.7/processor.h	Fri Aug 26 11:02:14 2005 +0000
    63.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.3 @@ -1,19 +0,0 @@
    63.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/processor.h	2005-01-23 13:23:36.000000000 -0700
    63.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/processor.h	2004-08-25 19:28:13.000000000 -0600
    63.6 -@@ -406,12 +406,16 @@
    63.7 -  */
    63.8 - 
    63.9 - /* Return TRUE if task T owns the fph partition of the CPU we're running on. */
   63.10 -+#ifdef XEN
   63.11 -+#define ia64_is_local_fpu_owner(t) 0
   63.12 -+#else
   63.13 - #define ia64_is_local_fpu_owner(t)								\
   63.14 - ({												\
   63.15 - 	struct task_struct *__ia64_islfo_task = (t);						\
   63.16 - 	(__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id()				\
   63.17 - 	 && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER));	\
   63.18 - })
   63.19 -+#endif
   63.20 - 
   63.21 - /* Mark task T as owning the fph partition of the CPU we're running on. */
   63.22 - #define ia64_set_local_fpu_owner(t) do {						\
    64.1 --- a/xen/arch/ia64/patch/linux-2.6.7/sal.h	Fri Aug 26 11:02:14 2005 +0000
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,26 +0,0 @@
    64.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/sal.h	2004-06-15 23:20:04.000000000 -0600
    64.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/sal.h	2004-10-27 13:55:23.000000000 -0600
    64.6 -@@ -646,7 +646,23 @@
    64.7 - {
    64.8 - 	struct ia64_sal_retval isrv;
    64.9 - 
   64.10 -+//#ifdef XEN
   64.11 -+#if 0
   64.12 -+	unsigned long *x = (unsigned long *)ia64_sal;
   64.13 -+	unsigned long *inst = (unsigned long *)*x;
   64.14 -+	unsigned long __ia64_sc_flags;
   64.15 -+	struct ia64_fpreg __ia64_sc_fr[6];
   64.16 -+printf("ia64_sal_freq_base: about to save_scratch_fpregs\n");
   64.17 -+	ia64_save_scratch_fpregs(__ia64_sc_fr);
   64.18 -+	spin_lock_irqsave(&sal_lock, __ia64_sc_flags);
   64.19 -+printf("ia64_sal_freq_base: about to call, ia64_sal=%p, ia64_sal[0]=%p, ia64_sal[1]=%p\n",x,x[0],x[1]);
   64.20 -+printf("first inst=%p,%p\n",inst[0],inst[1]);
   64.21 -+	isrv = (*ia64_sal)(SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   64.22 -+	spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags);
   64.23 -+	ia64_load_scratch_fpregs(__ia64_sc_fr);
   64.24 -+#else
   64.25 - 	SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   64.26 -+#endif
   64.27 - 	*ticks_per_second = isrv.v0;
   64.28 - 	*drift_info = isrv.v1;
   64.29 - 	return isrv.status;
    65.1 --- a/xen/arch/ia64/patch/linux-2.6.7/setup.c	Fri Aug 26 11:02:14 2005 +0000
    65.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.3 @@ -1,203 +0,0 @@
    65.4 ---- ../../linux-2.6.7/arch/ia64/kernel/setup.c	2004-06-15 23:18:58.000000000 -0600
    65.5 -+++ arch/ia64/setup.c	2005-04-04 22:31:09.000000000 -0600
    65.6 -@@ -21,6 +21,9 @@
    65.7 - #include <linux/init.h>
    65.8 - 
    65.9 - #include <linux/acpi.h>
   65.10 -+#ifdef XEN
   65.11 -+#include <xen/sched.h>
   65.12 -+#endif
   65.13 - #include <linux/bootmem.h>
   65.14 - #include <linux/console.h>
   65.15 - #include <linux/delay.h>
   65.16 -@@ -30,13 +33,17 @@
   65.17 - #include <linux/seq_file.h>
   65.18 - #include <linux/string.h>
   65.19 - #include <linux/threads.h>
   65.20 -+#ifndef XEN
   65.21 - #include <linux/tty.h>
   65.22 - #include <linux/serial.h>
   65.23 - #include <linux/serial_core.h>
   65.24 -+#endif
   65.25 - #include <linux/efi.h>
   65.26 - #include <linux/initrd.h>
   65.27 - 
   65.28 -+#ifndef XEN
   65.29 - #include <asm/ia32.h>
   65.30 -+#endif
   65.31 - #include <asm/machvec.h>
   65.32 - #include <asm/mca.h>
   65.33 - #include <asm/meminit.h>
   65.34 -@@ -50,6 +57,11 @@
   65.35 - #include <asm/smp.h>
   65.36 - #include <asm/system.h>
   65.37 - #include <asm/unistd.h>
   65.38 -+#ifdef XEN
   65.39 -+#include <linux/mm.h>
   65.40 -+#include <asm/mmu_context.h>
   65.41 -+extern unsigned long loops_per_jiffy;	// from linux/init/main.c
   65.42 -+#endif
   65.43 - 
   65.44 - #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
   65.45 - # error "struct cpuinfo_ia64 too big!"
   65.46 -@@ -65,7 +77,9 @@
   65.47 - DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
   65.48 - unsigned long ia64_cycles_per_usec;
   65.49 - struct ia64_boot_param *ia64_boot_param;
   65.50 -+#ifndef XEN
   65.51 - struct screen_info screen_info;
   65.52 -+#endif
   65.53 - 
   65.54 - unsigned long ia64_max_cacheline_size;
   65.55 - unsigned long ia64_iobase;	/* virtual address for I/O accesses */
   65.56 -@@ -98,7 +112,6 @@
   65.57 - struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
   65.58 - int num_rsvd_regions;
   65.59 - 
   65.60 --
   65.61 - /*
   65.62 -  * Filter incoming memory segments based on the primitive map created from the boot
   65.63 -  * parameters. Segments contained in the map are removed from the memory ranges. A
   65.64 -@@ -128,9 +141,12 @@
   65.65 - 	for (i = 0; i < num_rsvd_regions; ++i) {
   65.66 - 		range_start = max(start, prev_start);
   65.67 - 		range_end   = min(end, rsvd_region[i].start);
   65.68 --
   65.69 --		if (range_start < range_end)
   65.70 --			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   65.71 -+		/* init_boot_pages requires "ps, pe" */
   65.72 -+		if (range_start < range_end) {
   65.73 -+			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
   65.74 -+				__pa(range_start), __pa(range_end));
   65.75 -+			(*func)(__pa(range_start), __pa(range_end), 0);
   65.76 -+		}
   65.77 - 
   65.78 - 		/* nothing more available in this segment */
   65.79 - 		if (range_end == end) return 0;
   65.80 -@@ -187,17 +203,17 @@
   65.81 - 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
   65.82 - 	n++;
   65.83 - 
   65.84 -+	/* Reserve xen image/bitmap/xen-heap */
   65.85 - 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   65.86 --	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   65.87 -+	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   65.88 - 	n++;
   65.89 - 
   65.90 --#ifdef CONFIG_BLK_DEV_INITRD
   65.91 -+	/* This is actually dom0 image */
   65.92 - 	if (ia64_boot_param->initrd_start) {
   65.93 - 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
   65.94 - 		rsvd_region[n].end   = rsvd_region[n].start + ia64_boot_param->initrd_size;
   65.95 - 		n++;
   65.96 - 	}
   65.97 --#endif
   65.98 - 
   65.99 - 	/* end of memory marker */
  65.100 - 	rsvd_region[n].start = ~0UL;
  65.101 -@@ -207,6 +223,16 @@
  65.102 - 	num_rsvd_regions = n;
  65.103 - 
  65.104 - 	sort_regions(rsvd_region, num_rsvd_regions);
  65.105 -+
  65.106 -+	{
  65.107 -+		int i;
  65.108 -+		printk("Reserved regions: \n");
  65.109 -+		for (i = 0; i < num_rsvd_regions; i++)
  65.110 -+			printk("  [%d] -> [0x%lx, 0x%lx]\n",
  65.111 -+				i,
  65.112 -+				rsvd_region[i].start,
  65.113 -+				rsvd_region[i].end);
  65.114 -+	}
  65.115 - }
  65.116 - 
  65.117 - /**
  65.118 -@@ -280,23 +306,26 @@
  65.119 - }
  65.120 - #endif
  65.121 - 
  65.122 -+#ifdef XEN
  65.123 - void __init
  65.124 --setup_arch (char **cmdline_p)
  65.125 -+early_setup_arch(char **cmdline_p)
  65.126 - {
  65.127 - 	unw_init();
  65.128 --
  65.129 --	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
  65.130 --
  65.131 -+	
  65.132 - 	*cmdline_p = __va(ia64_boot_param->command_line);
  65.133 - 	strlcpy(saved_command_line, *cmdline_p, sizeof(saved_command_line));
  65.134 --
  65.135 -+	cmdline_parse(*cmdline_p);
  65.136 -+	
  65.137 - 	efi_init();
  65.138 --	io_port_init();
  65.139 --
  65.140 -+	
  65.141 - #ifdef CONFIG_IA64_GENERIC
  65.142 - 	machvec_init(acpi_get_sysname());
  65.143 - #endif
  65.144 - 
  65.145 -+#ifdef XEN
  65.146 -+#undef CONFIG_ACPI_BOOT
  65.147 -+#endif
  65.148 -+
  65.149 - #ifdef CONFIG_ACPI_BOOT
  65.150 - 	/* Initialize the ACPI boot-time table parser */
  65.151 - 	acpi_table_init();
  65.152 -@@ -308,9 +337,13 @@
  65.153 - 	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
  65.154 - # endif
  65.155 - #endif /* CONFIG_APCI_BOOT */
  65.156 -+	io_port_init();
  65.157 -+}
  65.158 -+#endif
  65.159 - 
  65.160 --	find_memory();
  65.161 --
  65.162 -+void __init
  65.163 -+setup_arch (void)
  65.164 -+{
  65.165 - 	/* process SAL system table: */
  65.166 - 	ia64_sal_init(efi.sal_systab);
  65.167 - 
  65.168 -@@ -353,7 +386,6 @@
  65.169 - 	/* enable IA-64 Machine Check Abort Handling */
  65.170 - 	ia64_mca_init();
  65.171 - 
  65.172 --	platform_setup(cmdline_p);
  65.173 - 	paging_init();
  65.174 - }
  65.175 - 
  65.176 -@@ -413,6 +445,9 @@
  65.177 - 		sprintf(cp, " 0x%lx", mask);
  65.178 - 	}
  65.179 - 
  65.180 -+#ifdef XEN
  65.181 -+#define seq_printf(a,b...) printf(b)
  65.182 -+#endif
  65.183 - 	seq_printf(m,
  65.184 - 		   "processor  : %d\n"
  65.185 - 		   "vendor     : %s\n"
  65.186 -@@ -616,7 +651,11 @@
  65.187 - 					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
  65.188 - 	atomic_inc(&init_mm.mm_count);
  65.189 - 	current->active_mm = &init_mm;
  65.190 -+#ifdef XEN
  65.191 -+	if (current->domain->arch.mm)
  65.192 -+#else
  65.193 - 	if (current->mm)
  65.194 -+#endif
  65.195 - 		BUG();
  65.196 - 
  65.197 - 	ia64_mmu_init(ia64_imva(cpu_data));
  65.198 -@@ -667,6 +706,8 @@
  65.199 - void
  65.200 - check_bugs (void)
  65.201 - {
  65.202 -+#ifndef XEN
  65.203 - 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
  65.204 - 			       (unsigned long) __end___mckinley_e9_bundles);
  65.205 -+#endif
  65.206 - }
    66.1 --- a/xen/arch/ia64/patch/linux-2.6.7/slab.c	Fri Aug 26 11:02:14 2005 +0000
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,139 +0,0 @@
    66.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/mm/slab.c	2004-06-15 23:19:44.000000000 -0600
    66.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/slab.c	2004-12-17 13:47:03.000000000 -0700
    66.6 -@@ -86,15 +86,30 @@
    66.7 - #include	<linux/init.h>
    66.8 - #include	<linux/compiler.h>
    66.9 - #include	<linux/seq_file.h>
   66.10 -+#ifndef XEN
   66.11 - #include	<linux/notifier.h>
   66.12 - #include	<linux/kallsyms.h>
   66.13 - #include	<linux/cpu.h>
   66.14 - #include	<linux/sysctl.h>
   66.15 - #include	<linux/module.h>
   66.16 -+#endif
   66.17 - 
   66.18 - #include	<asm/uaccess.h>
   66.19 - #include	<asm/cacheflush.h>
   66.20 -+#ifndef XEN
   66.21 - #include	<asm/tlbflush.h>
   66.22 -+#endif
   66.23 -+
   66.24 -+#ifdef XEN
   66.25 -+#define lock_cpu_hotplug()	do { } while (0)
   66.26 -+#define unlock_cpu_hotplug()	do { } while (0)
   66.27 -+#define might_sleep_if(x)	do { } while (0)
   66.28 -+#define	dump_stack()		do { } while (0)
   66.29 -+#define start_cpu_timer(cpu)	do { } while (0)
   66.30 -+static inline void __down(struct semaphore *sem) { }
   66.31 -+static inline void __up(struct semaphore *sem) { }
   66.32 -+static inline void might_sleep(void) { }
   66.33 -+#endif
   66.34 - 
   66.35 - /*
   66.36 -  * DEBUG	- 1 for kmem_cache_create() to honour; SLAB_DEBUG_INITIAL,
   66.37 -@@ -530,7 +545,9 @@
   66.38 - 	FULL
   66.39 - } g_cpucache_up;
   66.40 - 
   66.41 -+#ifndef XEN
   66.42 - static DEFINE_PER_CPU(struct timer_list, reap_timers);
   66.43 -+#endif
   66.44 - 
   66.45 - static void reap_timer_fnc(unsigned long data);
   66.46 - static void free_block(kmem_cache_t* cachep, void** objpp, int len);
   66.47 -@@ -588,6 +605,7 @@
   66.48 -  * Add the CPU number into the expiry time to minimize the possibility of the
   66.49 -  * CPUs getting into lockstep and contending for the global cache chain lock.
   66.50 -  */
   66.51 -+#ifndef XEN
   66.52 - static void __devinit start_cpu_timer(int cpu)
   66.53 - {
   66.54 - 	struct timer_list *rt = &per_cpu(reap_timers, cpu);
   66.55 -@@ -600,6 +618,7 @@
   66.56 - 		add_timer_on(rt, cpu);
   66.57 - 	}
   66.58 - }
   66.59 -+#endif
   66.60 - 
   66.61 - #ifdef CONFIG_HOTPLUG_CPU
   66.62 - static void stop_cpu_timer(int cpu)
   66.63 -@@ -634,6 +653,7 @@
   66.64 - 	return nc;
   66.65 - }
   66.66 - 
   66.67 -+#ifndef XEN
   66.68 - static int __devinit cpuup_callback(struct notifier_block *nfb,
   66.69 - 				  unsigned long action,
   66.70 - 				  void *hcpu)
   66.71 -@@ -693,6 +713,7 @@
   66.72 - }
   66.73 - 
   66.74 - static struct notifier_block cpucache_notifier = { &cpuup_callback, NULL, 0 };
   66.75 -+#endif
   66.76 - 
   66.77 - /* Initialisation.
   66.78 -  * Called after the gfp() functions have been enabled, and before smp_init().
   66.79 -@@ -805,10 +826,14 @@
   66.80 - 	/* Done! */
   66.81 - 	g_cpucache_up = FULL;
   66.82 - 
   66.83 -+#ifdef XEN
   66.84 -+printk("kmem_cache_init: some parts commented out, ignored\n");
   66.85 -+#else
   66.86 - 	/* Register a cpu startup notifier callback
   66.87 - 	 * that initializes ac_data for all new cpus
   66.88 - 	 */
   66.89 - 	register_cpu_notifier(&cpucache_notifier);
   66.90 -+#endif
   66.91 - 	
   66.92 - 
   66.93 - 	/* The reap timers are started later, with a module init call:
   66.94 -@@ -886,8 +911,10 @@
   66.95 - 		page++;
   66.96 - 	}
   66.97 - 	sub_page_state(nr_slab, nr_freed);
   66.98 -+#ifndef XEN
   66.99 - 	if (current->reclaim_state)
  66.100 - 		current->reclaim_state->reclaimed_slab += nr_freed;
  66.101 -+#endif
  66.102 - 	free_pages((unsigned long)addr, cachep->gfporder);
  66.103 - 	if (cachep->flags & SLAB_RECLAIM_ACCOUNT) 
  66.104 - 		atomic_sub(1<<cachep->gfporder, &slab_reclaim_pages);
  66.105 -@@ -1363,8 +1390,10 @@
  66.106 - 					+ cachep->num;
  66.107 - 	} 
  66.108 - 
  66.109 -+#ifndef XEN
  66.110 - 	cachep->lists.next_reap = jiffies + REAPTIMEOUT_LIST3 +
  66.111 - 					((unsigned long)cachep)%REAPTIMEOUT_LIST3;
  66.112 -+#endif
  66.113 - 
  66.114 - 	/* Need the semaphore to access the chain. */
  66.115 - 	down(&cache_chain_sem);
  66.116 -@@ -2237,8 +2266,10 @@
  66.117 - 
  66.118 - 	if (unlikely(addr < min_addr))
  66.119 - 		goto out;
  66.120 -+#ifndef XEN
  66.121 - 	if (unlikely(addr > (unsigned long)high_memory - size))
  66.122 - 		goto out;
  66.123 -+#endif
  66.124 - 	if (unlikely(addr & align_mask))
  66.125 - 		goto out;
  66.126 - 	if (unlikely(!kern_addr_valid(addr)))
  66.127 -@@ -2769,6 +2800,7 @@
  66.128 -  */
  66.129 - static void reap_timer_fnc(unsigned long cpu)
  66.130 - {
  66.131 -+#ifndef XEN
  66.132 - 	struct timer_list *rt = &__get_cpu_var(reap_timers);
  66.133 - 
  66.134 - 	/* CPU hotplug can drag us off cpu: don't run on wrong CPU */
  66.135 -@@ -2776,6 +2808,7 @@
  66.136 - 		cache_reap();
  66.137 - 		mod_timer(rt, jiffies + REAPTIMEOUT_CPUC + cpu);
  66.138 - 	}
  66.139 -+#endif
  66.140 - }
  66.141 - 
  66.142 - #ifdef CONFIG_PROC_FS
    67.1 --- a/xen/arch/ia64/patch/linux-2.6.7/slab.h	Fri Aug 26 11:02:14 2005 +0000
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,14 +0,0 @@
    67.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/slab.h	2004-06-15 23:20:26.000000000 -0600
    67.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/slab.h	2004-08-25 19:28:13.000000000 -0600
    67.6 -@@ -83,7 +83,11 @@
    67.7 - 			goto found; \
    67.8 - 		else \
    67.9 - 			i++;
   67.10 -+#ifdef XEN
   67.11 -+#include <linux/kmalloc_sizes.h>
   67.12 -+#else
   67.13 - #include "kmalloc_sizes.h"
   67.14 -+#endif
   67.15 - #undef CACHE
   67.16 - 		{
   67.17 - 			extern void __you_cannot_kmalloc_that_much(void);
    68.1 --- a/xen/arch/ia64/patch/linux-2.6.7/swiotlb.c	Fri Aug 26 11:02:14 2005 +0000
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,47 +0,0 @@
    68.4 ---- ../../linux-2.6.7/arch/ia64/lib/swiotlb.c	2004-06-15 23:19:43.000000000 -0600
    68.5 -+++ arch/ia64/lib/swiotlb.c	2005-03-23 14:54:05.000000000 -0700
    68.6 -@@ -100,7 +100,11 @@
    68.7 - 	/*
    68.8 - 	 * Get IO TLB memory from the low pages
    68.9 - 	 */
   68.10 --	io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs * (1 << IO_TLB_SHIFT));
   68.11 -+	/* FIXME: Do we really need swiotlb in HV? If all memory trunks
   68.12 -+	 * presented to guest as <4G, are actually <4G in machine range,
   68.13 -+	 * no DMA intevention from HV...
   68.14 -+	 */
   68.15 -+	io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)));
   68.16 - 	if (!io_tlb_start)
   68.17 - 		BUG();
   68.18 - 	io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
   68.19 -@@ -110,11 +114,11 @@
   68.20 - 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
   68.21 - 	 * between io_tlb_start and io_tlb_end.
   68.22 - 	 */
   68.23 --	io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
   68.24 -+	io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int)));
   68.25 - 	for (i = 0; i < io_tlb_nslabs; i++)
   68.26 -  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
   68.27 - 	io_tlb_index = 0;
   68.28 --	io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
   68.29 -+	io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *)));
   68.30 - 
   68.31 - 	printk(KERN_INFO "Placing software IO TLB between 0x%p - 0x%p\n",
   68.32 - 	       (void *) io_tlb_start, (void *) io_tlb_end);
   68.33 -@@ -279,7 +283,7 @@
   68.34 - 	/* XXX fix me: the DMA API should pass us an explicit DMA mask instead: */
   68.35 - 	flags |= GFP_DMA;
   68.36 - 
   68.37 --	ret = (void *)__get_free_pages(flags, get_order(size));
   68.38 -+	ret = (void *)alloc_xenheap_pages(get_order(size));
   68.39 - 	if (!ret)
   68.40 - 		return NULL;
   68.41 - 
   68.42 -@@ -294,7 +298,7 @@
   68.43 - void
   68.44 - swiotlb_free_coherent (struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
   68.45 - {
   68.46 --	free_pages((unsigned long) vaddr, get_order(size));
   68.47 -+	free_xenheap_pages((unsigned long) vaddr, get_order(size));
   68.48 - }
   68.49 - 
   68.50 - /*
    69.1 --- a/xen/arch/ia64/patch/linux-2.6.7/system.h	Fri Aug 26 11:02:14 2005 +0000
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,43 +0,0 @@
    69.4 ---- ../../linux-2.6.7/include/asm-ia64/system.h	2005-03-24 19:39:56.000000000 -0700
    69.5 -+++ include/asm-ia64/system.h	2005-04-01 12:56:37.000000000 -0700
    69.6 -@@ -24,8 +24,16 @@
    69.7 -  * 0xa000000000000000+2*PERCPU_PAGE_SIZE
    69.8 -  * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
    69.9 -  */
   69.10 -+#ifdef XEN
   69.11 -+//#define KERNEL_START		 0xf000000100000000
   69.12 -+#define KERNEL_START		 0xf000000004000000
   69.13 -+#define PERCPU_ADDR		 0xf100000000000000-PERCPU_PAGE_SIZE
   69.14 -+#define SHAREDINFO_ADDR		 0xf100000000000000
   69.15 -+#define VHPT_ADDR		 0xf200000000000000
   69.16 -+#else
   69.17 - #define KERNEL_START		 0xa000000100000000
   69.18 - #define PERCPU_ADDR		(-PERCPU_PAGE_SIZE)
   69.19 -+#endif
   69.20 - 
   69.21 - #ifndef __ASSEMBLY__
   69.22 - 
   69.23 -@@ -218,9 +226,13 @@
   69.24 - # define PERFMON_IS_SYSWIDE() (0)
   69.25 - #endif
   69.26 - 
   69.27 -+#ifdef XEN
   69.28 -+#define IA64_HAS_EXTRA_STATE(t) 0
   69.29 -+#else
   69.30 - #define IA64_HAS_EXTRA_STATE(t)							\
   69.31 - 	((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)	\
   69.32 - 	 || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE())
   69.33 -+#endif
   69.34 - 
   69.35 - #define __switch_to(prev,next,last) do {							 \
   69.36 - 	if (IA64_HAS_EXTRA_STATE(prev))								 \
   69.37 -@@ -249,6 +261,9 @@
   69.38 - #else
   69.39 - # define switch_to(prev,next,last)	__switch_to(prev, next, last)
   69.40 - #endif
   69.41 -+//#ifdef XEN
   69.42 -+//#undef switch_to
   69.43 -+//#endif
   69.44 - 
   69.45 - /*
   69.46 -  * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
    70.1 --- a/xen/arch/ia64/patch/linux-2.6.7/time.c	Fri Aug 26 11:02:14 2005 +0000
    70.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.3 @@ -1,338 +0,0 @@
    70.4 ---- ../../linux-2.6.7/arch/ia64/kernel/time.c	2004-06-15 23:19:01.000000000 -0600
    70.5 -+++ arch/ia64/time.c	2005-03-14 17:27:11.000000000 -0700
    70.6 -@@ -10,16 +10,22 @@
    70.7 -  */
    70.8 - #include <linux/config.h>
    70.9 - 
   70.10 -+#ifndef XEN
   70.11 - #include <linux/cpu.h>
   70.12 -+#endif
   70.13 - #include <linux/init.h>
   70.14 - #include <linux/kernel.h>
   70.15 - #include <linux/module.h>
   70.16 -+#ifndef XEN
   70.17 - #include <linux/profile.h>
   70.18 -+#endif
   70.19 - #include <linux/sched.h>
   70.20 - #include <linux/time.h>
   70.21 - #include <linux/interrupt.h>
   70.22 - #include <linux/efi.h>
   70.23 -+#ifndef XEN
   70.24 - #include <linux/profile.h>
   70.25 -+#endif
   70.26 - #include <linux/timex.h>
   70.27 - 
   70.28 - #include <asm/machvec.h>
   70.29 -@@ -29,6 +35,9 @@
   70.30 - #include <asm/sal.h>
   70.31 - #include <asm/sections.h>
   70.32 - #include <asm/system.h>
   70.33 -+#ifdef XEN
   70.34 -+#include <asm/ia64_int.h>
   70.35 -+#endif
   70.36 - 
   70.37 - extern unsigned long wall_jiffies;
   70.38 - 
   70.39 -@@ -45,6 +54,59 @@
   70.40 - 
   70.41 - #endif
   70.42 - 
   70.43 -+#ifdef XEN
   70.44 -+volatile unsigned long last_nsec_offset;
   70.45 -+extern rwlock_t xtime_lock;
   70.46 -+unsigned long cpu_khz;  /* Detected as we calibrate the TSC */
   70.47 -+static s_time_t        stime_irq;       /* System time at last 'time update' */
   70.48 -+
   70.49 -+static inline u64 get_time_delta(void)
   70.50 -+{
   70.51 -+	return ia64_get_itc();
   70.52 -+}
   70.53 -+
   70.54 -+s_time_t get_s_time(void)
   70.55 -+{
   70.56 -+    s_time_t now;
   70.57 -+    unsigned long flags;
   70.58 -+
   70.59 -+    read_lock_irqsave(&xtime_lock, flags);
   70.60 -+
   70.61 -+    now = stime_irq + get_time_delta();
   70.62 -+
   70.63 -+    /* Ensure that the returned system time is monotonically increasing. */
   70.64 -+    {
   70.65 -+        static s_time_t prev_now = 0;
   70.66 -+        if ( unlikely(now < prev_now) )
   70.67 -+            now = prev_now;
   70.68 -+        prev_now = now;
   70.69 -+    }
   70.70 -+
   70.71 -+    read_unlock_irqrestore(&xtime_lock, flags);
   70.72 -+
   70.73 -+    return now; 
   70.74 -+}
   70.75 -+
   70.76 -+void update_dom_time(struct vcpu *v)
   70.77 -+{
   70.78 -+// FIXME: implement this?
   70.79 -+//	printf("update_dom_time: called, not implemented, skipping\n");
   70.80 -+	return;
   70.81 -+}
   70.82 -+
   70.83 -+/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
   70.84 -+void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
   70.85 -+{
   70.86 -+// FIXME: Should this be do_settimeofday (from linux)???
   70.87 -+	printf("do_settime: called, not implemented, stopping\n");
   70.88 -+	dummy();
   70.89 -+}
   70.90 -+#endif
   70.91 -+
   70.92 -+#if 0	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   70.93 -+#endif	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
   70.94 -+
   70.95 -+#ifndef XEN
   70.96 - static void
   70.97 - itc_reset (void)
   70.98 - {
   70.99 -@@ -80,12 +142,15 @@
  70.100 - 	return (elapsed_cycles*local_cpu_data->nsec_per_cyc) >> IA64_NSEC_PER_CYC_SHIFT;
  70.101 - }
  70.102 - 
  70.103 -+#ifndef XEN
  70.104 - static struct time_interpolator itc_interpolator = {
  70.105 - 	.get_offset =	itc_get_offset,
  70.106 - 	.update =	itc_update,
  70.107 - 	.reset =	itc_reset
  70.108 - };
  70.109 -+#endif
  70.110 - 
  70.111 -+#ifndef XEN
  70.112 - int
  70.113 - do_settimeofday (struct timespec *tv)
  70.114 - {
  70.115 -@@ -95,7 +160,9 @@
  70.116 - 	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
  70.117 - 		return -EINVAL;
  70.118 - 
  70.119 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  70.120 - 	write_seqlock_irq(&xtime_lock);
  70.121 -+#endif
  70.122 - 	{
  70.123 - 		/*
  70.124 - 		 * This is revolting. We need to set "xtime" correctly. However, the value
  70.125 -@@ -117,12 +184,15 @@
  70.126 - 		time_esterror = NTP_PHASE_LIMIT;
  70.127 - 		time_interpolator_reset();
  70.128 - 	}
  70.129 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  70.130 - 	write_sequnlock_irq(&xtime_lock);
  70.131 -+#endif
  70.132 - 	clock_was_set();
  70.133 - 	return 0;
  70.134 - }
  70.135 - 
  70.136 - EXPORT_SYMBOL(do_settimeofday);
  70.137 -+#endif
  70.138 - 
  70.139 - void
  70.140 - do_gettimeofday (struct timeval *tv)
  70.141 -@@ -185,6 +255,7 @@
  70.142 - }
  70.143 - 
  70.144 - EXPORT_SYMBOL(do_gettimeofday);
  70.145 -+#endif
  70.146 - 
  70.147 - /*
  70.148 -  * The profiling function is SMP safe. (nothing can mess
  70.149 -@@ -195,6 +266,9 @@
  70.150 - static inline void
  70.151 - ia64_do_profile (struct pt_regs * regs)
  70.152 - {
  70.153 -+#ifdef XEN
  70.154 -+}
  70.155 -+#else
  70.156 - 	unsigned long ip, slot;
  70.157 - 	extern cpumask_t prof_cpu_mask;
  70.158 - 
  70.159 -@@ -231,24 +305,89 @@
  70.160 - 		ip = prof_len-1;
  70.161 - 	atomic_inc((atomic_t *)&prof_buffer[ip]);
  70.162 - }
  70.163 -+#endif
  70.164 -+
  70.165 -+#ifdef XEN
  70.166 -+unsigned long domain0_ready = 0;	// FIXME (see below)
  70.167 -+#define typecheck(a,b)	1
  70.168 -+/* FROM linux/include/linux/jiffies.h */
  70.169 -+/*
  70.170 -+ *	These inlines deal with timer wrapping correctly. You are 
  70.171 -+ *	strongly encouraged to use them
  70.172 -+ *	1. Because people otherwise forget
  70.173 -+ *	2. Because if the timer wrap changes in future you won't have to
  70.174 -+ *	   alter your driver code.
  70.175 -+ *
  70.176 -+ * time_after(a,b) returns true if the time a is after time b.
  70.177 -+ *
  70.178 -+ * Do this with "<0" and ">=0" to only test the sign of the result. A
  70.179 -+ * good compiler would generate better code (and a really good compiler
  70.180 -+ * wouldn't care). Gcc is currently neither.
  70.181 -+ */
  70.182 -+#define time_after(a,b)		\
  70.183 -+	(typecheck(unsigned long, a) && \
  70.184 -+	 typecheck(unsigned long, b) && \
  70.185 -+	 ((long)(b) - (long)(a) < 0))
  70.186 -+#define time_before(a,b)	time_after(b,a)
  70.187 -+
  70.188 -+#define time_after_eq(a,b)	\
  70.189 -+	(typecheck(unsigned long, a) && \
  70.190 -+	 typecheck(unsigned long, b) && \
  70.191 -+	 ((long)(a) - (long)(b) >= 0))
  70.192 -+#define time_before_eq(a,b)	time_after_eq(b,a)
  70.193 -+#endif
  70.194 - 
  70.195 - static irqreturn_t
  70.196 - timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
  70.197 - {
  70.198 - 	unsigned long new_itm;
  70.199 - 
  70.200 -+#ifndef XEN
  70.201 - 	if (unlikely(cpu_is_offline(smp_processor_id()))) {
  70.202 - 		return IRQ_HANDLED;
  70.203 - 	}
  70.204 -+#endif
  70.205 -+#ifdef XEN
  70.206 -+	if (current->domain == dom0) {
  70.207 -+		// FIXME: there's gotta be a better way of doing this...
  70.208 -+		// We have to ensure that domain0 is launched before we
  70.209 -+		// call vcpu_timer_expired on it
  70.210 -+		//domain0_ready = 1; // moved to xensetup.c
  70.211 -+	}
  70.212 -+	if (domain0_ready && vcpu_timer_expired(dom0->vcpu[0])) {
  70.213 -+		vcpu_pend_timer(dom0->vcpu[0]);
  70.214 -+		//vcpu_set_next_timer(dom0->vcpu[0]);
  70.215 -+		vcpu_wake(dom0->vcpu[0]);
  70.216 -+	}
  70.217 -+	if (!is_idle_task(current->domain) && current->domain != dom0) {
  70.218 -+		if (vcpu_timer_expired(current)) {
  70.219 -+			vcpu_pend_timer(current);
  70.220 -+			// ensure another timer interrupt happens even if domain doesn't
  70.221 -+			vcpu_set_next_timer(current);
  70.222 -+			vcpu_wake(current);
  70.223 -+		}
  70.224 -+	}
  70.225 -+	raise_actimer_softirq();
  70.226 -+#endif
  70.227 - 
  70.228 -+#ifndef XEN
  70.229 - 	platform_timer_interrupt(irq, dev_id, regs);
  70.230 -+#endif
  70.231 - 
  70.232 - 	new_itm = local_cpu_data->itm_next;
  70.233 - 
  70.234 - 	if (!time_after(ia64_get_itc(), new_itm))
  70.235 -+#ifdef XEN
  70.236 -+		return;
  70.237 -+#else
  70.238 - 		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
  70.239 - 		       ia64_get_itc(), new_itm);
  70.240 -+#endif
  70.241 - 
  70.242 -+#ifdef XEN
  70.243 -+//	printf("GOT TO HERE!!!!!!!!!!!\n");
  70.244 -+	//while(1);
  70.245 -+#endif
  70.246 - 	ia64_do_profile(regs);
  70.247 - 
  70.248 - 	while (1) {
  70.249 -@@ -269,10 +408,16 @@
  70.250 - 			 * another CPU. We need to avoid to SMP race by acquiring the
  70.251 - 			 * xtime_lock.
  70.252 - 			 */
  70.253 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  70.254 - 			write_seqlock(&xtime_lock);
  70.255 -+#endif
  70.256 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  70.257 - 			do_timer(regs);
  70.258 -+#endif
  70.259 - 			local_cpu_data->itm_next = new_itm;
  70.260 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  70.261 - 			write_sequnlock(&xtime_lock);
  70.262 -+#endif
  70.263 - 		} else
  70.264 - 			local_cpu_data->itm_next = new_itm;
  70.265 - 
  70.266 -@@ -292,7 +437,12 @@
  70.267 - 		 */
  70.268 - 		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
  70.269 - 			new_itm += local_cpu_data->itm_delta;
  70.270 -+//#ifdef XEN
  70.271 -+//		vcpu_set_next_timer(current);
  70.272 -+//#else
  70.273 -+//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
  70.274 - 		ia64_set_itm(new_itm);
  70.275 -+//#endif
  70.276 - 		/* double check, in case we got hit by a (slow) PMI: */
  70.277 - 	} while (time_after_eq(ia64_get_itc(), new_itm));
  70.278 - 	return IRQ_HANDLED;
  70.279 -@@ -307,6 +457,7 @@
  70.280 - 	int cpu = smp_processor_id();
  70.281 - 	unsigned long shift = 0, delta;
  70.282 - 
  70.283 -+printf("ia64_cpu_local_tick: about to call ia64_set_itv\n");
  70.284 - 	/* arrange for the cycle counter to generate a timer interrupt: */
  70.285 - 	ia64_set_itv(IA64_TIMER_VECTOR);
  70.286 - 
  70.287 -@@ -320,6 +471,7 @@
  70.288 - 		shift = (2*(cpu - hi) + 1) * delta/hi/2;
  70.289 - 	}
  70.290 - 	local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
  70.291 -+printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next);
  70.292 - 	ia64_set_itm(local_cpu_data->itm_next);
  70.293 - }
  70.294 - 
  70.295 -@@ -335,6 +487,7 @@
  70.296 - 	 * frequency and then a PAL call to determine the frequency ratio between the ITC
  70.297 - 	 * and the base frequency.
  70.298 - 	 */
  70.299 -+
  70.300 - 	status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
  70.301 - 				    &platform_base_freq, &platform_base_drift);
  70.302 - 	if (status != 0) {
  70.303 -@@ -384,9 +537,11 @@
  70.304 - 					+ itc_freq/2)/itc_freq;
  70.305 - 
  70.306 - 	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
  70.307 -+#ifndef XEN
  70.308 - 		itc_interpolator.frequency = local_cpu_data->itc_freq;
  70.309 - 		itc_interpolator.drift = itc_drift;
  70.310 - 		register_time_interpolator(&itc_interpolator);
  70.311 -+#endif
  70.312 - 	}
  70.313 - 
  70.314 - 	/* Setup the CPU local timer tick */
  70.315 -@@ -395,7 +550,9 @@
  70.316 - 
  70.317 - static struct irqaction timer_irqaction = {
  70.318 - 	.handler =	timer_interrupt,
  70.319 -+#ifndef XEN
  70.320 - 	.flags =	SA_INTERRUPT,
  70.321 -+#endif
  70.322 - 	.name =		"timer"
  70.323 - };
  70.324 - 
  70.325 -@@ -403,12 +560,16 @@
  70.326 - time_init (void)
  70.327 - {
  70.328 - 	register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
  70.329 -+#ifndef XEN
  70.330 - 	efi_gettimeofday(&xtime);
  70.331 -+#endif
  70.332 - 	ia64_init_itm();
  70.333 - 
  70.334 -+#ifndef XEN
  70.335 - 	/*
  70.336 - 	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
  70.337 - 	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
  70.338 - 	 */
  70.339 - 	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
  70.340 -+#endif
  70.341 - }
    71.1 --- a/xen/arch/ia64/patch/linux-2.6.7/tlb.c	Fri Aug 26 11:02:14 2005 +0000
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,48 +0,0 @@
    71.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/mm/tlb.c	2004-06-15 23:19:43.000000000 -0600
    71.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/tlb.c	2004-08-25 19:28:12.000000000 -0600
    71.6 -@@ -21,7 +21,9 @@
    71.7 - #include <asm/mmu_context.h>
    71.8 - #include <asm/pgalloc.h>
    71.9 - #include <asm/pal.h>
   71.10 -+#ifndef XEN
   71.11 - #include <asm/tlbflush.h>
   71.12 -+#endif
   71.13 - 
   71.14 - static struct {
   71.15 - 	unsigned long mask;	/* mask of supported purge page-sizes */
   71.16 -@@ -43,6 +45,9 @@
   71.17 - void
   71.18 - wrap_mmu_context (struct mm_struct *mm)
   71.19 - {
   71.20 -+#ifdef XEN
   71.21 -+printf("wrap_mmu_context: called, not implemented\n");
   71.22 -+#else
   71.23 - 	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
   71.24 - 	struct task_struct *tsk;
   71.25 - 	int i;
   71.26 -@@ -83,6 +88,7 @@
   71.27 - 		put_cpu();
   71.28 - 	}
   71.29 - 	local_flush_tlb_all();
   71.30 -+#endif
   71.31 - }
   71.32 - 
   71.33 - void
   71.34 -@@ -132,6 +138,9 @@
   71.35 - void
   71.36 - flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
   71.37 - {
   71.38 -+#ifdef XEN
   71.39 -+printf("flush_tlb_range: called, not implemented\n");
   71.40 -+#else
   71.41 - 	struct mm_struct *mm = vma->vm_mm;
   71.42 - 	unsigned long size = end - start;
   71.43 - 	unsigned long nbits;
   71.44 -@@ -163,6 +172,7 @@
   71.45 - # endif
   71.46 - 
   71.47 - 	ia64_srlz_i();			/* srlz.i implies srlz.d */
   71.48 -+#endif
   71.49 - }
   71.50 - EXPORT_SYMBOL(flush_tlb_range);
   71.51 - 
    72.1 --- a/xen/arch/ia64/patch/linux-2.6.7/types.h	Fri Aug 26 11:02:14 2005 +0000
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,15 +0,0 @@
    72.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/asm-ia64/types.h	2004-06-15 23:19:01.000000000 -0600
    72.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/types.h	2004-11-11 17:08:30.000000000 -0700
    72.6 -@@ -1,5 +1,12 @@
    72.7 - #ifndef _ASM_IA64_TYPES_H
    72.8 - #define _ASM_IA64_TYPES_H
    72.9 -+#ifdef XEN
   72.10 -+#ifndef __ASSEMBLY__
   72.11 -+typedef unsigned long ssize_t;
   72.12 -+typedef unsigned long size_t;
   72.13 -+typedef long long loff_t;
   72.14 -+#endif
   72.15 -+#endif
   72.16 - 
   72.17 - /*
   72.18 -  * This file is never included by application software unless explicitly requested (e.g.,
    73.1 --- a/xen/arch/ia64/patch/linux-2.6.7/unaligned.c	Fri Aug 26 11:02:14 2005 +0000
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,97 +0,0 @@
    73.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/arch/ia64/kernel/unaligned.c	2004-06-15 23:20:03.000000000 -0600
    73.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/arch/ia64/unaligned.c	2004-08-25 19:28:12.000000000 -0600
    73.6 -@@ -15,8 +15,10 @@
    73.7 -  */
    73.8 - #include <linux/kernel.h>
    73.9 - #include <linux/sched.h>
   73.10 -+#ifndef XEN
   73.11 - #include <linux/smp_lock.h>
   73.12 - #include <linux/tty.h>
   73.13 -+#endif
   73.14 - 
   73.15 - #include <asm/intrinsics.h>
   73.16 - #include <asm/processor.h>
   73.17 -@@ -24,7 +26,16 @@
   73.18 - #include <asm/uaccess.h>
   73.19 - #include <asm/unaligned.h>
   73.20 - 
   73.21 -+#ifdef XEN
   73.22 -+#define	ia64_peek(x...)	printk("ia64_peek: called, not implemented\n")
   73.23 -+#define	ia64_poke(x...)	printk("ia64_poke: called, not implemented\n")
   73.24 -+#define	ia64_sync_fph(x...) printk("ia64_sync_fph: called, not implemented\n")
   73.25 -+#define	ia64_flush_fph(x...) printk("ia64_flush_fph: called, not implemented\n")
   73.26 -+#define	die_if_kernel(x...) printk("die_if_kernel: called, not implemented\n")
   73.27 -+#define jiffies 0
   73.28 -+#else
   73.29 - extern void die_if_kernel(char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
   73.30 -+#endif
   73.31 - 
   73.32 - #undef DEBUG_UNALIGNED_TRAP
   73.33 - 
   73.34 -@@ -437,7 +448,11 @@
   73.35 - }
   73.36 - 
   73.37 - 
   73.38 -+#ifdef XEN
   73.39 -+void
   73.40 -+#else
   73.41 - static void
   73.42 -+#endif
   73.43 - setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
   73.44 - {
   73.45 - 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   73.46 -@@ -611,7 +626,11 @@
   73.47 - }
   73.48 - 
   73.49 - 
   73.50 -+#ifdef XEN
   73.51 -+void
   73.52 -+#else
   73.53 - static void
   73.54 -+#endif
   73.55 - getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs)
   73.56 - {
   73.57 - 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   73.58 -@@ -1298,7 +1317,9 @@
   73.59 - 	mm_segment_t old_fs = get_fs();
   73.60 - 	unsigned long bundle[2];
   73.61 - 	unsigned long opcode;
   73.62 -+#ifndef XEN
   73.63 - 	struct siginfo si;
   73.64 -+#endif
   73.65 - 	const struct exception_table_entry *eh = NULL;
   73.66 - 	union {
   73.67 - 		unsigned long l;
   73.68 -@@ -1317,6 +1338,9 @@
   73.69 - 	 * user-level unaligned accesses.  Otherwise, a clever program could trick this
   73.70 - 	 * handler into reading an arbitrary kernel addresses...
   73.71 - 	 */
   73.72 -+#ifdef XEN
   73.73 -+printk("ia64_handle_unaligned: called, not working yet\n");
   73.74 -+#else
   73.75 - 	if (!user_mode(regs))
   73.76 - 		eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
   73.77 - 	if (user_mode(regs) || eh) {
   73.78 -@@ -1353,6 +1377,7 @@
   73.79 - 
   73.80 - 	if (__copy_from_user(bundle, (void *) regs->cr_iip, 16))
   73.81 - 		goto failure;
   73.82 -+#endif
   73.83 - 
   73.84 - 	/*
   73.85 - 	 * extract the instruction from the bundle given the slot number
   73.86 -@@ -1493,6 +1518,7 @@
   73.87 - 		/* NOT_REACHED */
   73.88 - 	}
   73.89 -   force_sigbus:
   73.90 -+#ifndef XEN
   73.91 - 	si.si_signo = SIGBUS;
   73.92 - 	si.si_errno = 0;
   73.93 - 	si.si_code = BUS_ADRALN;
   73.94 -@@ -1501,5 +1527,6 @@
   73.95 - 	si.si_isr = 0;
   73.96 - 	si.si_imm = 0;
   73.97 - 	force_sig_info(SIGBUS, &si, current);
   73.98 -+#endif
   73.99 - 	goto done;
  73.100 - }
    74.1 --- a/xen/arch/ia64/patch/linux-2.6.7/wait.h	Fri Aug 26 11:02:14 2005 +0000
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,26 +0,0 @@
    74.4 ---- /home/djm/src/xen/xeno-ia64.bk/xen/linux-2.6.7/include/linux/wait.h	2004-06-15 23:19:31.000000000 -0600
    74.5 -+++ /home/djm/src/xen/xeno-ia64.bk/xen/include/asm-ia64/linux/wait.h	2004-08-25 19:28:13.000000000 -0600
    74.6 -@@ -104,10 +104,15 @@
    74.7 - 	list_del(&old->task_list);
    74.8 - }
    74.9 - 
   74.10 -+#ifdef XEN
   74.11 -+void FASTCALL(__wake_up(struct task_struct *p));
   74.12 -+#else
   74.13 - void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
   74.14 -+#endif
   74.15 - extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
   74.16 - extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
   74.17 - 
   74.18 -+#ifndef XEN
   74.19 - #define wake_up(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
   74.20 - #define wake_up_nr(x, nr)		__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
   74.21 - #define wake_up_all(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL)
   74.22 -@@ -117,6 +122,7 @@
   74.23 - #define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
   74.24 - #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
   74.25 - #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
   74.26 -+#endif
   74.27 - 
   74.28 - #define __wait_event(wq, condition) 					\
   74.29 - do {									\