ia64/xen-unstable

changeset 4737:ba75d06d25c5

bitkeeper revision 1.1389.1.28 (4276bde5IlPGAgyQBeTjHtxqjQjs2g)

Merge bk://xen.bkbits.net/xeno-unstable.bk
into bkbits.net:/repos/x/xen-ia64/xeno-unstable-ia64.bk
author xen-ia64.adm@bkbits.net
date Mon May 02 23:55:17 2005 +0000 (2005-05-02)
parents 1f679a34da36 96530b133124
children 26e046f6a342
files .rootkeys xen/arch/ia64/Makefile xen/arch/ia64/hypercall.c xen/arch/ia64/ivt.S xen/arch/ia64/lib/Makefile xen/arch/ia64/patch/linux-2.6.11/bootmem.h xen/arch/ia64/patch/linux-2.6.11/cpumask.h xen/arch/ia64/patch/linux-2.6.11/current.h xen/arch/ia64/patch/linux-2.6.11/efi.c xen/arch/ia64/patch/linux-2.6.11/entry.S xen/arch/ia64/patch/linux-2.6.11/hardirq.h xen/arch/ia64/patch/linux-2.6.11/head.S xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h xen/arch/ia64/patch/linux-2.6.11/irq.h xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c xen/arch/ia64/patch/linux-2.6.11/ivt.S xen/arch/ia64/patch/linux-2.6.11/kernel-time.c xen/arch/ia64/patch/linux-2.6.11/lds.S xen/arch/ia64/patch/linux-2.6.11/linuxextable.c xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h xen/arch/ia64/patch/linux-2.6.11/linuxtime.h xen/arch/ia64/patch/linux-2.6.11/mm_contig.c xen/arch/ia64/patch/linux-2.6.11/mmzone.h xen/arch/ia64/patch/linux-2.6.11/page.h xen/arch/ia64/patch/linux-2.6.11/pgalloc.h xen/arch/ia64/patch/linux-2.6.11/sal.h xen/arch/ia64/patch/linux-2.6.11/setup.c xen/arch/ia64/patch/linux-2.6.11/slab.h xen/arch/ia64/patch/linux-2.6.11/swiotlb.c xen/arch/ia64/patch/linux-2.6.11/system.h xen/arch/ia64/patch/linux-2.6.11/time.c xen/arch/ia64/patch/linux-2.6.11/tlb.c xen/arch/ia64/patch/linux-2.6.11/unaligned.c xen/arch/ia64/patch/linux-2.6.11/wait.h xen/arch/ia64/process.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/vcpu.c xen/arch/ia64/vhpt.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenirq.c xen/arch/ia64/xenmem.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/arch/ia64/xentime.c xen/include/asm-ia64/config.h
line diff
     1.1 --- a/.rootkeys	Mon May 02 16:07:35 2005 +0000
     1.2 +++ b/.rootkeys	Mon May 02 23:55:17 2005 +0000
     1.3 @@ -1085,47 +1085,34 @@ 421098b2ZlaBcyiuuPr3WpzaSDwg6Q xen/arch/
     1.4  4239e98a_HX-FCIcXtVqY0BbrDqVug xen/arch/ia64/hypercall.c
     1.5  421098b3LYAS8xJkQiGP7tiTlyBt0Q xen/arch/ia64/idle0_task.c
     1.6  421098b3ys5GAr4z6_H1jD33oem82g xen/arch/ia64/irq.c
     1.7 +4272a8e4lavI6DrTvqaIhXeR5RuKBw xen/arch/ia64/ivt.S
     1.8  421098b3Heh72KuoVlND3CH6c0B0aA xen/arch/ia64/lib/Makefile
     1.9  421098b3O0MYMUsmYVFy84VV_1gFwQ xen/arch/ia64/mm_init.c
    1.10 -425ae516skiHBZU-Kfwxv2YWXfNRWQ xen/arch/ia64/patch/linux-2.6.11/bootmem.h
    1.11  425ae516maKAsHBJVSzs19cdRgt3Nw xen/arch/ia64/patch/linux-2.6.11/cpumask.h
    1.12 -425ae516rHybgKj6KsvBOE0c_Hruxg xen/arch/ia64/patch/linux-2.6.11/current.h
    1.13  425ae516cGqvMzGtihTEsQXAXsuOhQ xen/arch/ia64/patch/linux-2.6.11/efi.c
    1.14  425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S
    1.15 -425ae516RoFheL-Ua-EOtFqmLxoc9g xen/arch/ia64/patch/linux-2.6.11/hardirq.h
    1.16 +425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/hardirq.h
    1.17  425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S
    1.18 -425ae5163aiWdc1IZNsON6ruE2-n9g xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c
    1.19  425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h
    1.20  425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h
    1.21  425ae516U2wFUzrUJQUpy3z38jZHsQ xen/arch/ia64/patch/linux-2.6.11/io.h
    1.22 -425ae516nXL2iTzpziIaSLi3N257qQ xen/arch/ia64/patch/linux-2.6.11/irq.h
    1.23  425ae516GGRmXijPBLC5ii6yWOn0rg xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c
    1.24 -425ae516qQA5dHuIybqfN3nEzM_Zvg xen/arch/ia64/patch/linux-2.6.11/ivt.S
    1.25 -425ae516_UhrTa3Y8wDG7fTgX6pNYA xen/arch/ia64/patch/linux-2.6.11/kernel-time.c
    1.26  425ae516atiECmpn_6nZDw4kkmbJ6g xen/arch/ia64/patch/linux-2.6.11/kregs.h
    1.27 -425ae516lwlYwHG1Jv93kC3tfU5caw xen/arch/ia64/patch/linux-2.6.11/lds.S
    1.28 -425ae516UGTH2xC56DEIlHSrPH4oxg xen/arch/ia64/patch/linux-2.6.11/linuxextable.c
    1.29 -425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h
    1.30 -425ae516kNsO5yYnBHvAISdvCkQ2-g xen/arch/ia64/patch/linux-2.6.11/linuxtime.h
    1.31  425ae516Je2zI-Iw30_uGhvUYdlCZQ xen/arch/ia64/patch/linux-2.6.11/mca_asm.h
    1.32  425ae5160-9wHxh0tOnIjavEjt6W0A xen/arch/ia64/patch/linux-2.6.11/minstate.h
    1.33  425ae516N7SaORdbodDr90tmtCzYXw xen/arch/ia64/patch/linux-2.6.11/mm_contig.c
    1.34 -425ae516YcBgoZ3xCTEmhCrgX8CjCA xen/arch/ia64/patch/linux-2.6.11/mmzone.h
    1.35  425ae516WDLrfEA4zr40d00z0VIWPg xen/arch/ia64/patch/linux-2.6.11/page.h
    1.36  425ae516pVQ75NhdItT593SiWI0lbQ xen/arch/ia64/patch/linux-2.6.11/pal.S
    1.37  425ae516QfmjiF_a-mabAXqV8Imzkg xen/arch/ia64/patch/linux-2.6.11/pgalloc.h
    1.38  425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h
    1.39 -425ae5165sks4NwRldZOV_p63fspYw xen/arch/ia64/patch/linux-2.6.11/sal.h
    1.40  425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series
    1.41  425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c
    1.42 -425ae516-xgihgqPEv-Aq8-9cNoCXg xen/arch/ia64/patch/linux-2.6.11/slab.h
    1.43  425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c
    1.44  425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h
    1.45  425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c
    1.46  425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c
    1.47  425ae5162bIl2Dgd19x-FceB4L9oGw xen/arch/ia64/patch/linux-2.6.11/types.h
    1.48  425ae516cFUNY2jHD46bujcF5NJheA xen/arch/ia64/patch/linux-2.6.11/unaligned.c
    1.49 -425ae516viTtlyQjWHf6kBmq8KcwiQ xen/arch/ia64/patch/linux-2.6.11/wait.h
    1.50  421098b39QFMC-1t1r38CA7NxAYBPA xen/arch/ia64/patch/linux-2.6.7/bootmem.h
    1.51  421098b3SIA1vZX9fFUjo1T3o_jMCQ xen/arch/ia64/patch/linux-2.6.7/current.h
    1.52  421098b3ZBl80iPuSeDU_Id5AgZl0w xen/arch/ia64/patch/linux-2.6.7/efi.c
    1.53 @@ -1186,8 +1173,11 @@ 4252ace74lKUPFnO8PmF0Dtpk7Xkng xen/arch/
    1.54  41a26ebc--sjlYZQxmIxyCx3jw70qA xen/arch/ia64/vcpu.c
    1.55  421098b6M2WhsJ_ZMzFamAQcdc5gzw xen/arch/ia64/vhpt.c
    1.56  41a26ebc4jSBGQOuyNIPDST58mNbBw xen/arch/ia64/xenasm.S
    1.57 +4272adaeit9raZ9KnjO_wR4Ii9LJNQ xen/arch/ia64/xenirq.c
    1.58 +427162263zDUiPmTj-lP4eGyXs5eIg xen/arch/ia64/xenmem.c
    1.59  421098b6mWyFPtkhPz9h1LCmKpoCLg xen/arch/ia64/xenmisc.c
    1.60  421098b6lY2JzrV1oFDbrt7XQhtElg xen/arch/ia64/xensetup.c
    1.61 +427664f5eygrc3nEhI3RKf0Y37PzyA xen/arch/ia64/xentime.c
    1.62  3ddb79bcZbRBzT3elFWSX7u6NtMagQ xen/arch/x86/Makefile
    1.63  3ddb79bcBQF85CfLS4i1WGZ4oLLaCA xen/arch/x86/Rules.mk
    1.64  3e5636e5FAYZ5_vQnmgwFJfSdmO5Mw xen/arch/x86/acpi.c
     2.1 --- a/xen/arch/ia64/Makefile	Mon May 02 16:07:35 2005 +0000
     2.2 +++ b/xen/arch/ia64/Makefile	Mon May 02 23:55:17 2005 +0000
     2.3 @@ -6,10 +6,10 @@ OBJS = xensetup.o setup.o time.o irq.o i
     2.4  	xenmisc.o pdb-stub.o acpi.o hypercall.o \
     2.5  	machvec.o dom0_ops.o domain.o \
     2.6  	idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
     2.7 -	sal.o cmdline.o mm_init.o tlb.o smpboot.o \
     2.8 -	extable.o linuxextable.o \
     2.9 +	xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
    2.10 +	extable.o linuxextable.o xenirq.o xentime.o \
    2.11  	regionreg.o entry.o unaligned.o privop.o vcpu.o \
    2.12 -	irq_ia64.o irq_lsapic.o hpsim_irq.o vhpt.o xenasm.o dom_fw.o
    2.13 +	irq_ia64.o irq_lsapic.o vhpt.o xenasm.o dom_fw.o
    2.14  # perfmon.o
    2.15  # unwind.o needed for kernel unwinding (rare)
    2.16  
     3.1 --- a/xen/arch/ia64/hypercall.c	Mon May 02 16:07:35 2005 +0000
     3.2 +++ b/xen/arch/ia64/hypercall.c	Mon May 02 23:55:17 2005 +0000
     3.3 @@ -32,6 +32,14 @@ ia64_hypercall (struct pt_regs *regs)
     3.4  	    case FW_HYPERCALL_PAL_CALL:
     3.5  		//printf("*** PAL hypercall: index=%d\n",regs->r28);
     3.6  		//FIXME: This should call a C routine
     3.7 +#if 1
     3.8 +		// This is very conservative, but avoids a possible
     3.9 +		// (and deadly) freeze in paravirtualized domains due
    3.10 +		// to a yet-to-be-found bug where pending_interruption
    3.11 +		// is zero when it shouldn't be. Since PAL is called
    3.12 +		// in the idle loop, this should resolve it
    3.13 +		ed->vcpu_info->arch.pending_interruption = 1;
    3.14 +#endif
    3.15  		x = pal_emulator_static(regs->r28);
    3.16  		regs->r8 = x.status; regs->r9 = x.v0;
    3.17  		regs->r10 = x.v1; regs->r11 = x.v2;
    3.18 @@ -61,7 +69,6 @@ ia64_hypercall (struct pt_regs *regs)
    3.19  #endif
    3.20  		break;
    3.21  	    case FW_HYPERCALL_EFI_GET_TIME:
    3.22 -		fooefi();
    3.23  		tv = vcpu_get_gr(ed,32);
    3.24  		tc = vcpu_get_gr(ed,33);
    3.25  		//printf("efi_get_time(%p,%p) called...",tv,tc);
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/arch/ia64/ivt.S	Mon May 02 23:55:17 2005 +0000
     4.3 @@ -0,0 +1,1870 @@
     4.4 +
     4.5 +#ifdef XEN
     4.6 +//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
     4.7 +// these are all hacked out for now as the entire IVT
     4.8 +// will eventually be replaced... just want to use it
     4.9 +// for startup code to handle TLB misses
    4.10 +//#define ia64_leave_kernel 0
    4.11 +//#define ia64_ret_from_syscall 0
    4.12 +//#define ia64_handle_irq 0
    4.13 +//#define ia64_fault 0
    4.14 +#define ia64_illegal_op_fault 0
    4.15 +#define ia64_prepare_handle_unaligned 0
    4.16 +#define ia64_bad_break 0
    4.17 +#define ia64_trace_syscall 0
    4.18 +#define sys_call_table 0
    4.19 +#define sys_ni_syscall 0
    4.20 +#include <asm/vhpt.h>
    4.21 +#endif
    4.22 +/*
    4.23 + * arch/ia64/kernel/ivt.S
    4.24 + *
    4.25 + * Copyright (C) 1998-2001, 2003 Hewlett-Packard Co
    4.26 + *	Stephane Eranian <eranian@hpl.hp.com>
    4.27 + *	David Mosberger <davidm@hpl.hp.com>
    4.28 + * Copyright (C) 2000, 2002-2003 Intel Co
    4.29 + *	Asit Mallick <asit.k.mallick@intel.com>
    4.30 + *      Suresh Siddha <suresh.b.siddha@intel.com>
    4.31 + *      Kenneth Chen <kenneth.w.chen@intel.com>
    4.32 + *      Fenghua Yu <fenghua.yu@intel.com>
    4.33 + *
    4.34 + * 00/08/23 Asit Mallick <asit.k.mallick@intel.com> TLB handling for SMP
    4.35 + * 00/12/20 David Mosberger-Tang <davidm@hpl.hp.com> DTLB/ITLB handler now uses virtual PT.
    4.36 + */
    4.37 +/*
    4.38 + * This file defines the interruption vector table used by the CPU.
    4.39 + * It does not include one entry per possible cause of interruption.
    4.40 + *
    4.41 + * The first 20 entries of the table contain 64 bundles each while the
    4.42 + * remaining 48 entries contain only 16 bundles each.
    4.43 + *
    4.44 + * The 64 bundles are used to allow inlining the whole handler for critical
    4.45 + * interruptions like TLB misses.
    4.46 + *
    4.47 + *  For each entry, the comment is as follows:
    4.48 + *
    4.49 + *		// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
    4.50 + *  entry offset ----/     /         /                  /          /
    4.51 + *  entry number ---------/         /                  /          /
    4.52 + *  size of the entry -------------/                  /          /
    4.53 + *  vector name -------------------------------------/          /
    4.54 + *  interruptions triggering this vector ----------------------/
    4.55 + *
    4.56 + * The table is 32KB in size and must be aligned on 32KB boundary.
    4.57 + * (The CPU ignores the 15 lower bits of the address)
    4.58 + *
    4.59 + * Table is based upon EAS2.6 (Oct 1999)
    4.60 + */
    4.61 +
    4.62 +#include <linux/config.h>
    4.63 +
    4.64 +#include <asm/asmmacro.h>
    4.65 +#include <asm/break.h>
    4.66 +#include <asm/ia32.h>
    4.67 +#include <asm/kregs.h>
    4.68 +#include <asm/offsets.h>
    4.69 +#include <asm/pgtable.h>
    4.70 +#include <asm/processor.h>
    4.71 +#include <asm/ptrace.h>
    4.72 +#include <asm/system.h>
    4.73 +#include <asm/thread_info.h>
    4.74 +#include <asm/unistd.h>
    4.75 +#include <asm/errno.h>
    4.76 +
    4.77 +#if 1
    4.78 +# define PSR_DEFAULT_BITS	psr.ac
    4.79 +#else
    4.80 +# define PSR_DEFAULT_BITS	0
    4.81 +#endif
    4.82 +
    4.83 +#if 0
    4.84 +  /*
    4.85 +   * This lets you track the last eight faults that occurred on the CPU.  Make sure ar.k2 isn't
    4.86 +   * needed for something else before enabling this...
    4.87 +   */
    4.88 +# define DBG_FAULT(i)	mov r16=ar.k2;;	shl r16=r16,8;;	add r16=(i),r16;;mov ar.k2=r16
    4.89 +#else
    4.90 +# define DBG_FAULT(i)
    4.91 +#endif
    4.92 +
    4.93 +#define MINSTATE_VIRT	/* needed by minstate.h */
    4.94 +#include "minstate.h"
    4.95 +
    4.96 +#define FAULT(n)									\
    4.97 +	mov r31=pr;									\
    4.98 +	mov r19=n;;			/* prepare to save predicates */		\
    4.99 +	br.sptk.many dispatch_to_fault_handler
   4.100 +
   4.101 +#ifdef XEN
   4.102 +#define REFLECT(n)									\
   4.103 +	mov r31=pr;									\
   4.104 +	mov r19=n;;			/* prepare to save predicates */		\
   4.105 +	br.sptk.many dispatch_reflection
   4.106 +#endif
   4.107 +
   4.108 +	.section .text.ivt,"ax"
   4.109 +
   4.110 +	.align 32768	// align on 32KB boundary
   4.111 +	.global ia64_ivt
   4.112 +ia64_ivt:
   4.113 +/////////////////////////////////////////////////////////////////////////////////////////
   4.114 +// 0x0000 Entry 0 (size 64 bundles) VHPT Translation (8,20,47)
   4.115 +ENTRY(vhpt_miss)
   4.116 +	DBG_FAULT(0)
   4.117 +	/*
   4.118 +	 * The VHPT vector is invoked when the TLB entry for the virtual page table
   4.119 +	 * is missing.  This happens only as a result of a previous
   4.120 +	 * (the "original") TLB miss, which may either be caused by an instruction
   4.121 +	 * fetch or a data access (or non-access).
   4.122 +	 *
   4.123 +	 * What we do here is normal TLB miss handing for the _original_ miss, followed
   4.124 +	 * by inserting the TLB entry for the virtual page table page that the VHPT
   4.125 +	 * walker was attempting to access.  The latter gets inserted as long
   4.126 +	 * as both L1 and L2 have valid mappings for the faulting address.
   4.127 +	 * The TLB entry for the original miss gets inserted only if
   4.128 +	 * the L3 entry indicates that the page is present.
   4.129 +	 *
   4.130 +	 * do_page_fault gets invoked in the following cases:
   4.131 +	 *	- the faulting virtual address uses unimplemented address bits
   4.132 +	 *	- the faulting virtual address has no L1, L2, or L3 mapping
   4.133 +	 */
   4.134 +	mov r16=cr.ifa				// get address that caused the TLB miss
   4.135 +#ifdef CONFIG_HUGETLB_PAGE
   4.136 +	movl r18=PAGE_SHIFT
   4.137 +	mov r25=cr.itir
   4.138 +#endif
   4.139 +	;;
   4.140 +	rsm psr.dt				// use physical addressing for data
   4.141 +	mov r31=pr				// save the predicate registers
   4.142 +	mov r19=IA64_KR(PT_BASE)		// get page table base address
   4.143 +	shl r21=r16,3				// shift bit 60 into sign bit
   4.144 +	shr.u r17=r16,61			// get the region number into r17
   4.145 +	;;
   4.146 +	shr r22=r21,3
   4.147 +#ifdef CONFIG_HUGETLB_PAGE
   4.148 +	extr.u r26=r25,2,6
   4.149 +	;;
   4.150 +	cmp.ne p8,p0=r18,r26
   4.151 +	sub r27=r26,r18
   4.152 +	;;
   4.153 +(p8)	dep r25=r18,r25,2,6
   4.154 +(p8)	shr r22=r22,r27
   4.155 +#endif
   4.156 +	;;
   4.157 +	cmp.eq p6,p7=5,r17			// is IFA pointing into to region 5?
   4.158 +	shr.u r18=r22,PGDIR_SHIFT		// get bits 33-63 of the faulting address
   4.159 +	;;
   4.160 +(p7)	dep r17=r17,r19,(PAGE_SHIFT-3),3	// put region number bits in place
   4.161 +
   4.162 +	srlz.d
   4.163 +	LOAD_PHYSICAL(p6, r19, swapper_pg_dir)	// region 5 is rooted at swapper_pg_dir
   4.164 +
   4.165 +	.pred.rel "mutex", p6, p7
   4.166 +(p6)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT
   4.167 +(p7)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3
   4.168 +	;;
   4.169 +(p6)	dep r17=r18,r19,3,(PAGE_SHIFT-3)	// r17=PTA + IFA(33,42)*8
   4.170 +(p7)	dep r17=r18,r17,3,(PAGE_SHIFT-6)	// r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8)
   4.171 +	cmp.eq p7,p6=0,r21			// unused address bits all zeroes?
   4.172 +	shr.u r18=r22,PMD_SHIFT			// shift L2 index into position
   4.173 +	;;
   4.174 +	ld8 r17=[r17]				// fetch the L1 entry (may be 0)
   4.175 +	;;
   4.176 +(p7)	cmp.eq p6,p7=r17,r0			// was L1 entry NULL?
   4.177 +	dep r17=r18,r17,3,(PAGE_SHIFT-3)	// compute address of L2 page table entry
   4.178 +	;;
   4.179 +(p7)	ld8 r20=[r17]				// fetch the L2 entry (may be 0)
   4.180 +	shr.u r19=r22,PAGE_SHIFT		// shift L3 index into position
   4.181 +	;;
   4.182 +(p7)	cmp.eq.or.andcm p6,p7=r20,r0		// was L2 entry NULL?
   4.183 +	dep r21=r19,r20,3,(PAGE_SHIFT-3)	// compute address of L3 page table entry
   4.184 +	;;
   4.185 +(p7)	ld8 r18=[r21]				// read the L3 PTE
   4.186 +	mov r19=cr.isr				// cr.isr bit 0 tells us if this is an insn miss
   4.187 +	;;
   4.188 +(p7)	tbit.z p6,p7=r18,_PAGE_P_BIT		// page present bit cleared?
   4.189 +	mov r22=cr.iha				// get the VHPT address that caused the TLB miss
   4.190 +	;;					// avoid RAW on p7
   4.191 +(p7)	tbit.nz.unc p10,p11=r19,32		// is it an instruction TLB miss?
   4.192 +	dep r23=0,r20,0,PAGE_SHIFT		// clear low bits to get page address
   4.193 +	;;
   4.194 +(p10)	itc.i r18				// insert the instruction TLB entry
   4.195 +(p11)	itc.d r18				// insert the data TLB entry
   4.196 +(p6)	br.cond.spnt.many page_fault		// handle bad address/page not present (page fault)
   4.197 +	mov cr.ifa=r22
   4.198 +
   4.199 +#ifdef CONFIG_HUGETLB_PAGE
   4.200 +(p8)	mov cr.itir=r25				// change to default page-size for VHPT
   4.201 +#endif
   4.202 +
   4.203 +	/*
   4.204 +	 * Now compute and insert the TLB entry for the virtual page table.  We never
   4.205 +	 * execute in a page table page so there is no need to set the exception deferral
   4.206 +	 * bit.
   4.207 +	 */
   4.208 +	adds r24=__DIRTY_BITS_NO_ED|_PAGE_PL_0|_PAGE_AR_RW,r23
   4.209 +	;;
   4.210 +(p7)	itc.d r24
   4.211 +	;;
   4.212 +#ifdef CONFIG_SMP
   4.213 +	/*
   4.214 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.215 +	 * cannot possibly affect the following loads:
   4.216 +	 */
   4.217 +	dv_serialize_data
   4.218 +
   4.219 +	/*
   4.220 +	 * Re-check L2 and L3 pagetable.  If they changed, we may have received a ptc.g
   4.221 +	 * between reading the pagetable and the "itc".  If so, flush the entry we
   4.222 +	 * inserted and retry.
   4.223 +	 */
   4.224 +	ld8 r25=[r21]				// read L3 PTE again
   4.225 +	ld8 r26=[r17]				// read L2 entry again
   4.226 +	;;
   4.227 +	cmp.ne p6,p7=r26,r20			// did L2 entry change
   4.228 +	mov r27=PAGE_SHIFT<<2
   4.229 +	;;
   4.230 +(p6)	ptc.l r22,r27				// purge PTE page translation
   4.231 +(p7)	cmp.ne.or.andcm p6,p7=r25,r18		// did L3 PTE change
   4.232 +	;;
   4.233 +(p6)	ptc.l r16,r27				// purge translation
   4.234 +#endif
   4.235 +
   4.236 +	mov pr=r31,-1				// restore predicate registers
   4.237 +	rfi
   4.238 +END(vhpt_miss)
   4.239 +
   4.240 +	.org ia64_ivt+0x400
   4.241 +/////////////////////////////////////////////////////////////////////////////////////////
   4.242 +// 0x0400 Entry 1 (size 64 bundles) ITLB (21)
   4.243 +ENTRY(itlb_miss)
   4.244 +	DBG_FAULT(1)
   4.245 +#ifdef XEN
   4.246 +	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
   4.247 +#ifdef VHPT_GLOBAL
   4.248 +	br.cond.sptk page_fault
   4.249 +	;;
   4.250 +#endif
   4.251 +#endif
   4.252 +	/*
   4.253 +	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
   4.254 +	 * page table.  If a nested TLB miss occurs, we switch into physical
   4.255 +	 * mode, walk the page table, and then re-execute the L3 PTE read
   4.256 +	 * and go on normally after that.
   4.257 +	 */
   4.258 +	mov r16=cr.ifa				// get virtual address
   4.259 +	mov r29=b0				// save b0
   4.260 +	mov r31=pr				// save predicates
   4.261 +.itlb_fault:
   4.262 +	mov r17=cr.iha				// get virtual address of L3 PTE
   4.263 +	movl r30=1f				// load nested fault continuation point
   4.264 +	;;
   4.265 +1:	ld8 r18=[r17]				// read L3 PTE
   4.266 +	;;
   4.267 +	mov b0=r29
   4.268 +	tbit.z p6,p0=r18,_PAGE_P_BIT		// page present bit cleared?
   4.269 +(p6)	br.cond.spnt page_fault
   4.270 +	;;
   4.271 +	itc.i r18
   4.272 +	;;
   4.273 +#ifdef CONFIG_SMP
   4.274 +	/*
   4.275 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.276 +	 * cannot possibly affect the following loads:
   4.277 +	 */
   4.278 +	dv_serialize_data
   4.279 +
   4.280 +	ld8 r19=[r17]				// read L3 PTE again and see if same
   4.281 +	mov r20=PAGE_SHIFT<<2			// setup page size for purge
   4.282 +	;;
   4.283 +	cmp.ne p7,p0=r18,r19
   4.284 +	;;
   4.285 +(p7)	ptc.l r16,r20
   4.286 +#endif
   4.287 +	mov pr=r31,-1
   4.288 +	rfi
   4.289 +END(itlb_miss)
   4.290 +
   4.291 +	.org ia64_ivt+0x0800
   4.292 +/////////////////////////////////////////////////////////////////////////////////////////
   4.293 +// 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
   4.294 +ENTRY(dtlb_miss)
   4.295 +	DBG_FAULT(2)
   4.296 +#ifdef XEN
   4.297 +	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
   4.298 +#ifdef VHPT_GLOBAL
   4.299 +	br.cond.sptk page_fault
   4.300 +	;;
   4.301 +#endif
   4.302 +#endif
   4.303 +	/*
   4.304 +	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
   4.305 +	 * page table.  If a nested TLB miss occurs, we switch into physical
   4.306 +	 * mode, walk the page table, and then re-execute the L3 PTE read
   4.307 +	 * and go on normally after that.
   4.308 +	 */
   4.309 +	mov r16=cr.ifa				// get virtual address
   4.310 +	mov r29=b0				// save b0
   4.311 +	mov r31=pr				// save predicates
   4.312 +dtlb_fault:
   4.313 +	mov r17=cr.iha				// get virtual address of L3 PTE
   4.314 +	movl r30=1f				// load nested fault continuation point
   4.315 +	;;
   4.316 +1:	ld8 r18=[r17]				// read L3 PTE
   4.317 +	;;
   4.318 +	mov b0=r29
   4.319 +	tbit.z p6,p0=r18,_PAGE_P_BIT		// page present bit cleared?
   4.320 +(p6)	br.cond.spnt page_fault
   4.321 +	;;
   4.322 +	itc.d r18
   4.323 +	;;
   4.324 +#ifdef CONFIG_SMP
   4.325 +	/*
   4.326 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.327 +	 * cannot possibly affect the following loads:
   4.328 +	 */
   4.329 +	dv_serialize_data
   4.330 +
   4.331 +	ld8 r19=[r17]				// read L3 PTE again and see if same
   4.332 +	mov r20=PAGE_SHIFT<<2			// setup page size for purge
   4.333 +	;;
   4.334 +	cmp.ne p7,p0=r18,r19
   4.335 +	;;
   4.336 +(p7)	ptc.l r16,r20
   4.337 +#endif
   4.338 +	mov pr=r31,-1
   4.339 +	rfi
   4.340 +END(dtlb_miss)
   4.341 +
   4.342 +	.org ia64_ivt+0x0c00
   4.343 +/////////////////////////////////////////////////////////////////////////////////////////
   4.344 +// 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
   4.345 +ENTRY(alt_itlb_miss)
   4.346 +	DBG_FAULT(3)
   4.347 +#ifdef XEN
   4.348 +//#ifdef VHPT_GLOBAL
   4.349 +//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
   4.350 +//	br.cond.sptk page_fault
   4.351 +//	;;
   4.352 +//#endif
   4.353 +#endif
   4.354 +	mov r16=cr.ifa		// get address that caused the TLB miss
   4.355 +	movl r17=PAGE_KERNEL
   4.356 +	mov r21=cr.ipsr
   4.357 +	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
   4.358 +	mov r31=pr
   4.359 +	;;
   4.360 +#ifdef CONFIG_DISABLE_VHPT
   4.361 +	shr.u r22=r16,61			// get the region number into r21
   4.362 +	;;
   4.363 +	cmp.gt p8,p0=6,r22			// user mode
   4.364 +	;;
   4.365 +(p8)	thash r17=r16
   4.366 +	;;
   4.367 +(p8)	mov cr.iha=r17
   4.368 +(p8)	mov r29=b0				// save b0
   4.369 +(p8)	br.cond.dptk .itlb_fault
   4.370 +#endif
   4.371 +	extr.u r23=r21,IA64_PSR_CPL0_BIT,2	// extract psr.cpl
   4.372 +	and r19=r19,r16		// clear ed, reserved bits, and PTE control bits
   4.373 +	shr.u r18=r16,57	// move address bit 61 to bit 4
   4.374 +	;;
   4.375 +	andcm r18=0x10,r18	// bit 4=~address-bit(61)
   4.376 +	cmp.ne p8,p0=r0,r23	// psr.cpl != 0?
   4.377 +	or r19=r17,r19		// insert PTE control bits into r19
   4.378 +	;;
   4.379 +	or r19=r19,r18		// set bit 4 (uncached) if the access was to region 6
   4.380 +(p8)	br.cond.spnt page_fault
   4.381 +	;;
   4.382 +	itc.i r19		// insert the TLB entry
   4.383 +	mov pr=r31,-1
   4.384 +	rfi
   4.385 +END(alt_itlb_miss)
   4.386 +
   4.387 +	.org ia64_ivt+0x1000
   4.388 +/////////////////////////////////////////////////////////////////////////////////////////
   4.389 +// 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
   4.390 +ENTRY(alt_dtlb_miss)
   4.391 +	DBG_FAULT(4)
   4.392 +#ifdef XEN
   4.393 +//#ifdef VHPT_GLOBAL
   4.394 +//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
   4.395 +//	br.cond.sptk page_fault
   4.396 +//	;;
   4.397 +//#endif
   4.398 +#endif
   4.399 +	mov r16=cr.ifa		// get address that caused the TLB miss
   4.400 +	movl r17=PAGE_KERNEL
   4.401 +	mov r20=cr.isr
   4.402 +	movl r19=(((1 << IA64_MAX_PHYS_BITS) - 1) & ~0xfff)
   4.403 +	mov r21=cr.ipsr
   4.404 +	mov r31=pr
   4.405 +	;;
   4.406 +#ifdef CONFIG_DISABLE_VHPT
   4.407 +	shr.u r22=r16,61			// get the region number into r21
   4.408 +	;;
   4.409 +	cmp.gt p8,p0=6,r22			// access to region 0-5
   4.410 +	;;
   4.411 +(p8)	thash r17=r16
   4.412 +	;;
   4.413 +(p8)	mov cr.iha=r17
   4.414 +(p8)	mov r29=b0				// save b0
   4.415 +(p8)	br.cond.dptk dtlb_fault
   4.416 +#endif
   4.417 +	extr.u r23=r21,IA64_PSR_CPL0_BIT,2	// extract psr.cpl
   4.418 +	and r22=IA64_ISR_CODE_MASK,r20		// get the isr.code field
   4.419 +	tbit.nz p6,p7=r20,IA64_ISR_SP_BIT	// is speculation bit on?
   4.420 +	shr.u r18=r16,57			// move address bit 61 to bit 4
   4.421 +	and r19=r19,r16				// clear ed, reserved bits, and PTE control bits
   4.422 +	tbit.nz p9,p0=r20,IA64_ISR_NA_BIT	// is non-access bit on?
   4.423 +	;;
   4.424 +	andcm r18=0x10,r18	// bit 4=~address-bit(61)
   4.425 +	cmp.ne p8,p0=r0,r23
   4.426 +(p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
   4.427 +(p8)	br.cond.spnt page_fault
   4.428 +#ifdef XEN
   4.429 +	;;
   4.430 +	// FIXME: inadequate test, this is where we test for Xen address
   4.431 +	// note that 0xf000 (cached) and 0xd000 (uncached) addresses
   4.432 +	// should be OK.  (Though no I/O is done in Xen, EFI needs uncached
   4.433 +	// addresses and some domain EFI calls are passed through)
   4.434 +	tbit.nz p0,p8=r16,60
   4.435 +(p8)	br.cond.spnt page_fault
   4.436 +//(p8)	br.cond.spnt 0
   4.437 +	;;
   4.438 +#endif
   4.439 +
   4.440 +	dep r21=-1,r21,IA64_PSR_ED_BIT,1
   4.441 +	or r19=r19,r17		// insert PTE control bits into r19
   4.442 +	;;
   4.443 +	or r19=r19,r18		// set bit 4 (uncached) if the access was to region 6
   4.444 +(p6)	mov cr.ipsr=r21
   4.445 +	;;
   4.446 +(p7)	itc.d r19		// insert the TLB entry
   4.447 +	mov pr=r31,-1
   4.448 +	rfi
   4.449 +END(alt_dtlb_miss)
   4.450 +
   4.451 +	.org ia64_ivt+0x1400
   4.452 +/////////////////////////////////////////////////////////////////////////////////////////
   4.453 +// 0x1400 Entry 5 (size 64 bundles) Data nested TLB (6,45)
   4.454 +ENTRY(nested_dtlb_miss)
   4.455 +	/*
   4.456 +	 * In the absence of kernel bugs, we get here when the virtually mapped linear
   4.457 +	 * page table is accessed non-speculatively (e.g., in the Dirty-bit, Instruction
   4.458 +	 * Access-bit, or Data Access-bit faults).  If the DTLB entry for the virtual page
   4.459 +	 * table is missing, a nested TLB miss fault is triggered and control is
   4.460 +	 * transferred to this point.  When this happens, we lookup the pte for the
   4.461 +	 * faulting address by walking the page table in physical mode and return to the
   4.462 +	 * continuation point passed in register r30 (or call page_fault if the address is
   4.463 +	 * not mapped).
   4.464 +	 *
   4.465 +	 * Input:	r16:	faulting address
   4.466 +	 *		r29:	saved b0
   4.467 +	 *		r30:	continuation address
   4.468 +	 *		r31:	saved pr
   4.469 +	 *
   4.470 +	 * Output:	r17:	physical address of L3 PTE of faulting address
   4.471 +	 *		r29:	saved b0
   4.472 +	 *		r30:	continuation address
   4.473 +	 *		r31:	saved pr
   4.474 +	 *
   4.475 +	 * Clobbered:	b0, r18, r19, r21, psr.dt (cleared)
   4.476 +	 */
   4.477 +	rsm psr.dt				// switch to using physical data addressing
   4.478 +	mov r19=IA64_KR(PT_BASE)		// get the page table base address
   4.479 +	shl r21=r16,3				// shift bit 60 into sign bit
   4.480 +	;;
   4.481 +	shr.u r17=r16,61			// get the region number into r17
   4.482 +	;;
   4.483 +	cmp.eq p6,p7=5,r17			// is faulting address in region 5?
   4.484 +	shr.u r18=r16,PGDIR_SHIFT		// get bits 33-63 of faulting address
   4.485 +	;;
   4.486 +(p7)	dep r17=r17,r19,(PAGE_SHIFT-3),3	// put region number bits in place
   4.487 +
   4.488 +	srlz.d
   4.489 +	LOAD_PHYSICAL(p6, r19, swapper_pg_dir)	// region 5 is rooted at swapper_pg_dir
   4.490 +
   4.491 +	.pred.rel "mutex", p6, p7
   4.492 +(p6)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT
   4.493 +(p7)	shr.u r21=r21,PGDIR_SHIFT+PAGE_SHIFT-3
   4.494 +	;;
   4.495 +(p6)	dep r17=r18,r19,3,(PAGE_SHIFT-3)	// r17=PTA + IFA(33,42)*8
   4.496 +(p7)	dep r17=r18,r17,3,(PAGE_SHIFT-6)	// r17=PTA + (((IFA(61,63) << 7) | IFA(33,39))*8)
   4.497 +	cmp.eq p7,p6=0,r21			// unused address bits all zeroes?
   4.498 +	shr.u r18=r16,PMD_SHIFT			// shift L2 index into position
   4.499 +	;;
   4.500 +	ld8 r17=[r17]				// fetch the L1 entry (may be 0)
   4.501 +	;;
   4.502 +(p7)	cmp.eq p6,p7=r17,r0			// was L1 entry NULL?
   4.503 +	dep r17=r18,r17,3,(PAGE_SHIFT-3)	// compute address of L2 page table entry
   4.504 +	;;
   4.505 +(p7)	ld8 r17=[r17]				// fetch the L2 entry (may be 0)
   4.506 +	shr.u r19=r16,PAGE_SHIFT		// shift L3 index into position
   4.507 +	;;
   4.508 +(p7)	cmp.eq.or.andcm p6,p7=r17,r0		// was L2 entry NULL?
   4.509 +	dep r17=r19,r17,3,(PAGE_SHIFT-3)	// compute address of L3 page table entry
   4.510 +(p6)	br.cond.spnt page_fault
   4.511 +	mov b0=r30
   4.512 +	br.sptk.many b0				// return to continuation point
   4.513 +END(nested_dtlb_miss)
   4.514 +
   4.515 +	.org ia64_ivt+0x1800
   4.516 +/////////////////////////////////////////////////////////////////////////////////////////
   4.517 +// 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
   4.518 +ENTRY(ikey_miss)
   4.519 +#ifdef XEN
   4.520 +	REFLECT(6)
   4.521 +#endif
   4.522 +	DBG_FAULT(6)
   4.523 +	FAULT(6)
   4.524 +END(ikey_miss)
   4.525 +
   4.526 +	//-----------------------------------------------------------------------------------
   4.527 +	// call do_page_fault (predicates are in r31, psr.dt may be off, r16 is faulting address)
   4.528 +ENTRY(page_fault)
   4.529 +	ssm psr.dt
   4.530 +	;;
   4.531 +	srlz.i
   4.532 +	;;
   4.533 +	SAVE_MIN_WITH_COVER
   4.534 +#ifdef XEN
   4.535 +	alloc r15=ar.pfs,0,0,4,0
   4.536 +	mov out0=cr.ifa
   4.537 +	mov out1=cr.isr
   4.538 +	mov out3=cr.itir
   4.539 +#else
   4.540 +	alloc r15=ar.pfs,0,0,3,0
   4.541 +	mov out0=cr.ifa
   4.542 +	mov out1=cr.isr
   4.543 +#endif
   4.544 +	adds r3=8,r2				// set up second base pointer
   4.545 +	;;
   4.546 +	ssm psr.ic | PSR_DEFAULT_BITS
   4.547 +	;;
   4.548 +	srlz.i					// guarantee that interruption collectin is on
   4.549 +	;;
   4.550 +(p15)	ssm psr.i				// restore psr.i
   4.551 +	movl r14=ia64_leave_kernel
   4.552 +	;;
   4.553 +	SAVE_REST
   4.554 +	mov rp=r14
   4.555 +	;;
   4.556 +	adds out2=16,r12			// out2 = pointer to pt_regs
   4.557 +	br.call.sptk.many b6=ia64_do_page_fault	// ignore return address
   4.558 +END(page_fault)
   4.559 +
   4.560 +	.org ia64_ivt+0x1c00
   4.561 +/////////////////////////////////////////////////////////////////////////////////////////
   4.562 +// 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
   4.563 +ENTRY(dkey_miss)
   4.564 +#ifdef XEN
   4.565 +	REFLECT(7)
   4.566 +#endif
   4.567 +	DBG_FAULT(7)
   4.568 +	FAULT(7)
   4.569 +END(dkey_miss)
   4.570 +
   4.571 +	.org ia64_ivt+0x2000
   4.572 +/////////////////////////////////////////////////////////////////////////////////////////
   4.573 +// 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
   4.574 +ENTRY(dirty_bit)
   4.575 +#ifdef XEN
   4.576 +	REFLECT(8)
   4.577 +#endif
   4.578 +	DBG_FAULT(8)
   4.579 +	/*
   4.580 +	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
   4.581 +	 * update both the page-table and the TLB entry.  To efficiently access the PTE,
   4.582 +	 * we address it through the virtual page table.  Most likely, the TLB entry for
   4.583 +	 * the relevant virtual page table page is still present in the TLB so we can
   4.584 +	 * normally do this without additional TLB misses.  In case the necessary virtual
   4.585 +	 * page table TLB entry isn't present, we take a nested TLB miss hit where we look
   4.586 +	 * up the physical address of the L3 PTE and then continue at label 1 below.
   4.587 +	 */
   4.588 +	mov r16=cr.ifa				// get the address that caused the fault
   4.589 +	movl r30=1f				// load continuation point in case of nested fault
   4.590 +	;;
   4.591 +	thash r17=r16				// compute virtual address of L3 PTE
   4.592 +	mov r29=b0				// save b0 in case of nested fault
   4.593 +	mov r31=pr				// save pr
   4.594 +#ifdef CONFIG_SMP
   4.595 +	mov r28=ar.ccv				// save ar.ccv
   4.596 +	;;
   4.597 +1:	ld8 r18=[r17]
   4.598 +	;;					// avoid RAW on r18
   4.599 +	mov ar.ccv=r18				// set compare value for cmpxchg
   4.600 +	or r25=_PAGE_D|_PAGE_A,r18		// set the dirty and accessed bits
   4.601 +	;;
   4.602 +	cmpxchg8.acq r26=[r17],r25,ar.ccv
   4.603 +	mov r24=PAGE_SHIFT<<2
   4.604 +	;;
   4.605 +	cmp.eq p6,p7=r26,r18
   4.606 +	;;
   4.607 +(p6)	itc.d r25				// install updated PTE
   4.608 +	;;
   4.609 +	/*
   4.610 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.611 +	 * cannot possibly affect the following loads:
   4.612 +	 */
   4.613 +	dv_serialize_data
   4.614 +
   4.615 +	ld8 r18=[r17]				// read PTE again
   4.616 +	;;
   4.617 +	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
   4.618 +	;;
   4.619 +(p7)	ptc.l r16,r24
   4.620 +	mov b0=r29				// restore b0
   4.621 +	mov ar.ccv=r28
   4.622 +#else
   4.623 +	;;
   4.624 +1:	ld8 r18=[r17]
   4.625 +	;;					// avoid RAW on r18
   4.626 +	or r18=_PAGE_D|_PAGE_A,r18		// set the dirty and accessed bits
   4.627 +	mov b0=r29				// restore b0
   4.628 +	;;
   4.629 +	st8 [r17]=r18				// store back updated PTE
   4.630 +	itc.d r18				// install updated PTE
   4.631 +#endif
   4.632 +	mov pr=r31,-1				// restore pr
   4.633 +	rfi
   4.634 +END(dirty_bit)
   4.635 +
   4.636 +	.org ia64_ivt+0x2400
   4.637 +/////////////////////////////////////////////////////////////////////////////////////////
   4.638 +// 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
   4.639 +ENTRY(iaccess_bit)
   4.640 +#ifdef XEN
   4.641 +	REFLECT(9)
   4.642 +#endif
   4.643 +	DBG_FAULT(9)
   4.644 +	// Like Entry 8, except for instruction access
   4.645 +	mov r16=cr.ifa				// get the address that caused the fault
   4.646 +	movl r30=1f				// load continuation point in case of nested fault
   4.647 +	mov r31=pr				// save predicates
   4.648 +#ifdef CONFIG_ITANIUM
   4.649 +	/*
   4.650 +	 * Erratum 10 (IFA may contain incorrect address) has "NoFix" status.
   4.651 +	 */
   4.652 +	mov r17=cr.ipsr
   4.653 +	;;
   4.654 +	mov r18=cr.iip
   4.655 +	tbit.z p6,p0=r17,IA64_PSR_IS_BIT	// IA64 instruction set?
   4.656 +	;;
   4.657 +(p6)	mov r16=r18				// if so, use cr.iip instead of cr.ifa
   4.658 +#endif /* CONFIG_ITANIUM */
   4.659 +	;;
   4.660 +	thash r17=r16				// compute virtual address of L3 PTE
   4.661 +	mov r29=b0				// save b0 in case of nested fault)
   4.662 +#ifdef CONFIG_SMP
   4.663 +	mov r28=ar.ccv				// save ar.ccv
   4.664 +	;;
   4.665 +1:	ld8 r18=[r17]
   4.666 +	;;
   4.667 +	mov ar.ccv=r18				// set compare value for cmpxchg
   4.668 +	or r25=_PAGE_A,r18			// set the accessed bit
   4.669 +	;;
   4.670 +	cmpxchg8.acq r26=[r17],r25,ar.ccv
   4.671 +	mov r24=PAGE_SHIFT<<2
   4.672 +	;;
   4.673 +	cmp.eq p6,p7=r26,r18
   4.674 +	;;
   4.675 +(p6)	itc.i r25				// install updated PTE
   4.676 +	;;
   4.677 +	/*
   4.678 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.679 +	 * cannot possibly affect the following loads:
   4.680 +	 */
   4.681 +	dv_serialize_data
   4.682 +
   4.683 +	ld8 r18=[r17]				// read PTE again
   4.684 +	;;
   4.685 +	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
   4.686 +	;;
   4.687 +(p7)	ptc.l r16,r24
   4.688 +	mov b0=r29				// restore b0
   4.689 +	mov ar.ccv=r28
   4.690 +#else /* !CONFIG_SMP */
   4.691 +	;;
   4.692 +1:	ld8 r18=[r17]
   4.693 +	;;
   4.694 +	or r18=_PAGE_A,r18			// set the accessed bit
   4.695 +	mov b0=r29				// restore b0
   4.696 +	;;
   4.697 +	st8 [r17]=r18				// store back updated PTE
   4.698 +	itc.i r18				// install updated PTE
   4.699 +#endif /* !CONFIG_SMP */
   4.700 +	mov pr=r31,-1
   4.701 +	rfi
   4.702 +END(iaccess_bit)
   4.703 +
   4.704 +	.org ia64_ivt+0x2800
   4.705 +/////////////////////////////////////////////////////////////////////////////////////////
   4.706 +// 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
   4.707 +ENTRY(daccess_bit)
   4.708 +#ifdef XEN
   4.709 +	REFLECT(10)
   4.710 +#endif
   4.711 +	DBG_FAULT(10)
   4.712 +	// Like Entry 8, except for data access
   4.713 +	mov r16=cr.ifa				// get the address that caused the fault
   4.714 +	movl r30=1f				// load continuation point in case of nested fault
   4.715 +	;;
   4.716 +	thash r17=r16				// compute virtual address of L3 PTE
   4.717 +	mov r31=pr
   4.718 +	mov r29=b0				// save b0 in case of nested fault)
   4.719 +#ifdef CONFIG_SMP
   4.720 +	mov r28=ar.ccv				// save ar.ccv
   4.721 +	;;
   4.722 +1:	ld8 r18=[r17]
   4.723 +	;;					// avoid RAW on r18
   4.724 +	mov ar.ccv=r18				// set compare value for cmpxchg
   4.725 +	or r25=_PAGE_A,r18			// set the dirty bit
   4.726 +	;;
   4.727 +	cmpxchg8.acq r26=[r17],r25,ar.ccv
   4.728 +	mov r24=PAGE_SHIFT<<2
   4.729 +	;;
   4.730 +	cmp.eq p6,p7=r26,r18
   4.731 +	;;
   4.732 +(p6)	itc.d r25				// install updated PTE
   4.733 +	/*
   4.734 +	 * Tell the assemblers dependency-violation checker that the above "itc" instructions
   4.735 +	 * cannot possibly affect the following loads:
   4.736 +	 */
   4.737 +	dv_serialize_data
   4.738 +	;;
   4.739 +	ld8 r18=[r17]				// read PTE again
   4.740 +	;;
   4.741 +	cmp.eq p6,p7=r18,r25			// is it same as the newly installed
   4.742 +	;;
   4.743 +(p7)	ptc.l r16,r24
   4.744 +	mov ar.ccv=r28
   4.745 +#else
   4.746 +	;;
   4.747 +1:	ld8 r18=[r17]
   4.748 +	;;					// avoid RAW on r18
   4.749 +	or r18=_PAGE_A,r18			// set the accessed bit
   4.750 +	;;
   4.751 +	st8 [r17]=r18				// store back updated PTE
   4.752 +	itc.d r18				// install updated PTE
   4.753 +#endif
   4.754 +	mov b0=r29				// restore b0
   4.755 +	mov pr=r31,-1
   4.756 +	rfi
   4.757 +END(daccess_bit)
   4.758 +
   4.759 +	.org ia64_ivt+0x2c00
   4.760 +/////////////////////////////////////////////////////////////////////////////////////////
   4.761 +// 0x2c00 Entry 11 (size 64 bundles) Break instruction (33)
   4.762 +ENTRY(break_fault)
   4.763 +	/*
   4.764 +	 * The streamlined system call entry/exit paths only save/restore the initial part
   4.765 +	 * of pt_regs.  This implies that the callers of system-calls must adhere to the
   4.766 +	 * normal procedure calling conventions.
   4.767 +	 *
   4.768 +	 *   Registers to be saved & restored:
   4.769 +	 *	CR registers: cr.ipsr, cr.iip, cr.ifs
   4.770 +	 *	AR registers: ar.unat, ar.pfs, ar.rsc, ar.rnat, ar.bspstore, ar.fpsr
   4.771 +	 * 	others: pr, b0, b6, loadrs, r1, r11, r12, r13, r15
   4.772 +	 *   Registers to be restored only:
   4.773 +	 * 	r8-r11: output value from the system call.
   4.774 +	 *
   4.775 +	 * During system call exit, scratch registers (including r15) are modified/cleared
   4.776 +	 * to prevent leaking bits from kernel to user level.
   4.777 +	 */
   4.778 +	DBG_FAULT(11)
   4.779 +#ifdef XEN
   4.780 +	mov r16=cr.isr
   4.781 +	mov r17=cr.iim
   4.782 +	mov r31=pr
   4.783 +	;;
   4.784 +	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
   4.785 +	// FIXME: may also need to check slot==2?
   4.786 +(p7)	br.sptk.many dispatch_privop_fault
   4.787 +	br.sptk.many dispatch_break_fault
   4.788 +#endif
   4.789 +	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
   4.790 +	mov r17=cr.iim
   4.791 +	mov r18=__IA64_BREAK_SYSCALL
   4.792 +	mov r21=ar.fpsr
   4.793 +	mov r29=cr.ipsr
   4.794 +	mov r19=b6
   4.795 +	mov r25=ar.unat
   4.796 +	mov r27=ar.rsc
   4.797 +	mov r26=ar.pfs
   4.798 +	mov r28=cr.iip
   4.799 +#ifndef XEN
   4.800 +	mov r31=pr				// prepare to save predicates
   4.801 +#endif
   4.802 +	mov r20=r1
   4.803 +	;;
   4.804 +	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
   4.805 +	cmp.eq p0,p7=r18,r17			// is this a system call? (p7 <- false, if so)
   4.806 +(p7)	br.cond.spnt non_syscall
   4.807 +	;;
   4.808 +	ld1 r17=[r16]				// load current->thread.on_ustack flag
   4.809 +	st1 [r16]=r0				// clear current->thread.on_ustack flag
   4.810 +	add r1=-IA64_TASK_THREAD_ON_USTACK_OFFSET,r16	// set r1 for MINSTATE_START_SAVE_MIN_VIRT
   4.811 +	;;
   4.812 +	invala
   4.813 +
   4.814 +	/* adjust return address so we skip over the break instruction: */
   4.815 +
   4.816 +	extr.u r8=r29,41,2			// extract ei field from cr.ipsr
   4.817 +	;;
   4.818 +	cmp.eq p6,p7=2,r8			// isr.ei==2?
   4.819 +	mov r2=r1				// setup r2 for ia64_syscall_setup
   4.820 +	;;
   4.821 +(p6)	mov r8=0				// clear ei to 0
   4.822 +(p6)	adds r28=16,r28				// switch cr.iip to next bundle cr.ipsr.ei wrapped
   4.823 +(p7)	adds r8=1,r8				// increment ei to next slot
   4.824 +	;;
   4.825 +	cmp.eq pKStk,pUStk=r0,r17		// are we in kernel mode already?
   4.826 +	dep r29=r8,r29,41,2			// insert new ei into cr.ipsr
   4.827 +	;;
   4.828 +
   4.829 +	// switch from user to kernel RBS:
   4.830 +	MINSTATE_START_SAVE_MIN_VIRT
   4.831 +	br.call.sptk.many b7=ia64_syscall_setup
   4.832 +	;;
   4.833 +	MINSTATE_END_SAVE_MIN_VIRT		// switch to bank 1
   4.834 +	ssm psr.ic | PSR_DEFAULT_BITS
   4.835 +	;;
   4.836 +	srlz.i					// guarantee that interruption collection is on
   4.837 +	mov r3=NR_syscalls - 1
   4.838 +	;;
   4.839 +(p15)	ssm psr.i				// restore psr.i
   4.840 +	// p10==true means out registers are more than 8 or r15's Nat is true
   4.841 +(p10)	br.cond.spnt.many ia64_ret_from_syscall
   4.842 +	;;
   4.843 +	movl r16=sys_call_table
   4.844 +
   4.845 +	adds r15=-1024,r15			// r15 contains the syscall number---subtract 1024
   4.846 +	movl r2=ia64_ret_from_syscall
   4.847 +	;;
   4.848 +	shladd r20=r15,3,r16			// r20 = sys_call_table + 8*(syscall-1024)
   4.849 +	cmp.leu p6,p7=r15,r3			// (syscall > 0 && syscall < 1024 + NR_syscalls) ?
   4.850 +	mov rp=r2				// set the real return addr
   4.851 +	;;
   4.852 +(p6)	ld8 r20=[r20]				// load address of syscall entry point
   4.853 +(p7)	movl r20=sys_ni_syscall
   4.854 +
   4.855 +	add r2=TI_FLAGS+IA64_TASK_SIZE,r13
   4.856 +	;;
   4.857 +	ld4 r2=[r2]				// r2 = current_thread_info()->flags
   4.858 +	;;
   4.859 +	and r2=_TIF_SYSCALL_TRACEAUDIT,r2	// mask trace or audit
   4.860 +	;;
   4.861 +	cmp.eq p8,p0=r2,r0
   4.862 +	mov b6=r20
   4.863 +	;;
   4.864 +(p8)	br.call.sptk.many b6=b6			// ignore this return addr
   4.865 +	br.cond.sptk ia64_trace_syscall
   4.866 +	// NOT REACHED
   4.867 +END(break_fault)
   4.868 +
   4.869 +	.org ia64_ivt+0x3000
   4.870 +/////////////////////////////////////////////////////////////////////////////////////////
   4.871 +// 0x3000 Entry 12 (size 64 bundles) External Interrupt (4)
   4.872 +ENTRY(interrupt)
   4.873 +	DBG_FAULT(12)
   4.874 +	mov r31=pr		// prepare to save predicates
   4.875 +	;;
   4.876 +	SAVE_MIN_WITH_COVER	// uses r31; defines r2 and r3
   4.877 +	ssm psr.ic | PSR_DEFAULT_BITS
   4.878 +	;;
   4.879 +	adds r3=8,r2		// set up second base pointer for SAVE_REST
   4.880 +	srlz.i			// ensure everybody knows psr.ic is back on
   4.881 +	;;
   4.882 +	SAVE_REST
   4.883 +	;;
   4.884 +	alloc r14=ar.pfs,0,0,2,0 // must be first in an insn group
   4.885 +	mov out0=cr.ivr		// pass cr.ivr as first arg
   4.886 +	add out1=16,sp		// pass pointer to pt_regs as second arg
   4.887 +	;;
   4.888 +	srlz.d			// make sure we see the effect of cr.ivr
   4.889 +	movl r14=ia64_leave_kernel
   4.890 +	;;
   4.891 +	mov rp=r14
   4.892 +	br.call.sptk.many b6=ia64_handle_irq
   4.893 +END(interrupt)
   4.894 +
   4.895 +	.org ia64_ivt+0x3400
   4.896 +/////////////////////////////////////////////////////////////////////////////////////////
   4.897 +// 0x3400 Entry 13 (size 64 bundles) Reserved
   4.898 +	DBG_FAULT(13)
   4.899 +	FAULT(13)
   4.900 +
   4.901 +#ifdef XEN
   4.902 +	// There is no particular reason for this code to be here, other than that
   4.903 +	// there happens to be space here that would go unused otherwise.  If this
   4.904 +	// fault ever gets "unreserved", simply moved the following code to a more
   4.905 +	// suitable spot...
   4.906 +
   4.907 +ENTRY(dispatch_break_fault)
   4.908 +	SAVE_MIN_WITH_COVER
   4.909 +	;;
   4.910 +	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
   4.911 +	mov out0=cr.ifa
   4.912 +	adds out1=16,sp
   4.913 +	mov out2=cr.isr		// FIXME: pity to make this slow access twice
   4.914 +	mov out3=cr.iim		// FIXME: pity to make this slow access twice
   4.915 +
   4.916 +	ssm psr.ic | PSR_DEFAULT_BITS
   4.917 +	;;
   4.918 +	srlz.i					// guarantee that interruption collection is on
   4.919 +	;;
   4.920 +(p15)	ssm psr.i				// restore psr.i
   4.921 +	adds r3=8,r2				// set up second base pointer
   4.922 +	;;
   4.923 +	SAVE_REST
   4.924 +	movl r14=ia64_leave_kernel
   4.925 +	;;
   4.926 +	mov rp=r14
   4.927 +	br.sptk.many ia64_prepare_handle_break
   4.928 +END(dispatch_break_fault)
   4.929 +#endif
   4.930 +
   4.931 +	.org ia64_ivt+0x3800
   4.932 +/////////////////////////////////////////////////////////////////////////////////////////
   4.933 +// 0x3800 Entry 14 (size 64 bundles) Reserved
   4.934 +	DBG_FAULT(14)
   4.935 +	FAULT(14)
   4.936 +
   4.937 +	/*
   4.938 +	 * There is no particular reason for this code to be here, other than that
   4.939 +	 * there happens to be space here that would go unused otherwise.  If this
   4.940 +	 * fault ever gets "unreserved", simply moved the following code to a more
   4.941 +	 * suitable spot...
   4.942 +	 *
   4.943 +	 * ia64_syscall_setup() is a separate subroutine so that it can
   4.944 +	 *	allocate stacked registers so it can safely demine any
   4.945 +	 *	potential NaT values from the input registers.
   4.946 +	 *
   4.947 +	 * On entry:
   4.948 +	 *	- executing on bank 0 or bank 1 register set (doesn't matter)
   4.949 +	 *	-  r1: stack pointer
   4.950 +	 *	-  r2: current task pointer
   4.951 +	 *	-  r3: preserved
   4.952 +	 *	- r11: original contents (saved ar.pfs to be saved)
   4.953 +	 *	- r12: original contents (sp to be saved)
   4.954 +	 *	- r13: original contents (tp to be saved)
   4.955 +	 *	- r15: original contents (syscall # to be saved)
   4.956 +	 *	- r18: saved bsp (after switching to kernel stack)
   4.957 +	 *	- r19: saved b6
   4.958 +	 *	- r20: saved r1 (gp)
   4.959 +	 *	- r21: saved ar.fpsr
   4.960 +	 *	- r22: kernel's register backing store base (krbs_base)
   4.961 +	 *	- r23: saved ar.bspstore
   4.962 +	 *	- r24: saved ar.rnat
   4.963 +	 *	- r25: saved ar.unat
   4.964 +	 *	- r26: saved ar.pfs
   4.965 +	 *	- r27: saved ar.rsc
   4.966 +	 *	- r28: saved cr.iip
   4.967 +	 *	- r29: saved cr.ipsr
   4.968 +	 *	- r31: saved pr
   4.969 +	 *	-  b0: original contents (to be saved)
   4.970 +	 * On exit:
   4.971 +	 *	- executing on bank 1 registers
   4.972 +	 *	- psr.ic enabled, interrupts restored
   4.973 +	 *	-  p10: TRUE if syscall is invoked with more than 8 out
   4.974 +	 *		registers or r15's Nat is true
   4.975 +	 *	-  r1: kernel's gp
   4.976 +	 *	-  r3: preserved (same as on entry)
   4.977 +	 *	-  r8: -EINVAL if p10 is true
   4.978 +	 *	- r12: points to kernel stack
   4.979 +	 *	- r13: points to current task
   4.980 +	 *	- p15: TRUE if interrupts need to be re-enabled
   4.981 +	 *	- ar.fpsr: set to kernel settings
   4.982 +	 */
   4.983 +GLOBAL_ENTRY(ia64_syscall_setup)
   4.984 +#ifndef XEN
   4.985 +#if PT(B6) != 0
   4.986 +# error This code assumes that b6 is the first field in pt_regs.
   4.987 +#endif
   4.988 +#endif
   4.989 +	st8 [r1]=r19				// save b6
   4.990 +	add r16=PT(CR_IPSR),r1			// initialize first base pointer
   4.991 +	add r17=PT(R11),r1			// initialize second base pointer
   4.992 +	;;
   4.993 +	alloc r19=ar.pfs,8,0,0,0		// ensure in0-in7 are writable
   4.994 +	st8 [r16]=r29,PT(AR_PFS)-PT(CR_IPSR)	// save cr.ipsr
   4.995 +	tnat.nz p8,p0=in0
   4.996 +
   4.997 +	st8.spill [r17]=r11,PT(CR_IIP)-PT(R11)	// save r11
   4.998 +	tnat.nz p9,p0=in1
   4.999 +(pKStk)	mov r18=r0				// make sure r18 isn't NaT
  4.1000 +	;;
  4.1001 +
  4.1002 +	st8 [r16]=r26,PT(CR_IFS)-PT(AR_PFS)	// save ar.pfs
  4.1003 +	st8 [r17]=r28,PT(AR_UNAT)-PT(CR_IIP)	// save cr.iip
  4.1004 +	mov r28=b0				// save b0 (2 cyc)
  4.1005 +	;;
  4.1006 +
  4.1007 +	st8 [r17]=r25,PT(AR_RSC)-PT(AR_UNAT)	// save ar.unat
  4.1008 +	dep r19=0,r19,38,26			// clear all bits but 0..37 [I0]
  4.1009 +(p8)	mov in0=-1
  4.1010 +	;;
  4.1011 +
  4.1012 +	st8 [r16]=r19,PT(AR_RNAT)-PT(CR_IFS)	// store ar.pfs.pfm in cr.ifs
  4.1013 +	extr.u r11=r19,7,7	// I0		// get sol of ar.pfs
  4.1014 +	and r8=0x7f,r19		// A		// get sof of ar.pfs
  4.1015 +
  4.1016 +	st8 [r17]=r27,PT(AR_BSPSTORE)-PT(AR_RSC)// save ar.rsc
  4.1017 +	tbit.nz p15,p0=r29,IA64_PSR_I_BIT // I0
  4.1018 +(p9)	mov in1=-1
  4.1019 +	;;
  4.1020 +
  4.1021 +(pUStk) sub r18=r18,r22				// r18=RSE.ndirty*8
  4.1022 +	tnat.nz p10,p0=in2
  4.1023 +	add r11=8,r11
  4.1024 +	;;
  4.1025 +(pKStk) adds r16=PT(PR)-PT(AR_RNAT),r16		// skip over ar_rnat field
  4.1026 +(pKStk) adds r17=PT(B0)-PT(AR_BSPSTORE),r17	// skip over ar_bspstore field
  4.1027 +	tnat.nz p11,p0=in3
  4.1028 +	;;
  4.1029 +(p10)	mov in2=-1
  4.1030 +	tnat.nz p12,p0=in4				// [I0]
  4.1031 +(p11)	mov in3=-1
  4.1032 +	;;
  4.1033 +(pUStk) st8 [r16]=r24,PT(PR)-PT(AR_RNAT)	// save ar.rnat
  4.1034 +(pUStk) st8 [r17]=r23,PT(B0)-PT(AR_BSPSTORE)	// save ar.bspstore
  4.1035 +	shl r18=r18,16				// compute ar.rsc to be used for "loadrs"
  4.1036 +	;;
  4.1037 +	st8 [r16]=r31,PT(LOADRS)-PT(PR)		// save predicates
  4.1038 +	st8 [r17]=r28,PT(R1)-PT(B0)		// save b0
  4.1039 +	tnat.nz p13,p0=in5				// [I0]
  4.1040 +	;;
  4.1041 +	st8 [r16]=r18,PT(R12)-PT(LOADRS)	// save ar.rsc value for "loadrs"
  4.1042 +	st8.spill [r17]=r20,PT(R13)-PT(R1)	// save original r1
  4.1043 +(p12)	mov in4=-1
  4.1044 +	;;
  4.1045 +
  4.1046 +.mem.offset 0,0; st8.spill [r16]=r12,PT(AR_FPSR)-PT(R12)	// save r12
  4.1047 +.mem.offset 8,0; st8.spill [r17]=r13,PT(R15)-PT(R13)		// save r13
  4.1048 +(p13)	mov in5=-1
  4.1049 +	;;
  4.1050 +	st8 [r16]=r21,PT(R8)-PT(AR_FPSR)	// save ar.fpsr
  4.1051 +	tnat.nz p14,p0=in6
  4.1052 +	cmp.lt p10,p9=r11,r8	// frame size can't be more than local+8
  4.1053 +	;;
  4.1054 +	stf8 [r16]=f1		// ensure pt_regs.r8 != 0 (see handle_syscall_error)
  4.1055 +(p9)	tnat.nz p10,p0=r15
  4.1056 +	adds r12=-16,r1		// switch to kernel memory stack (with 16 bytes of scratch)
  4.1057 +
  4.1058 +	st8.spill [r17]=r15			// save r15
  4.1059 +	tnat.nz p8,p0=in7
  4.1060 +	nop.i 0
  4.1061 +
  4.1062 +	mov r13=r2				// establish `current'
  4.1063 +	movl r1=__gp				// establish kernel global pointer
  4.1064 +	;;
  4.1065 +(p14)	mov in6=-1
  4.1066 +(p8)	mov in7=-1
  4.1067 +	nop.i 0
  4.1068 +
  4.1069 +	cmp.eq pSys,pNonSys=r0,r0		// set pSys=1, pNonSys=0
  4.1070 +	movl r17=FPSR_DEFAULT
  4.1071 +	;;
  4.1072 +	mov.m ar.fpsr=r17			// set ar.fpsr to kernel default value
  4.1073 +(p10)	mov r8=-EINVAL
  4.1074 +	br.ret.sptk.many b7
  4.1075 +END(ia64_syscall_setup)
  4.1076 +
  4.1077 +	.org ia64_ivt+0x3c00
  4.1078 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1079 +// 0x3c00 Entry 15 (size 64 bundles) Reserved
  4.1080 +	DBG_FAULT(15)
  4.1081 +	FAULT(15)
  4.1082 +
  4.1083 +	/*
  4.1084 +	 * Squatting in this space ...
  4.1085 +	 *
  4.1086 +	 * This special case dispatcher for illegal operation faults allows preserved
  4.1087 +	 * registers to be modified through a callback function (asm only) that is handed
  4.1088 +	 * back from the fault handler in r8. Up to three arguments can be passed to the
  4.1089 +	 * callback function by returning an aggregate with the callback as its first
  4.1090 +	 * element, followed by the arguments.
  4.1091 +	 */
  4.1092 +ENTRY(dispatch_illegal_op_fault)
  4.1093 +	SAVE_MIN_WITH_COVER
  4.1094 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1095 +	;;
  4.1096 +	srlz.i		// guarantee that interruption collection is on
  4.1097 +	;;
  4.1098 +(p15)	ssm psr.i	// restore psr.i
  4.1099 +	adds r3=8,r2	// set up second base pointer for SAVE_REST
  4.1100 +	;;
  4.1101 +	alloc r14=ar.pfs,0,0,1,0	// must be first in insn group
  4.1102 +	mov out0=ar.ec
  4.1103 +	;;
  4.1104 +	SAVE_REST
  4.1105 +	;;
  4.1106 +	br.call.sptk.many rp=ia64_illegal_op_fault
  4.1107 +.ret0:	;;
  4.1108 +	alloc r14=ar.pfs,0,0,3,0	// must be first in insn group
  4.1109 +	mov out0=r9
  4.1110 +	mov out1=r10
  4.1111 +	mov out2=r11
  4.1112 +	movl r15=ia64_leave_kernel
  4.1113 +	;;
  4.1114 +	mov rp=r15
  4.1115 +	mov b6=r8
  4.1116 +	;;
  4.1117 +	cmp.ne p6,p0=0,r8
  4.1118 +(p6)	br.call.dpnt.many b6=b6		// call returns to ia64_leave_kernel
  4.1119 +	br.sptk.many ia64_leave_kernel
  4.1120 +END(dispatch_illegal_op_fault)
  4.1121 +
  4.1122 +	.org ia64_ivt+0x4000
  4.1123 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1124 +// 0x4000 Entry 16 (size 64 bundles) Reserved
  4.1125 +	DBG_FAULT(16)
  4.1126 +	FAULT(16)
  4.1127 +
  4.1128 +#ifdef XEN
  4.1129 +	// There is no particular reason for this code to be here, other than that
  4.1130 +	// there happens to be space here that would go unused otherwise.  If this
  4.1131 +	// fault ever gets "unreserved", simply moved the following code to a more
  4.1132 +	// suitable spot...
  4.1133 +
  4.1134 +ENTRY(dispatch_privop_fault)
  4.1135 +	SAVE_MIN_WITH_COVER
  4.1136 +	;;
  4.1137 +	alloc r14=ar.pfs,0,0,4,0		// now it's safe (must be first in insn group!)
  4.1138 +	mov out0=cr.ifa
  4.1139 +	adds out1=16,sp
  4.1140 +	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  4.1141 +	mov out3=cr.itir
  4.1142 +
  4.1143 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1144 +	;;
  4.1145 +	srlz.i					// guarantee that interruption collection is on
  4.1146 +	;;
  4.1147 +(p15)	ssm psr.i				// restore psr.i
  4.1148 +	adds r3=8,r2				// set up second base pointer
  4.1149 +	;;
  4.1150 +	SAVE_REST
  4.1151 +	movl r14=ia64_leave_kernel
  4.1152 +	;;
  4.1153 +	mov rp=r14
  4.1154 +	br.sptk.many ia64_prepare_handle_privop
  4.1155 +END(dispatch_privop_fault)
  4.1156 +#endif
  4.1157 +
  4.1158 +
  4.1159 +	.org ia64_ivt+0x4400
  4.1160 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1161 +// 0x4400 Entry 17 (size 64 bundles) Reserved
  4.1162 +	DBG_FAULT(17)
  4.1163 +	FAULT(17)
  4.1164 +
  4.1165 +ENTRY(non_syscall)
  4.1166 +	SAVE_MIN_WITH_COVER
  4.1167 +
  4.1168 +	// There is no particular reason for this code to be here, other than that
  4.1169 +	// there happens to be space here that would go unused otherwise.  If this
  4.1170 +	// fault ever gets "unreserved", simply moved the following code to a more
  4.1171 +	// suitable spot...
  4.1172 +
  4.1173 +	alloc r14=ar.pfs,0,0,2,0
  4.1174 +	mov out0=cr.iim
  4.1175 +	add out1=16,sp
  4.1176 +	adds r3=8,r2			// set up second base pointer for SAVE_REST
  4.1177 +
  4.1178 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1179 +	;;
  4.1180 +	srlz.i				// guarantee that interruption collection is on
  4.1181 +	;;
  4.1182 +(p15)	ssm psr.i			// restore psr.i
  4.1183 +	movl r15=ia64_leave_kernel
  4.1184 +	;;
  4.1185 +	SAVE_REST
  4.1186 +	mov rp=r15
  4.1187 +	;;
  4.1188 +	br.call.sptk.many b6=ia64_bad_break	// avoid WAW on CFM and ignore return addr
  4.1189 +END(non_syscall)
  4.1190 +
  4.1191 +	.org ia64_ivt+0x4800
  4.1192 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1193 +// 0x4800 Entry 18 (size 64 bundles) Reserved
  4.1194 +	DBG_FAULT(18)
  4.1195 +	FAULT(18)
  4.1196 +
  4.1197 +	/*
  4.1198 +	 * There is no particular reason for this code to be here, other than that
  4.1199 +	 * there happens to be space here that would go unused otherwise.  If this
  4.1200 +	 * fault ever gets "unreserved", simply moved the following code to a more
  4.1201 +	 * suitable spot...
  4.1202 +	 */
  4.1203 +
  4.1204 +ENTRY(dispatch_unaligned_handler)
  4.1205 +	SAVE_MIN_WITH_COVER
  4.1206 +	;;
  4.1207 +	alloc r14=ar.pfs,0,0,2,0		// now it's safe (must be first in insn group!)
  4.1208 +	mov out0=cr.ifa
  4.1209 +	adds out1=16,sp
  4.1210 +
  4.1211 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1212 +	;;
  4.1213 +	srlz.i					// guarantee that interruption collection is on
  4.1214 +	;;
  4.1215 +(p15)	ssm psr.i				// restore psr.i
  4.1216 +	adds r3=8,r2				// set up second base pointer
  4.1217 +	;;
  4.1218 +	SAVE_REST
  4.1219 +	movl r14=ia64_leave_kernel
  4.1220 +	;;
  4.1221 +	mov rp=r14
  4.1222 +	br.sptk.many ia64_prepare_handle_unaligned
  4.1223 +END(dispatch_unaligned_handler)
  4.1224 +
  4.1225 +	.org ia64_ivt+0x4c00
  4.1226 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1227 +// 0x4c00 Entry 19 (size 64 bundles) Reserved
  4.1228 +	DBG_FAULT(19)
  4.1229 +	FAULT(19)
  4.1230 +
  4.1231 +	/*
  4.1232 +	 * There is no particular reason for this code to be here, other than that
  4.1233 +	 * there happens to be space here that would go unused otherwise.  If this
  4.1234 +	 * fault ever gets "unreserved", simply moved the following code to a more
  4.1235 +	 * suitable spot...
  4.1236 +	 */
  4.1237 +
  4.1238 +ENTRY(dispatch_to_fault_handler)
  4.1239 +	/*
  4.1240 +	 * Input:
  4.1241 +	 *	psr.ic:	off
  4.1242 +	 *	r19:	fault vector number (e.g., 24 for General Exception)
  4.1243 +	 *	r31:	contains saved predicates (pr)
  4.1244 +	 */
  4.1245 +	SAVE_MIN_WITH_COVER_R19
  4.1246 +	alloc r14=ar.pfs,0,0,5,0
  4.1247 +	mov out0=r15
  4.1248 +	mov out1=cr.isr
  4.1249 +	mov out2=cr.ifa
  4.1250 +	mov out3=cr.iim
  4.1251 +	mov out4=cr.itir
  4.1252 +	;;
  4.1253 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1254 +	;;
  4.1255 +	srlz.i					// guarantee that interruption collection is on
  4.1256 +	;;
  4.1257 +(p15)	ssm psr.i				// restore psr.i
  4.1258 +	adds r3=8,r2				// set up second base pointer for SAVE_REST
  4.1259 +	;;
  4.1260 +	SAVE_REST
  4.1261 +	movl r14=ia64_leave_kernel
  4.1262 +	;;
  4.1263 +	mov rp=r14
  4.1264 +	br.call.sptk.many b6=ia64_fault
  4.1265 +END(dispatch_to_fault_handler)
  4.1266 +
  4.1267 +//
  4.1268 +// --- End of long entries, Beginning of short entries
  4.1269 +//
  4.1270 +
  4.1271 +	.org ia64_ivt+0x5000
  4.1272 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1273 +// 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
  4.1274 +ENTRY(page_not_present)
  4.1275 +#ifdef XEN
  4.1276 +	REFLECT(20)
  4.1277 +#endif
  4.1278 +	DBG_FAULT(20)
  4.1279 +	mov r16=cr.ifa
  4.1280 +	rsm psr.dt
  4.1281 +	/*
  4.1282 +	 * The Linux page fault handler doesn't expect non-present pages to be in
  4.1283 +	 * the TLB.  Flush the existing entry now, so we meet that expectation.
  4.1284 +	 */
  4.1285 +	mov r17=PAGE_SHIFT<<2
  4.1286 +	;;
  4.1287 +	ptc.l r16,r17
  4.1288 +	;;
  4.1289 +	mov r31=pr
  4.1290 +	srlz.d
  4.1291 +	br.sptk.many page_fault
  4.1292 +END(page_not_present)
  4.1293 +
  4.1294 +	.org ia64_ivt+0x5100
  4.1295 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1296 +// 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
  4.1297 +ENTRY(key_permission)
  4.1298 +#ifdef XEN
  4.1299 +	REFLECT(21)
  4.1300 +#endif
  4.1301 +	DBG_FAULT(21)
  4.1302 +	mov r16=cr.ifa
  4.1303 +	rsm psr.dt
  4.1304 +	mov r31=pr
  4.1305 +	;;
  4.1306 +	srlz.d
  4.1307 +	br.sptk.many page_fault
  4.1308 +END(key_permission)
  4.1309 +
  4.1310 +	.org ia64_ivt+0x5200
  4.1311 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1312 +// 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
  4.1313 +ENTRY(iaccess_rights)
  4.1314 +#ifdef XEN
  4.1315 +	REFLECT(22)
  4.1316 +#endif
  4.1317 +	DBG_FAULT(22)
  4.1318 +	mov r16=cr.ifa
  4.1319 +	rsm psr.dt
  4.1320 +	mov r31=pr
  4.1321 +	;;
  4.1322 +	srlz.d
  4.1323 +	br.sptk.many page_fault
  4.1324 +END(iaccess_rights)
  4.1325 +
  4.1326 +	.org ia64_ivt+0x5300
  4.1327 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1328 +// 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
  4.1329 +ENTRY(daccess_rights)
  4.1330 +#ifdef XEN
  4.1331 +	REFLECT(23)
  4.1332 +#endif
  4.1333 +	DBG_FAULT(23)
  4.1334 +	mov r16=cr.ifa
  4.1335 +	rsm psr.dt
  4.1336 +	mov r31=pr
  4.1337 +	;;
  4.1338 +	srlz.d
  4.1339 +	br.sptk.many page_fault
  4.1340 +END(daccess_rights)
  4.1341 +
  4.1342 +	.org ia64_ivt+0x5400
  4.1343 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1344 +// 0x5400 Entry 24 (size 16 bundles) General Exception (5,32,34,36,38,39)
  4.1345 +ENTRY(general_exception)
  4.1346 +	DBG_FAULT(24)
  4.1347 +	mov r16=cr.isr
  4.1348 +	mov r31=pr
  4.1349 +	;;
  4.1350 +#ifdef XEN
  4.1351 +	cmp4.ge p6,p0=0x20,r16
  4.1352 +(p6)	br.sptk.many dispatch_privop_fault
  4.1353 +#else
  4.1354 +	cmp4.eq p6,p0=0,r16
  4.1355 +(p6)	br.sptk.many dispatch_illegal_op_fault
  4.1356 +#endif
  4.1357 +	;;
  4.1358 +	mov r19=24		// fault number
  4.1359 +	br.sptk.many dispatch_to_fault_handler
  4.1360 +END(general_exception)
  4.1361 +
  4.1362 +	.org ia64_ivt+0x5500
  4.1363 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1364 +// 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
  4.1365 +ENTRY(disabled_fp_reg)
  4.1366 +#ifdef XEN
  4.1367 +	REFLECT(25)
  4.1368 +#endif
  4.1369 +	DBG_FAULT(25)
  4.1370 +	rsm psr.dfh		// ensure we can access fph
  4.1371 +	;;
  4.1372 +	srlz.d
  4.1373 +	mov r31=pr
  4.1374 +	mov r19=25
  4.1375 +	br.sptk.many dispatch_to_fault_handler
  4.1376 +END(disabled_fp_reg)
  4.1377 +
  4.1378 +	.org ia64_ivt+0x5600
  4.1379 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1380 +// 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
  4.1381 +ENTRY(nat_consumption)
  4.1382 +#ifdef XEN
  4.1383 +	REFLECT(26)
  4.1384 +#endif
  4.1385 +	DBG_FAULT(26)
  4.1386 +	FAULT(26)
  4.1387 +END(nat_consumption)
  4.1388 +
  4.1389 +	.org ia64_ivt+0x5700
  4.1390 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1391 +// 0x5700 Entry 27 (size 16 bundles) Speculation (40)
  4.1392 +ENTRY(speculation_vector)
  4.1393 +#ifdef XEN
  4.1394 +	// this probably need not reflect...
  4.1395 +	REFLECT(27)
  4.1396 +#endif
  4.1397 +	DBG_FAULT(27)
  4.1398 +	/*
  4.1399 +	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
  4.1400 +	 * this part of the architecture is not implemented in hardware on some CPUs, such
  4.1401 +	 * as Itanium.  Thus, in general we need to emulate the behavior.  IIM contains
  4.1402 +	 * the relative target (not yet sign extended).  So after sign extending it we
  4.1403 +	 * simply add it to IIP.  We also need to reset the EI field of the IPSR to zero,
  4.1404 +	 * i.e., the slot to restart into.
  4.1405 +	 *
  4.1406 +	 * cr.imm contains zero_ext(imm21)
  4.1407 +	 */
  4.1408 +	mov r18=cr.iim
  4.1409 +	;;
  4.1410 +	mov r17=cr.iip
  4.1411 +	shl r18=r18,43			// put sign bit in position (43=64-21)
  4.1412 +	;;
  4.1413 +
  4.1414 +	mov r16=cr.ipsr
  4.1415 +	shr r18=r18,39			// sign extend (39=43-4)
  4.1416 +	;;
  4.1417 +
  4.1418 +	add r17=r17,r18			// now add the offset
  4.1419 +	;;
  4.1420 +	mov cr.iip=r17
  4.1421 +	dep r16=0,r16,41,2		// clear EI
  4.1422 +	;;
  4.1423 +
  4.1424 +	mov cr.ipsr=r16
  4.1425 +	;;
  4.1426 +
  4.1427 +	rfi				// and go back
  4.1428 +END(speculation_vector)
  4.1429 +
  4.1430 +	.org ia64_ivt+0x5800
  4.1431 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1432 +// 0x5800 Entry 28 (size 16 bundles) Reserved
  4.1433 +	DBG_FAULT(28)
  4.1434 +	FAULT(28)
  4.1435 +
  4.1436 +	.org ia64_ivt+0x5900
  4.1437 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1438 +// 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
  4.1439 +ENTRY(debug_vector)
  4.1440 +#ifdef XEN
  4.1441 +	REFLECT(29)
  4.1442 +#endif
  4.1443 +	DBG_FAULT(29)
  4.1444 +	FAULT(29)
  4.1445 +END(debug_vector)
  4.1446 +
  4.1447 +	.org ia64_ivt+0x5a00
  4.1448 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1449 +// 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
  4.1450 +ENTRY(unaligned_access)
  4.1451 +#ifdef XEN
  4.1452 +	REFLECT(30)
  4.1453 +#endif
  4.1454 +	DBG_FAULT(30)
  4.1455 +	mov r16=cr.ipsr
  4.1456 +	mov r31=pr		// prepare to save predicates
  4.1457 +	;;
  4.1458 +	br.sptk.many dispatch_unaligned_handler
  4.1459 +END(unaligned_access)
  4.1460 +
  4.1461 +	.org ia64_ivt+0x5b00
  4.1462 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1463 +// 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
  4.1464 +ENTRY(unsupported_data_reference)
  4.1465 +#ifdef XEN
  4.1466 +	REFLECT(31)
  4.1467 +#endif
  4.1468 +	DBG_FAULT(31)
  4.1469 +	FAULT(31)
  4.1470 +END(unsupported_data_reference)
  4.1471 +
  4.1472 +	.org ia64_ivt+0x5c00
  4.1473 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1474 +// 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
  4.1475 +ENTRY(floating_point_fault)
  4.1476 +#ifdef XEN
  4.1477 +	REFLECT(32)
  4.1478 +#endif
  4.1479 +	DBG_FAULT(32)
  4.1480 +	FAULT(32)
  4.1481 +END(floating_point_fault)
  4.1482 +
  4.1483 +	.org ia64_ivt+0x5d00
  4.1484 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1485 +// 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
  4.1486 +ENTRY(floating_point_trap)
  4.1487 +#ifdef XEN
  4.1488 +	REFLECT(33)
  4.1489 +#endif
  4.1490 +	DBG_FAULT(33)
  4.1491 +	FAULT(33)
  4.1492 +END(floating_point_trap)
  4.1493 +
  4.1494 +	.org ia64_ivt+0x5e00
  4.1495 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1496 +// 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
  4.1497 +ENTRY(lower_privilege_trap)
  4.1498 +#ifdef XEN
  4.1499 +	REFLECT(34)
  4.1500 +#endif
  4.1501 +	DBG_FAULT(34)
  4.1502 +	FAULT(34)
  4.1503 +END(lower_privilege_trap)
  4.1504 +
  4.1505 +	.org ia64_ivt+0x5f00
  4.1506 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1507 +// 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
  4.1508 +ENTRY(taken_branch_trap)
  4.1509 +#ifdef XEN
  4.1510 +	REFLECT(35)
  4.1511 +#endif
  4.1512 +	DBG_FAULT(35)
  4.1513 +	FAULT(35)
  4.1514 +END(taken_branch_trap)
  4.1515 +
  4.1516 +	.org ia64_ivt+0x6000
  4.1517 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1518 +// 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
  4.1519 +ENTRY(single_step_trap)
  4.1520 +#ifdef XEN
  4.1521 +	REFLECT(36)
  4.1522 +#endif
  4.1523 +	DBG_FAULT(36)
  4.1524 +	FAULT(36)
  4.1525 +END(single_step_trap)
  4.1526 +
  4.1527 +	.org ia64_ivt+0x6100
  4.1528 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1529 +// 0x6100 Entry 37 (size 16 bundles) Reserved
  4.1530 +	DBG_FAULT(37)
  4.1531 +	FAULT(37)
  4.1532 +
  4.1533 +	.org ia64_ivt+0x6200
  4.1534 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1535 +// 0x6200 Entry 38 (size 16 bundles) Reserved
  4.1536 +	DBG_FAULT(38)
  4.1537 +	FAULT(38)
  4.1538 +
  4.1539 +	.org ia64_ivt+0x6300
  4.1540 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1541 +// 0x6300 Entry 39 (size 16 bundles) Reserved
  4.1542 +	DBG_FAULT(39)
  4.1543 +	FAULT(39)
  4.1544 +
  4.1545 +	.org ia64_ivt+0x6400
  4.1546 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1547 +// 0x6400 Entry 40 (size 16 bundles) Reserved
  4.1548 +	DBG_FAULT(40)
  4.1549 +	FAULT(40)
  4.1550 +
  4.1551 +	.org ia64_ivt+0x6500
  4.1552 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1553 +// 0x6500 Entry 41 (size 16 bundles) Reserved
  4.1554 +	DBG_FAULT(41)
  4.1555 +	FAULT(41)
  4.1556 +
  4.1557 +	.org ia64_ivt+0x6600
  4.1558 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1559 +// 0x6600 Entry 42 (size 16 bundles) Reserved
  4.1560 +	DBG_FAULT(42)
  4.1561 +	FAULT(42)
  4.1562 +
  4.1563 +	.org ia64_ivt+0x6700
  4.1564 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1565 +// 0x6700 Entry 43 (size 16 bundles) Reserved
  4.1566 +	DBG_FAULT(43)
  4.1567 +	FAULT(43)
  4.1568 +
  4.1569 +	.org ia64_ivt+0x6800
  4.1570 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1571 +// 0x6800 Entry 44 (size 16 bundles) Reserved
  4.1572 +	DBG_FAULT(44)
  4.1573 +	FAULT(44)
  4.1574 +
  4.1575 +	.org ia64_ivt+0x6900
  4.1576 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1577 +// 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)
  4.1578 +ENTRY(ia32_exception)
  4.1579 +#ifdef XEN
  4.1580 +	REFLECT(45)
  4.1581 +#endif
  4.1582 +	DBG_FAULT(45)
  4.1583 +	FAULT(45)
  4.1584 +END(ia32_exception)
  4.1585 +
  4.1586 +	.org ia64_ivt+0x6a00
  4.1587 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1588 +// 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
  4.1589 +ENTRY(ia32_intercept)
  4.1590 +#ifdef XEN
  4.1591 +	REFLECT(46)
  4.1592 +#endif
  4.1593 +	DBG_FAULT(46)
  4.1594 +#ifdef	CONFIG_IA32_SUPPORT
  4.1595 +	mov r31=pr
  4.1596 +	mov r16=cr.isr
  4.1597 +	;;
  4.1598 +	extr.u r17=r16,16,8	// get ISR.code
  4.1599 +	mov r18=ar.eflag
  4.1600 +	mov r19=cr.iim		// old eflag value
  4.1601 +	;;
  4.1602 +	cmp.ne p6,p0=2,r17
  4.1603 +(p6)	br.cond.spnt 1f		// not a system flag fault
  4.1604 +	xor r16=r18,r19
  4.1605 +	;;
  4.1606 +	extr.u r17=r16,18,1	// get the eflags.ac bit
  4.1607 +	;;
  4.1608 +	cmp.eq p6,p0=0,r17
  4.1609 +(p6)	br.cond.spnt 1f		// eflags.ac bit didn't change
  4.1610 +	;;
  4.1611 +	mov pr=r31,-1		// restore predicate registers
  4.1612 +	rfi
  4.1613 +
  4.1614 +1:
  4.1615 +#endif	// CONFIG_IA32_SUPPORT
  4.1616 +	FAULT(46)
  4.1617 +END(ia32_intercept)
  4.1618 +
  4.1619 +	.org ia64_ivt+0x6b00
  4.1620 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1621 +// 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
  4.1622 +ENTRY(ia32_interrupt)
  4.1623 +#ifdef XEN
  4.1624 +	REFLECT(47)
  4.1625 +#endif
  4.1626 +	DBG_FAULT(47)
  4.1627 +#ifdef CONFIG_IA32_SUPPORT
  4.1628 +	mov r31=pr
  4.1629 +	br.sptk.many dispatch_to_ia32_handler
  4.1630 +#else
  4.1631 +	FAULT(47)
  4.1632 +#endif
  4.1633 +END(ia32_interrupt)
  4.1634 +
  4.1635 +	.org ia64_ivt+0x6c00
  4.1636 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1637 +// 0x6c00 Entry 48 (size 16 bundles) Reserved
  4.1638 +	DBG_FAULT(48)
  4.1639 +	FAULT(48)
  4.1640 +
  4.1641 +	.org ia64_ivt+0x6d00
  4.1642 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1643 +// 0x6d00 Entry 49 (size 16 bundles) Reserved
  4.1644 +	DBG_FAULT(49)
  4.1645 +	FAULT(49)
  4.1646 +
  4.1647 +	.org ia64_ivt+0x6e00
  4.1648 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1649 +// 0x6e00 Entry 50 (size 16 bundles) Reserved
  4.1650 +	DBG_FAULT(50)
  4.1651 +	FAULT(50)
  4.1652 +
  4.1653 +	.org ia64_ivt+0x6f00
  4.1654 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1655 +// 0x6f00 Entry 51 (size 16 bundles) Reserved
  4.1656 +	DBG_FAULT(51)
  4.1657 +	FAULT(51)
  4.1658 +
  4.1659 +	.org ia64_ivt+0x7000
  4.1660 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1661 +// 0x7000 Entry 52 (size 16 bundles) Reserved
  4.1662 +	DBG_FAULT(52)
  4.1663 +	FAULT(52)
  4.1664 +
  4.1665 +	.org ia64_ivt+0x7100
  4.1666 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1667 +// 0x7100 Entry 53 (size 16 bundles) Reserved
  4.1668 +	DBG_FAULT(53)
  4.1669 +	FAULT(53)
  4.1670 +
  4.1671 +	.org ia64_ivt+0x7200
  4.1672 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1673 +// 0x7200 Entry 54 (size 16 bundles) Reserved
  4.1674 +	DBG_FAULT(54)
  4.1675 +	FAULT(54)
  4.1676 +
  4.1677 +	.org ia64_ivt+0x7300
  4.1678 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1679 +// 0x7300 Entry 55 (size 16 bundles) Reserved
  4.1680 +	DBG_FAULT(55)
  4.1681 +	FAULT(55)
  4.1682 +
  4.1683 +	.org ia64_ivt+0x7400
  4.1684 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1685 +// 0x7400 Entry 56 (size 16 bundles) Reserved
  4.1686 +	DBG_FAULT(56)
  4.1687 +	FAULT(56)
  4.1688 +
  4.1689 +	.org ia64_ivt+0x7500
  4.1690 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1691 +// 0x7500 Entry 57 (size 16 bundles) Reserved
  4.1692 +	DBG_FAULT(57)
  4.1693 +	FAULT(57)
  4.1694 +
  4.1695 +	.org ia64_ivt+0x7600
  4.1696 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1697 +// 0x7600 Entry 58 (size 16 bundles) Reserved
  4.1698 +	DBG_FAULT(58)
  4.1699 +	FAULT(58)
  4.1700 +
  4.1701 +	.org ia64_ivt+0x7700
  4.1702 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1703 +// 0x7700 Entry 59 (size 16 bundles) Reserved
  4.1704 +	DBG_FAULT(59)
  4.1705 +	FAULT(59)
  4.1706 +
  4.1707 +	.org ia64_ivt+0x7800
  4.1708 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1709 +// 0x7800 Entry 60 (size 16 bundles) Reserved
  4.1710 +	DBG_FAULT(60)
  4.1711 +	FAULT(60)
  4.1712 +
  4.1713 +	.org ia64_ivt+0x7900
  4.1714 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1715 +// 0x7900 Entry 61 (size 16 bundles) Reserved
  4.1716 +	DBG_FAULT(61)
  4.1717 +	FAULT(61)
  4.1718 +
  4.1719 +	.org ia64_ivt+0x7a00
  4.1720 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1721 +// 0x7a00 Entry 62 (size 16 bundles) Reserved
  4.1722 +	DBG_FAULT(62)
  4.1723 +	FAULT(62)
  4.1724 +
  4.1725 +	.org ia64_ivt+0x7b00
  4.1726 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1727 +// 0x7b00 Entry 63 (size 16 bundles) Reserved
  4.1728 +	DBG_FAULT(63)
  4.1729 +	FAULT(63)
  4.1730 +
  4.1731 +	.org ia64_ivt+0x7c00
  4.1732 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1733 +// 0x7c00 Entry 64 (size 16 bundles) Reserved
  4.1734 +	DBG_FAULT(64)
  4.1735 +	FAULT(64)
  4.1736 +
  4.1737 +	.org ia64_ivt+0x7d00
  4.1738 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1739 +// 0x7d00 Entry 65 (size 16 bundles) Reserved
  4.1740 +	DBG_FAULT(65)
  4.1741 +	FAULT(65)
  4.1742 +
  4.1743 +	.org ia64_ivt+0x7e00
  4.1744 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1745 +// 0x7e00 Entry 66 (size 16 bundles) Reserved
  4.1746 +	DBG_FAULT(66)
  4.1747 +	FAULT(66)
  4.1748 +
  4.1749 +	.org ia64_ivt+0x7f00
  4.1750 +/////////////////////////////////////////////////////////////////////////////////////////
  4.1751 +// 0x7f00 Entry 67 (size 16 bundles) Reserved
  4.1752 +	DBG_FAULT(67)
  4.1753 +	FAULT(67)
  4.1754 +
  4.1755 +#ifdef XEN
  4.1756 +	.org ia64_ivt+0x8000
  4.1757 +ENTRY(dispatch_reflection)
  4.1758 +	/*
  4.1759 +	 * Input:
  4.1760 +	 *	psr.ic:	off
  4.1761 +	 *	r19:	intr type (offset into ivt, see ia64_int.h)
  4.1762 +	 *	r31:	contains saved predicates (pr)
  4.1763 +	 */
  4.1764 +	SAVE_MIN_WITH_COVER_R19
  4.1765 +	alloc r14=ar.pfs,0,0,5,0
  4.1766 +	mov out4=r15
  4.1767 +	mov out0=cr.ifa
  4.1768 +	adds out1=16,sp
  4.1769 +	mov out2=cr.isr
  4.1770 +	mov out3=cr.iim
  4.1771 +//	mov out3=cr.itir
  4.1772 +
  4.1773 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1774 +	;;
  4.1775 +	srlz.i					// guarantee that interruption collection is on
  4.1776 +	;;
  4.1777 +(p15)	ssm psr.i				// restore psr.i
  4.1778 +	adds r3=8,r2				// set up second base pointer
  4.1779 +	;;
  4.1780 +	SAVE_REST
  4.1781 +	movl r14=ia64_leave_kernel
  4.1782 +	;;
  4.1783 +	mov rp=r14
  4.1784 +	br.sptk.many ia64_prepare_handle_reflection
  4.1785 +END(dispatch_reflection)
  4.1786 +#endif
  4.1787 +
  4.1788 +#ifdef CONFIG_IA32_SUPPORT
  4.1789 +
  4.1790 +	/*
  4.1791 +	 * There is no particular reason for this code to be here, other than that
  4.1792 +	 * there happens to be space here that would go unused otherwise.  If this
  4.1793 +	 * fault ever gets "unreserved", simply moved the following code to a more
  4.1794 +	 * suitable spot...
  4.1795 +	 */
  4.1796 +
  4.1797 +	// IA32 interrupt entry point
  4.1798 +
  4.1799 +ENTRY(dispatch_to_ia32_handler)
  4.1800 +	SAVE_MIN
  4.1801 +	;;
  4.1802 +	mov r14=cr.isr
  4.1803 +	ssm psr.ic | PSR_DEFAULT_BITS
  4.1804 +	;;
  4.1805 +	srlz.i					// guarantee that interruption collection is on
  4.1806 +	;;
  4.1807 +(p15)	ssm psr.i
  4.1808 +	adds r3=8,r2		// Base pointer for SAVE_REST
  4.1809 +	;;
  4.1810 +	SAVE_REST
  4.1811 +	;;
  4.1812 +	mov r15=0x80
  4.1813 +	shr r14=r14,16		// Get interrupt number
  4.1814 +	;;
  4.1815 +	cmp.ne p6,p0=r14,r15
  4.1816 +(p6)	br.call.dpnt.many b6=non_ia32_syscall
  4.1817 +
  4.1818 +	adds r14=IA64_PT_REGS_R8_OFFSET + 16,sp	// 16 byte hole per SW conventions
  4.1819 +	adds r15=IA64_PT_REGS_R1_OFFSET + 16,sp
  4.1820 +	;;
  4.1821 +	cmp.eq pSys,pNonSys=r0,r0 // set pSys=1, pNonSys=0
  4.1822 +	ld8 r8=[r14]		// get r8
  4.1823 +	;;
  4.1824 +	st8 [r15]=r8		// save original EAX in r1 (IA32 procs don't use the GP)
  4.1825 +	;;
  4.1826 +	alloc r15=ar.pfs,0,0,6,0	// must first in an insn group
  4.1827 +	;;
  4.1828 +	ld4 r8=[r14],8		// r8 == eax (syscall number)
  4.1829 +	mov r15=IA32_NR_syscalls
  4.1830 +	;;
  4.1831 +	cmp.ltu.unc p6,p7=r8,r15
  4.1832 +	ld4 out1=[r14],8	// r9 == ecx
  4.1833 +	;;
  4.1834 +	ld4 out2=[r14],8	// r10 == edx
  4.1835 +	;;
  4.1836 +	ld4 out0=[r14]		// r11 == ebx
  4.1837 +	adds r14=(IA64_PT_REGS_R13_OFFSET) + 16,sp
  4.1838 +	;;
  4.1839 +	ld4 out5=[r14],PT(R14)-PT(R13)	// r13 == ebp
  4.1840 +	;;
  4.1841 +	ld4 out3=[r14],PT(R15)-PT(R14)	// r14 == esi
  4.1842 +	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
  4.1843 +	;;
  4.1844 +	ld4 out4=[r14]		// r15 == edi
  4.1845 +	movl r16=ia32_syscall_table
  4.1846 +	;;
  4.1847 +(p6)	shladd r16=r8,3,r16	// force ni_syscall if not valid syscall number
  4.1848 +	ld4 r2=[r2]		// r2 = current_thread_info()->flags
  4.1849 +	;;
  4.1850 +	ld8 r16=[r16]
  4.1851 +	and r2=_TIF_SYSCALL_TRACEAUDIT,r2	// mask trace or audit
  4.1852 +	;;
  4.1853 +	mov b6=r16
  4.1854 +	movl r15=ia32_ret_from_syscall
  4.1855 +	cmp.eq p8,p0=r2,r0
  4.1856 +	;;
  4.1857 +	mov rp=r15
  4.1858 +(p8)	br.call.sptk.many b6=b6
  4.1859 +	br.cond.sptk ia32_trace_syscall
  4.1860 +
  4.1861 +non_ia32_syscall:
  4.1862 +	alloc r15=ar.pfs,0,0,2,0
  4.1863 +	mov out0=r14				// interrupt #
  4.1864 +	add out1=16,sp				// pointer to pt_regs
  4.1865 +	;;			// avoid WAW on CFM
  4.1866 +	br.call.sptk.many rp=ia32_bad_interrupt
  4.1867 +.ret1:	movl r15=ia64_leave_kernel
  4.1868 +	;;
  4.1869 +	mov rp=r15
  4.1870 +	br.ret.sptk.many rp
  4.1871 +END(dispatch_to_ia32_handler)
  4.1872 +
  4.1873 +#endif /* CONFIG_IA32_SUPPORT */
     6.1 --- a/xen/arch/ia64/patch/linux-2.6.11/bootmem.h	Mon May 02 16:07:35 2005 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,17 +0,0 @@
     6.4 - bootmem.h |    2 ++
     6.5 - 1 files changed, 2 insertions(+)
     6.6 -
     6.7 -Index: linux-2.6.11/include/linux/bootmem.h
     6.8 -===================================================================
     6.9 ---- linux-2.6.11.orig/include/linux/bootmem.h	2005-03-02 01:38:25.000000000 -0600
    6.10 -+++ linux-2.6.11/include/linux/bootmem.h	2005-03-19 12:39:36.915887729 -0600
    6.11 -@@ -41,7 +41,9 @@ extern unsigned long __init init_bootmem
    6.12 - extern void __init free_bootmem (unsigned long addr, unsigned long size);
    6.13 - extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
    6.14 - #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
    6.15 -+#ifndef XEN
    6.16 - extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
    6.17 -+#endif
    6.18 - #define alloc_bootmem(x) \
    6.19 - 	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
    6.20 - #define alloc_bootmem_low(x) \
     7.1 --- a/xen/arch/ia64/patch/linux-2.6.11/cpumask.h	Mon May 02 16:07:35 2005 +0000
     7.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/cpumask.h	Mon May 02 23:55:17 2005 +0000
     7.3 @@ -1,20 +1,12 @@
     7.4 - cpumask.h |    2 +-
     7.5 - 1 files changed, 1 insertion(+), 1 deletion(-)
     7.6 -
     7.7 -Index: linux-2.6.11-xendiffs/include/linux/cpumask.h
     7.8 -===================================================================
     7.9 ---- linux-2.6.11-xendiffs.orig/include/linux/cpumask.h	2005-03-02 01:38:00.000000000 -0600
    7.10 -+++ linux-2.6.11-xendiffs/include/linux/cpumask.h	2005-03-24 15:06:18.408145243 -0600
    7.11 -@@ -341,11 +341,11 @@ static inline int __cpumask_parse(const 
    7.12 -  *        main(){ set1(3); set2(5); }
    7.13 +--- ../../linux-2.6.11/include/linux/cpumask.h	2005-03-02 00:38:00.000000000 -0700
    7.14 ++++ include/asm-ia64/linux/cpumask.h	2005-04-28 13:21:20.000000000 -0600
    7.15 +@@ -342,7 +342,9 @@
    7.16    */
    7.17   
    7.18 -+#if NR_CPUS > 1
    7.19   extern cpumask_t cpu_possible_map;
    7.20 ++#ifndef XEN
    7.21   extern cpumask_t cpu_online_map;
    7.22 ++#endif
    7.23   extern cpumask_t cpu_present_map;
    7.24   
    7.25 --#if NR_CPUS > 1
    7.26 - #define num_online_cpus()	cpus_weight(cpu_online_map)
    7.27 - #define num_possible_cpus()	cpus_weight(cpu_possible_map)
    7.28 - #define num_present_cpus()	cpus_weight(cpu_present_map)
    7.29 + #if NR_CPUS > 1
     8.1 --- a/xen/arch/ia64/patch/linux-2.6.11/current.h	Mon May 02 16:07:35 2005 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,22 +0,0 @@
     8.4 - current.h |    8 ++++++++
     8.5 - 1 files changed, 8 insertions(+)
     8.6 -
     8.7 -Index: linux-2.6.11/include/asm-ia64/current.h
     8.8 -===================================================================
     8.9 ---- linux-2.6.11.orig/include/asm-ia64/current.h	2005-03-02 01:38:19.000000000 -0600
    8.10 -+++ linux-2.6.11/include/asm-ia64/current.h	2005-03-19 12:39:41.410955288 -0600
    8.11 -@@ -12,6 +12,14 @@
    8.12 -  * In kernel mode, thread pointer (r13) is used to point to the current task
    8.13 -  * structure.
    8.14 -  */
    8.15 -+#ifdef XEN
    8.16 -+struct domain;
    8.17 -+#define get_current()	((struct exec_domain *) ia64_getreg(_IA64_REG_TP))
    8.18 -+#define current get_current()
    8.19 -+//#define set_current(d)	ia64_setreg(_IA64_REG_TP,(void *)d);
    8.20 -+#define set_current(d)		(ia64_r13 = (void *)d)
    8.21 -+#else
    8.22 - #define current	((struct task_struct *) ia64_getreg(_IA64_REG_TP))
    8.23 -+#endif
    8.24 - 
    8.25 - #endif /* _ASM_IA64_CURRENT_H */
     9.1 --- a/xen/arch/ia64/patch/linux-2.6.11/efi.c	Mon May 02 16:07:35 2005 +0000
     9.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/efi.c	Mon May 02 23:55:17 2005 +0000
     9.3 @@ -1,29 +1,6 @@
     9.4 - efi.c |   32 ++++++++++++++++++++++++++++++++
     9.5 - 1 files changed, 32 insertions(+)
     9.6 -
     9.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c
     9.8 -===================================================================
     9.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/efi.c	2005-04-07 12:22:08.230781400 -0500
    9.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c	2005-04-07 12:25:11.875195997 -0500
    9.11 -@@ -25,6 +25,9 @@
    9.12 - #include <linux/types.h>
    9.13 - #include <linux/time.h>
    9.14 - #include <linux/efi.h>
    9.15 -+#ifdef XEN
    9.16 -+#include <xen/sched.h>
    9.17 -+#endif
    9.18 - 
    9.19 - #include <asm/io.h>
    9.20 - #include <asm/kregs.h>
    9.21 -@@ -218,6 +221,7 @@ efi_gettimeofday (struct timespec *ts)
    9.22 - 	if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
    9.23 - 		return;
    9.24 - 
    9.25 -+	dummy();
    9.26 - 	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
    9.27 - 	ts->tv_nsec = tm.nanosecond;
    9.28 - }
    9.29 -@@ -320,6 +324,10 @@ efi_memmap_walk (efi_freemem_callback_t 
    9.30 +--- ../../linux-2.6.11/arch/ia64/kernel/efi.c	2005-03-02 00:37:47.000000000 -0700
    9.31 ++++ arch/ia64/efi.c	2005-04-29 14:09:24.000000000 -0600
    9.32 +@@ -320,6 +320,10 @@
    9.33   		if (!(md->attribute & EFI_MEMORY_WB))
    9.34   			continue;
    9.35   
    9.36 @@ -34,7 +11,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
    9.37   		/*
    9.38   		 * granule_addr is the base of md's first granule.
    9.39   		 * [granule_addr - first_non_wb_addr) is guaranteed to
    9.40 -@@ -719,6 +727,30 @@ efi_get_iobase (void)
    9.41 +@@ -719,6 +723,30 @@
    9.42   	return 0;
    9.43   }
    9.44   
    10.1 --- a/xen/arch/ia64/patch/linux-2.6.11/entry.S	Mon May 02 16:07:35 2005 +0000
    10.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S	Mon May 02 23:55:17 2005 +0000
    10.3 @@ -1,86 +1,34 @@
    10.4 - entry.S |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
    10.5 - 1 files changed, 85 insertions(+), 1 deletion(-)
    10.6 -
    10.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S
    10.8 -===================================================================
    10.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/entry.S	2005-04-08 13:32:07.636308237 -0500
   10.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S	2005-04-08 13:37:04.612542509 -0500
   10.11 -@@ -35,7 +35,9 @@
   10.12 - 
   10.13 - #include <asm/asmmacro.h>
   10.14 - #include <asm/cache.h>
   10.15 -+#ifndef XEN
   10.16 - #include <asm/errno.h>
   10.17 -+#endif
   10.18 - #include <asm/kregs.h>
   10.19 - #include <asm/offsets.h>
   10.20 - #include <asm/pgtable.h>
   10.21 -@@ -46,6 +48,25 @@
   10.22 +--- ../../linux-2.6.11/arch/ia64/kernel/entry.S	2005-03-02 00:37:50.000000000 -0700
   10.23 ++++ arch/ia64/entry.S	2005-04-29 14:54:13.000000000 -0600
   10.24 +@@ -46,6 +46,7 @@
   10.25   
   10.26   #include "minstate.h"
   10.27   
   10.28 -+#ifdef XEN
   10.29 -+#define	sys_execve 0
   10.30 -+#define do_fork 0
   10.31 -+#define	syscall_trace_enter 0
   10.32 -+#define	syscall_trace_leave 0
   10.33 -+#define schedule 0
   10.34 -+#define do_notify_resume_user 0
   10.35 -+#define ia64_rt_sigsuspend 0
   10.36 -+#define ia64_rt_sigreturn 0
   10.37 -+#define	ia64_handle_unaligned 0
   10.38 -+#define	errno 0
   10.39 -+#define	sys_ni_syscall 0
   10.40 -+#define unw_init_frame_info 0
   10.41 -+#define sys_call_table 0
   10.42 -+#define do_sigdelayed 0
   10.43 -+#endif
   10.44 -+
   10.45 -+	/*
   10.46 -+
   10.47 ++#ifndef XEN
   10.48   	/*
   10.49   	 * execve() is special because in case of success, we need to
   10.50   	 * setup a null register window frame.
   10.51 -@@ -187,11 +208,14 @@ GLOBAL_ENTRY(ia64_switch_to)
   10.52 - 	DO_SAVE_SWITCH_STACK
   10.53 - 	.body
   10.54 +@@ -174,6 +175,7 @@
   10.55 + 	mov rp=loc0
   10.56 + 	br.ret.sptk.many rp
   10.57 + END(sys_clone)
   10.58 ++#endif /* !XEN */
   10.59   
   10.60 -+#ifdef XEN
   10.61 -+//#undef IA64_TASK_THREAD_KSP_OFFSET
   10.62 -+//#define	IA64_TASK_THREAD_KSP_OFFSET	0x38
   10.63 - 	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   10.64 + /*
   10.65 +  * prev_task <- ia64_switch_to(struct task_struct *next)
   10.66 +@@ -191,7 +193,11 @@
   10.67   	movl r25=init_task
   10.68   	mov r27=IA64_KR(CURRENT_STACK)
   10.69   	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   10.70 --	dep r20=0,in0,61,3		// physical address of "next"
   10.71 ++#ifdef XEN
   10.72  +	dep r20=0,in0,60,4		// physical address of "next"
   10.73 ++#else
   10.74 + 	dep r20=0,in0,61,3		// physical address of "next"
   10.75 ++#endif
   10.76   	;;
   10.77   	st8 [r22]=sp			// save kernel stack pointer of old task
   10.78   	shr.u r26=r20,IA64_GRANULE_SHIFT
   10.79 -@@ -203,6 +227,22 @@ GLOBAL_ENTRY(ia64_switch_to)
   10.80 - (p6)	cmp.eq p7,p6=r26,r27
   10.81 - (p6)	br.cond.dpnt .map
   10.82 - 	;;
   10.83 -+#else
   10.84 -+	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   10.85 -+	mov r27=IA64_KR(CURRENT_STACK)
   10.86 -+	dep r20=0,in0,61,3		// physical address of "current"
   10.87 -+	;;
   10.88 -+	st8 [r22]=sp			// save kernel stack pointer of old task
   10.89 -+	shr.u r26=r20,IA64_GRANULE_SHIFT
   10.90 -+	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   10.91 -+	;;
   10.92 -+	/*
   10.93 -+	 * If we've already mapped this task's page, we can skip doing it again.
   10.94 -+	 */
   10.95 -+	cmp.eq p7,p6=r26,r27
   10.96 -+(p6)	br.cond.dpnt .map
   10.97 -+	;;
   10.98 -+#endif
   10.99 - .done:
  10.100 - (p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
  10.101 - 	;;
  10.102 -@@ -220,6 +260,16 @@ GLOBAL_ENTRY(ia64_switch_to)
  10.103 +@@ -220,6 +226,16 @@
  10.104   	br.ret.sptk.many rp		// boogie on out in new context
  10.105   
  10.106   .map:
  10.107 @@ -97,7 +45,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.108   	rsm psr.ic			// interrupts (psr.i) are already disabled here
  10.109   	movl r25=PAGE_KERNEL
  10.110   	;;
  10.111 -@@ -376,7 +426,11 @@ END(save_switch_stack)
  10.112 +@@ -376,7 +392,11 @@
  10.113    *	- b7 holds address to return to
  10.114    *	- must not touch r8-r11
  10.115    */
  10.116 @@ -109,7 +57,23 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.117   	.prologue
  10.118   	.altrp b7
  10.119   
  10.120 -@@ -604,6 +658,11 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
  10.121 +@@ -470,6 +490,7 @@
  10.122 + 	br.cond.sptk.many b7
  10.123 + END(load_switch_stack)
  10.124 + 
  10.125 ++#ifndef XEN
  10.126 + GLOBAL_ENTRY(__ia64_syscall)
  10.127 + 	.regstk 6,0,0,0
  10.128 + 	mov r15=in5				// put syscall number in place
  10.129 +@@ -588,6 +609,7 @@
  10.130 + }
  10.131 + .ret4:	br.cond.sptk ia64_leave_kernel
  10.132 + END(ia64_strace_leave_kernel)
  10.133 ++#endif
  10.134 + 
  10.135 + GLOBAL_ENTRY(ia64_ret_from_clone)
  10.136 + 	PT_REGS_UNWIND_INFO(0)
  10.137 +@@ -604,6 +626,11 @@
  10.138   	 */
  10.139   	br.call.sptk.many rp=ia64_invoke_schedule_tail
  10.140   }
  10.141 @@ -121,7 +85,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.142   .ret8:
  10.143   	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
  10.144   	;;
  10.145 -@@ -614,6 +673,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
  10.146 +@@ -614,6 +641,7 @@
  10.147   	;;
  10.148   	cmp.ne p6,p0=r2,r0
  10.149   (p6)	br.cond.spnt .strace_check_retval
  10.150 @@ -129,14 +93,11 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.151   	;;					// added stop bits to prevent r8 dependency
  10.152   END(ia64_ret_from_clone)
  10.153   	// fall through
  10.154 -@@ -700,9 +760,14 @@ ENTRY(ia64_leave_syscall)
  10.155 +@@ -700,19 +728,25 @@
  10.156   .work_processed_syscall:
  10.157   	adds r2=PT(LOADRS)+16,r12
  10.158   	adds r3=PT(AR_BSPSTORE)+16,r12
  10.159 -+#ifdef XEN
  10.160 -+	mov r31=r0
  10.161 -+	;;
  10.162 -+#else
  10.163 ++#ifndef XEN
  10.164   	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
  10.165   	;;
  10.166   (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
  10.167 @@ -144,7 +105,21 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.168   	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
  10.169   	mov b7=r0		// clear b7
  10.170   	;;
  10.171 -@@ -757,7 +822,11 @@ ENTRY(ia64_leave_syscall)
  10.172 + 	ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE)	// load ar.bspstore (may be garbage)
  10.173 + 	ld8 r18=[r2],PT(R9)-PT(B6)		// load b6
  10.174 ++#ifndef XEN
  10.175 + (p6)	and r15=TIF_WORK_MASK,r31		// any work other than TIF_SYSCALL_TRACE?
  10.176 ++#endif
  10.177 + 	;;
  10.178 + 	mov r16=ar.bsp				// M2  get existing backing store pointer
  10.179 ++#ifndef XEN
  10.180 + (p6)	cmp4.ne.unc p6,p0=r15, r0		// any special work pending?
  10.181 + (p6)	br.cond.spnt .work_pending_syscall
  10.182 ++#endif
  10.183 + 	;;
  10.184 + 	// start restoring the state saved on the kernel stack (struct pt_regs):
  10.185 + 	ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
  10.186 +@@ -757,7 +791,11 @@
  10.187   	;;
  10.188   	ld8.fill r12=[r2]	// restore r12 (sp)
  10.189   	ld8.fill r15=[r3]	// restore r15
  10.190 @@ -156,7 +131,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.191   	;;
  10.192   (pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
  10.193   (pUStk) st1 [r14]=r17
  10.194 -@@ -814,9 +883,18 @@ GLOBAL_ENTRY(ia64_leave_kernel)
  10.195 +@@ -814,9 +852,18 @@
  10.196   (pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
  10.197   #endif
  10.198   .work_processed_kernel:
  10.199 @@ -175,7 +150,17 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.200   	adds r21=PT(PR)+16,r12
  10.201   	;;
  10.202   
  10.203 -@@ -934,7 +1012,11 @@ GLOBAL_ENTRY(ia64_leave_kernel)
  10.204 +@@ -838,7 +885,9 @@
  10.205 + 	;;
  10.206 + 	ld8 r29=[r2],16		// load b7
  10.207 + 	ld8 r30=[r3],16		// load ar.csd
  10.208 ++#ifndef XEN
  10.209 + (p6)	br.cond.spnt .work_pending
  10.210 ++#endif
  10.211 + 	;;
  10.212 + 	ld8 r31=[r2],16		// load ar.ssd
  10.213 + 	ld8.fill r8=[r3],16
  10.214 +@@ -934,7 +983,11 @@
  10.215   	shr.u r18=r19,16	// get byte size of existing "dirty" partition
  10.216   	;;
  10.217   	mov r16=ar.bsp		// get existing backing store pointer
  10.218 @@ -187,15 +172,47 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  10.219   	;;
  10.220   	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
  10.221   (pKStk)	br.cond.dpnt skip_rbs_switch
  10.222 -@@ -1323,6 +1405,7 @@ GLOBAL_ENTRY(unw_init_running)
  10.223 +@@ -1069,6 +1122,7 @@
  10.224 + 	mov pr=r31,-1		// I0
  10.225 + 	rfi			// B
  10.226 + 
  10.227 ++#ifndef XEN
  10.228 + 	/*
  10.229 + 	 * On entry:
  10.230 + 	 *	r20 = &current->thread_info->pre_count (if CONFIG_PREEMPT)
  10.231 +@@ -1130,6 +1184,7 @@
  10.232 + 	ld8 r8=[r2]
  10.233 + 	ld8 r10=[r3]
  10.234 + 	br.cond.sptk.many .work_processed_syscall	// re-check
  10.235 ++#endif
  10.236 + 
  10.237 + END(ia64_leave_kernel)
  10.238 + 
  10.239 +@@ -1166,6 +1221,7 @@
  10.240   	br.ret.sptk.many rp
  10.241 - END(unw_init_running)
  10.242 + END(ia64_invoke_schedule_tail)
  10.243   
  10.244  +#ifndef XEN
  10.245 - 	.rodata
  10.246 - 	.align 8
  10.247 - 	.globl sys_call_table
  10.248 -@@ -1585,3 +1668,4 @@ sys_call_table:
  10.249 + 	/*
  10.250 + 	 * Setup stack and call do_notify_resume_user().  Note that pSys and pNonSys need to
  10.251 + 	 * be set up by the caller.  We declare 8 input registers so the system call
  10.252 +@@ -1264,6 +1320,7 @@
  10.253 + 	mov ar.unat=r9
  10.254 + 	br.many b7
  10.255 + END(sys_rt_sigreturn)
  10.256 ++#endif
  10.257 + 
  10.258 + GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
  10.259 + 	.prologue
  10.260 +@@ -1278,6 +1335,7 @@
  10.261 + 	br.cond.sptk.many rp				// goes to ia64_leave_kernel
  10.262 + END(ia64_prepare_handle_unaligned)
  10.263 + 
  10.264 ++#ifndef XEN
  10.265 + 	//
  10.266 + 	// unw_init_running(void (*callback)(info, arg), void *arg)
  10.267 + 	//
  10.268 +@@ -1585,3 +1643,4 @@
  10.269   	data8 sys_ni_syscall
  10.270   
  10.271   	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
    11.1 --- a/xen/arch/ia64/patch/linux-2.6.11/hardirq.h	Mon May 02 16:07:35 2005 +0000
    11.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h	Mon May 02 23:55:17 2005 +0000
    11.3 @@ -1,15 +1,14 @@
    11.4 - hardirq.h |    1 +
    11.5 - 1 files changed, 1 insertion(+)
    11.6 -
    11.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h
    11.8 -===================================================================
    11.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/hardirq.h	2005-03-24 15:59:37.210502749 -0600
   11.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h	2005-03-24 16:00:19.439540961 -0600
   11.11 -@@ -20,6 +20,7 @@
   11.12 - #define __ARCH_IRQ_STAT	1
   11.13 +--- ../../linux-2.6.11/include/linux/hardirq.h	2005-03-02 00:38:00.000000000 -0700
   11.14 ++++ include/asm-ia64/linux/hardirq.h	2005-04-28 16:34:39.000000000 -0600
   11.15 +@@ -60,7 +60,11 @@
   11.16 +  */
   11.17 + #define in_irq()		(hardirq_count())
   11.18 + #define in_softirq()		(softirq_count())
   11.19 ++#ifndef XEN
   11.20 + #define in_interrupt()		(irq_count())
   11.21 ++#else
   11.22 ++#define in_interrupt()		0		// FIXME LATER
   11.23 ++#endif
   11.24   
   11.25 - #define local_softirq_pending()		(local_cpu_data->softirq_pending)
   11.26 -+#define softirq_pending(cpu)			(cpu_data(cpu)->softirq_pending)
   11.27 - 
   11.28 - #define HARDIRQ_BITS	14
   11.29 - 
   11.30 + #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
   11.31 + # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
    12.1 --- a/xen/arch/ia64/patch/linux-2.6.11/head.S	Mon May 02 16:07:35 2005 +0000
    12.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/head.S	Mon May 02 23:55:17 2005 +0000
    12.3 @@ -1,20 +1,6 @@
    12.4 - head.S |   34 ++++++++++++++++++++++++++++++++++
    12.5 - 1 files changed, 34 insertions(+)
    12.6 -
    12.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S
    12.8 -===================================================================
    12.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/head.S	2005-04-07 10:56:19.225128582 -0500
   12.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/head.S	2005-04-07 11:00:21.718513399 -0500
   12.11 -@@ -1,3 +1,8 @@
   12.12 -+#ifdef XEN
   12.13 -+#define	console_print	printf
   12.14 -+#define kernel_thread_helper 0
   12.15 -+#define sys_exit 0
   12.16 -+#endif
   12.17 - /*
   12.18 -  * Here is where the ball gets rolling as far as the kernel is concerned.
   12.19 -  * When control is transferred to _start, the bootload has already
   12.20 -@@ -187,7 +192,11 @@ start_ap:
   12.21 +--- ../../linux-2.6.11/arch/ia64/kernel/head.S	2005-03-02 00:38:13.000000000 -0700
   12.22 ++++ arch/ia64/head.S	2005-04-28 10:51:19.000000000 -0600
   12.23 +@@ -187,7 +187,11 @@
   12.24   	dep r18=0,r3,0,12
   12.25   	;;
   12.26   	or r18=r17,r18
   12.27 @@ -26,7 +12,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
   12.28   	;;
   12.29   	mov r17=rr[r2]
   12.30   	shr.u r16=r3,IA64_GRANULE_SHIFT
   12.31 -@@ -227,7 +236,11 @@ start_ap:
   12.32 +@@ -227,7 +231,11 @@
   12.33   	;;
   12.34   	mov ar.rsc=0x3		// place RSE in eager mode
   12.35   
   12.36 @@ -38,29 +24,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
   12.37   (isBP)	movl r2=ia64_boot_param
   12.38   	;;
   12.39   (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
   12.40 -@@ -245,7 +258,21 @@ start_ap:
   12.41 - 	br.call.sptk.many rp=sys_fw_init
   12.42 - .ret1:
   12.43 - #endif
   12.44 -+#ifdef XEN
   12.45 -+	alloc r2=ar.pfs,8,0,2,0
   12.46 -+	;;
   12.47 -+#define fake_mbi_magic 0
   12.48 -+#define MULTIBOOT_INFO_SIZE	1024
   12.49 -+	.rodata
   12.50 -+fake_mbi:
   12.51 -+	.skip MULTIBOOT_INFO_SIZE
   12.52 -+	.previous
   12.53 -+	movl out0=fake_mbi
   12.54 -+	;;
   12.55 -+	br.call.sptk.many rp=cmain
   12.56 -+#else
   12.57 - 	br.call.sptk.many rp=start_kernel
   12.58 -+#endif
   12.59 - .ret2:	addl r3=@ltoff(halt_msg),gp
   12.60 - 	;;
   12.61 - 	alloc r2=ar.pfs,8,0,2,0
   12.62 -@@ -254,7 +281,9 @@ start_ap:
   12.63 +@@ -254,7 +262,9 @@
   12.64   	br.call.sptk.many b0=console_print
   12.65   
   12.66   self:	hint @pause
   12.67 @@ -70,13 +34,12 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
   12.68   END(_start)
   12.69   
   12.70   GLOBAL_ENTRY(ia64_save_debug_regs)
   12.71 -@@ -850,7 +879,12 @@ END(ia64_delay_loop)
   12.72 +@@ -850,7 +860,11 @@
   12.73    * intermediate precision so that we can produce a full 64-bit result.
   12.74    */
   12.75   GLOBAL_ENTRY(sched_clock)
   12.76  +#ifdef XEN
   12.77 -+	break 0;;	// FIX IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   12.78 -+	//movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   12.79 ++	movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   12.80  +#else
   12.81   	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
   12.82  +#endif
    13.1 --- a/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c	Mon May 02 16:07:35 2005 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,41 +0,0 @@
    13.4 - hpsim_irq.c |   15 +++++++++++++++
    13.5 - 1 files changed, 15 insertions(+)
    13.6 -
    13.7 -Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c
    13.8 -===================================================================
    13.9 ---- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_irq.c	2005-03-02 01:38:33.000000000 -0600
   13.10 -+++ linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c	2005-03-19 13:33:57.312014806 -0600
   13.11 -@@ -9,7 +9,17 @@
   13.12 - #include <linux/kernel.h>
   13.13 - #include <linux/sched.h>
   13.14 - #include <linux/irq.h>
   13.15 -+#ifdef XEN
   13.16 -+#include <asm/hw_irq.h>
   13.17 -+#endif
   13.18 - 
   13.19 -+#if 1
   13.20 -+void __init
   13.21 -+hpsim_irq_init (void)
   13.22 -+{
   13.23 -+	printf("*** hpsim_irq_init called: NOT NEEDED?!?!?\n");
   13.24 -+}
   13.25 -+#else
   13.26 - static unsigned int
   13.27 - hpsim_irq_startup (unsigned int irq)
   13.28 - {
   13.29 -@@ -19,6 +29,10 @@ hpsim_irq_startup (unsigned int irq)
   13.30 - static void
   13.31 - hpsim_irq_noop (unsigned int irq)
   13.32 - {
   13.33 -+#if 1
   13.34 -+printf("hpsim_irq_noop: irq=%d\n",irq);
   13.35 -+while(irq);
   13.36 -+#endif
   13.37 - }
   13.38 - 
   13.39 - static void
   13.40 -@@ -49,3 +63,4 @@ hpsim_irq_init (void)
   13.41 - 			idesc->handler = &irq_type_hp_sim;
   13.42 - 	}
   13.43 - }
   13.44 -+#endif
    15.1 --- a/xen/arch/ia64/patch/linux-2.6.11/irq.h	Mon May 02 16:07:35 2005 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,23 +0,0 @@
    15.4 - irq.h |    9 +++++++++
    15.5 - 1 files changed, 9 insertions(+)
    15.6 -
    15.7 -Index: linux-2.6.11/include/asm-ia64/irq.h
    15.8 -===================================================================
    15.9 ---- linux-2.6.11.orig/include/asm-ia64/irq.h	2005-03-02 01:38:33.000000000 -0600
   15.10 -+++ linux-2.6.11/include/asm-ia64/irq.h	2005-03-19 13:42:27.957677364 -0600
   15.11 -@@ -30,6 +30,15 @@ extern void disable_irq_nosync (unsigned
   15.12 - extern void enable_irq (unsigned int);
   15.13 - extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
   15.14 - 
   15.15 -+#ifdef XEN
   15.16 -+// dup'ed from signal.h to avoid changes to includes
   15.17 -+#define	SA_NOPROFILE	0x02000000
   15.18 -+#define	SA_SHIRQ	0x04000000
   15.19 -+#define	SA_RESTART	0x10000000
   15.20 -+#define	SA_INTERRUPT	0x20000000
   15.21 -+#define	SA_SAMPLE_RANDOM	SA_RESTART
   15.22 -+#endif
   15.23 -+
   15.24 - #ifdef CONFIG_SMP
   15.25 - extern void move_irq(int irq);
   15.26 - #else
    16.1 --- a/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c	Mon May 02 16:07:35 2005 +0000
    16.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c	Mon May 02 23:55:17 2005 +0000
    16.3 @@ -1,111 +1,22 @@
    16.4 - irq_ia64.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    16.5 - 1 files changed, 67 insertions(+)
    16.6 -
    16.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c
    16.8 -===================================================================
    16.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/irq_ia64.c	2005-04-08 13:30:16.777174938 -0500
   16.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c	2005-04-08 14:15:47.398616472 -0500
   16.11 -@@ -17,18 +17,26 @@
   16.12 - #include <linux/config.h>
   16.13 - #include <linux/module.h>
   16.14 - 
   16.15 -+#ifndef XEN
   16.16 - #include <linux/jiffies.h>
   16.17 -+#endif
   16.18 - #include <linux/errno.h>
   16.19 - #include <linux/init.h>
   16.20 - #include <linux/interrupt.h>
   16.21 - #include <linux/ioport.h>
   16.22 -+#ifndef XEN
   16.23 - #include <linux/kernel_stat.h>
   16.24 -+#endif
   16.25 - #include <linux/slab.h>
   16.26 -+#ifndef XEN
   16.27 - #include <linux/ptrace.h>
   16.28 - #include <linux/random.h>	/* for rand_initialize_irq() */
   16.29 - #include <linux/signal.h>
   16.30 -+#endif
   16.31 - #include <linux/smp.h>
   16.32 -+#ifndef XEN
   16.33 - #include <linux/smp_lock.h>
   16.34 -+#endif
   16.35 - #include <linux/threads.h>
   16.36 - #include <linux/bitops.h>
   16.37 - 
   16.38 -@@ -104,6 +112,24 @@ void
   16.39 - ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
   16.40 - {
   16.41 +--- ../../linux-2.6.11/arch/ia64/kernel/irq_ia64.c	2005-03-02 00:38:07.000000000 -0700
   16.42 ++++ arch/ia64/irq_ia64.c	2005-04-29 16:05:30.000000000 -0600
   16.43 +@@ -106,6 +106,9 @@
   16.44   	unsigned long saved_tpr;
   16.45 -+#if 0
   16.46 -+//FIXME: For debug only, can be removed
   16.47 -+	static char firstirq = 1;
   16.48 -+	static char firsttime[256];
   16.49 -+	static char firstpend[256];
   16.50 -+	if (firstirq) {
   16.51 -+		int i;
   16.52 -+		for (i=0;i<256;i++) firsttime[i] = 1;
   16.53 -+		for (i=0;i<256;i++) firstpend[i] = 1;
   16.54 -+		firstirq = 0;
   16.55 -+	}
   16.56 -+	if (firsttime[vector]) {
   16.57 -+		printf("**** (entry) First received int on vector=%d,itc=%lx\n",
   16.58 -+			(unsigned long) vector, ia64_get_itc());
   16.59 -+		firsttime[vector] = 0;
   16.60 -+	}
   16.61 -+#endif
   16.62 -+
   16.63   
   16.64   #if IRQ_DEBUG
   16.65 ++#ifdef XEN
   16.66 ++	xen_debug_irq(vector, regs);
   16.67 ++#endif
   16.68   	{
   16.69 -@@ -148,6 +174,27 @@ ia64_handle_irq (ia64_vector vector, str
   16.70 + 		unsigned long bsp, sp;
   16.71 + 
   16.72 +@@ -148,6 +151,9 @@
   16.73   			ia64_setreg(_IA64_REG_CR_TPR, vector);
   16.74   			ia64_srlz_d();
   16.75   
   16.76  +#ifdef XEN
   16.77 -+	if (vector != 0xef) {
   16.78 -+		extern void vcpu_pend_interrupt(void *, int);
   16.79 -+#if 0
   16.80 -+		if (firsttime[vector]) {
   16.81 -+			printf("**** (iterate) First received int on vector=%d,itc=%lx\n",
   16.82 -+			(unsigned long) vector, ia64_get_itc());
   16.83 -+			firsttime[vector] = 0;
   16.84 -+		}
   16.85 -+		if (firstpend[vector]) {
   16.86 -+			printf("**** First pended int on vector=%d,itc=%lx\n",
   16.87 -+				(unsigned long) vector,ia64_get_itc());
   16.88 -+			firstpend[vector] = 0;
   16.89 -+		}
   16.90 -+#endif
   16.91 -+		//FIXME: TEMPORARY HACK!!!!
   16.92 -+		vcpu_pend_interrupt(dom0->exec_domain[0],vector);
   16.93 -+		domain_wake(dom0->exec_domain[0]);
   16.94 -+	}
   16.95 -+	else
   16.96 ++			if (!xen_do_IRQ(vector))
   16.97  +#endif
   16.98   			__do_IRQ(local_vector_to_irq(vector), regs);
   16.99   
  16.100   			/*
  16.101 -@@ -276,3 +323,23 @@ ia64_send_ipi (int cpu, int vector, int 
  16.102 - 
  16.103 - 	writeq(ipi_data, ipi_addr);
  16.104 - }
  16.105 -+
  16.106 -+/* From linux/kernel/softirq.c */
  16.107 -+#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
  16.108 -+# define invoke_softirq()	__do_softirq()
  16.109 -+#else
  16.110 -+# define invoke_softirq()	do_softirq()
  16.111 -+#endif
  16.112 -+
  16.113 -+/*
  16.114 -+ * Exit an interrupt context. Process softirqs if needed and possible:
  16.115 -+ */
  16.116 -+void irq_exit(void)
  16.117 -+{
  16.118 -+	account_system_vtime(current);
  16.119 -+	sub_preempt_count(IRQ_EXIT_OFFSET);
  16.120 -+	if (!in_interrupt() && local_softirq_pending())
  16.121 -+		invoke_softirq();
  16.122 -+	preempt_enable_no_resched();
  16.123 -+}
  16.124 -+/* end from linux/kernel/softirq.c */
    17.1 --- a/xen/arch/ia64/patch/linux-2.6.11/ivt.S	Mon May 02 16:07:35 2005 +0000
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,533 +0,0 @@
    17.4 - ivt.S |  254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    17.5 - 1 files changed, 254 insertions(+)
    17.6 -
    17.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S
    17.8 -===================================================================
    17.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/ivt.S	2005-04-07 10:29:00.565766924 -0500
   17.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S	2005-04-07 10:29:50.923594750 -0500
   17.11 -@@ -1,3 +1,21 @@
   17.12 -+
   17.13 -+#ifdef XEN
   17.14 -+//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
   17.15 -+// these are all hacked out for now as the entire IVT
   17.16 -+// will eventually be replaced... just want to use it
   17.17 -+// for startup code to handle TLB misses
   17.18 -+//#define ia64_leave_kernel 0
   17.19 -+//#define ia64_ret_from_syscall 0
   17.20 -+//#define ia64_handle_irq 0
   17.21 -+//#define ia64_fault 0
   17.22 -+#define ia64_illegal_op_fault 0
   17.23 -+#define ia64_prepare_handle_unaligned 0
   17.24 -+#define ia64_bad_break 0
   17.25 -+#define ia64_trace_syscall 0
   17.26 -+#define sys_call_table 0
   17.27 -+#define sys_ni_syscall 0
   17.28 -+#include <asm/vhpt.h>
   17.29 -+#endif
   17.30 - /*
   17.31 -  * arch/ia64/kernel/ivt.S
   17.32 -  *
   17.33 -@@ -77,6 +95,13 @@
   17.34 - 	mov r19=n;;			/* prepare to save predicates */		\
   17.35 - 	br.sptk.many dispatch_to_fault_handler
   17.36 - 
   17.37 -+#ifdef XEN
   17.38 -+#define REFLECT(n)									\
   17.39 -+	mov r31=pr;									\
   17.40 -+	mov r19=n;;			/* prepare to save predicates */		\
   17.41 -+	br.sptk.many dispatch_reflection
   17.42 -+#endif
   17.43 -+
   17.44 - 	.section .text.ivt,"ax"
   17.45 - 
   17.46 - 	.align 32768	// align on 32KB boundary
   17.47 -@@ -214,6 +239,13 @@ END(vhpt_miss)
   17.48 - // 0x0400 Entry 1 (size 64 bundles) ITLB (21)
   17.49 - ENTRY(itlb_miss)
   17.50 - 	DBG_FAULT(1)
   17.51 -+#ifdef XEN
   17.52 -+	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
   17.53 -+#ifdef VHPT_GLOBAL
   17.54 -+	br.cond.sptk page_fault
   17.55 -+	;;
   17.56 -+#endif
   17.57 -+#endif
   17.58 - 	/*
   17.59 - 	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
   17.60 - 	 * page table.  If a nested TLB miss occurs, we switch into physical
   17.61 -@@ -258,6 +290,13 @@ END(itlb_miss)
   17.62 - // 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
   17.63 - ENTRY(dtlb_miss)
   17.64 - 	DBG_FAULT(2)
   17.65 -+#ifdef XEN
   17.66 -+	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
   17.67 -+#ifdef VHPT_GLOBAL
   17.68 -+	br.cond.sptk page_fault
   17.69 -+	;;
   17.70 -+#endif
   17.71 -+#endif
   17.72 - 	/*
   17.73 - 	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
   17.74 - 	 * page table.  If a nested TLB miss occurs, we switch into physical
   17.75 -@@ -302,6 +341,13 @@ END(dtlb_miss)
   17.76 - // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
   17.77 - ENTRY(alt_itlb_miss)
   17.78 - 	DBG_FAULT(3)
   17.79 -+#ifdef XEN
   17.80 -+//#ifdef VHPT_GLOBAL
   17.81 -+//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
   17.82 -+//	br.cond.sptk page_fault
   17.83 -+//	;;
   17.84 -+//#endif
   17.85 -+#endif
   17.86 - 	mov r16=cr.ifa		// get address that caused the TLB miss
   17.87 - 	movl r17=PAGE_KERNEL
   17.88 - 	mov r21=cr.ipsr
   17.89 -@@ -340,6 +386,13 @@ END(alt_itlb_miss)
   17.90 - // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
   17.91 - ENTRY(alt_dtlb_miss)
   17.92 - 	DBG_FAULT(4)
   17.93 -+#ifdef XEN
   17.94 -+//#ifdef VHPT_GLOBAL
   17.95 -+//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
   17.96 -+//	br.cond.sptk page_fault
   17.97 -+//	;;
   17.98 -+//#endif
   17.99 -+#endif
  17.100 - 	mov r16=cr.ifa		// get address that caused the TLB miss
  17.101 - 	movl r17=PAGE_KERNEL
  17.102 - 	mov r20=cr.isr
  17.103 -@@ -369,6 +422,17 @@ ENTRY(alt_dtlb_miss)
  17.104 - 	cmp.ne p8,p0=r0,r23
  17.105 - (p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
  17.106 - (p8)	br.cond.spnt page_fault
  17.107 -+#ifdef XEN
  17.108 -+	;;
  17.109 -+	// FIXME: inadequate test, this is where we test for Xen address
  17.110 -+	// note that 0xf000 (cached) and 0xd000 (uncached) addresses
  17.111 -+	// should be OK.  (Though no I/O is done in Xen, EFI needs uncached
  17.112 -+	// addresses and some domain EFI calls are passed through)
  17.113 -+	tbit.nz p0,p8=r16,60
  17.114 -+(p8)	br.cond.spnt page_fault
  17.115 -+//(p8)	br.cond.spnt 0
  17.116 -+	;;
  17.117 -+#endif
  17.118 - 
  17.119 - 	dep r21=-1,r21,IA64_PSR_ED_BIT,1
  17.120 - 	or r19=r19,r17		// insert PTE control bits into r19
  17.121 -@@ -449,6 +513,9 @@ END(nested_dtlb_miss)
  17.122 - /////////////////////////////////////////////////////////////////////////////////////////
  17.123 - // 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
  17.124 - ENTRY(ikey_miss)
  17.125 -+#ifdef XEN
  17.126 -+	REFLECT(6)
  17.127 -+#endif
  17.128 - 	DBG_FAULT(6)
  17.129 - 	FAULT(6)
  17.130 - END(ikey_miss)
  17.131 -@@ -461,9 +528,16 @@ ENTRY(page_fault)
  17.132 - 	srlz.i
  17.133 - 	;;
  17.134 - 	SAVE_MIN_WITH_COVER
  17.135 -+#ifdef XEN
  17.136 -+	alloc r15=ar.pfs,0,0,4,0
  17.137 -+	mov out0=cr.ifa
  17.138 -+	mov out1=cr.isr
  17.139 -+	mov out3=cr.itir
  17.140 -+#else
  17.141 - 	alloc r15=ar.pfs,0,0,3,0
  17.142 - 	mov out0=cr.ifa
  17.143 - 	mov out1=cr.isr
  17.144 -+#endif
  17.145 - 	adds r3=8,r2				// set up second base pointer
  17.146 - 	;;
  17.147 - 	ssm psr.ic | PSR_DEFAULT_BITS
  17.148 -@@ -484,6 +558,9 @@ END(page_fault)
  17.149 - /////////////////////////////////////////////////////////////////////////////////////////
  17.150 - // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
  17.151 - ENTRY(dkey_miss)
  17.152 -+#ifdef XEN
  17.153 -+	REFLECT(7)
  17.154 -+#endif
  17.155 - 	DBG_FAULT(7)
  17.156 - 	FAULT(7)
  17.157 - END(dkey_miss)
  17.158 -@@ -492,6 +569,9 @@ END(dkey_miss)
  17.159 - /////////////////////////////////////////////////////////////////////////////////////////
  17.160 - // 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
  17.161 - ENTRY(dirty_bit)
  17.162 -+#ifdef XEN
  17.163 -+	REFLECT(8)
  17.164 -+#endif
  17.165 - 	DBG_FAULT(8)
  17.166 - 	/*
  17.167 - 	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
  17.168 -@@ -554,6 +634,9 @@ END(dirty_bit)
  17.169 - /////////////////////////////////////////////////////////////////////////////////////////
  17.170 - // 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
  17.171 - ENTRY(iaccess_bit)
  17.172 -+#ifdef XEN
  17.173 -+	REFLECT(9)
  17.174 -+#endif
  17.175 - 	DBG_FAULT(9)
  17.176 - 	// Like Entry 8, except for instruction access
  17.177 - 	mov r16=cr.ifa				// get the address that caused the fault
  17.178 -@@ -619,6 +702,9 @@ END(iaccess_bit)
  17.179 - /////////////////////////////////////////////////////////////////////////////////////////
  17.180 - // 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
  17.181 - ENTRY(daccess_bit)
  17.182 -+#ifdef XEN
  17.183 -+	REFLECT(10)
  17.184 -+#endif
  17.185 - 	DBG_FAULT(10)
  17.186 - 	// Like Entry 8, except for data access
  17.187 - 	mov r16=cr.ifa				// get the address that caused the fault
  17.188 -@@ -687,6 +773,16 @@ ENTRY(break_fault)
  17.189 - 	 * to prevent leaking bits from kernel to user level.
  17.190 - 	 */
  17.191 - 	DBG_FAULT(11)
  17.192 -+#ifdef XEN
  17.193 -+	mov r16=cr.isr
  17.194 -+	mov r17=cr.iim
  17.195 -+	mov r31=pr
  17.196 -+	;;
  17.197 -+	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
  17.198 -+	// FIXME: may also need to check slot==2?
  17.199 -+(p7)	br.sptk.many dispatch_privop_fault
  17.200 -+	br.sptk.many dispatch_break_fault
  17.201 -+#endif
  17.202 - 	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
  17.203 - 	mov r17=cr.iim
  17.204 - 	mov r18=__IA64_BREAK_SYSCALL
  17.205 -@@ -697,7 +793,9 @@ ENTRY(break_fault)
  17.206 - 	mov r27=ar.rsc
  17.207 - 	mov r26=ar.pfs
  17.208 - 	mov r28=cr.iip
  17.209 -+#ifndef XEN
  17.210 - 	mov r31=pr				// prepare to save predicates
  17.211 -+#endif
  17.212 - 	mov r20=r1
  17.213 - 	;;
  17.214 - 	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
  17.215 -@@ -797,6 +895,36 @@ END(interrupt)
  17.216 - 	DBG_FAULT(13)
  17.217 - 	FAULT(13)
  17.218 - 
  17.219 -+#ifdef XEN
  17.220 -+	// There is no particular reason for this code to be here, other than that
  17.221 -+	// there happens to be space here that would go unused otherwise.  If this
  17.222 -+	// fault ever gets "unreserved", simply moved the following code to a more
  17.223 -+	// suitable spot...
  17.224 -+
  17.225 -+ENTRY(dispatch_break_fault)
  17.226 -+	SAVE_MIN_WITH_COVER
  17.227 -+	;;
  17.228 -+	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
  17.229 -+	mov out0=cr.ifa
  17.230 -+	adds out1=16,sp
  17.231 -+	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  17.232 -+	mov out3=cr.iim		// FIXME: pity to make this slow access twice
  17.233 -+
  17.234 -+	ssm psr.ic | PSR_DEFAULT_BITS
  17.235 -+	;;
  17.236 -+	srlz.i					// guarantee that interruption collection is on
  17.237 -+	;;
  17.238 -+(p15)	ssm psr.i				// restore psr.i
  17.239 -+	adds r3=8,r2				// set up second base pointer
  17.240 -+	;;
  17.241 -+	SAVE_REST
  17.242 -+	movl r14=ia64_leave_kernel
  17.243 -+	;;
  17.244 -+	mov rp=r14
  17.245 -+	br.sptk.many ia64_prepare_handle_break
  17.246 -+END(dispatch_break_fault)
  17.247 -+#endif
  17.248 -+
  17.249 - 	.org ia64_ivt+0x3800
  17.250 - /////////////////////////////////////////////////////////////////////////////////////////
  17.251 - // 0x3800 Entry 14 (size 64 bundles) Reserved
  17.252 -@@ -850,9 +978,11 @@ END(interrupt)
  17.253 - 	 *	- ar.fpsr: set to kernel settings
  17.254 - 	 */
  17.255 - GLOBAL_ENTRY(ia64_syscall_setup)
  17.256 -+#ifndef XEN
  17.257 - #if PT(B6) != 0
  17.258 - # error This code assumes that b6 is the first field in pt_regs.
  17.259 - #endif
  17.260 -+#endif
  17.261 - 	st8 [r1]=r19				// save b6
  17.262 - 	add r16=PT(CR_IPSR),r1			// initialize first base pointer
  17.263 - 	add r17=PT(R11),r1			// initialize second base pointer
  17.264 -@@ -992,6 +1122,37 @@ END(dispatch_illegal_op_fault)
  17.265 - 	DBG_FAULT(16)
  17.266 - 	FAULT(16)
  17.267 - 
  17.268 -+#ifdef XEN
  17.269 -+	// There is no particular reason for this code to be here, other than that
  17.270 -+	// there happens to be space here that would go unused otherwise.  If this
  17.271 -+	// fault ever gets "unreserved", simply moved the following code to a more
  17.272 -+	// suitable spot...
  17.273 -+
  17.274 -+ENTRY(dispatch_privop_fault)
  17.275 -+	SAVE_MIN_WITH_COVER
  17.276 -+	;;
  17.277 -+	alloc r14=ar.pfs,0,0,4,0		// now it's safe (must be first in insn group!)
  17.278 -+	mov out0=cr.ifa
  17.279 -+	adds out1=16,sp
  17.280 -+	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  17.281 -+	mov out3=cr.itir
  17.282 -+
  17.283 -+	ssm psr.ic | PSR_DEFAULT_BITS
  17.284 -+	;;
  17.285 -+	srlz.i					// guarantee that interruption collection is on
  17.286 -+	;;
  17.287 -+(p15)	ssm psr.i				// restore psr.i
  17.288 -+	adds r3=8,r2				// set up second base pointer
  17.289 -+	;;
  17.290 -+	SAVE_REST
  17.291 -+	movl r14=ia64_leave_kernel
  17.292 -+	;;
  17.293 -+	mov rp=r14
  17.294 -+	br.sptk.many ia64_prepare_handle_privop
  17.295 -+END(dispatch_privop_fault)
  17.296 -+#endif
  17.297 -+
  17.298 -+
  17.299 - 	.org ia64_ivt+0x4400
  17.300 - /////////////////////////////////////////////////////////////////////////////////////////
  17.301 - // 0x4400 Entry 17 (size 64 bundles) Reserved
  17.302 -@@ -1108,6 +1269,9 @@ END(dispatch_to_fault_handler)
  17.303 - /////////////////////////////////////////////////////////////////////////////////////////
  17.304 - // 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
  17.305 - ENTRY(page_not_present)
  17.306 -+#ifdef XEN
  17.307 -+	REFLECT(20)
  17.308 -+#endif
  17.309 - 	DBG_FAULT(20)
  17.310 - 	mov r16=cr.ifa
  17.311 - 	rsm psr.dt
  17.312 -@@ -1128,6 +1292,9 @@ END(page_not_present)
  17.313 - /////////////////////////////////////////////////////////////////////////////////////////
  17.314 - // 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
  17.315 - ENTRY(key_permission)
  17.316 -+#ifdef XEN
  17.317 -+	REFLECT(21)
  17.318 -+#endif
  17.319 - 	DBG_FAULT(21)
  17.320 - 	mov r16=cr.ifa
  17.321 - 	rsm psr.dt
  17.322 -@@ -1141,6 +1308,9 @@ END(key_permission)
  17.323 - /////////////////////////////////////////////////////////////////////////////////////////
  17.324 - // 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
  17.325 - ENTRY(iaccess_rights)
  17.326 -+#ifdef XEN
  17.327 -+	REFLECT(22)
  17.328 -+#endif
  17.329 - 	DBG_FAULT(22)
  17.330 - 	mov r16=cr.ifa
  17.331 - 	rsm psr.dt
  17.332 -@@ -1154,6 +1324,9 @@ END(iaccess_rights)
  17.333 - /////////////////////////////////////////////////////////////////////////////////////////
  17.334 - // 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
  17.335 - ENTRY(daccess_rights)
  17.336 -+#ifdef XEN
  17.337 -+	REFLECT(23)
  17.338 -+#endif
  17.339 - 	DBG_FAULT(23)
  17.340 - 	mov r16=cr.ifa
  17.341 - 	rsm psr.dt
  17.342 -@@ -1171,8 +1344,13 @@ ENTRY(general_exception)
  17.343 - 	mov r16=cr.isr
  17.344 - 	mov r31=pr
  17.345 - 	;;
  17.346 -+#ifdef XEN
  17.347 -+	cmp4.ge p6,p0=0x20,r16
  17.348 -+(p6)	br.sptk.many dispatch_privop_fault
  17.349 -+#else
  17.350 - 	cmp4.eq p6,p0=0,r16
  17.351 - (p6)	br.sptk.many dispatch_illegal_op_fault
  17.352 -+#endif
  17.353 - 	;;
  17.354 - 	mov r19=24		// fault number
  17.355 - 	br.sptk.many dispatch_to_fault_handler
  17.356 -@@ -1182,6 +1360,9 @@ END(general_exception)
  17.357 - /////////////////////////////////////////////////////////////////////////////////////////
  17.358 - // 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
  17.359 - ENTRY(disabled_fp_reg)
  17.360 -+#ifdef XEN
  17.361 -+	REFLECT(25)
  17.362 -+#endif
  17.363 - 	DBG_FAULT(25)
  17.364 - 	rsm psr.dfh		// ensure we can access fph
  17.365 - 	;;
  17.366 -@@ -1195,6 +1376,9 @@ END(disabled_fp_reg)
  17.367 - /////////////////////////////////////////////////////////////////////////////////////////
  17.368 - // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
  17.369 - ENTRY(nat_consumption)
  17.370 -+#ifdef XEN
  17.371 -+	REFLECT(26)
  17.372 -+#endif
  17.373 - 	DBG_FAULT(26)
  17.374 - 	FAULT(26)
  17.375 - END(nat_consumption)
  17.376 -@@ -1203,6 +1387,10 @@ END(nat_consumption)
  17.377 - /////////////////////////////////////////////////////////////////////////////////////////
  17.378 - // 0x5700 Entry 27 (size 16 bundles) Speculation (40)
  17.379 - ENTRY(speculation_vector)
  17.380 -+#ifdef XEN
  17.381 -+	// this probably need not reflect...
  17.382 -+	REFLECT(27)
  17.383 -+#endif
  17.384 - 	DBG_FAULT(27)
  17.385 - 	/*
  17.386 - 	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
  17.387 -@@ -1246,6 +1434,9 @@ END(speculation_vector)
  17.388 - /////////////////////////////////////////////////////////////////////////////////////////
  17.389 - // 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
  17.390 - ENTRY(debug_vector)
  17.391 -+#ifdef XEN
  17.392 -+	REFLECT(29)
  17.393 -+#endif
  17.394 - 	DBG_FAULT(29)
  17.395 - 	FAULT(29)
  17.396 - END(debug_vector)
  17.397 -@@ -1254,6 +1445,9 @@ END(debug_vector)
  17.398 - /////////////////////////////////////////////////////////////////////////////////////////
  17.399 - // 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
  17.400 - ENTRY(unaligned_access)
  17.401 -+#ifdef XEN
  17.402 -+	REFLECT(30)
  17.403 -+#endif
  17.404 - 	DBG_FAULT(30)
  17.405 - 	mov r16=cr.ipsr
  17.406 - 	mov r31=pr		// prepare to save predicates
  17.407 -@@ -1265,6 +1459,9 @@ END(unaligned_access)
  17.408 - /////////////////////////////////////////////////////////////////////////////////////////
  17.409 - // 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
  17.410 - ENTRY(unsupported_data_reference)
  17.411 -+#ifdef XEN
  17.412 -+	REFLECT(31)
  17.413 -+#endif
  17.414 - 	DBG_FAULT(31)
  17.415 - 	FAULT(31)
  17.416 - END(unsupported_data_reference)
  17.417 -@@ -1273,6 +1470,9 @@ END(unsupported_data_reference)
  17.418 - /////////////////////////////////////////////////////////////////////////////////////////
  17.419 - // 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
  17.420 - ENTRY(floating_point_fault)
  17.421 -+#ifdef XEN
  17.422 -+	REFLECT(32)
  17.423 -+#endif
  17.424 - 	DBG_FAULT(32)
  17.425 - 	FAULT(32)
  17.426 - END(floating_point_fault)
  17.427 -@@ -1281,6 +1481,9 @@ END(floating_point_fault)
  17.428 - /////////////////////////////////////////////////////////////////////////////////////////
  17.429 - // 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
  17.430 - ENTRY(floating_point_trap)
  17.431 -+#ifdef XEN
  17.432 -+	REFLECT(33)
  17.433 -+#endif
  17.434 - 	DBG_FAULT(33)
  17.435 - 	FAULT(33)
  17.436 - END(floating_point_trap)
  17.437 -@@ -1289,6 +1492,9 @@ END(floating_point_trap)
  17.438 - /////////////////////////////////////////////////////////////////////////////////////////
  17.439 - // 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
  17.440 - ENTRY(lower_privilege_trap)
  17.441 -+#ifdef XEN
  17.442 -+	REFLECT(34)
  17.443 -+#endif
  17.444 - 	DBG_FAULT(34)
  17.445 - 	FAULT(34)
  17.446 - END(lower_privilege_trap)
  17.447 -@@ -1297,6 +1503,9 @@ END(lower_privilege_trap)
  17.448 - /////////////////////////////////////////////////////////////////////////////////////////
  17.449 - // 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
  17.450 - ENTRY(taken_branch_trap)
  17.451 -+#ifdef XEN
  17.452 -+	REFLECT(35)
  17.453 -+#endif
  17.454 - 	DBG_FAULT(35)
  17.455 - 	FAULT(35)
  17.456 - END(taken_branch_trap)
  17.457 -@@ -1305,6 +1514,9 @@ END(taken_branch_trap)
  17.458 - /////////////////////////////////////////////////////////////////////////////////////////
  17.459 - // 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
  17.460 - ENTRY(single_step_trap)
  17.461 -+#ifdef XEN
  17.462 -+	REFLECT(36)
  17.463 -+#endif
  17.464 - 	DBG_FAULT(36)
  17.465 - 	FAULT(36)
  17.466 - END(single_step_trap)
  17.467 -@@ -1361,6 +1573,9 @@ END(single_step_trap)
  17.468 - /////////////////////////////////////////////////////////////////////////////////////////
  17.469 - // 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)
  17.470 - ENTRY(ia32_exception)
  17.471 -+#ifdef XEN
  17.472 -+	REFLECT(45)
  17.473 -+#endif
  17.474 - 	DBG_FAULT(45)
  17.475 - 	FAULT(45)
  17.476 - END(ia32_exception)
  17.477 -@@ -1369,6 +1584,9 @@ END(ia32_exception)
  17.478 - /////////////////////////////////////////////////////////////////////////////////////////
  17.479 - // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
  17.480 - ENTRY(ia32_intercept)
  17.481 -+#ifdef XEN
  17.482 -+	REFLECT(46)
  17.483 -+#endif
  17.484 - 	DBG_FAULT(46)
  17.485 - #ifdef	CONFIG_IA32_SUPPORT
  17.486 - 	mov r31=pr
  17.487 -@@ -1399,6 +1617,9 @@ END(ia32_intercept)
  17.488 - /////////////////////////////////////////////////////////////////////////////////////////
  17.489 - // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
  17.490 - ENTRY(ia32_interrupt)
  17.491 -+#ifdef XEN
  17.492 -+	REFLECT(47)
  17.493 -+#endif
  17.494 - 	DBG_FAULT(47)
  17.495 - #ifdef CONFIG_IA32_SUPPORT
  17.496 - 	mov r31=pr
  17.497 -@@ -1528,6 +1749,39 @@ END(ia32_interrupt)
  17.498 - 	DBG_FAULT(67)
  17.499 - 	FAULT(67)
  17.500 - 
  17.501 -+#ifdef XEN
  17.502 -+	.org ia64_ivt+0x8000
  17.503 -+ENTRY(dispatch_reflection)
  17.504 -+	/*
  17.505 -+	 * Input:
  17.506 -+	 *	psr.ic:	off
  17.507 -+	 *	r19:	intr type (offset into ivt, see ia64_int.h)
  17.508 -+	 *	r31:	contains saved predicates (pr)
  17.509 -+	 */
  17.510 -+	SAVE_MIN_WITH_COVER_R19
  17.511 -+	alloc r14=ar.pfs,0,0,5,0
  17.512 -+	mov out4=r15
  17.513 -+	mov out0=cr.ifa
  17.514 -+	adds out1=16,sp
  17.515 -+	mov out2=cr.isr
  17.516 -+	mov out3=cr.iim
  17.517 -+//	mov out3=cr.itir
  17.518 -+
  17.519 -+	ssm psr.ic | PSR_DEFAULT_BITS
  17.520 -+	;;
  17.521 -+	srlz.i					// guarantee that interruption collection is on
  17.522 -+	;;
  17.523 -+(p15)	ssm psr.i				// restore psr.i
  17.524 -+	adds r3=8,r2				// set up second base pointer
  17.525 -+	;;
  17.526 -+	SAVE_REST
  17.527 -+	movl r14=ia64_leave_kernel
  17.528 -+	;;
  17.529 -+	mov rp=r14
  17.530 -+	br.sptk.many ia64_prepare_handle_reflection
  17.531 -+END(dispatch_reflection)
  17.532 -+#endif
  17.533 -+
  17.534 - #ifdef CONFIG_IA32_SUPPORT
  17.535 - 
  17.536 - 	/*
    18.1 --- a/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c	Mon May 02 16:07:35 2005 +0000
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,44 +0,0 @@
    18.4 - time.c |    7 ++++++-
    18.5 - 1 files changed, 6 insertions(+), 1 deletion(-)
    18.6 -
    18.7 -Index: linux-2.6.11/kernel/time.c
    18.8 -===================================================================
    18.9 ---- linux-2.6.11.orig/kernel/time.c	2005-03-02 01:37:50.000000000 -0600
   18.10 -+++ linux-2.6.11/kernel/time.c	2005-03-19 14:56:40.767870674 -0600
   18.11 -@@ -495,6 +495,7 @@ void getnstimeofday (struct timespec *tv
   18.12 - 	tv->tv_nsec = nsec;
   18.13 - }
   18.14 - 
   18.15 -+#ifndef XEN
   18.16 - int do_settimeofday (struct timespec *tv)
   18.17 - {
   18.18 - 	time_t wtm_sec, sec = tv->tv_sec;
   18.19 -@@ -503,7 +504,9 @@ int do_settimeofday (struct timespec *tv
   18.20 - 	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
   18.21 - 		return -EINVAL;
   18.22 - 
   18.23 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   18.24 - 	write_seqlock_irq(&xtime_lock);
   18.25 -+#endif
   18.26 - 	{
   18.27 - 		/*
   18.28 - 		 * This is revolting. We need to set "xtime" correctly. However, the value
   18.29 -@@ -525,7 +528,9 @@ int do_settimeofday (struct timespec *tv
   18.30 - 		time_esterror = NTP_PHASE_LIMIT;
   18.31 - 		time_interpolator_reset();
   18.32 - 	}
   18.33 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   18.34 - 	write_sequnlock_irq(&xtime_lock);
   18.35 -+#endif
   18.36 - 	clock_was_set();
   18.37 - 	return 0;
   18.38 - }
   18.39 -@@ -552,7 +557,7 @@ void do_gettimeofday (struct timeval *tv
   18.40 - }
   18.41 - 
   18.42 - EXPORT_SYMBOL(do_gettimeofday);
   18.43 --
   18.44 -+#endif
   18.45 - 
   18.46 - #else
   18.47 - /*
    19.1 --- a/xen/arch/ia64/patch/linux-2.6.11/lds.S	Mon May 02 16:07:35 2005 +0000
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,22 +0,0 @@
    19.4 - vmlinux.lds.S |    2 ++
    19.5 - 1 files changed, 2 insertions(+)
    19.6 -
    19.7 -Index: linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S
    19.8 -===================================================================
    19.9 ---- linux-2.6.11.orig/arch/ia64/kernel/vmlinux.lds.S	2005-03-02 01:38:25.000000000 -0600
   19.10 -+++ linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S	2005-03-19 13:44:28.746368232 -0600
   19.11 -@@ -11,12 +11,14 @@
   19.12 - OUTPUT_FORMAT("elf64-ia64-little")
   19.13 - OUTPUT_ARCH(ia64)
   19.14 - ENTRY(phys_start)
   19.15 -+#ifndef XEN
   19.16 - jiffies = jiffies_64;
   19.17 - PHDRS {
   19.18 -   code   PT_LOAD;
   19.19 -   percpu PT_LOAD;
   19.20 -   data   PT_LOAD;
   19.21 - }
   19.22 -+#endif
   19.23 - SECTIONS
   19.24 - {
   19.25 -   /* Sections to be discarded */
    20.1 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c	Mon May 02 16:07:35 2005 +0000
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,16 +0,0 @@
    20.4 - extable.c |    2 ++
    20.5 - 1 files changed, 2 insertions(+)
    20.6 -
    20.7 -Index: linux-2.6.11-xendiffs/kernel/extable.c
    20.8 -===================================================================
    20.9 ---- linux-2.6.11-xendiffs.orig/kernel/extable.c	2005-03-02 01:37:54.000000000 -0600
   20.10 -+++ linux-2.6.11-xendiffs/kernel/extable.c	2005-04-08 14:30:46.283360881 -0500
   20.11 -@@ -20,6 +20,8 @@
   20.12 - #include <asm/uaccess.h>
   20.13 - #include <asm/sections.h>
   20.14 - 
   20.15 -+#define __module_text_address(addr)	(NULL)
   20.16 -+
   20.17 - extern struct exception_table_entry __start___ex_table[];
   20.18 - extern struct exception_table_entry __stop___ex_table[];
   20.19 - 
    21.1 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h	Mon May 02 16:07:35 2005 +0000
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,29 +0,0 @@
    21.4 - hardirq.h |    6 ++++++
    21.5 - 1 files changed, 6 insertions(+)
    21.6 -
    21.7 -Index: linux-2.6.11-xendiffs/include/linux/hardirq.h
    21.8 -===================================================================
    21.9 ---- linux-2.6.11-xendiffs.orig/include/linux/hardirq.h	2005-03-02 01:38:00.000000000 -0600
   21.10 -+++ linux-2.6.11-xendiffs/include/linux/hardirq.h	2005-03-25 08:49:57.301998663 -0600
   21.11 -@@ -2,7 +2,9 @@
   21.12 - #define LINUX_HARDIRQ_H
   21.13 - 
   21.14 - #include <linux/config.h>
   21.15 -+#ifndef XEN
   21.16 - #include <linux/smp_lock.h>
   21.17 -+#endif
   21.18 - #include <asm/hardirq.h>
   21.19 - #include <asm/system.h>
   21.20 - 
   21.21 -@@ -60,7 +62,11 @@
   21.22 -  */
   21.23 - #define in_irq()		(hardirq_count())
   21.24 - #define in_softirq()		(softirq_count())
   21.25 -+#ifndef XEN
   21.26 - #define in_interrupt()		(irq_count())
   21.27 -+#else
   21.28 -+#define in_interrupt()		0		// FIXME LATER
   21.29 -+#endif
   21.30 - 
   21.31 - #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
   21.32 - # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
    22.1 --- a/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h	Mon May 02 16:07:35 2005 +0000
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,36 +0,0 @@
    22.4 - time.h |    9 +++++++++
    22.5 - 1 files changed, 9 insertions(+)
    22.6 -
    22.7 -Index: linux-2.6.11/include/linux/time.h
    22.8 -===================================================================
    22.9 ---- linux-2.6.11.orig/include/linux/time.h	2005-03-02 01:38:12.000000000 -0600
   22.10 -+++ linux-2.6.11/include/linux/time.h	2005-03-19 13:46:27.987225234 -0600
   22.11 -@@ -1,11 +1,18 @@
   22.12 - #ifndef _LINUX_TIME_H
   22.13 - #define _LINUX_TIME_H
   22.14 - 
   22.15 -+#ifdef XEN
   22.16 -+typedef	s64 time_t;
   22.17 -+typedef	s64 suseconds_t;
   22.18 -+#endif
   22.19 -+
   22.20 - #include <linux/types.h>
   22.21 - 
   22.22 -+#ifndef XEN
   22.23 - #ifdef __KERNEL__
   22.24 - #include <linux/seqlock.h>
   22.25 - #endif
   22.26 -+#endif
   22.27 - 
   22.28 - #ifndef _STRUCT_TIMESPEC
   22.29 - #define _STRUCT_TIMESPEC
   22.30 -@@ -80,7 +87,9 @@ mktime (unsigned int year, unsigned int 
   22.31 - 
   22.32 - extern struct timespec xtime;
   22.33 - extern struct timespec wall_to_monotonic;
   22.34 -+#ifndef XEN
   22.35 - extern seqlock_t xtime_lock;
   22.36 -+#endif
   22.37 - 
   22.38 - static inline unsigned long get_seconds(void)
   22.39 - { 
    23.1 --- a/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c	Mon May 02 16:07:35 2005 +0000
    23.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c	Mon May 02 23:55:17 2005 +0000
    23.3 @@ -1,220 +1,47 @@
    23.4 - contig.c |  172 +++++++++++++++++----------------------------------------------
    23.5 - 1 files changed, 48 insertions(+), 124 deletions(-)
    23.6 -
    23.7 -Index: linux-2.6.11-xendiffs/arch/ia64/mm/contig.c
    23.8 -===================================================================
    23.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/mm/contig.c	2005-04-07 11:02:50.227598140 -0500
   23.10 -+++ linux-2.6.11-xendiffs/arch/ia64/mm/contig.c	2005-04-07 11:05:21.724931959 -0500
   23.11 -@@ -15,11 +15,21 @@
   23.12 -  * memory.
   23.13 +--- ../../linux-2.6.11/arch/ia64/mm/contig.c	2005-03-02 00:37:55.000000000 -0700
   23.14 ++++ arch/ia64/mm_contig.c	2005-04-28 16:13:52.000000000 -0600
   23.15 +@@ -35,6 +35,7 @@
   23.16 +  *
   23.17 +  * Just walks the pages in the system and describes where they're allocated.
   23.18    */
   23.19 - #include <linux/config.h>
   23.20 -+#ifdef XEN
   23.21 -+#include <xen/sched.h>
   23.22 -+#endif
   23.23 - #include <linux/bootmem.h>
   23.24 - #include <linux/efi.h>
   23.25 - #include <linux/mm.h>
   23.26 - #include <linux/swap.h>
   23.27 - 
   23.28 -+#ifdef XEN
   23.29 -+#undef reserve_bootmem
   23.30 -+extern struct page *zero_page_memmap_ptr;
   23.31 -+struct page *mem_map;
   23.32 -+#define MAX_DMA_ADDRESS ~0UL	// FIXME???
   23.33 -+#endif
   23.34 -+
   23.35 - #include <asm/meminit.h>
   23.36 - #include <asm/pgalloc.h>
   23.37 - #include <asm/pgtable.h>
   23.38 -@@ -38,30 +48,7 @@ static unsigned long num_dma_physpages;
   23.39 ++#ifndef XEN
   23.40   void
   23.41   show_mem (void)
   23.42   {
   23.43 --	int i, total = 0, reserved = 0;
   23.44 --	int shared = 0, cached = 0;
   23.45 --
   23.46 --	printk("Mem-info:\n");
   23.47 --	show_free_areas();
   23.48 --
   23.49 --	printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
   23.50 --	i = max_mapnr;
   23.51 --	while (i-- > 0) {
   23.52 --		if (!pfn_valid(i))
   23.53 --			continue;
   23.54 --		total++;
   23.55 --		if (PageReserved(mem_map+i))
   23.56 --			reserved++;
   23.57 --		else if (PageSwapCache(mem_map+i))
   23.58 --			cached++;
   23.59 --		else if (page_count(mem_map + i))
   23.60 --			shared += page_count(mem_map + i) - 1;
   23.61 --	}
   23.62 --	printk("%d pages of RAM\n", total);
   23.63 --	printk("%d reserved pages\n", reserved);
   23.64 --	printk("%d pages shared\n", shared);
   23.65 --	printk("%d pages swap cached\n", cached);
   23.66 --	printk("%ld pages in page table cache\n", pgtable_cache_size);
   23.67 -+	printk("Dummy show_mem\n");
   23.68 +@@ -63,6 +64,7 @@
   23.69 + 	printk("%d pages swap cached\n", cached);
   23.70 + 	printk("%ld pages in page table cache\n", pgtable_cache_size);
   23.71   }
   23.72 ++#endif
   23.73   
   23.74   /* physical address where the bootmem map is located */
   23.75 -@@ -81,6 +68,9 @@ find_max_pfn (unsigned long start, unsig
   23.76 + unsigned long bootmap_start;
   23.77 +@@ -140,6 +142,7 @@
   23.78 +  * Walk the EFI memory map and find usable memory for the system, taking
   23.79 +  * into account reserved areas.
   23.80 +  */
   23.81 ++#ifndef XEN
   23.82 + void
   23.83 + find_memory (void)
   23.84   {
   23.85 - 	unsigned long *max_pfnp = arg, pfn;
   23.86 - 
   23.87 -+#ifdef XEN
   23.88 -+//printf("find_max_pfn: start=%lx, end=%lx, *arg=%lx\n",start,end,*(unsigned long *)arg);
   23.89 -+#endif
   23.90 - 	pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT;
   23.91 - 	if (pfn > *max_pfnp)
   23.92 - 		*max_pfnp = pfn;
   23.93 -@@ -134,41 +124,6 @@ find_bootmap_location (unsigned long sta
   23.94 - 	return 0;
   23.95 - }
   23.96 +@@ -168,6 +171,7 @@
   23.97   
   23.98 --/**
   23.99 -- * find_memory - setup memory map
  23.100 -- *
  23.101 -- * Walk the EFI memory map and find usable memory for the system, taking
  23.102 -- * into account reserved areas.
  23.103 -- */
  23.104 --void
  23.105 --find_memory (void)
  23.106 --{
  23.107 --	unsigned long bootmap_size;
  23.108 --
  23.109 --	reserve_memory();
  23.110 --
  23.111 --	/* first find highest page frame number */
  23.112 --	max_pfn = 0;
  23.113 --	efi_memmap_walk(find_max_pfn, &max_pfn);
  23.114 --
  23.115 --	/* how many bytes to cover all the pages */
  23.116 --	bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT;
  23.117 --
  23.118 --	/* look for a location to hold the bootmap */
  23.119 --	bootmap_start = ~0UL;
  23.120 --	efi_memmap_walk(find_bootmap_location, &bootmap_size);
  23.121 --	if (bootmap_start == ~0UL)
  23.122 --		panic("Cannot find %ld bytes for bootmap\n", bootmap_size);
  23.123 --
  23.124 --	bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn);
  23.125 --
  23.126 --	/* Free all available memory, then mark bootmem-map as being in use. */
  23.127 --	efi_memmap_walk(filter_rsvd_memory, free_bootmem);
  23.128 --	reserve_bootmem(bootmap_start, bootmap_size);
  23.129 --
  23.130 --	find_initrd();
  23.131 --}
  23.132 --
  23.133 + 	find_initrd();
  23.134 + }
  23.135 ++#endif
  23.136 + 
  23.137   #ifdef CONFIG_SMP
  23.138   /**
  23.139 -  * per_cpu_init - setup per-cpu variables
  23.140 -@@ -228,72 +183,41 @@ count_dma_pages (u64 start, u64 end, voi
  23.141 +@@ -225,6 +229,7 @@
  23.142 +  * Set up the page tables.
  23.143 +  */
  23.144 + 
  23.145 ++#ifndef XEN
  23.146   void
  23.147   paging_init (void)
  23.148   {
  23.149 --	unsigned long max_dma;
  23.150 --	unsigned long zones_size[MAX_NR_ZONES];
  23.151 --#ifdef CONFIG_VIRTUAL_MEM_MAP
  23.152 --	unsigned long zholes_size[MAX_NR_ZONES];
  23.153 --	unsigned long max_gap;
  23.154 --#endif
  23.155 --
  23.156 --	/* initialize mem_map[] */
  23.157 --
  23.158 --	memset(zones_size, 0, sizeof(zones_size));
  23.159 --
  23.160 --	num_physpages = 0;
  23.161 --	efi_memmap_walk(count_pages, &num_physpages);
  23.162 --
  23.163 --	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  23.164 --
  23.165 --#ifdef CONFIG_VIRTUAL_MEM_MAP
  23.166 --	memset(zholes_size, 0, sizeof(zholes_size));
  23.167 -+	struct pfn_info *pg;
  23.168 -+	/* Allocate and map the machine-to-phys table */
  23.169 -+	if ((pg = alloc_domheap_pages(NULL, 10)) == NULL)
  23.170 -+		panic("Not enough memory to bootstrap Xen.\n");
  23.171 -+	memset(page_to_virt(pg), 0x55, 16UL << 20);
  23.172 - 
  23.173 --	num_dma_physpages = 0;
  23.174 --	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
  23.175 -+	/* Other mapping setup */
  23.176 - 
  23.177 --	if (max_low_pfn < max_dma) {
  23.178 --		zones_size[ZONE_DMA] = max_low_pfn;
  23.179 --		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
  23.180 --	} else {
  23.181 --		zones_size[ZONE_DMA] = max_dma;
  23.182 --		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
  23.183 --		if (num_physpages > num_dma_physpages) {
  23.184 --			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  23.185 --			zholes_size[ZONE_NORMAL] =
  23.186 --				((max_low_pfn - max_dma) -
  23.187 --				 (num_physpages - num_dma_physpages));
  23.188 --		}
  23.189 --	}
  23.190 --
  23.191 --	max_gap = 0;
  23.192 --	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
  23.193 --	if (max_gap < LARGE_GAP) {
  23.194 --		vmem_map = (struct page *) 0;
  23.195 --		free_area_init_node(0, &contig_page_data, zones_size, 0,
  23.196 --				    zholes_size);
  23.197 --	} else {
  23.198 --		unsigned long map_size;
  23.199 --
  23.200 --		/* allocate virtual_mem_map */
  23.201 --
  23.202 --		map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
  23.203 --		vmalloc_end -= map_size;
  23.204 --		vmem_map = (struct page *) vmalloc_end;
  23.205 --		efi_memmap_walk(create_mem_map_page_table, NULL);
  23.206 --
  23.207 --		mem_map = contig_page_data.node_mem_map = vmem_map;
  23.208 --		free_area_init_node(0, &contig_page_data, zones_size,
  23.209 --				    0, zholes_size);
  23.210 --
  23.211 --		printk("Virtual mem_map starts at 0x%p\n", mem_map);
  23.212 --	}
  23.213 --#else /* !CONFIG_VIRTUAL_MEM_MAP */
  23.214 --	if (max_low_pfn < max_dma)
  23.215 --		zones_size[ZONE_DMA] = max_low_pfn;
  23.216 --	else {
  23.217 --		zones_size[ZONE_DMA] = max_dma;
  23.218 --		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  23.219 --	}
  23.220 --	free_area_init(zones_size);
  23.221 --#endif /* !CONFIG_VIRTUAL_MEM_MAP */
  23.222 +@@ -297,3 +302,4 @@
  23.223 + #endif /* !CONFIG_VIRTUAL_MEM_MAP */
  23.224   	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
  23.225   }
  23.226 -+
  23.227 -+struct pfn_info *frame_table;
  23.228 -+unsigned long frame_table_size;
  23.229 -+unsigned long max_page;
  23.230 -+
  23.231 -+/* FIXME: postpone support to machines with big holes between physical memorys.
  23.232 -+ * Current hack allows only efi memdesc upto 4G place. (See efi.c)
  23.233 -+ */
  23.234 -+#ifndef CONFIG_VIRTUAL_MEM_MAP
  23.235 -+#define FT_ALIGN_SIZE	(16UL << 20)
  23.236 -+void __init init_frametable(void)
  23.237 -+{
  23.238 -+	unsigned long i, p;
  23.239 -+	frame_table_size = max_page * sizeof(struct pfn_info);
  23.240 -+	frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
  23.241 -+
  23.242 -+	/* Request continuous trunk from boot allocator, since HV
  23.243 -+	 * address is identity mapped */
  23.244 -+	p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE);
  23.245 -+	if (p == 0)
  23.246 -+		panic("Not enough memory for frame table.\n");
  23.247 -+
  23.248 -+	frame_table = __va(p);
  23.249 -+	memset(frame_table, 0, frame_table_size);
  23.250 -+	printk("size of frame_table: %lukB\n",
  23.251 -+		frame_table_size >> 10);
  23.252 -+}
  23.253 -+#endif
  23.254 ++#endif /* !CONFIG_XEN */
    24.1 --- a/xen/arch/ia64/patch/linux-2.6.11/mmzone.h	Mon May 02 16:07:35 2005 +0000
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,19 +0,0 @@
    24.4 - mmzone.h |    4 ++++
    24.5 - 1 files changed, 4 insertions(+)
    24.6 -
    24.7 -Index: linux-2.6.11/include/linux/mmzone.h
    24.8 -===================================================================
    24.9 ---- linux-2.6.11.orig/include/linux/mmzone.h	2005-03-02 01:38:10.000000000 -0600
   24.10 -+++ linux-2.6.11/include/linux/mmzone.h	2005-03-19 13:49:30.427573139 -0600
   24.11 -@@ -209,7 +209,11 @@ struct zone {
   24.12 - 	 * rarely used fields:
   24.13 - 	 */
   24.14 - 	char			*name;
   24.15 -+#ifdef XEN
   24.16 -+};
   24.17 -+#else
   24.18 - } ____cacheline_maxaligned_in_smp;
   24.19 -+#endif
   24.20 - 
   24.21 - 
   24.22 - /*
    25.1 --- a/xen/arch/ia64/patch/linux-2.6.11/page.h	Mon May 02 16:07:35 2005 +0000
    25.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/page.h	Mon May 02 23:55:17 2005 +0000
    25.3 @@ -1,52 +1,34 @@
    25.4 - page.h |   42 +++++++++++++++++++++++++++++++++++++++---
    25.5 - 1 files changed, 39 insertions(+), 3 deletions(-)
    25.6 -
    25.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h
    25.8 -===================================================================
    25.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/page.h	2005-04-06 22:58:07.597539393 -0500
   25.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/page.h	2005-04-06 23:06:15.908576975 -0500
   25.11 -@@ -12,6 +12,9 @@
   25.12 - #include <asm/intrinsics.h>
   25.13 - #include <asm/types.h>
   25.14 - 
   25.15 -+#ifndef __ASSEMBLY__
   25.16 -+#include <asm/flushtlb.h>
   25.17 -+#endif
   25.18 - /*
   25.19 -  * PAGE_SHIFT determines the actual kernel page size.
   25.20 -  */
   25.21 -@@ -95,9 +98,11 @@ extern int ia64_pfn_valid (unsigned long
   25.22 +--- ../../linux-2.6.11/include/asm-ia64/page.h	2005-03-02 00:37:48.000000000 -0700
   25.23 ++++ include/asm-ia64/page.h	2005-05-02 11:25:33.000000000 -0600
   25.24 +@@ -95,9 +95,15 @@
   25.25   #endif
   25.26   
   25.27   #ifndef CONFIG_DISCONTIGMEM
   25.28  +#ifdef XEN
   25.29 -+#define pfn_valid(pfn)		(0)
   25.30 ++# define pfn_valid(pfn)		(0)
   25.31 ++# define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
   25.32 ++# define pfn_to_page(_pfn)	(frame_table + (_pfn))
   25.33  +#else
   25.34   # define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
   25.35 --# define page_to_pfn(page)	((unsigned long) (page - mem_map))
   25.36 --# define pfn_to_page(pfn)	(mem_map + (pfn))
   25.37 + # define page_to_pfn(page)	((unsigned long) (page - mem_map))
   25.38 + # define pfn_to_page(pfn)	(mem_map + (pfn))
   25.39  +#endif
   25.40   #else
   25.41   extern struct page *vmem_map;
   25.42   extern unsigned long max_low_pfn;
   25.43 -@@ -106,9 +111,15 @@ extern unsigned long max_low_pfn;
   25.44 - # define pfn_to_page(pfn)	(vmem_map + (pfn))
   25.45 - #endif
   25.46 - 
   25.47 --#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   25.48 -+#define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
   25.49 -+#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
   25.50 -+
   25.51 -+#define page_to_phys(_page)	(page_to_pfn(_page) << PAGE_SHIFT)
   25.52 +@@ -109,6 +115,11 @@
   25.53 + #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   25.54   #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
   25.55   
   25.56 -+#define pfn_to_page(_pfn)	(frame_table + (_pfn))
   25.57 ++#ifdef XEN
   25.58 ++#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
   25.59  +#define phys_to_page(kaddr)	pfn_to_page(((kaddr) >> PAGE_SHIFT))
   25.60 ++#endif
   25.61  +
   25.62   typedef union ia64_va {
   25.63   	struct {
   25.64   		unsigned long off : 61;		/* intra-region offset */
   25.65 -@@ -124,8 +135,25 @@ typedef union ia64_va {
   25.66 +@@ -124,8 +135,23 @@
   25.67    * expressed in this way to ensure they result in a single "dep"
   25.68    * instruction.
   25.69    */
   25.70 @@ -63,8 +45,6 @@ Index: linux-2.6.11-xendiffs/include/asm
   25.71  +// xen/drivers/console.c uses __va in a declaration (should be fixed!)
   25.72  +#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   25.73  +#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   25.74 -+//# define __pa(x)	((unsigned long)(((unsigned long)x) - PAGE_OFFSET))
   25.75 -+//# define __va(x)	((void *)((char *)(x) + PAGE_OFFSET))
   25.76  +#else
   25.77   #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   25.78   #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   25.79 @@ -72,7 +52,7 @@ Index: linux-2.6.11-xendiffs/include/asm
   25.80   
   25.81   #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
   25.82   #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
   25.83 -@@ -197,11 +225,19 @@ get_order (unsigned long size)
   25.84 +@@ -197,7 +223,11 @@
   25.85   # define __pgprot(x)	(x)
   25.86   #endif /* !STRICT_MM_TYPECHECKS */
   25.87   
   25.88 @@ -84,11 +64,3 @@ Index: linux-2.6.11-xendiffs/include/asm
   25.89   
   25.90   #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
   25.91   					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
   25.92 - 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
   25.93 - 					  ? VM_EXEC : 0))
   25.94 - 
   25.95 -+#ifdef XEN
   25.96 -+#define __flush_tlb() do {} while(0);
   25.97 -+#endif
   25.98 -+
   25.99 - #endif /* _ASM_IA64_PAGE_H */
    26.1 --- a/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Mon May 02 16:07:35 2005 +0000
    26.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Mon May 02 23:55:17 2005 +0000
    26.3 @@ -1,78 +1,72 @@
    26.4 - pgalloc.h |   17 +++++++++++------
    26.5 - 1 files changed, 11 insertions(+), 6 deletions(-)
    26.6 -
    26.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h
    26.8 -===================================================================
    26.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/pgalloc.h	2005-04-08 11:57:30.909774800 -0500
   26.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h	2005-04-08 11:58:08.102711219 -0500
   26.11 -@@ -18,6 +18,7 @@
   26.12 - #include <linux/compiler.h>
   26.13 - #include <linux/mm.h>
   26.14 - #include <linux/page-flags.h>
   26.15 -+#include <linux/preempt.h>
   26.16 - #include <linux/threads.h>
   26.17 - 
   26.18 - #include <asm/mmu_context.h>
   26.19 -@@ -34,6 +35,10 @@
   26.20 - #define pmd_quicklist		(local_cpu_data->pmd_quick)
   26.21 - #define pgtable_cache_size	(local_cpu_data->pgtable_cache_sz)
   26.22 - 
   26.23 -+/* FIXME: Later 3 level page table should be over, to create 
   26.24 -+ * new interface upon xen memory allocator. To simplify first
   26.25 -+ * effort moving to xen allocator, use xenheap pages temporarily. 
   26.26 -+ */
   26.27 - static inline pgd_t*
   26.28 - pgd_alloc_one_fast (struct mm_struct *mm)
   26.29 - {
   26.30 -@@ -61,7 +66,7 @@ pgd_alloc (struct mm_struct *mm)
   26.31 +--- ../../linux-2.6.11/include/asm-ia64/pgalloc.h	2005-03-02 00:37:31.000000000 -0700
   26.32 ++++ include/asm-ia64/pgalloc.h	2005-04-29 17:09:20.000000000 -0600
   26.33 +@@ -61,7 +61,11 @@
   26.34   	pgd_t *pgd = pgd_alloc_one_fast(mm);
   26.35   
   26.36   	if (unlikely(pgd == NULL)) {
   26.37 --		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
   26.38 ++#ifdef XEN
   26.39  +		pgd = (pgd_t *)alloc_xenheap_page();
   26.40 ++#else
   26.41 + 		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
   26.42 ++#endif
   26.43   	}
   26.44   	return pgd;
   26.45   }
   26.46 -@@ -104,7 +109,7 @@ pmd_alloc_one_fast (struct mm_struct *mm
   26.47 +@@ -104,7 +108,11 @@
   26.48   static inline pmd_t*
   26.49   pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
   26.50   {
   26.51 --	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   26.52 ++#ifdef XEN
   26.53  +	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
   26.54 ++#else
   26.55 + 	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   26.56 ++#endif
   26.57   
   26.58   	return pmd;
   26.59   }
   26.60 -@@ -136,7 +141,7 @@ pmd_populate_kernel (struct mm_struct *m
   26.61 +@@ -136,7 +144,11 @@
   26.62   static inline struct page *
   26.63   pte_alloc_one (struct mm_struct *mm, unsigned long addr)
   26.64   {
   26.65 --	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
   26.66 ++#ifdef XEN
   26.67  +	struct page *pte = alloc_xenheap_page();
   26.68 ++#else
   26.69 + 	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
   26.70 ++#endif
   26.71   
   26.72   	return pte;
   26.73   }
   26.74 -@@ -144,7 +149,7 @@ pte_alloc_one (struct mm_struct *mm, uns
   26.75 +@@ -144,7 +156,11 @@
   26.76   static inline pte_t *
   26.77   pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
   26.78   {
   26.79 --	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   26.80 ++#ifdef XEN
   26.81  +	pte_t *pte = (pte_t *)alloc_xenheap_page();
   26.82 ++#else
   26.83 + 	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   26.84 ++#endif
   26.85   
   26.86   	return pte;
   26.87   }
   26.88 -@@ -152,13 +157,13 @@ pte_alloc_one_kernel (struct mm_struct *
   26.89 +@@ -152,13 +168,21 @@
   26.90   static inline void
   26.91   pte_free (struct page *pte)
   26.92   {
   26.93 --	__free_page(pte);
   26.94 ++#ifdef XEN
   26.95  +	free_xenheap_page(pte);
   26.96 ++#else
   26.97 + 	__free_page(pte);
   26.98 ++#endif
   26.99   }
  26.100   
  26.101   static inline void
  26.102   pte_free_kernel (pte_t *pte)
  26.103   {
  26.104 --	free_page((unsigned long) pte);
  26.105 ++#ifdef XEN
  26.106  +	free_xenheap_page((unsigned long) pte);
  26.107 ++#else
  26.108 + 	free_page((unsigned long) pte);
  26.109 ++#endif
  26.110   }
  26.111   
  26.112   #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
    27.1 --- a/xen/arch/ia64/patch/linux-2.6.11/sal.h	Mon May 02 16:07:35 2005 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,39 +0,0 @@
    27.4 - sal.h |   17 +++++++++++++++++
    27.5 - 1 files changed, 17 insertions(+)
    27.6 -
    27.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/sal.h
    27.8 -===================================================================
    27.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/sal.h	2005-04-08 12:00:53.510988510 -0500
   27.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/sal.h	2005-04-08 12:02:17.778587216 -0500
   27.11 -@@ -36,6 +36,7 @@
   27.12 - #ifndef __ASSEMBLY__
   27.13 - 
   27.14 - #include <linux/bcd.h>
   27.15 -+#include <linux/preempt.h>
   27.16 - #include <linux/spinlock.h>
   27.17 - #include <linux/efi.h>
   27.18 - 
   27.19 -@@ -650,7 +651,23 @@ ia64_sal_freq_base (unsigned long which,
   27.20 - {
   27.21 - 	struct ia64_sal_retval isrv;
   27.22 - 
   27.23 -+//#ifdef XEN
   27.24 -+#if 0
   27.25 -+	unsigned long *x = (unsigned long *)ia64_sal;
   27.26 -+	unsigned long *inst = (unsigned long *)*x;
   27.27 -+	unsigned long __ia64_sc_flags;
   27.28 -+	struct ia64_fpreg __ia64_sc_fr[6];
   27.29 -+printf("ia64_sal_freq_base: about to save_scratch_fpregs\n");
   27.30 -+	ia64_save_scratch_fpregs(__ia64_sc_fr);
   27.31 -+	spin_lock_irqsave(&sal_lock, __ia64_sc_flags);
   27.32 -+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]);
   27.33 -+printf("first inst=%p,%p\n",inst[0],inst[1]);
   27.34 -+	isrv = (*ia64_sal)(SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   27.35 -+	spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags);
   27.36 -+	ia64_load_scratch_fpregs(__ia64_sc_fr);
   27.37 -+#else
   27.38 - 	SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   27.39 -+#endif
   27.40 - 	*ticks_per_second = isrv.v0;
   27.41 - 	*drift_info = isrv.v1;
   27.42 - 	return isrv.status;
    28.1 --- a/xen/arch/ia64/patch/linux-2.6.11/setup.c	Mon May 02 16:07:35 2005 +0000
    28.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/setup.c	Mon May 02 23:55:17 2005 +0000
    28.3 @@ -1,191 +1,96 @@
    28.4 - setup.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------
    28.5 - 1 files changed, 58 insertions(+), 14 deletions(-)
    28.6 -
    28.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c
    28.8 -===================================================================
    28.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/setup.c	2005-04-07 17:44:13.294980153 -0500
   28.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c	2005-04-07 17:46:37.157717072 -0500
   28.11 -@@ -21,6 +21,9 @@
   28.12 - #include <linux/init.h>
   28.13 - 
   28.14 - #include <linux/acpi.h>
   28.15 -+#ifdef XEN
   28.16 -+#include <xen/sched.h>
   28.17 -+#endif
   28.18 - #include <linux/bootmem.h>
   28.19 - #include <linux/console.h>
   28.20 - #include <linux/delay.h>
   28.21 -@@ -30,13 +33,17 @@
   28.22 - #include <linux/seq_file.h>
   28.23 - #include <linux/string.h>
   28.24 - #include <linux/threads.h>
   28.25 -+#ifndef XEN
   28.26 - #include <linux/tty.h>
   28.27 - #include <linux/serial.h>
   28.28 - #include <linux/serial_core.h>
   28.29 -+#endif
   28.30 - #include <linux/efi.h>
   28.31 - #include <linux/initrd.h>
   28.32 +--- ../../linux-2.6.11/arch/ia64/kernel/setup.c	2005-03-02 00:37:49.000000000 -0700
   28.33 ++++ arch/ia64/setup.c	2005-05-02 10:04:03.000000000 -0600
   28.34 +@@ -127,7 +127,16 @@
   28.35 + 		range_end   = min(end, rsvd_region[i].start);
   28.36   
   28.37 -+#ifndef XEN
   28.38 - #include <asm/ia32.h>
   28.39 -+#endif
   28.40 - #include <asm/machvec.h>
   28.41 - #include <asm/mca.h>
   28.42 - #include <asm/meminit.h>
   28.43 -@@ -51,6 +58,12 @@
   28.44 - #include <asm/smp.h>
   28.45 - #include <asm/system.h>
   28.46 - #include <asm/unistd.h>
   28.47 + 		if (range_start < range_end)
   28.48  +#ifdef XEN
   28.49 -+#include <linux/mm.h>
   28.50 -+#include <asm/mmu_context.h>
   28.51 -+extern unsigned long loops_per_jiffy;		// from linux/init/main.c
   28.52 -+char saved_command_line[COMMAND_LINE_SIZE];	// from linux/init/main.c
   28.53 -+#endif
   28.54 - 
   28.55 - #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
   28.56 - # error "struct cpuinfo_ia64 too big!"
   28.57 -@@ -66,7 +79,9 @@ DEFINE_PER_CPU(unsigned long, local_per_
   28.58 - DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
   28.59 - unsigned long ia64_cycles_per_usec;
   28.60 - struct ia64_boot_param *ia64_boot_param;
   28.61 -+#ifndef XEN
   28.62 - struct screen_info screen_info;
   28.63 -+#endif
   28.64 - 
   28.65 - unsigned long ia64_max_cacheline_size;
   28.66 - unsigned long ia64_iobase;	/* virtual address for I/O accesses */
   28.67 -@@ -95,7 +110,6 @@ EXPORT_SYMBOL(ia64_max_iommu_merge_mask)
   28.68 - struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
   28.69 - int num_rsvd_regions;
   28.70 - 
   28.71 --
   28.72 - /*
   28.73 -  * Filter incoming memory segments based on the primitive map created from the boot
   28.74 -  * parameters. Segments contained in the map are removed from the memory ranges. A
   28.75 -@@ -125,9 +139,12 @@ filter_rsvd_memory (unsigned long start,
   28.76 - 	for (i = 0; i < num_rsvd_regions; ++i) {
   28.77 - 		range_start = max(start, prev_start);
   28.78 - 		range_end   = min(end, rsvd_region[i].start);
   28.79 --
   28.80 --		if (range_start < range_end)
   28.81 --			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   28.82 ++		{
   28.83  +		/* init_boot_pages requires "ps, pe" */
   28.84 -+		if (range_start < range_end) {
   28.85  +			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
   28.86  +				__pa(range_start), __pa(range_end));
   28.87  +			(*func)(__pa(range_start), __pa(range_end), 0);
   28.88  +		}
   28.89 ++#else
   28.90 + 			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   28.91 ++#endif
   28.92   
   28.93   		/* nothing more available in this segment */
   28.94   		if (range_end == end) return 0;
   28.95 -@@ -184,17 +201,17 @@ reserve_memory (void)
   28.96 - 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
   28.97 - 	n++;
   28.98 - 
   28.99 -+	/* Reserve xen image/bitmap/xen-heap */
  28.100 - 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
  28.101 --	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
  28.102 -+	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
  28.103 +@@ -185,7 +194,12 @@
  28.104   	n++;
  28.105   
  28.106 --#ifdef CONFIG_BLK_DEV_INITRD
  28.107 -+	/* This is actually dom0 image */
  28.108 - 	if (ia64_boot_param->initrd_start) {
  28.109 - 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
  28.110 - 		rsvd_region[n].end   = rsvd_region[n].start + ia64_boot_param->initrd_size;
  28.111 - 		n++;
  28.112 - 	}
  28.113 --#endif
  28.114 + 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
  28.115 ++#ifdef XEN
  28.116 ++	/* Reserve xen image/bitmap/xen-heap */
  28.117 ++	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
  28.118 ++#else
  28.119 + 	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
  28.120 ++#endif
  28.121 + 	n++;
  28.122   
  28.123 - 	/* end of memory marker */
  28.124 - 	rsvd_region[n].start = ~0UL;
  28.125 -@@ -204,6 +221,16 @@ reserve_memory (void)
  28.126 - 	num_rsvd_regions = n;
  28.127 - 
  28.128 - 	sort_regions(rsvd_region, num_rsvd_regions);
  28.129 -+
  28.130 -+	{
  28.131 -+		int i;
  28.132 -+		printk("Reserved regions: \n");
  28.133 -+		for (i = 0; i < num_rsvd_regions; i++)
  28.134 -+			printk("  [%d] -> [0x%lx, 0x%lx]\n",
  28.135 -+				i,
  28.136 -+				rsvd_region[i].start,
  28.137 -+				rsvd_region[i].end);
  28.138 -+	}
  28.139 + #ifdef CONFIG_BLK_DEV_INITRD
  28.140 +@@ -299,7 +313,11 @@
  28.141   }
  28.142   
  28.143 - /**
  28.144 -@@ -298,18 +325,17 @@ mark_bsp_online (void)
  28.145 - #endif
  28.146 - }
  28.147 - 
  28.148 + void __init
  28.149  +#ifdef XEN
  28.150 - void __init
  28.151 --setup_arch (char **cmdline_p)
  28.152  +early_setup_arch (char **cmdline_p)
  28.153 ++#else
  28.154 + setup_arch (char **cmdline_p)
  28.155 ++#endif
  28.156   {
  28.157   	unw_init();
  28.158   
  28.159 --	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
  28.160 --
  28.161 +@@ -308,8 +326,14 @@
  28.162   	*cmdline_p = __va(ia64_boot_param->command_line);
  28.163   	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  28.164 + 
  28.165 ++#ifdef XEN
  28.166  +	cmdline_parse(*cmdline_p);
  28.167 - 
  28.168 ++#undef CONFIG_ACPI_BOOT
  28.169 ++#endif
  28.170   	efi_init();
  28.171 --	io_port_init();
  28.172 ++#ifndef XEN
  28.173 + 	io_port_init();
  28.174 ++#endif
  28.175   
  28.176   #ifdef CONFIG_IA64_GENERIC
  28.177   	{
  28.178 -@@ -339,6 +365,10 @@ setup_arch (char **cmdline_p)
  28.179 - 	if (early_console_setup(*cmdline_p) == 0)
  28.180 - 		mark_bsp_online();
  28.181 +@@ -351,8 +375,17 @@
  28.182 + # endif
  28.183 + #endif /* CONFIG_APCI_BOOT */
  28.184   
  28.185 -+#ifdef XEN
  28.186 ++#ifndef XEN
  28.187 + 	find_memory();
  28.188 ++#else
  28.189 ++	io_port_init();
  28.190 ++}
  28.191 + 
  28.192 ++void __init
  28.193 ++late_setup_arch (char **cmdline_p)
  28.194 ++{
  28.195  +#undef CONFIG_ACPI_BOOT
  28.196  +#endif
  28.197 -+
  28.198 - #ifdef CONFIG_ACPI_BOOT
  28.199 - 	/* Initialize the ACPI boot-time table parser */
  28.200 - 	acpi_table_init();
  28.201 -@@ -350,9 +380,13 @@ setup_arch (char **cmdline_p)
  28.202 - 	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
  28.203 - # endif
  28.204 - #endif /* CONFIG_APCI_BOOT */
  28.205 -+	io_port_init();
  28.206 -+}
  28.207 -+#endif
  28.208 - 
  28.209 --	find_memory();
  28.210 --
  28.211 -+void __init
  28.212 -+setup_arch (void)
  28.213 -+{
  28.214   	/* process SAL system table: */
  28.215   	ia64_sal_init(efi.sal_systab);
  28.216   
  28.217 -@@ -388,7 +422,6 @@ setup_arch (char **cmdline_p)
  28.218 - 	if (!strstr(saved_command_line, "nomca"))
  28.219 - 		ia64_mca_init();
  28.220 - 
  28.221 --	platform_setup(cmdline_p);
  28.222 - 	paging_init();
  28.223 +@@ -492,12 +525,14 @@
  28.224 + {
  28.225   }
  28.226   
  28.227 -@@ -448,6 +481,9 @@ show_cpuinfo (struct seq_file *m, void *
  28.228 - 		sprintf(cp, " 0x%lx", mask);
  28.229 - 	}
  28.230 ++#ifndef XEN
  28.231 + struct seq_operations cpuinfo_op = {
  28.232 + 	.start =	c_start,
  28.233 + 	.next =		c_next,
  28.234 + 	.stop =		c_stop,
  28.235 + 	.show =		show_cpuinfo
  28.236 + };
  28.237 ++#endif
  28.238   
  28.239 -+#ifdef XEN
  28.240 -+#define seq_printf(a,b...) printf(b)
  28.241 -+#endif
  28.242 - 	seq_printf(m,
  28.243 - 		   "processor  : %d\n"
  28.244 - 		   "vendor     : %s\n"
  28.245 -@@ -659,11 +695,17 @@ cpu_init (void)
  28.246 + void
  28.247 + identify_cpu (struct cpuinfo_ia64 *c)
  28.248 +@@ -659,7 +694,11 @@
  28.249   					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
  28.250   	atomic_inc(&init_mm.mm_count);
  28.251   	current->active_mm = &init_mm;
  28.252 @@ -197,18 +102,3 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  28.253   		BUG();
  28.254   
  28.255   	ia64_mmu_init(ia64_imva(cpu_data));
  28.256 -+#ifndef XEN
  28.257 - 	ia64_mca_cpu_init(ia64_imva(cpu_data));
  28.258 -+#endif
  28.259 - 
  28.260 - #ifdef CONFIG_IA32_SUPPORT
  28.261 - 	ia32_cpu_init();
  28.262 -@@ -711,6 +753,8 @@ cpu_init (void)
  28.263 - void
  28.264 - check_bugs (void)
  28.265 - {
  28.266 -+#ifndef XEN
  28.267 - 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
  28.268 - 			       (unsigned long) __end___mckinley_e9_bundles);
  28.269 -+#endif
  28.270 - }
    29.1 --- a/xen/arch/ia64/patch/linux-2.6.11/slab.h	Mon May 02 16:07:35 2005 +0000
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,19 +0,0 @@
    29.4 - slab.h |    4 ++++
    29.5 - 1 files changed, 4 insertions(+)
    29.6 -
    29.7 -Index: linux-2.6.11/include/linux/slab.h
    29.8 -===================================================================
    29.9 ---- linux-2.6.11.orig/include/linux/slab.h	2005-03-02 01:38:33.000000000 -0600
   29.10 -+++ linux-2.6.11/include/linux/slab.h	2005-03-19 14:35:19.301871922 -0600
   29.11 -@@ -91,7 +91,11 @@ static inline void *kmalloc(size_t size,
   29.12 - 			goto found; \
   29.13 - 		else \
   29.14 - 			i++;
   29.15 -+#ifdef XEN
   29.16 -+#include <linux/kmalloc_sizes.h>
   29.17 -+#else
   29.18 - #include "kmalloc_sizes.h"
   29.19 -+#endif
   29.20 - #undef CACHE
   29.21 - 		{
   29.22 - 			extern void __you_cannot_kmalloc_that_much(void);
    30.1 --- a/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c	Mon May 02 16:07:35 2005 +0000
    30.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c	Mon May 02 23:55:17 2005 +0000
    30.3 @@ -1,70 +1,22 @@
    30.4 - swiotlb.c |   21 +++++++++++++--------
    30.5 - 1 files changed, 13 insertions(+), 8 deletions(-)
    30.6 -
    30.7 -Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c
    30.8 -===================================================================
    30.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c	2005-04-08 12:13:54.040202667 -0500
   30.10 -+++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c	2005-04-08 12:19:09.170367318 -0500
   30.11 -@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d
   30.12 - 	/*
   30.13 - 	 * Get IO TLB memory from the low pages
   30.14 - 	 */
   30.15 --	io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
   30.16 --					       (1 << IO_TLB_SHIFT));
   30.17 -+	/* FIXME: Do we really need swiotlb in HV? If all memory trunks
   30.18 -+	 * presented to guest as <4G, are actually <4G in machine range,
   30.19 -+	 * no DMA intevention from HV...
   30.20 -+	 */
   30.21 -+	io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)));
   30.22 - 	if (!io_tlb_start)
   30.23 - 		panic("Cannot allocate SWIOTLB buffer");
   30.24 - 	io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
   30.25 -@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d
   30.26 - 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
   30.27 - 	 * between io_tlb_start and io_tlb_end.
   30.28 - 	 */
   30.29 --	io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
   30.30 -+	io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int)));
   30.31 - 	for (i = 0; i < io_tlb_nslabs; i++)
   30.32 -  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
   30.33 - 	io_tlb_index = 0;
   30.34 --	io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
   30.35 -+	io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *)));
   30.36 +--- ../../linux-2.6.11/arch/ia64/lib/swiotlb.c	2005-03-02 00:38:17.000000000 -0700
   30.37 ++++ arch/ia64/lib/swiotlb.c	2005-05-02 13:04:15.000000000 -0600
   30.38 +@@ -49,6 +49,15 @@
   30.39 +  */
   30.40 + #define IO_TLB_SHIFT 11
   30.41   
   30.42 - 	/*
   30.43 - 	 * Get the overflow emergency buffer
   30.44 - 	 */
   30.45 --	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
   30.46 -+	io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow));
   30.47 - 	printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
   30.48 - 	       virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
   30.49 - }
   30.50 -@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw
   30.51 - 	 */
   30.52 - 	flags |= GFP_DMA;
   30.53 ++#ifdef XEN
   30.54 ++#define __order_to_size(_order) (1 << (_order+PAGE_SHIFT))
   30.55 ++#define alloc_bootmem_low_pages(_x) alloc_xenheap_pages(get_order(_x))
   30.56 ++#define alloc_bootmem_low(_x) alloc_xenheap_pages(get_order(_x))
   30.57 ++#define alloc_bootmem(_x) alloc_xenheap_pages(get_order(_x))
   30.58 ++#define __get_free_pages(_x,_y) alloc_xenheap_pages(__order_to_size(_y))
   30.59 ++#define free_pages(_x,_y) free_xenheap_pages(_x,_y)
   30.60 ++#endif
   30.61 ++
   30.62 + int swiotlb_force;
   30.63   
   30.64 --	ret = (void *)__get_free_pages(flags, order);
   30.65 -+	ret = (void *)alloc_xenheap_pages(get_order(size));
   30.66 - 	if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
   30.67 - 		/*
   30.68 - 		 * The allocated memory isn't reachable by the device.
   30.69 - 		 * Fall back on swiotlb_map_single().
   30.70 - 		 */
   30.71 --		free_pages((unsigned long) ret, order);
   30.72 -+		free_xenheap_pages((unsigned long) ret, order);
   30.73 - 		ret = NULL;
   30.74 - 	}
   30.75 - 	if (!ret) {
   30.76 -@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd
   30.77 - {
   30.78 - 	if (!(vaddr >= (void *)io_tlb_start
   30.79 -                     && vaddr < (void *)io_tlb_end))
   30.80 --		free_pages((unsigned long) vaddr, get_order(size));
   30.81 -+		free_xenheap_pages((unsigned long) vaddr, get_order(size));
   30.82 - 	else
   30.83 - 		/* DMA_TO_DEVICE to avoid memcpy in unmap_single */
   30.84 - 		swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
   30.85 -@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t 
   30.86 + /*
   30.87 +@@ -388,8 +397,10 @@
   30.88   	 * When the mapping is small enough return a static buffer to limit
   30.89   	 * the damage, or panic when the transfer is too big.
   30.90   	 */
    31.1 --- a/xen/arch/ia64/patch/linux-2.6.11/system.h	Mon May 02 16:07:35 2005 +0000
    31.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/system.h	Mon May 02 23:55:17 2005 +0000
    31.3 @@ -1,16 +1,10 @@
    31.4 - system.h |   15 +++++++++++++++
    31.5 - 1 files changed, 15 insertions(+)
    31.6 -
    31.7 -Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h
    31.8 -===================================================================
    31.9 ---- linux-2.6.11-xendiffs.orig/include/asm-ia64/system.h	2005-04-07 10:39:11.066701457 -0500
   31.10 -+++ linux-2.6.11-xendiffs/include/asm-ia64/system.h	2005-04-07 10:40:19.540544127 -0500
   31.11 -@@ -24,8 +24,16 @@
   31.12 +--- ../../linux-2.6.11/include/asm-ia64/system.h	2005-03-02 00:38:07.000000000 -0700
   31.13 ++++ include/asm-ia64/system.h	2005-05-02 10:18:30.000000000 -0600
   31.14 +@@ -24,8 +24,15 @@
   31.15    * 0xa000000000000000+2*PERCPU_PAGE_SIZE
   31.16    * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
   31.17    */
   31.18  +#ifdef XEN
   31.19 -+//#define KERNEL_START		 0xf000000100000000
   31.20  +#define KERNEL_START		 0xf000000004000000
   31.21  +#define PERCPU_ADDR		 0xf100000000000000-PERCPU_PAGE_SIZE
   31.22  +#define SHAREDINFO_ADDR		 0xf100000000000000
   31.23 @@ -22,7 +16,7 @@ Index: linux-2.6.11-xendiffs/include/asm
   31.24   
   31.25   #ifndef __ASSEMBLY__
   31.26   
   31.27 -@@ -218,9 +226,13 @@ extern void ia64_load_extra (struct task
   31.28 +@@ -218,9 +225,13 @@
   31.29   # define PERFMON_IS_SYSWIDE() (0)
   31.30   #endif
   31.31   
   31.32 @@ -36,13 +30,3 @@ Index: linux-2.6.11-xendiffs/include/asm
   31.33   
   31.34   #define __switch_to(prev,next,last) do {							 \
   31.35   	if (IA64_HAS_EXTRA_STATE(prev))								 \
   31.36 -@@ -249,6 +261,9 @@ extern void ia64_load_extra (struct task
   31.37 - #else
   31.38 - # define switch_to(prev,next,last)	__switch_to(prev, next, last)
   31.39 - #endif
   31.40 -+//#ifdef XEN
   31.41 -+//#undef switch_to
   31.42 -+//#endif
   31.43 - 
   31.44 - /*
   31.45 -  * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
    32.1 --- a/xen/arch/ia64/patch/linux-2.6.11/time.c	Mon May 02 16:07:35 2005 +0000
    32.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c	Mon May 02 23:55:17 2005 +0000
    32.3 @@ -1,263 +1,32 @@
    32.4 - time.c |  158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    32.5 - 1 files changed, 158 insertions(+)
    32.6 -
    32.7 -Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c
    32.8 -===================================================================
    32.9 ---- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/time.c	2005-04-07 17:02:39.634985144 -0500
   32.10 -+++ linux-2.6.11-xendiffs/arch/ia64/kernel/time.c	2005-04-07 17:23:52.777723222 -0500
   32.11 -@@ -10,16 +10,22 @@
   32.12 -  */
   32.13 - #include <linux/config.h>
   32.14 - 
   32.15 -+#ifndef XEN
   32.16 - #include <linux/cpu.h>
   32.17 -+#endif
   32.18 - #include <linux/init.h>
   32.19 - #include <linux/kernel.h>
   32.20 - #include <linux/module.h>
   32.21 -+#ifndef XEN
   32.22 - #include <linux/profile.h>
   32.23 -+#endif
   32.24 - #include <linux/sched.h>
   32.25 - #include <linux/time.h>
   32.26 - #include <linux/interrupt.h>
   32.27 - #include <linux/efi.h>
   32.28 -+#ifndef XEN
   32.29 - #include <linux/profile.h>
   32.30 -+#endif
   32.31 - #include <linux/timex.h>
   32.32 - 
   32.33 - #include <asm/machvec.h>
   32.34 -@@ -29,10 +35,19 @@
   32.35 +--- ../../linux-2.6.11/arch/ia64/kernel/time.c	2005-03-02 00:37:50.000000000 -0700
   32.36 ++++ arch/ia64/time.c	2005-05-02 11:19:29.000000000 -0600
   32.37 +@@ -29,6 +29,9 @@
   32.38   #include <asm/sal.h>
   32.39   #include <asm/sections.h>
   32.40   #include <asm/system.h>
   32.41  +#ifdef XEN
   32.42 -+#include <asm/ia64_int.h>
   32.43 ++#include <linux/jiffies.h>	// not included by xen/sched.h
   32.44  +#endif
   32.45   
   32.46   extern unsigned long wall_jiffies;
   32.47   
   32.48 -+#ifndef XEN
   32.49 - u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
   32.50 -+#else
   32.51 -+#define INITIAL_JIFFIES 0
   32.52 -+u64 jiffies_64 = INITIAL_JIFFIES;
   32.53 -+#define CPU_PROFILING 0
   32.54 -+#endif
   32.55 - 
   32.56 - EXPORT_SYMBOL(jiffies_64);
   32.57 - 
   32.58 -@@ -45,33 +60,154 @@ EXPORT_SYMBOL(last_cli_ip);
   32.59 +@@ -45,6 +48,7 @@
   32.60   
   32.61   #endif
   32.62   
   32.63 -+#ifdef XEN
   32.64 -+volatile unsigned long last_nsec_offset;
   32.65 -+extern rwlock_t xtime_lock;
   32.66 -+unsigned long cpu_khz;  /* Detected as we calibrate the TSC */
   32.67 -+static s_time_t        stime_irq;       /* System time at last 'time update' */
   32.68 -+
   32.69 -+static inline u64 get_time_delta(void)
   32.70 -+{
   32.71 -+	return ia64_get_itc();
   32.72 -+}
   32.73 -+
   32.74 -+s_time_t get_s_time(void)
   32.75 -+{
   32.76 -+    s_time_t now;
   32.77 -+    unsigned long flags;
   32.78 -+
   32.79 -+    read_lock_irqsave(&xtime_lock, flags);
   32.80 -+
   32.81 -+    now = stime_irq + get_time_delta();
   32.82 -+
   32.83 -+    /* Ensure that the returned system time is monotonically increasing. */
   32.84 -+    {
   32.85 -+        static s_time_t prev_now = 0;
   32.86 -+        if ( unlikely(now < prev_now) )
   32.87 -+            now = prev_now;
   32.88 -+        prev_now = now;
   32.89 -+    }
   32.90 -+
   32.91 -+    read_unlock_irqrestore(&xtime_lock, flags);
   32.92 -+
   32.93 -+    return now; 
   32.94 -+}
   32.95 -+
   32.96 -+void update_dom_time(struct exec_domain *ed)
   32.97 -+{
   32.98 -+// FIXME: implement this?
   32.99 -+//	printf("update_dom_time: called, not implemented, skipping\n");
  32.100 -+	return;
  32.101 -+}
  32.102 -+
  32.103 -+/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
  32.104 -+void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
  32.105 -+{
  32.106 -+// FIXME: Should this be do_settimeofday (from linux)???
  32.107 -+	printf("do_settime: called, not implemented, stopping\n");
  32.108 -+	dummy();
  32.109 -+}
  32.110 -+#endif
  32.111 -+
  32.112 -+#if 0	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  32.113 -+#endif	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  32.114 -+ 
  32.115  +#ifndef XEN
  32.116   static struct time_interpolator itc_interpolator = {
  32.117   	.shift = 16,
  32.118   	.mask = 0xffffffffffffffffLL,
  32.119 - 	.source = TIME_SOURCE_CPU
  32.120 - };
  32.121 -+#endif
  32.122 -+
  32.123 -+#ifdef XEN
  32.124 -+unsigned long domain0_ready = 0;	// FIXME (see below)
  32.125 -+#define typecheck(a,b)	1
  32.126 -+/* FROM linux/include/linux/jiffies.h */
  32.127 -+/*
  32.128 -+ *	These inlines deal with timer wrapping correctly. You are 
  32.129 -+ *	strongly encouraged to use them
  32.130 -+ *	1. Because people otherwise forget
  32.131 -+ *	2. Because if the timer wrap changes in future you won't have to
  32.132 -+ *	   alter your driver code.
  32.133 -+ *
  32.134 -+ * time_after(a,b) returns true if the time a is after time b.
  32.135 -+ *
  32.136 -+ * Do this with "<0" and ">=0" to only test the sign of the result. A
  32.137 -+ * good compiler would generate better code (and a really good compiler
  32.138 -+ * wouldn't care). Gcc is currently neither.
  32.139 -+ */
  32.140 -+#define time_after(a,b)		\
  32.141 -+	(typecheck(unsigned long, a) && \
  32.142 -+	 typecheck(unsigned long, b) && \
  32.143 -+	 ((long)(b) - (long)(a) < 0))
  32.144 -+#define time_before(a,b)	time_after(b,a)
  32.145 -+
  32.146 -+#define time_after_eq(a,b)	\
  32.147 -+	(typecheck(unsigned long, a) && \
  32.148 -+	 typecheck(unsigned long, b) && \
  32.149 -+	 ((long)(a) - (long)(b) >= 0))
  32.150 -+#define time_before_eq(a,b)	time_after_eq(b,a)
  32.151 -+#endif
  32.152 - 
  32.153 - static irqreturn_t
  32.154 - timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
  32.155 - {
  32.156 - 	unsigned long new_itm;
  32.157 - 
  32.158 -+#ifndef XEN
  32.159 - 	if (unlikely(cpu_is_offline(smp_processor_id()))) {
  32.160 - 		return IRQ_HANDLED;
  32.161 - 	}
  32.162 -+#endif
  32.163 -+#ifdef XEN
  32.164 -+	if (current->domain == dom0) {
  32.165 -+		// FIXME: there's gotta be a better way of doing this...
  32.166 -+		// We have to ensure that domain0 is launched before we
  32.167 -+		// call vcpu_timer_expired on it
  32.168 -+		//domain0_ready = 1; // moved to xensetup.c
  32.169 -+	}
  32.170 -+	if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) {
  32.171 -+		vcpu_pend_timer(dom0->exec_domain[0]);
  32.172 -+		//vcpu_set_next_timer(dom0->exec_domain[0]);
  32.173 -+		domain_wake(dom0->exec_domain[0]);
  32.174 -+	}
  32.175 -+	if (!is_idle_task(current->domain) && current->domain != dom0) {
  32.176 -+		if (vcpu_timer_expired(current)) {
  32.177 -+			vcpu_pend_timer(current);
  32.178 -+			// ensure another timer interrupt happens even if domain doesn't
  32.179 -+			vcpu_set_next_timer(current);
  32.180 -+			domain_wake(current);
  32.181 -+		}
  32.182 -+	}
  32.183 -+	raise_actimer_softirq();
  32.184 -+#endif
  32.185 - 
  32.186 -+#ifndef XEN
  32.187 - 	platform_timer_interrupt(irq, dev_id, regs);
  32.188 +@@ -110,6 +114,7 @@
  32.189 + 	} while (time_after_eq(ia64_get_itc(), new_itm));
  32.190 + 	return IRQ_HANDLED;
  32.191 + }
  32.192  +#endif
  32.193   
  32.194 - 	new_itm = local_cpu_data->itm_next;
  32.195 - 
  32.196 - 	if (!time_after(ia64_get_itc(), new_itm))
  32.197 -+#ifdef XEN
  32.198 -+		return;
  32.199 -+#else
  32.200 - 		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
  32.201 - 		       ia64_get_itc(), new_itm);
  32.202 -+#endif
  32.203 - 
  32.204 -+#ifdef XEN
  32.205 -+//	printf("GOT TO HERE!!!!!!!!!!!\n");
  32.206 -+	//while(1);
  32.207 -+#else
  32.208 - 	profile_tick(CPU_PROFILING, regs);
  32.209 -+#endif
  32.210 - 
  32.211 - 	while (1) {
  32.212 -+#ifndef XEN
  32.213 - 		update_process_times(user_mode(regs));
  32.214 -+#endif
  32.215 - 
  32.216 - 		new_itm += local_cpu_data->itm_delta;
  32.217 - 
  32.218 -@@ -82,10 +218,16 @@ timer_interrupt (int irq, void *dev_id, 
  32.219 - 			 * another CPU. We need to avoid to SMP race by acquiring the
  32.220 - 			 * xtime_lock.
  32.221 - 			 */
  32.222 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  32.223 - 			write_seqlock(&xtime_lock);
  32.224 -+#endif
  32.225 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  32.226 - 			do_timer(regs);
  32.227 -+#endif
  32.228 - 			local_cpu_data->itm_next = new_itm;
  32.229 -+#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  32.230 - 			write_sequnlock(&xtime_lock);
  32.231 -+#endif
  32.232 - 		} else
  32.233 - 			local_cpu_data->itm_next = new_itm;
  32.234 - 
  32.235 -@@ -105,7 +247,12 @@ timer_interrupt (int irq, void *dev_id, 
  32.236 - 		 */
  32.237 - 		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
  32.238 - 			new_itm += local_cpu_data->itm_delta;
  32.239 -+//#ifdef XEN
  32.240 -+//		vcpu_set_next_timer(current);
  32.241 -+//#else
  32.242 -+//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
  32.243 - 		ia64_set_itm(new_itm);
  32.244 -+//#endif
  32.245 - 		/* double check, in case we got hit by a (slow) PMI: */
  32.246 - 	} while (time_after_eq(ia64_get_itc(), new_itm));
  32.247 - 	return IRQ_HANDLED;
  32.248 -@@ -120,6 +267,7 @@ ia64_cpu_local_tick (void)
  32.249 - 	int cpu = smp_processor_id();
  32.250 - 	unsigned long shift = 0, delta;
  32.251 - 
  32.252 -+printf("ia64_cpu_local_tick: about to call ia64_set_itv\n");
  32.253 - 	/* arrange for the cycle counter to generate a timer interrupt: */
  32.254 - 	ia64_set_itv(IA64_TIMER_VECTOR);
  32.255 - 
  32.256 -@@ -133,6 +281,7 @@ ia64_cpu_local_tick (void)
  32.257 - 		shift = (2*(cpu - hi) + 1) * delta/hi/2;
  32.258 - 	}
  32.259 - 	local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
  32.260 -+printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next);
  32.261 - 	ia64_set_itm(local_cpu_data->itm_next);
  32.262 - }
  32.263 - 
  32.264 -@@ -160,6 +309,7 @@ ia64_init_itm (void)
  32.265 - 	 * frequency and then a PAL call to determine the frequency ratio between the ITC
  32.266 - 	 * and the base frequency.
  32.267 - 	 */
  32.268 -+
  32.269 - 	status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
  32.270 - 				    &platform_base_freq, &platform_base_drift);
  32.271 - 	if (status != 0) {
  32.272 -@@ -212,6 +362,7 @@ ia64_init_itm (void)
  32.273 + /*
  32.274 +  * Encapsulate access to the itm structure for SMP.
  32.275 +@@ -212,6 +217,7 @@
  32.276   					+ itc_freq/2)/itc_freq;
  32.277   
  32.278   	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
  32.279 @@ -265,7 +34,7 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  32.280   		itc_interpolator.frequency = local_cpu_data->itc_freq;
  32.281   		itc_interpolator.drift = itc_drift;
  32.282   #ifdef CONFIG_SMP
  32.283 -@@ -228,6 +379,7 @@ ia64_init_itm (void)
  32.284 +@@ -228,12 +234,14 @@
  32.285   		if (!nojitter) itc_interpolator.jitter = 1;
  32.286   #endif
  32.287   		register_time_interpolator(&itc_interpolator);
  32.288 @@ -273,30 +42,15 @@ Index: linux-2.6.11-xendiffs/arch/ia64/k
  32.289   	}
  32.290   
  32.291   	/* Setup the CPU local timer tick */
  32.292 -@@ -236,7 +388,9 @@ ia64_init_itm (void)
  32.293 + 	ia64_cpu_local_tick();
  32.294 + }
  32.295   
  32.296 ++#ifndef XEN
  32.297   static struct irqaction timer_irqaction = {
  32.298   	.handler =	timer_interrupt,
  32.299 -+#ifndef XEN
  32.300   	.flags =	SA_INTERRUPT,
  32.301 -+#endif
  32.302 - 	.name =		"timer"
  32.303 - };
  32.304 - 
  32.305 -@@ -244,12 +398,16 @@ void __init
  32.306 - time_init (void)
  32.307 - {
  32.308 - 	register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
  32.309 -+#ifndef XEN
  32.310 - 	efi_gettimeofday(&xtime);
  32.311 -+#endif
  32.312 - 	ia64_init_itm();
  32.313 - 
  32.314 -+#ifndef XEN
  32.315 - 	/*
  32.316 - 	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
  32.317 - 	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
  32.318 +@@ -253,3 +261,4 @@
  32.319   	 */
  32.320   	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
  32.321 + }
  32.322  +#endif
  32.323 - }
    33.1 --- a/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Mon May 02 16:07:35 2005 +0000
    33.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Mon May 02 23:55:17 2005 +0000
    33.3 @@ -1,21 +1,6 @@
    33.4 - tlb.c |   10 ++++++++++
    33.5 - 1 files changed, 10 insertions(+)
    33.6 -
    33.7 -Index: linux-2.6.11/arch/ia64/mm/tlb.c
    33.8 -===================================================================
    33.9 ---- linux-2.6.11.orig/arch/ia64/mm/tlb.c	2005-03-02 01:38:38.000000000 -0600
   33.10 -+++ linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-19 14:58:43.978400822 -0600
   33.11 -@@ -21,7 +21,9 @@
   33.12 - #include <asm/mmu_context.h>
   33.13 - #include <asm/pgalloc.h>
   33.14 - #include <asm/pal.h>
   33.15 -+#ifndef XEN
   33.16 - #include <asm/tlbflush.h>
   33.17 -+#endif
   33.18 - 
   33.19 - static struct {
   33.20 - 	unsigned long mask;	/* mask of supported purge page-sizes */
   33.21 -@@ -43,6 +45,9 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
   33.22 +--- ../../linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-02 00:38:38.000000000 -0700
   33.23 ++++ arch/ia64/tlb.c	2005-05-02 10:23:09.000000000 -0600
   33.24 +@@ -43,6 +43,9 @@
   33.25   void
   33.26   wrap_mmu_context (struct mm_struct *mm)
   33.27   {
   33.28 @@ -25,7 +10,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
   33.29   	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
   33.30   	struct task_struct *tsk;
   33.31   	int i;
   33.32 -@@ -83,6 +88,7 @@ wrap_mmu_context (struct mm_struct *mm)
   33.33 +@@ -83,6 +86,7 @@
   33.34   		put_cpu();
   33.35   	}
   33.36   	local_flush_tlb_all();
   33.37 @@ -33,7 +18,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
   33.38   }
   33.39   
   33.40   void
   33.41 -@@ -132,6 +138,9 @@ EXPORT_SYMBOL(local_flush_tlb_all);
   33.42 +@@ -132,6 +136,9 @@
   33.43   void
   33.44   flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
   33.45   {
   33.46 @@ -43,7 +28,7 @@ Index: linux-2.6.11/arch/ia64/mm/tlb.c
   33.47   	struct mm_struct *mm = vma->vm_mm;
   33.48   	unsigned long size = end - start;
   33.49   	unsigned long nbits;
   33.50 -@@ -163,6 +172,7 @@ flush_tlb_range (struct vm_area_struct *
   33.51 +@@ -163,6 +170,7 @@
   33.52   # endif
   33.53   
   33.54   	ia64_srlz_i();			/* srlz.i implies srlz.d */
    34.1 --- a/xen/arch/ia64/patch/linux-2.6.11/unaligned.c	Mon May 02 16:07:35 2005 +0000
    34.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/unaligned.c	Mon May 02 23:55:17 2005 +0000
    34.3 @@ -1,39 +1,6 @@
    34.4 - unaligned.c |   27 +++++++++++++++++++++++++++
    34.5 - 1 files changed, 27 insertions(+)
    34.6 -
    34.7 -Index: linux-2.6.11/arch/ia64/kernel/unaligned.c
    34.8 -===================================================================
    34.9 ---- linux-2.6.11.orig/arch/ia64/kernel/unaligned.c	2005-03-02 01:38:25.000000000 -0600
   34.10 -+++ linux-2.6.11/arch/ia64/kernel/unaligned.c	2005-03-19 14:58:51.269335202 -0600
   34.11 -@@ -15,8 +15,10 @@
   34.12 -  */
   34.13 - #include <linux/kernel.h>
   34.14 - #include <linux/sched.h>
   34.15 -+#ifndef XEN
   34.16 - #include <linux/smp_lock.h>
   34.17 - #include <linux/tty.h>
   34.18 -+#endif
   34.19 - 
   34.20 - #include <asm/intrinsics.h>
   34.21 - #include <asm/processor.h>
   34.22 -@@ -24,7 +26,16 @@
   34.23 - #include <asm/uaccess.h>
   34.24 - #include <asm/unaligned.h>
   34.25 - 
   34.26 -+#ifdef XEN
   34.27 -+#define	ia64_peek(x...)	printk("ia64_peek: called, not implemented\n")
   34.28 -+#define	ia64_poke(x...)	printk("ia64_poke: called, not implemented\n")
   34.29 -+#define	ia64_sync_fph(x...) printk("ia64_sync_fph: called, not implemented\n")
   34.30 -+#define	ia64_flush_fph(x...) printk("ia64_flush_fph: called, not implemented\n")
   34.31 -+#define	die_if_kernel(x...) printk("die_if_kernel: called, not implemented\n")
   34.32 -+#define jiffies 0
   34.33 -+#else
   34.34 - extern void die_if_kernel(char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
   34.35 -+#endif
   34.36 - 
   34.37 - #undef DEBUG_UNALIGNED_TRAP
   34.38 - 
   34.39 -@@ -437,7 +448,11 @@ get_rse_reg (struct pt_regs *regs, unsig
   34.40 +--- ../../linux-2.6.11/arch/ia64/kernel/unaligned.c	2005-03-02 00:38:25.000000000 -0700
   34.41 ++++ arch/ia64/unaligned.c	2005-04-28 15:40:13.000000000 -0600
   34.42 +@@ -437,7 +437,11 @@
   34.43   }
   34.44   
   34.45   
   34.46 @@ -45,7 +12,7 @@ Index: linux-2.6.11/arch/ia64/kernel/una
   34.47   setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
   34.48   {
   34.49   	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   34.50 -@@ -611,7 +626,11 @@ getfpreg (unsigned long regnum, struct i
   34.51 +@@ -611,7 +615,11 @@
   34.52   }
   34.53   
   34.54   
   34.55 @@ -57,46 +24,19 @@ Index: linux-2.6.11/arch/ia64/kernel/una
   34.56   getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs)
   34.57   {
   34.58   	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   34.59 -@@ -1298,7 +1317,9 @@ ia64_handle_unaligned (unsigned long ifa
   34.60 - 	mm_segment_t old_fs = get_fs();
   34.61 - 	unsigned long bundle[2];
   34.62 - 	unsigned long opcode;
   34.63 -+#ifndef XEN
   34.64 - 	struct siginfo si;
   34.65 -+#endif
   34.66 - 	const struct exception_table_entry *eh = NULL;
   34.67 - 	union {
   34.68 - 		unsigned long l;
   34.69 -@@ -1317,6 +1338,9 @@ ia64_handle_unaligned (unsigned long ifa
   34.70 - 	 * user-level unaligned accesses.  Otherwise, a clever program could trick this
   34.71 - 	 * handler into reading an arbitrary kernel addresses...
   34.72 - 	 */
   34.73 +@@ -1294,6 +1302,9 @@
   34.74 + void
   34.75 + ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
   34.76 + {
   34.77  +#ifdef XEN
   34.78  +printk("ia64_handle_unaligned: called, not working yet\n");
   34.79  +#else
   34.80 - 	if (!user_mode(regs))
   34.81 - 		eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
   34.82 - 	if (user_mode(regs) || eh) {
   34.83 -@@ -1353,6 +1377,7 @@ ia64_handle_unaligned (unsigned long ifa
   34.84 - 
   34.85 - 	if (__copy_from_user(bundle, (void __user *) regs->cr_iip, 16))
   34.86 - 		goto failure;
   34.87 -+#endif
   34.88 - 
   34.89 - 	/*
   34.90 - 	 * extract the instruction from the bundle given the slot number
   34.91 -@@ -1493,6 +1518,7 @@ ia64_handle_unaligned (unsigned long ifa
   34.92 - 		/* NOT_REACHED */
   34.93 - 	}
   34.94 -   force_sigbus:
   34.95 -+#ifndef XEN
   34.96 - 	si.si_signo = SIGBUS;
   34.97 - 	si.si_errno = 0;
   34.98 - 	si.si_code = BUS_ADRALN;
   34.99 -@@ -1501,5 +1527,6 @@ ia64_handle_unaligned (unsigned long ifa
  34.100 - 	si.si_isr = 0;
  34.101 + 	struct ia64_psr *ipsr = ia64_psr(regs);
  34.102 + 	mm_segment_t old_fs = get_fs();
  34.103 + 	unsigned long bundle[2];
  34.104 +@@ -1502,4 +1513,5 @@
  34.105   	si.si_imm = 0;
  34.106   	force_sig_info(SIGBUS, &si, current);
  34.107 + 	goto done;
  34.108  +#endif
  34.109 - 	goto done;
  34.110   }
    35.1 --- a/xen/arch/ia64/patch/linux-2.6.11/wait.h	Mon May 02 16:07:35 2005 +0000
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,35 +0,0 @@
    35.4 - wait.h |    6 ++++++
    35.5 - 1 files changed, 6 insertions(+)
    35.6 -
    35.7 -Index: linux-2.6.11/include/linux/wait.h
    35.8 -===================================================================
    35.9 ---- linux-2.6.11.orig/include/linux/wait.h	2005-03-02 01:38:10.000000000 -0600
   35.10 -+++ linux-2.6.11/include/linux/wait.h	2005-03-19 15:00:23.691156973 -0600
   35.11 -@@ -136,7 +136,11 @@ static inline void __remove_wait_queue(w
   35.12 - 	list_del(&old->task_list);
   35.13 - }
   35.14 - 
   35.15 -+#ifdef XEN
   35.16 -+void FASTCALL(__wake_up(struct task_struct *p));
   35.17 -+#else
   35.18 - void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
   35.19 -+#endif
   35.20 - extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
   35.21 - extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
   35.22 - void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int));
   35.23 -@@ -147,6 +151,7 @@ int FASTCALL(out_of_line_wait_on_bit(voi
   35.24 - int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned));
   35.25 - wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
   35.26 - 
   35.27 -+#ifndef XEN
   35.28 - #define wake_up(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
   35.29 - #define wake_up_nr(x, nr)		__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
   35.30 - #define wake_up_all(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL)
   35.31 -@@ -155,6 +160,7 @@ wait_queue_head_t *FASTCALL(bit_waitqueu
   35.32 - #define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
   35.33 - #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
   35.34 - #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
   35.35 -+#endif
   35.36 - 
   35.37 - #define __wait_event(wq, condition) 					\
   35.38 - do {									\
    36.1 --- a/xen/arch/ia64/process.c	Mon May 02 16:07:35 2005 +0000
    36.2 +++ b/xen/arch/ia64/process.c	Mon May 02 23:55:17 2005 +0000
    36.3 @@ -171,6 +171,10 @@ panic_domain(regs,"psr.ic off, deliverin
    36.4  		else if (vector == IA64_INST_TLB_VECTOR)
    36.5  			vector = IA64_ALT_INST_TLB_VECTOR;
    36.6  //	}
    36.7 +	if (vector == IA64_ALT_DATA_TLB_VECTOR ||
    36.8 +	    vector == IA64_ALT_INST_TLB_VECTOR) {
    36.9 +		vcpu_thash(ed,ifa,&PSCB(ed,iha));
   36.10 +	}
   36.11  	PSCB(ed,unat) = regs->ar_unat;  // not sure if this is really needed?
   36.12  	PSCB(ed,precover_ifs) = regs->cr_ifs;
   36.13  	vcpu_bsw0(ed);
    37.1 --- a/xen/arch/ia64/tools/mkbuildtree	Mon May 02 16:07:35 2005 +0000
    37.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Mon May 02 23:55:17 2005 +0000
    37.3 @@ -85,24 +85,26 @@ cp_patch arch/ia64/kernel/entry.S arch/i
    37.4  cp_patch arch/ia64/kernel/head.S arch/ia64/head.S head.S
    37.5  #cp_patch arch/ia64/kernel/init_task.c arch/ia64/init_task.c init_task.c
    37.6  cp_patch arch/ia64/kernel/irq_ia64.c arch/ia64/irq_ia64.c irq_ia64.c
    37.7 -cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S
    37.8 +#cp_patch arch/ia64/kernel/ivt.S arch/ia64/ivt.S ivt.S
    37.9  #cp_patch arch/ia64/kernel/minstate.h arch/ia64/minstate.h minstate.h
   37.10  cp_patch arch/ia64/kernel/setup.c arch/ia64/setup.c setup.c
   37.11  cp_patch arch/ia64/kernel/time.c arch/ia64/time.c time.c
   37.12  cp_patch arch/ia64/kernel/unaligned.c arch/ia64/unaligned.c unaligned.c
   37.13 -cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S
   37.14 +#cp_patch arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S lds.S
   37.15 +softlink arch/ia64/kernel/vmlinux.lds.S arch/ia64/xen.lds.S
   37.16  
   37.17  #cp_patch mm/bootmem.c arch/ia64/mm_bootmem.c mm_bootmem.c
   37.18  #cp_patch mm/page_alloc.c arch/ia64/page_alloc.c page_alloc.c
   37.19  #cp_patch mm/slab.c arch/ia64/slab.c slab.c
   37.20  
   37.21  # following renamed to avoid conflict
   37.22 -cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c
   37.23 +#cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c
   37.24 +softlink kernel/extable.c arch/ia64/linuxextable.c
   37.25  
   37.26  cp_patch arch/ia64/mm/contig.c arch/ia64/mm_contig.c mm_contig.c
   37.27  cp_patch arch/ia64/mm/tlb.c arch/ia64/tlb.c tlb.c
   37.28  
   37.29 -cp_patch arch/ia64/hp/sim/hpsim_irq.c arch/ia64/hpsim_irq.c hpsim_irq.c
   37.30 +#cp_patch arch/ia64/hp/sim/hpsim_irq.c arch/ia64/hpsim_irq.c hpsim_irq.c
   37.31  
   37.32  softlink arch/ia64/kernel/efi_stub.S arch/ia64/efi_stub.S
   37.33  softlink arch/ia64/kernel/entry.h arch/ia64/entry.h
   37.34 @@ -149,38 +151,42 @@ softlink arch/ia64/hp/sim/hpsim.S arch/i
   37.35  
   37.36  # xen/include/asm-generic files
   37.37  
   37.38 -softlink include/asm-generic/bug.h include/asm-generic/bug.h bug.h
   37.39 -softlink include/asm-generic/div64.h include/asm-generic/div64.h div64.h
   37.40 +softlink include/asm-generic/bug.h include/asm-generic/bug.h
   37.41 +softlink include/asm-generic/div64.h include/asm-generic/div64.h
   37.42  softlink include/asm-generic/errno.h include/asm-generic/errno.h
   37.43  softlink include/asm-generic/errno-base.h include/asm-generic/errno-base.h
   37.44 -softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h ide_iops.h
   37.45 -softlink include/asm-generic/iomap.h include/asm-generic/iomap.h iomap.h
   37.46 -softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h pci-dma-compat.h
   37.47 -softlink include/asm-generic/pci.h include/asm-generic/pci.h pci.h
   37.48 -softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h pgtable.h
   37.49 -softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h pgtable-nopud.h
   37.50 -softlink include/asm-generic/sections.h include/asm-generic/sections.h sections.h
   37.51 -softlink include/asm-generic/topology.h include/asm-generic/topology.h topology.h
   37.52 -softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vmlinux.lds.h
   37.53 +softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h
   37.54 +softlink include/asm-generic/iomap.h include/asm-generic/iomap.h
   37.55 +softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h
   37.56 +softlink include/asm-generic/pci.h include/asm-generic/pci.h
   37.57 +softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h
   37.58 +softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h
   37.59 +softlink include/asm-generic/sections.h include/asm-generic/sections.h
   37.60 +softlink include/asm-generic/topology.h include/asm-generic/topology.h
   37.61 +softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h
   37.62  
   37.63  
   37.64  # xen/include/asm-ia64 files
   37.65  
   37.66  cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h
   37.67  
   37.68 -cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h
   37.69 +#cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h
   37.70 +softlink include/asm-ia64/current.h include/asm-ia64/current.h
   37.71  #cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h
   37.72  softlink include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h
   37.73 -cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h
   37.74 +#cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h
   37.75 +softlink include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h
   37.76  #cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h
   37.77  softlink include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h
   37.78  #cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h
   37.79  cp_patch include/asm-ia64/io.h include/asm-ia64/io.h io.h
   37.80 -cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h
   37.81 +#cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h
   37.82 +softlink include/asm-ia64/irq.h include/asm-ia64/irq.h
   37.83  cp_patch include/asm-ia64/kregs.h include/asm-ia64/kregs.h kregs.h
   37.84  cp_patch include/asm-ia64/page.h include/asm-ia64/page.h page.h
   37.85  cp_patch include/asm-ia64/processor.h include/asm-ia64/processor.h processor.h
   37.86 -cp_patch include/asm-ia64/sal.h include/asm-ia64/sal.h sal.h
   37.87 +#cp_patch include/asm-ia64/sal.h include/asm-ia64/sal.h sal.h
   37.88 +softlink include/asm-ia64/sal.h include/asm-ia64/sal.h
   37.89  cp_patch include/asm-ia64/system.h include/asm-ia64/system.h system.h
   37.90  cp_patch include/asm-ia64/types.h include/asm-ia64/types.h types.h
   37.91  
   37.92 @@ -190,6 +196,8 @@ null include/asm-ia64/desc.h
   37.93  null include/asm-ia64/io_apic.h
   37.94  null include/asm-ia64/pdb.h
   37.95  null include/asm-ia64/module.h
   37.96 +null include/asm-ia64/ia32.h
   37.97 +null include/asm-ia64/tlbflush.h
   37.98  
   37.99  softlink include/asm-ia64/acpi.h include/asm-ia64/acpi.h
  37.100  softlink include/asm-ia64/asmmacro.h include/asm-ia64/asmmacro.h
  37.101 @@ -208,7 +216,7 @@ softlink include/asm-ia64/dma-mapping.h 
  37.102  softlink include/asm-ia64/errno.h include/asm-ia64/errno.h
  37.103  softlink include/asm-ia64/fpu.h include/asm-ia64/fpu.h
  37.104  softlink include/asm-ia64/hdreg.h include/asm-ia64/hdreg.h
  37.105 -softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
  37.106 +#softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
  37.107  softlink include/asm-ia64/ia64regs.h include/asm-ia64/ia64regs.h
  37.108  softlink include/asm-ia64/intrinsics.h include/asm-ia64/intrinsics.h
  37.109  softlink include/asm-ia64/ioctl.h include/asm-ia64/ioctl.h
  37.110 @@ -257,23 +265,26 @@ softlink include/asm-ia64/ustack.h inclu
  37.111  
  37.112  # xen/include/asm-ia64/linux/*.h (== linux/include/linux/*.h)
  37.113  
  37.114 -cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h
  37.115 +#cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h
  37.116  cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h
  37.117  #cp_patch include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h dma-mapping.h
  37.118  softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h
  37.119  #cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h
  37.120  softlink include/linux/efi.h include/asm-ia64/linux/efi.h
  37.121 -cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h
  37.122 +cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h hardirq.h
  37.123  #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h
  37.124  cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h
  37.125 -cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h
  37.126 +#cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h
  37.127 +softlink include/linux/mmzone.h include/asm-ia64/linux/mmzone.h
  37.128  
  37.129 -cp_patch include/linux/wait.h include/asm-ia64/linux/wait.h wait.h
  37.130 +#cp_patch include/linux/wait.h include/asm-ia64/linux/wait.h wait.h
  37.131 +softlink include/linux/wait.h include/asm-ia64/linux/wait.h
  37.132  
  37.133 -cp_patch include/linux/slab.h include/asm-ia64/slab.h slab.h
  37.134 +#cp_patch include/linux/slab.h include/asm-ia64/slab.h slab.h
  37.135  
  37.136  # following renamed to avoid conflict
  37.137 -cp_patch include/linux/time.h include/xen/linuxtime.h linuxtime.h
  37.138 +#cp_patch include/linux/time.h include/xen/linuxtime.h linuxtime.h
  37.139 +softlink include/linux/time.h include/asm-ia64/linux/linuxtime.h
  37.140  
  37.141  softlink include/linux/bcd.h include/asm-ia64/linux/bcd.h
  37.142  softlink include/linux/bitmap.h include/asm-ia64/linux/bitmap.h
  37.143 @@ -289,14 +300,15 @@ softlink include/linux/percpu.h include/
  37.144  softlink include/linux/preempt.h include/asm-ia64/linux/preempt.h
  37.145  softlink include/linux/rbtree.h include/asm-ia64/linux/rbtree.h
  37.146  softlink include/linux/rwsem.h include/asm-ia64/linux/rwsem.h
  37.147 -softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h
  37.148 -softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h
  37.149 +#softlink include/linux/seq_file.h include/asm-ia64/linux/seq_file.h
  37.150 +#softlink include/linux/serial_core.h include/asm-ia64/linux/serial_core.h
  37.151  softlink include/linux/stddef.h include/asm-ia64/linux/stddef.h
  37.152  softlink include/linux/thread_info.h include/asm-ia64/linux/thread_info.h
  37.153  softlink include/linux/threads.h include/asm-ia64/linux/threads.h
  37.154  softlink include/linux/timex.h include/asm-ia64/linux/timex.h
  37.155  softlink include/linux/topology.h include/asm-ia64/linux/topology.h
  37.156 -softlink include/linux/tty.h include/asm-ia64/linux/tty.h
  37.157 +softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
  37.158 +softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
  37.159  
  37.160  null include/asm-ia64/linux/file.h
  37.161  null include/asm-ia64/linux/module.h
  37.162 @@ -305,6 +317,18 @@ null include/asm-ia64/linux/device.h
  37.163  null include/asm-ia64/linux/proc_fs.h
  37.164  null include/asm-ia64/linux/rtc.h
  37.165  null include/asm-ia64/linux/profile.h
  37.166 +null include/asm-ia64/linux/seqlock.h
  37.167 +null include/asm-ia64/linux/smp_lock.h
  37.168 +null include/asm-ia64/linux/tty.h
  37.169 +null include/asm-ia64/linux/kernel_stat.h
  37.170 +null include/asm-ia64/linux/ptrace.h
  37.171 +null include/asm-ia64/linux/random.h
  37.172 +null include/asm-ia64/linux/signal.h
  37.173 +null include/asm-ia64/linux/bootmem.h
  37.174 +null include/asm-ia64/linux/serial.h
  37.175 +null include/asm-ia64/linux/serial_core.h
  37.176 +null include/asm-ia64/linux/seq_file.h
  37.177 +null include/asm-ia64/linux/cpu.h
  37.178  
  37.179  softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h
  37.180  softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h
    38.1 --- a/xen/arch/ia64/vcpu.c	Mon May 02 16:07:35 2005 +0000
    38.2 +++ b/xen/arch/ia64/vcpu.c	Mon May 02 23:55:17 2005 +0000
    38.3 @@ -394,7 +394,10 @@ IA64FAULT vcpu_get_iim(VCPU *vcpu, UINT6
    38.4  
    38.5  IA64FAULT vcpu_get_iha(VCPU *vcpu, UINT64 *pval)
    38.6  {
    38.7 -	return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval);
    38.8 +	//return vcpu_thash(vcpu,PSCB(vcpu,ifa),pval);
    38.9 +	UINT64 val = PSCB(vcpu,iha);
   38.10 +	*pval = val;
   38.11 +	return (IA64_NO_FAULT);
   38.12  }
   38.13  
   38.14  IA64FAULT vcpu_set_dcr(VCPU *vcpu, UINT64 val)
   38.15 @@ -747,7 +750,8 @@ IA64FAULT vcpu_set_tpr(VCPU *vcpu, UINT6
   38.16  {
   38.17  	if (val & 0xff00) return IA64_RSVDREG_FAULT;
   38.18  	PSCB(vcpu,tpr) = val;
   38.19 -	//PSCB(vcpu,pending_interruption) = 1;
   38.20 +	if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR)
   38.21 +		PSCB(vcpu,pending_interruption) = 1;
   38.22  	return (IA64_NO_FAULT);
   38.23  }
   38.24  
   38.25 @@ -773,6 +777,8 @@ IA64FAULT vcpu_set_eoi(VCPU *vcpu, UINT6
   38.26  		// with interrupts disabled
   38.27  		printf("Trying to EOI interrupt with interrupts enabled\r\n");
   38.28  	}
   38.29 +	if (vcpu_check_pending_interrupts(vcpu) != SPURIOUS_VECTOR)
   38.30 +		PSCB(vcpu,pending_interruption) = 1;
   38.31  //printf("YYYYY vcpu_set_eoi: Successful\n");
   38.32  	return (IA64_NO_FAULT);
   38.33  }
   38.34 @@ -1138,11 +1144,13 @@ IA64FAULT vcpu_thash(VCPU *vcpu, UINT64 
   38.35  	UINT64 VHPT_addr = VHPT_addr1 | ((VHPT_addr2a | VHPT_addr2b) << 15) |
   38.36  			VHPT_addr3;
   38.37  
   38.38 +#if 0
   38.39  	if (VHPT_addr1 == 0xe000000000000000L) {
   38.40  	    printf("vcpu_thash: thash unsupported with rr7 @%lx\n",
   38.41  		PSCB(vcpu,iip));
   38.42  	    return (IA64_ILLOP_FAULT);
   38.43  	}
   38.44 +#endif
   38.45  //verbose("vcpu_thash: vadr=%p, VHPT_addr=%p\n",vadr,VHPT_addr);
   38.46  	*pval = VHPT_addr;
   38.47  	return (IA64_NO_FAULT);
    39.1 --- a/xen/arch/ia64/vhpt.c	Mon May 02 16:07:35 2005 +0000
    39.2 +++ b/xen/arch/ia64/vhpt.c	Mon May 02 23:55:17 2005 +0000
    39.3 @@ -21,7 +21,20 @@ void vhpt_flush(void)
    39.4  {
    39.5  	struct vhpt_lf_entry *v = (void *)VHPT_ADDR;
    39.6  	int i, cnt = 0;
    39.7 +#if 0
    39.8 +static int firsttime = 2;
    39.9  
   39.10 +if (firsttime) firsttime--;
   39.11 +else {
   39.12 +printf("vhpt_flush: *********************************************\n");
   39.13 +printf("vhpt_flush: *********************************************\n");
   39.14 +printf("vhpt_flush: *********************************************\n");
   39.15 +printf("vhpt_flush: flushing vhpt (seems to crash at rid wrap?)...\n");
   39.16 +printf("vhpt_flush: *********************************************\n");
   39.17 +printf("vhpt_flush: *********************************************\n");
   39.18 +printf("vhpt_flush: *********************************************\n");
   39.19 +}
   39.20 +#endif
   39.21  	for (i = 0; i < VHPT_NUM_ENTRIES; i++, v++) {
   39.22  		v->itir = 0;
   39.23  		v->CChain = 0;
    40.1 --- a/xen/arch/ia64/xenasm.S	Mon May 02 16:07:35 2005 +0000
    40.2 +++ b/xen/arch/ia64/xenasm.S	Mon May 02 23:55:17 2005 +0000
    40.3 @@ -190,7 +190,6 @@ 1:
    40.4  
    40.5  	movl r22=SHAREDINFO_ADDR
    40.6  	;;
    40.7 -	movl r25=PAGE_SHARED
    40.8  	movl r25=__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RW)
    40.9  	;;
   40.10  	mov r21=loc5			// saved sharedinfo physical address
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/xen/arch/ia64/xenirq.c	Mon May 02 23:55:17 2005 +0000
    41.3 @@ -0,0 +1,77 @@
    41.4 +/*
    41.5 + * Xen irq routines
    41.6 + *
    41.7 + * Copyright (C) 2005 Hewlett-Packard Co.
    41.8 + *	Dan Magenheimer (dan.magenheimer@hp.com)
    41.9 + *
   41.10 + */
   41.11 +
   41.12 +#include <asm/ptrace.h>
   41.13 +#include <asm/hw_irq.h>
   41.14 +
   41.15 +
   41.16 +void
   41.17 +xen_debug_irq(ia64_vector vector, struct pt_regs *regs)
   41.18 +{
   41.19 +//FIXME: For debug only, can be removed
   41.20 +	static char firstirq = 1;
   41.21 +	static char firsttime[256];
   41.22 +	static char firstpend[256];
   41.23 +	if (firstirq) {
   41.24 +		int i;
   41.25 +		for (i=0;i<256;i++) firsttime[i] = 1;
   41.26 +		for (i=0;i<256;i++) firstpend[i] = 1;
   41.27 +		firstirq = 0;
   41.28 +	}
   41.29 +	if (firsttime[vector]) {
   41.30 +		printf("**** (entry) First received int on vector=%d,itc=%lx\n",
   41.31 +			(unsigned long) vector, ia64_get_itc());
   41.32 +		firsttime[vector] = 0;
   41.33 +	}
   41.34 +}
   41.35 +
   41.36 +
   41.37 +int
   41.38 +xen_do_IRQ(ia64_vector vector)
   41.39 +{
   41.40 +	if (vector != 0xef) {
   41.41 +		extern void vcpu_pend_interrupt(void *, int);
   41.42 +#if 0
   41.43 +		if (firsttime[vector]) {
   41.44 +			printf("**** (iterate) First received int on vector=%d,itc=%lx\n",
   41.45 +			(unsigned long) vector, ia64_get_itc());
   41.46 +			firsttime[vector] = 0;
   41.47 +		}
   41.48 +		if (firstpend[vector]) {
   41.49 +			printf("**** First pended int on vector=%d,itc=%lx\n",
   41.50 +				(unsigned long) vector,ia64_get_itc());
   41.51 +			firstpend[vector] = 0;
   41.52 +		}
   41.53 +#endif
   41.54 +		//FIXME: TEMPORARY HACK!!!!
   41.55 +		vcpu_pend_interrupt(dom0->exec_domain[0],vector);
   41.56 +		domain_wake(dom0->exec_domain[0]);
   41.57 +		return(1);
   41.58 +	}
   41.59 +	return(0);
   41.60 +}
   41.61 +
   41.62 +/* From linux/kernel/softirq.c */
   41.63 +#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
   41.64 +# define invoke_softirq()	__do_softirq()
   41.65 +#else
   41.66 +# define invoke_softirq()	do_softirq()
   41.67 +#endif
   41.68 +
   41.69 +/*
   41.70 + * Exit an interrupt context. Process softirqs if needed and possible:
   41.71 + */
   41.72 +void irq_exit(void)
   41.73 +{
   41.74 +	//account_system_vtime(current);
   41.75 +	//sub_preempt_count(IRQ_EXIT_OFFSET);
   41.76 +	if (!in_interrupt() && local_softirq_pending())
   41.77 +		invoke_softirq();
   41.78 +	//preempt_enable_no_resched();
   41.79 +}
   41.80 +/* end from linux/kernel/softirq.c */
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/xen/arch/ia64/xenmem.c	Mon May 02 23:55:17 2005 +0000
    42.3 @@ -0,0 +1,67 @@
    42.4 +/*
    42.5 + * Xen memory allocator routines
    42.6 + *
    42.7 + * Copyright (C) 2005 Hewlett-Packard Co
    42.8 + *	Dan Magenheimer <dan.magenheimer@hp.com>
    42.9 + * Copyright (C) 2005 Intel Corp.
   42.10 + *
   42.11 + * Routines used by ia64 machines with contiguous (or virtually contiguous)
   42.12 + * memory.
   42.13 + */
   42.14 +
   42.15 +#include <linux/config.h>
   42.16 +#include <asm/pgtable.h>
   42.17 +
   42.18 +extern struct page *zero_page_memmap_ptr;
   42.19 +struct pfn_info *frame_table;
   42.20 +unsigned long frame_table_size;
   42.21 +unsigned long max_page;
   42.22 +
   42.23 +struct page *mem_map;
   42.24 +#define MAX_DMA_ADDRESS ~0UL	// FIXME???
   42.25 +
   42.26 +#ifdef CONFIG_VIRTUAL_MEM_MAP
   42.27 +static unsigned long num_dma_physpages;
   42.28 +#endif
   42.29 +
   42.30 +/*
   42.31 + * Set up the page tables.
   42.32 + */
   42.33 +
   42.34 +void
   42.35 +paging_init (void)
   42.36 +{
   42.37 +	struct pfn_info *pg;
   42.38 +	/* Allocate and map the machine-to-phys table */
   42.39 +	if ((pg = alloc_domheap_pages(NULL, 10)) == NULL)
   42.40 +		panic("Not enough memory to bootstrap Xen.\n");
   42.41 +	memset(page_to_virt(pg), 0x55, 16UL << 20);
   42.42 +
   42.43 +	/* Other mapping setup */
   42.44 +
   42.45 +	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
   42.46 +}
   42.47 +
   42.48 +/* FIXME: postpone support to machines with big holes between physical memorys.
   42.49 + * Current hack allows only efi memdesc upto 4G place. (See efi.c)
   42.50 + */
   42.51 +#ifndef CONFIG_VIRTUAL_MEM_MAP
   42.52 +#define FT_ALIGN_SIZE	(16UL << 20)
   42.53 +void __init init_frametable(void)
   42.54 +{
   42.55 +	unsigned long i, p;
   42.56 +	frame_table_size = max_page * sizeof(struct pfn_info);
   42.57 +	frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
   42.58 +
   42.59 +	/* Request continuous trunk from boot allocator, since HV
   42.60 +	 * address is identity mapped */
   42.61 +	p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE);
   42.62 +	if (p == 0)
   42.63 +		panic("Not enough memory for frame table.\n");
   42.64 +
   42.65 +	frame_table = __va(p);
   42.66 +	memset(frame_table, 0, frame_table_size);
   42.67 +	printk("size of frame_table: %lukB\n",
   42.68 +		frame_table_size >> 10);
   42.69 +}
   42.70 +#endif
    43.1 --- a/xen/arch/ia64/xenmisc.c	Mon May 02 16:07:35 2005 +0000
    43.2 +++ b/xen/arch/ia64/xenmisc.c	Mon May 02 23:55:17 2005 +0000
    43.3 @@ -27,7 +27,13 @@ unsigned int watchdog_on = 0;	// from ar
    43.4  
    43.5  void unw_init(void) { printf("unw_init() skipped (NEED FOR KERNEL UNWIND)\n"); }
    43.6  void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort handling)\n"); }
    43.7 -void hpsim_setup(char **x) { printf("hpsim_setup() skipped (MAY NEED FOR CONSOLE INPUT!!!)\n"); }	
    43.8 +void ia64_mca_cpu_init(void *x) { }
    43.9 +void ia64_patch_mckinley_e9(unsigned long a, unsigned long b) { }
   43.10 +void ia64_patch_vtop(unsigned long a, unsigned long b) { }
   43.11 +void hpsim_setup(char **x) { }
   43.12 +
   43.13 +// called from mem_init... don't think s/w I/O tlb is needed in Xen
   43.14 +//void swiotlb_init(void) { }  ...looks like it IS needed
   43.15  
   43.16  long
   43.17  is_platform_hp_ski(void)
   43.18 @@ -237,17 +243,74 @@ void physdev_destroy_state(struct domain
   43.19  	dummy();
   43.20  }
   43.21  
   43.22 +///////////////////////////////
   43.23 +// called from arch/ia64/head.S
   43.24 +///////////////////////////////
   43.25 +
   43.26 +void console_print(char *msg)
   43.27 +{
   43.28 +	printk("console_print called, how did start_kernel return???\n");
   43.29 +}
   43.30 +
   43.31 +void kernel_thread_helper(void)
   43.32 +{
   43.33 +	printk("kernel_thread_helper not implemented\n");
   43.34 +	dummy();
   43.35 +}
   43.36 +
   43.37 +void sys_exit(void)
   43.38 +{
   43.39 +	printk("sys_exit not implemented\n");
   43.40 +	dummy();
   43.41 +}
   43.42 +
   43.43 +////////////////////////////////////
   43.44 +// called from unaligned.c
   43.45 +////////////////////////////////////
   43.46 +
   43.47 +void die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */
   43.48 +{
   43.49 +	printk("die_if_kernel: called, not implemented\n");
   43.50 +}
   43.51 +
   43.52 +long
   43.53 +ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
   43.54 +	   unsigned long user_rbs_end, unsigned long addr, long *val)
   43.55 +{
   43.56 +	printk("ia64_peek: called, not implemented\n");
   43.57 +}
   43.58 +
   43.59 +long
   43.60 +ia64_poke (struct task_struct *child, struct switch_stack *child_stack,
   43.61 +	   unsigned long user_rbs_end, unsigned long addr, long val)
   43.62 +{
   43.63 +	printk("ia64_poke: called, not implemented\n");
   43.64 +}
   43.65 +
   43.66 +void
   43.67 +ia64_sync_fph (struct task_struct *task)
   43.68 +{
   43.69 +	printk("ia64_sync_fph: called, not implemented\n");
   43.70 +}
   43.71 +
   43.72 +void
   43.73 +ia64_flush_fph (struct task_struct *task)
   43.74 +{
   43.75 +	printk("ia64_flush_fph: called, not implemented\n");
   43.76 +}
   43.77 +
   43.78 +////////////////////////////////////
   43.79 +// called from irq_ia64.c:init_IRQ()
   43.80 +//   (because CONFIG_IA64_HP_SIM is specified)
   43.81 +////////////////////////////////////
   43.82 +void hpsim_irq_init(void) { }
   43.83 +
   43.84 +
   43.85  // accomodate linux extable.c
   43.86  //const struct exception_table_entry *
   43.87 -void *search_module_extables(unsigned long addr)
   43.88 -{
   43.89 -	return NULL;
   43.90 -}
   43.91 -
   43.92 -void *module_text_address(unsigned long addr)
   43.93 -{
   43.94 -	return NULL;
   43.95 -}
   43.96 +void *search_module_extables(unsigned long addr) { return NULL; }
   43.97 +void *__module_text_address(unsigned long addr) { return NULL; }
   43.98 +void *module_text_address(unsigned long addr) { return NULL; }
   43.99  
  43.100  void cs10foo(void) {}
  43.101  void cs01foo(void) {}
    44.1 --- a/xen/arch/ia64/xensetup.c	Mon May 02 16:07:35 2005 +0000
    44.2 +++ b/xen/arch/ia64/xensetup.c	Mon May 02 23:55:17 2005 +0000
    44.3 @@ -1,13 +1,9 @@
    44.4  /******************************************************************************
    44.5 - * kernel.c
    44.6 - * 
    44.7 - * This file should contain architecture-independent bootstrap and low-level
    44.8 - * help routines. It's a bit x86/PC specific right now!
    44.9 - * 
   44.10 - * Copyright (c) 2002-2003 K A Fraser
   44.11 + * xensetup.c
   44.12 + * Copyright (c) 2004-2005  Hewlett-Packard Co
   44.13 + *         Dan Magenheimer <dan.magenheimer@hp.com>
   44.14   */
   44.15  
   44.16 -//#include <stdarg.h>
   44.17  #include <xen/config.h>
   44.18  #include <xen/lib.h>
   44.19  #include <xen/errno.h>
   44.20 @@ -20,16 +16,14 @@
   44.21  //#include <xen/console.h>
   44.22  //#include <xen/serial.h>
   44.23  #include <xen/trace.h>
   44.24 -//#include <asm/shadow.h>
   44.25 -//#include <asm/io.h>
   44.26 -//#include <asm/uaccess.h>
   44.27 -//#include <asm/domain_page.h>
   44.28 -//#include <public/dom0_ops.h>
   44.29  #include <asm/meminit.h>
   44.30  #include <asm/page.h>
   44.31 +#include <asm/setup.h>
   44.32  
   44.33  unsigned long xenheap_phys_end;
   44.34  
   44.35 +char saved_command_line[COMMAND_LINE_SIZE];
   44.36 +
   44.37  struct exec_domain *idle_task[NR_CPUS] = { &idle0_exec_domain };
   44.38  
   44.39  #ifdef CLONE_DOMAIN0
   44.40 @@ -84,7 +78,7 @@ char opt_physdev_dom0_hide[200] = "";
   44.41  char opt_leveltrigger[30] = "", opt_edgetrigger[30] = "";
   44.42  /*
   44.43   * opt_xenheap_megabytes: Size of Xen heap in megabytes, including:
   44.44 - * 	xen image
   44.45 + *	xen image
   44.46   *	bootmap bits
   44.47   *	xen heap
   44.48   * Note: To allow xenheap size configurable, the prerequisite is
   44.49 @@ -147,10 +141,9 @@ static void __init do_initcalls(void)
   44.50          (*call)();
   44.51  }
   44.52  
   44.53 -void cmain(multiboot_info_t *mbi)
   44.54 +void start_kernel(void)
   44.55  {
   44.56      unsigned char *cmdline;
   44.57 -    module_t *mod = (module_t *)__va(mbi->mods_addr);
   44.58      void *heap_start;
   44.59      int i;
   44.60      unsigned long max_mem, nr_pages, firsthole_start;
   44.61 @@ -162,7 +155,8 @@ void cmain(multiboot_info_t *mbi)
   44.62      xen_pstart = ia64_tpa(KERNEL_START);
   44.63  
   44.64      /* Must do this early -- e.g., spinlocks rely on get_current(). */
   44.65 -    set_current(&idle0_exec_domain);
   44.66 +    //set_current(&idle0_exec_domain);
   44.67 +    ia64_r13 = (void *)&idle0_exec_domain;
   44.68      idle0_exec_domain.domain = &idle0_domain;
   44.69  
   44.70      early_setup_arch(&cmdline);
   44.71 @@ -170,7 +164,7 @@ void cmain(multiboot_info_t *mbi)
   44.72      /* We initialise the serial devices very early so we can get debugging. */
   44.73      serial_init_stage1();
   44.74  
   44.75 -    init_console(); 
   44.76 +    init_console();
   44.77      set_printk_prefix("(XEN) ");
   44.78  
   44.79      /* xenheap should be in same TR-covered range with xen image */
   44.80 @@ -201,7 +195,7 @@ void cmain(multiboot_info_t *mbi)
   44.81  	   ia64_boot_param->initrd_size);
   44.82      ia64_boot_param->initrd_start = initial_images_start;
   44.83      printk("Done\n");
   44.84 -    
   44.85 +
   44.86      /* first find highest page frame number */
   44.87      max_page = 0;
   44.88      efi_memmap_walk(find_max_pfn, &max_page);
   44.89 @@ -217,7 +211,7 @@ void cmain(multiboot_info_t *mbi)
   44.90      efi_memmap_walk(filter_rsvd_memory, init_boot_pages);
   44.91      efi_memmap_walk(xen_count_pages, &nr_pages);
   44.92  
   44.93 -    printk("System RAM: %luMB (%lukB)\n", 
   44.94 +    printk("System RAM: %luMB (%lukB)\n",
   44.95  	nr_pages >> (20 - PAGE_SHIFT),
   44.96  	nr_pages << (PAGE_SHIFT - 10));
   44.97  
   44.98 @@ -235,15 +229,15 @@ void cmain(multiboot_info_t *mbi)
   44.99  	(xenheap_phys_end-__pa(heap_start)) >> 20,
  44.100  	(xenheap_phys_end-__pa(heap_start)) >> 10);
  44.101  
  44.102 -    setup_arch();
  44.103 +    late_setup_arch(&cmdline);
  44.104      setup_per_cpu_areas();
  44.105      mem_init();
  44.106  
  44.107  printk("About to call scheduler_init()\n");
  44.108      scheduler_init();
  44.109      local_irq_disable();
  44.110 -printk("About to call time_init()\n");
  44.111 -    time_init();
  44.112 +printk("About to call xen_time_init()\n");
  44.113 +    xen_time_init();
  44.114  printk("About to call ac_timer_init()\n");
  44.115      ac_timer_init();
  44.116  // init_xen_time(); ???
  44.117 @@ -267,7 +261,7 @@ printk("About to call init_idle_task()\n
  44.118      {
  44.119      int i;
  44.120      for (i = 0; i < CLONE_DOMAIN0; i++) {
  44.121 -    	clones[i] = do_createdomain(i+1, 0);
  44.122 +	clones[i] = do_createdomain(i+1, 0);
  44.123          if ( clones[i] == NULL )
  44.124              panic("Error creating domain0 clone %d\n",i);
  44.125      }
  44.126 @@ -278,9 +272,6 @@ printk("About to call init_idle_task()\n
  44.127  
  44.128      set_bit(DF_PRIVILEGED, &dom0->d_flags);
  44.129  
  44.130 -//printk("About to call shadow_mode_init()\n");
  44.131 -//    shadow_mode_init();
  44.132 -
  44.133      /*
  44.134       * We're going to setup domain0 using the module(s) that we stashed safely
  44.135       * above our heap. The second module, if present, is an initrd ramdisk.
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/xen/arch/ia64/xentime.c	Mon May 02 23:55:17 2005 +0000
    45.3 @@ -0,0 +1,204 @@
    45.4 +/*
    45.5 + * xen/arch/ia64/time.c
    45.6 + *
    45.7 + * Copyright (C) 2005 Hewlett-Packard Co
    45.8 + *	Dan Magenheimer <dan.magenheimer@hp.com>
    45.9 + */
   45.10 +
   45.11 +#include <linux/config.h>
   45.12 +
   45.13 +#include <linux/cpu.h>
   45.14 +#include <linux/init.h>
   45.15 +#include <linux/kernel.h>
   45.16 +#include <linux/module.h>
   45.17 +#include <linux/profile.h>
   45.18 +#include <linux/sched.h>
   45.19 +#include <linux/time.h>
   45.20 +#include <linux/interrupt.h>
   45.21 +#include <linux/efi.h>
   45.22 +#include <linux/profile.h>
   45.23 +#include <linux/timex.h>
   45.24 +
   45.25 +#include <asm/machvec.h>
   45.26 +#include <asm/delay.h>
   45.27 +#include <asm/hw_irq.h>
   45.28 +#include <asm/ptrace.h>
   45.29 +#include <asm/sal.h>
   45.30 +#include <asm/sections.h>
   45.31 +#include <asm/system.h>
   45.32 +#ifdef XEN
   45.33 +#include <linux/jiffies.h>	// not included by xen/sched.h
   45.34 +#endif
   45.35 +
   45.36 +#define TIME_KEEPER_ID  0
   45.37 +extern unsigned long wall_jiffies;
   45.38 +
   45.39 +static s_time_t        stime_irq;       /* System time at last 'time update' */
   45.40 +
   45.41 +unsigned long domain0_ready = 0;
   45.42 +
   45.43 +static inline u64 get_time_delta(void)
   45.44 +{
   45.45 +	return ia64_get_itc();
   45.46 +}
   45.47 +
   45.48 +s_time_t get_s_time(void)
   45.49 +{
   45.50 +    s_time_t now;
   45.51 +    unsigned long flags;
   45.52 +
   45.53 +    read_lock_irqsave(&xtime_lock, flags);
   45.54 +
   45.55 +    now = stime_irq + get_time_delta();
   45.56 +
   45.57 +    /* Ensure that the returned system time is monotonically increasing. */
   45.58 +    {
   45.59 +        static s_time_t prev_now = 0;
   45.60 +        if ( unlikely(now < prev_now) )
   45.61 +            now = prev_now;
   45.62 +        prev_now = now;
   45.63 +    }
   45.64 +
   45.65 +    read_unlock_irqrestore(&xtime_lock, flags);
   45.66 +
   45.67 +    return now; 
   45.68 +}
   45.69 +
   45.70 +void update_dom_time(struct exec_domain *ed)
   45.71 +{
   45.72 +// FIXME: implement this?
   45.73 +//	printf("update_dom_time: called, not implemented, skipping\n");
   45.74 +	return;
   45.75 +}
   45.76 +
   45.77 +/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
   45.78 +void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
   45.79 +{
   45.80 +// FIXME: Should this be do_settimeofday (from linux)???
   45.81 +	printf("do_settime: called, not implemented, stopping\n");
   45.82 +	dummy();
   45.83 +}
   45.84 +
   45.85 +irqreturn_t
   45.86 +xen_timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
   45.87 +{
   45.88 +	unsigned long new_itm;
   45.89 +
   45.90 +#ifndef XEN
   45.91 +	if (unlikely(cpu_is_offline(smp_processor_id()))) {
   45.92 +		return IRQ_HANDLED;
   45.93 +	}
   45.94 +#endif
   45.95 +#ifdef XEN
   45.96 +	if (current->domain == dom0) {
   45.97 +		// FIXME: there's gotta be a better way of doing this...
   45.98 +		// We have to ensure that domain0 is launched before we
   45.99 +		// call vcpu_timer_expired on it
  45.100 +		//domain0_ready = 1; // moved to xensetup.c
  45.101 +		current->vcpu_info->arch.pending_interruption = 1;
  45.102 +	}
  45.103 +	if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) {
  45.104 +		vcpu_pend_timer(dom0->exec_domain[0]);
  45.105 +		//vcpu_set_next_timer(dom0->exec_domain[0]);
  45.106 +		domain_wake(dom0->exec_domain[0]);
  45.107 +	}
  45.108 +	if (!is_idle_task(current->domain) && current->domain != dom0) {
  45.109 +		if (vcpu_timer_expired(current)) {
  45.110 +			vcpu_pend_timer(current);
  45.111 +			// ensure another timer interrupt happens even if domain doesn't
  45.112 +			vcpu_set_next_timer(current);
  45.113 +			domain_wake(current);
  45.114 +		}
  45.115 +	}
  45.116 +	raise_actimer_softirq();
  45.117 +#endif
  45.118 +
  45.119 +#ifndef XEN
  45.120 +	platform_timer_interrupt(irq, dev_id, regs);
  45.121 +#endif
  45.122 +
  45.123 +	new_itm = local_cpu_data->itm_next;
  45.124 +
  45.125 +	if (!time_after(ia64_get_itc(), new_itm))
  45.126 +#ifdef XEN
  45.127 +		return;
  45.128 +#else
  45.129 +		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
  45.130 +		       ia64_get_itc(), new_itm);
  45.131 +#endif
  45.132 +
  45.133 +#ifdef XEN
  45.134 +//	printf("GOT TO HERE!!!!!!!!!!!\n");
  45.135 +	//while(1);
  45.136 +#else
  45.137 +	profile_tick(CPU_PROFILING, regs);
  45.138 +#endif
  45.139 +
  45.140 +	while (1) {
  45.141 +#ifndef XEN
  45.142 +		update_process_times(user_mode(regs));
  45.143 +#endif
  45.144 +
  45.145 +		new_itm += local_cpu_data->itm_delta;
  45.146 +
  45.147 +		if (smp_processor_id() == TIME_KEEPER_ID) {
  45.148 +			/*
  45.149 +			 * Here we are in the timer irq handler. We have irqs locally
  45.150 +			 * disabled, but we don't know if the timer_bh is running on
  45.151 +			 * another CPU. We need to avoid to SMP race by acquiring the
  45.152 +			 * xtime_lock.
  45.153 +			 */
  45.154 +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  45.155 +			write_seqlock(&xtime_lock);
  45.156 +#endif
  45.157 +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  45.158 +			do_timer(regs);
  45.159 +#endif
  45.160 +			local_cpu_data->itm_next = new_itm;
  45.161 +#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  45.162 +			write_sequnlock(&xtime_lock);
  45.163 +#endif
  45.164 +		} else
  45.165 +			local_cpu_data->itm_next = new_itm;
  45.166 +
  45.167 +		if (time_after(new_itm, ia64_get_itc()))
  45.168 +			break;
  45.169 +	}
  45.170 +
  45.171 +	do {
  45.172 +		/*
  45.173 +		 * If we're too close to the next clock tick for
  45.174 +		 * comfort, we increase the safety margin by
  45.175 +		 * intentionally dropping the next tick(s).  We do NOT
  45.176 +		 * update itm.next because that would force us to call
  45.177 +		 * do_timer() which in turn would let our clock run
  45.178 +		 * too fast (with the potentially devastating effect
  45.179 +		 * of losing monotony of time).
  45.180 +		 */
  45.181 +		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
  45.182 +			new_itm += local_cpu_data->itm_delta;
  45.183 +//#ifdef XEN
  45.184 +//		vcpu_set_next_timer(current);
  45.185 +//#else
  45.186 +//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
  45.187 +		ia64_set_itm(new_itm);
  45.188 +//#endif
  45.189 +		/* double check, in case we got hit by a (slow) PMI: */
  45.190 +	} while (time_after_eq(ia64_get_itc(), new_itm));
  45.191 +	return IRQ_HANDLED;
  45.192 +}
  45.193 +
  45.194 +static struct irqaction xen_timer_irqaction = {
  45.195 +	.handler =	xen_timer_interrupt,
  45.196 +#ifndef XEN
  45.197 +	.flags =	SA_INTERRUPT,
  45.198 +#endif
  45.199 +	.name =		"timer"
  45.200 +};
  45.201 +
  45.202 +void __init
  45.203 +xen_time_init (void)
  45.204 +{
  45.205 +	register_percpu_irq(IA64_TIMER_VECTOR, &xen_timer_irqaction);
  45.206 +	ia64_init_itm();
  45.207 +}
    46.1 --- a/xen/include/asm-ia64/config.h	Mon May 02 16:07:35 2005 +0000
    46.2 +++ b/xen/include/asm-ia64/config.h	Mon May 02 23:55:17 2005 +0000
    46.3 @@ -14,8 +14,6 @@
    46.4  // needed by include/asm-ia64/page.h
    46.5  #define	CONFIG_IA64_PAGE_SIZE_16KB	// 4KB doesn't work?!?
    46.6  #define	CONFIG_IA64_GRANULE_16MB
    46.7 -// needed in arch/ia64/setup.c to reserve memory for domain0
    46.8 -#define CONFIG_BLK_DEV_INITRD
    46.9  
   46.10  #ifndef __ASSEMBLY__
   46.11  
   46.12 @@ -116,6 +114,9 @@ struct page;
   46.13  // avoid redefining task_t in asm/thread_info.h
   46.14  #define task_t	struct domain
   46.15  
   46.16 +// avoid redefining task_struct in asm/current.h
   46.17 +#define task_struct exec_domain
   46.18 +
   46.19  // linux/include/asm-ia64/machvec.h (linux/arch/ia64/lib/io.c)
   46.20  #define platform_inb	__ia64_inb
   46.21  #define platform_inw	__ia64_inw
   46.22 @@ -131,8 +132,10 @@ struct page;
   46.23  #undef ____cacheline_aligned
   46.24  #undef ____cacheline_aligned_in_smp
   46.25  #define __cacheline_aligned
   46.26 +#define __cacheline_aligned_in_smp
   46.27  #define ____cacheline_aligned
   46.28  #define ____cacheline_aligned_in_smp
   46.29 +#define ____cacheline_maxaligned_in_smp
   46.30  
   46.31  #include "asm/types.h"	// for u64
   46.32  struct device {
   46.33 @@ -177,8 +180,6 @@ struct pci_bus_region {
   46.34  	unsigned long end;
   46.35  };
   46.36  
   46.37 -// from linux/include/linux/module.h
   46.38 -
   46.39  // warning: unless search_extable is declared, the return value gets
   46.40  // truncated to 32-bits, causing a very strange error in privop handling
   46.41  struct exception_table_entry;
   46.42 @@ -221,18 +222,47 @@ void sort_main_extable(void);
   46.43  // FIXME following needs work
   46.44  #define atomic_compareandswap(old, new, v) old
   46.45  
   46.46 -// x86 typedef still used in sched.h, may go away later
   46.47 -//typedef unsigned long l1_pgentry_t;
   46.48 -
   46.49  // see include/asm-ia64/mm.h, handle remaining pfn_info uses until gone
   46.50  #define pfn_info page
   46.51  
   46.52  // see common/keyhandler.c
   46.53  #define	nop()	asm volatile ("nop 0")
   46.54  
   46.55 -#define ARCH_HAS_EXEC_DOMAIN_MM_PTR
   46.56 +// from include/linux/preempt.h (needs including from interrupt.h or smp.h)
   46.57 +#define preempt_enable()	do { } while (0)
   46.58 +#define preempt_disable()	do { } while (0)
   46.59 +
   46.60 +// needed for include/xen/linuxtime.h
   46.61 +typedef s64 time_t;
   46.62 +typedef s64 suseconds_t;
   46.63 +
   46.64 +// needed for include/linux/jiffies.h
   46.65 +typedef long clock_t;
   46.66  
   46.67 -// see arch/x86/nmi.c !?!?
   46.68 +// from include/linux/kernel.h, needed by jiffies.h
   46.69 +#define typecheck(type,x) \
   46.70 +({	type __dummy; \
   46.71 +	typeof(x) __dummy2; \
   46.72 +	(void)(&__dummy == &__dummy2); \
   46.73 +	1; \
   46.74 +})
   46.75 +
   46.76 +// from include/linux/timex.h, needed by arch/ia64/time.c
   46.77 +#define	TIME_SOURCE_CPU 0
   46.78 +
   46.79 +// used in common code
   46.80 +#define softirq_pending(cpu)	(cpu_data(cpu)->softirq_pending)
   46.81 +
   46.82 +// dup'ed from signal.h to avoid changes to includes
   46.83 +#define	SA_SHIRQ	0x04000000
   46.84 +#define	SA_INTERRUPT	0x20000000
   46.85 +
   46.86 +// needed for setup.c
   46.87 +extern unsigned long loops_per_jiffy;
   46.88 +extern char saved_command_line[];
   46.89 +struct screen_info { };
   46.90 +#define seq_printf(a,b...) printf(b)
   46.91 +#define CONFIG_BLK_DEV_INITRD // needed to reserve memory for domain0
   46.92  
   46.93  // these declarations got moved at some point, find a better place for them
   46.94  extern int opt_noht;
   46.95 @@ -251,6 +281,8 @@ extern unsigned int watchdog_on;
   46.96  
   46.97  #undef CONFIG_X86
   46.98  
   46.99 +#define CONFIG_MCKINLEY
  46.100 +
  46.101  //#define CONFIG_SMP 1
  46.102  //#define CONFIG_NR_CPUS 2
  46.103  //leave SMP for a later time