direct-io.hg

changeset 4507:f1c946e1226a

bitkeeper revision 1.1277.1.2 (425ae67ayuPkmrSQsIggGCi0FefXZg)

Merge http://djm@sportsman.fc.hp.com//home/djm/xeno-unstable-ia64.bk
into djmnc4000.(none):/home/djm/src/xen/test2611.bk
author djm@djmnc4000.(none)
date Mon Apr 11 21:04:58 2005 +0000 (2005-04-11)
parents 08cf72b95611 c59636548615
children a8466d0e2992
files .rootkeys xen/arch/ia64/domain.c xen/arch/ia64/irq.c xen/arch/ia64/mm_init.c 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/interrupt.h xen/arch/ia64/patch/linux-2.6.11/io.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/kregs.h 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/mca_asm.h xen/arch/ia64/patch/linux-2.6.11/minstate.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/pal.S xen/arch/ia64/patch/linux-2.6.11/pgalloc.h xen/arch/ia64/patch/linux-2.6.11/processor.h xen/arch/ia64/patch/linux-2.6.11/sal.h xen/arch/ia64/patch/linux-2.6.11/series 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/types.h xen/arch/ia64/patch/linux-2.6.11/unaligned.c xen/arch/ia64/patch/linux-2.6.11/wait.h xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/xenasm.S xen/arch/ia64/xenmisc.c xen/include/asm-ia64/config.h xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/.rootkeys	Mon Apr 11 14:14:40 2005 +0000
     1.2 +++ b/.rootkeys	Mon Apr 11 21:04:58 2005 +0000
     1.3 @@ -1078,6 +1078,45 @@ 421098b3LYAS8xJkQiGP7tiTlyBt0Q xen/arch/
     1.4  421098b3ys5GAr4z6_H1jD33oem82g xen/arch/ia64/irq.c
     1.5  421098b3Heh72KuoVlND3CH6c0B0aA xen/arch/ia64/lib/Makefile
     1.6  421098b3O0MYMUsmYVFy84VV_1gFwQ xen/arch/ia64/mm_init.c
     1.7 +425ae516skiHBZU-Kfwxv2YWXfNRWQ xen/arch/ia64/patch/linux-2.6.11/bootmem.h
     1.8 +425ae516maKAsHBJVSzs19cdRgt3Nw xen/arch/ia64/patch/linux-2.6.11/cpumask.h
     1.9 +425ae516rHybgKj6KsvBOE0c_Hruxg xen/arch/ia64/patch/linux-2.6.11/current.h
    1.10 +425ae516cGqvMzGtihTEsQXAXsuOhQ xen/arch/ia64/patch/linux-2.6.11/efi.c
    1.11 +425ae516Y1A4q4_Kfre3qnDj7lbHJg xen/arch/ia64/patch/linux-2.6.11/entry.S
    1.12 +425ae516RoFheL-Ua-EOtFqmLxoc9g xen/arch/ia64/patch/linux-2.6.11/hardirq.h
    1.13 +425ae516PDO1ESDHXHVeDNvlqUfmdQ xen/arch/ia64/patch/linux-2.6.11/head.S
    1.14 +425ae5163aiWdc1IZNsON6ruE2-n9g xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c
    1.15 +425ae516JR7HWvt1zxJ-wLvEWmJGgg xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h
    1.16 +425ae516AHRNmaVuZjJY-9YjmKRDqg xen/arch/ia64/patch/linux-2.6.11/interrupt.h
    1.17 +425ae516U2wFUzrUJQUpy3z38jZHsQ xen/arch/ia64/patch/linux-2.6.11/io.h
    1.18 +425ae516nXL2iTzpziIaSLi3N257qQ xen/arch/ia64/patch/linux-2.6.11/irq.h
    1.19 +425ae516GGRmXijPBLC5ii6yWOn0rg xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c
    1.20 +425ae516qQA5dHuIybqfN3nEzM_Zvg xen/arch/ia64/patch/linux-2.6.11/ivt.S
    1.21 +425ae516_UhrTa3Y8wDG7fTgX6pNYA xen/arch/ia64/patch/linux-2.6.11/kernel-time.c
    1.22 +425ae516atiECmpn_6nZDw4kkmbJ6g xen/arch/ia64/patch/linux-2.6.11/kregs.h
    1.23 +425ae516lwlYwHG1Jv93kC3tfU5caw xen/arch/ia64/patch/linux-2.6.11/lds.S
    1.24 +425ae516UGTH2xC56DEIlHSrPH4oxg xen/arch/ia64/patch/linux-2.6.11/linuxextable.c
    1.25 +425ae516txAP-owjzpTJ7ThfzWR8nw xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h
    1.26 +425ae516kNsO5yYnBHvAISdvCkQ2-g xen/arch/ia64/patch/linux-2.6.11/linuxtime.h
    1.27 +425ae516Je2zI-Iw30_uGhvUYdlCZQ xen/arch/ia64/patch/linux-2.6.11/mca_asm.h
    1.28 +425ae5160-9wHxh0tOnIjavEjt6W0A xen/arch/ia64/patch/linux-2.6.11/minstate.h
    1.29 +425ae516N7SaORdbodDr90tmtCzYXw xen/arch/ia64/patch/linux-2.6.11/mm_contig.c
    1.30 +425ae516YcBgoZ3xCTEmhCrgX8CjCA xen/arch/ia64/patch/linux-2.6.11/mmzone.h
    1.31 +425ae516WDLrfEA4zr40d00z0VIWPg xen/arch/ia64/patch/linux-2.6.11/page.h
    1.32 +425ae516pVQ75NhdItT593SiWI0lbQ xen/arch/ia64/patch/linux-2.6.11/pal.S
    1.33 +425ae516QfmjiF_a-mabAXqV8Imzkg xen/arch/ia64/patch/linux-2.6.11/pgalloc.h
    1.34 +425ae516EWaNOBEnc1xnphTbRmNZsw xen/arch/ia64/patch/linux-2.6.11/processor.h
    1.35 +425ae5165sks4NwRldZOV_p63fspYw xen/arch/ia64/patch/linux-2.6.11/sal.h
    1.36 +425ae516LecDyXlwh3NLBtHZKXmMcA xen/arch/ia64/patch/linux-2.6.11/series
    1.37 +425ae516RFiPn2CGkpJ21LM-1lJcQg xen/arch/ia64/patch/linux-2.6.11/setup.c
    1.38 +425ae516-xgihgqPEv-Aq8-9cNoCXg xen/arch/ia64/patch/linux-2.6.11/slab.h
    1.39 +425ae516FX_10YaKGMU8Ysf7kkdm_A xen/arch/ia64/patch/linux-2.6.11/swiotlb.c
    1.40 +425ae516p4ICTkjqNYEfYFxqULj4dw xen/arch/ia64/patch/linux-2.6.11/system.h
    1.41 +425ae516juUB257qrwUdsL9AsswrqQ xen/arch/ia64/patch/linux-2.6.11/time.c
    1.42 +425ae5167zQn7zYcgKtDUDX2v-e8mw xen/arch/ia64/patch/linux-2.6.11/tlb.c
    1.43 +425ae5162bIl2Dgd19x-FceB4L9oGw xen/arch/ia64/patch/linux-2.6.11/types.h
    1.44 +425ae516cFUNY2jHD46bujcF5NJheA xen/arch/ia64/patch/linux-2.6.11/unaligned.c
    1.45 +425ae516viTtlyQjWHf6kBmq8KcwiQ xen/arch/ia64/patch/linux-2.6.11/wait.h
    1.46  421098b39QFMC-1t1r38CA7NxAYBPA xen/arch/ia64/patch/linux-2.6.7/bootmem.h
    1.47  421098b3SIA1vZX9fFUjo1T3o_jMCQ xen/arch/ia64/patch/linux-2.6.7/current.h
    1.48  421098b3ZBl80iPuSeDU_Id5AgZl0w xen/arch/ia64/patch/linux-2.6.7/efi.c
     2.1 --- a/xen/arch/ia64/domain.c	Mon Apr 11 14:14:40 2005 +0000
     2.2 +++ b/xen/arch/ia64/domain.c	Mon Apr 11 21:04:58 2005 +0000
     2.3 @@ -289,6 +289,7 @@ struct page * map_new_domain_page(struct
     2.4  	struct mm_struct *mm = d->arch.mm;
     2.5  	struct page *p = (struct page *)0;
     2.6  	pgd_t *pgd;
     2.7 +	pud_t *pud;
     2.8  	pmd_t *pmd;
     2.9  	pte_t *pte;
    2.10  extern unsigned long vhpt_paddr, vhpt_pend;
    2.11 @@ -299,9 +300,13 @@ extern unsigned long vhpt_paddr, vhpt_pe
    2.12  	}
    2.13  	pgd = pgd_offset(mm,mpaddr);
    2.14  	if (pgd_none(*pgd))
    2.15 -		pgd_populate(mm, pgd, pmd_alloc_one(mm,mpaddr));
    2.16 +		pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr));
    2.17  
    2.18 -	pmd = pmd_offset(pgd, mpaddr);
    2.19 +	pud = pud_offset(pgd, mpaddr);
    2.20 +	if (pud_none(*pud))
    2.21 +		pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr));
    2.22 +
    2.23 +	pmd = pmd_offset(pud, mpaddr);
    2.24  	if (pmd_none(*pmd))
    2.25  		pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
    2.26  //		pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
    2.27 @@ -338,6 +343,7 @@ unsigned long lookup_domain_mpa(struct d
    2.28  {
    2.29  	struct mm_struct *mm = d->arch.mm;
    2.30  	pgd_t *pgd = pgd_offset(mm, mpaddr);
    2.31 +	pud_t *pud;
    2.32  	pmd_t *pmd;
    2.33  	pte_t *pte;
    2.34  
    2.35 @@ -356,14 +362,17 @@ unsigned long lookup_domain_mpa(struct d
    2.36  #endif
    2.37  tryagain:
    2.38  	if (pgd_present(*pgd)) {
    2.39 -		pmd = pmd_offset(pgd,mpaddr);
    2.40 -		if (pmd_present(*pmd)) {
    2.41 -			pte = pte_offset_map(pmd,mpaddr);
    2.42 -			if (pte_present(*pte)) {
    2.43 +		pud = pud_offset(pgd,mpaddr);
    2.44 +		if (pud_present(*pud)) {
    2.45 +			pmd = pmd_offset(pud,mpaddr);
    2.46 +			if (pmd_present(*pmd)) {
    2.47 +				pte = pte_offset_map(pmd,mpaddr);
    2.48 +				if (pte_present(*pte)) {
    2.49  //printk("lookup_domain_page: found mapping for %lx, pte=%lx\n",mpaddr,pte_val(*pte));
    2.50 -				return *(unsigned long *)pte;
    2.51 +					return *(unsigned long *)pte;
    2.52 +				}
    2.53  			}
    2.54 -		}	
    2.55 +		}
    2.56  	}
    2.57  	/* if lookup fails and mpaddr is "legal", "create" the page */
    2.58  	if ((mpaddr >> PAGE_SHIFT) < d->max_pages) {
     3.1 --- a/xen/arch/ia64/irq.c	Mon Apr 11 14:14:40 2005 +0000
     3.2 +++ b/xen/arch/ia64/irq.c	Mon Apr 11 21:04:58 2005 +0000
     3.3 @@ -492,101 +492,101 @@ EXPORT_SYMBOL(enable_irq);
     3.4   * SMP cross-CPU interrupts have their own specific
     3.5   * handlers).
     3.6   */
     3.7 -unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs)
     3.8 +fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs)
     3.9  {
    3.10 -	/*
    3.11 -	 * We ack quickly, we don't want the irq controller
    3.12 -	 * thinking we're snobs just because some other CPU has
    3.13 -	 * disabled global interrupts (we have already done the
    3.14 -	 * INT_ACK cycles, it's too late to try to pretend to the
    3.15 -	 * controller that we aren't taking the interrupt).
    3.16 -	 *
    3.17 -	 * 0 return value means that this irq is already being
    3.18 -	 * handled by some other CPU. (or is disabled)
    3.19 -	 */
    3.20 -	irq_desc_t *desc = irq_descp(irq);
    3.21 +	irq_desc_t *desc = irq_desc + irq;
    3.22  	struct irqaction * action;
    3.23 -	irqreturn_t action_ret;
    3.24  	unsigned int status;
    3.25 -	int cpu;
    3.26 -
    3.27 -	cpu = smp_processor_id(); /* for CONFIG_PREEMPT, this must come after irq_enter()! */
    3.28  
    3.29  #ifndef XEN
    3.30 -	kstat_cpu(cpu).irqs[irq]++;
    3.31 +	kstat_this_cpu.irqs[irq]++;
    3.32  #endif
    3.33 -
    3.34  	if (desc->status & IRQ_PER_CPU) {
    3.35 -		/* no locking required for CPU-local interrupts: */
    3.36 -		desc->handler->ack(irq);
    3.37 -		action_ret = handle_IRQ_event(irq, regs, desc->action);
    3.38 -		desc->handler->end(irq);
    3.39 -	} else {
    3.40 -		spin_lock(&desc->lock);
    3.41 -		desc->handler->ack(irq);
    3.42 -		/*
    3.43 -		 * REPLAY is when Linux resends an IRQ that was dropped earlier
    3.44 -		 * WAITING is used by probe to mark irqs that are being tested
    3.45 -		 */
    3.46 -#ifdef XEN
    3.47 -		status = desc->status & ~IRQ_REPLAY;
    3.48 -#else
    3.49 -		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
    3.50 -#endif
    3.51 -		status |= IRQ_PENDING; /* we _want_ to handle it */
    3.52 +		irqreturn_t action_ret;
    3.53  
    3.54  		/*
    3.55 -		 * If the IRQ is disabled for whatever reason, we cannot
    3.56 -		 * use the action we have.
    3.57 +		 * No locking required for CPU-local interrupts:
    3.58  		 */
    3.59 -		action = NULL;
    3.60 -		if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
    3.61 -			action = desc->action;
    3.62 -			status &= ~IRQ_PENDING; /* we commit to handling */
    3.63 -			status |= IRQ_INPROGRESS; /* we are handling it */
    3.64 -		}
    3.65 -		desc->status = status;
    3.66 +		desc->handler->ack(irq);
    3.67 +		action_ret = handle_IRQ_event(irq, regs, desc->action);
    3.68 +#ifndef XEN
    3.69 +		if (!noirqdebug)
    3.70 +			note_interrupt(irq, desc, action_ret);
    3.71 +#endif
    3.72 +		desc->handler->end(irq);
    3.73 +		return 1;
    3.74 +	}
    3.75  
    3.76 -		/*
    3.77 -		 * If there is no IRQ handler or it was disabled, exit early.
    3.78 -		 * Since we set PENDING, if another processor is handling
    3.79 -		 * a different instance of this same irq, the other processor
    3.80 -		 * will take care of it.
    3.81 -		 */
    3.82 -		if (unlikely(!action))
    3.83 -			goto out;
    3.84 +	spin_lock(&desc->lock);
    3.85 +	desc->handler->ack(irq);
    3.86 +	/*
    3.87 +	 * REPLAY is when Linux resends an IRQ that was dropped earlier
    3.88 +	 * WAITING is used by probe to mark irqs that are being tested
    3.89 +	 */
    3.90 +#ifdef XEN
    3.91 +	status = desc->status & ~IRQ_REPLAY;
    3.92 +#else
    3.93 +	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
    3.94 +#endif
    3.95 +	status |= IRQ_PENDING; /* we _want_ to handle it */
    3.96 +
    3.97 +	/*
    3.98 +	 * If the IRQ is disabled for whatever reason, we cannot
    3.99 +	 * use the action we have.
   3.100 +	 */
   3.101 +	action = NULL;
   3.102 +	if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
   3.103 +		action = desc->action;
   3.104 +		status &= ~IRQ_PENDING; /* we commit to handling */
   3.105 +		status |= IRQ_INPROGRESS; /* we are handling it */
   3.106 +	}
   3.107 +	desc->status = status;
   3.108  
   3.109 -		/*
   3.110 -		 * Edge triggered interrupts need to remember
   3.111 -		 * pending events.
   3.112 -		 * This applies to any hw interrupts that allow a second
   3.113 -		 * instance of the same irq to arrive while we are in do_IRQ
   3.114 -		 * or in the handler. But the code here only handles the _second_
   3.115 -		 * instance of the irq, not the third or fourth. So it is mostly
   3.116 -		 * useful for irq hardware that does not mask cleanly in an
   3.117 -		 * SMP environment.
   3.118 -		 */
   3.119 -		for (;;) {
   3.120 -			spin_unlock(&desc->lock);
   3.121 -			action_ret = handle_IRQ_event(irq, regs, action);
   3.122 -			spin_lock(&desc->lock);
   3.123 +	/*
   3.124 +	 * If there is no IRQ handler or it was disabled, exit early.
   3.125 +	 * Since we set PENDING, if another processor is handling
   3.126 +	 * a different instance of this same irq, the other processor
   3.127 +	 * will take care of it.
   3.128 +	 */
   3.129 +	if (unlikely(!action))
   3.130 +		goto out;
   3.131 +
   3.132 +	/*
   3.133 +	 * Edge triggered interrupts need to remember
   3.134 +	 * pending events.
   3.135 +	 * This applies to any hw interrupts that allow a second
   3.136 +	 * instance of the same irq to arrive while we are in do_IRQ
   3.137 +	 * or in the handler. But the code here only handles the _second_
   3.138 +	 * instance of the irq, not the third or fourth. So it is mostly
   3.139 +	 * useful for irq hardware that does not mask cleanly in an
   3.140 +	 * SMP environment.
   3.141 +	 */
   3.142 +	for (;;) {
   3.143 +		irqreturn_t action_ret;
   3.144 +
   3.145 +		spin_unlock(&desc->lock);
   3.146 +
   3.147 +		action_ret = handle_IRQ_event(irq, regs, action);
   3.148 +
   3.149 +		spin_lock(&desc->lock);
   3.150  #ifndef XEN
   3.151 -			if (!noirqdebug)
   3.152 -				note_interrupt(irq, desc, action_ret);
   3.153 +		if (!noirqdebug)
   3.154 +			note_interrupt(irq, desc, action_ret);
   3.155  #endif
   3.156 -			if (!(desc->status & IRQ_PENDING))
   3.157 -				break;
   3.158 -			desc->status &= ~IRQ_PENDING;
   3.159 -		}
   3.160 -		desc->status &= ~IRQ_INPROGRESS;
   3.161 -	  out:
   3.162 -		/*
   3.163 -		 * The ->end() handler has to deal with interrupts which got
   3.164 -		 * disabled while the handler was running.
   3.165 -		 */
   3.166 -		desc->handler->end(irq);
   3.167 -		spin_unlock(&desc->lock);
   3.168 +		if (likely(!(desc->status & IRQ_PENDING)))
   3.169 +			break;
   3.170 +		desc->status &= ~IRQ_PENDING;
   3.171  	}
   3.172 +	desc->status &= ~IRQ_INPROGRESS;
   3.173 +
   3.174 +out:
   3.175 +	/*
   3.176 +	 * The ->end() handler has to deal with interrupts which got
   3.177 +	 * disabled while the handler was running.
   3.178 +	 */
   3.179 +	desc->handler->end(irq);
   3.180 +	spin_unlock(&desc->lock);
   3.181 +
   3.182  	return 1;
   3.183  }
   3.184  
     4.1 --- a/xen/arch/ia64/mm_init.c	Mon Apr 11 14:14:40 2005 +0000
     4.2 +++ b/xen/arch/ia64/mm_init.c	Mon Apr 11 21:04:58 2005 +0000
     4.3 @@ -102,6 +102,39 @@ void insert_vm_struct(struct mm_struct *
     4.4  /////////////////////////////////////////////
     4.5  //following from linux/mm/memory.c
     4.6  
     4.7 +#ifndef __ARCH_HAS_4LEVEL_HACK
     4.8 +/*
     4.9 + * Allocate page upper directory.
    4.10 + *
    4.11 + * We've already handled the fast-path in-line, and we own the
    4.12 + * page table lock.
    4.13 + *
    4.14 + * On a two-level or three-level page table, this ends up actually being
    4.15 + * entirely optimized away.
    4.16 + */
    4.17 +pud_t fastcall *__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
    4.18 +{
    4.19 +	pud_t *new;
    4.20 +
    4.21 +	spin_unlock(&mm->page_table_lock);
    4.22 +	new = pud_alloc_one(mm, address);
    4.23 +	spin_lock(&mm->page_table_lock);
    4.24 +	if (!new)
    4.25 +		return NULL;
    4.26 +
    4.27 +	/*
    4.28 +	 * Because we dropped the lock, we should re-check the
    4.29 +	 * entry, as somebody else could have populated it..
    4.30 +	 */
    4.31 +	if (pgd_present(*pgd)) {
    4.32 +		pud_free(new);
    4.33 +		goto out;
    4.34 +	}
    4.35 +	pgd_populate(mm, pgd, new);
    4.36 + out:
    4.37 +	return pud_offset(pgd, address);
    4.38 +}
    4.39 +
    4.40  /*
    4.41   * Allocate page middle directory.
    4.42   *
    4.43 @@ -111,7 +144,7 @@ void insert_vm_struct(struct mm_struct *
    4.44   * On a two-level page table, this ends up actually being entirely
    4.45   * optimized away.
    4.46   */
    4.47 -pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
    4.48 +pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
    4.49  {
    4.50  	pmd_t *new;
    4.51  
    4.52 @@ -125,14 +158,15 @@ pmd_t fastcall *__pmd_alloc(struct mm_st
    4.53  	 * Because we dropped the lock, we should re-check the
    4.54  	 * entry, as somebody else could have populated it..
    4.55  	 */
    4.56 -	if (pgd_present(*pgd)) {
    4.57 +	if (pud_present(*pud)) {
    4.58  		pmd_free(new);
    4.59  		goto out;
    4.60  	}
    4.61 -	pgd_populate(mm, pgd, new);
    4.62 -out:
    4.63 -	return pmd_offset(pgd, address);
    4.64 +	pud_populate(mm, pud, new);
    4.65 + out:
    4.66 +	return pmd_offset(pud, address);
    4.67  }
    4.68 +#endif
    4.69  
    4.70  pte_t fastcall * pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)
    4.71  {
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/bootmem.h	Mon Apr 11 21:04:58 2005 +0000
     5.3 @@ -0,0 +1,17 @@
     5.4 + bootmem.h |    2 ++
     5.5 + 1 files changed, 2 insertions(+)
     5.6 +
     5.7 +Index: linux-2.6.11/include/linux/bootmem.h
     5.8 +===================================================================
     5.9 +--- linux-2.6.11.orig/include/linux/bootmem.h	2005-03-02 01:38:25.000000000 -0600
    5.10 ++++ linux-2.6.11/include/linux/bootmem.h	2005-03-19 12:39:36.915887729 -0600
    5.11 +@@ -41,7 +41,9 @@ extern unsigned long __init init_bootmem
    5.12 + extern void __init free_bootmem (unsigned long addr, unsigned long size);
    5.13 + extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
    5.14 + #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
    5.15 ++#ifndef XEN
    5.16 + extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
    5.17 ++#endif
    5.18 + #define alloc_bootmem(x) \
    5.19 + 	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
    5.20 + #define alloc_bootmem_low(x) \
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/cpumask.h	Mon Apr 11 21:04:58 2005 +0000
     6.3 @@ -0,0 +1,20 @@
     6.4 + cpumask.h |    2 +-
     6.5 + 1 files changed, 1 insertion(+), 1 deletion(-)
     6.6 +
     6.7 +Index: linux-2.6.11-xendiffs/include/linux/cpumask.h
     6.8 +===================================================================
     6.9 +--- linux-2.6.11-xendiffs.orig/include/linux/cpumask.h	2005-03-02 01:38:00.000000000 -0600
    6.10 ++++ linux-2.6.11-xendiffs/include/linux/cpumask.h	2005-03-24 15:06:18.408145243 -0600
    6.11 +@@ -341,11 +341,11 @@ static inline int __cpumask_parse(const 
    6.12 +  *        main(){ set1(3); set2(5); }
    6.13 +  */
    6.14 + 
    6.15 ++#if NR_CPUS > 1
    6.16 + extern cpumask_t cpu_possible_map;
    6.17 + extern cpumask_t cpu_online_map;
    6.18 + extern cpumask_t cpu_present_map;
    6.19 + 
    6.20 +-#if NR_CPUS > 1
    6.21 + #define num_online_cpus()	cpus_weight(cpu_online_map)
    6.22 + #define num_possible_cpus()	cpus_weight(cpu_possible_map)
    6.23 + #define num_present_cpus()	cpus_weight(cpu_present_map)
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/current.h	Mon Apr 11 21:04:58 2005 +0000
     7.3 @@ -0,0 +1,22 @@
     7.4 + current.h |    8 ++++++++
     7.5 + 1 files changed, 8 insertions(+)
     7.6 +
     7.7 +Index: linux-2.6.11/include/asm-ia64/current.h
     7.8 +===================================================================
     7.9 +--- linux-2.6.11.orig/include/asm-ia64/current.h	2005-03-02 01:38:19.000000000 -0600
    7.10 ++++ linux-2.6.11/include/asm-ia64/current.h	2005-03-19 12:39:41.410955288 -0600
    7.11 +@@ -12,6 +12,14 @@
    7.12 +  * In kernel mode, thread pointer (r13) is used to point to the current task
    7.13 +  * structure.
    7.14 +  */
    7.15 ++#ifdef XEN
    7.16 ++struct domain;
    7.17 ++#define get_current()	((struct exec_domain *) ia64_getreg(_IA64_REG_TP))
    7.18 ++#define current get_current()
    7.19 ++//#define set_current(d)	ia64_setreg(_IA64_REG_TP,(void *)d);
    7.20 ++#define set_current(d)		(ia64_r13 = (void *)d)
    7.21 ++#else
    7.22 + #define current	((struct task_struct *) ia64_getreg(_IA64_REG_TP))
    7.23 ++#endif
    7.24 + 
    7.25 + #endif /* _ASM_IA64_CURRENT_H */
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/efi.c	Mon Apr 11 21:04:58 2005 +0000
     8.3 @@ -0,0 +1,67 @@
     8.4 + efi.c |   32 ++++++++++++++++++++++++++++++++
     8.5 + 1 files changed, 32 insertions(+)
     8.6 +
     8.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c
     8.8 +===================================================================
     8.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/efi.c	2005-04-07 12:22:08.230781400 -0500
    8.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c	2005-04-07 12:25:11.875195997 -0500
    8.11 +@@ -25,6 +25,9 @@
    8.12 + #include <linux/types.h>
    8.13 + #include <linux/time.h>
    8.14 + #include <linux/efi.h>
    8.15 ++#ifdef XEN
    8.16 ++#include <xen/sched.h>
    8.17 ++#endif
    8.18 + 
    8.19 + #include <asm/io.h>
    8.20 + #include <asm/kregs.h>
    8.21 +@@ -218,6 +221,7 @@ efi_gettimeofday (struct timespec *ts)
    8.22 + 	if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
    8.23 + 		return;
    8.24 + 
    8.25 ++	dummy();
    8.26 + 	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
    8.27 + 	ts->tv_nsec = tm.nanosecond;
    8.28 + }
    8.29 +@@ -320,6 +324,10 @@ efi_memmap_walk (efi_freemem_callback_t 
    8.30 + 		if (!(md->attribute & EFI_MEMORY_WB))
    8.31 + 			continue;
    8.32 + 
    8.33 ++#ifdef XEN
    8.34 ++// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
    8.35 ++		if (md->phys_addr >= 0x100000000) continue;
    8.36 ++#endif
    8.37 + 		/*
    8.38 + 		 * granule_addr is the base of md's first granule.
    8.39 + 		 * [granule_addr - first_non_wb_addr) is guaranteed to
    8.40 +@@ -719,6 +727,30 @@ efi_get_iobase (void)
    8.41 + 	return 0;
    8.42 + }
    8.43 + 
    8.44 ++#ifdef XEN
    8.45 ++// variation of efi_get_iobase which returns entire memory descriptor
    8.46 ++efi_memory_desc_t *
    8.47 ++efi_get_io_md (void)
    8.48 ++{
    8.49 ++	void *efi_map_start, *efi_map_end, *p;
    8.50 ++	efi_memory_desc_t *md;
    8.51 ++	u64 efi_desc_size;
    8.52 ++
    8.53 ++	efi_map_start = __va(ia64_boot_param->efi_memmap);
    8.54 ++	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
    8.55 ++	efi_desc_size = ia64_boot_param->efi_memdesc_size;
    8.56 ++
    8.57 ++	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
    8.58 ++		md = p;
    8.59 ++		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
    8.60 ++			if (md->attribute & EFI_MEMORY_UC)
    8.61 ++				return md;
    8.62 ++		}
    8.63 ++	}
    8.64 ++	return 0;
    8.65 ++}
    8.66 ++#endif
    8.67 ++
    8.68 + u32
    8.69 + efi_mem_type (unsigned long phys_addr)
    8.70 + {
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S	Mon Apr 11 21:04:58 2005 +0000
     9.3 @@ -0,0 +1,202 @@
     9.4 + entry.S |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
     9.5 + 1 files changed, 85 insertions(+), 1 deletion(-)
     9.6 +
     9.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S
     9.8 +===================================================================
     9.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/entry.S	2005-04-08 13:32:07.636308237 -0500
    9.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S	2005-04-08 13:37:04.612542509 -0500
    9.11 +@@ -35,7 +35,9 @@
    9.12 + 
    9.13 + #include <asm/asmmacro.h>
    9.14 + #include <asm/cache.h>
    9.15 ++#ifndef XEN
    9.16 + #include <asm/errno.h>
    9.17 ++#endif
    9.18 + #include <asm/kregs.h>
    9.19 + #include <asm/offsets.h>
    9.20 + #include <asm/pgtable.h>
    9.21 +@@ -46,6 +48,25 @@
    9.22 + 
    9.23 + #include "minstate.h"
    9.24 + 
    9.25 ++#ifdef XEN
    9.26 ++#define	sys_execve 0
    9.27 ++#define do_fork 0
    9.28 ++#define	syscall_trace_enter 0
    9.29 ++#define	syscall_trace_leave 0
    9.30 ++#define schedule 0
    9.31 ++#define do_notify_resume_user 0
    9.32 ++#define ia64_rt_sigsuspend 0
    9.33 ++#define ia64_rt_sigreturn 0
    9.34 ++#define	ia64_handle_unaligned 0
    9.35 ++#define	errno 0
    9.36 ++#define	sys_ni_syscall 0
    9.37 ++#define unw_init_frame_info 0
    9.38 ++#define sys_call_table 0
    9.39 ++#define do_sigdelayed 0
    9.40 ++#endif
    9.41 ++
    9.42 ++	/*
    9.43 ++
    9.44 + 	/*
    9.45 + 	 * execve() is special because in case of success, we need to
    9.46 + 	 * setup a null register window frame.
    9.47 +@@ -187,11 +208,14 @@ GLOBAL_ENTRY(ia64_switch_to)
    9.48 + 	DO_SAVE_SWITCH_STACK
    9.49 + 	.body
    9.50 + 
    9.51 ++#ifdef XEN
    9.52 ++//#undef IA64_TASK_THREAD_KSP_OFFSET
    9.53 ++//#define	IA64_TASK_THREAD_KSP_OFFSET	0x38
    9.54 + 	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
    9.55 + 	movl r25=init_task
    9.56 + 	mov r27=IA64_KR(CURRENT_STACK)
    9.57 + 	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
    9.58 +-	dep r20=0,in0,61,3		// physical address of "next"
    9.59 ++	dep r20=0,in0,60,4		// physical address of "next"
    9.60 + 	;;
    9.61 + 	st8 [r22]=sp			// save kernel stack pointer of old task
    9.62 + 	shr.u r26=r20,IA64_GRANULE_SHIFT
    9.63 +@@ -203,6 +227,22 @@ GLOBAL_ENTRY(ia64_switch_to)
    9.64 + (p6)	cmp.eq p7,p6=r26,r27
    9.65 + (p6)	br.cond.dpnt .map
    9.66 + 	;;
    9.67 ++#else
    9.68 ++	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
    9.69 ++	mov r27=IA64_KR(CURRENT_STACK)
    9.70 ++	dep r20=0,in0,61,3		// physical address of "current"
    9.71 ++	;;
    9.72 ++	st8 [r22]=sp			// save kernel stack pointer of old task
    9.73 ++	shr.u r26=r20,IA64_GRANULE_SHIFT
    9.74 ++	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
    9.75 ++	;;
    9.76 ++	/*
    9.77 ++	 * If we've already mapped this task's page, we can skip doing it again.
    9.78 ++	 */
    9.79 ++	cmp.eq p7,p6=r26,r27
    9.80 ++(p6)	br.cond.dpnt .map
    9.81 ++	;;
    9.82 ++#endif
    9.83 + .done:
    9.84 + (p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
    9.85 + 	;;
    9.86 +@@ -220,6 +260,16 @@ GLOBAL_ENTRY(ia64_switch_to)
    9.87 + 	br.ret.sptk.many rp		// boogie on out in new context
    9.88 + 
    9.89 + .map:
    9.90 ++#ifdef XEN
    9.91 ++	// avoid overlapping with kernel TR
    9.92 ++	movl r25=KERNEL_START
    9.93 ++	dep  r23=0,in0,0,KERNEL_TR_PAGE_SHIFT
    9.94 ++	;;
    9.95 ++	cmp.eq p7,p0=r25,r23
    9.96 ++	;;
    9.97 ++(p7)	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
    9.98 ++(p7)	br.cond.sptk .done
    9.99 ++#endif
   9.100 + 	rsm psr.ic			// interrupts (psr.i) are already disabled here
   9.101 + 	movl r25=PAGE_KERNEL
   9.102 + 	;;
   9.103 +@@ -376,7 +426,11 @@ END(save_switch_stack)
   9.104 +  *	- b7 holds address to return to
   9.105 +  *	- must not touch r8-r11
   9.106 +  */
   9.107 ++#ifdef XEN
   9.108 ++GLOBAL_ENTRY(load_switch_stack)
   9.109 ++#else
   9.110 + ENTRY(load_switch_stack)
   9.111 ++#endif
   9.112 + 	.prologue
   9.113 + 	.altrp b7
   9.114 + 
   9.115 +@@ -604,6 +658,11 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
   9.116 + 	 */
   9.117 + 	br.call.sptk.many rp=ia64_invoke_schedule_tail
   9.118 + }
   9.119 ++#ifdef XEN
   9.120 ++	// new domains are cloned but not exec'ed so switch to user mode here
   9.121 ++	cmp.ne pKStk,pUStk=r0,r0
   9.122 ++	br.cond.spnt ia64_leave_kernel
   9.123 ++#else
   9.124 + .ret8:
   9.125 + 	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
   9.126 + 	;;
   9.127 +@@ -614,6 +673,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
   9.128 + 	;;
   9.129 + 	cmp.ne p6,p0=r2,r0
   9.130 + (p6)	br.cond.spnt .strace_check_retval
   9.131 ++#endif
   9.132 + 	;;					// added stop bits to prevent r8 dependency
   9.133 + END(ia64_ret_from_clone)
   9.134 + 	// fall through
   9.135 +@@ -700,9 +760,14 @@ ENTRY(ia64_leave_syscall)
   9.136 + .work_processed_syscall:
   9.137 + 	adds r2=PT(LOADRS)+16,r12
   9.138 + 	adds r3=PT(AR_BSPSTORE)+16,r12
   9.139 ++#ifdef XEN
   9.140 ++	mov r31=r0
   9.141 ++	;;
   9.142 ++#else
   9.143 + 	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
   9.144 + 	;;
   9.145 + (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
   9.146 ++#endif
   9.147 + 	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
   9.148 + 	mov b7=r0		// clear b7
   9.149 + 	;;
   9.150 +@@ -757,7 +822,11 @@ ENTRY(ia64_leave_syscall)
   9.151 + 	;;
   9.152 + 	ld8.fill r12=[r2]	// restore r12 (sp)
   9.153 + 	ld8.fill r15=[r3]	// restore r15
   9.154 ++#ifdef XEN
   9.155 ++	movl r3=THIS_CPU(ia64_phys_stacked_size_p8)
   9.156 ++#else
   9.157 + 	addl r3=THIS_CPU(ia64_phys_stacked_size_p8),r0
   9.158 ++#endif
   9.159 + 	;;
   9.160 + (pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
   9.161 + (pUStk) st1 [r14]=r17
   9.162 +@@ -814,9 +883,18 @@ GLOBAL_ENTRY(ia64_leave_kernel)
   9.163 + (pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
   9.164 + #endif
   9.165 + .work_processed_kernel:
   9.166 ++#ifdef XEN
   9.167 ++	alloc loc0=ar.pfs,0,1,1,0
   9.168 ++	adds out0=16,r12
   9.169 ++	;;
   9.170 ++(p6)	br.call.sptk.many b0=deliver_pending_interrupt
   9.171 ++	mov ar.pfs=loc0
   9.172 ++	mov r31=r0
   9.173 ++#else
   9.174 + 	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
   9.175 + 	;;
   9.176 + (p6)	ld4 r31=[r17]				// load current_thread_info()->flags
   9.177 ++#endif
   9.178 + 	adds r21=PT(PR)+16,r12
   9.179 + 	;;
   9.180 + 
   9.181 +@@ -934,7 +1012,11 @@ GLOBAL_ENTRY(ia64_leave_kernel)
   9.182 + 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
   9.183 + 	;;
   9.184 + 	mov r16=ar.bsp		// get existing backing store pointer
   9.185 ++#ifdef XEN
   9.186 ++	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
   9.187 ++#else
   9.188 + 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
   9.189 ++#endif
   9.190 + 	;;
   9.191 + 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
   9.192 + (pKStk)	br.cond.dpnt skip_rbs_switch
   9.193 +@@ -1323,6 +1405,7 @@ GLOBAL_ENTRY(unw_init_running)
   9.194 + 	br.ret.sptk.many rp
   9.195 + END(unw_init_running)
   9.196 + 
   9.197 ++#ifndef XEN
   9.198 + 	.rodata
   9.199 + 	.align 8
   9.200 + 	.globl sys_call_table
   9.201 +@@ -1585,3 +1668,4 @@ sys_call_table:
   9.202 + 	data8 sys_ni_syscall
   9.203 + 
   9.204 + 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
   9.205 ++#endif
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h	Mon Apr 11 21:04:58 2005 +0000
    10.3 @@ -0,0 +1,15 @@
    10.4 + hardirq.h |    1 +
    10.5 + 1 files changed, 1 insertion(+)
    10.6 +
    10.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h
    10.8 +===================================================================
    10.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/hardirq.h	2005-03-24 15:59:37.210502749 -0600
   10.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h	2005-03-24 16:00:19.439540961 -0600
   10.11 +@@ -20,6 +20,7 @@
   10.12 + #define __ARCH_IRQ_STAT	1
   10.13 + 
   10.14 + #define local_softirq_pending()		(local_cpu_data->softirq_pending)
   10.15 ++#define softirq_pending(cpu)			(cpu_data(cpu)->softirq_pending)
   10.16 + 
   10.17 + #define HARDIRQ_BITS	14
   10.18 + 
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/head.S	Mon Apr 11 21:04:58 2005 +0000
    11.3 @@ -0,0 +1,85 @@
    11.4 + head.S |   34 ++++++++++++++++++++++++++++++++++
    11.5 + 1 files changed, 34 insertions(+)
    11.6 +
    11.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S
    11.8 +===================================================================
    11.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/head.S	2005-04-07 10:56:19.225128582 -0500
   11.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/head.S	2005-04-07 11:00:21.718513399 -0500
   11.11 +@@ -1,3 +1,8 @@
   11.12 ++#ifdef XEN
   11.13 ++#define	console_print	printf
   11.14 ++#define kernel_thread_helper 0
   11.15 ++#define sys_exit 0
   11.16 ++#endif
   11.17 + /*
   11.18 +  * Here is where the ball gets rolling as far as the kernel is concerned.
   11.19 +  * When control is transferred to _start, the bootload has already
   11.20 +@@ -187,7 +192,11 @@ start_ap:
   11.21 + 	dep r18=0,r3,0,12
   11.22 + 	;;
   11.23 + 	or r18=r17,r18
   11.24 ++#ifdef XEN
   11.25 ++	dep r2=-1,r3,60,4	// IMVA of task
   11.26 ++#else
   11.27 + 	dep r2=-1,r3,61,3	// IMVA of task
   11.28 ++#endif
   11.29 + 	;;
   11.30 + 	mov r17=rr[r2]
   11.31 + 	shr.u r16=r3,IA64_GRANULE_SHIFT
   11.32 +@@ -227,7 +236,11 @@ start_ap:
   11.33 + 	;;
   11.34 + 	mov ar.rsc=0x3		// place RSE in eager mode
   11.35 + 
   11.36 ++#ifdef XEN
   11.37 ++(isBP)	dep r28=-1,r28,60,4	// make address virtual
   11.38 ++#else
   11.39 + (isBP)	dep r28=-1,r28,61,3	// make address virtual
   11.40 ++#endif
   11.41 + (isBP)	movl r2=ia64_boot_param
   11.42 + 	;;
   11.43 + (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
   11.44 +@@ -245,7 +258,21 @@ start_ap:
   11.45 + 	br.call.sptk.many rp=sys_fw_init
   11.46 + .ret1:
   11.47 + #endif
   11.48 ++#ifdef XEN
   11.49 ++	alloc r2=ar.pfs,8,0,2,0
   11.50 ++	;;
   11.51 ++#define fake_mbi_magic 0
   11.52 ++#define MULTIBOOT_INFO_SIZE	1024
   11.53 ++	.rodata
   11.54 ++fake_mbi:
   11.55 ++	.skip MULTIBOOT_INFO_SIZE
   11.56 ++	.previous
   11.57 ++	movl out0=fake_mbi
   11.58 ++	;;
   11.59 ++	br.call.sptk.many rp=cmain
   11.60 ++#else
   11.61 + 	br.call.sptk.many rp=start_kernel
   11.62 ++#endif
   11.63 + .ret2:	addl r3=@ltoff(halt_msg),gp
   11.64 + 	;;
   11.65 + 	alloc r2=ar.pfs,8,0,2,0
   11.66 +@@ -254,7 +281,9 @@ start_ap:
   11.67 + 	br.call.sptk.many b0=console_print
   11.68 + 
   11.69 + self:	hint @pause
   11.70 ++	;;
   11.71 + 	br.sptk.many self		// endless loop
   11.72 ++	;;
   11.73 + END(_start)
   11.74 + 
   11.75 + GLOBAL_ENTRY(ia64_save_debug_regs)
   11.76 +@@ -850,7 +879,12 @@ END(ia64_delay_loop)
   11.77 +  * intermediate precision so that we can produce a full 64-bit result.
   11.78 +  */
   11.79 + GLOBAL_ENTRY(sched_clock)
   11.80 ++#ifdef XEN
   11.81 ++	break 0;;	// FIX IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   11.82 ++	//movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   11.83 ++#else
   11.84 + 	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
   11.85 ++#endif
   11.86 + 	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
   11.87 + 	;;
   11.88 + 	ldf8 f8=[r8]
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c	Mon Apr 11 21:04:58 2005 +0000
    12.3 @@ -0,0 +1,41 @@
    12.4 + hpsim_irq.c |   15 +++++++++++++++
    12.5 + 1 files changed, 15 insertions(+)
    12.6 +
    12.7 +Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c
    12.8 +===================================================================
    12.9 +--- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_irq.c	2005-03-02 01:38:33.000000000 -0600
   12.10 ++++ linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c	2005-03-19 13:33:57.312014806 -0600
   12.11 +@@ -9,7 +9,17 @@
   12.12 + #include <linux/kernel.h>
   12.13 + #include <linux/sched.h>
   12.14 + #include <linux/irq.h>
   12.15 ++#ifdef XEN
   12.16 ++#include <asm/hw_irq.h>
   12.17 ++#endif
   12.18 + 
   12.19 ++#if 1
   12.20 ++void __init
   12.21 ++hpsim_irq_init (void)
   12.22 ++{
   12.23 ++	printf("*** hpsim_irq_init called: NOT NEEDED?!?!?\n");
   12.24 ++}
   12.25 ++#else
   12.26 + static unsigned int
   12.27 + hpsim_irq_startup (unsigned int irq)
   12.28 + {
   12.29 +@@ -19,6 +29,10 @@ hpsim_irq_startup (unsigned int irq)
   12.30 + static void
   12.31 + hpsim_irq_noop (unsigned int irq)
   12.32 + {
   12.33 ++#if 1
   12.34 ++printf("hpsim_irq_noop: irq=%d\n",irq);
   12.35 ++while(irq);
   12.36 ++#endif
   12.37 + }
   12.38 + 
   12.39 + static void
   12.40 +@@ -49,3 +63,4 @@ hpsim_irq_init (void)
   12.41 + 			idesc->handler = &irq_type_hp_sim;
   12.42 + 	}
   12.43 + }
   12.44 ++#endif
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h	Mon Apr 11 21:04:58 2005 +0000
    13.3 @@ -0,0 +1,31 @@
    13.4 + hpsim_ssc.h |   19 +++++++++++++++++++
    13.5 + 1 files changed, 19 insertions(+)
    13.6 +
    13.7 +Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h
    13.8 +===================================================================
    13.9 +--- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_ssc.h	2005-03-02 01:38:17.000000000 -0600
   13.10 ++++ linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h	2005-03-19 13:34:01.705520375 -0600
   13.11 +@@ -33,4 +33,23 @@
   13.12 +  */
   13.13 + extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
   13.14 + 
   13.15 ++#ifdef XEN
   13.16 ++/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
   13.17 ++ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
   13.18 ++#define SSC_OPEN			50
   13.19 ++#define SSC_CLOSE			51
   13.20 ++#define SSC_READ			52
   13.21 ++#define SSC_WRITE			53
   13.22 ++#define SSC_GET_COMPLETION		54
   13.23 ++#define SSC_WAIT_COMPLETION		55
   13.24 ++
   13.25 ++#define SSC_WRITE_ACCESS		2
   13.26 ++#define SSC_READ_ACCESS			1
   13.27 ++
   13.28 ++struct ssc_disk_req {
   13.29 ++	unsigned long addr;
   13.30 ++	unsigned long len;
   13.31 ++};
   13.32 ++#endif
   13.33 ++
   13.34 + #endif /* _IA64_PLATFORM_HPSIM_SSC_H */
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/interrupt.h	Mon Apr 11 21:04:58 2005 +0000
    14.3 @@ -0,0 +1,23 @@
    14.4 + interrupt.h |    2 ++
    14.5 + 1 files changed, 2 insertions(+)
    14.6 +
    14.7 +Index: linux-2.6.11/include/linux/interrupt.h
    14.8 +===================================================================
    14.9 +--- linux-2.6.11.orig/include/linux/interrupt.h	2005-03-02 01:38:09.000000000 -0600
   14.10 ++++ linux-2.6.11/include/linux/interrupt.h	2005-03-19 13:41:00.739901125 -0600
   14.11 +@@ -33,6 +33,7 @@ typedef int irqreturn_t;
   14.12 + #define IRQ_HANDLED	(1)
   14.13 + #define IRQ_RETVAL(x)	((x) != 0)
   14.14 + 
   14.15 ++#ifndef XEN
   14.16 + struct irqaction {
   14.17 + 	irqreturn_t (*handler)(int, void *, struct pt_regs *);
   14.18 + 	unsigned long flags;
   14.19 +@@ -49,6 +50,7 @@ extern int request_irq(unsigned int,
   14.20 + 		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
   14.21 + 		       unsigned long, const char *, void *);
   14.22 + extern void free_irq(unsigned int, void *);
   14.23 ++#endif
   14.24 + 
   14.25 + 
   14.26 + #ifdef CONFIG_GENERIC_HARDIRQS
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/io.h	Mon Apr 11 21:04:58 2005 +0000
    15.3 @@ -0,0 +1,19 @@
    15.4 + io.h |    4 ++++
    15.5 + 1 files changed, 4 insertions(+)
    15.6 +
    15.7 +Index: linux-2.6.11/include/asm-ia64/io.h
    15.8 +===================================================================
    15.9 +--- linux-2.6.11.orig/include/asm-ia64/io.h	2005-03-02 01:38:34.000000000 -0600
   15.10 ++++ linux-2.6.11/include/asm-ia64/io.h	2005-03-19 13:42:06.541900818 -0600
   15.11 +@@ -23,7 +23,11 @@
   15.12 + #define __SLOW_DOWN_IO	do { } while (0)
   15.13 + #define SLOW_DOWN_IO	do { } while (0)
   15.14 + 
   15.15 ++#ifdef XEN
   15.16 ++#define __IA64_UNCACHED_OFFSET	0xdffc000000000000UL	/* region 6 */
   15.17 ++#else
   15.18 + #define __IA64_UNCACHED_OFFSET	0xc000000000000000UL	/* region 6 */
   15.19 ++#endif
   15.20 + 
   15.21 + /*
   15.22 +  * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/irq.h	Mon Apr 11 21:04:58 2005 +0000
    16.3 @@ -0,0 +1,23 @@
    16.4 + irq.h |    9 +++++++++
    16.5 + 1 files changed, 9 insertions(+)
    16.6 +
    16.7 +Index: linux-2.6.11/include/asm-ia64/irq.h
    16.8 +===================================================================
    16.9 +--- linux-2.6.11.orig/include/asm-ia64/irq.h	2005-03-02 01:38:33.000000000 -0600
   16.10 ++++ linux-2.6.11/include/asm-ia64/irq.h	2005-03-19 13:42:27.957677364 -0600
   16.11 +@@ -30,6 +30,15 @@ extern void disable_irq_nosync (unsigned
   16.12 + extern void enable_irq (unsigned int);
   16.13 + extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
   16.14 + 
   16.15 ++#ifdef XEN
   16.16 ++// dup'ed from signal.h to avoid changes to includes
   16.17 ++#define	SA_NOPROFILE	0x02000000
   16.18 ++#define	SA_SHIRQ	0x04000000
   16.19 ++#define	SA_RESTART	0x10000000
   16.20 ++#define	SA_INTERRUPT	0x20000000
   16.21 ++#define	SA_SAMPLE_RANDOM	SA_RESTART
   16.22 ++#endif
   16.23 ++
   16.24 + #ifdef CONFIG_SMP
   16.25 + extern void move_irq(int irq);
   16.26 + #else
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c	Mon Apr 11 21:04:58 2005 +0000
    17.3 @@ -0,0 +1,111 @@
    17.4 + irq_ia64.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    17.5 + 1 files changed, 67 insertions(+)
    17.6 +
    17.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c
    17.8 +===================================================================
    17.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/irq_ia64.c	2005-04-08 13:30:16.777174938 -0500
   17.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c	2005-04-08 14:15:47.398616472 -0500
   17.11 +@@ -17,18 +17,26 @@
   17.12 + #include <linux/config.h>
   17.13 + #include <linux/module.h>
   17.14 + 
   17.15 ++#ifndef XEN
   17.16 + #include <linux/jiffies.h>
   17.17 ++#endif
   17.18 + #include <linux/errno.h>
   17.19 + #include <linux/init.h>
   17.20 + #include <linux/interrupt.h>
   17.21 + #include <linux/ioport.h>
   17.22 ++#ifndef XEN
   17.23 + #include <linux/kernel_stat.h>
   17.24 ++#endif
   17.25 + #include <linux/slab.h>
   17.26 ++#ifndef XEN
   17.27 + #include <linux/ptrace.h>
   17.28 + #include <linux/random.h>	/* for rand_initialize_irq() */
   17.29 + #include <linux/signal.h>
   17.30 ++#endif
   17.31 + #include <linux/smp.h>
   17.32 ++#ifndef XEN
   17.33 + #include <linux/smp_lock.h>
   17.34 ++#endif
   17.35 + #include <linux/threads.h>
   17.36 + #include <linux/bitops.h>
   17.37 + 
   17.38 +@@ -104,6 +112,24 @@ void
   17.39 + ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
   17.40 + {
   17.41 + 	unsigned long saved_tpr;
   17.42 ++#if 0
   17.43 ++//FIXME: For debug only, can be removed
   17.44 ++	static char firstirq = 1;
   17.45 ++	static char firsttime[256];
   17.46 ++	static char firstpend[256];
   17.47 ++	if (firstirq) {
   17.48 ++		int i;
   17.49 ++		for (i=0;i<256;i++) firsttime[i] = 1;
   17.50 ++		for (i=0;i<256;i++) firstpend[i] = 1;
   17.51 ++		firstirq = 0;
   17.52 ++	}
   17.53 ++	if (firsttime[vector]) {
   17.54 ++		printf("**** (entry) First received int on vector=%d,itc=%lx\n",
   17.55 ++			(unsigned long) vector, ia64_get_itc());
   17.56 ++		firsttime[vector] = 0;
   17.57 ++	}
   17.58 ++#endif
   17.59 ++
   17.60 + 
   17.61 + #if IRQ_DEBUG
   17.62 + 	{
   17.63 +@@ -148,6 +174,27 @@ ia64_handle_irq (ia64_vector vector, str
   17.64 + 			ia64_setreg(_IA64_REG_CR_TPR, vector);
   17.65 + 			ia64_srlz_d();
   17.66 + 
   17.67 ++#ifdef XEN
   17.68 ++	if (vector != 0xef) {
   17.69 ++		extern void vcpu_pend_interrupt(void *, int);
   17.70 ++#if 0
   17.71 ++		if (firsttime[vector]) {
   17.72 ++			printf("**** (iterate) First received int on vector=%d,itc=%lx\n",
   17.73 ++			(unsigned long) vector, ia64_get_itc());
   17.74 ++			firsttime[vector] = 0;
   17.75 ++		}
   17.76 ++		if (firstpend[vector]) {
   17.77 ++			printf("**** First pended int on vector=%d,itc=%lx\n",
   17.78 ++				(unsigned long) vector,ia64_get_itc());
   17.79 ++			firstpend[vector] = 0;
   17.80 ++		}
   17.81 ++#endif
   17.82 ++		//FIXME: TEMPORARY HACK!!!!
   17.83 ++		vcpu_pend_interrupt(dom0->exec_domain[0],vector);
   17.84 ++		domain_wake(dom0->exec_domain[0]);
   17.85 ++	}
   17.86 ++	else
   17.87 ++#endif
   17.88 + 			__do_IRQ(local_vector_to_irq(vector), regs);
   17.89 + 
   17.90 + 			/*
   17.91 +@@ -276,3 +323,23 @@ ia64_send_ipi (int cpu, int vector, int 
   17.92 + 
   17.93 + 	writeq(ipi_data, ipi_addr);
   17.94 + }
   17.95 ++
   17.96 ++/* From linux/kernel/softirq.c */
   17.97 ++#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
   17.98 ++# define invoke_softirq()	__do_softirq()
   17.99 ++#else
  17.100 ++# define invoke_softirq()	do_softirq()
  17.101 ++#endif
  17.102 ++
  17.103 ++/*
  17.104 ++ * Exit an interrupt context. Process softirqs if needed and possible:
  17.105 ++ */
  17.106 ++void irq_exit(void)
  17.107 ++{
  17.108 ++	account_system_vtime(current);
  17.109 ++	sub_preempt_count(IRQ_EXIT_OFFSET);
  17.110 ++	if (!in_interrupt() && local_softirq_pending())
  17.111 ++		invoke_softirq();
  17.112 ++	preempt_enable_no_resched();
  17.113 ++}
  17.114 ++/* end from linux/kernel/softirq.c */
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/ivt.S	Mon Apr 11 21:04:58 2005 +0000
    18.3 @@ -0,0 +1,533 @@
    18.4 + ivt.S |  254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    18.5 + 1 files changed, 254 insertions(+)
    18.6 +
    18.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S
    18.8 +===================================================================
    18.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/ivt.S	2005-04-07 10:29:00.565766924 -0500
   18.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S	2005-04-07 10:29:50.923594750 -0500
   18.11 +@@ -1,3 +1,21 @@
   18.12 ++
   18.13 ++#ifdef XEN
   18.14 ++//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
   18.15 ++// these are all hacked out for now as the entire IVT
   18.16 ++// will eventually be replaced... just want to use it
   18.17 ++// for startup code to handle TLB misses
   18.18 ++//#define ia64_leave_kernel 0
   18.19 ++//#define ia64_ret_from_syscall 0
   18.20 ++//#define ia64_handle_irq 0
   18.21 ++//#define ia64_fault 0
   18.22 ++#define ia64_illegal_op_fault 0
   18.23 ++#define ia64_prepare_handle_unaligned 0
   18.24 ++#define ia64_bad_break 0
   18.25 ++#define ia64_trace_syscall 0
   18.26 ++#define sys_call_table 0
   18.27 ++#define sys_ni_syscall 0
   18.28 ++#include <asm/vhpt.h>
   18.29 ++#endif
   18.30 + /*
   18.31 +  * arch/ia64/kernel/ivt.S
   18.32 +  *
   18.33 +@@ -77,6 +95,13 @@
   18.34 + 	mov r19=n;;			/* prepare to save predicates */		\
   18.35 + 	br.sptk.many dispatch_to_fault_handler
   18.36 + 
   18.37 ++#ifdef XEN
   18.38 ++#define REFLECT(n)									\
   18.39 ++	mov r31=pr;									\
   18.40 ++	mov r19=n;;			/* prepare to save predicates */		\
   18.41 ++	br.sptk.many dispatch_reflection
   18.42 ++#endif
   18.43 ++
   18.44 + 	.section .text.ivt,"ax"
   18.45 + 
   18.46 + 	.align 32768	// align on 32KB boundary
   18.47 +@@ -214,6 +239,13 @@ END(vhpt_miss)
   18.48 + // 0x0400 Entry 1 (size 64 bundles) ITLB (21)
   18.49 + ENTRY(itlb_miss)
   18.50 + 	DBG_FAULT(1)
   18.51 ++#ifdef XEN
   18.52 ++	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
   18.53 ++#ifdef VHPT_GLOBAL
   18.54 ++	br.cond.sptk page_fault
   18.55 ++	;;
   18.56 ++#endif
   18.57 ++#endif
   18.58 + 	/*
   18.59 + 	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
   18.60 + 	 * page table.  If a nested TLB miss occurs, we switch into physical
   18.61 +@@ -258,6 +290,13 @@ END(itlb_miss)
   18.62 + // 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
   18.63 + ENTRY(dtlb_miss)
   18.64 + 	DBG_FAULT(2)
   18.65 ++#ifdef XEN
   18.66 ++	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
   18.67 ++#ifdef VHPT_GLOBAL
   18.68 ++	br.cond.sptk page_fault
   18.69 ++	;;
   18.70 ++#endif
   18.71 ++#endif
   18.72 + 	/*
   18.73 + 	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
   18.74 + 	 * page table.  If a nested TLB miss occurs, we switch into physical
   18.75 +@@ -302,6 +341,13 @@ END(dtlb_miss)
   18.76 + // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
   18.77 + ENTRY(alt_itlb_miss)
   18.78 + 	DBG_FAULT(3)
   18.79 ++#ifdef XEN
   18.80 ++//#ifdef VHPT_GLOBAL
   18.81 ++//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
   18.82 ++//	br.cond.sptk page_fault
   18.83 ++//	;;
   18.84 ++//#endif
   18.85 ++#endif
   18.86 + 	mov r16=cr.ifa		// get address that caused the TLB miss
   18.87 + 	movl r17=PAGE_KERNEL
   18.88 + 	mov r21=cr.ipsr
   18.89 +@@ -340,6 +386,13 @@ END(alt_itlb_miss)
   18.90 + // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
   18.91 + ENTRY(alt_dtlb_miss)
   18.92 + 	DBG_FAULT(4)
   18.93 ++#ifdef XEN
   18.94 ++//#ifdef VHPT_GLOBAL
   18.95 ++//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
   18.96 ++//	br.cond.sptk page_fault
   18.97 ++//	;;
   18.98 ++//#endif
   18.99 ++#endif
  18.100 + 	mov r16=cr.ifa		// get address that caused the TLB miss
  18.101 + 	movl r17=PAGE_KERNEL
  18.102 + 	mov r20=cr.isr
  18.103 +@@ -369,6 +422,17 @@ ENTRY(alt_dtlb_miss)
  18.104 + 	cmp.ne p8,p0=r0,r23
  18.105 + (p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
  18.106 + (p8)	br.cond.spnt page_fault
  18.107 ++#ifdef XEN
  18.108 ++	;;
  18.109 ++	// FIXME: inadequate test, this is where we test for Xen address
  18.110 ++	// note that 0xf000 (cached) and 0xd000 (uncached) addresses
  18.111 ++	// should be OK.  (Though no I/O is done in Xen, EFI needs uncached
  18.112 ++	// addresses and some domain EFI calls are passed through)
  18.113 ++	tbit.nz p0,p8=r16,60
  18.114 ++(p8)	br.cond.spnt page_fault
  18.115 ++//(p8)	br.cond.spnt 0
  18.116 ++	;;
  18.117 ++#endif
  18.118 + 
  18.119 + 	dep r21=-1,r21,IA64_PSR_ED_BIT,1
  18.120 + 	or r19=r19,r17		// insert PTE control bits into r19
  18.121 +@@ -449,6 +513,9 @@ END(nested_dtlb_miss)
  18.122 + /////////////////////////////////////////////////////////////////////////////////////////
  18.123 + // 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
  18.124 + ENTRY(ikey_miss)
  18.125 ++#ifdef XEN
  18.126 ++	REFLECT(6)
  18.127 ++#endif
  18.128 + 	DBG_FAULT(6)
  18.129 + 	FAULT(6)
  18.130 + END(ikey_miss)
  18.131 +@@ -461,9 +528,16 @@ ENTRY(page_fault)
  18.132 + 	srlz.i
  18.133 + 	;;
  18.134 + 	SAVE_MIN_WITH_COVER
  18.135 ++#ifdef XEN
  18.136 ++	alloc r15=ar.pfs,0,0,4,0
  18.137 ++	mov out0=cr.ifa
  18.138 ++	mov out1=cr.isr
  18.139 ++	mov out3=cr.itir
  18.140 ++#else
  18.141 + 	alloc r15=ar.pfs,0,0,3,0
  18.142 + 	mov out0=cr.ifa
  18.143 + 	mov out1=cr.isr
  18.144 ++#endif
  18.145 + 	adds r3=8,r2				// set up second base pointer
  18.146 + 	;;
  18.147 + 	ssm psr.ic | PSR_DEFAULT_BITS
  18.148 +@@ -484,6 +558,9 @@ END(page_fault)
  18.149 + /////////////////////////////////////////////////////////////////////////////////////////
  18.150 + // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
  18.151 + ENTRY(dkey_miss)
  18.152 ++#ifdef XEN
  18.153 ++	REFLECT(7)
  18.154 ++#endif
  18.155 + 	DBG_FAULT(7)
  18.156 + 	FAULT(7)
  18.157 + END(dkey_miss)
  18.158 +@@ -492,6 +569,9 @@ END(dkey_miss)
  18.159 + /////////////////////////////////////////////////////////////////////////////////////////
  18.160 + // 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
  18.161 + ENTRY(dirty_bit)
  18.162 ++#ifdef XEN
  18.163 ++	REFLECT(8)
  18.164 ++#endif
  18.165 + 	DBG_FAULT(8)
  18.166 + 	/*
  18.167 + 	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
  18.168 +@@ -554,6 +634,9 @@ END(dirty_bit)
  18.169 + /////////////////////////////////////////////////////////////////////////////////////////
  18.170 + // 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
  18.171 + ENTRY(iaccess_bit)
  18.172 ++#ifdef XEN
  18.173 ++	REFLECT(9)
  18.174 ++#endif
  18.175 + 	DBG_FAULT(9)
  18.176 + 	// Like Entry 8, except for instruction access
  18.177 + 	mov r16=cr.ifa				// get the address that caused the fault
  18.178 +@@ -619,6 +702,9 @@ END(iaccess_bit)
  18.179 + /////////////////////////////////////////////////////////////////////////////////////////
  18.180 + // 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
  18.181 + ENTRY(daccess_bit)
  18.182 ++#ifdef XEN
  18.183 ++	REFLECT(10)
  18.184 ++#endif
  18.185 + 	DBG_FAULT(10)
  18.186 + 	// Like Entry 8, except for data access
  18.187 + 	mov r16=cr.ifa				// get the address that caused the fault
  18.188 +@@ -687,6 +773,16 @@ ENTRY(break_fault)
  18.189 + 	 * to prevent leaking bits from kernel to user level.
  18.190 + 	 */
  18.191 + 	DBG_FAULT(11)
  18.192 ++#ifdef XEN
  18.193 ++	mov r16=cr.isr
  18.194 ++	mov r17=cr.iim
  18.195 ++	mov r31=pr
  18.196 ++	;;
  18.197 ++	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
  18.198 ++	// FIXME: may also need to check slot==2?
  18.199 ++(p7)	br.sptk.many dispatch_privop_fault
  18.200 ++	br.sptk.many dispatch_break_fault
  18.201 ++#endif
  18.202 + 	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
  18.203 + 	mov r17=cr.iim
  18.204 + 	mov r18=__IA64_BREAK_SYSCALL
  18.205 +@@ -697,7 +793,9 @@ ENTRY(break_fault)
  18.206 + 	mov r27=ar.rsc
  18.207 + 	mov r26=ar.pfs
  18.208 + 	mov r28=cr.iip
  18.209 ++#ifndef XEN
  18.210 + 	mov r31=pr				// prepare to save predicates
  18.211 ++#endif
  18.212 + 	mov r20=r1
  18.213 + 	;;
  18.214 + 	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
  18.215 +@@ -797,6 +895,36 @@ END(interrupt)
  18.216 + 	DBG_FAULT(13)
  18.217 + 	FAULT(13)
  18.218 + 
  18.219 ++#ifdef XEN
  18.220 ++	// There is no particular reason for this code to be here, other than that
  18.221 ++	// there happens to be space here that would go unused otherwise.  If this
  18.222 ++	// fault ever gets "unreserved", simply moved the following code to a more
  18.223 ++	// suitable spot...
  18.224 ++
  18.225 ++ENTRY(dispatch_break_fault)
  18.226 ++	SAVE_MIN_WITH_COVER
  18.227 ++	;;
  18.228 ++	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
  18.229 ++	mov out0=cr.ifa
  18.230 ++	adds out1=16,sp
  18.231 ++	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  18.232 ++	mov out3=cr.iim		// FIXME: pity to make this slow access twice
  18.233 ++
  18.234 ++	ssm psr.ic | PSR_DEFAULT_BITS
  18.235 ++	;;
  18.236 ++	srlz.i					// guarantee that interruption collection is on
  18.237 ++	;;
  18.238 ++(p15)	ssm psr.i				// restore psr.i
  18.239 ++	adds r3=8,r2				// set up second base pointer
  18.240 ++	;;
  18.241 ++	SAVE_REST
  18.242 ++	movl r14=ia64_leave_kernel
  18.243 ++	;;
  18.244 ++	mov rp=r14
  18.245 ++	br.sptk.many ia64_prepare_handle_break
  18.246 ++END(dispatch_break_fault)
  18.247 ++#endif
  18.248 ++
  18.249 + 	.org ia64_ivt+0x3800
  18.250 + /////////////////////////////////////////////////////////////////////////////////////////
  18.251 + // 0x3800 Entry 14 (size 64 bundles) Reserved
  18.252 +@@ -850,9 +978,11 @@ END(interrupt)
  18.253 + 	 *	- ar.fpsr: set to kernel settings
  18.254 + 	 */
  18.255 + GLOBAL_ENTRY(ia64_syscall_setup)
  18.256 ++#ifndef XEN
  18.257 + #if PT(B6) != 0
  18.258 + # error This code assumes that b6 is the first field in pt_regs.
  18.259 + #endif
  18.260 ++#endif
  18.261 + 	st8 [r1]=r19				// save b6
  18.262 + 	add r16=PT(CR_IPSR),r1			// initialize first base pointer
  18.263 + 	add r17=PT(R11),r1			// initialize second base pointer
  18.264 +@@ -992,6 +1122,37 @@ END(dispatch_illegal_op_fault)
  18.265 + 	DBG_FAULT(16)
  18.266 + 	FAULT(16)
  18.267 + 
  18.268 ++#ifdef XEN
  18.269 ++	// There is no particular reason for this code to be here, other than that
  18.270 ++	// there happens to be space here that would go unused otherwise.  If this
  18.271 ++	// fault ever gets "unreserved", simply moved the following code to a more
  18.272 ++	// suitable spot...
  18.273 ++
  18.274 ++ENTRY(dispatch_privop_fault)
  18.275 ++	SAVE_MIN_WITH_COVER
  18.276 ++	;;
  18.277 ++	alloc r14=ar.pfs,0,0,4,0		// now it's safe (must be first in insn group!)
  18.278 ++	mov out0=cr.ifa
  18.279 ++	adds out1=16,sp
  18.280 ++	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  18.281 ++	mov out3=cr.itir
  18.282 ++
  18.283 ++	ssm psr.ic | PSR_DEFAULT_BITS
  18.284 ++	;;
  18.285 ++	srlz.i					// guarantee that interruption collection is on
  18.286 ++	;;
  18.287 ++(p15)	ssm psr.i				// restore psr.i
  18.288 ++	adds r3=8,r2				// set up second base pointer
  18.289 ++	;;
  18.290 ++	SAVE_REST
  18.291 ++	movl r14=ia64_leave_kernel
  18.292 ++	;;
  18.293 ++	mov rp=r14
  18.294 ++	br.sptk.many ia64_prepare_handle_privop
  18.295 ++END(dispatch_privop_fault)
  18.296 ++#endif
  18.297 ++
  18.298 ++
  18.299 + 	.org ia64_ivt+0x4400
  18.300 + /////////////////////////////////////////////////////////////////////////////////////////
  18.301 + // 0x4400 Entry 17 (size 64 bundles) Reserved
  18.302 +@@ -1108,6 +1269,9 @@ END(dispatch_to_fault_handler)
  18.303 + /////////////////////////////////////////////////////////////////////////////////////////
  18.304 + // 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
  18.305 + ENTRY(page_not_present)
  18.306 ++#ifdef XEN
  18.307 ++	REFLECT(20)
  18.308 ++#endif
  18.309 + 	DBG_FAULT(20)
  18.310 + 	mov r16=cr.ifa
  18.311 + 	rsm psr.dt
  18.312 +@@ -1128,6 +1292,9 @@ END(page_not_present)
  18.313 + /////////////////////////////////////////////////////////////////////////////////////////
  18.314 + // 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
  18.315 + ENTRY(key_permission)
  18.316 ++#ifdef XEN
  18.317 ++	REFLECT(21)
  18.318 ++#endif
  18.319 + 	DBG_FAULT(21)
  18.320 + 	mov r16=cr.ifa
  18.321 + 	rsm psr.dt
  18.322 +@@ -1141,6 +1308,9 @@ END(key_permission)
  18.323 + /////////////////////////////////////////////////////////////////////////////////////////
  18.324 + // 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
  18.325 + ENTRY(iaccess_rights)
  18.326 ++#ifdef XEN
  18.327 ++	REFLECT(22)
  18.328 ++#endif
  18.329 + 	DBG_FAULT(22)
  18.330 + 	mov r16=cr.ifa
  18.331 + 	rsm psr.dt
  18.332 +@@ -1154,6 +1324,9 @@ END(iaccess_rights)
  18.333 + /////////////////////////////////////////////////////////////////////////////////////////
  18.334 + // 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
  18.335 + ENTRY(daccess_rights)
  18.336 ++#ifdef XEN
  18.337 ++	REFLECT(23)
  18.338 ++#endif
  18.339 + 	DBG_FAULT(23)
  18.340 + 	mov r16=cr.ifa
  18.341 + 	rsm psr.dt
  18.342 +@@ -1171,8 +1344,13 @@ ENTRY(general_exception)
  18.343 + 	mov r16=cr.isr
  18.344 + 	mov r31=pr
  18.345 + 	;;
  18.346 ++#ifdef XEN
  18.347 ++	cmp4.ge p6,p0=0x20,r16
  18.348 ++(p6)	br.sptk.many dispatch_privop_fault
  18.349 ++#else
  18.350 + 	cmp4.eq p6,p0=0,r16
  18.351 + (p6)	br.sptk.many dispatch_illegal_op_fault
  18.352 ++#endif
  18.353 + 	;;
  18.354 + 	mov r19=24		// fault number
  18.355 + 	br.sptk.many dispatch_to_fault_handler
  18.356 +@@ -1182,6 +1360,9 @@ END(general_exception)
  18.357 + /////////////////////////////////////////////////////////////////////////////////////////
  18.358 + // 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
  18.359 + ENTRY(disabled_fp_reg)
  18.360 ++#ifdef XEN
  18.361 ++	REFLECT(25)
  18.362 ++#endif
  18.363 + 	DBG_FAULT(25)
  18.364 + 	rsm psr.dfh		// ensure we can access fph
  18.365 + 	;;
  18.366 +@@ -1195,6 +1376,9 @@ END(disabled_fp_reg)
  18.367 + /////////////////////////////////////////////////////////////////////////////////////////
  18.368 + // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
  18.369 + ENTRY(nat_consumption)
  18.370 ++#ifdef XEN
  18.371 ++	REFLECT(26)
  18.372 ++#endif
  18.373 + 	DBG_FAULT(26)
  18.374 + 	FAULT(26)
  18.375 + END(nat_consumption)
  18.376 +@@ -1203,6 +1387,10 @@ END(nat_consumption)
  18.377 + /////////////////////////////////////////////////////////////////////////////////////////
  18.378 + // 0x5700 Entry 27 (size 16 bundles) Speculation (40)
  18.379 + ENTRY(speculation_vector)
  18.380 ++#ifdef XEN
  18.381 ++	// this probably need not reflect...
  18.382 ++	REFLECT(27)
  18.383 ++#endif
  18.384 + 	DBG_FAULT(27)
  18.385 + 	/*
  18.386 + 	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
  18.387 +@@ -1246,6 +1434,9 @@ END(speculation_vector)
  18.388 + /////////////////////////////////////////////////////////////////////////////////////////
  18.389 + // 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
  18.390 + ENTRY(debug_vector)
  18.391 ++#ifdef XEN
  18.392 ++	REFLECT(29)
  18.393 ++#endif
  18.394 + 	DBG_FAULT(29)
  18.395 + 	FAULT(29)
  18.396 + END(debug_vector)
  18.397 +@@ -1254,6 +1445,9 @@ END(debug_vector)
  18.398 + /////////////////////////////////////////////////////////////////////////////////////////
  18.399 + // 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
  18.400 + ENTRY(unaligned_access)
  18.401 ++#ifdef XEN
  18.402 ++	REFLECT(30)
  18.403 ++#endif
  18.404 + 	DBG_FAULT(30)
  18.405 + 	mov r16=cr.ipsr
  18.406 + 	mov r31=pr		// prepare to save predicates
  18.407 +@@ -1265,6 +1459,9 @@ END(unaligned_access)
  18.408 + /////////////////////////////////////////////////////////////////////////////////////////
  18.409 + // 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
  18.410 + ENTRY(unsupported_data_reference)
  18.411 ++#ifdef XEN
  18.412 ++	REFLECT(31)
  18.413 ++#endif
  18.414 + 	DBG_FAULT(31)
  18.415 + 	FAULT(31)
  18.416 + END(unsupported_data_reference)
  18.417 +@@ -1273,6 +1470,9 @@ END(unsupported_data_reference)
  18.418 + /////////////////////////////////////////////////////////////////////////////////////////
  18.419 + // 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
  18.420 + ENTRY(floating_point_fault)
  18.421 ++#ifdef XEN
  18.422 ++	REFLECT(32)
  18.423 ++#endif
  18.424 + 	DBG_FAULT(32)
  18.425 + 	FAULT(32)
  18.426 + END(floating_point_fault)
  18.427 +@@ -1281,6 +1481,9 @@ END(floating_point_fault)
  18.428 + /////////////////////////////////////////////////////////////////////////////////////////
  18.429 + // 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
  18.430 + ENTRY(floating_point_trap)
  18.431 ++#ifdef XEN
  18.432 ++	REFLECT(33)
  18.433 ++#endif
  18.434 + 	DBG_FAULT(33)
  18.435 + 	FAULT(33)
  18.436 + END(floating_point_trap)
  18.437 +@@ -1289,6 +1492,9 @@ END(floating_point_trap)
  18.438 + /////////////////////////////////////////////////////////////////////////////////////////
  18.439 + // 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
  18.440 + ENTRY(lower_privilege_trap)
  18.441 ++#ifdef XEN
  18.442 ++	REFLECT(34)
  18.443 ++#endif
  18.444 + 	DBG_FAULT(34)
  18.445 + 	FAULT(34)
  18.446 + END(lower_privilege_trap)
  18.447 +@@ -1297,6 +1503,9 @@ END(lower_privilege_trap)
  18.448 + /////////////////////////////////////////////////////////////////////////////////////////
  18.449 + // 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
  18.450 + ENTRY(taken_branch_trap)
  18.451 ++#ifdef XEN
  18.452 ++	REFLECT(35)
  18.453 ++#endif
  18.454 + 	DBG_FAULT(35)
  18.455 + 	FAULT(35)
  18.456 + END(taken_branch_trap)
  18.457 +@@ -1305,6 +1514,9 @@ END(taken_branch_trap)
  18.458 + /////////////////////////////////////////////////////////////////////////////////////////
  18.459 + // 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
  18.460 + ENTRY(single_step_trap)
  18.461 ++#ifdef XEN
  18.462 ++	REFLECT(36)
  18.463 ++#endif
  18.464 + 	DBG_FAULT(36)
  18.465 + 	FAULT(36)
  18.466 + END(single_step_trap)
  18.467 +@@ -1361,6 +1573,9 @@ END(single_step_trap)
  18.468 + /////////////////////////////////////////////////////////////////////////////////////////
  18.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)
  18.470 + ENTRY(ia32_exception)
  18.471 ++#ifdef XEN
  18.472 ++	REFLECT(45)
  18.473 ++#endif
  18.474 + 	DBG_FAULT(45)
  18.475 + 	FAULT(45)
  18.476 + END(ia32_exception)
  18.477 +@@ -1369,6 +1584,9 @@ END(ia32_exception)
  18.478 + /////////////////////////////////////////////////////////////////////////////////////////
  18.479 + // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
  18.480 + ENTRY(ia32_intercept)
  18.481 ++#ifdef XEN
  18.482 ++	REFLECT(46)
  18.483 ++#endif
  18.484 + 	DBG_FAULT(46)
  18.485 + #ifdef	CONFIG_IA32_SUPPORT
  18.486 + 	mov r31=pr
  18.487 +@@ -1399,6 +1617,9 @@ END(ia32_intercept)
  18.488 + /////////////////////////////////////////////////////////////////////////////////////////
  18.489 + // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
  18.490 + ENTRY(ia32_interrupt)
  18.491 ++#ifdef XEN
  18.492 ++	REFLECT(47)
  18.493 ++#endif
  18.494 + 	DBG_FAULT(47)
  18.495 + #ifdef CONFIG_IA32_SUPPORT
  18.496 + 	mov r31=pr
  18.497 +@@ -1528,6 +1749,39 @@ END(ia32_interrupt)
  18.498 + 	DBG_FAULT(67)
  18.499 + 	FAULT(67)
  18.500 + 
  18.501 ++#ifdef XEN
  18.502 ++	.org ia64_ivt+0x8000
  18.503 ++ENTRY(dispatch_reflection)
  18.504 ++	/*
  18.505 ++	 * Input:
  18.506 ++	 *	psr.ic:	off
  18.507 ++	 *	r19:	intr type (offset into ivt, see ia64_int.h)
  18.508 ++	 *	r31:	contains saved predicates (pr)
  18.509 ++	 */
  18.510 ++	SAVE_MIN_WITH_COVER_R19
  18.511 ++	alloc r14=ar.pfs,0,0,5,0
  18.512 ++	mov out4=r15
  18.513 ++	mov out0=cr.ifa
  18.514 ++	adds out1=16,sp
  18.515 ++	mov out2=cr.isr
  18.516 ++	mov out3=cr.iim
  18.517 ++//	mov out3=cr.itir
  18.518 ++
  18.519 ++	ssm psr.ic | PSR_DEFAULT_BITS
  18.520 ++	;;
  18.521 ++	srlz.i					// guarantee that interruption collection is on
  18.522 ++	;;
  18.523 ++(p15)	ssm psr.i				// restore psr.i
  18.524 ++	adds r3=8,r2				// set up second base pointer
  18.525 ++	;;
  18.526 ++	SAVE_REST
  18.527 ++	movl r14=ia64_leave_kernel
  18.528 ++	;;
  18.529 ++	mov rp=r14
  18.530 ++	br.sptk.many ia64_prepare_handle_reflection
  18.531 ++END(dispatch_reflection)
  18.532 ++#endif
  18.533 ++
  18.534 + #ifdef CONFIG_IA32_SUPPORT
  18.535 + 
  18.536 + 	/*
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c	Mon Apr 11 21:04:58 2005 +0000
    19.3 @@ -0,0 +1,44 @@
    19.4 + time.c |    7 ++++++-
    19.5 + 1 files changed, 6 insertions(+), 1 deletion(-)
    19.6 +
    19.7 +Index: linux-2.6.11/kernel/time.c
    19.8 +===================================================================
    19.9 +--- linux-2.6.11.orig/kernel/time.c	2005-03-02 01:37:50.000000000 -0600
   19.10 ++++ linux-2.6.11/kernel/time.c	2005-03-19 14:56:40.767870674 -0600
   19.11 +@@ -495,6 +495,7 @@ void getnstimeofday (struct timespec *tv
   19.12 + 	tv->tv_nsec = nsec;
   19.13 + }
   19.14 + 
   19.15 ++#ifndef XEN
   19.16 + int do_settimeofday (struct timespec *tv)
   19.17 + {
   19.18 + 	time_t wtm_sec, sec = tv->tv_sec;
   19.19 +@@ -503,7 +504,9 @@ int do_settimeofday (struct timespec *tv
   19.20 + 	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
   19.21 + 		return -EINVAL;
   19.22 + 
   19.23 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   19.24 + 	write_seqlock_irq(&xtime_lock);
   19.25 ++#endif
   19.26 + 	{
   19.27 + 		/*
   19.28 + 		 * This is revolting. We need to set "xtime" correctly. However, the value
   19.29 +@@ -525,7 +528,9 @@ int do_settimeofday (struct timespec *tv
   19.30 + 		time_esterror = NTP_PHASE_LIMIT;
   19.31 + 		time_interpolator_reset();
   19.32 + 	}
   19.33 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   19.34 + 	write_sequnlock_irq(&xtime_lock);
   19.35 ++#endif
   19.36 + 	clock_was_set();
   19.37 + 	return 0;
   19.38 + }
   19.39 +@@ -552,7 +557,7 @@ void do_gettimeofday (struct timeval *tv
   19.40 + }
   19.41 + 
   19.42 + EXPORT_SYMBOL(do_gettimeofday);
   19.43 +-
   19.44 ++#endif
   19.45 + 
   19.46 + #else
   19.47 + /*
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/kregs.h	Mon Apr 11 21:04:58 2005 +0000
    20.3 @@ -0,0 +1,18 @@
    20.4 + kregs.h |    4 ++++
    20.5 + 1 files changed, 4 insertions(+)
    20.6 +
    20.7 +Index: linux-2.6.11/include/asm-ia64/kregs.h
    20.8 +===================================================================
    20.9 +--- linux-2.6.11.orig/include/asm-ia64/kregs.h	2005-03-02 01:37:49.000000000 -0600
   20.10 ++++ linux-2.6.11/include/asm-ia64/kregs.h	2005-03-19 13:44:24.362628092 -0600
   20.11 +@@ -31,6 +31,10 @@
   20.12 + #define IA64_TR_PALCODE		1	/* itr1: maps PALcode as required by EFI */
   20.13 + #define IA64_TR_PERCPU_DATA	1	/* dtr1: percpu data */
   20.14 + #define IA64_TR_CURRENT_STACK	2	/* dtr2: maps kernel's memory- & register-stacks */
   20.15 ++#ifdef XEN
   20.16 ++#define IA64_TR_SHARED_INFO	3	/* dtr3: page shared with domain */
   20.17 ++#define	IA64_TR_VHPT		4	/* dtr4: vhpt */
   20.18 ++#endif
   20.19 + 
   20.20 + /* Processor status register bits: */
   20.21 + #define IA64_PSR_BE_BIT		1
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/lds.S	Mon Apr 11 21:04:58 2005 +0000
    21.3 @@ -0,0 +1,22 @@
    21.4 + vmlinux.lds.S |    2 ++
    21.5 + 1 files changed, 2 insertions(+)
    21.6 +
    21.7 +Index: linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S
    21.8 +===================================================================
    21.9 +--- linux-2.6.11.orig/arch/ia64/kernel/vmlinux.lds.S	2005-03-02 01:38:25.000000000 -0600
   21.10 ++++ linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S	2005-03-19 13:44:28.746368232 -0600
   21.11 +@@ -11,12 +11,14 @@
   21.12 + OUTPUT_FORMAT("elf64-ia64-little")
   21.13 + OUTPUT_ARCH(ia64)
   21.14 + ENTRY(phys_start)
   21.15 ++#ifndef XEN
   21.16 + jiffies = jiffies_64;
   21.17 + PHDRS {
   21.18 +   code   PT_LOAD;
   21.19 +   percpu PT_LOAD;
   21.20 +   data   PT_LOAD;
   21.21 + }
   21.22 ++#endif
   21.23 + SECTIONS
   21.24 + {
   21.25 +   /* Sections to be discarded */
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c	Mon Apr 11 21:04:58 2005 +0000
    22.3 @@ -0,0 +1,16 @@
    22.4 + extable.c |    2 ++
    22.5 + 1 files changed, 2 insertions(+)
    22.6 +
    22.7 +Index: linux-2.6.11-xendiffs/kernel/extable.c
    22.8 +===================================================================
    22.9 +--- linux-2.6.11-xendiffs.orig/kernel/extable.c	2005-03-02 01:37:54.000000000 -0600
   22.10 ++++ linux-2.6.11-xendiffs/kernel/extable.c	2005-04-08 14:30:46.283360881 -0500
   22.11 +@@ -20,6 +20,8 @@
   22.12 + #include <asm/uaccess.h>
   22.13 + #include <asm/sections.h>
   22.14 + 
   22.15 ++#define __module_text_address(addr)	(NULL)
   22.16 ++
   22.17 + extern struct exception_table_entry __start___ex_table[];
   22.18 + extern struct exception_table_entry __stop___ex_table[];
   22.19 + 
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h	Mon Apr 11 21:04:58 2005 +0000
    23.3 @@ -0,0 +1,29 @@
    23.4 + hardirq.h |    6 ++++++
    23.5 + 1 files changed, 6 insertions(+)
    23.6 +
    23.7 +Index: linux-2.6.11-xendiffs/include/linux/hardirq.h
    23.8 +===================================================================
    23.9 +--- linux-2.6.11-xendiffs.orig/include/linux/hardirq.h	2005-03-02 01:38:00.000000000 -0600
   23.10 ++++ linux-2.6.11-xendiffs/include/linux/hardirq.h	2005-03-25 08:49:57.301998663 -0600
   23.11 +@@ -2,7 +2,9 @@
   23.12 + #define LINUX_HARDIRQ_H
   23.13 + 
   23.14 + #include <linux/config.h>
   23.15 ++#ifndef XEN
   23.16 + #include <linux/smp_lock.h>
   23.17 ++#endif
   23.18 + #include <asm/hardirq.h>
   23.19 + #include <asm/system.h>
   23.20 + 
   23.21 +@@ -60,7 +62,11 @@
   23.22 +  */
   23.23 + #define in_irq()		(hardirq_count())
   23.24 + #define in_softirq()		(softirq_count())
   23.25 ++#ifndef XEN
   23.26 + #define in_interrupt()		(irq_count())
   23.27 ++#else
   23.28 ++#define in_interrupt()		0		// FIXME LATER
   23.29 ++#endif
   23.30 + 
   23.31 + #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
   23.32 + # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h	Mon Apr 11 21:04:58 2005 +0000
    24.3 @@ -0,0 +1,36 @@
    24.4 + time.h |    9 +++++++++
    24.5 + 1 files changed, 9 insertions(+)
    24.6 +
    24.7 +Index: linux-2.6.11/include/linux/time.h
    24.8 +===================================================================
    24.9 +--- linux-2.6.11.orig/include/linux/time.h	2005-03-02 01:38:12.000000000 -0600
   24.10 ++++ linux-2.6.11/include/linux/time.h	2005-03-19 13:46:27.987225234 -0600
   24.11 +@@ -1,11 +1,18 @@
   24.12 + #ifndef _LINUX_TIME_H
   24.13 + #define _LINUX_TIME_H
   24.14 + 
   24.15 ++#ifdef XEN
   24.16 ++typedef	s64 time_t;
   24.17 ++typedef	s64 suseconds_t;
   24.18 ++#endif
   24.19 ++
   24.20 + #include <linux/types.h>
   24.21 + 
   24.22 ++#ifndef XEN
   24.23 + #ifdef __KERNEL__
   24.24 + #include <linux/seqlock.h>
   24.25 + #endif
   24.26 ++#endif
   24.27 + 
   24.28 + #ifndef _STRUCT_TIMESPEC
   24.29 + #define _STRUCT_TIMESPEC
   24.30 +@@ -80,7 +87,9 @@ mktime (unsigned int year, unsigned int 
   24.31 + 
   24.32 + extern struct timespec xtime;
   24.33 + extern struct timespec wall_to_monotonic;
   24.34 ++#ifndef XEN
   24.35 + extern seqlock_t xtime_lock;
   24.36 ++#endif
   24.37 + 
   24.38 + static inline unsigned long get_seconds(void)
   24.39 + { 
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mca_asm.h	Mon Apr 11 21:04:58 2005 +0000
    25.3 @@ -0,0 +1,37 @@
    25.4 + mca_asm.h |   11 +++++++++++
    25.5 + 1 files changed, 11 insertions(+)
    25.6 +
    25.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/mca_asm.h
    25.8 +===================================================================
    25.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/mca_asm.h	2005-03-02 01:38:38.000000000 -0600
   25.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/mca_asm.h	2005-04-06 22:41:57.392411032 -0500
   25.11 +@@ -26,8 +26,13 @@
   25.12 +  * direct mapped to physical addresses.
   25.13 +  *	1. Lop off bits 61 thru 63 in the virtual address
   25.14 +  */
   25.15 ++#ifdef XEN
   25.16 ++#define INST_VA_TO_PA(addr)							\
   25.17 ++	dep	addr	= 0, addr, 60, 4
   25.18 ++#else // XEN
   25.19 + #define INST_VA_TO_PA(addr)							\
   25.20 + 	dep	addr	= 0, addr, 61, 3
   25.21 ++#endif // XEN
   25.22 + /*
   25.23 +  * This macro converts a data virtual address to a physical address
   25.24 +  * Right now for simulation purposes the virtual addresses are
   25.25 +@@ -42,9 +47,15 @@
   25.26 +  * direct mapped to physical addresses.
   25.27 +  *	1. Put 0x7 in bits 61 thru 63.
   25.28 +  */
   25.29 ++#ifdef XEN
   25.30 ++#define DATA_PA_TO_VA(addr,temp)							\
   25.31 ++	mov	temp	= 0xf	;;							\
   25.32 ++	dep	addr	= temp, addr, 60, 4
   25.33 ++#else // XEN
   25.34 + #define DATA_PA_TO_VA(addr,temp)							\
   25.35 + 	mov	temp	= 0x7	;;							\
   25.36 + 	dep	addr	= temp, addr, 61, 3
   25.37 ++#endif // XEN
   25.38 + 
   25.39 + #define GET_THIS_PADDR(reg, var)		\
   25.40 + 	mov	reg = IA64_KR(PER_CPU_DATA);;	\
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/minstate.h	Mon Apr 11 21:04:58 2005 +0000
    26.3 @@ -0,0 +1,25 @@
    26.4 + minstate.h |    4 ++--
    26.5 + 1 files changed, 2 insertions(+), 2 deletions(-)
    26.6 +
    26.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h
    26.8 +===================================================================
    26.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/minstate.h	2005-04-06 22:51:31.170261541 -0500
   26.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h	2005-04-06 22:54:03.210575034 -0500
   26.11 +@@ -48,7 +48,7 @@
   26.12 + (pUStk)	mov r24=ar.rnat;									\
   26.13 + (pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
   26.14 + (pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
   26.15 +-(pUStk)	dep r22=-1,r22,61,3;			/* compute kernel virtual addr of RBS */	\
   26.16 ++(pUStk)	dep r22=-1,r22,60,4;			/* compute kernel virtual addr of RBS */	\
   26.17 + 	;;											\
   26.18 + (pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;		/* if in kernel mode, use sp (r12) */		\
   26.19 + (pUStk)	mov ar.bspstore=r22;			/* switch to kernel RBS */			\
   26.20 +@@ -57,7 +57,7 @@
   26.21 + (pUStk)	mov ar.rsc=0x3;		/* set eager mode, pl 0, little-endian, loadrs=0 */		\
   26.22 + 
   26.23 + #define MINSTATE_END_SAVE_MIN_PHYS								\
   26.24 +-	dep r12=-1,r12,61,3;		/* make sp a kernel virtual address */			\
   26.25 ++	dep r12=-1,r12,60,4;		/* make sp a kernel virtual address */			\
   26.26 + 	;;
   26.27 + 
   26.28 + #ifdef MINSTATE_VIRT
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c	Mon Apr 11 21:04:58 2005 +0000
    27.3 @@ -0,0 +1,220 @@
    27.4 + contig.c |  172 +++++++++++++++++----------------------------------------------
    27.5 + 1 files changed, 48 insertions(+), 124 deletions(-)
    27.6 +
    27.7 +Index: linux-2.6.11-xendiffs/arch/ia64/mm/contig.c
    27.8 +===================================================================
    27.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/mm/contig.c	2005-04-07 11:02:50.227598140 -0500
   27.10 ++++ linux-2.6.11-xendiffs/arch/ia64/mm/contig.c	2005-04-07 11:05:21.724931959 -0500
   27.11 +@@ -15,11 +15,21 @@
   27.12 +  * memory.
   27.13 +  */
   27.14 + #include <linux/config.h>
   27.15 ++#ifdef XEN
   27.16 ++#include <xen/sched.h>
   27.17 ++#endif
   27.18 + #include <linux/bootmem.h>
   27.19 + #include <linux/efi.h>
   27.20 + #include <linux/mm.h>
   27.21 + #include <linux/swap.h>
   27.22 + 
   27.23 ++#ifdef XEN
   27.24 ++#undef reserve_bootmem
   27.25 ++extern struct page *zero_page_memmap_ptr;
   27.26 ++struct page *mem_map;
   27.27 ++#define MAX_DMA_ADDRESS ~0UL	// FIXME???
   27.28 ++#endif
   27.29 ++
   27.30 + #include <asm/meminit.h>
   27.31 + #include <asm/pgalloc.h>
   27.32 + #include <asm/pgtable.h>
   27.33 +@@ -38,30 +48,7 @@ static unsigned long num_dma_physpages;
   27.34 + void
   27.35 + show_mem (void)
   27.36 + {
   27.37 +-	int i, total = 0, reserved = 0;
   27.38 +-	int shared = 0, cached = 0;
   27.39 +-
   27.40 +-	printk("Mem-info:\n");
   27.41 +-	show_free_areas();
   27.42 +-
   27.43 +-	printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
   27.44 +-	i = max_mapnr;
   27.45 +-	while (i-- > 0) {
   27.46 +-		if (!pfn_valid(i))
   27.47 +-			continue;
   27.48 +-		total++;
   27.49 +-		if (PageReserved(mem_map+i))
   27.50 +-			reserved++;
   27.51 +-		else if (PageSwapCache(mem_map+i))
   27.52 +-			cached++;
   27.53 +-		else if (page_count(mem_map + i))
   27.54 +-			shared += page_count(mem_map + i) - 1;
   27.55 +-	}
   27.56 +-	printk("%d pages of RAM\n", total);
   27.57 +-	printk("%d reserved pages\n", reserved);
   27.58 +-	printk("%d pages shared\n", shared);
   27.59 +-	printk("%d pages swap cached\n", cached);
   27.60 +-	printk("%ld pages in page table cache\n", pgtable_cache_size);
   27.61 ++	printk("Dummy show_mem\n");
   27.62 + }
   27.63 + 
   27.64 + /* physical address where the bootmem map is located */
   27.65 +@@ -81,6 +68,9 @@ find_max_pfn (unsigned long start, unsig
   27.66 + {
   27.67 + 	unsigned long *max_pfnp = arg, pfn;
   27.68 + 
   27.69 ++#ifdef XEN
   27.70 ++//printf("find_max_pfn: start=%lx, end=%lx, *arg=%lx\n",start,end,*(unsigned long *)arg);
   27.71 ++#endif
   27.72 + 	pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT;
   27.73 + 	if (pfn > *max_pfnp)
   27.74 + 		*max_pfnp = pfn;
   27.75 +@@ -134,41 +124,6 @@ find_bootmap_location (unsigned long sta
   27.76 + 	return 0;
   27.77 + }
   27.78 + 
   27.79 +-/**
   27.80 +- * find_memory - setup memory map
   27.81 +- *
   27.82 +- * Walk the EFI memory map and find usable memory for the system, taking
   27.83 +- * into account reserved areas.
   27.84 +- */
   27.85 +-void
   27.86 +-find_memory (void)
   27.87 +-{
   27.88 +-	unsigned long bootmap_size;
   27.89 +-
   27.90 +-	reserve_memory();
   27.91 +-
   27.92 +-	/* first find highest page frame number */
   27.93 +-	max_pfn = 0;
   27.94 +-	efi_memmap_walk(find_max_pfn, &max_pfn);
   27.95 +-
   27.96 +-	/* how many bytes to cover all the pages */
   27.97 +-	bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT;
   27.98 +-
   27.99 +-	/* look for a location to hold the bootmap */
  27.100 +-	bootmap_start = ~0UL;
  27.101 +-	efi_memmap_walk(find_bootmap_location, &bootmap_size);
  27.102 +-	if (bootmap_start == ~0UL)
  27.103 +-		panic("Cannot find %ld bytes for bootmap\n", bootmap_size);
  27.104 +-
  27.105 +-	bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn);
  27.106 +-
  27.107 +-	/* Free all available memory, then mark bootmem-map as being in use. */
  27.108 +-	efi_memmap_walk(filter_rsvd_memory, free_bootmem);
  27.109 +-	reserve_bootmem(bootmap_start, bootmap_size);
  27.110 +-
  27.111 +-	find_initrd();
  27.112 +-}
  27.113 +-
  27.114 + #ifdef CONFIG_SMP
  27.115 + /**
  27.116 +  * per_cpu_init - setup per-cpu variables
  27.117 +@@ -228,72 +183,41 @@ count_dma_pages (u64 start, u64 end, voi
  27.118 + void
  27.119 + paging_init (void)
  27.120 + {
  27.121 +-	unsigned long max_dma;
  27.122 +-	unsigned long zones_size[MAX_NR_ZONES];
  27.123 +-#ifdef CONFIG_VIRTUAL_MEM_MAP
  27.124 +-	unsigned long zholes_size[MAX_NR_ZONES];
  27.125 +-	unsigned long max_gap;
  27.126 +-#endif
  27.127 +-
  27.128 +-	/* initialize mem_map[] */
  27.129 +-
  27.130 +-	memset(zones_size, 0, sizeof(zones_size));
  27.131 +-
  27.132 +-	num_physpages = 0;
  27.133 +-	efi_memmap_walk(count_pages, &num_physpages);
  27.134 +-
  27.135 +-	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  27.136 +-
  27.137 +-#ifdef CONFIG_VIRTUAL_MEM_MAP
  27.138 +-	memset(zholes_size, 0, sizeof(zholes_size));
  27.139 ++	struct pfn_info *pg;
  27.140 ++	/* Allocate and map the machine-to-phys table */
  27.141 ++	if ((pg = alloc_domheap_pages(NULL, 10)) == NULL)
  27.142 ++		panic("Not enough memory to bootstrap Xen.\n");
  27.143 ++	memset(page_to_virt(pg), 0x55, 16UL << 20);
  27.144 + 
  27.145 +-	num_dma_physpages = 0;
  27.146 +-	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
  27.147 ++	/* Other mapping setup */
  27.148 + 
  27.149 +-	if (max_low_pfn < max_dma) {
  27.150 +-		zones_size[ZONE_DMA] = max_low_pfn;
  27.151 +-		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
  27.152 +-	} else {
  27.153 +-		zones_size[ZONE_DMA] = max_dma;
  27.154 +-		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
  27.155 +-		if (num_physpages > num_dma_physpages) {
  27.156 +-			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  27.157 +-			zholes_size[ZONE_NORMAL] =
  27.158 +-				((max_low_pfn - max_dma) -
  27.159 +-				 (num_physpages - num_dma_physpages));
  27.160 +-		}
  27.161 +-	}
  27.162 +-
  27.163 +-	max_gap = 0;
  27.164 +-	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
  27.165 +-	if (max_gap < LARGE_GAP) {
  27.166 +-		vmem_map = (struct page *) 0;
  27.167 +-		free_area_init_node(0, &contig_page_data, zones_size, 0,
  27.168 +-				    zholes_size);
  27.169 +-	} else {
  27.170 +-		unsigned long map_size;
  27.171 +-
  27.172 +-		/* allocate virtual_mem_map */
  27.173 +-
  27.174 +-		map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
  27.175 +-		vmalloc_end -= map_size;
  27.176 +-		vmem_map = (struct page *) vmalloc_end;
  27.177 +-		efi_memmap_walk(create_mem_map_page_table, NULL);
  27.178 +-
  27.179 +-		mem_map = contig_page_data.node_mem_map = vmem_map;
  27.180 +-		free_area_init_node(0, &contig_page_data, zones_size,
  27.181 +-				    0, zholes_size);
  27.182 +-
  27.183 +-		printk("Virtual mem_map starts at 0x%p\n", mem_map);
  27.184 +-	}
  27.185 +-#else /* !CONFIG_VIRTUAL_MEM_MAP */
  27.186 +-	if (max_low_pfn < max_dma)
  27.187 +-		zones_size[ZONE_DMA] = max_low_pfn;
  27.188 +-	else {
  27.189 +-		zones_size[ZONE_DMA] = max_dma;
  27.190 +-		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  27.191 +-	}
  27.192 +-	free_area_init(zones_size);
  27.193 +-#endif /* !CONFIG_VIRTUAL_MEM_MAP */
  27.194 + 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
  27.195 + }
  27.196 ++
  27.197 ++struct pfn_info *frame_table;
  27.198 ++unsigned long frame_table_size;
  27.199 ++unsigned long max_page;
  27.200 ++
  27.201 ++/* FIXME: postpone support to machines with big holes between physical memorys.
  27.202 ++ * Current hack allows only efi memdesc upto 4G place. (See efi.c)
  27.203 ++ */
  27.204 ++#ifndef CONFIG_VIRTUAL_MEM_MAP
  27.205 ++#define FT_ALIGN_SIZE	(16UL << 20)
  27.206 ++void __init init_frametable(void)
  27.207 ++{
  27.208 ++	unsigned long i, p;
  27.209 ++	frame_table_size = max_page * sizeof(struct pfn_info);
  27.210 ++	frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
  27.211 ++
  27.212 ++	/* Request continuous trunk from boot allocator, since HV
  27.213 ++	 * address is identity mapped */
  27.214 ++	p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE);
  27.215 ++	if (p == 0)
  27.216 ++		panic("Not enough memory for frame table.\n");
  27.217 ++
  27.218 ++	frame_table = __va(p);
  27.219 ++	memset(frame_table, 0, frame_table_size);
  27.220 ++	printk("size of frame_table: %lukB\n",
  27.221 ++		frame_table_size >> 10);
  27.222 ++}
  27.223 ++#endif
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mmzone.h	Mon Apr 11 21:04:58 2005 +0000
    28.3 @@ -0,0 +1,19 @@
    28.4 + mmzone.h |    4 ++++
    28.5 + 1 files changed, 4 insertions(+)
    28.6 +
    28.7 +Index: linux-2.6.11/include/linux/mmzone.h
    28.8 +===================================================================
    28.9 +--- linux-2.6.11.orig/include/linux/mmzone.h	2005-03-02 01:38:10.000000000 -0600
   28.10 ++++ linux-2.6.11/include/linux/mmzone.h	2005-03-19 13:49:30.427573139 -0600
   28.11 +@@ -209,7 +209,11 @@ struct zone {
   28.12 + 	 * rarely used fields:
   28.13 + 	 */
   28.14 + 	char			*name;
   28.15 ++#ifdef XEN
   28.16 ++};
   28.17 ++#else
   28.18 + } ____cacheline_maxaligned_in_smp;
   28.19 ++#endif
   28.20 + 
   28.21 + 
   28.22 + /*
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/page.h	Mon Apr 11 21:04:58 2005 +0000
    29.3 @@ -0,0 +1,94 @@
    29.4 + page.h |   42 +++++++++++++++++++++++++++++++++++++++---
    29.5 + 1 files changed, 39 insertions(+), 3 deletions(-)
    29.6 +
    29.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h
    29.8 +===================================================================
    29.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/page.h	2005-04-06 22:58:07.597539393 -0500
   29.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/page.h	2005-04-06 23:06:15.908576975 -0500
   29.11 +@@ -12,6 +12,9 @@
   29.12 + #include <asm/intrinsics.h>
   29.13 + #include <asm/types.h>
   29.14 + 
   29.15 ++#ifndef __ASSEMBLY__
   29.16 ++#include <asm/flushtlb.h>
   29.17 ++#endif
   29.18 + /*
   29.19 +  * PAGE_SHIFT determines the actual kernel page size.
   29.20 +  */
   29.21 +@@ -95,9 +98,11 @@ extern int ia64_pfn_valid (unsigned long
   29.22 + #endif
   29.23 + 
   29.24 + #ifndef CONFIG_DISCONTIGMEM
   29.25 ++#ifdef XEN
   29.26 ++#define pfn_valid(pfn)		(0)
   29.27 ++#else
   29.28 + # define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
   29.29 +-# define page_to_pfn(page)	((unsigned long) (page - mem_map))
   29.30 +-# define pfn_to_page(pfn)	(mem_map + (pfn))
   29.31 ++#endif
   29.32 + #else
   29.33 + extern struct page *vmem_map;
   29.34 + extern unsigned long max_low_pfn;
   29.35 +@@ -106,9 +111,15 @@ extern unsigned long max_low_pfn;
   29.36 + # define pfn_to_page(pfn)	(vmem_map + (pfn))
   29.37 + #endif
   29.38 + 
   29.39 +-#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   29.40 ++#define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
   29.41 ++#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
   29.42 ++
   29.43 ++#define page_to_phys(_page)	(page_to_pfn(_page) << PAGE_SHIFT)
   29.44 + #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
   29.45 + 
   29.46 ++#define pfn_to_page(_pfn)	(frame_table + (_pfn))
   29.47 ++#define phys_to_page(kaddr)	pfn_to_page(((kaddr) >> PAGE_SHIFT))
   29.48 ++
   29.49 + typedef union ia64_va {
   29.50 + 	struct {
   29.51 + 		unsigned long off : 61;		/* intra-region offset */
   29.52 +@@ -124,8 +135,25 @@ typedef union ia64_va {
   29.53 +  * expressed in this way to ensure they result in a single "dep"
   29.54 +  * instruction.
   29.55 +  */
   29.56 ++#ifdef XEN
   29.57 ++typedef union xen_va {
   29.58 ++	struct {
   29.59 ++		unsigned long off : 60;
   29.60 ++		unsigned long reg : 4;
   29.61 ++	} f;
   29.62 ++	unsigned long l;
   29.63 ++	void *p;
   29.64 ++} xen_va;
   29.65 ++
   29.66 ++// xen/drivers/console.c uses __va in a declaration (should be fixed!)
   29.67 ++#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   29.68 ++#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   29.69 ++//# define __pa(x)	((unsigned long)(((unsigned long)x) - PAGE_OFFSET))
   29.70 ++//# define __va(x)	((void *)((char *)(x) + PAGE_OFFSET))
   29.71 ++#else
   29.72 + #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   29.73 + #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   29.74 ++#endif
   29.75 + 
   29.76 + #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
   29.77 + #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
   29.78 +@@ -197,11 +225,19 @@ get_order (unsigned long size)
   29.79 + # define __pgprot(x)	(x)
   29.80 + #endif /* !STRICT_MM_TYPECHECKS */
   29.81 + 
   29.82 ++#ifdef XEN
   29.83 ++#define PAGE_OFFSET			__IA64_UL_CONST(0xf000000000000000)
   29.84 ++#else
   29.85 + #define PAGE_OFFSET			__IA64_UL_CONST(0xe000000000000000)
   29.86 ++#endif
   29.87 + 
   29.88 + #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
   29.89 + 					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
   29.90 + 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
   29.91 + 					  ? VM_EXEC : 0))
   29.92 + 
   29.93 ++#ifdef XEN
   29.94 ++#define __flush_tlb() do {} while(0);
   29.95 ++#endif
   29.96 ++
   29.97 + #endif /* _ASM_IA64_PAGE_H */
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pal.S	Mon Apr 11 21:04:58 2005 +0000
    30.3 @@ -0,0 +1,31 @@
    30.4 + pal.S |    8 ++++++++
    30.5 + 1 files changed, 8 insertions(+)
    30.6 +
    30.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/pal.S
    30.8 +===================================================================
    30.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/pal.S	2005-03-02 01:38:33.000000000 -0600
   30.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/pal.S	2005-04-06 22:43:53.817885390 -0500
   30.11 +@@ -166,7 +166,11 @@ GLOBAL_ENTRY(ia64_pal_call_phys_static)
   30.12 + 	adds r8  = 1f-1b,r8		// calculate return address for call
   30.13 + 	;;
   30.14 + 	mov loc4=ar.rsc			// save RSE configuration
   30.15 ++#ifdef XEN
   30.16 ++	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   30.17 ++#else // XEN
   30.18 + 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   30.19 ++#endif // XEN
   30.20 + 	tpa r8=r8			// convert rp to physical
   30.21 + 	;;
   30.22 + 	mov b7 = loc2			// install target to branch reg
   30.23 +@@ -225,7 +229,11 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
   30.24 + 	mov loc3 = psr		// save psr
   30.25 + 	;;
   30.26 + 	mov loc4=ar.rsc			// save RSE configuration
   30.27 ++#ifdef XEN
   30.28 ++	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   30.29 ++#else // XEN
   30.30 + 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   30.31 ++#endif // XEN
   30.32 + 	;;
   30.33 + 	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
   30.34 + 	movl r16=PAL_PSR_BITS_TO_CLEAR
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Mon Apr 11 21:04:58 2005 +0000
    31.3 @@ -0,0 +1,78 @@
    31.4 + pgalloc.h |   17 +++++++++++------
    31.5 + 1 files changed, 11 insertions(+), 6 deletions(-)
    31.6 +
    31.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h
    31.8 +===================================================================
    31.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/pgalloc.h	2005-04-08 11:57:30.909774800 -0500
   31.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h	2005-04-08 11:58:08.102711219 -0500
   31.11 +@@ -18,6 +18,7 @@
   31.12 + #include <linux/compiler.h>
   31.13 + #include <linux/mm.h>
   31.14 + #include <linux/page-flags.h>
   31.15 ++#include <linux/preempt.h>
   31.16 + #include <linux/threads.h>
   31.17 + 
   31.18 + #include <asm/mmu_context.h>
   31.19 +@@ -34,6 +35,10 @@
   31.20 + #define pmd_quicklist		(local_cpu_data->pmd_quick)
   31.21 + #define pgtable_cache_size	(local_cpu_data->pgtable_cache_sz)
   31.22 + 
   31.23 ++/* FIXME: Later 3 level page table should be over, to create 
   31.24 ++ * new interface upon xen memory allocator. To simplify first
   31.25 ++ * effort moving to xen allocator, use xenheap pages temporarily. 
   31.26 ++ */
   31.27 + static inline pgd_t*
   31.28 + pgd_alloc_one_fast (struct mm_struct *mm)
   31.29 + {
   31.30 +@@ -61,7 +66,7 @@ pgd_alloc (struct mm_struct *mm)
   31.31 + 	pgd_t *pgd = pgd_alloc_one_fast(mm);
   31.32 + 
   31.33 + 	if (unlikely(pgd == NULL)) {
   31.34 +-		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
   31.35 ++		pgd = (pgd_t *)alloc_xenheap_page();
   31.36 + 	}
   31.37 + 	return pgd;
   31.38 + }
   31.39 +@@ -104,7 +109,7 @@ pmd_alloc_one_fast (struct mm_struct *mm
   31.40 + static inline pmd_t*
   31.41 + pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
   31.42 + {
   31.43 +-	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   31.44 ++	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
   31.45 + 
   31.46 + 	return pmd;
   31.47 + }
   31.48 +@@ -136,7 +141,7 @@ pmd_populate_kernel (struct mm_struct *m
   31.49 + static inline struct page *
   31.50 + pte_alloc_one (struct mm_struct *mm, unsigned long addr)
   31.51 + {
   31.52 +-	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
   31.53 ++	struct page *pte = alloc_xenheap_page();
   31.54 + 
   31.55 + 	return pte;
   31.56 + }
   31.57 +@@ -144,7 +149,7 @@ pte_alloc_one (struct mm_struct *mm, uns
   31.58 + static inline pte_t *
   31.59 + pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
   31.60 + {
   31.61 +-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   31.62 ++	pte_t *pte = (pte_t *)alloc_xenheap_page();
   31.63 + 
   31.64 + 	return pte;
   31.65 + }
   31.66 +@@ -152,13 +157,13 @@ pte_alloc_one_kernel (struct mm_struct *
   31.67 + static inline void
   31.68 + pte_free (struct page *pte)
   31.69 + {
   31.70 +-	__free_page(pte);
   31.71 ++	free_xenheap_page(pte);
   31.72 + }
   31.73 + 
   31.74 + static inline void
   31.75 + pte_free_kernel (pte_t *pte)
   31.76 + {
   31.77 +-	free_page((unsigned long) pte);
   31.78 ++	free_xenheap_page((unsigned long) pte);
   31.79 + }
   31.80 + 
   31.81 + #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/processor.h	Mon Apr 11 21:04:58 2005 +0000
    32.3 @@ -0,0 +1,24 @@
    32.4 + processor.h |    4 ++++
    32.5 + 1 files changed, 4 insertions(+)
    32.6 +
    32.7 +Index: linux-2.6.11/include/asm-ia64/processor.h
    32.8 +===================================================================
    32.9 +--- linux-2.6.11.orig/include/asm-ia64/processor.h	2005-03-02 01:37:58.000000000 -0600
   32.10 ++++ linux-2.6.11/include/asm-ia64/processor.h	2005-03-19 14:26:01.062135543 -0600
   32.11 +@@ -408,12 +408,16 @@ extern void ia64_setreg_unknown_kr (void
   32.12 +  */
   32.13 + 
   32.14 + /* Return TRUE if task T owns the fph partition of the CPU we're running on. */
   32.15 ++#ifdef XEN
   32.16 ++#define ia64_is_local_fpu_owner(t) 0
   32.17 ++#else
   32.18 + #define ia64_is_local_fpu_owner(t)								\
   32.19 + ({												\
   32.20 + 	struct task_struct *__ia64_islfo_task = (t);						\
   32.21 + 	(__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id()				\
   32.22 + 	 && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER));	\
   32.23 + })
   32.24 ++#endif
   32.25 + 
   32.26 + /* Mark task T as owning the fph partition of the CPU we're running on. */
   32.27 + #define ia64_set_local_fpu_owner(t) do {						\
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/sal.h	Mon Apr 11 21:04:58 2005 +0000
    33.3 @@ -0,0 +1,39 @@
    33.4 + sal.h |   17 +++++++++++++++++
    33.5 + 1 files changed, 17 insertions(+)
    33.6 +
    33.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/sal.h
    33.8 +===================================================================
    33.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/sal.h	2005-04-08 12:00:53.510988510 -0500
   33.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/sal.h	2005-04-08 12:02:17.778587216 -0500
   33.11 +@@ -36,6 +36,7 @@
   33.12 + #ifndef __ASSEMBLY__
   33.13 + 
   33.14 + #include <linux/bcd.h>
   33.15 ++#include <linux/preempt.h>
   33.16 + #include <linux/spinlock.h>
   33.17 + #include <linux/efi.h>
   33.18 + 
   33.19 +@@ -650,7 +651,23 @@ ia64_sal_freq_base (unsigned long which,
   33.20 + {
   33.21 + 	struct ia64_sal_retval isrv;
   33.22 + 
   33.23 ++//#ifdef XEN
   33.24 ++#if 0
   33.25 ++	unsigned long *x = (unsigned long *)ia64_sal;
   33.26 ++	unsigned long *inst = (unsigned long *)*x;
   33.27 ++	unsigned long __ia64_sc_flags;
   33.28 ++	struct ia64_fpreg __ia64_sc_fr[6];
   33.29 ++printf("ia64_sal_freq_base: about to save_scratch_fpregs\n");
   33.30 ++	ia64_save_scratch_fpregs(__ia64_sc_fr);
   33.31 ++	spin_lock_irqsave(&sal_lock, __ia64_sc_flags);
   33.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]);
   33.33 ++printf("first inst=%p,%p\n",inst[0],inst[1]);
   33.34 ++	isrv = (*ia64_sal)(SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   33.35 ++	spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags);
   33.36 ++	ia64_load_scratch_fpregs(__ia64_sc_fr);
   33.37 ++#else
   33.38 + 	SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   33.39 ++#endif
   33.40 + 	*ticks_per_second = isrv.v0;
   33.41 + 	*drift_info = isrv.v1;
   33.42 + 	return isrv.status;
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/series	Mon Apr 11 21:04:58 2005 +0000
    34.3 @@ -0,0 +1,40 @@
    34.4 +bootmem.h
    34.5 +current.h
    34.6 +efi.c
    34.7 +efi.h
    34.8 +entry.S
    34.9 +gcc_intrin.h
   34.10 +hardirq.h
   34.11 +head.S
   34.12 +hpsim_irq.c
   34.13 +hpsim_ssc.h
   34.14 +hw_irq.h
   34.15 +ide.h
   34.16 +init_task.c
   34.17 +init_task.h
   34.18 +interrupt.h
   34.19 +io.h
   34.20 +irq.h
   34.21 +irq_ia64.c
   34.22 +ivt.S
   34.23 +kregs.h
   34.24 +lds.S
   34.25 +linuxtime.h
   34.26 +minstate.h
   34.27 +mm_bootmem.c
   34.28 +mm_contig.c
   34.29 +mmzone.h
   34.30 +page_alloc.c
   34.31 +page.h
   34.32 +processor.h
   34.33 +sal.h
   34.34 +setup.c
   34.35 +slab.c
   34.36 +slab.h
   34.37 +system.h
   34.38 +time.c
   34.39 +kernel-time.c
   34.40 +tlb.c
   34.41 +types.h
   34.42 +unaligned.c
   34.43 +wait.h
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/setup.c	Mon Apr 11 21:04:58 2005 +0000
    35.3 @@ -0,0 +1,214 @@
    35.4 + setup.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------
    35.5 + 1 files changed, 58 insertions(+), 14 deletions(-)
    35.6 +
    35.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c
    35.8 +===================================================================
    35.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/setup.c	2005-04-07 17:44:13.294980153 -0500
   35.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c	2005-04-07 17:46:37.157717072 -0500
   35.11 +@@ -21,6 +21,9 @@
   35.12 + #include <linux/init.h>
   35.13 + 
   35.14 + #include <linux/acpi.h>
   35.15 ++#ifdef XEN
   35.16 ++#include <xen/sched.h>
   35.17 ++#endif
   35.18 + #include <linux/bootmem.h>
   35.19 + #include <linux/console.h>
   35.20 + #include <linux/delay.h>
   35.21 +@@ -30,13 +33,17 @@
   35.22 + #include <linux/seq_file.h>
   35.23 + #include <linux/string.h>
   35.24 + #include <linux/threads.h>
   35.25 ++#ifndef XEN
   35.26 + #include <linux/tty.h>
   35.27 + #include <linux/serial.h>
   35.28 + #include <linux/serial_core.h>
   35.29 ++#endif
   35.30 + #include <linux/efi.h>
   35.31 + #include <linux/initrd.h>
   35.32 + 
   35.33 ++#ifndef XEN
   35.34 + #include <asm/ia32.h>
   35.35 ++#endif
   35.36 + #include <asm/machvec.h>
   35.37 + #include <asm/mca.h>
   35.38 + #include <asm/meminit.h>
   35.39 +@@ -51,6 +58,12 @@
   35.40 + #include <asm/smp.h>
   35.41 + #include <asm/system.h>
   35.42 + #include <asm/unistd.h>
   35.43 ++#ifdef XEN
   35.44 ++#include <linux/mm.h>
   35.45 ++#include <asm/mmu_context.h>
   35.46 ++extern unsigned long loops_per_jiffy;		// from linux/init/main.c
   35.47 ++char saved_command_line[COMMAND_LINE_SIZE];	// from linux/init/main.c
   35.48 ++#endif
   35.49 + 
   35.50 + #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
   35.51 + # error "struct cpuinfo_ia64 too big!"
   35.52 +@@ -66,7 +79,9 @@ DEFINE_PER_CPU(unsigned long, local_per_
   35.53 + DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
   35.54 + unsigned long ia64_cycles_per_usec;
   35.55 + struct ia64_boot_param *ia64_boot_param;
   35.56 ++#ifndef XEN
   35.57 + struct screen_info screen_info;
   35.58 ++#endif
   35.59 + 
   35.60 + unsigned long ia64_max_cacheline_size;
   35.61 + unsigned long ia64_iobase;	/* virtual address for I/O accesses */
   35.62 +@@ -95,7 +110,6 @@ EXPORT_SYMBOL(ia64_max_iommu_merge_mask)
   35.63 + struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
   35.64 + int num_rsvd_regions;
   35.65 + 
   35.66 +-
   35.67 + /*
   35.68 +  * Filter incoming memory segments based on the primitive map created from the boot
   35.69 +  * parameters. Segments contained in the map are removed from the memory ranges. A
   35.70 +@@ -125,9 +139,12 @@ filter_rsvd_memory (unsigned long start,
   35.71 + 	for (i = 0; i < num_rsvd_regions; ++i) {
   35.72 + 		range_start = max(start, prev_start);
   35.73 + 		range_end   = min(end, rsvd_region[i].start);
   35.74 +-
   35.75 +-		if (range_start < range_end)
   35.76 +-			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   35.77 ++		/* init_boot_pages requires "ps, pe" */
   35.78 ++		if (range_start < range_end) {
   35.79 ++			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
   35.80 ++				__pa(range_start), __pa(range_end));
   35.81 ++			(*func)(__pa(range_start), __pa(range_end), 0);
   35.82 ++		}
   35.83 + 
   35.84 + 		/* nothing more available in this segment */
   35.85 + 		if (range_end == end) return 0;
   35.86 +@@ -184,17 +201,17 @@ reserve_memory (void)
   35.87 + 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
   35.88 + 	n++;
   35.89 + 
   35.90 ++	/* Reserve xen image/bitmap/xen-heap */
   35.91 + 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   35.92 +-	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   35.93 ++	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   35.94 + 	n++;
   35.95 + 
   35.96 +-#ifdef CONFIG_BLK_DEV_INITRD
   35.97 ++	/* This is actually dom0 image */
   35.98 + 	if (ia64_boot_param->initrd_start) {
   35.99 + 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
  35.100 + 		rsvd_region[n].end   = rsvd_region[n].start + ia64_boot_param->initrd_size;
  35.101 + 		n++;
  35.102 + 	}
  35.103 +-#endif
  35.104 + 
  35.105 + 	/* end of memory marker */
  35.106 + 	rsvd_region[n].start = ~0UL;
  35.107 +@@ -204,6 +221,16 @@ reserve_memory (void)
  35.108 + 	num_rsvd_regions = n;
  35.109 + 
  35.110 + 	sort_regions(rsvd_region, num_rsvd_regions);
  35.111 ++
  35.112 ++	{
  35.113 ++		int i;
  35.114 ++		printk("Reserved regions: \n");
  35.115 ++		for (i = 0; i < num_rsvd_regions; i++)
  35.116 ++			printk("  [%d] -> [0x%lx, 0x%lx]\n",
  35.117 ++				i,
  35.118 ++				rsvd_region[i].start,
  35.119 ++				rsvd_region[i].end);
  35.120 ++	}
  35.121 + }
  35.122 + 
  35.123 + /**
  35.124 +@@ -298,18 +325,17 @@ mark_bsp_online (void)
  35.125 + #endif
  35.126 + }
  35.127 + 
  35.128 ++#ifdef XEN
  35.129 + void __init
  35.130 +-setup_arch (char **cmdline_p)
  35.131 ++early_setup_arch (char **cmdline_p)
  35.132 + {
  35.133 + 	unw_init();
  35.134 + 
  35.135 +-	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
  35.136 +-
  35.137 + 	*cmdline_p = __va(ia64_boot_param->command_line);
  35.138 + 	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  35.139 ++	cmdline_parse(*cmdline_p);
  35.140 + 
  35.141 + 	efi_init();
  35.142 +-	io_port_init();
  35.143 + 
  35.144 + #ifdef CONFIG_IA64_GENERIC
  35.145 + 	{
  35.146 +@@ -339,6 +365,10 @@ setup_arch (char **cmdline_p)
  35.147 + 	if (early_console_setup(*cmdline_p) == 0)
  35.148 + 		mark_bsp_online();
  35.149 + 
  35.150 ++#ifdef XEN
  35.151 ++#undef CONFIG_ACPI_BOOT
  35.152 ++#endif
  35.153 ++
  35.154 + #ifdef CONFIG_ACPI_BOOT
  35.155 + 	/* Initialize the ACPI boot-time table parser */
  35.156 + 	acpi_table_init();
  35.157 +@@ -350,9 +380,13 @@ setup_arch (char **cmdline_p)
  35.158 + 	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
  35.159 + # endif
  35.160 + #endif /* CONFIG_APCI_BOOT */
  35.161 ++	io_port_init();
  35.162 ++}
  35.163 ++#endif
  35.164 + 
  35.165 +-	find_memory();
  35.166 +-
  35.167 ++void __init
  35.168 ++setup_arch (void)
  35.169 ++{
  35.170 + 	/* process SAL system table: */
  35.171 + 	ia64_sal_init(efi.sal_systab);
  35.172 + 
  35.173 +@@ -388,7 +422,6 @@ setup_arch (char **cmdline_p)
  35.174 + 	if (!strstr(saved_command_line, "nomca"))
  35.175 + 		ia64_mca_init();
  35.176 + 
  35.177 +-	platform_setup(cmdline_p);
  35.178 + 	paging_init();
  35.179 + }
  35.180 + 
  35.181 +@@ -448,6 +481,9 @@ show_cpuinfo (struct seq_file *m, void *
  35.182 + 		sprintf(cp, " 0x%lx", mask);
  35.183 + 	}
  35.184 + 
  35.185 ++#ifdef XEN
  35.186 ++#define seq_printf(a,b...) printf(b)
  35.187 ++#endif
  35.188 + 	seq_printf(m,
  35.189 + 		   "processor  : %d\n"
  35.190 + 		   "vendor     : %s\n"
  35.191 +@@ -659,11 +695,17 @@ cpu_init (void)
  35.192 + 					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
  35.193 + 	atomic_inc(&init_mm.mm_count);
  35.194 + 	current->active_mm = &init_mm;
  35.195 ++#ifdef XEN
  35.196 ++	if (current->domain->arch.mm)
  35.197 ++#else
  35.198 + 	if (current->mm)
  35.199 ++#endif
  35.200 + 		BUG();
  35.201 + 
  35.202 + 	ia64_mmu_init(ia64_imva(cpu_data));
  35.203 ++#ifndef XEN
  35.204 + 	ia64_mca_cpu_init(ia64_imva(cpu_data));
  35.205 ++#endif
  35.206 + 
  35.207 + #ifdef CONFIG_IA32_SUPPORT
  35.208 + 	ia32_cpu_init();
  35.209 +@@ -711,6 +753,8 @@ cpu_init (void)
  35.210 + void
  35.211 + check_bugs (void)
  35.212 + {
  35.213 ++#ifndef XEN
  35.214 + 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
  35.215 + 			       (unsigned long) __end___mckinley_e9_bundles);
  35.216 ++#endif
  35.217 + }
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/slab.h	Mon Apr 11 21:04:58 2005 +0000
    36.3 @@ -0,0 +1,19 @@
    36.4 + slab.h |    4 ++++
    36.5 + 1 files changed, 4 insertions(+)
    36.6 +
    36.7 +Index: linux-2.6.11/include/linux/slab.h
    36.8 +===================================================================
    36.9 +--- linux-2.6.11.orig/include/linux/slab.h	2005-03-02 01:38:33.000000000 -0600
   36.10 ++++ linux-2.6.11/include/linux/slab.h	2005-03-19 14:35:19.301871922 -0600
   36.11 +@@ -91,7 +91,11 @@ static inline void *kmalloc(size_t size,
   36.12 + 			goto found; \
   36.13 + 		else \
   36.14 + 			i++;
   36.15 ++#ifdef XEN
   36.16 ++#include <linux/kmalloc_sizes.h>
   36.17 ++#else
   36.18 + #include "kmalloc_sizes.h"
   36.19 ++#endif
   36.20 + #undef CACHE
   36.21 + 		{
   36.22 + 			extern void __you_cannot_kmalloc_that_much(void);
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c	Mon Apr 11 21:04:58 2005 +0000
    37.3 @@ -0,0 +1,77 @@
    37.4 + swiotlb.c |   21 +++++++++++++--------
    37.5 + 1 files changed, 13 insertions(+), 8 deletions(-)
    37.6 +
    37.7 +Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c
    37.8 +===================================================================
    37.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c	2005-04-08 12:13:54.040202667 -0500
   37.10 ++++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c	2005-04-08 12:19:09.170367318 -0500
   37.11 +@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d
   37.12 + 	/*
   37.13 + 	 * Get IO TLB memory from the low pages
   37.14 + 	 */
   37.15 +-	io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
   37.16 +-					       (1 << IO_TLB_SHIFT));
   37.17 ++	/* FIXME: Do we really need swiotlb in HV? If all memory trunks
   37.18 ++	 * presented to guest as <4G, are actually <4G in machine range,
   37.19 ++	 * no DMA intevention from HV...
   37.20 ++	 */
   37.21 ++	io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)));
   37.22 + 	if (!io_tlb_start)
   37.23 + 		panic("Cannot allocate SWIOTLB buffer");
   37.24 + 	io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
   37.25 +@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d
   37.26 + 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
   37.27 + 	 * between io_tlb_start and io_tlb_end.
   37.28 + 	 */
   37.29 +-	io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
   37.30 ++	io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int)));
   37.31 + 	for (i = 0; i < io_tlb_nslabs; i++)
   37.32 +  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
   37.33 + 	io_tlb_index = 0;
   37.34 +-	io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
   37.35 ++	io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *)));
   37.36 + 
   37.37 + 	/*
   37.38 + 	 * Get the overflow emergency buffer
   37.39 + 	 */
   37.40 +-	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
   37.41 ++	io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow));
   37.42 + 	printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
   37.43 + 	       virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
   37.44 + }
   37.45 +@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw
   37.46 + 	 */
   37.47 + 	flags |= GFP_DMA;
   37.48 + 
   37.49 +-	ret = (void *)__get_free_pages(flags, order);
   37.50 ++	ret = (void *)alloc_xenheap_pages(get_order(size));
   37.51 + 	if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
   37.52 + 		/*
   37.53 + 		 * The allocated memory isn't reachable by the device.
   37.54 + 		 * Fall back on swiotlb_map_single().
   37.55 + 		 */
   37.56 +-		free_pages((unsigned long) ret, order);
   37.57 ++		free_xenheap_pages((unsigned long) ret, order);
   37.58 + 		ret = NULL;
   37.59 + 	}
   37.60 + 	if (!ret) {
   37.61 +@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd
   37.62 + {
   37.63 + 	if (!(vaddr >= (void *)io_tlb_start
   37.64 +                     && vaddr < (void *)io_tlb_end))
   37.65 +-		free_pages((unsigned long) vaddr, get_order(size));
   37.66 ++		free_xenheap_pages((unsigned long) vaddr, get_order(size));
   37.67 + 	else
   37.68 + 		/* DMA_TO_DEVICE to avoid memcpy in unmap_single */
   37.69 + 		swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
   37.70 +@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t 
   37.71 + 	 * When the mapping is small enough return a static buffer to limit
   37.72 + 	 * the damage, or panic when the transfer is too big.
   37.73 + 	 */
   37.74 ++#ifndef XEN
   37.75 + 	printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
   37.76 + 	       "device %s\n", size, dev ? dev->bus_id : "?");
   37.77 ++#endif
   37.78 + 
   37.79 + 	if (size > io_tlb_overflow && do_panic) {
   37.80 + 		if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/system.h	Mon Apr 11 21:04:58 2005 +0000
    38.3 @@ -0,0 +1,48 @@
    38.4 + system.h |   15 +++++++++++++++
    38.5 + 1 files changed, 15 insertions(+)
    38.6 +
    38.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h
    38.8 +===================================================================
    38.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/system.h	2005-04-07 10:39:11.066701457 -0500
   38.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/system.h	2005-04-07 10:40:19.540544127 -0500
   38.11 +@@ -24,8 +24,16 @@
   38.12 +  * 0xa000000000000000+2*PERCPU_PAGE_SIZE
   38.13 +  * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
   38.14 +  */
   38.15 ++#ifdef XEN
   38.16 ++//#define KERNEL_START		 0xf000000100000000
   38.17 ++#define KERNEL_START		 0xf000000004000000
   38.18 ++#define PERCPU_ADDR		 0xf100000000000000-PERCPU_PAGE_SIZE
   38.19 ++#define SHAREDINFO_ADDR		 0xf100000000000000
   38.20 ++#define VHPT_ADDR		 0xf200000000000000
   38.21 ++#else
   38.22 + #define KERNEL_START		 __IA64_UL_CONST(0xa000000100000000)
   38.23 + #define PERCPU_ADDR		(-PERCPU_PAGE_SIZE)
   38.24 ++#endif
   38.25 + 
   38.26 + #ifndef __ASSEMBLY__
   38.27 + 
   38.28 +@@ -218,9 +226,13 @@ extern void ia64_load_extra (struct task
   38.29 + # define PERFMON_IS_SYSWIDE() (0)
   38.30 + #endif
   38.31 + 
   38.32 ++#ifdef XEN
   38.33 ++#define IA64_HAS_EXTRA_STATE(t) 0
   38.34 ++#else
   38.35 + #define IA64_HAS_EXTRA_STATE(t)							\
   38.36 + 	((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)	\
   38.37 + 	 || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE())
   38.38 ++#endif
   38.39 + 
   38.40 + #define __switch_to(prev,next,last) do {							 \
   38.41 + 	if (IA64_HAS_EXTRA_STATE(prev))								 \
   38.42 +@@ -249,6 +261,9 @@ extern void ia64_load_extra (struct task
   38.43 + #else
   38.44 + # define switch_to(prev,next,last)	__switch_to(prev, next, last)
   38.45 + #endif
   38.46 ++//#ifdef XEN
   38.47 ++//#undef switch_to
   38.48 ++//#endif
   38.49 + 
   38.50 + /*
   38.51 +  * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c	Mon Apr 11 21:04:58 2005 +0000
    39.3 @@ -0,0 +1,302 @@
    39.4 + time.c |  158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    39.5 + 1 files changed, 158 insertions(+)
    39.6 +
    39.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c
    39.8 +===================================================================
    39.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/time.c	2005-04-07 17:02:39.634985144 -0500
   39.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/time.c	2005-04-07 17:23:52.777723222 -0500
   39.11 +@@ -10,16 +10,22 @@
   39.12 +  */
   39.13 + #include <linux/config.h>
   39.14 + 
   39.15 ++#ifndef XEN
   39.16 + #include <linux/cpu.h>
   39.17 ++#endif
   39.18 + #include <linux/init.h>
   39.19 + #include <linux/kernel.h>
   39.20 + #include <linux/module.h>
   39.21 ++#ifndef XEN
   39.22 + #include <linux/profile.h>
   39.23 ++#endif
   39.24 + #include <linux/sched.h>
   39.25 + #include <linux/time.h>
   39.26 + #include <linux/interrupt.h>
   39.27 + #include <linux/efi.h>
   39.28 ++#ifndef XEN
   39.29 + #include <linux/profile.h>
   39.30 ++#endif
   39.31 + #include <linux/timex.h>
   39.32 + 
   39.33 + #include <asm/machvec.h>
   39.34 +@@ -29,10 +35,19 @@
   39.35 + #include <asm/sal.h>
   39.36 + #include <asm/sections.h>
   39.37 + #include <asm/system.h>
   39.38 ++#ifdef XEN
   39.39 ++#include <asm/ia64_int.h>
   39.40 ++#endif
   39.41 + 
   39.42 + extern unsigned long wall_jiffies;
   39.43 + 
   39.44 ++#ifndef XEN
   39.45 + u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
   39.46 ++#else
   39.47 ++#define INITIAL_JIFFIES 0
   39.48 ++u64 jiffies_64 = INITIAL_JIFFIES;
   39.49 ++#define CPU_PROFILING 0
   39.50 ++#endif
   39.51 + 
   39.52 + EXPORT_SYMBOL(jiffies_64);
   39.53 + 
   39.54 +@@ -45,33 +60,154 @@ EXPORT_SYMBOL(last_cli_ip);
   39.55 + 
   39.56 + #endif
   39.57 + 
   39.58 ++#ifdef XEN
   39.59 ++volatile unsigned long last_nsec_offset;
   39.60 ++extern rwlock_t xtime_lock;
   39.61 ++unsigned long cpu_khz;  /* Detected as we calibrate the TSC */
   39.62 ++static s_time_t        stime_irq;       /* System time at last 'time update' */
   39.63 ++
   39.64 ++static inline u64 get_time_delta(void)
   39.65 ++{
   39.66 ++	return ia64_get_itc();
   39.67 ++}
   39.68 ++
   39.69 ++s_time_t get_s_time(void)
   39.70 ++{
   39.71 ++    s_time_t now;
   39.72 ++    unsigned long flags;
   39.73 ++
   39.74 ++    read_lock_irqsave(&xtime_lock, flags);
   39.75 ++
   39.76 ++    now = stime_irq + get_time_delta();
   39.77 ++
   39.78 ++    /* Ensure that the returned system time is monotonically increasing. */
   39.79 ++    {
   39.80 ++        static s_time_t prev_now = 0;
   39.81 ++        if ( unlikely(now < prev_now) )
   39.82 ++            now = prev_now;
   39.83 ++        prev_now = now;
   39.84 ++    }
   39.85 ++
   39.86 ++    read_unlock_irqrestore(&xtime_lock, flags);
   39.87 ++
   39.88 ++    return now; 
   39.89 ++}
   39.90 ++
   39.91 ++void update_dom_time(struct exec_domain *ed)
   39.92 ++{
   39.93 ++// FIXME: implement this?
   39.94 ++//	printf("update_dom_time: called, not implemented, skipping\n");
   39.95 ++	return;
   39.96 ++}
   39.97 ++
   39.98 ++/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
   39.99 ++void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
  39.100 ++{
  39.101 ++// FIXME: Should this be do_settimeofday (from linux)???
  39.102 ++	printf("do_settime: called, not implemented, stopping\n");
  39.103 ++	dummy();
  39.104 ++}
  39.105 ++#endif
  39.106 ++
  39.107 ++#if 0	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  39.108 ++#endif	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  39.109 ++ 
  39.110 ++#ifndef XEN
  39.111 + static struct time_interpolator itc_interpolator = {
  39.112 + 	.shift = 16,
  39.113 + 	.mask = 0xffffffffffffffffLL,
  39.114 + 	.source = TIME_SOURCE_CPU
  39.115 + };
  39.116 ++#endif
  39.117 ++
  39.118 ++#ifdef XEN
  39.119 ++unsigned long domain0_ready = 0;	// FIXME (see below)
  39.120 ++#define typecheck(a,b)	1
  39.121 ++/* FROM linux/include/linux/jiffies.h */
  39.122 ++/*
  39.123 ++ *	These inlines deal with timer wrapping correctly. You are 
  39.124 ++ *	strongly encouraged to use them
  39.125 ++ *	1. Because people otherwise forget
  39.126 ++ *	2. Because if the timer wrap changes in future you won't have to
  39.127 ++ *	   alter your driver code.
  39.128 ++ *
  39.129 ++ * time_after(a,b) returns true if the time a is after time b.
  39.130 ++ *
  39.131 ++ * Do this with "<0" and ">=0" to only test the sign of the result. A
  39.132 ++ * good compiler would generate better code (and a really good compiler
  39.133 ++ * wouldn't care). Gcc is currently neither.
  39.134 ++ */
  39.135 ++#define time_after(a,b)		\
  39.136 ++	(typecheck(unsigned long, a) && \
  39.137 ++	 typecheck(unsigned long, b) && \
  39.138 ++	 ((long)(b) - (long)(a) < 0))
  39.139 ++#define time_before(a,b)	time_after(b,a)
  39.140 ++
  39.141 ++#define time_after_eq(a,b)	\
  39.142 ++	(typecheck(unsigned long, a) && \
  39.143 ++	 typecheck(unsigned long, b) && \
  39.144 ++	 ((long)(a) - (long)(b) >= 0))
  39.145 ++#define time_before_eq(a,b)	time_after_eq(b,a)
  39.146 ++#endif
  39.147 + 
  39.148 + static irqreturn_t
  39.149 + timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
  39.150 + {
  39.151 + 	unsigned long new_itm;
  39.152 + 
  39.153 ++#ifndef XEN
  39.154 + 	if (unlikely(cpu_is_offline(smp_processor_id()))) {
  39.155 + 		return IRQ_HANDLED;
  39.156 + 	}
  39.157 ++#endif
  39.158 ++#ifdef XEN
  39.159 ++	if (current->domain == dom0) {
  39.160 ++		// FIXME: there's gotta be a better way of doing this...
  39.161 ++		// We have to ensure that domain0 is launched before we
  39.162 ++		// call vcpu_timer_expired on it
  39.163 ++		//domain0_ready = 1; // moved to xensetup.c
  39.164 ++	}
  39.165 ++	if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) {
  39.166 ++		vcpu_pend_timer(dom0->exec_domain[0]);
  39.167 ++		//vcpu_set_next_timer(dom0->exec_domain[0]);
  39.168 ++		domain_wake(dom0->exec_domain[0]);
  39.169 ++	}
  39.170 ++	if (!is_idle_task(current->domain) && current->domain != dom0) {
  39.171 ++		if (vcpu_timer_expired(current)) {
  39.172 ++			vcpu_pend_timer(current);
  39.173 ++			// ensure another timer interrupt happens even if domain doesn't
  39.174 ++			vcpu_set_next_timer(current);
  39.175 ++			domain_wake(current);
  39.176 ++		}
  39.177 ++	}
  39.178 ++	raise_actimer_softirq();
  39.179 ++#endif
  39.180 + 
  39.181 ++#ifndef XEN
  39.182 + 	platform_timer_interrupt(irq, dev_id, regs);
  39.183 ++#endif
  39.184 + 
  39.185 + 	new_itm = local_cpu_data->itm_next;
  39.186 + 
  39.187 + 	if (!time_after(ia64_get_itc(), new_itm))
  39.188 ++#ifdef XEN
  39.189 ++		return;
  39.190 ++#else
  39.191 + 		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
  39.192 + 		       ia64_get_itc(), new_itm);
  39.193 ++#endif
  39.194 + 
  39.195 ++#ifdef XEN
  39.196 ++//	printf("GOT TO HERE!!!!!!!!!!!\n");
  39.197 ++	//while(1);
  39.198 ++#else
  39.199 + 	profile_tick(CPU_PROFILING, regs);
  39.200 ++#endif
  39.201 + 
  39.202 + 	while (1) {
  39.203 ++#ifndef XEN
  39.204 + 		update_process_times(user_mode(regs));
  39.205 ++#endif
  39.206 + 
  39.207 + 		new_itm += local_cpu_data->itm_delta;
  39.208 + 
  39.209 +@@ -82,10 +218,16 @@ timer_interrupt (int irq, void *dev_id, 
  39.210 + 			 * another CPU. We need to avoid to SMP race by acquiring the
  39.211 + 			 * xtime_lock.
  39.212 + 			 */
  39.213 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  39.214 + 			write_seqlock(&xtime_lock);
  39.215 ++#endif
  39.216 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  39.217 + 			do_timer(regs);
  39.218 ++#endif
  39.219 + 			local_cpu_data->itm_next = new_itm;
  39.220 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  39.221 + 			write_sequnlock(&xtime_lock);
  39.222 ++#endif
  39.223 + 		} else
  39.224 + 			local_cpu_data->itm_next = new_itm;
  39.225 + 
  39.226 +@@ -105,7 +247,12 @@ timer_interrupt (int irq, void *dev_id, 
  39.227 + 		 */
  39.228 + 		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
  39.229 + 			new_itm += local_cpu_data->itm_delta;
  39.230 ++//#ifdef XEN
  39.231 ++//		vcpu_set_next_timer(current);
  39.232 ++//#else
  39.233 ++//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
  39.234 + 		ia64_set_itm(new_itm);
  39.235 ++//#endif
  39.236 + 		/* double check, in case we got hit by a (slow) PMI: */
  39.237 + 	} while (time_after_eq(ia64_get_itc(), new_itm));
  39.238 + 	return IRQ_HANDLED;
  39.239 +@@ -120,6 +267,7 @@ ia64_cpu_local_tick (void)
  39.240 + 	int cpu = smp_processor_id();
  39.241 + 	unsigned long shift = 0, delta;
  39.242 + 
  39.243 ++printf("ia64_cpu_local_tick: about to call ia64_set_itv\n");
  39.244 + 	/* arrange for the cycle counter to generate a timer interrupt: */
  39.245 + 	ia64_set_itv(IA64_TIMER_VECTOR);
  39.246 + 
  39.247 +@@ -133,6 +281,7 @@ ia64_cpu_local_tick (void)
  39.248 + 		shift = (2*(cpu - hi) + 1) * delta/hi/2;
  39.249 + 	}
  39.250 + 	local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
  39.251 ++printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next);
  39.252 + 	ia64_set_itm(local_cpu_data->itm_next);
  39.253 + }
  39.254 + 
  39.255 +@@ -160,6 +309,7 @@ ia64_init_itm (void)
  39.256 + 	 * frequency and then a PAL call to determine the frequency ratio between the ITC
  39.257 + 	 * and the base frequency.
  39.258 + 	 */
  39.259 ++
  39.260 + 	status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
  39.261 + 				    &platform_base_freq, &platform_base_drift);
  39.262 + 	if (status != 0) {
  39.263 +@@ -212,6 +362,7 @@ ia64_init_itm (void)
  39.264 + 					+ itc_freq/2)/itc_freq;
  39.265 + 
  39.266 + 	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
  39.267 ++#ifndef XEN
  39.268 + 		itc_interpolator.frequency = local_cpu_data->itc_freq;
  39.269 + 		itc_interpolator.drift = itc_drift;
  39.270 + #ifdef CONFIG_SMP
  39.271 +@@ -228,6 +379,7 @@ ia64_init_itm (void)
  39.272 + 		if (!nojitter) itc_interpolator.jitter = 1;
  39.273 + #endif
  39.274 + 		register_time_interpolator(&itc_interpolator);
  39.275 ++#endif
  39.276 + 	}
  39.277 + 
  39.278 + 	/* Setup the CPU local timer tick */
  39.279 +@@ -236,7 +388,9 @@ ia64_init_itm (void)
  39.280 + 
  39.281 + static struct irqaction timer_irqaction = {
  39.282 + 	.handler =	timer_interrupt,
  39.283 ++#ifndef XEN
  39.284 + 	.flags =	SA_INTERRUPT,
  39.285 ++#endif
  39.286 + 	.name =		"timer"
  39.287 + };
  39.288 + 
  39.289 +@@ -244,12 +398,16 @@ void __init
  39.290 + time_init (void)
  39.291 + {
  39.292 + 	register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
  39.293 ++#ifndef XEN
  39.294 + 	efi_gettimeofday(&xtime);
  39.295 ++#endif
  39.296 + 	ia64_init_itm();
  39.297 + 
  39.298 ++#ifndef XEN
  39.299 + 	/*
  39.300 + 	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
  39.301 + 	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
  39.302 + 	 */
  39.303 + 	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
  39.304 ++#endif
  39.305 + }
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Mon Apr 11 21:04:58 2005 +0000
    40.3 @@ -0,0 +1,53 @@
    40.4 + tlb.c |   10 ++++++++++
    40.5 + 1 files changed, 10 insertions(+)
    40.6 +
    40.7 +Index: linux-2.6.11/arch/ia64/mm/tlb.c
    40.8 +===================================================================
    40.9 +--- linux-2.6.11.orig/arch/ia64/mm/tlb.c	2005-03-02 01:38:38.000000000 -0600
   40.10 ++++ linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-19 14:58:43.978400822 -0600
   40.11 +@@ -21,7 +21,9 @@
   40.12 + #include <asm/mmu_context.h>
   40.13 + #include <asm/pgalloc.h>
   40.14 + #include <asm/pal.h>
   40.15 ++#ifndef XEN
   40.16 + #include <asm/tlbflush.h>
   40.17 ++#endif
   40.18 + 
   40.19 + static struct {
   40.20 + 	unsigned long mask;	/* mask of supported purge page-sizes */
   40.21 +@@ -43,6 +45,9 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
   40.22 + void
   40.23 + wrap_mmu_context (struct mm_struct *mm)
   40.24 + {
   40.25 ++#ifdef XEN
   40.26 ++printf("wrap_mmu_context: called, not implemented\n");
   40.27 ++#else
   40.28 + 	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
   40.29 + 	struct task_struct *tsk;
   40.30 + 	int i;
   40.31 +@@ -83,6 +88,7 @@ wrap_mmu_context (struct mm_struct *mm)
   40.32 + 		put_cpu();
   40.33 + 	}
   40.34 + 	local_flush_tlb_all();
   40.35 ++#endif
   40.36 + }
   40.37 + 
   40.38 + void
   40.39 +@@ -132,6 +138,9 @@ EXPORT_SYMBOL(local_flush_tlb_all);
   40.40 + void
   40.41 + flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
   40.42 + {
   40.43 ++#ifdef XEN
   40.44 ++printf("flush_tlb_range: called, not implemented\n");
   40.45 ++#else
   40.46 + 	struct mm_struct *mm = vma->vm_mm;
   40.47 + 	unsigned long size = end - start;
   40.48 + 	unsigned long nbits;
   40.49 +@@ -163,6 +172,7 @@ flush_tlb_range (struct vm_area_struct *
   40.50 + # endif
   40.51 + 
   40.52 + 	ia64_srlz_i();			/* srlz.i implies srlz.d */
   40.53 ++#endif
   40.54 + }
   40.55 + EXPORT_SYMBOL(flush_tlb_range);
   40.56 + 
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/types.h	Mon Apr 11 21:04:58 2005 +0000
    41.3 @@ -0,0 +1,20 @@
    41.4 + types.h |    7 +++++++
    41.5 + 1 files changed, 7 insertions(+)
    41.6 +
    41.7 +Index: linux-2.6.11/include/asm-ia64/types.h
    41.8 +===================================================================
    41.9 +--- linux-2.6.11.orig/include/asm-ia64/types.h	2005-03-02 01:37:49.000000000 -0600
   41.10 ++++ linux-2.6.11/include/asm-ia64/types.h	2005-03-19 14:58:47.628750770 -0600
   41.11 +@@ -1,5 +1,12 @@
   41.12 + #ifndef _ASM_IA64_TYPES_H
   41.13 + #define _ASM_IA64_TYPES_H
   41.14 ++#ifdef XEN
   41.15 ++#ifndef __ASSEMBLY__
   41.16 ++typedef unsigned long ssize_t;
   41.17 ++typedef unsigned long size_t;
   41.18 ++typedef long long loff_t;
   41.19 ++#endif
   41.20 ++#endif
   41.21 + 
   41.22 + /*
   41.23 +  * This file is never included by application software unless explicitly requested (e.g.,
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/unaligned.c	Mon Apr 11 21:04:58 2005 +0000
    42.3 @@ -0,0 +1,102 @@
    42.4 + unaligned.c |   27 +++++++++++++++++++++++++++
    42.5 + 1 files changed, 27 insertions(+)
    42.6 +
    42.7 +Index: linux-2.6.11/arch/ia64/kernel/unaligned.c
    42.8 +===================================================================
    42.9 +--- linux-2.6.11.orig/arch/ia64/kernel/unaligned.c	2005-03-02 01:38:25.000000000 -0600
   42.10 ++++ linux-2.6.11/arch/ia64/kernel/unaligned.c	2005-03-19 14:58:51.269335202 -0600
   42.11 +@@ -15,8 +15,10 @@
   42.12 +  */
   42.13 + #include <linux/kernel.h>
   42.14 + #include <linux/sched.h>
   42.15 ++#ifndef XEN
   42.16 + #include <linux/smp_lock.h>
   42.17 + #include <linux/tty.h>
   42.18 ++#endif
   42.19 + 
   42.20 + #include <asm/intrinsics.h>
   42.21 + #include <asm/processor.h>
   42.22 +@@ -24,7 +26,16 @@
   42.23 + #include <asm/uaccess.h>
   42.24 + #include <asm/unaligned.h>
   42.25 + 
   42.26 ++#ifdef XEN
   42.27 ++#define	ia64_peek(x...)	printk("ia64_peek: called, not implemented\n")
   42.28 ++#define	ia64_poke(x...)	printk("ia64_poke: called, not implemented\n")
   42.29 ++#define	ia64_sync_fph(x...) printk("ia64_sync_fph: called, not implemented\n")
   42.30 ++#define	ia64_flush_fph(x...) printk("ia64_flush_fph: called, not implemented\n")
   42.31 ++#define	die_if_kernel(x...) printk("die_if_kernel: called, not implemented\n")
   42.32 ++#define jiffies 0
   42.33 ++#else
   42.34 + extern void die_if_kernel(char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
   42.35 ++#endif
   42.36 + 
   42.37 + #undef DEBUG_UNALIGNED_TRAP
   42.38 + 
   42.39 +@@ -437,7 +448,11 @@ get_rse_reg (struct pt_regs *regs, unsig
   42.40 + }
   42.41 + 
   42.42 + 
   42.43 ++#ifdef XEN
   42.44 ++void
   42.45 ++#else
   42.46 + static void
   42.47 ++#endif
   42.48 + setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
   42.49 + {
   42.50 + 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   42.51 +@@ -611,7 +626,11 @@ getfpreg (unsigned long regnum, struct i
   42.52 + }
   42.53 + 
   42.54 + 
   42.55 ++#ifdef XEN
   42.56 ++void
   42.57 ++#else
   42.58 + static void
   42.59 ++#endif
   42.60 + getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs)
   42.61 + {
   42.62 + 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   42.63 +@@ -1298,7 +1317,9 @@ ia64_handle_unaligned (unsigned long ifa
   42.64 + 	mm_segment_t old_fs = get_fs();
   42.65 + 	unsigned long bundle[2];
   42.66 + 	unsigned long opcode;
   42.67 ++#ifndef XEN
   42.68 + 	struct siginfo si;
   42.69 ++#endif
   42.70 + 	const struct exception_table_entry *eh = NULL;
   42.71 + 	union {
   42.72 + 		unsigned long l;
   42.73 +@@ -1317,6 +1338,9 @@ ia64_handle_unaligned (unsigned long ifa
   42.74 + 	 * user-level unaligned accesses.  Otherwise, a clever program could trick this
   42.75 + 	 * handler into reading an arbitrary kernel addresses...
   42.76 + 	 */
   42.77 ++#ifdef XEN
   42.78 ++printk("ia64_handle_unaligned: called, not working yet\n");
   42.79 ++#else
   42.80 + 	if (!user_mode(regs))
   42.81 + 		eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
   42.82 + 	if (user_mode(regs) || eh) {
   42.83 +@@ -1353,6 +1377,7 @@ ia64_handle_unaligned (unsigned long ifa
   42.84 + 
   42.85 + 	if (__copy_from_user(bundle, (void __user *) regs->cr_iip, 16))
   42.86 + 		goto failure;
   42.87 ++#endif
   42.88 + 
   42.89 + 	/*
   42.90 + 	 * extract the instruction from the bundle given the slot number
   42.91 +@@ -1493,6 +1518,7 @@ ia64_handle_unaligned (unsigned long ifa
   42.92 + 		/* NOT_REACHED */
   42.93 + 	}
   42.94 +   force_sigbus:
   42.95 ++#ifndef XEN
   42.96 + 	si.si_signo = SIGBUS;
   42.97 + 	si.si_errno = 0;
   42.98 + 	si.si_code = BUS_ADRALN;
   42.99 +@@ -1501,5 +1527,6 @@ ia64_handle_unaligned (unsigned long ifa
  42.100 + 	si.si_isr = 0;
  42.101 + 	si.si_imm = 0;
  42.102 + 	force_sig_info(SIGBUS, &si, current);
  42.103 ++#endif
  42.104 + 	goto done;
  42.105 + }
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/wait.h	Mon Apr 11 21:04:58 2005 +0000
    43.3 @@ -0,0 +1,35 @@
    43.4 + wait.h |    6 ++++++
    43.5 + 1 files changed, 6 insertions(+)
    43.6 +
    43.7 +Index: linux-2.6.11/include/linux/wait.h
    43.8 +===================================================================
    43.9 +--- linux-2.6.11.orig/include/linux/wait.h	2005-03-02 01:38:10.000000000 -0600
   43.10 ++++ linux-2.6.11/include/linux/wait.h	2005-03-19 15:00:23.691156973 -0600
   43.11 +@@ -136,7 +136,11 @@ static inline void __remove_wait_queue(w
   43.12 + 	list_del(&old->task_list);
   43.13 + }
   43.14 + 
   43.15 ++#ifdef XEN
   43.16 ++void FASTCALL(__wake_up(struct task_struct *p));
   43.17 ++#else
   43.18 + void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
   43.19 ++#endif
   43.20 + extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
   43.21 + extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
   43.22 + void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int));
   43.23 +@@ -147,6 +151,7 @@ int FASTCALL(out_of_line_wait_on_bit(voi
   43.24 + int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned));
   43.25 + wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
   43.26 + 
   43.27 ++#ifndef XEN
   43.28 + #define wake_up(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
   43.29 + #define wake_up_nr(x, nr)		__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
   43.30 + #define wake_up_all(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL)
   43.31 +@@ -155,6 +160,7 @@ wait_queue_head_t *FASTCALL(bit_waitqueu
   43.32 + #define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
   43.33 + #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
   43.34 + #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
   43.35 ++#endif
   43.36 + 
   43.37 + #define __wait_event(wq, condition) 					\
   43.38 + do {									\
    44.1 --- a/xen/arch/ia64/tools/mkbuildtree	Mon Apr 11 14:14:40 2005 +0000
    44.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Mon Apr 11 21:04:58 2005 +0000
    44.3 @@ -3,9 +3,8 @@
    44.4  # run in xen-X.X/xen directory after unpacking linux in same directory
    44.5  
    44.6  XEN=$PWD
    44.7 -#LINUX=$XEN/linux-2.6.7
    44.8 -LINUX=$XEN/../../linux-2.6.7
    44.9 -LINUXPATCH=$XEN/arch/ia64/patch/linux-2.6.7
   44.10 +LINUX=$XEN/../../linux-2.6.11
   44.11 +LINUXPATCH=$XEN/arch/ia64/patch/linux-2.6.11
   44.12  XENPATCH=$XEN/arch/ia64/patch/xen-2.0.1
   44.13  
   44.14  cp_patch ()
   44.15 @@ -99,7 +98,7 @@ cp_patch arch/ia64/kernel/vmlinux.lds.S 
   44.16  #cp_patch mm/slab.c arch/ia64/slab.c slab.c
   44.17  
   44.18  # following renamed to avoid conflict
   44.19 -softlink kernel/extable.c arch/ia64/linuxextable.c
   44.20 +cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c
   44.21  
   44.22  cp_patch arch/ia64/mm/contig.c arch/ia64/mm_contig.c mm_contig.c
   44.23  cp_patch arch/ia64/mm/tlb.c arch/ia64/tlb.c tlb.c
   44.24 @@ -151,15 +150,16 @@ softlink arch/ia64/hp/sim/hpsim.S arch/i
   44.25  
   44.26  # xen/include/asm-generic files
   44.27  
   44.28 -softlink include/asm-generic/cpumask_const_value.h include/asm-generic/cpumask_const_value.h cpumask_const_value.h
   44.29 -softlink include/asm-generic/cpumask.h include/asm-generic/cpumask.h cpumask.h
   44.30 -softlink include/asm-generic/cpumask_up.h include/asm-generic/cpumask_up.h cpumask_up.h
   44.31 -softlink include/asm-generic/cpumask_arith.h include/asm-generic/cpumask_arith.h cpumask_arith.h
   44.32 +softlink include/asm-generic/bug.h include/asm-generic/bug.h bug.h
   44.33  softlink include/asm-generic/div64.h include/asm-generic/div64.h div64.h
   44.34 +softlink include/asm-generic/errno.h include/asm-generic/errno.h
   44.35 +softlink include/asm-generic/errno-base.h include/asm-generic/errno-base.h
   44.36  softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h ide_iops.h
   44.37 +softlink include/asm-generic/iomap.h include/asm-generic/iomap.h iomap.h
   44.38  softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h pci-dma-compat.h
   44.39  softlink include/asm-generic/pci.h include/asm-generic/pci.h pci.h
   44.40  softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h pgtable.h
   44.41 +softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h pgtable-nopud.h
   44.42  softlink include/asm-generic/sections.h include/asm-generic/sections.h sections.h
   44.43  softlink include/asm-generic/topology.h include/asm-generic/topology.h topology.h
   44.44  softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vmlinux.lds.h
   44.45 @@ -170,10 +170,12 @@ softlink include/asm-generic/vmlinux.lds
   44.46  cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h
   44.47  
   44.48  cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h
   44.49 -cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h
   44.50 +#cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h
   44.51 +softlink include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h
   44.52  cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h
   44.53 -cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h
   44.54 -cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h
   44.55 +#cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h
   44.56 +softlink include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h
   44.57 +#cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h
   44.58  cp_patch include/asm-ia64/io.h include/asm-ia64/io.h io.h
   44.59  cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h
   44.60  cp_patch include/asm-ia64/kregs.h include/asm-ia64/kregs.h kregs.h
   44.61 @@ -200,11 +202,11 @@ softlink include/asm-ia64/byteorder.h in
   44.62  softlink include/asm-ia64/cacheflush.h include/asm-ia64/cacheflush.h
   44.63  softlink include/asm-ia64/cache.h include/asm-ia64/cache.h
   44.64  softlink include/asm-ia64/checksum.h include/asm-ia64/checksum.h
   44.65 -softlink include/asm-ia64/cpumask.h include/asm-ia64/cpumask.h
   44.66  softlink include/asm-ia64/delay.h include/asm-ia64/delay.h
   44.67  softlink include/asm-ia64/div64.h include/asm-ia64/div64.h
   44.68  softlink include/asm-ia64/dma.h include/asm-ia64/dma.h
   44.69  softlink include/asm-ia64/dma-mapping.h include/asm-ia64/dma-mapping.h
   44.70 +softlink include/asm-ia64/errno.h include/asm-ia64/errno.h
   44.71  softlink include/asm-ia64/fpu.h include/asm-ia64/fpu.h
   44.72  softlink include/asm-ia64/hdreg.h include/asm-ia64/hdreg.h
   44.73  softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
   44.74 @@ -235,6 +237,7 @@ softlink include/asm-ia64/rwsem.h includ
   44.75  softlink include/asm-ia64/scatterlist.h include/asm-ia64/scatterlist.h
   44.76  softlink include/asm-ia64/sections.h include/asm-ia64/sections.h
   44.77  softlink include/asm-ia64/semaphore.h include/asm-ia64/semaphore.h
   44.78 +softlink include/asm-ia64/setup.h include/asm-ia64/setup.h
   44.79  softlink include/asm-ia64/sigcontext.h include/asm-ia64/sigcontext.h
   44.80  softlink include/asm-ia64/signal.h include/asm-ia64/signal.h
   44.81  softlink include/asm-ia64/smp.h include/asm-ia64/smp.h
   44.82 @@ -256,7 +259,12 @@ softlink include/asm-ia64/ustack.h inclu
   44.83  # xen/include/asm-ia64/linux/*.h (== linux/include/linux/*.h)
   44.84  
   44.85  cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h
   44.86 -cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h
   44.87 +cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h
   44.88 +#cp_patch include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h dma-mapping.h
   44.89 +softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h
   44.90 +#cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h
   44.91 +softlink include/linux/efi.h include/asm-ia64/linux/efi.h
   44.92 +cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h
   44.93  #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h
   44.94  cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h
   44.95  cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h
   44.96 @@ -271,8 +279,7 @@ cp_patch include/linux/time.h include/xe
   44.97  softlink include/linux/bcd.h include/asm-ia64/linux/bcd.h
   44.98  softlink include/linux/bitmap.h include/asm-ia64/linux/bitmap.h
   44.99  softlink include/linux/bitops.h include/asm-ia64/linux/bitops.h
  44.100 -softlink include/linux/cpumask.h include/asm-ia64/linux/cpumask.h
  44.101 -softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h
  44.102 +softlink include/linux/err.h include/asm-ia64/linux/err.h
  44.103  softlink include/linux/gfp.h include/asm-ia64/linux/gfp.h
  44.104  softlink include/linux/initrd.h include/asm-ia64/linux/initrd.h
  44.105  softlink include/linux/kmalloc_sizes.h include/asm-ia64/linux/kmalloc_sizes.h
  44.106 @@ -295,6 +302,10 @@ softlink include/linux/tty.h include/asm
  44.107  null include/asm-ia64/linux/file.h
  44.108  null include/asm-ia64/linux/module.h
  44.109  null include/asm-ia64/linux/swap.h
  44.110 +null include/asm-ia64/linux/device.h
  44.111 +null include/asm-ia64/linux/proc_fs.h
  44.112 +null include/asm-ia64/linux/rtc.h
  44.113 +null include/asm-ia64/linux/profile.h
  44.114  
  44.115  softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h
  44.116  softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h
    45.1 --- a/xen/arch/ia64/xenasm.S	Mon Apr 11 14:14:40 2005 +0000
    45.2 +++ b/xen/arch/ia64/xenasm.S	Mon Apr 11 21:04:58 2005 +0000
    45.3 @@ -132,9 +132,9 @@ 1:
    45.4  (p7)	br.cond.sptk	.stack_overlaps
    45.5  	;;
    45.6  	movl r25=PAGE_KERNEL
    45.7 -	dep r20=0,r13,60,4		// physical address of "current"
    45.8 +	dep r21=0,r13,60,4		// physical address of "current"
    45.9  	;;
   45.10 -	or r23=r25,r20			// construct PA | page properties
   45.11 +	or r23=r25,r21			// construct PA | page properties
   45.12  	mov r25=IA64_GRANULE_SHIFT<<2
   45.13  	;;
   45.14  	ptr.d	r13,r25
   45.15 @@ -152,9 +152,9 @@ 1:
   45.16  	;;
   45.17  	movl r25=PAGE_KERNEL
   45.18  	;;
   45.19 -	mov r20=loc2			// saved percpu physical address
   45.20 +	mov r21=loc2			// saved percpu physical address
   45.21  	;;
   45.22 -	or r23=r25,r20			// construct PA | page properties
   45.23 +	or r23=r25,r21			// construct PA | page properties
   45.24  	mov r24=PERCPU_PAGE_SHIFT<<2
   45.25  	;;
   45.26  	ptr.d	r22,r24
   45.27 @@ -172,9 +172,9 @@ 1:
   45.28  	;;
   45.29  	movl r25=PAGE_KERNEL
   45.30  	;;
   45.31 -	mov r20=loc6			// saved vhpt physical address
   45.32 +	mov r21=loc6			// saved vhpt physical address
   45.33  	;;
   45.34 -	or r23=r25,r20			// construct PA | page properties
   45.35 +	or r23=r25,r21			// construct PA | page properties
   45.36  	mov r24=VHPT_PAGE_SHIFT<<2
   45.37  	;;
   45.38  	ptr.d	r22,r24
   45.39 @@ -192,9 +192,9 @@ 1:
   45.40  	;;
   45.41  	movl r25=PAGE_KERNEL
   45.42  	;;
   45.43 -	mov r20=loc5			// saved sharedinfo physical address
   45.44 +	mov r21=loc5			// saved sharedinfo physical address
   45.45  	;;
   45.46 -	or r23=r25,r20			// construct PA | page properties
   45.47 +	or r23=r25,r21			// construct PA | page properties
   45.48  	mov r24=PAGE_SHIFT<<2
   45.49  	;;
   45.50  	ptr.d	r22,r24
    46.1 --- a/xen/arch/ia64/xenmisc.c	Mon Apr 11 14:14:40 2005 +0000
    46.2 +++ b/xen/arch/ia64/xenmisc.c	Mon Apr 11 21:04:58 2005 +0000
    46.3 @@ -93,6 +93,17 @@ int reprogram_ac_timer(s_time_t timeout)
    46.4  DEFINE_PER_CPU(struct page_state, page_states) = {0};
    46.5  unsigned long totalram_pages;
    46.6  
    46.7 +void __mod_page_state(unsigned offset, unsigned long delta)
    46.8 +{
    46.9 +	unsigned long flags;
   46.10 +	void* ptr;
   46.11 +
   46.12 +	local_irq_save(flags);
   46.13 +	ptr = &__get_cpu_var(page_states);
   46.14 +	*(unsigned long*)(ptr + offset) += delta;
   46.15 +	local_irq_restore(flags);
   46.16 +}
   46.17 +
   46.18  ///////////////////////////////
   46.19  // from arch/x86/flushtlb.c
   46.20  ///////////////////////////////
    47.1 --- a/xen/include/asm-ia64/config.h	Mon Apr 11 14:14:40 2005 +0000
    47.2 +++ b/xen/include/asm-ia64/config.h	Mon Apr 11 21:04:58 2005 +0000
    47.3 @@ -40,9 +40,6 @@ typedef int pid_t;
    47.4  #define CLEAR_BITMAP(name,bits) \
    47.5  	memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
    47.6  
    47.7 -// from linux/include/linux/compiler.h
    47.8 -#define __user
    47.9 -
   47.10  // FIXME?: x86-ism used in xen/mm.h
   47.11  #define LOCK_PREFIX
   47.12  
   47.13 @@ -58,6 +55,21 @@ extern char _end[]; /* standard ELF symb
   47.14  
   47.15  // linux/include/linux/compiler.h
   47.16  #define __attribute_const__
   47.17 +#define __user
   47.18 +//#define __kernel
   47.19 +//#define __safe
   47.20 +#define __force
   47.21 +#define __iomem
   47.22 +#define __chk_user_ptr(x) (void)0
   47.23 +//#define __chk_io_ptr(x) (void)0
   47.24 +//#define __builtin_warning(x, y...) (1)
   47.25 +//#define __acquires(x)
   47.26 +//#define __releases(x)
   47.27 +//#define __acquire(x) (void)0
   47.28 +//#define __release(x) (void)0
   47.29 +//#define __cond_lock(x) (x)
   47.30 +#define __must_check
   47.31 +#define __deprecated
   47.32  
   47.33  // xen/include/asm/config.h
   47.34  #define HZ 100
   47.35 @@ -67,6 +79,9 @@ extern char _end[]; /* standard ELF symb
   47.36  //#define CONFIG_NR_CPUS 16
   47.37  #define barrier() __asm__ __volatile__("": : :"memory")
   47.38  
   47.39 +// linux/include/spinlock.h
   47.40 +#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
   47.41 +
   47.42  ///////////////////////////////////////////////////////////////
   47.43  // xen/include/asm/config.h
   47.44  // Natural boundary upon TR size to define xenheap space
    48.1 --- a/xen/include/asm-ia64/mm.h	Mon Apr 11 14:14:40 2005 +0000
    48.2 +++ b/xen/include/asm-ia64/mm.h	Mon Apr 11 21:04:58 2005 +0000
    48.3 @@ -25,25 +25,6 @@
    48.4  
    48.5  typedef unsigned long page_flags_t;
    48.6  
    48.7 -// from linux/include/linux/mm.h
    48.8 -
    48.9 -extern pmd_t *FASTCALL(__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address));
   48.10 -extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
   48.11 -extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
   48.12 -
   48.13 -/*
   48.14 - * On a two-level page table, this ends up being trivial. Thus the
   48.15 - * inlining and the symmetry break with pte_alloc_map() that does all
   48.16 - * of this out-of-line.
   48.17 - */
   48.18 -static inline pmd_t *pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
   48.19 -{
   48.20 -	if (pgd_none(*pgd))
   48.21 -		return __pmd_alloc(mm, pgd, address);
   48.22 -	return pmd_offset(pgd, address);
   48.23 -}
   48.24 -
   48.25 -
   48.26  /*
   48.27   * Per-page-frame information.
   48.28   */