ia64/xen-unstable

changeset 4577:58efb3448933

bitkeeper revision 1.1327.1.1 (426536d2PUqtjTi2v06bzD10RFwarg)

Merge bk://xen.bkbits.net/xeno-unstable.bk
into bkbits.net:/repos/x/xen-ia64/xeno-unstable-ia64.bk
author xen-ia64.adm@bkbits.net
date Tue Apr 19 16:50:26 2005 +0000 (2005-04-19)
parents dfe18db08708 c7e94658f623
children 1dd9ce40afca
files .rootkeys xen/arch/ia64/Makefile xen/arch/ia64/Rules.mk xen/arch/ia64/acpi.c xen/arch/ia64/domain.c xen/arch/ia64/hypercall.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/privop.c xen/arch/ia64/process.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/vcpu.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenmisc.c xen/include/asm-ia64/config.h xen/include/asm-ia64/domain.h xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/.rootkeys	Tue Apr 19 13:48:05 2005 +0000
     1.2 +++ b/.rootkeys	Tue Apr 19 16:50:26 2005 +0000
     1.3 @@ -1080,6 +1080,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/Makefile	Tue Apr 19 13:48:05 2005 +0000
     2.2 +++ b/xen/arch/ia64/Makefile	Tue Apr 19 16:50:26 2005 +0000
     2.3 @@ -18,19 +18,11 @@ OBJS := $(subst $(TARGET_ARCH)/asm-offse
     2.4  # remove following line if not privifying in memory
     2.5  # OBJS += privify.o
     2.6  
     2.7 -# What happens here? We link monitor object files together, starting
     2.8 -# at MONITOR_BASE (a very high address). But bootloader cannot put
     2.9 -# things there, so we initially load at LOAD_BASE. A hacky little
    2.10 -# tool called `elf-reloc' is used to modify segment offsets from
    2.11 -# MONITOR_BASE-relative to LOAD_BASE-relative.
    2.12 -# (NB. Linux gets round this by turning its image into raw binary, then 
    2.13 -# wrapping that with a low-memory bootstrapper.)
    2.14  default: $(OBJS) head.o ia64lib.o xen.lds.s
    2.15  	$(LD) -r -o arch.o $(OBJS) ia64lib.o
    2.16  	$(LD) $(LDFLAGS) -T $(BASEDIR)/arch/$(TARGET_ARCH)/xen.lds.s -N \
    2.17  		-Map map.out head.o $(ALL_OBJS) -o $(TARGET)-syms
    2.18  	$(OBJCOPY) -R .note -R .comment -S $(TARGET)-syms $(TARGET)
    2.19 -#	$(BASEDIR)/tools/elf-reloc $(MONITOR_BASE) $(LOAD_BASE) $(TARGET)
    2.20  
    2.21  asm-offsets.s: asm-offsets.c
    2.22  	$(CC) $(CFLAGS) -S -o $@ $<
    2.23 @@ -45,7 +37,7 @@ ia64lib.o:
    2.24  
    2.25  clean:
    2.26  	rm -f *.o *~ core  xen.lds.s $(BASEDIR)/include/asm-ia64/.offsets.h.stamp
    2.27 -	$(MAKE) -C lib clean
    2.28 +	rm -f lib/*.o
    2.29  
    2.30  # setup.o contains bits of compile.h so it must be blown away
    2.31  delete-unfresh-files:
     3.1 --- a/xen/arch/ia64/Rules.mk	Tue Apr 19 13:48:05 2005 +0000
     3.2 +++ b/xen/arch/ia64/Rules.mk	Tue Apr 19 16:50:26 2005 +0000
     3.3 @@ -1,33 +1,20 @@
     3.4  ########################################
     3.5 -# x86-specific definitions
     3.6 +# ia64-specific definitions
     3.7  
     3.8 -ifeq ($(COMPILE_ARCH),$(TARGET_ARCH))
     3.9 -OBJCOPY = objcopy
    3.10 -endif
    3.11  ifneq ($(COMPILE_ARCH),$(TARGET_ARCH))
    3.12 -CC = /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-gcc
    3.13 -LD = /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-ld
    3.14 -OBJCOPY = /usr/local/sp_env/v2.2/i686/bin/ia64-unknown-linux-objcopy
    3.15 +CROSS_COMPILE ?= /usr/local/sp_env/v2.2.5/i686/bin/ia64-unknown-linux-
    3.16  endif
    3.17 -HOSTCC := gcc
    3.18 -#LD := ld
    3.19 -# Linker should relocate monitor to this address
    3.20 -MONITOR_BASE := 0xFC500000
    3.21 -# Bootloader should load monitor to this real address
    3.22 -LOAD_BASE    := 0x00100000
    3.23  AFLAGS  += -D__ASSEMBLY__
    3.24  CPPFLAGS  += -I$(BASEDIR)/include -I$(BASEDIR)/include/asm-ia64
    3.25  CFLAGS  := -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
    3.26  #CFLAGS  += -O3		# -O3 over-inlines making debugging tough!
    3.27  CFLAGS  += -O2		# but no optimization causes compile errors!
    3.28 -CFLAGS  += -iwithprefix include -Wall -DMONITOR_BASE=$(MONITOR_BASE)
    3.29 +#CFLAGS  += -iwithprefix include -Wall -DMONITOR_BASE=$(MONITOR_BASE)
    3.30 +CFLAGS  += -iwithprefix include -Wall
    3.31  CFLAGS  += -fomit-frame-pointer -I$(BASEDIR)/include -D__KERNEL__
    3.32  CFLAGS  += -I$(BASEDIR)/include/asm-ia64
    3.33  CFLAGS  += -Wno-pointer-arith -Wredundant-decls
    3.34  CFLAGS  += -DIA64 -DXEN -DLINUX_2_6
    3.35  CFLAGS	+= -ffixed-r13 -mfixed-range=f12-f15,f32-f127
    3.36  CFLAGS	+= -w -g
    3.37 -#TARGET_CPU := i686
    3.38 -#CFLAGS += -march=$(TARGET_CPU)
    3.39 -#LDARCHFLAGS := --oformat elf32-i386 
    3.40  LDFLAGS := -g
     4.1 --- a/xen/arch/ia64/acpi.c	Tue Apr 19 13:48:05 2005 +0000
     4.2 +++ b/xen/arch/ia64/acpi.c	Tue Apr 19 16:50:26 2005 +0000
     4.3 @@ -57,7 +57,7 @@ int acpi_ioapic = 0;
     4.4     -------------------------------------------------------------------------- */
     4.5  
     4.6  #ifdef CONFIG_ACPI_BOOT
     4.7 -int acpi_noirq __initdata = 0;  /* skip ACPI IRQ initialization */
     4.8 +//int acpi_noirq __initdata = 0;  /* skip ACPI IRQ initialization */
     4.9  int acpi_ht __initdata = 1;     /* enable HT */
    4.10  
    4.11  enum acpi_irq_model_id		acpi_irq_model;
     5.1 --- a/xen/arch/ia64/domain.c	Tue Apr 19 13:48:05 2005 +0000
     5.2 +++ b/xen/arch/ia64/domain.c	Tue Apr 19 16:50:26 2005 +0000
     5.3 @@ -258,8 +258,8 @@ void new_thread(struct exec_domain *ed,
     5.4  	sw->ar_pfs = 0;
     5.5  	sw->ar_bspstore = new_rbs;
     5.6  	//regs->r13 = (unsigned long) ed;
     5.7 -printf("new_thread: ed=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n",
     5.8 -ed,regs,sw,new_rbs,IA64_STK_OFFSET,&regs->r8);
     5.9 +printf("new_thread: ed=%p, start_pc=%p, regs=%p, sw=%p, new_rbs=%p, IA64_STK_OFFSET=%p, &r8=%p\n",
    5.10 +ed,start_pc,regs,sw,new_rbs,IA64_STK_OFFSET,&regs->r8);
    5.11  	sw->b0 = (unsigned long) &ia64_ret_from_clone;
    5.12  	ed->thread.ksp = (unsigned long) sw - 16;
    5.13  	//ed->thread_info->flags = 0;
    5.14 @@ -289,6 +289,7 @@ struct page * map_new_domain_page(struct
    5.15  	struct mm_struct *mm = d->arch.mm;
    5.16  	struct page *p = (struct page *)0;
    5.17  	pgd_t *pgd;
    5.18 +	pud_t *pud;
    5.19  	pmd_t *pmd;
    5.20  	pte_t *pte;
    5.21  extern unsigned long vhpt_paddr, vhpt_pend;
    5.22 @@ -299,9 +300,13 @@ extern unsigned long vhpt_paddr, vhpt_pe
    5.23  	}
    5.24  	pgd = pgd_offset(mm,mpaddr);
    5.25  	if (pgd_none(*pgd))
    5.26 -		pgd_populate(mm, pgd, pmd_alloc_one(mm,mpaddr));
    5.27 +		pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr));
    5.28  
    5.29 -	pmd = pmd_offset(pgd, mpaddr);
    5.30 +	pud = pud_offset(pgd, mpaddr);
    5.31 +	if (pud_none(*pud))
    5.32 +		pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr));
    5.33 +
    5.34 +	pmd = pmd_offset(pud, mpaddr);
    5.35  	if (pmd_none(*pmd))
    5.36  		pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
    5.37  //		pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
    5.38 @@ -338,6 +343,7 @@ unsigned long lookup_domain_mpa(struct d
    5.39  {
    5.40  	struct mm_struct *mm = d->arch.mm;
    5.41  	pgd_t *pgd = pgd_offset(mm, mpaddr);
    5.42 +	pud_t *pud;
    5.43  	pmd_t *pmd;
    5.44  	pte_t *pte;
    5.45  
    5.46 @@ -356,14 +362,17 @@ unsigned long lookup_domain_mpa(struct d
    5.47  #endif
    5.48  tryagain:
    5.49  	if (pgd_present(*pgd)) {
    5.50 -		pmd = pmd_offset(pgd,mpaddr);
    5.51 -		if (pmd_present(*pmd)) {
    5.52 -			pte = pte_offset_map(pmd,mpaddr);
    5.53 -			if (pte_present(*pte)) {
    5.54 +		pud = pud_offset(pgd,mpaddr);
    5.55 +		if (pud_present(*pud)) {
    5.56 +			pmd = pmd_offset(pud,mpaddr);
    5.57 +			if (pmd_present(*pmd)) {
    5.58 +				pte = pte_offset_map(pmd,mpaddr);
    5.59 +				if (pte_present(*pte)) {
    5.60  //printk("lookup_domain_page: found mapping for %lx, pte=%lx\n",mpaddr,pte_val(*pte));
    5.61 -				return *(unsigned long *)pte;
    5.62 +					return *(unsigned long *)pte;
    5.63 +				}
    5.64  			}
    5.65 -		}	
    5.66 +		}
    5.67  	}
    5.68  	/* if lookup fails and mpaddr is "legal", "create" the page */
    5.69  	if ((mpaddr >> PAGE_SHIFT) < d->max_pages) {
    5.70 @@ -428,6 +437,7 @@ void loaddomainelfimage(struct domain *d
    5.71  	int h, filesz, memsz, paddr;
    5.72  	unsigned long elfaddr, dom_mpaddr, dom_imva;
    5.73  	struct page *p;
    5.74 +	unsigned long pteval;
    5.75    
    5.76  	copy_memory(&ehdr,image_start,sizeof(Elf_Ehdr));
    5.77  	for ( h = 0; h < ehdr.e_phnum; h++ ) {
    5.78 @@ -456,9 +466,15 @@ void loaddomainelfimage(struct domain *d
    5.79  	else
    5.80  #endif
    5.81  	while (memsz > 0) {
    5.82 +#ifdef DOMU_AUTO_RESTART
    5.83 +		pteval = lookup_domain_mpa(d,dom_mpaddr);
    5.84 +		if (pteval) dom_imva = __va(pteval & _PFN_MASK);
    5.85 +		else { printf("loaddomainelfimage: BAD!\n"); while(1); }
    5.86 +#else
    5.87  		p = map_new_domain_page(d,dom_mpaddr);
    5.88  		if (unlikely(!p)) BUG();
    5.89  		dom_imva = __va(page_to_phys(p));
    5.90 +#endif
    5.91  		if (filesz > 0) {
    5.92  			if (filesz >= PAGE_SIZE)
    5.93  				copy_memory(dom_imva,elfaddr,PAGE_SIZE);
    5.94 @@ -774,7 +790,9 @@ int construct_domU(struct domain *d,
    5.95  	struct exec_domain *ed = d->exec_domain[0];
    5.96  	unsigned long pkern_entry;
    5.97  
    5.98 +#ifndef DOMU_AUTO_RESTART
    5.99  	if ( test_bit(DF_CONSTRUCTED, &d->d_flags) ) BUG();
   5.100 +#endif
   5.101  
   5.102  	printk("*** LOADING DOMAIN %d ***\n",d->id);
   5.103  
   5.104 @@ -808,7 +826,12 @@ int construct_domU(struct domain *d,
   5.105  
   5.106  	set_bit(DF_CONSTRUCTED, &d->d_flags);
   5.107  
   5.108 -	printk("calling new_thread\n");
   5.109 +	printk("calling new_thread, entry=%p\n",pkern_entry);
   5.110 +#ifdef DOMU_AUTO_RESTART
   5.111 +	ed->domain->arch.image_start = image_start;
   5.112 +	ed->domain->arch.image_len = image_len;
   5.113 +	ed->domain->arch.entry = pkern_entry;
   5.114 +#endif
   5.115  	new_thread(ed, pkern_entry, 0, 0);
   5.116  	printk("new_thread returns\n");
   5.117  	__set_bit(0x30,ed->vcpu_info->arch.delivery_mask);
   5.118 @@ -816,6 +839,17 @@ int construct_domU(struct domain *d,
   5.119  	return 0;
   5.120  }
   5.121  
   5.122 +#ifdef DOMU_AUTO_RESTART
   5.123 +void reconstruct_domU(struct exec_domain *ed)
   5.124 +{
   5.125 +	/* re-copy the OS image to reset data values to original */
   5.126 +	printk("reconstruct_domU: restarting domain %d...\n",
   5.127 +		ed->domain->id);
   5.128 +	loaddomainelfimage(ed->domain,ed->domain->arch.image_start);
   5.129 +	new_thread(ed, ed->domain->arch.entry, 0, 0);
   5.130 +}
   5.131 +#endif
   5.132 +
   5.133  // FIXME: When dom0 can construct domains, this goes away (or is rewritten)
   5.134  int launch_domainU(unsigned long size)
   5.135  {
     6.1 --- a/xen/arch/ia64/hypercall.c	Tue Apr 19 13:48:05 2005 +0000
     6.2 +++ b/xen/arch/ia64/hypercall.c	Tue Apr 19 16:50:26 2005 +0000
     6.3 @@ -21,7 +21,7 @@ extern struct ia64_sal_retval sal_emulat
     6.4  
     6.5  void fooefi(void) {}
     6.6  
     6.7 -void
     6.8 +int
     6.9  ia64_hypercall (struct pt_regs *regs)
    6.10  {
    6.11  	struct exec_domain *ed = (struct domain *) current;
    6.12 @@ -50,8 +50,15 @@ ia64_hypercall (struct pt_regs *regs)
    6.13  			printf("(by dom0)\n ");
    6.14  			(*efi.reset_system)(EFI_RESET_WARM,0,0,NULL);
    6.15  		}
    6.16 +#ifdef DOMU_AUTO_RESTART
    6.17 +		else {
    6.18 +			reconstruct_domU(current);
    6.19 +			return 0;  // don't increment ip!
    6.20 +		}
    6.21 +#else	
    6.22  		printf("(not supported for non-0 domain)\n");
    6.23  		regs->r8 = EFI_UNSUPPORTED;
    6.24 +#endif
    6.25  		break;
    6.26  	    case FW_HYPERCALL_EFI_GET_TIME:
    6.27  		fooefi();
    6.28 @@ -105,4 +112,5 @@ ia64_hypercall (struct pt_regs *regs)
    6.29  		regs->r8 = domU_staging_read_8(vcpu_get_gr(ed,32));
    6.30  		break;
    6.31  	}
    6.32 +	return 1;
    6.33  }
     7.1 --- a/xen/arch/ia64/irq.c	Tue Apr 19 13:48:05 2005 +0000
     7.2 +++ b/xen/arch/ia64/irq.c	Tue Apr 19 16:50:26 2005 +0000
     7.3 @@ -492,101 +492,101 @@ EXPORT_SYMBOL(enable_irq);
     7.4   * SMP cross-CPU interrupts have their own specific
     7.5   * handlers).
     7.6   */
     7.7 -unsigned int do_IRQ(unsigned long irq, struct pt_regs *regs)
     7.8 +fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs)
     7.9  {
    7.10 -	/*
    7.11 -	 * We ack quickly, we don't want the irq controller
    7.12 -	 * thinking we're snobs just because some other CPU has
    7.13 -	 * disabled global interrupts (we have already done the
    7.14 -	 * INT_ACK cycles, it's too late to try to pretend to the
    7.15 -	 * controller that we aren't taking the interrupt).
    7.16 -	 *
    7.17 -	 * 0 return value means that this irq is already being
    7.18 -	 * handled by some other CPU. (or is disabled)
    7.19 -	 */
    7.20 -	irq_desc_t *desc = irq_descp(irq);
    7.21 +	irq_desc_t *desc = irq_desc + irq;
    7.22  	struct irqaction * action;
    7.23 -	irqreturn_t action_ret;
    7.24  	unsigned int status;
    7.25 -	int cpu;
    7.26 -
    7.27 -	cpu = smp_processor_id(); /* for CONFIG_PREEMPT, this must come after irq_enter()! */
    7.28  
    7.29  #ifndef XEN
    7.30 -	kstat_cpu(cpu).irqs[irq]++;
    7.31 +	kstat_this_cpu.irqs[irq]++;
    7.32  #endif
    7.33 -
    7.34  	if (desc->status & IRQ_PER_CPU) {
    7.35 -		/* no locking required for CPU-local interrupts: */
    7.36 -		desc->handler->ack(irq);
    7.37 -		action_ret = handle_IRQ_event(irq, regs, desc->action);
    7.38 -		desc->handler->end(irq);
    7.39 -	} else {
    7.40 -		spin_lock(&desc->lock);
    7.41 -		desc->handler->ack(irq);
    7.42 -		/*
    7.43 -		 * REPLAY is when Linux resends an IRQ that was dropped earlier
    7.44 -		 * WAITING is used by probe to mark irqs that are being tested
    7.45 -		 */
    7.46 -#ifdef XEN
    7.47 -		status = desc->status & ~IRQ_REPLAY;
    7.48 -#else
    7.49 -		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
    7.50 -#endif
    7.51 -		status |= IRQ_PENDING; /* we _want_ to handle it */
    7.52 +		irqreturn_t action_ret;
    7.53  
    7.54  		/*
    7.55 -		 * If the IRQ is disabled for whatever reason, we cannot
    7.56 -		 * use the action we have.
    7.57 +		 * No locking required for CPU-local interrupts:
    7.58  		 */
    7.59 -		action = NULL;
    7.60 -		if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
    7.61 -			action = desc->action;
    7.62 -			status &= ~IRQ_PENDING; /* we commit to handling */
    7.63 -			status |= IRQ_INPROGRESS; /* we are handling it */
    7.64 -		}
    7.65 -		desc->status = status;
    7.66 +		desc->handler->ack(irq);
    7.67 +		action_ret = handle_IRQ_event(irq, regs, desc->action);
    7.68 +#ifndef XEN
    7.69 +		if (!noirqdebug)
    7.70 +			note_interrupt(irq, desc, action_ret);
    7.71 +#endif
    7.72 +		desc->handler->end(irq);
    7.73 +		return 1;
    7.74 +	}
    7.75  
    7.76 -		/*
    7.77 -		 * If there is no IRQ handler or it was disabled, exit early.
    7.78 -		 * Since we set PENDING, if another processor is handling
    7.79 -		 * a different instance of this same irq, the other processor
    7.80 -		 * will take care of it.
    7.81 -		 */
    7.82 -		if (unlikely(!action))
    7.83 -			goto out;
    7.84 +	spin_lock(&desc->lock);
    7.85 +	desc->handler->ack(irq);
    7.86 +	/*
    7.87 +	 * REPLAY is when Linux resends an IRQ that was dropped earlier
    7.88 +	 * WAITING is used by probe to mark irqs that are being tested
    7.89 +	 */
    7.90 +#ifdef XEN
    7.91 +	status = desc->status & ~IRQ_REPLAY;
    7.92 +#else
    7.93 +	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
    7.94 +#endif
    7.95 +	status |= IRQ_PENDING; /* we _want_ to handle it */
    7.96 +
    7.97 +	/*
    7.98 +	 * If the IRQ is disabled for whatever reason, we cannot
    7.99 +	 * use the action we have.
   7.100 +	 */
   7.101 +	action = NULL;
   7.102 +	if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
   7.103 +		action = desc->action;
   7.104 +		status &= ~IRQ_PENDING; /* we commit to handling */
   7.105 +		status |= IRQ_INPROGRESS; /* we are handling it */
   7.106 +	}
   7.107 +	desc->status = status;
   7.108  
   7.109 -		/*
   7.110 -		 * Edge triggered interrupts need to remember
   7.111 -		 * pending events.
   7.112 -		 * This applies to any hw interrupts that allow a second
   7.113 -		 * instance of the same irq to arrive while we are in do_IRQ
   7.114 -		 * or in the handler. But the code here only handles the _second_
   7.115 -		 * instance of the irq, not the third or fourth. So it is mostly
   7.116 -		 * useful for irq hardware that does not mask cleanly in an
   7.117 -		 * SMP environment.
   7.118 -		 */
   7.119 -		for (;;) {
   7.120 -			spin_unlock(&desc->lock);
   7.121 -			action_ret = handle_IRQ_event(irq, regs, action);
   7.122 -			spin_lock(&desc->lock);
   7.123 +	/*
   7.124 +	 * If there is no IRQ handler or it was disabled, exit early.
   7.125 +	 * Since we set PENDING, if another processor is handling
   7.126 +	 * a different instance of this same irq, the other processor
   7.127 +	 * will take care of it.
   7.128 +	 */
   7.129 +	if (unlikely(!action))
   7.130 +		goto out;
   7.131 +
   7.132 +	/*
   7.133 +	 * Edge triggered interrupts need to remember
   7.134 +	 * pending events.
   7.135 +	 * This applies to any hw interrupts that allow a second
   7.136 +	 * instance of the same irq to arrive while we are in do_IRQ
   7.137 +	 * or in the handler. But the code here only handles the _second_
   7.138 +	 * instance of the irq, not the third or fourth. So it is mostly
   7.139 +	 * useful for irq hardware that does not mask cleanly in an
   7.140 +	 * SMP environment.
   7.141 +	 */
   7.142 +	for (;;) {
   7.143 +		irqreturn_t action_ret;
   7.144 +
   7.145 +		spin_unlock(&desc->lock);
   7.146 +
   7.147 +		action_ret = handle_IRQ_event(irq, regs, action);
   7.148 +
   7.149 +		spin_lock(&desc->lock);
   7.150  #ifndef XEN
   7.151 -			if (!noirqdebug)
   7.152 -				note_interrupt(irq, desc, action_ret);
   7.153 +		if (!noirqdebug)
   7.154 +			note_interrupt(irq, desc, action_ret);
   7.155  #endif
   7.156 -			if (!(desc->status & IRQ_PENDING))
   7.157 -				break;
   7.158 -			desc->status &= ~IRQ_PENDING;
   7.159 -		}
   7.160 -		desc->status &= ~IRQ_INPROGRESS;
   7.161 -	  out:
   7.162 -		/*
   7.163 -		 * The ->end() handler has to deal with interrupts which got
   7.164 -		 * disabled while the handler was running.
   7.165 -		 */
   7.166 -		desc->handler->end(irq);
   7.167 -		spin_unlock(&desc->lock);
   7.168 +		if (likely(!(desc->status & IRQ_PENDING)))
   7.169 +			break;
   7.170 +		desc->status &= ~IRQ_PENDING;
   7.171  	}
   7.172 +	desc->status &= ~IRQ_INPROGRESS;
   7.173 +
   7.174 +out:
   7.175 +	/*
   7.176 +	 * The ->end() handler has to deal with interrupts which got
   7.177 +	 * disabled while the handler was running.
   7.178 +	 */
   7.179 +	desc->handler->end(irq);
   7.180 +	spin_unlock(&desc->lock);
   7.181 +
   7.182  	return 1;
   7.183  }
   7.184  
     8.1 --- a/xen/arch/ia64/mm_init.c	Tue Apr 19 13:48:05 2005 +0000
     8.2 +++ b/xen/arch/ia64/mm_init.c	Tue Apr 19 16:50:26 2005 +0000
     8.3 @@ -102,6 +102,39 @@ void insert_vm_struct(struct mm_struct *
     8.4  /////////////////////////////////////////////
     8.5  //following from linux/mm/memory.c
     8.6  
     8.7 +#ifndef __ARCH_HAS_4LEVEL_HACK
     8.8 +/*
     8.9 + * Allocate page upper directory.
    8.10 + *
    8.11 + * We've already handled the fast-path in-line, and we own the
    8.12 + * page table lock.
    8.13 + *
    8.14 + * On a two-level or three-level page table, this ends up actually being
    8.15 + * entirely optimized away.
    8.16 + */
    8.17 +pud_t fastcall *__pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
    8.18 +{
    8.19 +	pud_t *new;
    8.20 +
    8.21 +	spin_unlock(&mm->page_table_lock);
    8.22 +	new = pud_alloc_one(mm, address);
    8.23 +	spin_lock(&mm->page_table_lock);
    8.24 +	if (!new)
    8.25 +		return NULL;
    8.26 +
    8.27 +	/*
    8.28 +	 * Because we dropped the lock, we should re-check the
    8.29 +	 * entry, as somebody else could have populated it..
    8.30 +	 */
    8.31 +	if (pgd_present(*pgd)) {
    8.32 +		pud_free(new);
    8.33 +		goto out;
    8.34 +	}
    8.35 +	pgd_populate(mm, pgd, new);
    8.36 + out:
    8.37 +	return pud_offset(pgd, address);
    8.38 +}
    8.39 +
    8.40  /*
    8.41   * Allocate page middle directory.
    8.42   *
    8.43 @@ -111,7 +144,7 @@ void insert_vm_struct(struct mm_struct *
    8.44   * On a two-level page table, this ends up actually being entirely
    8.45   * optimized away.
    8.46   */
    8.47 -pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
    8.48 +pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
    8.49  {
    8.50  	pmd_t *new;
    8.51  
    8.52 @@ -125,14 +158,15 @@ pmd_t fastcall *__pmd_alloc(struct mm_st
    8.53  	 * Because we dropped the lock, we should re-check the
    8.54  	 * entry, as somebody else could have populated it..
    8.55  	 */
    8.56 -	if (pgd_present(*pgd)) {
    8.57 +	if (pud_present(*pud)) {
    8.58  		pmd_free(new);
    8.59  		goto out;
    8.60  	}
    8.61 -	pgd_populate(mm, pgd, new);
    8.62 -out:
    8.63 -	return pmd_offset(pgd, address);
    8.64 +	pud_populate(mm, pud, new);
    8.65 + out:
    8.66 +	return pmd_offset(pud, address);
    8.67  }
    8.68 +#endif
    8.69  
    8.70  pte_t fastcall * pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address)
    8.71  {
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/bootmem.h	Tue Apr 19 16:50:26 2005 +0000
     9.3 @@ -0,0 +1,17 @@
     9.4 + bootmem.h |    2 ++
     9.5 + 1 files changed, 2 insertions(+)
     9.6 +
     9.7 +Index: linux-2.6.11/include/linux/bootmem.h
     9.8 +===================================================================
     9.9 +--- linux-2.6.11.orig/include/linux/bootmem.h	2005-03-02 01:38:25.000000000 -0600
    9.10 ++++ linux-2.6.11/include/linux/bootmem.h	2005-03-19 12:39:36.915887729 -0600
    9.11 +@@ -41,7 +41,9 @@ extern unsigned long __init init_bootmem
    9.12 + extern void __init free_bootmem (unsigned long addr, unsigned long size);
    9.13 + extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
    9.14 + #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
    9.15 ++#ifndef XEN
    9.16 + extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
    9.17 ++#endif
    9.18 + #define alloc_bootmem(x) \
    9.19 + 	__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
    9.20 + #define alloc_bootmem_low(x) \
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/cpumask.h	Tue Apr 19 16:50:26 2005 +0000
    10.3 @@ -0,0 +1,20 @@
    10.4 + cpumask.h |    2 +-
    10.5 + 1 files changed, 1 insertion(+), 1 deletion(-)
    10.6 +
    10.7 +Index: linux-2.6.11-xendiffs/include/linux/cpumask.h
    10.8 +===================================================================
    10.9 +--- linux-2.6.11-xendiffs.orig/include/linux/cpumask.h	2005-03-02 01:38:00.000000000 -0600
   10.10 ++++ linux-2.6.11-xendiffs/include/linux/cpumask.h	2005-03-24 15:06:18.408145243 -0600
   10.11 +@@ -341,11 +341,11 @@ static inline int __cpumask_parse(const 
   10.12 +  *        main(){ set1(3); set2(5); }
   10.13 +  */
   10.14 + 
   10.15 ++#if NR_CPUS > 1
   10.16 + extern cpumask_t cpu_possible_map;
   10.17 + extern cpumask_t cpu_online_map;
   10.18 + extern cpumask_t cpu_present_map;
   10.19 + 
   10.20 +-#if NR_CPUS > 1
   10.21 + #define num_online_cpus()	cpus_weight(cpu_online_map)
   10.22 + #define num_possible_cpus()	cpus_weight(cpu_possible_map)
   10.23 + #define num_present_cpus()	cpus_weight(cpu_present_map)
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/current.h	Tue Apr 19 16:50:26 2005 +0000
    11.3 @@ -0,0 +1,22 @@
    11.4 + current.h |    8 ++++++++
    11.5 + 1 files changed, 8 insertions(+)
    11.6 +
    11.7 +Index: linux-2.6.11/include/asm-ia64/current.h
    11.8 +===================================================================
    11.9 +--- linux-2.6.11.orig/include/asm-ia64/current.h	2005-03-02 01:38:19.000000000 -0600
   11.10 ++++ linux-2.6.11/include/asm-ia64/current.h	2005-03-19 12:39:41.410955288 -0600
   11.11 +@@ -12,6 +12,14 @@
   11.12 +  * In kernel mode, thread pointer (r13) is used to point to the current task
   11.13 +  * structure.
   11.14 +  */
   11.15 ++#ifdef XEN
   11.16 ++struct domain;
   11.17 ++#define get_current()	((struct exec_domain *) ia64_getreg(_IA64_REG_TP))
   11.18 ++#define current get_current()
   11.19 ++//#define set_current(d)	ia64_setreg(_IA64_REG_TP,(void *)d);
   11.20 ++#define set_current(d)		(ia64_r13 = (void *)d)
   11.21 ++#else
   11.22 + #define current	((struct task_struct *) ia64_getreg(_IA64_REG_TP))
   11.23 ++#endif
   11.24 + 
   11.25 + #endif /* _ASM_IA64_CURRENT_H */
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/efi.c	Tue Apr 19 16:50:26 2005 +0000
    12.3 @@ -0,0 +1,67 @@
    12.4 + efi.c |   32 ++++++++++++++++++++++++++++++++
    12.5 + 1 files changed, 32 insertions(+)
    12.6 +
    12.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c
    12.8 +===================================================================
    12.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/efi.c	2005-04-07 12:22:08.230781400 -0500
   12.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/efi.c	2005-04-07 12:25:11.875195997 -0500
   12.11 +@@ -25,6 +25,9 @@
   12.12 + #include <linux/types.h>
   12.13 + #include <linux/time.h>
   12.14 + #include <linux/efi.h>
   12.15 ++#ifdef XEN
   12.16 ++#include <xen/sched.h>
   12.17 ++#endif
   12.18 + 
   12.19 + #include <asm/io.h>
   12.20 + #include <asm/kregs.h>
   12.21 +@@ -218,6 +221,7 @@ efi_gettimeofday (struct timespec *ts)
   12.22 + 	if ((*efi.get_time)(&tm, NULL) != EFI_SUCCESS)
   12.23 + 		return;
   12.24 + 
   12.25 ++	dummy();
   12.26 + 	ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second);
   12.27 + 	ts->tv_nsec = tm.nanosecond;
   12.28 + }
   12.29 +@@ -320,6 +324,10 @@ efi_memmap_walk (efi_freemem_callback_t 
   12.30 + 		if (!(md->attribute & EFI_MEMORY_WB))
   12.31 + 			continue;
   12.32 + 
   12.33 ++#ifdef XEN
   12.34 ++// this is a temporary hack to avoid CONFIG_VIRTUAL_MEM_MAP
   12.35 ++		if (md->phys_addr >= 0x100000000) continue;
   12.36 ++#endif
   12.37 + 		/*
   12.38 + 		 * granule_addr is the base of md's first granule.
   12.39 + 		 * [granule_addr - first_non_wb_addr) is guaranteed to
   12.40 +@@ -719,6 +727,30 @@ efi_get_iobase (void)
   12.41 + 	return 0;
   12.42 + }
   12.43 + 
   12.44 ++#ifdef XEN
   12.45 ++// variation of efi_get_iobase which returns entire memory descriptor
   12.46 ++efi_memory_desc_t *
   12.47 ++efi_get_io_md (void)
   12.48 ++{
   12.49 ++	void *efi_map_start, *efi_map_end, *p;
   12.50 ++	efi_memory_desc_t *md;
   12.51 ++	u64 efi_desc_size;
   12.52 ++
   12.53 ++	efi_map_start = __va(ia64_boot_param->efi_memmap);
   12.54 ++	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
   12.55 ++	efi_desc_size = ia64_boot_param->efi_memdesc_size;
   12.56 ++
   12.57 ++	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
   12.58 ++		md = p;
   12.59 ++		if (md->type == EFI_MEMORY_MAPPED_IO_PORT_SPACE) {
   12.60 ++			if (md->attribute & EFI_MEMORY_UC)
   12.61 ++				return md;
   12.62 ++		}
   12.63 ++	}
   12.64 ++	return 0;
   12.65 ++}
   12.66 ++#endif
   12.67 ++
   12.68 + u32
   12.69 + efi_mem_type (unsigned long phys_addr)
   12.70 + {
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/entry.S	Tue Apr 19 16:50:26 2005 +0000
    13.3 @@ -0,0 +1,202 @@
    13.4 + entry.S |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
    13.5 + 1 files changed, 85 insertions(+), 1 deletion(-)
    13.6 +
    13.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S
    13.8 +===================================================================
    13.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/entry.S	2005-04-08 13:32:07.636308237 -0500
   13.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/entry.S	2005-04-08 13:37:04.612542509 -0500
   13.11 +@@ -35,7 +35,9 @@
   13.12 + 
   13.13 + #include <asm/asmmacro.h>
   13.14 + #include <asm/cache.h>
   13.15 ++#ifndef XEN
   13.16 + #include <asm/errno.h>
   13.17 ++#endif
   13.18 + #include <asm/kregs.h>
   13.19 + #include <asm/offsets.h>
   13.20 + #include <asm/pgtable.h>
   13.21 +@@ -46,6 +48,25 @@
   13.22 + 
   13.23 + #include "minstate.h"
   13.24 + 
   13.25 ++#ifdef XEN
   13.26 ++#define	sys_execve 0
   13.27 ++#define do_fork 0
   13.28 ++#define	syscall_trace_enter 0
   13.29 ++#define	syscall_trace_leave 0
   13.30 ++#define schedule 0
   13.31 ++#define do_notify_resume_user 0
   13.32 ++#define ia64_rt_sigsuspend 0
   13.33 ++#define ia64_rt_sigreturn 0
   13.34 ++#define	ia64_handle_unaligned 0
   13.35 ++#define	errno 0
   13.36 ++#define	sys_ni_syscall 0
   13.37 ++#define unw_init_frame_info 0
   13.38 ++#define sys_call_table 0
   13.39 ++#define do_sigdelayed 0
   13.40 ++#endif
   13.41 ++
   13.42 ++	/*
   13.43 ++
   13.44 + 	/*
   13.45 + 	 * execve() is special because in case of success, we need to
   13.46 + 	 * setup a null register window frame.
   13.47 +@@ -187,11 +208,14 @@ GLOBAL_ENTRY(ia64_switch_to)
   13.48 + 	DO_SAVE_SWITCH_STACK
   13.49 + 	.body
   13.50 + 
   13.51 ++#ifdef XEN
   13.52 ++//#undef IA64_TASK_THREAD_KSP_OFFSET
   13.53 ++//#define	IA64_TASK_THREAD_KSP_OFFSET	0x38
   13.54 + 	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   13.55 + 	movl r25=init_task
   13.56 + 	mov r27=IA64_KR(CURRENT_STACK)
   13.57 + 	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   13.58 +-	dep r20=0,in0,61,3		// physical address of "next"
   13.59 ++	dep r20=0,in0,60,4		// physical address of "next"
   13.60 + 	;;
   13.61 + 	st8 [r22]=sp			// save kernel stack pointer of old task
   13.62 + 	shr.u r26=r20,IA64_GRANULE_SHIFT
   13.63 +@@ -203,6 +227,22 @@ GLOBAL_ENTRY(ia64_switch_to)
   13.64 + (p6)	cmp.eq p7,p6=r26,r27
   13.65 + (p6)	br.cond.dpnt .map
   13.66 + 	;;
   13.67 ++#else
   13.68 ++	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
   13.69 ++	mov r27=IA64_KR(CURRENT_STACK)
   13.70 ++	dep r20=0,in0,61,3		// physical address of "current"
   13.71 ++	;;
   13.72 ++	st8 [r22]=sp			// save kernel stack pointer of old task
   13.73 ++	shr.u r26=r20,IA64_GRANULE_SHIFT
   13.74 ++	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
   13.75 ++	;;
   13.76 ++	/*
   13.77 ++	 * If we've already mapped this task's page, we can skip doing it again.
   13.78 ++	 */
   13.79 ++	cmp.eq p7,p6=r26,r27
   13.80 ++(p6)	br.cond.dpnt .map
   13.81 ++	;;
   13.82 ++#endif
   13.83 + .done:
   13.84 + (p6)	ssm psr.ic			// if we had to map, reenable the psr.ic bit FIRST!!!
   13.85 + 	;;
   13.86 +@@ -220,6 +260,16 @@ GLOBAL_ENTRY(ia64_switch_to)
   13.87 + 	br.ret.sptk.many rp		// boogie on out in new context
   13.88 + 
   13.89 + .map:
   13.90 ++#ifdef XEN
   13.91 ++	// avoid overlapping with kernel TR
   13.92 ++	movl r25=KERNEL_START
   13.93 ++	dep  r23=0,in0,0,KERNEL_TR_PAGE_SHIFT
   13.94 ++	;;
   13.95 ++	cmp.eq p7,p0=r25,r23
   13.96 ++	;;
   13.97 ++(p7)	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
   13.98 ++(p7)	br.cond.sptk .done
   13.99 ++#endif
  13.100 + 	rsm psr.ic			// interrupts (psr.i) are already disabled here
  13.101 + 	movl r25=PAGE_KERNEL
  13.102 + 	;;
  13.103 +@@ -376,7 +426,11 @@ END(save_switch_stack)
  13.104 +  *	- b7 holds address to return to
  13.105 +  *	- must not touch r8-r11
  13.106 +  */
  13.107 ++#ifdef XEN
  13.108 ++GLOBAL_ENTRY(load_switch_stack)
  13.109 ++#else
  13.110 + ENTRY(load_switch_stack)
  13.111 ++#endif
  13.112 + 	.prologue
  13.113 + 	.altrp b7
  13.114 + 
  13.115 +@@ -604,6 +658,11 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
  13.116 + 	 */
  13.117 + 	br.call.sptk.many rp=ia64_invoke_schedule_tail
  13.118 + }
  13.119 ++#ifdef XEN
  13.120 ++	// new domains are cloned but not exec'ed so switch to user mode here
  13.121 ++	cmp.ne pKStk,pUStk=r0,r0
  13.122 ++	br.cond.spnt ia64_leave_kernel
  13.123 ++#else
  13.124 + .ret8:
  13.125 + 	adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
  13.126 + 	;;
  13.127 +@@ -614,6 +673,7 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
  13.128 + 	;;
  13.129 + 	cmp.ne p6,p0=r2,r0
  13.130 + (p6)	br.cond.spnt .strace_check_retval
  13.131 ++#endif
  13.132 + 	;;					// added stop bits to prevent r8 dependency
  13.133 + END(ia64_ret_from_clone)
  13.134 + 	// fall through
  13.135 +@@ -700,9 +760,14 @@ ENTRY(ia64_leave_syscall)
  13.136 + .work_processed_syscall:
  13.137 + 	adds r2=PT(LOADRS)+16,r12
  13.138 + 	adds r3=PT(AR_BSPSTORE)+16,r12
  13.139 ++#ifdef XEN
  13.140 ++	mov r31=r0
  13.141 ++	;;
  13.142 ++#else
  13.143 + 	adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
  13.144 + 	;;
  13.145 + (p6)	ld4 r31=[r18]				// load current_thread_info()->flags
  13.146 ++#endif
  13.147 + 	ld8 r19=[r2],PT(B6)-PT(LOADRS)		// load ar.rsc value for "loadrs"
  13.148 + 	mov b7=r0		// clear b7
  13.149 + 	;;
  13.150 +@@ -757,7 +822,11 @@ ENTRY(ia64_leave_syscall)
  13.151 + 	;;
  13.152 + 	ld8.fill r12=[r2]	// restore r12 (sp)
  13.153 + 	ld8.fill r15=[r3]	// restore r15
  13.154 ++#ifdef XEN
  13.155 ++	movl r3=THIS_CPU(ia64_phys_stacked_size_p8)
  13.156 ++#else
  13.157 + 	addl r3=THIS_CPU(ia64_phys_stacked_size_p8),r0
  13.158 ++#endif
  13.159 + 	;;
  13.160 + (pUStk)	ld4 r3=[r3]		// r3 = cpu_data->phys_stacked_size_p8
  13.161 + (pUStk) st1 [r14]=r17
  13.162 +@@ -814,9 +883,18 @@ GLOBAL_ENTRY(ia64_leave_kernel)
  13.163 + (pUStk)	cmp.eq.unc p6,p0=r0,r0		// p6 <- pUStk
  13.164 + #endif
  13.165 + .work_processed_kernel:
  13.166 ++#ifdef XEN
  13.167 ++	alloc loc0=ar.pfs,0,1,1,0
  13.168 ++	adds out0=16,r12
  13.169 ++	;;
  13.170 ++(p6)	br.call.sptk.many b0=deliver_pending_interrupt
  13.171 ++	mov ar.pfs=loc0
  13.172 ++	mov r31=r0
  13.173 ++#else
  13.174 + 	adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
  13.175 + 	;;
  13.176 + (p6)	ld4 r31=[r17]				// load current_thread_info()->flags
  13.177 ++#endif
  13.178 + 	adds r21=PT(PR)+16,r12
  13.179 + 	;;
  13.180 + 
  13.181 +@@ -934,7 +1012,11 @@ GLOBAL_ENTRY(ia64_leave_kernel)
  13.182 + 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
  13.183 + 	;;
  13.184 + 	mov r16=ar.bsp		// get existing backing store pointer
  13.185 ++#ifdef XEN
  13.186 ++	movl r17=THIS_CPU(ia64_phys_stacked_size_p8)
  13.187 ++#else
  13.188 + 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
  13.189 ++#endif
  13.190 + 	;;
  13.191 + 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
  13.192 + (pKStk)	br.cond.dpnt skip_rbs_switch
  13.193 +@@ -1323,6 +1405,7 @@ GLOBAL_ENTRY(unw_init_running)
  13.194 + 	br.ret.sptk.many rp
  13.195 + END(unw_init_running)
  13.196 + 
  13.197 ++#ifndef XEN
  13.198 + 	.rodata
  13.199 + 	.align 8
  13.200 + 	.globl sys_call_table
  13.201 +@@ -1585,3 +1668,4 @@ sys_call_table:
  13.202 + 	data8 sys_ni_syscall
  13.203 + 
  13.204 + 	.org sys_call_table + 8*NR_syscalls	// guard against failures to increase NR_syscalls
  13.205 ++#endif
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hardirq.h	Tue Apr 19 16:50:26 2005 +0000
    14.3 @@ -0,0 +1,15 @@
    14.4 + hardirq.h |    1 +
    14.5 + 1 files changed, 1 insertion(+)
    14.6 +
    14.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h
    14.8 +===================================================================
    14.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/hardirq.h	2005-03-24 15:59:37.210502749 -0600
   14.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/hardirq.h	2005-03-24 16:00:19.439540961 -0600
   14.11 +@@ -20,6 +20,7 @@
   14.12 + #define __ARCH_IRQ_STAT	1
   14.13 + 
   14.14 + #define local_softirq_pending()		(local_cpu_data->softirq_pending)
   14.15 ++#define softirq_pending(cpu)			(cpu_data(cpu)->softirq_pending)
   14.16 + 
   14.17 + #define HARDIRQ_BITS	14
   14.18 + 
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/head.S	Tue Apr 19 16:50:26 2005 +0000
    15.3 @@ -0,0 +1,85 @@
    15.4 + head.S |   34 ++++++++++++++++++++++++++++++++++
    15.5 + 1 files changed, 34 insertions(+)
    15.6 +
    15.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/head.S
    15.8 +===================================================================
    15.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/head.S	2005-04-07 10:56:19.225128582 -0500
   15.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/head.S	2005-04-07 11:00:21.718513399 -0500
   15.11 +@@ -1,3 +1,8 @@
   15.12 ++#ifdef XEN
   15.13 ++#define	console_print	printf
   15.14 ++#define kernel_thread_helper 0
   15.15 ++#define sys_exit 0
   15.16 ++#endif
   15.17 + /*
   15.18 +  * Here is where the ball gets rolling as far as the kernel is concerned.
   15.19 +  * When control is transferred to _start, the bootload has already
   15.20 +@@ -187,7 +192,11 @@ start_ap:
   15.21 + 	dep r18=0,r3,0,12
   15.22 + 	;;
   15.23 + 	or r18=r17,r18
   15.24 ++#ifdef XEN
   15.25 ++	dep r2=-1,r3,60,4	// IMVA of task
   15.26 ++#else
   15.27 + 	dep r2=-1,r3,61,3	// IMVA of task
   15.28 ++#endif
   15.29 + 	;;
   15.30 + 	mov r17=rr[r2]
   15.31 + 	shr.u r16=r3,IA64_GRANULE_SHIFT
   15.32 +@@ -227,7 +236,11 @@ start_ap:
   15.33 + 	;;
   15.34 + 	mov ar.rsc=0x3		// place RSE in eager mode
   15.35 + 
   15.36 ++#ifdef XEN
   15.37 ++(isBP)	dep r28=-1,r28,60,4	// make address virtual
   15.38 ++#else
   15.39 + (isBP)	dep r28=-1,r28,61,3	// make address virtual
   15.40 ++#endif
   15.41 + (isBP)	movl r2=ia64_boot_param
   15.42 + 	;;
   15.43 + (isBP)	st8 [r2]=r28		// save the address of the boot param area passed by the bootloader
   15.44 +@@ -245,7 +258,21 @@ start_ap:
   15.45 + 	br.call.sptk.many rp=sys_fw_init
   15.46 + .ret1:
   15.47 + #endif
   15.48 ++#ifdef XEN
   15.49 ++	alloc r2=ar.pfs,8,0,2,0
   15.50 ++	;;
   15.51 ++#define fake_mbi_magic 0
   15.52 ++#define MULTIBOOT_INFO_SIZE	1024
   15.53 ++	.rodata
   15.54 ++fake_mbi:
   15.55 ++	.skip MULTIBOOT_INFO_SIZE
   15.56 ++	.previous
   15.57 ++	movl out0=fake_mbi
   15.58 ++	;;
   15.59 ++	br.call.sptk.many rp=cmain
   15.60 ++#else
   15.61 + 	br.call.sptk.many rp=start_kernel
   15.62 ++#endif
   15.63 + .ret2:	addl r3=@ltoff(halt_msg),gp
   15.64 + 	;;
   15.65 + 	alloc r2=ar.pfs,8,0,2,0
   15.66 +@@ -254,7 +281,9 @@ start_ap:
   15.67 + 	br.call.sptk.many b0=console_print
   15.68 + 
   15.69 + self:	hint @pause
   15.70 ++	;;
   15.71 + 	br.sptk.many self		// endless loop
   15.72 ++	;;
   15.73 + END(_start)
   15.74 + 
   15.75 + GLOBAL_ENTRY(ia64_save_debug_regs)
   15.76 +@@ -850,7 +879,12 @@ END(ia64_delay_loop)
   15.77 +  * intermediate precision so that we can produce a full 64-bit result.
   15.78 +  */
   15.79 + GLOBAL_ENTRY(sched_clock)
   15.80 ++#ifdef XEN
   15.81 ++	break 0;;	// FIX IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   15.82 ++	//movl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET
   15.83 ++#else
   15.84 + 	addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
   15.85 ++#endif
   15.86 + 	mov.m r9=ar.itc		// fetch cycle-counter				(35 cyc)
   15.87 + 	;;
   15.88 + 	ldf8 f8=[r8]
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hpsim_irq.c	Tue Apr 19 16:50:26 2005 +0000
    16.3 @@ -0,0 +1,41 @@
    16.4 + hpsim_irq.c |   15 +++++++++++++++
    16.5 + 1 files changed, 15 insertions(+)
    16.6 +
    16.7 +Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c
    16.8 +===================================================================
    16.9 +--- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_irq.c	2005-03-02 01:38:33.000000000 -0600
   16.10 ++++ linux-2.6.11/arch/ia64/hp/sim/hpsim_irq.c	2005-03-19 13:33:57.312014806 -0600
   16.11 +@@ -9,7 +9,17 @@
   16.12 + #include <linux/kernel.h>
   16.13 + #include <linux/sched.h>
   16.14 + #include <linux/irq.h>
   16.15 ++#ifdef XEN
   16.16 ++#include <asm/hw_irq.h>
   16.17 ++#endif
   16.18 + 
   16.19 ++#if 1
   16.20 ++void __init
   16.21 ++hpsim_irq_init (void)
   16.22 ++{
   16.23 ++	printf("*** hpsim_irq_init called: NOT NEEDED?!?!?\n");
   16.24 ++}
   16.25 ++#else
   16.26 + static unsigned int
   16.27 + hpsim_irq_startup (unsigned int irq)
   16.28 + {
   16.29 +@@ -19,6 +29,10 @@ hpsim_irq_startup (unsigned int irq)
   16.30 + static void
   16.31 + hpsim_irq_noop (unsigned int irq)
   16.32 + {
   16.33 ++#if 1
   16.34 ++printf("hpsim_irq_noop: irq=%d\n",irq);
   16.35 ++while(irq);
   16.36 ++#endif
   16.37 + }
   16.38 + 
   16.39 + static void
   16.40 +@@ -49,3 +63,4 @@ hpsim_irq_init (void)
   16.41 + 			idesc->handler = &irq_type_hp_sim;
   16.42 + 	}
   16.43 + }
   16.44 ++#endif
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/hpsim_ssc.h	Tue Apr 19 16:50:26 2005 +0000
    17.3 @@ -0,0 +1,31 @@
    17.4 + hpsim_ssc.h |   19 +++++++++++++++++++
    17.5 + 1 files changed, 19 insertions(+)
    17.6 +
    17.7 +Index: linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h
    17.8 +===================================================================
    17.9 +--- linux-2.6.11.orig/arch/ia64/hp/sim/hpsim_ssc.h	2005-03-02 01:38:17.000000000 -0600
   17.10 ++++ linux-2.6.11/arch/ia64/hp/sim/hpsim_ssc.h	2005-03-19 13:34:01.705520375 -0600
   17.11 +@@ -33,4 +33,23 @@
   17.12 +  */
   17.13 + extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr);
   17.14 + 
   17.15 ++#ifdef XEN
   17.16 ++/* Note: These are declared in linux/arch/ia64/hp/sim/simscsi.c but belong
   17.17 ++ * in linux/include/asm-ia64/hpsim_ssc.h, hence their addition here */
   17.18 ++#define SSC_OPEN			50
   17.19 ++#define SSC_CLOSE			51
   17.20 ++#define SSC_READ			52
   17.21 ++#define SSC_WRITE			53
   17.22 ++#define SSC_GET_COMPLETION		54
   17.23 ++#define SSC_WAIT_COMPLETION		55
   17.24 ++
   17.25 ++#define SSC_WRITE_ACCESS		2
   17.26 ++#define SSC_READ_ACCESS			1
   17.27 ++
   17.28 ++struct ssc_disk_req {
   17.29 ++	unsigned long addr;
   17.30 ++	unsigned long len;
   17.31 ++};
   17.32 ++#endif
   17.33 ++
   17.34 + #endif /* _IA64_PLATFORM_HPSIM_SSC_H */
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/interrupt.h	Tue Apr 19 16:50:26 2005 +0000
    18.3 @@ -0,0 +1,23 @@
    18.4 + interrupt.h |    2 ++
    18.5 + 1 files changed, 2 insertions(+)
    18.6 +
    18.7 +Index: linux-2.6.11/include/linux/interrupt.h
    18.8 +===================================================================
    18.9 +--- linux-2.6.11.orig/include/linux/interrupt.h	2005-03-02 01:38:09.000000000 -0600
   18.10 ++++ linux-2.6.11/include/linux/interrupt.h	2005-03-19 13:41:00.739901125 -0600
   18.11 +@@ -33,6 +33,7 @@ typedef int irqreturn_t;
   18.12 + #define IRQ_HANDLED	(1)
   18.13 + #define IRQ_RETVAL(x)	((x) != 0)
   18.14 + 
   18.15 ++#ifndef XEN
   18.16 + struct irqaction {
   18.17 + 	irqreturn_t (*handler)(int, void *, struct pt_regs *);
   18.18 + 	unsigned long flags;
   18.19 +@@ -49,6 +50,7 @@ extern int request_irq(unsigned int,
   18.20 + 		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
   18.21 + 		       unsigned long, const char *, void *);
   18.22 + extern void free_irq(unsigned int, void *);
   18.23 ++#endif
   18.24 + 
   18.25 + 
   18.26 + #ifdef CONFIG_GENERIC_HARDIRQS
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/io.h	Tue Apr 19 16:50:26 2005 +0000
    19.3 @@ -0,0 +1,19 @@
    19.4 + io.h |    4 ++++
    19.5 + 1 files changed, 4 insertions(+)
    19.6 +
    19.7 +Index: linux-2.6.11/include/asm-ia64/io.h
    19.8 +===================================================================
    19.9 +--- linux-2.6.11.orig/include/asm-ia64/io.h	2005-03-02 01:38:34.000000000 -0600
   19.10 ++++ linux-2.6.11/include/asm-ia64/io.h	2005-03-19 13:42:06.541900818 -0600
   19.11 +@@ -23,7 +23,11 @@
   19.12 + #define __SLOW_DOWN_IO	do { } while (0)
   19.13 + #define SLOW_DOWN_IO	do { } while (0)
   19.14 + 
   19.15 ++#ifdef XEN
   19.16 ++#define __IA64_UNCACHED_OFFSET	0xdffc000000000000UL	/* region 6 */
   19.17 ++#else
   19.18 + #define __IA64_UNCACHED_OFFSET	0xc000000000000000UL	/* region 6 */
   19.19 ++#endif
   19.20 + 
   19.21 + /*
   19.22 +  * The legacy I/O space defined by the ia64 architecture supports only 65536 ports, but
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/irq.h	Tue Apr 19 16:50:26 2005 +0000
    20.3 @@ -0,0 +1,23 @@
    20.4 + irq.h |    9 +++++++++
    20.5 + 1 files changed, 9 insertions(+)
    20.6 +
    20.7 +Index: linux-2.6.11/include/asm-ia64/irq.h
    20.8 +===================================================================
    20.9 +--- linux-2.6.11.orig/include/asm-ia64/irq.h	2005-03-02 01:38:33.000000000 -0600
   20.10 ++++ linux-2.6.11/include/asm-ia64/irq.h	2005-03-19 13:42:27.957677364 -0600
   20.11 +@@ -30,6 +30,15 @@ extern void disable_irq_nosync (unsigned
   20.12 + extern void enable_irq (unsigned int);
   20.13 + extern void set_irq_affinity_info (unsigned int irq, int dest, int redir);
   20.14 + 
   20.15 ++#ifdef XEN
   20.16 ++// dup'ed from signal.h to avoid changes to includes
   20.17 ++#define	SA_NOPROFILE	0x02000000
   20.18 ++#define	SA_SHIRQ	0x04000000
   20.19 ++#define	SA_RESTART	0x10000000
   20.20 ++#define	SA_INTERRUPT	0x20000000
   20.21 ++#define	SA_SAMPLE_RANDOM	SA_RESTART
   20.22 ++#endif
   20.23 ++
   20.24 + #ifdef CONFIG_SMP
   20.25 + extern void move_irq(int irq);
   20.26 + #else
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/irq_ia64.c	Tue Apr 19 16:50:26 2005 +0000
    21.3 @@ -0,0 +1,111 @@
    21.4 + irq_ia64.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    21.5 + 1 files changed, 67 insertions(+)
    21.6 +
    21.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c
    21.8 +===================================================================
    21.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/irq_ia64.c	2005-04-08 13:30:16.777174938 -0500
   21.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/irq_ia64.c	2005-04-08 14:15:47.398616472 -0500
   21.11 +@@ -17,18 +17,26 @@
   21.12 + #include <linux/config.h>
   21.13 + #include <linux/module.h>
   21.14 + 
   21.15 ++#ifndef XEN
   21.16 + #include <linux/jiffies.h>
   21.17 ++#endif
   21.18 + #include <linux/errno.h>
   21.19 + #include <linux/init.h>
   21.20 + #include <linux/interrupt.h>
   21.21 + #include <linux/ioport.h>
   21.22 ++#ifndef XEN
   21.23 + #include <linux/kernel_stat.h>
   21.24 ++#endif
   21.25 + #include <linux/slab.h>
   21.26 ++#ifndef XEN
   21.27 + #include <linux/ptrace.h>
   21.28 + #include <linux/random.h>	/* for rand_initialize_irq() */
   21.29 + #include <linux/signal.h>
   21.30 ++#endif
   21.31 + #include <linux/smp.h>
   21.32 ++#ifndef XEN
   21.33 + #include <linux/smp_lock.h>
   21.34 ++#endif
   21.35 + #include <linux/threads.h>
   21.36 + #include <linux/bitops.h>
   21.37 + 
   21.38 +@@ -104,6 +112,24 @@ void
   21.39 + ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
   21.40 + {
   21.41 + 	unsigned long saved_tpr;
   21.42 ++#if 0
   21.43 ++//FIXME: For debug only, can be removed
   21.44 ++	static char firstirq = 1;
   21.45 ++	static char firsttime[256];
   21.46 ++	static char firstpend[256];
   21.47 ++	if (firstirq) {
   21.48 ++		int i;
   21.49 ++		for (i=0;i<256;i++) firsttime[i] = 1;
   21.50 ++		for (i=0;i<256;i++) firstpend[i] = 1;
   21.51 ++		firstirq = 0;
   21.52 ++	}
   21.53 ++	if (firsttime[vector]) {
   21.54 ++		printf("**** (entry) First received int on vector=%d,itc=%lx\n",
   21.55 ++			(unsigned long) vector, ia64_get_itc());
   21.56 ++		firsttime[vector] = 0;
   21.57 ++	}
   21.58 ++#endif
   21.59 ++
   21.60 + 
   21.61 + #if IRQ_DEBUG
   21.62 + 	{
   21.63 +@@ -148,6 +174,27 @@ ia64_handle_irq (ia64_vector vector, str
   21.64 + 			ia64_setreg(_IA64_REG_CR_TPR, vector);
   21.65 + 			ia64_srlz_d();
   21.66 + 
   21.67 ++#ifdef XEN
   21.68 ++	if (vector != 0xef) {
   21.69 ++		extern void vcpu_pend_interrupt(void *, int);
   21.70 ++#if 0
   21.71 ++		if (firsttime[vector]) {
   21.72 ++			printf("**** (iterate) First received int on vector=%d,itc=%lx\n",
   21.73 ++			(unsigned long) vector, ia64_get_itc());
   21.74 ++			firsttime[vector] = 0;
   21.75 ++		}
   21.76 ++		if (firstpend[vector]) {
   21.77 ++			printf("**** First pended int on vector=%d,itc=%lx\n",
   21.78 ++				(unsigned long) vector,ia64_get_itc());
   21.79 ++			firstpend[vector] = 0;
   21.80 ++		}
   21.81 ++#endif
   21.82 ++		//FIXME: TEMPORARY HACK!!!!
   21.83 ++		vcpu_pend_interrupt(dom0->exec_domain[0],vector);
   21.84 ++		domain_wake(dom0->exec_domain[0]);
   21.85 ++	}
   21.86 ++	else
   21.87 ++#endif
   21.88 + 			__do_IRQ(local_vector_to_irq(vector), regs);
   21.89 + 
   21.90 + 			/*
   21.91 +@@ -276,3 +323,23 @@ ia64_send_ipi (int cpu, int vector, int 
   21.92 + 
   21.93 + 	writeq(ipi_data, ipi_addr);
   21.94 + }
   21.95 ++
   21.96 ++/* From linux/kernel/softirq.c */
   21.97 ++#ifdef __ARCH_IRQ_EXIT_IRQS_DISABLED
   21.98 ++# define invoke_softirq()	__do_softirq()
   21.99 ++#else
  21.100 ++# define invoke_softirq()	do_softirq()
  21.101 ++#endif
  21.102 ++
  21.103 ++/*
  21.104 ++ * Exit an interrupt context. Process softirqs if needed and possible:
  21.105 ++ */
  21.106 ++void irq_exit(void)
  21.107 ++{
  21.108 ++	account_system_vtime(current);
  21.109 ++	sub_preempt_count(IRQ_EXIT_OFFSET);
  21.110 ++	if (!in_interrupt() && local_softirq_pending())
  21.111 ++		invoke_softirq();
  21.112 ++	preempt_enable_no_resched();
  21.113 ++}
  21.114 ++/* end from linux/kernel/softirq.c */
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/ivt.S	Tue Apr 19 16:50:26 2005 +0000
    22.3 @@ -0,0 +1,533 @@
    22.4 + ivt.S |  254 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    22.5 + 1 files changed, 254 insertions(+)
    22.6 +
    22.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S
    22.8 +===================================================================
    22.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/ivt.S	2005-04-07 10:29:00.565766924 -0500
   22.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/ivt.S	2005-04-07 10:29:50.923594750 -0500
   22.11 +@@ -1,3 +1,21 @@
   22.12 ++
   22.13 ++#ifdef XEN
   22.14 ++//#define CONFIG_DISABLE_VHPT	// FIXME: change when VHPT is enabled??
   22.15 ++// these are all hacked out for now as the entire IVT
   22.16 ++// will eventually be replaced... just want to use it
   22.17 ++// for startup code to handle TLB misses
   22.18 ++//#define ia64_leave_kernel 0
   22.19 ++//#define ia64_ret_from_syscall 0
   22.20 ++//#define ia64_handle_irq 0
   22.21 ++//#define ia64_fault 0
   22.22 ++#define ia64_illegal_op_fault 0
   22.23 ++#define ia64_prepare_handle_unaligned 0
   22.24 ++#define ia64_bad_break 0
   22.25 ++#define ia64_trace_syscall 0
   22.26 ++#define sys_call_table 0
   22.27 ++#define sys_ni_syscall 0
   22.28 ++#include <asm/vhpt.h>
   22.29 ++#endif
   22.30 + /*
   22.31 +  * arch/ia64/kernel/ivt.S
   22.32 +  *
   22.33 +@@ -77,6 +95,13 @@
   22.34 + 	mov r19=n;;			/* prepare to save predicates */		\
   22.35 + 	br.sptk.many dispatch_to_fault_handler
   22.36 + 
   22.37 ++#ifdef XEN
   22.38 ++#define REFLECT(n)									\
   22.39 ++	mov r31=pr;									\
   22.40 ++	mov r19=n;;			/* prepare to save predicates */		\
   22.41 ++	br.sptk.many dispatch_reflection
   22.42 ++#endif
   22.43 ++
   22.44 + 	.section .text.ivt,"ax"
   22.45 + 
   22.46 + 	.align 32768	// align on 32KB boundary
   22.47 +@@ -214,6 +239,13 @@ END(vhpt_miss)
   22.48 + // 0x0400 Entry 1 (size 64 bundles) ITLB (21)
   22.49 + ENTRY(itlb_miss)
   22.50 + 	DBG_FAULT(1)
   22.51 ++#ifdef XEN
   22.52 ++	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
   22.53 ++#ifdef VHPT_GLOBAL
   22.54 ++	br.cond.sptk page_fault
   22.55 ++	;;
   22.56 ++#endif
   22.57 ++#endif
   22.58 + 	/*
   22.59 + 	 * The ITLB handler accesses the L3 PTE via the virtually mapped linear
   22.60 + 	 * page table.  If a nested TLB miss occurs, we switch into physical
   22.61 +@@ -258,6 +290,13 @@ END(itlb_miss)
   22.62 + // 0x0800 Entry 2 (size 64 bundles) DTLB (9,48)
   22.63 + ENTRY(dtlb_miss)
   22.64 + 	DBG_FAULT(2)
   22.65 ++#ifdef XEN
   22.66 ++	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
   22.67 ++#ifdef VHPT_GLOBAL
   22.68 ++	br.cond.sptk page_fault
   22.69 ++	;;
   22.70 ++#endif
   22.71 ++#endif
   22.72 + 	/*
   22.73 + 	 * The DTLB handler accesses the L3 PTE via the virtually mapped linear
   22.74 + 	 * page table.  If a nested TLB miss occurs, we switch into physical
   22.75 +@@ -302,6 +341,13 @@ END(dtlb_miss)
   22.76 + // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
   22.77 + ENTRY(alt_itlb_miss)
   22.78 + 	DBG_FAULT(3)
   22.79 ++#ifdef XEN
   22.80 ++//#ifdef VHPT_GLOBAL
   22.81 ++//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
   22.82 ++//	br.cond.sptk page_fault
   22.83 ++//	;;
   22.84 ++//#endif
   22.85 ++#endif
   22.86 + 	mov r16=cr.ifa		// get address that caused the TLB miss
   22.87 + 	movl r17=PAGE_KERNEL
   22.88 + 	mov r21=cr.ipsr
   22.89 +@@ -340,6 +386,13 @@ END(alt_itlb_miss)
   22.90 + // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
   22.91 + ENTRY(alt_dtlb_miss)
   22.92 + 	DBG_FAULT(4)
   22.93 ++#ifdef XEN
   22.94 ++//#ifdef VHPT_GLOBAL
   22.95 ++//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
   22.96 ++//	br.cond.sptk page_fault
   22.97 ++//	;;
   22.98 ++//#endif
   22.99 ++#endif
  22.100 + 	mov r16=cr.ifa		// get address that caused the TLB miss
  22.101 + 	movl r17=PAGE_KERNEL
  22.102 + 	mov r20=cr.isr
  22.103 +@@ -369,6 +422,17 @@ ENTRY(alt_dtlb_miss)
  22.104 + 	cmp.ne p8,p0=r0,r23
  22.105 + (p9)	cmp.eq.or.andcm p6,p7=IA64_ISR_CODE_LFETCH,r22	// check isr.code field
  22.106 + (p8)	br.cond.spnt page_fault
  22.107 ++#ifdef XEN
  22.108 ++	;;
  22.109 ++	// FIXME: inadequate test, this is where we test for Xen address
  22.110 ++	// note that 0xf000 (cached) and 0xd000 (uncached) addresses
  22.111 ++	// should be OK.  (Though no I/O is done in Xen, EFI needs uncached
  22.112 ++	// addresses and some domain EFI calls are passed through)
  22.113 ++	tbit.nz p0,p8=r16,60
  22.114 ++(p8)	br.cond.spnt page_fault
  22.115 ++//(p8)	br.cond.spnt 0
  22.116 ++	;;
  22.117 ++#endif
  22.118 + 
  22.119 + 	dep r21=-1,r21,IA64_PSR_ED_BIT,1
  22.120 + 	or r19=r19,r17		// insert PTE control bits into r19
  22.121 +@@ -449,6 +513,9 @@ END(nested_dtlb_miss)
  22.122 + /////////////////////////////////////////////////////////////////////////////////////////
  22.123 + // 0x1800 Entry 6 (size 64 bundles) Instruction Key Miss (24)
  22.124 + ENTRY(ikey_miss)
  22.125 ++#ifdef XEN
  22.126 ++	REFLECT(6)
  22.127 ++#endif
  22.128 + 	DBG_FAULT(6)
  22.129 + 	FAULT(6)
  22.130 + END(ikey_miss)
  22.131 +@@ -461,9 +528,16 @@ ENTRY(page_fault)
  22.132 + 	srlz.i
  22.133 + 	;;
  22.134 + 	SAVE_MIN_WITH_COVER
  22.135 ++#ifdef XEN
  22.136 ++	alloc r15=ar.pfs,0,0,4,0
  22.137 ++	mov out0=cr.ifa
  22.138 ++	mov out1=cr.isr
  22.139 ++	mov out3=cr.itir
  22.140 ++#else
  22.141 + 	alloc r15=ar.pfs,0,0,3,0
  22.142 + 	mov out0=cr.ifa
  22.143 + 	mov out1=cr.isr
  22.144 ++#endif
  22.145 + 	adds r3=8,r2				// set up second base pointer
  22.146 + 	;;
  22.147 + 	ssm psr.ic | PSR_DEFAULT_BITS
  22.148 +@@ -484,6 +558,9 @@ END(page_fault)
  22.149 + /////////////////////////////////////////////////////////////////////////////////////////
  22.150 + // 0x1c00 Entry 7 (size 64 bundles) Data Key Miss (12,51)
  22.151 + ENTRY(dkey_miss)
  22.152 ++#ifdef XEN
  22.153 ++	REFLECT(7)
  22.154 ++#endif
  22.155 + 	DBG_FAULT(7)
  22.156 + 	FAULT(7)
  22.157 + END(dkey_miss)
  22.158 +@@ -492,6 +569,9 @@ END(dkey_miss)
  22.159 + /////////////////////////////////////////////////////////////////////////////////////////
  22.160 + // 0x2000 Entry 8 (size 64 bundles) Dirty-bit (54)
  22.161 + ENTRY(dirty_bit)
  22.162 ++#ifdef XEN
  22.163 ++	REFLECT(8)
  22.164 ++#endif
  22.165 + 	DBG_FAULT(8)
  22.166 + 	/*
  22.167 + 	 * What we do here is to simply turn on the dirty bit in the PTE.  We need to
  22.168 +@@ -554,6 +634,9 @@ END(dirty_bit)
  22.169 + /////////////////////////////////////////////////////////////////////////////////////////
  22.170 + // 0x2400 Entry 9 (size 64 bundles) Instruction Access-bit (27)
  22.171 + ENTRY(iaccess_bit)
  22.172 ++#ifdef XEN
  22.173 ++	REFLECT(9)
  22.174 ++#endif
  22.175 + 	DBG_FAULT(9)
  22.176 + 	// Like Entry 8, except for instruction access
  22.177 + 	mov r16=cr.ifa				// get the address that caused the fault
  22.178 +@@ -619,6 +702,9 @@ END(iaccess_bit)
  22.179 + /////////////////////////////////////////////////////////////////////////////////////////
  22.180 + // 0x2800 Entry 10 (size 64 bundles) Data Access-bit (15,55)
  22.181 + ENTRY(daccess_bit)
  22.182 ++#ifdef XEN
  22.183 ++	REFLECT(10)
  22.184 ++#endif
  22.185 + 	DBG_FAULT(10)
  22.186 + 	// Like Entry 8, except for data access
  22.187 + 	mov r16=cr.ifa				// get the address that caused the fault
  22.188 +@@ -687,6 +773,16 @@ ENTRY(break_fault)
  22.189 + 	 * to prevent leaking bits from kernel to user level.
  22.190 + 	 */
  22.191 + 	DBG_FAULT(11)
  22.192 ++#ifdef XEN
  22.193 ++	mov r16=cr.isr
  22.194 ++	mov r17=cr.iim
  22.195 ++	mov r31=pr
  22.196 ++	;;
  22.197 ++	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
  22.198 ++	// FIXME: may also need to check slot==2?
  22.199 ++(p7)	br.sptk.many dispatch_privop_fault
  22.200 ++	br.sptk.many dispatch_break_fault
  22.201 ++#endif
  22.202 + 	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
  22.203 + 	mov r17=cr.iim
  22.204 + 	mov r18=__IA64_BREAK_SYSCALL
  22.205 +@@ -697,7 +793,9 @@ ENTRY(break_fault)
  22.206 + 	mov r27=ar.rsc
  22.207 + 	mov r26=ar.pfs
  22.208 + 	mov r28=cr.iip
  22.209 ++#ifndef XEN
  22.210 + 	mov r31=pr				// prepare to save predicates
  22.211 ++#endif
  22.212 + 	mov r20=r1
  22.213 + 	;;
  22.214 + 	adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16
  22.215 +@@ -797,6 +895,36 @@ END(interrupt)
  22.216 + 	DBG_FAULT(13)
  22.217 + 	FAULT(13)
  22.218 + 
  22.219 ++#ifdef XEN
  22.220 ++	// There is no particular reason for this code to be here, other than that
  22.221 ++	// there happens to be space here that would go unused otherwise.  If this
  22.222 ++	// fault ever gets "unreserved", simply moved the following code to a more
  22.223 ++	// suitable spot...
  22.224 ++
  22.225 ++ENTRY(dispatch_break_fault)
  22.226 ++	SAVE_MIN_WITH_COVER
  22.227 ++	;;
  22.228 ++	alloc r14=ar.pfs,0,0,4,0 // now it's safe (must be first in insn group!)
  22.229 ++	mov out0=cr.ifa
  22.230 ++	adds out1=16,sp
  22.231 ++	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  22.232 ++	mov out3=cr.iim		// FIXME: pity to make this slow access twice
  22.233 ++
  22.234 ++	ssm psr.ic | PSR_DEFAULT_BITS
  22.235 ++	;;
  22.236 ++	srlz.i					// guarantee that interruption collection is on
  22.237 ++	;;
  22.238 ++(p15)	ssm psr.i				// restore psr.i
  22.239 ++	adds r3=8,r2				// set up second base pointer
  22.240 ++	;;
  22.241 ++	SAVE_REST
  22.242 ++	movl r14=ia64_leave_kernel
  22.243 ++	;;
  22.244 ++	mov rp=r14
  22.245 ++	br.sptk.many ia64_prepare_handle_break
  22.246 ++END(dispatch_break_fault)
  22.247 ++#endif
  22.248 ++
  22.249 + 	.org ia64_ivt+0x3800
  22.250 + /////////////////////////////////////////////////////////////////////////////////////////
  22.251 + // 0x3800 Entry 14 (size 64 bundles) Reserved
  22.252 +@@ -850,9 +978,11 @@ END(interrupt)
  22.253 + 	 *	- ar.fpsr: set to kernel settings
  22.254 + 	 */
  22.255 + GLOBAL_ENTRY(ia64_syscall_setup)
  22.256 ++#ifndef XEN
  22.257 + #if PT(B6) != 0
  22.258 + # error This code assumes that b6 is the first field in pt_regs.
  22.259 + #endif
  22.260 ++#endif
  22.261 + 	st8 [r1]=r19				// save b6
  22.262 + 	add r16=PT(CR_IPSR),r1			// initialize first base pointer
  22.263 + 	add r17=PT(R11),r1			// initialize second base pointer
  22.264 +@@ -992,6 +1122,37 @@ END(dispatch_illegal_op_fault)
  22.265 + 	DBG_FAULT(16)
  22.266 + 	FAULT(16)
  22.267 + 
  22.268 ++#ifdef XEN
  22.269 ++	// There is no particular reason for this code to be here, other than that
  22.270 ++	// there happens to be space here that would go unused otherwise.  If this
  22.271 ++	// fault ever gets "unreserved", simply moved the following code to a more
  22.272 ++	// suitable spot...
  22.273 ++
  22.274 ++ENTRY(dispatch_privop_fault)
  22.275 ++	SAVE_MIN_WITH_COVER
  22.276 ++	;;
  22.277 ++	alloc r14=ar.pfs,0,0,4,0		// now it's safe (must be first in insn group!)
  22.278 ++	mov out0=cr.ifa
  22.279 ++	adds out1=16,sp
  22.280 ++	mov out2=cr.isr		// FIXME: pity to make this slow access twice
  22.281 ++	mov out3=cr.itir
  22.282 ++
  22.283 ++	ssm psr.ic | PSR_DEFAULT_BITS
  22.284 ++	;;
  22.285 ++	srlz.i					// guarantee that interruption collection is on
  22.286 ++	;;
  22.287 ++(p15)	ssm psr.i				// restore psr.i
  22.288 ++	adds r3=8,r2				// set up second base pointer
  22.289 ++	;;
  22.290 ++	SAVE_REST
  22.291 ++	movl r14=ia64_leave_kernel
  22.292 ++	;;
  22.293 ++	mov rp=r14
  22.294 ++	br.sptk.many ia64_prepare_handle_privop
  22.295 ++END(dispatch_privop_fault)
  22.296 ++#endif
  22.297 ++
  22.298 ++
  22.299 + 	.org ia64_ivt+0x4400
  22.300 + /////////////////////////////////////////////////////////////////////////////////////////
  22.301 + // 0x4400 Entry 17 (size 64 bundles) Reserved
  22.302 +@@ -1108,6 +1269,9 @@ END(dispatch_to_fault_handler)
  22.303 + /////////////////////////////////////////////////////////////////////////////////////////
  22.304 + // 0x5000 Entry 20 (size 16 bundles) Page Not Present (10,22,49)
  22.305 + ENTRY(page_not_present)
  22.306 ++#ifdef XEN
  22.307 ++	REFLECT(20)
  22.308 ++#endif
  22.309 + 	DBG_FAULT(20)
  22.310 + 	mov r16=cr.ifa
  22.311 + 	rsm psr.dt
  22.312 +@@ -1128,6 +1292,9 @@ END(page_not_present)
  22.313 + /////////////////////////////////////////////////////////////////////////////////////////
  22.314 + // 0x5100 Entry 21 (size 16 bundles) Key Permission (13,25,52)
  22.315 + ENTRY(key_permission)
  22.316 ++#ifdef XEN
  22.317 ++	REFLECT(21)
  22.318 ++#endif
  22.319 + 	DBG_FAULT(21)
  22.320 + 	mov r16=cr.ifa
  22.321 + 	rsm psr.dt
  22.322 +@@ -1141,6 +1308,9 @@ END(key_permission)
  22.323 + /////////////////////////////////////////////////////////////////////////////////////////
  22.324 + // 0x5200 Entry 22 (size 16 bundles) Instruction Access Rights (26)
  22.325 + ENTRY(iaccess_rights)
  22.326 ++#ifdef XEN
  22.327 ++	REFLECT(22)
  22.328 ++#endif
  22.329 + 	DBG_FAULT(22)
  22.330 + 	mov r16=cr.ifa
  22.331 + 	rsm psr.dt
  22.332 +@@ -1154,6 +1324,9 @@ END(iaccess_rights)
  22.333 + /////////////////////////////////////////////////////////////////////////////////////////
  22.334 + // 0x5300 Entry 23 (size 16 bundles) Data Access Rights (14,53)
  22.335 + ENTRY(daccess_rights)
  22.336 ++#ifdef XEN
  22.337 ++	REFLECT(23)
  22.338 ++#endif
  22.339 + 	DBG_FAULT(23)
  22.340 + 	mov r16=cr.ifa
  22.341 + 	rsm psr.dt
  22.342 +@@ -1171,8 +1344,13 @@ ENTRY(general_exception)
  22.343 + 	mov r16=cr.isr
  22.344 + 	mov r31=pr
  22.345 + 	;;
  22.346 ++#ifdef XEN
  22.347 ++	cmp4.ge p6,p0=0x20,r16
  22.348 ++(p6)	br.sptk.many dispatch_privop_fault
  22.349 ++#else
  22.350 + 	cmp4.eq p6,p0=0,r16
  22.351 + (p6)	br.sptk.many dispatch_illegal_op_fault
  22.352 ++#endif
  22.353 + 	;;
  22.354 + 	mov r19=24		// fault number
  22.355 + 	br.sptk.many dispatch_to_fault_handler
  22.356 +@@ -1182,6 +1360,9 @@ END(general_exception)
  22.357 + /////////////////////////////////////////////////////////////////////////////////////////
  22.358 + // 0x5500 Entry 25 (size 16 bundles) Disabled FP-Register (35)
  22.359 + ENTRY(disabled_fp_reg)
  22.360 ++#ifdef XEN
  22.361 ++	REFLECT(25)
  22.362 ++#endif
  22.363 + 	DBG_FAULT(25)
  22.364 + 	rsm psr.dfh		// ensure we can access fph
  22.365 + 	;;
  22.366 +@@ -1195,6 +1376,9 @@ END(disabled_fp_reg)
  22.367 + /////////////////////////////////////////////////////////////////////////////////////////
  22.368 + // 0x5600 Entry 26 (size 16 bundles) Nat Consumption (11,23,37,50)
  22.369 + ENTRY(nat_consumption)
  22.370 ++#ifdef XEN
  22.371 ++	REFLECT(26)
  22.372 ++#endif
  22.373 + 	DBG_FAULT(26)
  22.374 + 	FAULT(26)
  22.375 + END(nat_consumption)
  22.376 +@@ -1203,6 +1387,10 @@ END(nat_consumption)
  22.377 + /////////////////////////////////////////////////////////////////////////////////////////
  22.378 + // 0x5700 Entry 27 (size 16 bundles) Speculation (40)
  22.379 + ENTRY(speculation_vector)
  22.380 ++#ifdef XEN
  22.381 ++	// this probably need not reflect...
  22.382 ++	REFLECT(27)
  22.383 ++#endif
  22.384 + 	DBG_FAULT(27)
  22.385 + 	/*
  22.386 + 	 * A [f]chk.[as] instruction needs to take the branch to the recovery code but
  22.387 +@@ -1246,6 +1434,9 @@ END(speculation_vector)
  22.388 + /////////////////////////////////////////////////////////////////////////////////////////
  22.389 + // 0x5900 Entry 29 (size 16 bundles) Debug (16,28,56)
  22.390 + ENTRY(debug_vector)
  22.391 ++#ifdef XEN
  22.392 ++	REFLECT(29)
  22.393 ++#endif
  22.394 + 	DBG_FAULT(29)
  22.395 + 	FAULT(29)
  22.396 + END(debug_vector)
  22.397 +@@ -1254,6 +1445,9 @@ END(debug_vector)
  22.398 + /////////////////////////////////////////////////////////////////////////////////////////
  22.399 + // 0x5a00 Entry 30 (size 16 bundles) Unaligned Reference (57)
  22.400 + ENTRY(unaligned_access)
  22.401 ++#ifdef XEN
  22.402 ++	REFLECT(30)
  22.403 ++#endif
  22.404 + 	DBG_FAULT(30)
  22.405 + 	mov r16=cr.ipsr
  22.406 + 	mov r31=pr		// prepare to save predicates
  22.407 +@@ -1265,6 +1459,9 @@ END(unaligned_access)
  22.408 + /////////////////////////////////////////////////////////////////////////////////////////
  22.409 + // 0x5b00 Entry 31 (size 16 bundles) Unsupported Data Reference (57)
  22.410 + ENTRY(unsupported_data_reference)
  22.411 ++#ifdef XEN
  22.412 ++	REFLECT(31)
  22.413 ++#endif
  22.414 + 	DBG_FAULT(31)
  22.415 + 	FAULT(31)
  22.416 + END(unsupported_data_reference)
  22.417 +@@ -1273,6 +1470,9 @@ END(unsupported_data_reference)
  22.418 + /////////////////////////////////////////////////////////////////////////////////////////
  22.419 + // 0x5c00 Entry 32 (size 16 bundles) Floating-Point Fault (64)
  22.420 + ENTRY(floating_point_fault)
  22.421 ++#ifdef XEN
  22.422 ++	REFLECT(32)
  22.423 ++#endif
  22.424 + 	DBG_FAULT(32)
  22.425 + 	FAULT(32)
  22.426 + END(floating_point_fault)
  22.427 +@@ -1281,6 +1481,9 @@ END(floating_point_fault)
  22.428 + /////////////////////////////////////////////////////////////////////////////////////////
  22.429 + // 0x5d00 Entry 33 (size 16 bundles) Floating Point Trap (66)
  22.430 + ENTRY(floating_point_trap)
  22.431 ++#ifdef XEN
  22.432 ++	REFLECT(33)
  22.433 ++#endif
  22.434 + 	DBG_FAULT(33)
  22.435 + 	FAULT(33)
  22.436 + END(floating_point_trap)
  22.437 +@@ -1289,6 +1492,9 @@ END(floating_point_trap)
  22.438 + /////////////////////////////////////////////////////////////////////////////////////////
  22.439 + // 0x5e00 Entry 34 (size 16 bundles) Lower Privilege Transfer Trap (66)
  22.440 + ENTRY(lower_privilege_trap)
  22.441 ++#ifdef XEN
  22.442 ++	REFLECT(34)
  22.443 ++#endif
  22.444 + 	DBG_FAULT(34)
  22.445 + 	FAULT(34)
  22.446 + END(lower_privilege_trap)
  22.447 +@@ -1297,6 +1503,9 @@ END(lower_privilege_trap)
  22.448 + /////////////////////////////////////////////////////////////////////////////////////////
  22.449 + // 0x5f00 Entry 35 (size 16 bundles) Taken Branch Trap (68)
  22.450 + ENTRY(taken_branch_trap)
  22.451 ++#ifdef XEN
  22.452 ++	REFLECT(35)
  22.453 ++#endif
  22.454 + 	DBG_FAULT(35)
  22.455 + 	FAULT(35)
  22.456 + END(taken_branch_trap)
  22.457 +@@ -1305,6 +1514,9 @@ END(taken_branch_trap)
  22.458 + /////////////////////////////////////////////////////////////////////////////////////////
  22.459 + // 0x6000 Entry 36 (size 16 bundles) Single Step Trap (69)
  22.460 + ENTRY(single_step_trap)
  22.461 ++#ifdef XEN
  22.462 ++	REFLECT(36)
  22.463 ++#endif
  22.464 + 	DBG_FAULT(36)
  22.465 + 	FAULT(36)
  22.466 + END(single_step_trap)
  22.467 +@@ -1361,6 +1573,9 @@ END(single_step_trap)
  22.468 + /////////////////////////////////////////////////////////////////////////////////////////
  22.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)
  22.470 + ENTRY(ia32_exception)
  22.471 ++#ifdef XEN
  22.472 ++	REFLECT(45)
  22.473 ++#endif
  22.474 + 	DBG_FAULT(45)
  22.475 + 	FAULT(45)
  22.476 + END(ia32_exception)
  22.477 +@@ -1369,6 +1584,9 @@ END(ia32_exception)
  22.478 + /////////////////////////////////////////////////////////////////////////////////////////
  22.479 + // 0x6a00 Entry 46 (size 16 bundles) IA-32 Intercept  (30,31,59,70,71)
  22.480 + ENTRY(ia32_intercept)
  22.481 ++#ifdef XEN
  22.482 ++	REFLECT(46)
  22.483 ++#endif
  22.484 + 	DBG_FAULT(46)
  22.485 + #ifdef	CONFIG_IA32_SUPPORT
  22.486 + 	mov r31=pr
  22.487 +@@ -1399,6 +1617,9 @@ END(ia32_intercept)
  22.488 + /////////////////////////////////////////////////////////////////////////////////////////
  22.489 + // 0x6b00 Entry 47 (size 16 bundles) IA-32 Interrupt  (74)
  22.490 + ENTRY(ia32_interrupt)
  22.491 ++#ifdef XEN
  22.492 ++	REFLECT(47)
  22.493 ++#endif
  22.494 + 	DBG_FAULT(47)
  22.495 + #ifdef CONFIG_IA32_SUPPORT
  22.496 + 	mov r31=pr
  22.497 +@@ -1528,6 +1749,39 @@ END(ia32_interrupt)
  22.498 + 	DBG_FAULT(67)
  22.499 + 	FAULT(67)
  22.500 + 
  22.501 ++#ifdef XEN
  22.502 ++	.org ia64_ivt+0x8000
  22.503 ++ENTRY(dispatch_reflection)
  22.504 ++	/*
  22.505 ++	 * Input:
  22.506 ++	 *	psr.ic:	off
  22.507 ++	 *	r19:	intr type (offset into ivt, see ia64_int.h)
  22.508 ++	 *	r31:	contains saved predicates (pr)
  22.509 ++	 */
  22.510 ++	SAVE_MIN_WITH_COVER_R19
  22.511 ++	alloc r14=ar.pfs,0,0,5,0
  22.512 ++	mov out4=r15
  22.513 ++	mov out0=cr.ifa
  22.514 ++	adds out1=16,sp
  22.515 ++	mov out2=cr.isr
  22.516 ++	mov out3=cr.iim
  22.517 ++//	mov out3=cr.itir
  22.518 ++
  22.519 ++	ssm psr.ic | PSR_DEFAULT_BITS
  22.520 ++	;;
  22.521 ++	srlz.i					// guarantee that interruption collection is on
  22.522 ++	;;
  22.523 ++(p15)	ssm psr.i				// restore psr.i
  22.524 ++	adds r3=8,r2				// set up second base pointer
  22.525 ++	;;
  22.526 ++	SAVE_REST
  22.527 ++	movl r14=ia64_leave_kernel
  22.528 ++	;;
  22.529 ++	mov rp=r14
  22.530 ++	br.sptk.many ia64_prepare_handle_reflection
  22.531 ++END(dispatch_reflection)
  22.532 ++#endif
  22.533 ++
  22.534 + #ifdef CONFIG_IA32_SUPPORT
  22.535 + 
  22.536 + 	/*
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/kernel-time.c	Tue Apr 19 16:50:26 2005 +0000
    23.3 @@ -0,0 +1,44 @@
    23.4 + time.c |    7 ++++++-
    23.5 + 1 files changed, 6 insertions(+), 1 deletion(-)
    23.6 +
    23.7 +Index: linux-2.6.11/kernel/time.c
    23.8 +===================================================================
    23.9 +--- linux-2.6.11.orig/kernel/time.c	2005-03-02 01:37:50.000000000 -0600
   23.10 ++++ linux-2.6.11/kernel/time.c	2005-03-19 14:56:40.767870674 -0600
   23.11 +@@ -495,6 +495,7 @@ void getnstimeofday (struct timespec *tv
   23.12 + 	tv->tv_nsec = nsec;
   23.13 + }
   23.14 + 
   23.15 ++#ifndef XEN
   23.16 + int do_settimeofday (struct timespec *tv)
   23.17 + {
   23.18 + 	time_t wtm_sec, sec = tv->tv_sec;
   23.19 +@@ -503,7 +504,9 @@ int do_settimeofday (struct timespec *tv
   23.20 + 	if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
   23.21 + 		return -EINVAL;
   23.22 + 
   23.23 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   23.24 + 	write_seqlock_irq(&xtime_lock);
   23.25 ++#endif
   23.26 + 	{
   23.27 + 		/*
   23.28 + 		 * This is revolting. We need to set "xtime" correctly. However, the value
   23.29 +@@ -525,7 +528,9 @@ int do_settimeofday (struct timespec *tv
   23.30 + 		time_esterror = NTP_PHASE_LIMIT;
   23.31 + 		time_interpolator_reset();
   23.32 + 	}
   23.33 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
   23.34 + 	write_sequnlock_irq(&xtime_lock);
   23.35 ++#endif
   23.36 + 	clock_was_set();
   23.37 + 	return 0;
   23.38 + }
   23.39 +@@ -552,7 +557,7 @@ void do_gettimeofday (struct timeval *tv
   23.40 + }
   23.41 + 
   23.42 + EXPORT_SYMBOL(do_gettimeofday);
   23.43 +-
   23.44 ++#endif
   23.45 + 
   23.46 + #else
   23.47 + /*
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/kregs.h	Tue Apr 19 16:50:26 2005 +0000
    24.3 @@ -0,0 +1,18 @@
    24.4 + kregs.h |    4 ++++
    24.5 + 1 files changed, 4 insertions(+)
    24.6 +
    24.7 +Index: linux-2.6.11/include/asm-ia64/kregs.h
    24.8 +===================================================================
    24.9 +--- linux-2.6.11.orig/include/asm-ia64/kregs.h	2005-03-02 01:37:49.000000000 -0600
   24.10 ++++ linux-2.6.11/include/asm-ia64/kregs.h	2005-03-19 13:44:24.362628092 -0600
   24.11 +@@ -31,6 +31,10 @@
   24.12 + #define IA64_TR_PALCODE		1	/* itr1: maps PALcode as required by EFI */
   24.13 + #define IA64_TR_PERCPU_DATA	1	/* dtr1: percpu data */
   24.14 + #define IA64_TR_CURRENT_STACK	2	/* dtr2: maps kernel's memory- & register-stacks */
   24.15 ++#ifdef XEN
   24.16 ++#define IA64_TR_SHARED_INFO	3	/* dtr3: page shared with domain */
   24.17 ++#define	IA64_TR_VHPT		4	/* dtr4: vhpt */
   24.18 ++#endif
   24.19 + 
   24.20 + /* Processor status register bits: */
   24.21 + #define IA64_PSR_BE_BIT		1
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/lds.S	Tue Apr 19 16:50:26 2005 +0000
    25.3 @@ -0,0 +1,22 @@
    25.4 + vmlinux.lds.S |    2 ++
    25.5 + 1 files changed, 2 insertions(+)
    25.6 +
    25.7 +Index: linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S
    25.8 +===================================================================
    25.9 +--- linux-2.6.11.orig/arch/ia64/kernel/vmlinux.lds.S	2005-03-02 01:38:25.000000000 -0600
   25.10 ++++ linux-2.6.11/arch/ia64/kernel/vmlinux.lds.S	2005-03-19 13:44:28.746368232 -0600
   25.11 +@@ -11,12 +11,14 @@
   25.12 + OUTPUT_FORMAT("elf64-ia64-little")
   25.13 + OUTPUT_ARCH(ia64)
   25.14 + ENTRY(phys_start)
   25.15 ++#ifndef XEN
   25.16 + jiffies = jiffies_64;
   25.17 + PHDRS {
   25.18 +   code   PT_LOAD;
   25.19 +   percpu PT_LOAD;
   25.20 +   data   PT_LOAD;
   25.21 + }
   25.22 ++#endif
   25.23 + SECTIONS
   25.24 + {
   25.25 +   /* Sections to be discarded */
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxextable.c	Tue Apr 19 16:50:26 2005 +0000
    26.3 @@ -0,0 +1,16 @@
    26.4 + extable.c |    2 ++
    26.5 + 1 files changed, 2 insertions(+)
    26.6 +
    26.7 +Index: linux-2.6.11-xendiffs/kernel/extable.c
    26.8 +===================================================================
    26.9 +--- linux-2.6.11-xendiffs.orig/kernel/extable.c	2005-03-02 01:37:54.000000000 -0600
   26.10 ++++ linux-2.6.11-xendiffs/kernel/extable.c	2005-04-08 14:30:46.283360881 -0500
   26.11 +@@ -20,6 +20,8 @@
   26.12 + #include <asm/uaccess.h>
   26.13 + #include <asm/sections.h>
   26.14 + 
   26.15 ++#define __module_text_address(addr)	(NULL)
   26.16 ++
   26.17 + extern struct exception_table_entry __start___ex_table[];
   26.18 + extern struct exception_table_entry __stop___ex_table[];
   26.19 + 
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxhardirq.h	Tue Apr 19 16:50:26 2005 +0000
    27.3 @@ -0,0 +1,29 @@
    27.4 + hardirq.h |    6 ++++++
    27.5 + 1 files changed, 6 insertions(+)
    27.6 +
    27.7 +Index: linux-2.6.11-xendiffs/include/linux/hardirq.h
    27.8 +===================================================================
    27.9 +--- linux-2.6.11-xendiffs.orig/include/linux/hardirq.h	2005-03-02 01:38:00.000000000 -0600
   27.10 ++++ linux-2.6.11-xendiffs/include/linux/hardirq.h	2005-03-25 08:49:57.301998663 -0600
   27.11 +@@ -2,7 +2,9 @@
   27.12 + #define LINUX_HARDIRQ_H
   27.13 + 
   27.14 + #include <linux/config.h>
   27.15 ++#ifndef XEN
   27.16 + #include <linux/smp_lock.h>
   27.17 ++#endif
   27.18 + #include <asm/hardirq.h>
   27.19 + #include <asm/system.h>
   27.20 + 
   27.21 +@@ -60,7 +62,11 @@
   27.22 +  */
   27.23 + #define in_irq()		(hardirq_count())
   27.24 + #define in_softirq()		(softirq_count())
   27.25 ++#ifndef XEN
   27.26 + #define in_interrupt()		(irq_count())
   27.27 ++#else
   27.28 ++#define in_interrupt()		0		// FIXME LATER
   27.29 ++#endif
   27.30 + 
   27.31 + #if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL)
   27.32 + # define in_atomic()	((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/linuxtime.h	Tue Apr 19 16:50:26 2005 +0000
    28.3 @@ -0,0 +1,36 @@
    28.4 + time.h |    9 +++++++++
    28.5 + 1 files changed, 9 insertions(+)
    28.6 +
    28.7 +Index: linux-2.6.11/include/linux/time.h
    28.8 +===================================================================
    28.9 +--- linux-2.6.11.orig/include/linux/time.h	2005-03-02 01:38:12.000000000 -0600
   28.10 ++++ linux-2.6.11/include/linux/time.h	2005-03-19 13:46:27.987225234 -0600
   28.11 +@@ -1,11 +1,18 @@
   28.12 + #ifndef _LINUX_TIME_H
   28.13 + #define _LINUX_TIME_H
   28.14 + 
   28.15 ++#ifdef XEN
   28.16 ++typedef	s64 time_t;
   28.17 ++typedef	s64 suseconds_t;
   28.18 ++#endif
   28.19 ++
   28.20 + #include <linux/types.h>
   28.21 + 
   28.22 ++#ifndef XEN
   28.23 + #ifdef __KERNEL__
   28.24 + #include <linux/seqlock.h>
   28.25 + #endif
   28.26 ++#endif
   28.27 + 
   28.28 + #ifndef _STRUCT_TIMESPEC
   28.29 + #define _STRUCT_TIMESPEC
   28.30 +@@ -80,7 +87,9 @@ mktime (unsigned int year, unsigned int 
   28.31 + 
   28.32 + extern struct timespec xtime;
   28.33 + extern struct timespec wall_to_monotonic;
   28.34 ++#ifndef XEN
   28.35 + extern seqlock_t xtime_lock;
   28.36 ++#endif
   28.37 + 
   28.38 + static inline unsigned long get_seconds(void)
   28.39 + { 
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mca_asm.h	Tue Apr 19 16:50:26 2005 +0000
    29.3 @@ -0,0 +1,37 @@
    29.4 + mca_asm.h |   11 +++++++++++
    29.5 + 1 files changed, 11 insertions(+)
    29.6 +
    29.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/mca_asm.h
    29.8 +===================================================================
    29.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/mca_asm.h	2005-03-02 01:38:38.000000000 -0600
   29.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/mca_asm.h	2005-04-06 22:41:57.392411032 -0500
   29.11 +@@ -26,8 +26,13 @@
   29.12 +  * direct mapped to physical addresses.
   29.13 +  *	1. Lop off bits 61 thru 63 in the virtual address
   29.14 +  */
   29.15 ++#ifdef XEN
   29.16 ++#define INST_VA_TO_PA(addr)							\
   29.17 ++	dep	addr	= 0, addr, 60, 4
   29.18 ++#else // XEN
   29.19 + #define INST_VA_TO_PA(addr)							\
   29.20 + 	dep	addr	= 0, addr, 61, 3
   29.21 ++#endif // XEN
   29.22 + /*
   29.23 +  * This macro converts a data virtual address to a physical address
   29.24 +  * Right now for simulation purposes the virtual addresses are
   29.25 +@@ -42,9 +47,15 @@
   29.26 +  * direct mapped to physical addresses.
   29.27 +  *	1. Put 0x7 in bits 61 thru 63.
   29.28 +  */
   29.29 ++#ifdef XEN
   29.30 ++#define DATA_PA_TO_VA(addr,temp)							\
   29.31 ++	mov	temp	= 0xf	;;							\
   29.32 ++	dep	addr	= temp, addr, 60, 4
   29.33 ++#else // XEN
   29.34 + #define DATA_PA_TO_VA(addr,temp)							\
   29.35 + 	mov	temp	= 0x7	;;							\
   29.36 + 	dep	addr	= temp, addr, 61, 3
   29.37 ++#endif // XEN
   29.38 + 
   29.39 + #define GET_THIS_PADDR(reg, var)		\
   29.40 + 	mov	reg = IA64_KR(PER_CPU_DATA);;	\
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/minstate.h	Tue Apr 19 16:50:26 2005 +0000
    30.3 @@ -0,0 +1,25 @@
    30.4 + minstate.h |    4 ++--
    30.5 + 1 files changed, 2 insertions(+), 2 deletions(-)
    30.6 +
    30.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h
    30.8 +===================================================================
    30.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/minstate.h	2005-04-06 22:51:31.170261541 -0500
   30.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/minstate.h	2005-04-06 22:54:03.210575034 -0500
   30.11 +@@ -48,7 +48,7 @@
   30.12 + (pUStk)	mov r24=ar.rnat;									\
   30.13 + (pUStk)	addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;	/* compute base of memory stack */	\
   30.14 + (pUStk)	mov r23=ar.bspstore;				/* save ar.bspstore */			\
   30.15 +-(pUStk)	dep r22=-1,r22,61,3;			/* compute kernel virtual addr of RBS */	\
   30.16 ++(pUStk)	dep r22=-1,r22,60,4;			/* compute kernel virtual addr of RBS */	\
   30.17 + 	;;											\
   30.18 + (pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;		/* if in kernel mode, use sp (r12) */		\
   30.19 + (pUStk)	mov ar.bspstore=r22;			/* switch to kernel RBS */			\
   30.20 +@@ -57,7 +57,7 @@
   30.21 + (pUStk)	mov ar.rsc=0x3;		/* set eager mode, pl 0, little-endian, loadrs=0 */		\
   30.22 + 
   30.23 + #define MINSTATE_END_SAVE_MIN_PHYS								\
   30.24 +-	dep r12=-1,r12,61,3;		/* make sp a kernel virtual address */			\
   30.25 ++	dep r12=-1,r12,60,4;		/* make sp a kernel virtual address */			\
   30.26 + 	;;
   30.27 + 
   30.28 + #ifdef MINSTATE_VIRT
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mm_contig.c	Tue Apr 19 16:50:26 2005 +0000
    31.3 @@ -0,0 +1,220 @@
    31.4 + contig.c |  172 +++++++++++++++++----------------------------------------------
    31.5 + 1 files changed, 48 insertions(+), 124 deletions(-)
    31.6 +
    31.7 +Index: linux-2.6.11-xendiffs/arch/ia64/mm/contig.c
    31.8 +===================================================================
    31.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/mm/contig.c	2005-04-07 11:02:50.227598140 -0500
   31.10 ++++ linux-2.6.11-xendiffs/arch/ia64/mm/contig.c	2005-04-07 11:05:21.724931959 -0500
   31.11 +@@ -15,11 +15,21 @@
   31.12 +  * memory.
   31.13 +  */
   31.14 + #include <linux/config.h>
   31.15 ++#ifdef XEN
   31.16 ++#include <xen/sched.h>
   31.17 ++#endif
   31.18 + #include <linux/bootmem.h>
   31.19 + #include <linux/efi.h>
   31.20 + #include <linux/mm.h>
   31.21 + #include <linux/swap.h>
   31.22 + 
   31.23 ++#ifdef XEN
   31.24 ++#undef reserve_bootmem
   31.25 ++extern struct page *zero_page_memmap_ptr;
   31.26 ++struct page *mem_map;
   31.27 ++#define MAX_DMA_ADDRESS ~0UL	// FIXME???
   31.28 ++#endif
   31.29 ++
   31.30 + #include <asm/meminit.h>
   31.31 + #include <asm/pgalloc.h>
   31.32 + #include <asm/pgtable.h>
   31.33 +@@ -38,30 +48,7 @@ static unsigned long num_dma_physpages;
   31.34 + void
   31.35 + show_mem (void)
   31.36 + {
   31.37 +-	int i, total = 0, reserved = 0;
   31.38 +-	int shared = 0, cached = 0;
   31.39 +-
   31.40 +-	printk("Mem-info:\n");
   31.41 +-	show_free_areas();
   31.42 +-
   31.43 +-	printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
   31.44 +-	i = max_mapnr;
   31.45 +-	while (i-- > 0) {
   31.46 +-		if (!pfn_valid(i))
   31.47 +-			continue;
   31.48 +-		total++;
   31.49 +-		if (PageReserved(mem_map+i))
   31.50 +-			reserved++;
   31.51 +-		else if (PageSwapCache(mem_map+i))
   31.52 +-			cached++;
   31.53 +-		else if (page_count(mem_map + i))
   31.54 +-			shared += page_count(mem_map + i) - 1;
   31.55 +-	}
   31.56 +-	printk("%d pages of RAM\n", total);
   31.57 +-	printk("%d reserved pages\n", reserved);
   31.58 +-	printk("%d pages shared\n", shared);
   31.59 +-	printk("%d pages swap cached\n", cached);
   31.60 +-	printk("%ld pages in page table cache\n", pgtable_cache_size);
   31.61 ++	printk("Dummy show_mem\n");
   31.62 + }
   31.63 + 
   31.64 + /* physical address where the bootmem map is located */
   31.65 +@@ -81,6 +68,9 @@ find_max_pfn (unsigned long start, unsig
   31.66 + {
   31.67 + 	unsigned long *max_pfnp = arg, pfn;
   31.68 + 
   31.69 ++#ifdef XEN
   31.70 ++//printf("find_max_pfn: start=%lx, end=%lx, *arg=%lx\n",start,end,*(unsigned long *)arg);
   31.71 ++#endif
   31.72 + 	pfn = (PAGE_ALIGN(end - 1) - PAGE_OFFSET) >> PAGE_SHIFT;
   31.73 + 	if (pfn > *max_pfnp)
   31.74 + 		*max_pfnp = pfn;
   31.75 +@@ -134,41 +124,6 @@ find_bootmap_location (unsigned long sta
   31.76 + 	return 0;
   31.77 + }
   31.78 + 
   31.79 +-/**
   31.80 +- * find_memory - setup memory map
   31.81 +- *
   31.82 +- * Walk the EFI memory map and find usable memory for the system, taking
   31.83 +- * into account reserved areas.
   31.84 +- */
   31.85 +-void
   31.86 +-find_memory (void)
   31.87 +-{
   31.88 +-	unsigned long bootmap_size;
   31.89 +-
   31.90 +-	reserve_memory();
   31.91 +-
   31.92 +-	/* first find highest page frame number */
   31.93 +-	max_pfn = 0;
   31.94 +-	efi_memmap_walk(find_max_pfn, &max_pfn);
   31.95 +-
   31.96 +-	/* how many bytes to cover all the pages */
   31.97 +-	bootmap_size = bootmem_bootmap_pages(max_pfn) << PAGE_SHIFT;
   31.98 +-
   31.99 +-	/* look for a location to hold the bootmap */
  31.100 +-	bootmap_start = ~0UL;
  31.101 +-	efi_memmap_walk(find_bootmap_location, &bootmap_size);
  31.102 +-	if (bootmap_start == ~0UL)
  31.103 +-		panic("Cannot find %ld bytes for bootmap\n", bootmap_size);
  31.104 +-
  31.105 +-	bootmap_size = init_bootmem(bootmap_start >> PAGE_SHIFT, max_pfn);
  31.106 +-
  31.107 +-	/* Free all available memory, then mark bootmem-map as being in use. */
  31.108 +-	efi_memmap_walk(filter_rsvd_memory, free_bootmem);
  31.109 +-	reserve_bootmem(bootmap_start, bootmap_size);
  31.110 +-
  31.111 +-	find_initrd();
  31.112 +-}
  31.113 +-
  31.114 + #ifdef CONFIG_SMP
  31.115 + /**
  31.116 +  * per_cpu_init - setup per-cpu variables
  31.117 +@@ -228,72 +183,41 @@ count_dma_pages (u64 start, u64 end, voi
  31.118 + void
  31.119 + paging_init (void)
  31.120 + {
  31.121 +-	unsigned long max_dma;
  31.122 +-	unsigned long zones_size[MAX_NR_ZONES];
  31.123 +-#ifdef CONFIG_VIRTUAL_MEM_MAP
  31.124 +-	unsigned long zholes_size[MAX_NR_ZONES];
  31.125 +-	unsigned long max_gap;
  31.126 +-#endif
  31.127 +-
  31.128 +-	/* initialize mem_map[] */
  31.129 +-
  31.130 +-	memset(zones_size, 0, sizeof(zones_size));
  31.131 +-
  31.132 +-	num_physpages = 0;
  31.133 +-	efi_memmap_walk(count_pages, &num_physpages);
  31.134 +-
  31.135 +-	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  31.136 +-
  31.137 +-#ifdef CONFIG_VIRTUAL_MEM_MAP
  31.138 +-	memset(zholes_size, 0, sizeof(zholes_size));
  31.139 ++	struct pfn_info *pg;
  31.140 ++	/* Allocate and map the machine-to-phys table */
  31.141 ++	if ((pg = alloc_domheap_pages(NULL, 10)) == NULL)
  31.142 ++		panic("Not enough memory to bootstrap Xen.\n");
  31.143 ++	memset(page_to_virt(pg), 0x55, 16UL << 20);
  31.144 + 
  31.145 +-	num_dma_physpages = 0;
  31.146 +-	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
  31.147 ++	/* Other mapping setup */
  31.148 + 
  31.149 +-	if (max_low_pfn < max_dma) {
  31.150 +-		zones_size[ZONE_DMA] = max_low_pfn;
  31.151 +-		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
  31.152 +-	} else {
  31.153 +-		zones_size[ZONE_DMA] = max_dma;
  31.154 +-		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
  31.155 +-		if (num_physpages > num_dma_physpages) {
  31.156 +-			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  31.157 +-			zholes_size[ZONE_NORMAL] =
  31.158 +-				((max_low_pfn - max_dma) -
  31.159 +-				 (num_physpages - num_dma_physpages));
  31.160 +-		}
  31.161 +-	}
  31.162 +-
  31.163 +-	max_gap = 0;
  31.164 +-	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
  31.165 +-	if (max_gap < LARGE_GAP) {
  31.166 +-		vmem_map = (struct page *) 0;
  31.167 +-		free_area_init_node(0, &contig_page_data, zones_size, 0,
  31.168 +-				    zholes_size);
  31.169 +-	} else {
  31.170 +-		unsigned long map_size;
  31.171 +-
  31.172 +-		/* allocate virtual_mem_map */
  31.173 +-
  31.174 +-		map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
  31.175 +-		vmalloc_end -= map_size;
  31.176 +-		vmem_map = (struct page *) vmalloc_end;
  31.177 +-		efi_memmap_walk(create_mem_map_page_table, NULL);
  31.178 +-
  31.179 +-		mem_map = contig_page_data.node_mem_map = vmem_map;
  31.180 +-		free_area_init_node(0, &contig_page_data, zones_size,
  31.181 +-				    0, zholes_size);
  31.182 +-
  31.183 +-		printk("Virtual mem_map starts at 0x%p\n", mem_map);
  31.184 +-	}
  31.185 +-#else /* !CONFIG_VIRTUAL_MEM_MAP */
  31.186 +-	if (max_low_pfn < max_dma)
  31.187 +-		zones_size[ZONE_DMA] = max_low_pfn;
  31.188 +-	else {
  31.189 +-		zones_size[ZONE_DMA] = max_dma;
  31.190 +-		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
  31.191 +-	}
  31.192 +-	free_area_init(zones_size);
  31.193 +-#endif /* !CONFIG_VIRTUAL_MEM_MAP */
  31.194 + 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
  31.195 + }
  31.196 ++
  31.197 ++struct pfn_info *frame_table;
  31.198 ++unsigned long frame_table_size;
  31.199 ++unsigned long max_page;
  31.200 ++
  31.201 ++/* FIXME: postpone support to machines with big holes between physical memorys.
  31.202 ++ * Current hack allows only efi memdesc upto 4G place. (See efi.c)
  31.203 ++ */
  31.204 ++#ifndef CONFIG_VIRTUAL_MEM_MAP
  31.205 ++#define FT_ALIGN_SIZE	(16UL << 20)
  31.206 ++void __init init_frametable(void)
  31.207 ++{
  31.208 ++	unsigned long i, p;
  31.209 ++	frame_table_size = max_page * sizeof(struct pfn_info);
  31.210 ++	frame_table_size = (frame_table_size + PAGE_SIZE - 1) & PAGE_MASK;
  31.211 ++
  31.212 ++	/* Request continuous trunk from boot allocator, since HV
  31.213 ++	 * address is identity mapped */
  31.214 ++	p = alloc_boot_pages(frame_table_size, FT_ALIGN_SIZE);
  31.215 ++	if (p == 0)
  31.216 ++		panic("Not enough memory for frame table.\n");
  31.217 ++
  31.218 ++	frame_table = __va(p);
  31.219 ++	memset(frame_table, 0, frame_table_size);
  31.220 ++	printk("size of frame_table: %lukB\n",
  31.221 ++		frame_table_size >> 10);
  31.222 ++}
  31.223 ++#endif
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/mmzone.h	Tue Apr 19 16:50:26 2005 +0000
    32.3 @@ -0,0 +1,19 @@
    32.4 + mmzone.h |    4 ++++
    32.5 + 1 files changed, 4 insertions(+)
    32.6 +
    32.7 +Index: linux-2.6.11/include/linux/mmzone.h
    32.8 +===================================================================
    32.9 +--- linux-2.6.11.orig/include/linux/mmzone.h	2005-03-02 01:38:10.000000000 -0600
   32.10 ++++ linux-2.6.11/include/linux/mmzone.h	2005-03-19 13:49:30.427573139 -0600
   32.11 +@@ -209,7 +209,11 @@ struct zone {
   32.12 + 	 * rarely used fields:
   32.13 + 	 */
   32.14 + 	char			*name;
   32.15 ++#ifdef XEN
   32.16 ++};
   32.17 ++#else
   32.18 + } ____cacheline_maxaligned_in_smp;
   32.19 ++#endif
   32.20 + 
   32.21 + 
   32.22 + /*
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/page.h	Tue Apr 19 16:50:26 2005 +0000
    33.3 @@ -0,0 +1,94 @@
    33.4 + page.h |   42 +++++++++++++++++++++++++++++++++++++++---
    33.5 + 1 files changed, 39 insertions(+), 3 deletions(-)
    33.6 +
    33.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/page.h
    33.8 +===================================================================
    33.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/page.h	2005-04-06 22:58:07.597539393 -0500
   33.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/page.h	2005-04-06 23:06:15.908576975 -0500
   33.11 +@@ -12,6 +12,9 @@
   33.12 + #include <asm/intrinsics.h>
   33.13 + #include <asm/types.h>
   33.14 + 
   33.15 ++#ifndef __ASSEMBLY__
   33.16 ++#include <asm/flushtlb.h>
   33.17 ++#endif
   33.18 + /*
   33.19 +  * PAGE_SHIFT determines the actual kernel page size.
   33.20 +  */
   33.21 +@@ -95,9 +98,11 @@ extern int ia64_pfn_valid (unsigned long
   33.22 + #endif
   33.23 + 
   33.24 + #ifndef CONFIG_DISCONTIGMEM
   33.25 ++#ifdef XEN
   33.26 ++#define pfn_valid(pfn)		(0)
   33.27 ++#else
   33.28 + # define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
   33.29 +-# define page_to_pfn(page)	((unsigned long) (page - mem_map))
   33.30 +-# define pfn_to_page(pfn)	(mem_map + (pfn))
   33.31 ++#endif
   33.32 + #else
   33.33 + extern struct page *vmem_map;
   33.34 + extern unsigned long max_low_pfn;
   33.35 +@@ -106,9 +111,15 @@ extern unsigned long max_low_pfn;
   33.36 + # define pfn_to_page(pfn)	(vmem_map + (pfn))
   33.37 + #endif
   33.38 + 
   33.39 +-#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
   33.40 ++#define page_to_pfn(_page)	((unsigned long)((_page) - frame_table))
   33.41 ++#define page_to_virt(_page)	phys_to_virt(page_to_phys(_page))
   33.42 ++
   33.43 ++#define page_to_phys(_page)	(page_to_pfn(_page) << PAGE_SHIFT)
   33.44 + #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
   33.45 + 
   33.46 ++#define pfn_to_page(_pfn)	(frame_table + (_pfn))
   33.47 ++#define phys_to_page(kaddr)	pfn_to_page(((kaddr) >> PAGE_SHIFT))
   33.48 ++
   33.49 + typedef union ia64_va {
   33.50 + 	struct {
   33.51 + 		unsigned long off : 61;		/* intra-region offset */
   33.52 +@@ -124,8 +135,25 @@ typedef union ia64_va {
   33.53 +  * expressed in this way to ensure they result in a single "dep"
   33.54 +  * instruction.
   33.55 +  */
   33.56 ++#ifdef XEN
   33.57 ++typedef union xen_va {
   33.58 ++	struct {
   33.59 ++		unsigned long off : 60;
   33.60 ++		unsigned long reg : 4;
   33.61 ++	} f;
   33.62 ++	unsigned long l;
   33.63 ++	void *p;
   33.64 ++} xen_va;
   33.65 ++
   33.66 ++// xen/drivers/console.c uses __va in a declaration (should be fixed!)
   33.67 ++#define __pa(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   33.68 ++#define __va(x)		({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   33.69 ++//# define __pa(x)	((unsigned long)(((unsigned long)x) - PAGE_OFFSET))
   33.70 ++//# define __va(x)	((void *)((char *)(x) + PAGE_OFFSET))
   33.71 ++#else
   33.72 + #define __pa(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
   33.73 + #define __va(x)		({ia64_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
   33.74 ++#endif
   33.75 + 
   33.76 + #define REGION_NUMBER(x)	({ia64_va _v; _v.l = (long) (x); _v.f.reg;})
   33.77 + #define REGION_OFFSET(x)	({ia64_va _v; _v.l = (long) (x); _v.f.off;})
   33.78 +@@ -197,11 +225,19 @@ get_order (unsigned long size)
   33.79 + # define __pgprot(x)	(x)
   33.80 + #endif /* !STRICT_MM_TYPECHECKS */
   33.81 + 
   33.82 ++#ifdef XEN
   33.83 ++#define PAGE_OFFSET			__IA64_UL_CONST(0xf000000000000000)
   33.84 ++#else
   33.85 + #define PAGE_OFFSET			__IA64_UL_CONST(0xe000000000000000)
   33.86 ++#endif
   33.87 + 
   33.88 + #define VM_DATA_DEFAULT_FLAGS		(VM_READ | VM_WRITE |					\
   33.89 + 					 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |		\
   33.90 + 					 (((current->personality & READ_IMPLIES_EXEC) != 0)	\
   33.91 + 					  ? VM_EXEC : 0))
   33.92 + 
   33.93 ++#ifdef XEN
   33.94 ++#define __flush_tlb() do {} while(0);
   33.95 ++#endif
   33.96 ++
   33.97 + #endif /* _ASM_IA64_PAGE_H */
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pal.S	Tue Apr 19 16:50:26 2005 +0000
    34.3 @@ -0,0 +1,31 @@
    34.4 + pal.S |    8 ++++++++
    34.5 + 1 files changed, 8 insertions(+)
    34.6 +
    34.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/pal.S
    34.8 +===================================================================
    34.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/pal.S	2005-03-02 01:38:33.000000000 -0600
   34.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/pal.S	2005-04-06 22:43:53.817885390 -0500
   34.11 +@@ -166,7 +166,11 @@ GLOBAL_ENTRY(ia64_pal_call_phys_static)
   34.12 + 	adds r8  = 1f-1b,r8		// calculate return address for call
   34.13 + 	;;
   34.14 + 	mov loc4=ar.rsc			// save RSE configuration
   34.15 ++#ifdef XEN
   34.16 ++	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   34.17 ++#else // XEN
   34.18 + 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   34.19 ++#endif // XEN
   34.20 + 	tpa r8=r8			// convert rp to physical
   34.21 + 	;;
   34.22 + 	mov b7 = loc2			// install target to branch reg
   34.23 +@@ -225,7 +229,11 @@ GLOBAL_ENTRY(ia64_pal_call_phys_stacked)
   34.24 + 	mov loc3 = psr		// save psr
   34.25 + 	;;
   34.26 + 	mov loc4=ar.rsc			// save RSE configuration
   34.27 ++#ifdef XEN
   34.28 ++	dep.z loc2=loc2,0,60		// convert pal entry point to physical
   34.29 ++#else // XEN
   34.30 + 	dep.z loc2=loc2,0,61		// convert pal entry point to physical
   34.31 ++#endif // XEN
   34.32 + 	;;
   34.33 + 	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
   34.34 + 	movl r16=PAL_PSR_BITS_TO_CLEAR
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/pgalloc.h	Tue Apr 19 16:50:26 2005 +0000
    35.3 @@ -0,0 +1,78 @@
    35.4 + pgalloc.h |   17 +++++++++++------
    35.5 + 1 files changed, 11 insertions(+), 6 deletions(-)
    35.6 +
    35.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h
    35.8 +===================================================================
    35.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/pgalloc.h	2005-04-08 11:57:30.909774800 -0500
   35.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/pgalloc.h	2005-04-08 11:58:08.102711219 -0500
   35.11 +@@ -18,6 +18,7 @@
   35.12 + #include <linux/compiler.h>
   35.13 + #include <linux/mm.h>
   35.14 + #include <linux/page-flags.h>
   35.15 ++#include <linux/preempt.h>
   35.16 + #include <linux/threads.h>
   35.17 + 
   35.18 + #include <asm/mmu_context.h>
   35.19 +@@ -34,6 +35,10 @@
   35.20 + #define pmd_quicklist		(local_cpu_data->pmd_quick)
   35.21 + #define pgtable_cache_size	(local_cpu_data->pgtable_cache_sz)
   35.22 + 
   35.23 ++/* FIXME: Later 3 level page table should be over, to create 
   35.24 ++ * new interface upon xen memory allocator. To simplify first
   35.25 ++ * effort moving to xen allocator, use xenheap pages temporarily. 
   35.26 ++ */
   35.27 + static inline pgd_t*
   35.28 + pgd_alloc_one_fast (struct mm_struct *mm)
   35.29 + {
   35.30 +@@ -61,7 +66,7 @@ pgd_alloc (struct mm_struct *mm)
   35.31 + 	pgd_t *pgd = pgd_alloc_one_fast(mm);
   35.32 + 
   35.33 + 	if (unlikely(pgd == NULL)) {
   35.34 +-		pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
   35.35 ++		pgd = (pgd_t *)alloc_xenheap_page();
   35.36 + 	}
   35.37 + 	return pgd;
   35.38 + }
   35.39 +@@ -104,7 +109,7 @@ pmd_alloc_one_fast (struct mm_struct *mm
   35.40 + static inline pmd_t*
   35.41 + pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
   35.42 + {
   35.43 +-	pmd_t *pmd = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   35.44 ++	pmd_t *pmd = (pmd_t *)alloc_xenheap_page();
   35.45 + 
   35.46 + 	return pmd;
   35.47 + }
   35.48 +@@ -136,7 +141,7 @@ pmd_populate_kernel (struct mm_struct *m
   35.49 + static inline struct page *
   35.50 + pte_alloc_one (struct mm_struct *mm, unsigned long addr)
   35.51 + {
   35.52 +-	struct page *pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
   35.53 ++	struct page *pte = alloc_xenheap_page();
   35.54 + 
   35.55 + 	return pte;
   35.56 + }
   35.57 +@@ -144,7 +149,7 @@ pte_alloc_one (struct mm_struct *mm, uns
   35.58 + static inline pte_t *
   35.59 + pte_alloc_one_kernel (struct mm_struct *mm, unsigned long addr)
   35.60 + {
   35.61 +-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
   35.62 ++	pte_t *pte = (pte_t *)alloc_xenheap_page();
   35.63 + 
   35.64 + 	return pte;
   35.65 + }
   35.66 +@@ -152,13 +157,13 @@ pte_alloc_one_kernel (struct mm_struct *
   35.67 + static inline void
   35.68 + pte_free (struct page *pte)
   35.69 + {
   35.70 +-	__free_page(pte);
   35.71 ++	free_xenheap_page(pte);
   35.72 + }
   35.73 + 
   35.74 + static inline void
   35.75 + pte_free_kernel (pte_t *pte)
   35.76 + {
   35.77 +-	free_page((unsigned long) pte);
   35.78 ++	free_xenheap_page((unsigned long) pte);
   35.79 + }
   35.80 + 
   35.81 + #define __pte_free_tlb(tlb, pte)	tlb_remove_page((tlb), (pte))
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/processor.h	Tue Apr 19 16:50:26 2005 +0000
    36.3 @@ -0,0 +1,24 @@
    36.4 + processor.h |    4 ++++
    36.5 + 1 files changed, 4 insertions(+)
    36.6 +
    36.7 +Index: linux-2.6.11/include/asm-ia64/processor.h
    36.8 +===================================================================
    36.9 +--- linux-2.6.11.orig/include/asm-ia64/processor.h	2005-03-02 01:37:58.000000000 -0600
   36.10 ++++ linux-2.6.11/include/asm-ia64/processor.h	2005-03-19 14:26:01.062135543 -0600
   36.11 +@@ -408,12 +408,16 @@ extern void ia64_setreg_unknown_kr (void
   36.12 +  */
   36.13 + 
   36.14 + /* Return TRUE if task T owns the fph partition of the CPU we're running on. */
   36.15 ++#ifdef XEN
   36.16 ++#define ia64_is_local_fpu_owner(t) 0
   36.17 ++#else
   36.18 + #define ia64_is_local_fpu_owner(t)								\
   36.19 + ({												\
   36.20 + 	struct task_struct *__ia64_islfo_task = (t);						\
   36.21 + 	(__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id()				\
   36.22 + 	 && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER));	\
   36.23 + })
   36.24 ++#endif
   36.25 + 
   36.26 + /* Mark task T as owning the fph partition of the CPU we're running on. */
   36.27 + #define ia64_set_local_fpu_owner(t) do {						\
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/sal.h	Tue Apr 19 16:50:26 2005 +0000
    37.3 @@ -0,0 +1,39 @@
    37.4 + sal.h |   17 +++++++++++++++++
    37.5 + 1 files changed, 17 insertions(+)
    37.6 +
    37.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/sal.h
    37.8 +===================================================================
    37.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/sal.h	2005-04-08 12:00:53.510988510 -0500
   37.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/sal.h	2005-04-08 12:02:17.778587216 -0500
   37.11 +@@ -36,6 +36,7 @@
   37.12 + #ifndef __ASSEMBLY__
   37.13 + 
   37.14 + #include <linux/bcd.h>
   37.15 ++#include <linux/preempt.h>
   37.16 + #include <linux/spinlock.h>
   37.17 + #include <linux/efi.h>
   37.18 + 
   37.19 +@@ -650,7 +651,23 @@ ia64_sal_freq_base (unsigned long which,
   37.20 + {
   37.21 + 	struct ia64_sal_retval isrv;
   37.22 + 
   37.23 ++//#ifdef XEN
   37.24 ++#if 0
   37.25 ++	unsigned long *x = (unsigned long *)ia64_sal;
   37.26 ++	unsigned long *inst = (unsigned long *)*x;
   37.27 ++	unsigned long __ia64_sc_flags;
   37.28 ++	struct ia64_fpreg __ia64_sc_fr[6];
   37.29 ++printf("ia64_sal_freq_base: about to save_scratch_fpregs\n");
   37.30 ++	ia64_save_scratch_fpregs(__ia64_sc_fr);
   37.31 ++	spin_lock_irqsave(&sal_lock, __ia64_sc_flags);
   37.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]);
   37.33 ++printf("first inst=%p,%p\n",inst[0],inst[1]);
   37.34 ++	isrv = (*ia64_sal)(SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   37.35 ++	spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags);
   37.36 ++	ia64_load_scratch_fpregs(__ia64_sc_fr);
   37.37 ++#else
   37.38 + 	SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
   37.39 ++#endif
   37.40 + 	*ticks_per_second = isrv.v0;
   37.41 + 	*drift_info = isrv.v1;
   37.42 + 	return isrv.status;
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/series	Tue Apr 19 16:50:26 2005 +0000
    38.3 @@ -0,0 +1,40 @@
    38.4 +bootmem.h
    38.5 +current.h
    38.6 +efi.c
    38.7 +efi.h
    38.8 +entry.S
    38.9 +gcc_intrin.h
   38.10 +hardirq.h
   38.11 +head.S
   38.12 +hpsim_irq.c
   38.13 +hpsim_ssc.h
   38.14 +hw_irq.h
   38.15 +ide.h
   38.16 +init_task.c
   38.17 +init_task.h
   38.18 +interrupt.h
   38.19 +io.h
   38.20 +irq.h
   38.21 +irq_ia64.c
   38.22 +ivt.S
   38.23 +kregs.h
   38.24 +lds.S
   38.25 +linuxtime.h
   38.26 +minstate.h
   38.27 +mm_bootmem.c
   38.28 +mm_contig.c
   38.29 +mmzone.h
   38.30 +page_alloc.c
   38.31 +page.h
   38.32 +processor.h
   38.33 +sal.h
   38.34 +setup.c
   38.35 +slab.c
   38.36 +slab.h
   38.37 +system.h
   38.38 +time.c
   38.39 +kernel-time.c
   38.40 +tlb.c
   38.41 +types.h
   38.42 +unaligned.c
   38.43 +wait.h
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/setup.c	Tue Apr 19 16:50:26 2005 +0000
    39.3 @@ -0,0 +1,214 @@
    39.4 + setup.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------
    39.5 + 1 files changed, 58 insertions(+), 14 deletions(-)
    39.6 +
    39.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c
    39.8 +===================================================================
    39.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/setup.c	2005-04-07 17:44:13.294980153 -0500
   39.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/setup.c	2005-04-07 17:46:37.157717072 -0500
   39.11 +@@ -21,6 +21,9 @@
   39.12 + #include <linux/init.h>
   39.13 + 
   39.14 + #include <linux/acpi.h>
   39.15 ++#ifdef XEN
   39.16 ++#include <xen/sched.h>
   39.17 ++#endif
   39.18 + #include <linux/bootmem.h>
   39.19 + #include <linux/console.h>
   39.20 + #include <linux/delay.h>
   39.21 +@@ -30,13 +33,17 @@
   39.22 + #include <linux/seq_file.h>
   39.23 + #include <linux/string.h>
   39.24 + #include <linux/threads.h>
   39.25 ++#ifndef XEN
   39.26 + #include <linux/tty.h>
   39.27 + #include <linux/serial.h>
   39.28 + #include <linux/serial_core.h>
   39.29 ++#endif
   39.30 + #include <linux/efi.h>
   39.31 + #include <linux/initrd.h>
   39.32 + 
   39.33 ++#ifndef XEN
   39.34 + #include <asm/ia32.h>
   39.35 ++#endif
   39.36 + #include <asm/machvec.h>
   39.37 + #include <asm/mca.h>
   39.38 + #include <asm/meminit.h>
   39.39 +@@ -51,6 +58,12 @@
   39.40 + #include <asm/smp.h>
   39.41 + #include <asm/system.h>
   39.42 + #include <asm/unistd.h>
   39.43 ++#ifdef XEN
   39.44 ++#include <linux/mm.h>
   39.45 ++#include <asm/mmu_context.h>
   39.46 ++extern unsigned long loops_per_jiffy;		// from linux/init/main.c
   39.47 ++char saved_command_line[COMMAND_LINE_SIZE];	// from linux/init/main.c
   39.48 ++#endif
   39.49 + 
   39.50 + #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
   39.51 + # error "struct cpuinfo_ia64 too big!"
   39.52 +@@ -66,7 +79,9 @@ DEFINE_PER_CPU(unsigned long, local_per_
   39.53 + DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
   39.54 + unsigned long ia64_cycles_per_usec;
   39.55 + struct ia64_boot_param *ia64_boot_param;
   39.56 ++#ifndef XEN
   39.57 + struct screen_info screen_info;
   39.58 ++#endif
   39.59 + 
   39.60 + unsigned long ia64_max_cacheline_size;
   39.61 + unsigned long ia64_iobase;	/* virtual address for I/O accesses */
   39.62 +@@ -95,7 +110,6 @@ EXPORT_SYMBOL(ia64_max_iommu_merge_mask)
   39.63 + struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
   39.64 + int num_rsvd_regions;
   39.65 + 
   39.66 +-
   39.67 + /*
   39.68 +  * Filter incoming memory segments based on the primitive map created from the boot
   39.69 +  * parameters. Segments contained in the map are removed from the memory ranges. A
   39.70 +@@ -125,9 +139,12 @@ filter_rsvd_memory (unsigned long start,
   39.71 + 	for (i = 0; i < num_rsvd_regions; ++i) {
   39.72 + 		range_start = max(start, prev_start);
   39.73 + 		range_end   = min(end, rsvd_region[i].start);
   39.74 +-
   39.75 +-		if (range_start < range_end)
   39.76 +-			call_pernode_memory(__pa(range_start), range_end - range_start, func);
   39.77 ++		/* init_boot_pages requires "ps, pe" */
   39.78 ++		if (range_start < range_end) {
   39.79 ++			printk("Init boot pages: 0x%lx -> 0x%lx.\n",
   39.80 ++				__pa(range_start), __pa(range_end));
   39.81 ++			(*func)(__pa(range_start), __pa(range_end), 0);
   39.82 ++		}
   39.83 + 
   39.84 + 		/* nothing more available in this segment */
   39.85 + 		if (range_end == end) return 0;
   39.86 +@@ -184,17 +201,17 @@ reserve_memory (void)
   39.87 + 				+ strlen(__va(ia64_boot_param->command_line)) + 1);
   39.88 + 	n++;
   39.89 + 
   39.90 ++	/* Reserve xen image/bitmap/xen-heap */
   39.91 + 	rsvd_region[n].start = (unsigned long) ia64_imva((void *)KERNEL_START);
   39.92 +-	rsvd_region[n].end   = (unsigned long) ia64_imva(_end);
   39.93 ++	rsvd_region[n].end   = rsvd_region[n].start + xenheap_size;
   39.94 + 	n++;
   39.95 + 
   39.96 +-#ifdef CONFIG_BLK_DEV_INITRD
   39.97 ++	/* This is actually dom0 image */
   39.98 + 	if (ia64_boot_param->initrd_start) {
   39.99 + 		rsvd_region[n].start = (unsigned long)__va(ia64_boot_param->initrd_start);
  39.100 + 		rsvd_region[n].end   = rsvd_region[n].start + ia64_boot_param->initrd_size;
  39.101 + 		n++;
  39.102 + 	}
  39.103 +-#endif
  39.104 + 
  39.105 + 	/* end of memory marker */
  39.106 + 	rsvd_region[n].start = ~0UL;
  39.107 +@@ -204,6 +221,16 @@ reserve_memory (void)
  39.108 + 	num_rsvd_regions = n;
  39.109 + 
  39.110 + 	sort_regions(rsvd_region, num_rsvd_regions);
  39.111 ++
  39.112 ++	{
  39.113 ++		int i;
  39.114 ++		printk("Reserved regions: \n");
  39.115 ++		for (i = 0; i < num_rsvd_regions; i++)
  39.116 ++			printk("  [%d] -> [0x%lx, 0x%lx]\n",
  39.117 ++				i,
  39.118 ++				rsvd_region[i].start,
  39.119 ++				rsvd_region[i].end);
  39.120 ++	}
  39.121 + }
  39.122 + 
  39.123 + /**
  39.124 +@@ -298,18 +325,17 @@ mark_bsp_online (void)
  39.125 + #endif
  39.126 + }
  39.127 + 
  39.128 ++#ifdef XEN
  39.129 + void __init
  39.130 +-setup_arch (char **cmdline_p)
  39.131 ++early_setup_arch (char **cmdline_p)
  39.132 + {
  39.133 + 	unw_init();
  39.134 + 
  39.135 +-	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
  39.136 +-
  39.137 + 	*cmdline_p = __va(ia64_boot_param->command_line);
  39.138 + 	strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
  39.139 ++	cmdline_parse(*cmdline_p);
  39.140 + 
  39.141 + 	efi_init();
  39.142 +-	io_port_init();
  39.143 + 
  39.144 + #ifdef CONFIG_IA64_GENERIC
  39.145 + 	{
  39.146 +@@ -339,6 +365,10 @@ setup_arch (char **cmdline_p)
  39.147 + 	if (early_console_setup(*cmdline_p) == 0)
  39.148 + 		mark_bsp_online();
  39.149 + 
  39.150 ++#ifdef XEN
  39.151 ++#undef CONFIG_ACPI_BOOT
  39.152 ++#endif
  39.153 ++
  39.154 + #ifdef CONFIG_ACPI_BOOT
  39.155 + 	/* Initialize the ACPI boot-time table parser */
  39.156 + 	acpi_table_init();
  39.157 +@@ -350,9 +380,13 @@ setup_arch (char **cmdline_p)
  39.158 + 	smp_build_cpu_map();	/* happens, e.g., with the Ski simulator */
  39.159 + # endif
  39.160 + #endif /* CONFIG_APCI_BOOT */
  39.161 ++	io_port_init();
  39.162 ++}
  39.163 ++#endif
  39.164 + 
  39.165 +-	find_memory();
  39.166 +-
  39.167 ++void __init
  39.168 ++setup_arch (void)
  39.169 ++{
  39.170 + 	/* process SAL system table: */
  39.171 + 	ia64_sal_init(efi.sal_systab);
  39.172 + 
  39.173 +@@ -388,7 +422,6 @@ setup_arch (char **cmdline_p)
  39.174 + 	if (!strstr(saved_command_line, "nomca"))
  39.175 + 		ia64_mca_init();
  39.176 + 
  39.177 +-	platform_setup(cmdline_p);
  39.178 + 	paging_init();
  39.179 + }
  39.180 + 
  39.181 +@@ -448,6 +481,9 @@ show_cpuinfo (struct seq_file *m, void *
  39.182 + 		sprintf(cp, " 0x%lx", mask);
  39.183 + 	}
  39.184 + 
  39.185 ++#ifdef XEN
  39.186 ++#define seq_printf(a,b...) printf(b)
  39.187 ++#endif
  39.188 + 	seq_printf(m,
  39.189 + 		   "processor  : %d\n"
  39.190 + 		   "vendor     : %s\n"
  39.191 +@@ -659,11 +695,17 @@ cpu_init (void)
  39.192 + 					| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
  39.193 + 	atomic_inc(&init_mm.mm_count);
  39.194 + 	current->active_mm = &init_mm;
  39.195 ++#ifdef XEN
  39.196 ++	if (current->domain->arch.mm)
  39.197 ++#else
  39.198 + 	if (current->mm)
  39.199 ++#endif
  39.200 + 		BUG();
  39.201 + 
  39.202 + 	ia64_mmu_init(ia64_imva(cpu_data));
  39.203 ++#ifndef XEN
  39.204 + 	ia64_mca_cpu_init(ia64_imva(cpu_data));
  39.205 ++#endif
  39.206 + 
  39.207 + #ifdef CONFIG_IA32_SUPPORT
  39.208 + 	ia32_cpu_init();
  39.209 +@@ -711,6 +753,8 @@ cpu_init (void)
  39.210 + void
  39.211 + check_bugs (void)
  39.212 + {
  39.213 ++#ifndef XEN
  39.214 + 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
  39.215 + 			       (unsigned long) __end___mckinley_e9_bundles);
  39.216 ++#endif
  39.217 + }
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/slab.h	Tue Apr 19 16:50:26 2005 +0000
    40.3 @@ -0,0 +1,19 @@
    40.4 + slab.h |    4 ++++
    40.5 + 1 files changed, 4 insertions(+)
    40.6 +
    40.7 +Index: linux-2.6.11/include/linux/slab.h
    40.8 +===================================================================
    40.9 +--- linux-2.6.11.orig/include/linux/slab.h	2005-03-02 01:38:33.000000000 -0600
   40.10 ++++ linux-2.6.11/include/linux/slab.h	2005-03-19 14:35:19.301871922 -0600
   40.11 +@@ -91,7 +91,11 @@ static inline void *kmalloc(size_t size,
   40.12 + 			goto found; \
   40.13 + 		else \
   40.14 + 			i++;
   40.15 ++#ifdef XEN
   40.16 ++#include <linux/kmalloc_sizes.h>
   40.17 ++#else
   40.18 + #include "kmalloc_sizes.h"
   40.19 ++#endif
   40.20 + #undef CACHE
   40.21 + 		{
   40.22 + 			extern void __you_cannot_kmalloc_that_much(void);
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/swiotlb.c	Tue Apr 19 16:50:26 2005 +0000
    41.3 @@ -0,0 +1,77 @@
    41.4 + swiotlb.c |   21 +++++++++++++--------
    41.5 + 1 files changed, 13 insertions(+), 8 deletions(-)
    41.6 +
    41.7 +Index: linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c
    41.8 +===================================================================
    41.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/lib/swiotlb.c	2005-04-08 12:13:54.040202667 -0500
   41.10 ++++ linux-2.6.11-xendiffs/arch/ia64/lib/swiotlb.c	2005-04-08 12:19:09.170367318 -0500
   41.11 +@@ -124,8 +124,11 @@ swiotlb_init_with_default_size (size_t d
   41.12 + 	/*
   41.13 + 	 * Get IO TLB memory from the low pages
   41.14 + 	 */
   41.15 +-	io_tlb_start = alloc_bootmem_low_pages(io_tlb_nslabs *
   41.16 +-					       (1 << IO_TLB_SHIFT));
   41.17 ++	/* FIXME: Do we really need swiotlb in HV? If all memory trunks
   41.18 ++	 * presented to guest as <4G, are actually <4G in machine range,
   41.19 ++	 * no DMA intevention from HV...
   41.20 ++	 */
   41.21 ++	io_tlb_start = alloc_xenheap_pages(get_order(io_tlb_nslabs * (1 << IO_TLB_SHIFT)));
   41.22 + 	if (!io_tlb_start)
   41.23 + 		panic("Cannot allocate SWIOTLB buffer");
   41.24 + 	io_tlb_end = io_tlb_start + io_tlb_nslabs * (1 << IO_TLB_SHIFT);
   41.25 +@@ -135,16 +138,16 @@ swiotlb_init_with_default_size (size_t d
   41.26 + 	 * to find contiguous free memory regions of size up to IO_TLB_SEGSIZE
   41.27 + 	 * between io_tlb_start and io_tlb_end.
   41.28 + 	 */
   41.29 +-	io_tlb_list = alloc_bootmem(io_tlb_nslabs * sizeof(int));
   41.30 ++	io_tlb_list = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(int)));
   41.31 + 	for (i = 0; i < io_tlb_nslabs; i++)
   41.32 +  		io_tlb_list[i] = IO_TLB_SEGSIZE - OFFSET(i, IO_TLB_SEGSIZE);
   41.33 + 	io_tlb_index = 0;
   41.34 +-	io_tlb_orig_addr = alloc_bootmem(io_tlb_nslabs * sizeof(char *));
   41.35 ++	io_tlb_orig_addr = alloc_xenheap_pages(get_order(io_tlb_nslabs * sizeof(char *)));
   41.36 + 
   41.37 + 	/*
   41.38 + 	 * Get the overflow emergency buffer
   41.39 + 	 */
   41.40 +-	io_tlb_overflow_buffer = alloc_bootmem_low(io_tlb_overflow);
   41.41 ++	io_tlb_overflow_buffer = alloc_xenheap_pages(get_order(io_tlb_overflow));
   41.42 + 	printk(KERN_INFO "Placing software IO TLB between 0x%lx - 0x%lx\n",
   41.43 + 	       virt_to_phys(io_tlb_start), virt_to_phys(io_tlb_end));
   41.44 + }
   41.45 +@@ -328,13 +331,13 @@ swiotlb_alloc_coherent(struct device *hw
   41.46 + 	 */
   41.47 + 	flags |= GFP_DMA;
   41.48 + 
   41.49 +-	ret = (void *)__get_free_pages(flags, order);
   41.50 ++	ret = (void *)alloc_xenheap_pages(get_order(size));
   41.51 + 	if (ret && address_needs_mapping(hwdev, virt_to_phys(ret))) {
   41.52 + 		/*
   41.53 + 		 * The allocated memory isn't reachable by the device.
   41.54 + 		 * Fall back on swiotlb_map_single().
   41.55 + 		 */
   41.56 +-		free_pages((unsigned long) ret, order);
   41.57 ++		free_xenheap_pages((unsigned long) ret, order);
   41.58 + 		ret = NULL;
   41.59 + 	}
   41.60 + 	if (!ret) {
   41.61 +@@ -372,7 +375,7 @@ swiotlb_free_coherent(struct device *hwd
   41.62 + {
   41.63 + 	if (!(vaddr >= (void *)io_tlb_start
   41.64 +                     && vaddr < (void *)io_tlb_end))
   41.65 +-		free_pages((unsigned long) vaddr, get_order(size));
   41.66 ++		free_xenheap_pages((unsigned long) vaddr, get_order(size));
   41.67 + 	else
   41.68 + 		/* DMA_TO_DEVICE to avoid memcpy in unmap_single */
   41.69 + 		swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE);
   41.70 +@@ -388,8 +391,10 @@ swiotlb_full(struct device *dev, size_t 
   41.71 + 	 * When the mapping is small enough return a static buffer to limit
   41.72 + 	 * the damage, or panic when the transfer is too big.
   41.73 + 	 */
   41.74 ++#ifndef XEN
   41.75 + 	printk(KERN_ERR "PCI-DMA: Out of SW-IOMMU space for %lu bytes at "
   41.76 + 	       "device %s\n", size, dev ? dev->bus_id : "?");
   41.77 ++#endif
   41.78 + 
   41.79 + 	if (size > io_tlb_overflow && do_panic) {
   41.80 + 		if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/system.h	Tue Apr 19 16:50:26 2005 +0000
    42.3 @@ -0,0 +1,48 @@
    42.4 + system.h |   15 +++++++++++++++
    42.5 + 1 files changed, 15 insertions(+)
    42.6 +
    42.7 +Index: linux-2.6.11-xendiffs/include/asm-ia64/system.h
    42.8 +===================================================================
    42.9 +--- linux-2.6.11-xendiffs.orig/include/asm-ia64/system.h	2005-04-07 10:39:11.066701457 -0500
   42.10 ++++ linux-2.6.11-xendiffs/include/asm-ia64/system.h	2005-04-07 10:40:19.540544127 -0500
   42.11 +@@ -24,8 +24,16 @@
   42.12 +  * 0xa000000000000000+2*PERCPU_PAGE_SIZE
   42.13 +  * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
   42.14 +  */
   42.15 ++#ifdef XEN
   42.16 ++//#define KERNEL_START		 0xf000000100000000
   42.17 ++#define KERNEL_START		 0xf000000004000000
   42.18 ++#define PERCPU_ADDR		 0xf100000000000000-PERCPU_PAGE_SIZE
   42.19 ++#define SHAREDINFO_ADDR		 0xf100000000000000
   42.20 ++#define VHPT_ADDR		 0xf200000000000000
   42.21 ++#else
   42.22 + #define KERNEL_START		 __IA64_UL_CONST(0xa000000100000000)
   42.23 + #define PERCPU_ADDR		(-PERCPU_PAGE_SIZE)
   42.24 ++#endif
   42.25 + 
   42.26 + #ifndef __ASSEMBLY__
   42.27 + 
   42.28 +@@ -218,9 +226,13 @@ extern void ia64_load_extra (struct task
   42.29 + # define PERFMON_IS_SYSWIDE() (0)
   42.30 + #endif
   42.31 + 
   42.32 ++#ifdef XEN
   42.33 ++#define IA64_HAS_EXTRA_STATE(t) 0
   42.34 ++#else
   42.35 + #define IA64_HAS_EXTRA_STATE(t)							\
   42.36 + 	((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID)	\
   42.37 + 	 || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE())
   42.38 ++#endif
   42.39 + 
   42.40 + #define __switch_to(prev,next,last) do {							 \
   42.41 + 	if (IA64_HAS_EXTRA_STATE(prev))								 \
   42.42 +@@ -249,6 +261,9 @@ extern void ia64_load_extra (struct task
   42.43 + #else
   42.44 + # define switch_to(prev,next,last)	__switch_to(prev, next, last)
   42.45 + #endif
   42.46 ++//#ifdef XEN
   42.47 ++//#undef switch_to
   42.48 ++//#endif
   42.49 + 
   42.50 + /*
   42.51 +  * On IA-64, we don't want to hold the runqueue's lock during the low-level context-switch,
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/time.c	Tue Apr 19 16:50:26 2005 +0000
    43.3 @@ -0,0 +1,302 @@
    43.4 + time.c |  158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    43.5 + 1 files changed, 158 insertions(+)
    43.6 +
    43.7 +Index: linux-2.6.11-xendiffs/arch/ia64/kernel/time.c
    43.8 +===================================================================
    43.9 +--- linux-2.6.11-xendiffs.orig/arch/ia64/kernel/time.c	2005-04-07 17:02:39.634985144 -0500
   43.10 ++++ linux-2.6.11-xendiffs/arch/ia64/kernel/time.c	2005-04-07 17:23:52.777723222 -0500
   43.11 +@@ -10,16 +10,22 @@
   43.12 +  */
   43.13 + #include <linux/config.h>
   43.14 + 
   43.15 ++#ifndef XEN
   43.16 + #include <linux/cpu.h>
   43.17 ++#endif
   43.18 + #include <linux/init.h>
   43.19 + #include <linux/kernel.h>
   43.20 + #include <linux/module.h>
   43.21 ++#ifndef XEN
   43.22 + #include <linux/profile.h>
   43.23 ++#endif
   43.24 + #include <linux/sched.h>
   43.25 + #include <linux/time.h>
   43.26 + #include <linux/interrupt.h>
   43.27 + #include <linux/efi.h>
   43.28 ++#ifndef XEN
   43.29 + #include <linux/profile.h>
   43.30 ++#endif
   43.31 + #include <linux/timex.h>
   43.32 + 
   43.33 + #include <asm/machvec.h>
   43.34 +@@ -29,10 +35,19 @@
   43.35 + #include <asm/sal.h>
   43.36 + #include <asm/sections.h>
   43.37 + #include <asm/system.h>
   43.38 ++#ifdef XEN
   43.39 ++#include <asm/ia64_int.h>
   43.40 ++#endif
   43.41 + 
   43.42 + extern unsigned long wall_jiffies;
   43.43 + 
   43.44 ++#ifndef XEN
   43.45 + u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES;
   43.46 ++#else
   43.47 ++#define INITIAL_JIFFIES 0
   43.48 ++u64 jiffies_64 = INITIAL_JIFFIES;
   43.49 ++#define CPU_PROFILING 0
   43.50 ++#endif
   43.51 + 
   43.52 + EXPORT_SYMBOL(jiffies_64);
   43.53 + 
   43.54 +@@ -45,33 +60,154 @@ EXPORT_SYMBOL(last_cli_ip);
   43.55 + 
   43.56 + #endif
   43.57 + 
   43.58 ++#ifdef XEN
   43.59 ++volatile unsigned long last_nsec_offset;
   43.60 ++extern rwlock_t xtime_lock;
   43.61 ++unsigned long cpu_khz;  /* Detected as we calibrate the TSC */
   43.62 ++static s_time_t        stime_irq;       /* System time at last 'time update' */
   43.63 ++
   43.64 ++static inline u64 get_time_delta(void)
   43.65 ++{
   43.66 ++	return ia64_get_itc();
   43.67 ++}
   43.68 ++
   43.69 ++s_time_t get_s_time(void)
   43.70 ++{
   43.71 ++    s_time_t now;
   43.72 ++    unsigned long flags;
   43.73 ++
   43.74 ++    read_lock_irqsave(&xtime_lock, flags);
   43.75 ++
   43.76 ++    now = stime_irq + get_time_delta();
   43.77 ++
   43.78 ++    /* Ensure that the returned system time is monotonically increasing. */
   43.79 ++    {
   43.80 ++        static s_time_t prev_now = 0;
   43.81 ++        if ( unlikely(now < prev_now) )
   43.82 ++            now = prev_now;
   43.83 ++        prev_now = now;
   43.84 ++    }
   43.85 ++
   43.86 ++    read_unlock_irqrestore(&xtime_lock, flags);
   43.87 ++
   43.88 ++    return now; 
   43.89 ++}
   43.90 ++
   43.91 ++void update_dom_time(struct exec_domain *ed)
   43.92 ++{
   43.93 ++// FIXME: implement this?
   43.94 ++//	printf("update_dom_time: called, not implemented, skipping\n");
   43.95 ++	return;
   43.96 ++}
   43.97 ++
   43.98 ++/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
   43.99 ++void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
  43.100 ++{
  43.101 ++// FIXME: Should this be do_settimeofday (from linux)???
  43.102 ++	printf("do_settime: called, not implemented, stopping\n");
  43.103 ++	dummy();
  43.104 ++}
  43.105 ++#endif
  43.106 ++
  43.107 ++#if 0	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  43.108 ++#endif	/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  43.109 ++ 
  43.110 ++#ifndef XEN
  43.111 + static struct time_interpolator itc_interpolator = {
  43.112 + 	.shift = 16,
  43.113 + 	.mask = 0xffffffffffffffffLL,
  43.114 + 	.source = TIME_SOURCE_CPU
  43.115 + };
  43.116 ++#endif
  43.117 ++
  43.118 ++#ifdef XEN
  43.119 ++unsigned long domain0_ready = 0;	// FIXME (see below)
  43.120 ++#define typecheck(a,b)	1
  43.121 ++/* FROM linux/include/linux/jiffies.h */
  43.122 ++/*
  43.123 ++ *	These inlines deal with timer wrapping correctly. You are 
  43.124 ++ *	strongly encouraged to use them
  43.125 ++ *	1. Because people otherwise forget
  43.126 ++ *	2. Because if the timer wrap changes in future you won't have to
  43.127 ++ *	   alter your driver code.
  43.128 ++ *
  43.129 ++ * time_after(a,b) returns true if the time a is after time b.
  43.130 ++ *
  43.131 ++ * Do this with "<0" and ">=0" to only test the sign of the result. A
  43.132 ++ * good compiler would generate better code (and a really good compiler
  43.133 ++ * wouldn't care). Gcc is currently neither.
  43.134 ++ */
  43.135 ++#define time_after(a,b)		\
  43.136 ++	(typecheck(unsigned long, a) && \
  43.137 ++	 typecheck(unsigned long, b) && \
  43.138 ++	 ((long)(b) - (long)(a) < 0))
  43.139 ++#define time_before(a,b)	time_after(b,a)
  43.140 ++
  43.141 ++#define time_after_eq(a,b)	\
  43.142 ++	(typecheck(unsigned long, a) && \
  43.143 ++	 typecheck(unsigned long, b) && \
  43.144 ++	 ((long)(a) - (long)(b) >= 0))
  43.145 ++#define time_before_eq(a,b)	time_after_eq(b,a)
  43.146 ++#endif
  43.147 + 
  43.148 + static irqreturn_t
  43.149 + timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
  43.150 + {
  43.151 + 	unsigned long new_itm;
  43.152 + 
  43.153 ++#ifndef XEN
  43.154 + 	if (unlikely(cpu_is_offline(smp_processor_id()))) {
  43.155 + 		return IRQ_HANDLED;
  43.156 + 	}
  43.157 ++#endif
  43.158 ++#ifdef XEN
  43.159 ++	if (current->domain == dom0) {
  43.160 ++		// FIXME: there's gotta be a better way of doing this...
  43.161 ++		// We have to ensure that domain0 is launched before we
  43.162 ++		// call vcpu_timer_expired on it
  43.163 ++		//domain0_ready = 1; // moved to xensetup.c
  43.164 ++	}
  43.165 ++	if (domain0_ready && vcpu_timer_expired(dom0->exec_domain[0])) {
  43.166 ++		vcpu_pend_timer(dom0->exec_domain[0]);
  43.167 ++		//vcpu_set_next_timer(dom0->exec_domain[0]);
  43.168 ++		domain_wake(dom0->exec_domain[0]);
  43.169 ++	}
  43.170 ++	if (!is_idle_task(current->domain) && current->domain != dom0) {
  43.171 ++		if (vcpu_timer_expired(current)) {
  43.172 ++			vcpu_pend_timer(current);
  43.173 ++			// ensure another timer interrupt happens even if domain doesn't
  43.174 ++			vcpu_set_next_timer(current);
  43.175 ++			domain_wake(current);
  43.176 ++		}
  43.177 ++	}
  43.178 ++	raise_actimer_softirq();
  43.179 ++#endif
  43.180 + 
  43.181 ++#ifndef XEN
  43.182 + 	platform_timer_interrupt(irq, dev_id, regs);
  43.183 ++#endif
  43.184 + 
  43.185 + 	new_itm = local_cpu_data->itm_next;
  43.186 + 
  43.187 + 	if (!time_after(ia64_get_itc(), new_itm))
  43.188 ++#ifdef XEN
  43.189 ++		return;
  43.190 ++#else
  43.191 + 		printk(KERN_ERR "Oops: timer tick before it's due (itc=%lx,itm=%lx)\n",
  43.192 + 		       ia64_get_itc(), new_itm);
  43.193 ++#endif
  43.194 + 
  43.195 ++#ifdef XEN
  43.196 ++//	printf("GOT TO HERE!!!!!!!!!!!\n");
  43.197 ++	//while(1);
  43.198 ++#else
  43.199 + 	profile_tick(CPU_PROFILING, regs);
  43.200 ++#endif
  43.201 + 
  43.202 + 	while (1) {
  43.203 ++#ifndef XEN
  43.204 + 		update_process_times(user_mode(regs));
  43.205 ++#endif
  43.206 + 
  43.207 + 		new_itm += local_cpu_data->itm_delta;
  43.208 + 
  43.209 +@@ -82,10 +218,16 @@ timer_interrupt (int irq, void *dev_id, 
  43.210 + 			 * another CPU. We need to avoid to SMP race by acquiring the
  43.211 + 			 * xtime_lock.
  43.212 + 			 */
  43.213 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  43.214 + 			write_seqlock(&xtime_lock);
  43.215 ++#endif
  43.216 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  43.217 + 			do_timer(regs);
  43.218 ++#endif
  43.219 + 			local_cpu_data->itm_next = new_itm;
  43.220 ++#ifdef TURN_ME_OFF_FOR_NOW_IA64_XEN
  43.221 + 			write_sequnlock(&xtime_lock);
  43.222 ++#endif
  43.223 + 		} else
  43.224 + 			local_cpu_data->itm_next = new_itm;
  43.225 + 
  43.226 +@@ -105,7 +247,12 @@ timer_interrupt (int irq, void *dev_id, 
  43.227 + 		 */
  43.228 + 		while (!time_after(new_itm, ia64_get_itc() + local_cpu_data->itm_delta/2))
  43.229 + 			new_itm += local_cpu_data->itm_delta;
  43.230 ++//#ifdef XEN
  43.231 ++//		vcpu_set_next_timer(current);
  43.232 ++//#else
  43.233 ++//printf("***** timer_interrupt: Setting itm to %lx\n",new_itm);
  43.234 + 		ia64_set_itm(new_itm);
  43.235 ++//#endif
  43.236 + 		/* double check, in case we got hit by a (slow) PMI: */
  43.237 + 	} while (time_after_eq(ia64_get_itc(), new_itm));
  43.238 + 	return IRQ_HANDLED;
  43.239 +@@ -120,6 +267,7 @@ ia64_cpu_local_tick (void)
  43.240 + 	int cpu = smp_processor_id();
  43.241 + 	unsigned long shift = 0, delta;
  43.242 + 
  43.243 ++printf("ia64_cpu_local_tick: about to call ia64_set_itv\n");
  43.244 + 	/* arrange for the cycle counter to generate a timer interrupt: */
  43.245 + 	ia64_set_itv(IA64_TIMER_VECTOR);
  43.246 + 
  43.247 +@@ -133,6 +281,7 @@ ia64_cpu_local_tick (void)
  43.248 + 		shift = (2*(cpu - hi) + 1) * delta/hi/2;
  43.249 + 	}
  43.250 + 	local_cpu_data->itm_next = ia64_get_itc() + delta + shift;
  43.251 ++printf("***** ia64_cpu_local_tick: Setting itm to %lx\n",local_cpu_data->itm_next);
  43.252 + 	ia64_set_itm(local_cpu_data->itm_next);
  43.253 + }
  43.254 + 
  43.255 +@@ -160,6 +309,7 @@ ia64_init_itm (void)
  43.256 + 	 * frequency and then a PAL call to determine the frequency ratio between the ITC
  43.257 + 	 * and the base frequency.
  43.258 + 	 */
  43.259 ++
  43.260 + 	status = ia64_sal_freq_base(SAL_FREQ_BASE_PLATFORM,
  43.261 + 				    &platform_base_freq, &platform_base_drift);
  43.262 + 	if (status != 0) {
  43.263 +@@ -212,6 +362,7 @@ ia64_init_itm (void)
  43.264 + 					+ itc_freq/2)/itc_freq;
  43.265 + 
  43.266 + 	if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)) {
  43.267 ++#ifndef XEN
  43.268 + 		itc_interpolator.frequency = local_cpu_data->itc_freq;
  43.269 + 		itc_interpolator.drift = itc_drift;
  43.270 + #ifdef CONFIG_SMP
  43.271 +@@ -228,6 +379,7 @@ ia64_init_itm (void)
  43.272 + 		if (!nojitter) itc_interpolator.jitter = 1;
  43.273 + #endif
  43.274 + 		register_time_interpolator(&itc_interpolator);
  43.275 ++#endif
  43.276 + 	}
  43.277 + 
  43.278 + 	/* Setup the CPU local timer tick */
  43.279 +@@ -236,7 +388,9 @@ ia64_init_itm (void)
  43.280 + 
  43.281 + static struct irqaction timer_irqaction = {
  43.282 + 	.handler =	timer_interrupt,
  43.283 ++#ifndef XEN
  43.284 + 	.flags =	SA_INTERRUPT,
  43.285 ++#endif
  43.286 + 	.name =		"timer"
  43.287 + };
  43.288 + 
  43.289 +@@ -244,12 +398,16 @@ void __init
  43.290 + time_init (void)
  43.291 + {
  43.292 + 	register_percpu_irq(IA64_TIMER_VECTOR, &timer_irqaction);
  43.293 ++#ifndef XEN
  43.294 + 	efi_gettimeofday(&xtime);
  43.295 ++#endif
  43.296 + 	ia64_init_itm();
  43.297 + 
  43.298 ++#ifndef XEN
  43.299 + 	/*
  43.300 + 	 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
  43.301 + 	 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
  43.302 + 	 */
  43.303 + 	set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
  43.304 ++#endif
  43.305 + }
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/tlb.c	Tue Apr 19 16:50:26 2005 +0000
    44.3 @@ -0,0 +1,53 @@
    44.4 + tlb.c |   10 ++++++++++
    44.5 + 1 files changed, 10 insertions(+)
    44.6 +
    44.7 +Index: linux-2.6.11/arch/ia64/mm/tlb.c
    44.8 +===================================================================
    44.9 +--- linux-2.6.11.orig/arch/ia64/mm/tlb.c	2005-03-02 01:38:38.000000000 -0600
   44.10 ++++ linux-2.6.11/arch/ia64/mm/tlb.c	2005-03-19 14:58:43.978400822 -0600
   44.11 +@@ -21,7 +21,9 @@
   44.12 + #include <asm/mmu_context.h>
   44.13 + #include <asm/pgalloc.h>
   44.14 + #include <asm/pal.h>
   44.15 ++#ifndef XEN
   44.16 + #include <asm/tlbflush.h>
   44.17 ++#endif
   44.18 + 
   44.19 + static struct {
   44.20 + 	unsigned long mask;	/* mask of supported purge page-sizes */
   44.21 +@@ -43,6 +45,9 @@ DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
   44.22 + void
   44.23 + wrap_mmu_context (struct mm_struct *mm)
   44.24 + {
   44.25 ++#ifdef XEN
   44.26 ++printf("wrap_mmu_context: called, not implemented\n");
   44.27 ++#else
   44.28 + 	unsigned long tsk_context, max_ctx = ia64_ctx.max_ctx;
   44.29 + 	struct task_struct *tsk;
   44.30 + 	int i;
   44.31 +@@ -83,6 +88,7 @@ wrap_mmu_context (struct mm_struct *mm)
   44.32 + 		put_cpu();
   44.33 + 	}
   44.34 + 	local_flush_tlb_all();
   44.35 ++#endif
   44.36 + }
   44.37 + 
   44.38 + void
   44.39 +@@ -132,6 +138,9 @@ EXPORT_SYMBOL(local_flush_tlb_all);
   44.40 + void
   44.41 + flush_tlb_range (struct vm_area_struct *vma, unsigned long start, unsigned long end)
   44.42 + {
   44.43 ++#ifdef XEN
   44.44 ++printf("flush_tlb_range: called, not implemented\n");
   44.45 ++#else
   44.46 + 	struct mm_struct *mm = vma->vm_mm;
   44.47 + 	unsigned long size = end - start;
   44.48 + 	unsigned long nbits;
   44.49 +@@ -163,6 +172,7 @@ flush_tlb_range (struct vm_area_struct *
   44.50 + # endif
   44.51 + 
   44.52 + 	ia64_srlz_i();			/* srlz.i implies srlz.d */
   44.53 ++#endif
   44.54 + }
   44.55 + EXPORT_SYMBOL(flush_tlb_range);
   44.56 + 
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/types.h	Tue Apr 19 16:50:26 2005 +0000
    45.3 @@ -0,0 +1,44 @@
    45.4 +--- ../../linux-2.6.11/include/asm-ia64/types.h	2005-03-04 10:26:30.000000000 -0700
    45.5 ++++ include/asm-ia64/types.h	2005-04-11 15:23:49.000000000 -0600
    45.6 +@@ -1,5 +1,12 @@
    45.7 + #ifndef _ASM_IA64_TYPES_H
    45.8 + #define _ASM_IA64_TYPES_H
    45.9 ++#ifdef XEN
   45.10 ++#ifndef __ASSEMBLY__
   45.11 ++typedef unsigned long ssize_t;
   45.12 ++typedef unsigned long size_t;
   45.13 ++typedef long long loff_t;
   45.14 ++#endif
   45.15 ++#endif
   45.16 + 
   45.17 + /*
   45.18 +  * This file is never included by application software unless explicitly requested (e.g.,
   45.19 +@@ -61,6 +68,28 @@
   45.20 + typedef __s64 s64;
   45.21 + typedef __u64 u64;
   45.22 + 
   45.23 ++#ifdef XEN
   45.24 ++/*
   45.25 ++ * Below are truly Linux-specific types that should never collide with
   45.26 ++ * any application/library that wants linux/types.h.
   45.27 ++ */
   45.28 ++
   45.29 ++#ifdef __CHECKER__
   45.30 ++#define __bitwise __attribute__((bitwise))
   45.31 ++#else
   45.32 ++#define __bitwise
   45.33 ++#endif
   45.34 ++
   45.35 ++typedef __u16 __bitwise __le16;
   45.36 ++typedef __u16 __bitwise __be16;
   45.37 ++typedef __u32 __bitwise __le32;
   45.38 ++typedef __u32 __bitwise __be32;
   45.39 ++#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
   45.40 ++typedef __u64 __bitwise __le64;
   45.41 ++typedef __u64 __bitwise __be64;
   45.42 ++#endif
   45.43 ++#endif
   45.44 ++
   45.45 + #define BITS_PER_LONG 64
   45.46 + 
   45.47 + /* DMA addresses are 64-bits wide, in general.  */
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/unaligned.c	Tue Apr 19 16:50:26 2005 +0000
    46.3 @@ -0,0 +1,102 @@
    46.4 + unaligned.c |   27 +++++++++++++++++++++++++++
    46.5 + 1 files changed, 27 insertions(+)
    46.6 +
    46.7 +Index: linux-2.6.11/arch/ia64/kernel/unaligned.c
    46.8 +===================================================================
    46.9 +--- linux-2.6.11.orig/arch/ia64/kernel/unaligned.c	2005-03-02 01:38:25.000000000 -0600
   46.10 ++++ linux-2.6.11/arch/ia64/kernel/unaligned.c	2005-03-19 14:58:51.269335202 -0600
   46.11 +@@ -15,8 +15,10 @@
   46.12 +  */
   46.13 + #include <linux/kernel.h>
   46.14 + #include <linux/sched.h>
   46.15 ++#ifndef XEN
   46.16 + #include <linux/smp_lock.h>
   46.17 + #include <linux/tty.h>
   46.18 ++#endif
   46.19 + 
   46.20 + #include <asm/intrinsics.h>
   46.21 + #include <asm/processor.h>
   46.22 +@@ -24,7 +26,16 @@
   46.23 + #include <asm/uaccess.h>
   46.24 + #include <asm/unaligned.h>
   46.25 + 
   46.26 ++#ifdef XEN
   46.27 ++#define	ia64_peek(x...)	printk("ia64_peek: called, not implemented\n")
   46.28 ++#define	ia64_poke(x...)	printk("ia64_poke: called, not implemented\n")
   46.29 ++#define	ia64_sync_fph(x...) printk("ia64_sync_fph: called, not implemented\n")
   46.30 ++#define	ia64_flush_fph(x...) printk("ia64_flush_fph: called, not implemented\n")
   46.31 ++#define	die_if_kernel(x...) printk("die_if_kernel: called, not implemented\n")
   46.32 ++#define jiffies 0
   46.33 ++#else
   46.34 + extern void die_if_kernel(char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
   46.35 ++#endif
   46.36 + 
   46.37 + #undef DEBUG_UNALIGNED_TRAP
   46.38 + 
   46.39 +@@ -437,7 +448,11 @@ get_rse_reg (struct pt_regs *regs, unsig
   46.40 + }
   46.41 + 
   46.42 + 
   46.43 ++#ifdef XEN
   46.44 ++void
   46.45 ++#else
   46.46 + static void
   46.47 ++#endif
   46.48 + setreg (unsigned long regnum, unsigned long val, int nat, struct pt_regs *regs)
   46.49 + {
   46.50 + 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   46.51 +@@ -611,7 +626,11 @@ getfpreg (unsigned long regnum, struct i
   46.52 + }
   46.53 + 
   46.54 + 
   46.55 ++#ifdef XEN
   46.56 ++void
   46.57 ++#else
   46.58 + static void
   46.59 ++#endif
   46.60 + getreg (unsigned long regnum, unsigned long *val, int *nat, struct pt_regs *regs)
   46.61 + {
   46.62 + 	struct switch_stack *sw = (struct switch_stack *) regs - 1;
   46.63 +@@ -1298,7 +1317,9 @@ ia64_handle_unaligned (unsigned long ifa
   46.64 + 	mm_segment_t old_fs = get_fs();
   46.65 + 	unsigned long bundle[2];
   46.66 + 	unsigned long opcode;
   46.67 ++#ifndef XEN
   46.68 + 	struct siginfo si;
   46.69 ++#endif
   46.70 + 	const struct exception_table_entry *eh = NULL;
   46.71 + 	union {
   46.72 + 		unsigned long l;
   46.73 +@@ -1317,6 +1338,9 @@ ia64_handle_unaligned (unsigned long ifa
   46.74 + 	 * user-level unaligned accesses.  Otherwise, a clever program could trick this
   46.75 + 	 * handler into reading an arbitrary kernel addresses...
   46.76 + 	 */
   46.77 ++#ifdef XEN
   46.78 ++printk("ia64_handle_unaligned: called, not working yet\n");
   46.79 ++#else
   46.80 + 	if (!user_mode(regs))
   46.81 + 		eh = search_exception_tables(regs->cr_iip + ia64_psr(regs)->ri);
   46.82 + 	if (user_mode(regs) || eh) {
   46.83 +@@ -1353,6 +1377,7 @@ ia64_handle_unaligned (unsigned long ifa
   46.84 + 
   46.85 + 	if (__copy_from_user(bundle, (void __user *) regs->cr_iip, 16))
   46.86 + 		goto failure;
   46.87 ++#endif
   46.88 + 
   46.89 + 	/*
   46.90 + 	 * extract the instruction from the bundle given the slot number
   46.91 +@@ -1493,6 +1518,7 @@ ia64_handle_unaligned (unsigned long ifa
   46.92 + 		/* NOT_REACHED */
   46.93 + 	}
   46.94 +   force_sigbus:
   46.95 ++#ifndef XEN
   46.96 + 	si.si_signo = SIGBUS;
   46.97 + 	si.si_errno = 0;
   46.98 + 	si.si_code = BUS_ADRALN;
   46.99 +@@ -1501,5 +1527,6 @@ ia64_handle_unaligned (unsigned long ifa
  46.100 + 	si.si_isr = 0;
  46.101 + 	si.si_imm = 0;
  46.102 + 	force_sig_info(SIGBUS, &si, current);
  46.103 ++#endif
  46.104 + 	goto done;
  46.105 + }
    47.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.2 +++ b/xen/arch/ia64/patch/linux-2.6.11/wait.h	Tue Apr 19 16:50:26 2005 +0000
    47.3 @@ -0,0 +1,35 @@
    47.4 + wait.h |    6 ++++++
    47.5 + 1 files changed, 6 insertions(+)
    47.6 +
    47.7 +Index: linux-2.6.11/include/linux/wait.h
    47.8 +===================================================================
    47.9 +--- linux-2.6.11.orig/include/linux/wait.h	2005-03-02 01:38:10.000000000 -0600
   47.10 ++++ linux-2.6.11/include/linux/wait.h	2005-03-19 15:00:23.691156973 -0600
   47.11 +@@ -136,7 +136,11 @@ static inline void __remove_wait_queue(w
   47.12 + 	list_del(&old->task_list);
   47.13 + }
   47.14 + 
   47.15 ++#ifdef XEN
   47.16 ++void FASTCALL(__wake_up(struct task_struct *p));
   47.17 ++#else
   47.18 + void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key));
   47.19 ++#endif
   47.20 + extern void FASTCALL(__wake_up_locked(wait_queue_head_t *q, unsigned int mode));
   47.21 + extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr));
   47.22 + void FASTCALL(__wake_up_bit(wait_queue_head_t *, void *, int));
   47.23 +@@ -147,6 +151,7 @@ int FASTCALL(out_of_line_wait_on_bit(voi
   47.24 + int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned));
   47.25 + wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
   47.26 + 
   47.27 ++#ifndef XEN
   47.28 + #define wake_up(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL)
   47.29 + #define wake_up_nr(x, nr)		__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL)
   47.30 + #define wake_up_all(x)			__wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL)
   47.31 +@@ -155,6 +160,7 @@ wait_queue_head_t *FASTCALL(bit_waitqueu
   47.32 + #define wake_up_interruptible_all(x)	__wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
   47.33 + #define	wake_up_locked(x)		__wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE)
   47.34 + #define wake_up_interruptible_sync(x)   __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
   47.35 ++#endif
   47.36 + 
   47.37 + #define __wait_event(wq, condition) 					\
   47.38 + do {									\
    48.1 --- a/xen/arch/ia64/privop.c	Tue Apr 19 13:48:05 2005 +0000
    48.2 +++ b/xen/arch/ia64/privop.c	Tue Apr 19 16:50:26 2005 +0000
    48.3 @@ -524,6 +524,7 @@ PPEFCN Mpriv_funcs[64] = {
    48.4  struct {
    48.5  	unsigned long mov_to_ar_imm;
    48.6  	unsigned long mov_to_ar_reg;
    48.7 +	unsigned long mov_from_ar;
    48.8  	unsigned long ssm;
    48.9  	unsigned long rsm;
   48.10  	unsigned long rfi;
   48.11 @@ -617,7 +618,9 @@ priv_handle_op(VCPU *vcpu, REGS *regs, i
   48.12  		else if (inst.generic.major != 1) break;
   48.13  		x6 = inst.M29.x6;
   48.14  		if (x6 == 0x2a) {
   48.15 -			privcnt.mov_to_ar_reg++;
   48.16 +			if (inst.M29.r2 > 63 && inst.M29.ar3 < 8)
   48.17 +				privcnt.mov_from_ar++; // privified mov from kr
   48.18 +			else privcnt.mov_to_ar_reg++;
   48.19  			return priv_mov_to_ar_reg(vcpu,inst);
   48.20  		}
   48.21  		if (inst.M29.x3 != 0) break;
   48.22 @@ -663,7 +666,9 @@ priv_handle_op(VCPU *vcpu, REGS *regs, i
   48.23  #endif
   48.24  		if (inst.I26.x3 != 0) break;  // I26.x3 == I27.x3
   48.25  		if (inst.I26.x6 == 0x2a) {
   48.26 -			privcnt.mov_to_ar_reg++;
   48.27 +			if (inst.I26.r2 > 63 && inst.I26.ar3 < 8)
   48.28 +				privcnt.mov_from_ar++; // privified mov from kr
   48.29 +			else privcnt.mov_to_ar_reg++;
   48.30  			return priv_mov_to_ar_reg(vcpu,inst);
   48.31  		}
   48.32  		if (inst.I27.x6 == 0x0a) {
   48.33 @@ -800,6 +805,9 @@ int dump_privop_counts(char *buf)
   48.34  	if (privcnt.mov_to_ar_reg)
   48.35  		s += sprintf(s,"%10d  %s [%d%%]\r\n", privcnt.mov_to_ar_reg,
   48.36  			"mov_to_ar_reg", (privcnt.mov_to_ar_reg*100L)/sum);
   48.37 +	if (privcnt.mov_from_ar)
   48.38 +		s += sprintf(s,"%10d  %s [%d%%]\r\n", privcnt.mov_from_ar,
   48.39 +			"privified-mov_from_ar", (privcnt.mov_from_ar*100L)/sum);
   48.40  	if (privcnt.ssm)
   48.41  		s += sprintf(s,"%10d  %s [%d%%]\r\n", privcnt.ssm,
   48.42  			"ssm", (privcnt.ssm*100L)/sum);
   48.43 @@ -852,6 +860,7 @@ int zero_privop_counts(char *buf)
   48.44  	// this is ugly and should probably produce sorted output
   48.45  	// but it will have to do for now
   48.46  	privcnt.mov_to_ar_imm = 0; privcnt.mov_to_ar_reg = 0;
   48.47 +	privcnt.mov_from_ar = 0;
   48.48  	privcnt.ssm = 0; privcnt.rsm = 0;
   48.49  	privcnt.rfi = 0; privcnt.bsw0 = 0;
   48.50  	privcnt.bsw1 = 0; privcnt.cover = 0;
    49.1 --- a/xen/arch/ia64/process.c	Tue Apr 19 13:48:05 2005 +0000
    49.2 +++ b/xen/arch/ia64/process.c	Tue Apr 19 16:50:26 2005 +0000
    49.3 @@ -185,9 +185,10 @@ panic_domain(regs,"psr.ic off, deliverin
    49.4  
    49.5  	regs->cr_iip = ((unsigned long) PSCB(ed,iva) + vector) & ~0xffUL;
    49.6  	regs->cr_ipsr = (regs->cr_ipsr & ~DELIVER_PSR_CLR) | DELIVER_PSR_SET;
    49.7 -// FIXME: NEED TO PASS PSCB, BUT **NOT** IN R31 WHICH IS BEING USED FOR ar.pr
    49.8 -// IN ANY CASE, PASS PINNED ADDRESS, NOT THIS ONE
    49.9 -	//regs->r31 = (unsigned long) &PSCB(ed);
   49.10 +#ifdef CONFIG_SMP
   49.11 +#error "sharedinfo doesn't handle smp yet"
   49.12 +#endif
   49.13 +	regs->r31 = &((shared_info_t *)SHAREDINFO_ADDR)->vcpu_data[0].arch;
   49.14  
   49.15  	PSCB(ed,interrupt_delivery_enabled) = 0;
   49.16  	PSCB(ed,interrupt_collection_enabled) = 0;
   49.17 @@ -714,8 +715,8 @@ ia64_handle_break (unsigned long ifa, st
   49.18  		else do_ssc(vcpu_get_gr(current,36), regs);
   49.19  	}
   49.20  	else if (iim == d->breakimm) {
   49.21 -		ia64_hypercall(regs);
   49.22 -		vcpu_increment_iip(current);
   49.23 +		if (ia64_hypercall(regs))
   49.24 +			vcpu_increment_iip(current);
   49.25  	}
   49.26  	else reflect_interruption(ifa,isr,iim,regs,IA64_BREAK_VECTOR);
   49.27  }
    50.1 --- a/xen/arch/ia64/tools/mkbuildtree	Tue Apr 19 13:48:05 2005 +0000
    50.2 +++ b/xen/arch/ia64/tools/mkbuildtree	Tue Apr 19 16:50:26 2005 +0000
    50.3 @@ -3,9 +3,8 @@
    50.4  # run in xen-X.X/xen directory after unpacking linux in same directory
    50.5  
    50.6  XEN=$PWD
    50.7 -#LINUX=$XEN/linux-2.6.7
    50.8 -LINUX=$XEN/../../linux-2.6.7
    50.9 -LINUXPATCH=$XEN/arch/ia64/patch/linux-2.6.7
   50.10 +LINUX=$XEN/../../linux-2.6.11
   50.11 +LINUXPATCH=$XEN/arch/ia64/patch/linux-2.6.11
   50.12  XENPATCH=$XEN/arch/ia64/patch/xen-2.0.1
   50.13  
   50.14  cp_patch ()
   50.15 @@ -35,7 +34,6 @@ null ()
   50.16  # ensure linux directory is set up
   50.17  if [ ! -d $LINUX ]; then
   50.18  	echo "ERROR: $LINUX directory doesn't exist"
   50.19 -	echo "(don't forget to apply the -ia64 patch to it too)"
   50.20  	exit
   50.21  fi
   50.22  
   50.23 @@ -99,7 +97,7 @@ cp_patch arch/ia64/kernel/vmlinux.lds.S 
   50.24  #cp_patch mm/slab.c arch/ia64/slab.c slab.c
   50.25  
   50.26  # following renamed to avoid conflict
   50.27 -softlink kernel/extable.c arch/ia64/linuxextable.c
   50.28 +cp_patch kernel/extable.c arch/ia64/linuxextable.c linuxextable.c
   50.29  
   50.30  cp_patch arch/ia64/mm/contig.c arch/ia64/mm_contig.c mm_contig.c
   50.31  cp_patch arch/ia64/mm/tlb.c arch/ia64/tlb.c tlb.c
   50.32 @@ -151,15 +149,16 @@ softlink arch/ia64/hp/sim/hpsim.S arch/i
   50.33  
   50.34  # xen/include/asm-generic files
   50.35  
   50.36 -softlink include/asm-generic/cpumask_const_value.h include/asm-generic/cpumask_const_value.h cpumask_const_value.h
   50.37 -softlink include/asm-generic/cpumask.h include/asm-generic/cpumask.h cpumask.h
   50.38 -softlink include/asm-generic/cpumask_up.h include/asm-generic/cpumask_up.h cpumask_up.h
   50.39 -softlink include/asm-generic/cpumask_arith.h include/asm-generic/cpumask_arith.h cpumask_arith.h
   50.40 +softlink include/asm-generic/bug.h include/asm-generic/bug.h bug.h
   50.41  softlink include/asm-generic/div64.h include/asm-generic/div64.h div64.h
   50.42 +softlink include/asm-generic/errno.h include/asm-generic/errno.h
   50.43 +softlink include/asm-generic/errno-base.h include/asm-generic/errno-base.h
   50.44  softlink include/asm-generic/ide_iops.h include/asm-generic/ide_iops.h ide_iops.h
   50.45 +softlink include/asm-generic/iomap.h include/asm-generic/iomap.h iomap.h
   50.46  softlink include/asm-generic/pci-dma-compat.h include/asm-generic/pci-dma-compat.h pci-dma-compat.h
   50.47  softlink include/asm-generic/pci.h include/asm-generic/pci.h pci.h
   50.48  softlink include/asm-generic/pgtable.h include/asm-generic/pgtable.h pgtable.h
   50.49 +softlink include/asm-generic/pgtable-nopud.h include/asm-generic/pgtable-nopud.h pgtable-nopud.h
   50.50  softlink include/asm-generic/sections.h include/asm-generic/sections.h sections.h
   50.51  softlink include/asm-generic/topology.h include/asm-generic/topology.h topology.h
   50.52  softlink include/asm-generic/vmlinux.lds.h include/asm-generic/vmlinux.lds.h vmlinux.lds.h
   50.53 @@ -170,10 +169,12 @@ softlink include/asm-generic/vmlinux.lds
   50.54  cp_patch arch/ia64/hp/sim/hpsim_ssc.h include/asm-ia64/hpsim_ssc.h hpsim_ssc.h
   50.55  
   50.56  cp_patch include/asm-ia64/current.h include/asm-ia64/current.h current.h
   50.57 -cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h
   50.58 +#cp_patch include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h gcc_intrin.h
   50.59 +softlink include/asm-ia64/gcc_intrin.h include/asm-ia64/gcc_intrin.h
   50.60  cp_patch include/asm-ia64/hardirq.h include/asm-ia64/hardirq.h hardirq.h
   50.61 -cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h
   50.62 -cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h
   50.63 +#cp_patch include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h hw_irq.h
   50.64 +softlink include/asm-ia64/hw_irq.h include/asm-ia64/hw_irq.h
   50.65 +#cp_patch include/asm-ia64/ide.h include/asm-ia64/ide.h ide.h
   50.66  cp_patch include/asm-ia64/io.h include/asm-ia64/io.h io.h
   50.67  cp_patch include/asm-ia64/irq.h include/asm-ia64/irq.h irq.h
   50.68  cp_patch include/asm-ia64/kregs.h include/asm-ia64/kregs.h kregs.h
   50.69 @@ -200,11 +201,11 @@ softlink include/asm-ia64/byteorder.h in
   50.70  softlink include/asm-ia64/cacheflush.h include/asm-ia64/cacheflush.h
   50.71  softlink include/asm-ia64/cache.h include/asm-ia64/cache.h
   50.72  softlink include/asm-ia64/checksum.h include/asm-ia64/checksum.h
   50.73 -softlink include/asm-ia64/cpumask.h include/asm-ia64/cpumask.h
   50.74  softlink include/asm-ia64/delay.h include/asm-ia64/delay.h
   50.75  softlink include/asm-ia64/div64.h include/asm-ia64/div64.h
   50.76  softlink include/asm-ia64/dma.h include/asm-ia64/dma.h
   50.77  softlink include/asm-ia64/dma-mapping.h include/asm-ia64/dma-mapping.h
   50.78 +softlink include/asm-ia64/errno.h include/asm-ia64/errno.h
   50.79  softlink include/asm-ia64/fpu.h include/asm-ia64/fpu.h
   50.80  softlink include/asm-ia64/hdreg.h include/asm-ia64/hdreg.h
   50.81  softlink include/asm-ia64/ia32.h include/asm-ia64/ia32.h
   50.82 @@ -235,6 +236,7 @@ softlink include/asm-ia64/rwsem.h includ
   50.83  softlink include/asm-ia64/scatterlist.h include/asm-ia64/scatterlist.h
   50.84  softlink include/asm-ia64/sections.h include/asm-ia64/sections.h
   50.85  softlink include/asm-ia64/semaphore.h include/asm-ia64/semaphore.h
   50.86 +softlink include/asm-ia64/setup.h include/asm-ia64/setup.h
   50.87  softlink include/asm-ia64/sigcontext.h include/asm-ia64/sigcontext.h
   50.88  softlink include/asm-ia64/signal.h include/asm-ia64/signal.h
   50.89  softlink include/asm-ia64/smp.h include/asm-ia64/smp.h
   50.90 @@ -256,7 +258,12 @@ softlink include/asm-ia64/ustack.h inclu
   50.91  # xen/include/asm-ia64/linux/*.h (== linux/include/linux/*.h)
   50.92  
   50.93  cp_patch include/linux/bootmem.h include/asm-ia64/linux/bootmem.h bootmem.h
   50.94 -cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h
   50.95 +cp_patch include/linux/cpumask.h include/asm-ia64/linux/cpumask.h cpumask.h
   50.96 +#cp_patch include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h dma-mapping.h
   50.97 +softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h
   50.98 +#cp_patch include/linux/efi.h include/asm-ia64/linux/efi.h efi.h
   50.99 +softlink include/linux/efi.h include/asm-ia64/linux/efi.h
  50.100 +cp_patch include/linux/hardirq.h include/asm-ia64/linux/hardirq.h linuxhardirq.h
  50.101  #cp_patch include/linux/init_task.h include/asm-ia64/linux/init_task.h init_task.h
  50.102  cp_patch include/linux/interrupt.h include/asm-ia64/linux/interrupt.h interrupt.h
  50.103  cp_patch include/linux/mmzone.h include/asm-ia64/linux/mmzone.h mmzone.h
  50.104 @@ -271,8 +278,7 @@ cp_patch include/linux/time.h include/xe
  50.105  softlink include/linux/bcd.h include/asm-ia64/linux/bcd.h
  50.106  softlink include/linux/bitmap.h include/asm-ia64/linux/bitmap.h
  50.107  softlink include/linux/bitops.h include/asm-ia64/linux/bitops.h
  50.108 -softlink include/linux/cpumask.h include/asm-ia64/linux/cpumask.h
  50.109 -softlink include/linux/dma-mapping.h include/asm-ia64/linux/dma-mapping.h
  50.110 +softlink include/linux/err.h include/asm-ia64/linux/err.h
  50.111  softlink include/linux/gfp.h include/asm-ia64/linux/gfp.h
  50.112  softlink include/linux/initrd.h include/asm-ia64/linux/initrd.h
  50.113  softlink include/linux/kmalloc_sizes.h include/asm-ia64/linux/kmalloc_sizes.h
  50.114 @@ -295,6 +301,10 @@ softlink include/linux/tty.h include/asm
  50.115  null include/asm-ia64/linux/file.h
  50.116  null include/asm-ia64/linux/module.h
  50.117  null include/asm-ia64/linux/swap.h
  50.118 +null include/asm-ia64/linux/device.h
  50.119 +null include/asm-ia64/linux/proc_fs.h
  50.120 +null include/asm-ia64/linux/rtc.h
  50.121 +null include/asm-ia64/linux/profile.h
  50.122  
  50.123  softlink include/linux/byteorder/generic.h include/asm-ia64/linux/byteorder/generic.h
  50.124  softlink include/linux/byteorder/little_endian.h include/asm-ia64/linux/byteorder/little_endian.h
    51.1 --- a/xen/arch/ia64/vcpu.c	Tue Apr 19 13:48:05 2005 +0000
    51.2 +++ b/xen/arch/ia64/vcpu.c	Tue Apr 19 16:50:26 2005 +0000
    51.3 @@ -509,6 +509,7 @@ void vcpu_pend_interrupt(VCPU *vcpu, UIN
    51.4  //printf("vcpu_pend_interrupt: overrun\n");
    51.5  	}
    51.6  	set_bit(vector,PSCB(vcpu,irr));
    51.7 +	PSCB(vcpu,pending_interruption) = 1;
    51.8  }
    51.9  
   51.10  void early_tick(VCPU *vcpu)
   51.11 @@ -637,7 +638,7 @@ IA64FAULT vcpu_get_ivr(VCPU *vcpu, UINT6
   51.12  //printf("ZZZZZZ vcpu_get_ivr: setting insvc mask for vector %ld\n",vector);
   51.13  	PSCB(vcpu,insvc[i]) |= mask;
   51.14  	PSCB(vcpu,irr[i]) &= ~mask;
   51.15 -	PSCB(vcpu,pending_interruption)--;
   51.16 +	//PSCB(vcpu,pending_interruption)--;
   51.17  	*pval = vector;
   51.18  	// if delivering a timer interrupt, remember domain_itm
   51.19  	if (vector == (PSCB(vcpu,itv) & 0xff)) {
   51.20 @@ -746,6 +747,7 @@ IA64FAULT vcpu_set_tpr(VCPU *vcpu, UINT6
   51.21  {
   51.22  	if (val & 0xff00) return IA64_RSVDREG_FAULT;
   51.23  	PSCB(vcpu,tpr) = val;
   51.24 +	//PSCB(vcpu,pending_interruption) = 1;
   51.25  	return (IA64_NO_FAULT);
   51.26  }
   51.27  
    52.1 --- a/xen/arch/ia64/xenasm.S	Tue Apr 19 13:48:05 2005 +0000
    52.2 +++ b/xen/arch/ia64/xenasm.S	Tue Apr 19 16:50:26 2005 +0000
    52.3 @@ -132,9 +132,9 @@ 1:
    52.4  (p7)	br.cond.sptk	.stack_overlaps
    52.5  	;;
    52.6  	movl r25=PAGE_KERNEL
    52.7 -	dep r20=0,r13,60,4		// physical address of "current"
    52.8 +	dep r21=0,r13,60,4		// physical address of "current"
    52.9  	;;
   52.10 -	or r23=r25,r20			// construct PA | page properties
   52.11 +	or r23=r25,r21			// construct PA | page properties
   52.12  	mov r25=IA64_GRANULE_SHIFT<<2
   52.13  	;;
   52.14  	ptr.d	r13,r25
   52.15 @@ -152,9 +152,9 @@ 1:
   52.16  	;;
   52.17  	movl r25=PAGE_KERNEL
   52.18  	;;
   52.19 -	mov r20=loc2			// saved percpu physical address
   52.20 +	mov r21=loc2			// saved percpu physical address
   52.21  	;;
   52.22 -	or r23=r25,r20			// construct PA | page properties
   52.23 +	or r23=r25,r21			// construct PA | page properties
   52.24  	mov r24=PERCPU_PAGE_SHIFT<<2
   52.25  	;;
   52.26  	ptr.d	r22,r24
   52.27 @@ -172,9 +172,9 @@ 1:
   52.28  	;;
   52.29  	movl r25=PAGE_KERNEL
   52.30  	;;
   52.31 -	mov r20=loc6			// saved vhpt physical address
   52.32 +	mov r21=loc6			// saved vhpt physical address
   52.33  	;;
   52.34 -	or r23=r25,r20			// construct PA | page properties
   52.35 +	or r23=r25,r21			// construct PA | page properties
   52.36  	mov r24=VHPT_PAGE_SHIFT<<2
   52.37  	;;
   52.38  	ptr.d	r22,r24
   52.39 @@ -190,11 +190,12 @@ 1:
   52.40  
   52.41  	movl r22=SHAREDINFO_ADDR
   52.42  	;;
   52.43 -	movl r25=PAGE_KERNEL
   52.44 +	movl r25=PAGE_SHARED
   52.45 +	movl r25=__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RW)
   52.46  	;;
   52.47 -	mov r20=loc5			// saved sharedinfo physical address
   52.48 +	mov r21=loc5			// saved sharedinfo physical address
   52.49  	;;
   52.50 -	or r23=r25,r20			// construct PA | page properties
   52.51 +	or r23=r25,r21			// construct PA | page properties
   52.52  	mov r24=PAGE_SHIFT<<2
   52.53  	;;
   52.54  	ptr.d	r22,r24
    53.1 --- a/xen/arch/ia64/xenmisc.c	Tue Apr 19 13:48:05 2005 +0000
    53.2 +++ b/xen/arch/ia64/xenmisc.c	Tue Apr 19 16:50:26 2005 +0000
    53.3 @@ -93,6 +93,17 @@ int reprogram_ac_timer(s_time_t timeout)
    53.4  DEFINE_PER_CPU(struct page_state, page_states) = {0};
    53.5  unsigned long totalram_pages;
    53.6  
    53.7 +void __mod_page_state(unsigned offset, unsigned long delta)
    53.8 +{
    53.9 +	unsigned long flags;
   53.10 +	void* ptr;
   53.11 +
   53.12 +	local_irq_save(flags);
   53.13 +	ptr = &__get_cpu_var(page_states);
   53.14 +	*(unsigned long*)(ptr + offset) += delta;
   53.15 +	local_irq_restore(flags);
   53.16 +}
   53.17 +
   53.18  ///////////////////////////////
   53.19  // from arch/x86/flushtlb.c
   53.20  ///////////////////////////////
   53.21 @@ -276,6 +287,7 @@ void panic_domain(struct pt_regs *regs, 
   53.22  	extern spinlock_t console_lock;
   53.23  	unsigned long flags;
   53.24      
   53.25 +loop:
   53.26  	printf("$$$$$ PANIC in domain %d (k6=%p): ",
   53.27  		ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
   53.28  	va_start(args, fmt);
   53.29 @@ -285,5 +297,11 @@ void panic_domain(struct pt_regs *regs, 
   53.30  	if (regs) show_registers(regs);
   53.31  	domain_pause_by_systemcontroller(current->domain);
   53.32  	set_bit(DF_CRASHED, ed->domain->d_flags);
   53.33 -	//while(test);
   53.34 +	if (ed->domain->id == 0) {
   53.35 +		int i = 1000000000L;
   53.36 +		// if domain0 crashes, just periodically print out panic
   53.37 +		// message to make post-mortem easier
   53.38 +		while(i--);
   53.39 +		goto loop;
   53.40 +	}
   53.41  }
    54.1 --- a/xen/include/asm-ia64/config.h	Tue Apr 19 13:48:05 2005 +0000
    54.2 +++ b/xen/include/asm-ia64/config.h	Tue Apr 19 16:50:26 2005 +0000
    54.3 @@ -1,8 +1,9 @@
    54.4  // control flags for turning on/off features under test
    54.5  #undef CLONE_DOMAIN0
    54.6 -//#define CLONE_DOMAIN0 5
    54.7 +//#define CLONE_DOMAIN0 1
    54.8  #define DOMU_BUILD_STAGING
    54.9  #define VHPT_GLOBAL
   54.10 +#define DOMU_AUTO_RESTART
   54.11  
   54.12  // manufactured from component pieces
   54.13  
   54.14 @@ -39,9 +40,6 @@ typedef int pid_t;
   54.15  #define CLEAR_BITMAP(name,bits) \
   54.16  	memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long))
   54.17  
   54.18 -// from linux/include/linux/compiler.h
   54.19 -#define __user
   54.20 -
   54.21  // FIXME?: x86-ism used in xen/mm.h
   54.22  #define LOCK_PREFIX
   54.23  
   54.24 @@ -57,6 +55,21 @@ extern char _end[]; /* standard ELF symb
   54.25  
   54.26  // linux/include/linux/compiler.h
   54.27  #define __attribute_const__
   54.28 +#define __user
   54.29 +//#define __kernel
   54.30 +//#define __safe
   54.31 +#define __force
   54.32 +#define __iomem
   54.33 +#define __chk_user_ptr(x) (void)0
   54.34 +//#define __chk_io_ptr(x) (void)0
   54.35 +//#define __builtin_warning(x, y...) (1)
   54.36 +//#define __acquires(x)
   54.37 +//#define __releases(x)
   54.38 +//#define __acquire(x) (void)0
   54.39 +//#define __release(x) (void)0
   54.40 +//#define __cond_lock(x) (x)
   54.41 +#define __must_check
   54.42 +#define __deprecated
   54.43  
   54.44  // xen/include/asm/config.h
   54.45  #define HZ 100
   54.46 @@ -66,6 +79,9 @@ extern char _end[]; /* standard ELF symb
   54.47  //#define CONFIG_NR_CPUS 16
   54.48  #define barrier() __asm__ __volatile__("": : :"memory")
   54.49  
   54.50 +// linux/include/spinlock.h
   54.51 +#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
   54.52 +
   54.53  ///////////////////////////////////////////////////////////////
   54.54  // xen/include/asm/config.h
   54.55  // Natural boundary upon TR size to define xenheap space
    55.1 --- a/xen/include/asm-ia64/domain.h	Tue Apr 19 13:48:05 2005 +0000
    55.2 +++ b/xen/include/asm-ia64/domain.h	Tue Apr 19 16:50:26 2005 +0000
    55.3 @@ -21,6 +21,11 @@ struct arch_domain {
    55.4      u64 xen_vastart;
    55.5      u64 xen_vaend;
    55.6      u64 shared_info_va;
    55.7 +#ifdef DOMU_AUTO_RESTART
    55.8 +    u64 image_start;
    55.9 +    u64 image_len;
   55.10 +    u64 entry;
   55.11 +#endif
   55.12  };
   55.13  #define metaphysical_rid arch.metaphysical_rid
   55.14  #define starting_rid arch.starting_rid
    56.1 --- a/xen/include/asm-ia64/mm.h	Tue Apr 19 13:48:05 2005 +0000
    56.2 +++ b/xen/include/asm-ia64/mm.h	Tue Apr 19 16:50:26 2005 +0000
    56.3 @@ -25,25 +25,6 @@
    56.4  
    56.5  typedef unsigned long page_flags_t;
    56.6  
    56.7 -// from linux/include/linux/mm.h
    56.8 -
    56.9 -extern pmd_t *FASTCALL(__pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address));
   56.10 -extern pte_t *FASTCALL(pte_alloc_kernel(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
   56.11 -extern pte_t *FASTCALL(pte_alloc_map(struct mm_struct *mm, pmd_t *pmd, unsigned long address));
   56.12 -
   56.13 -/*
   56.14 - * On a two-level page table, this ends up being trivial. Thus the
   56.15 - * inlining and the symmetry break with pte_alloc_map() that does all
   56.16 - * of this out-of-line.
   56.17 - */
   56.18 -static inline pmd_t *pmd_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
   56.19 -{
   56.20 -	if (pgd_none(*pgd))
   56.21 -		return __pmd_alloc(mm, pgd, address);
   56.22 -	return pmd_offset(pgd, address);
   56.23 -}
   56.24 -
   56.25 -
   56.26  /*
   56.27   * Per-page-frame information.
   56.28   */