ia64/xen-unstable

changeset 6370:d760699356fd

merge?
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 17:33:11 2005 +0000 (2005-08-23)
parents d7b79cac9ea9 67a530b01542
children 9dc059239e2a
files .hgignore Config.mk Makefile buildconfigs/Rules.mk docs/src/user.tex extras/mini-os/include/time.h extras/mini-os/kernel.c extras/mini-os/time.c linux-2.6-xen-sparse/arch/xen/Kconfig linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32 linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/i386/Kconfig linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6-xen-sparse/arch/xen/i386/kernel/head.S linux-2.6-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/i386/kernel/mpparse.c linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c linux-2.6-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smp.c linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c linux-2.6-xen-sparse/arch/xen/i386/mm/highmem.c linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6-xen-sparse/arch/xen/i386/mm/init.c linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c linux-2.6-xen-sparse/arch/xen/i386/pci/Makefile linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c linux-2.6-xen-sparse/arch/xen/x86_64/Kconfig linux-2.6-xen-sparse/arch/xen/x86_64/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/ia32/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/apic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/e820.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-nommu.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/process.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/vsyscall.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c linux-2.6-xen-sparse/drivers/xen/blkback/Makefile linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkback/common.h linux-2.6-xen-sparse/drivers/xen/blkback/interface.c linux-2.6-xen-sparse/drivers/xen/blkback/vbd.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h linux-2.6-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/usbback/usbback.c linux-2.6-xen-sparse/drivers/xen/usbfront/usbfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/desc.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/dma-mapping.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/fixmap.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypercall.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu_context.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pci.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgalloc.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/desc.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/dma-mapping.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pci.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h linux-2.6-xen-sparse/include/asm-xen/balloon.h linux-2.6-xen-sparse/include/asm-xen/gnttab.h linux-2.6-xen-sparse/include/asm-xen/hypervisor.h linux-2.6-xen-sparse/include/asm-xen/xenbus.h linux-2.6-xen-sparse/include/linux/highmem.h linux-2.6-xen-sparse/include/linux/mm.h linux-2.6-xen-sparse/mm/highmem.c linux-2.6-xen-sparse/mm/memory.c tools/Makefile tools/Rules.mk tools/console/daemon/io.c tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/debugger/pdb/Domain.ml tools/debugger/pdb/Domain.mli tools/debugger/pdb/Makefile tools/debugger/pdb/PDB.ml tools/debugger/pdb/Process.ml tools/debugger/pdb/Process.mli tools/debugger/pdb/debugger.ml tools/debugger/pdb/linux-2.6-module/debug.c tools/debugger/pdb/linux-2.6-module/module.c tools/debugger/pdb/linux-2.6-module/pdb_debug.h tools/debugger/pdb/linux-2.6-module/pdb_module.h tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xcs.c tools/debugger/pdb/readme tools/examples/Makefile tools/examples/xend-config.sxp tools/examples/xmexample.vmx tools/ioemu/hw/ide.c tools/libxc/Makefile tools/libxc/xc.h tools/libxc/xc_core.c tools/libxc/xc_gnttab.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_elf.c tools/libxc/xc_ptrace.c tools/libxc/xc_vmx_build.c tools/misc/xend tools/python/setup.py tools/python/xen/lowlevel/xu/xu.c tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendRoot.py tools/python/xen/xend/image.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/event.py tools/python/xen/xend/server/netif.py tools/python/xen/xend/server/relocate.py tools/python/xen/xm/create.py tools/python/xen/xm/main.py tools/security/Makefile tools/security/secpol_tool.c tools/xenstat/Makefile tools/xenstat/libxenstat/COPYING tools/xenstat/libxenstat/Makefile tools/xenstat/libxenstat/bindings/swig/perl/.empty tools/xenstat/libxenstat/bindings/swig/python/.empty tools/xenstat/libxenstat/bindings/swig/xenstat.i tools/xenstat/libxenstat/src/xen-interface.c tools/xenstat/libxenstat/src/xen-interface.h tools/xenstat/libxenstat/src/xenstat.c tools/xenstat/libxenstat/src/xenstat.h tools/xenstat/xentop/Makefile tools/xenstat/xentop/TODO tools/xenstat/xentop/xentop.1 tools/xenstat/xentop/xentop.c tools/xenstore/xenstored.h tools/xenstore/xenstored_core.c tools/xentrace/xentrace.c xen/Rules.mk xen/arch/ia64/grant_table.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xentime.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/io_apic.c xen/arch/x86/mm.c xen/arch/x86/physdev.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/shadow32.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/traps.c xen/common/domain.c xen/common/event_channel.c xen/common/grant_table.c xen/common/lib.c xen/common/perfc.c xen/common/schedule.c xen/common/trace.c xen/drivers/char/console.c xen/include/asm-x86/e820.h xen/include/asm-x86/mm.h xen/include/asm-x86/page.h xen/include/asm-x86/shadow.h xen/include/asm-x86/uaccess.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_vmcs.h xen/include/asm-x86/x86_32/page-3level.h xen/include/asm-x86/x86_32/uaccess.h xen/include/public/arch-ia64.h xen/include/public/arch-x86_32.h xen/include/public/arch-x86_64.h xen/include/public/dom0_ops.h xen/include/public/grant_table.h xen/include/public/io/blkif.h xen/include/public/io/domain_controller.h xen/include/public/io/netif.h xen/include/public/physdev.h xen/include/public/xen.h xen/include/xen/grant_table.h xen/include/xen/sched.h xen/include/xen/time.h
line diff
     1.1 --- a/.hgignore	Tue Aug 23 17:32:44 2005 +0000
     1.2 +++ b/.hgignore	Tue Aug 23 17:33:11 2005 +0000
     1.3 @@ -147,6 +147,7 @@
     1.4  ^tools/xcs/xcsdump$
     1.5  ^tools/xcutils/xc_restore$
     1.6  ^tools/xcutils/xc_save$
     1.7 +^tools/xenstat/xentop/xentop$
     1.8  ^tools/xenstore/testsuite/tmp/.*$
     1.9  ^tools/xenstore/xen$
    1.10  ^tools/xenstore/xenstored$
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Tue Aug 23 17:32:44 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Tue Aug 23 17:33:11 2005 +0000
     2.3 @@ -807,7 +807,107 @@ CONFIG_DUMMY_CONSOLE=y
     2.4  #
     2.5  CONFIG_USB_ARCH_HAS_HCD=y
     2.6  CONFIG_USB_ARCH_HAS_OHCI=y
     2.7 -# CONFIG_USB is not set
     2.8 +CONFIG_USB=y
     2.9 +# CONFIG_USB_DEBUG is not set
    2.10 +
    2.11 +#
    2.12 +# Miscellaneous USB options
    2.13 +#
    2.14 +# CONFIG_USB_DEVICEFS is not set
    2.15 +# CONFIG_USB_BANDWIDTH is not set
    2.16 +# CONFIG_USB_DYNAMIC_MINORS is not set
    2.17 +# CONFIG_USB_OTG is not set
    2.18 +
    2.19 +#
    2.20 +# USB Host Controller Drivers
    2.21 +#
    2.22 +# CONFIG_USB_EHCI_HCD is not set
    2.23 +CONFIG_USB_OHCI_HCD=y
    2.24 +# CONFIG_USB_OHCI_BIG_ENDIAN is not set
    2.25 +CONFIG_USB_OHCI_LITTLE_ENDIAN=y
    2.26 +CONFIG_USB_UHCI_HCD=y
    2.27 +# CONFIG_USB_SL811_HCD is not set
    2.28 +
    2.29 +#
    2.30 +# USB Device Class drivers
    2.31 +#
    2.32 +# CONFIG_USB_BLUETOOTH_TTY is not set
    2.33 +# CONFIG_USB_ACM is not set
    2.34 +# CONFIG_USB_PRINTER is not set
    2.35 +
    2.36 +#
    2.37 +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
    2.38 +#
    2.39 +# CONFIG_USB_STORAGE is not set
    2.40 +
    2.41 +#
    2.42 +# USB Input Devices
    2.43 +#
    2.44 +CONFIG_USB_HID=y
    2.45 +CONFIG_USB_HIDINPUT=y
    2.46 +# CONFIG_HID_FF is not set
    2.47 +# CONFIG_USB_HIDDEV is not set
    2.48 +# CONFIG_USB_AIPTEK is not set
    2.49 +# CONFIG_USB_WACOM is not set
    2.50 +# CONFIG_USB_KBTAB is not set
    2.51 +# CONFIG_USB_POWERMATE is not set
    2.52 +# CONFIG_USB_MTOUCH is not set
    2.53 +# CONFIG_USB_EGALAX is not set
    2.54 +# CONFIG_USB_XPAD is not set
    2.55 +# CONFIG_USB_ATI_REMOTE is not set
    2.56 +
    2.57 +#
    2.58 +# USB Imaging devices
    2.59 +#
    2.60 +# CONFIG_USB_MDC800 is not set
    2.61 +# CONFIG_USB_MICROTEK is not set
    2.62 +
    2.63 +#
    2.64 +# USB Multimedia devices
    2.65 +#
    2.66 +# CONFIG_USB_DABUSB is not set
    2.67 +
    2.68 +#
    2.69 +# Video4Linux support is needed for USB Multimedia device support
    2.70 +#
    2.71 +
    2.72 +#
    2.73 +# USB Network Adapters
    2.74 +#
    2.75 +# CONFIG_USB_CATC is not set
    2.76 +# CONFIG_USB_KAWETH is not set
    2.77 +# CONFIG_USB_PEGASUS is not set
    2.78 +# CONFIG_USB_RTL8150 is not set
    2.79 +# CONFIG_USB_USBNET is not set
    2.80 +CONFIG_USB_MON=y
    2.81 +
    2.82 +#
    2.83 +# USB port drivers
    2.84 +#
    2.85 +
    2.86 +#
    2.87 +# USB Serial Converter support
    2.88 +#
    2.89 +# CONFIG_USB_SERIAL is not set
    2.90 +
    2.91 +#
    2.92 +# USB Miscellaneous drivers
    2.93 +#
    2.94 +# CONFIG_USB_EMI62 is not set
    2.95 +# CONFIG_USB_EMI26 is not set
    2.96 +# CONFIG_USB_AUERSWALD is not set
    2.97 +# CONFIG_USB_RIO500 is not set
    2.98 +# CONFIG_USB_LEGOTOWER is not set
    2.99 +# CONFIG_USB_LCD is not set
   2.100 +# CONFIG_USB_LED is not set
   2.101 +# CONFIG_USB_CYTHERM is not set
   2.102 +# CONFIG_USB_PHIDGETKIT is not set
   2.103 +# CONFIG_USB_PHIDGETSERVO is not set
   2.104 +# CONFIG_USB_IDMOUSE is not set
   2.105 +
   2.106 +#
   2.107 +# USB ATM/DSL drivers
   2.108 +#
   2.109  
   2.110  #
   2.111  # USB Gadget Support
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Aug 23 17:32:44 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Aug 23 17:33:11 2005 +0000
     3.3 @@ -1575,19 +1575,20 @@ void __init setup_arch(char **cmdline_p)
     3.4  	/* Make sure we have a correctly sized P->M table. */
     3.5  	if (max_pfn != xen_start_info.nr_pages) {
     3.6  		phys_to_machine_mapping = alloc_bootmem_low_pages(
     3.7 -			max_pfn * sizeof(unsigned long));
     3.8 +			max_pfn * sizeof(unsigned int));
     3.9  
    3.10  		if (max_pfn > xen_start_info.nr_pages) {
    3.11  			/* set to INVALID_P2M_ENTRY */
    3.12  			memset(phys_to_machine_mapping, ~0,
    3.13 -				max_pfn * sizeof(unsigned long));
    3.14 +				max_pfn * sizeof(unsigned int));
    3.15  			memcpy(phys_to_machine_mapping,
    3.16 -				(unsigned long *)xen_start_info.mfn_list,
    3.17 -				xen_start_info.nr_pages * sizeof(unsigned long));
    3.18 +				(unsigned int *)xen_start_info.mfn_list,
    3.19 +				xen_start_info.nr_pages * sizeof(unsigned int));
    3.20  		} else {
    3.21  			memcpy(phys_to_machine_mapping,
    3.22 -				(unsigned long *)xen_start_info.mfn_list,
    3.23 -				max_pfn * sizeof(unsigned long));
    3.24 +				(unsigned int *)xen_start_info.mfn_list,
    3.25 +				max_pfn * sizeof(unsigned int));
    3.26 +			/* N.B. below relies on sizeof(int) == sizeof(long). */
    3.27  			if (HYPERVISOR_dom_mem_op(
    3.28  				MEMOP_decrease_reservation,
    3.29  				(unsigned long *)xen_start_info.mfn_list + max_pfn,
    3.30 @@ -1597,11 +1598,11 @@ void __init setup_arch(char **cmdline_p)
    3.31  		free_bootmem(
    3.32  			__pa(xen_start_info.mfn_list), 
    3.33  			PFN_PHYS(PFN_UP(xen_start_info.nr_pages *
    3.34 -			sizeof(unsigned long))));
    3.35 +			sizeof(unsigned int))));
    3.36  	}
    3.37  
    3.38  	pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
    3.39 -	for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
    3.40 +	for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned int)), j++ )
    3.41  	{	
    3.42  	     pfn_to_mfn_frame_list[j] = 
    3.43  		  virt_to_mfn(&phys_to_machine_mapping[i]);
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Aug 23 17:32:44 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Aug 23 17:33:11 2005 +0000
     4.3 @@ -281,7 +281,7 @@ fastcall void do_page_fault(struct pt_re
     4.4  	siginfo_t info;
     4.5  
     4.6  	/* Set the "privileged fault" bit to something sane. */
     4.7 -	error_code &= 3;
     4.8 +	error_code &= ~4;
     4.9  	error_code |= (regs->xcs & 2) << 1;
    4.10  	if (regs->eflags & X86_EFLAGS_VM)
    4.11  		error_code |= 4;
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Tue Aug 23 17:32:44 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/init.c	Tue Aug 23 17:33:11 2005 +0000
     5.3 @@ -348,9 +348,12 @@ static void __init pagetable_init (void)
     5.4  {
     5.5  	unsigned long vaddr;
     5.6  	pgd_t *pgd_base = (pgd_t *)xen_start_info.pt_base;
     5.7 +	int i;
     5.8  
     5.9  	swapper_pg_dir = pgd_base;
    5.10  	init_mm.pgd    = pgd_base;
    5.11 +	for (i = 0; i < NR_CPUS; i++)
    5.12 +		per_cpu(cur_pgd, i) = pgd_base;
    5.13  
    5.14  	/* Enable PSE if available */
    5.15  	if (cpu_has_pse) {
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Tue Aug 23 17:32:44 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Tue Aug 23 17:33:11 2005 +0000
     6.3 @@ -36,6 +36,8 @@ void iounmap(volatile void __iomem *addr
     6.4  {
     6.5  }
     6.6  
     6.7 +#ifdef __i386__
     6.8 +
     6.9  void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
    6.10  {
    6.11  	return NULL;
    6.12 @@ -45,6 +47,8 @@ void __init bt_iounmap(void *addr, unsig
    6.13  {
    6.14  }
    6.15  
    6.16 +#endif /* __i386__ */
    6.17 +
    6.18  #else
    6.19  
    6.20  /*
    6.21 @@ -58,7 +62,7 @@ static inline int is_local_lowmem(unsign
    6.22  	extern unsigned long max_low_pfn;
    6.23  	unsigned long mfn = address >> PAGE_SHIFT;
    6.24  	unsigned long pfn = mfn_to_pfn(mfn);
    6.25 -	return ((pfn < max_low_pfn) && (pfn_to_mfn(pfn) == mfn));
    6.26 +	return ((pfn < max_low_pfn) && (phys_to_machine_mapping[pfn] == mfn));
    6.27  }
    6.28  
    6.29  /*
    6.30 @@ -126,10 +130,12 @@ void __iomem * __ioremap(unsigned long p
    6.31  		return NULL;
    6.32  	area->phys_addr = phys_addr;
    6.33  	addr = (void __iomem *) area->addr;
    6.34 +	flags |= _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
    6.35 +#ifdef __x86_64__
    6.36 +	flags |= _PAGE_USER;
    6.37 +#endif
    6.38  	if (direct_remap_area_pages(&init_mm, (unsigned long) addr, phys_addr,
    6.39 -				    size, __pgprot(_PAGE_PRESENT | _PAGE_RW |
    6.40 -						   _PAGE_DIRTY | _PAGE_ACCESSED
    6.41 -						   | flags), domid)) {
    6.42 +				    size, __pgprot(flags), domid)) {
    6.43  		vunmap((void __force *) addr);
    6.44  		return NULL;
    6.45  	}
    6.46 @@ -218,6 +224,8 @@ void iounmap(volatile void __iomem *addr
    6.47  	kfree(p); 
    6.48  }
    6.49  
    6.50 +#ifdef __i386__
    6.51 +
    6.52  void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
    6.53  {
    6.54  	unsigned long offset, last_addr;
    6.55 @@ -289,6 +297,8 @@ void __init bt_iounmap(void *addr, unsig
    6.56  	}
    6.57  }
    6.58  
    6.59 +#endif /* __i386__ */
    6.60 +
    6.61  #endif /* CONFIG_XEN_PHYSDEV_ACCESS */
    6.62  
    6.63  /* These hacky macros avoid phys->machine translations. */
    6.64 @@ -346,7 +356,7 @@ int direct_remap_area_pages(struct mm_st
    6.65  		 * Fill in the machine address: PTE ptr is done later by
    6.66  		 * __direct_remap_area_pages(). 
    6.67  		 */
    6.68 -		v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot);
    6.69 +		v->val = pte_val_ma(pfn_pte_ma(machine_addr >> PAGE_SHIFT, prot));
    6.70  
    6.71  		machine_addr += PAGE_SIZE;
    6.72  		address += PAGE_SIZE; 
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile	Tue Aug 23 17:32:44 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile	Tue Aug 23 17:33:11 2005 +0000
     7.3 @@ -44,7 +44,7 @@ obj-$(CONFIG_X86_PM_TIMER)	+= pmtimer.o
     7.4  
     7.5  c-obj-$(CONFIG_MODULES)		+= module.o
     7.6  
     7.7 -#obj-y				+= topology.o
     7.8 +obj-y				+= topology.o
     7.9  c-obj-y				+= intel_cacheinfo.o
    7.10  
    7.11  bootflag-y			+= ../../../i386/kernel/bootflag.o
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Aug 23 17:32:44 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Aug 23 17:33:11 2005 +0000
     8.3 @@ -778,21 +778,21 @@ void __init setup_arch(char **cmdline_p)
     8.4  		/* Make sure we have a large enough P->M table. */
     8.5  		if (end_pfn > xen_start_info.nr_pages) {
     8.6  			phys_to_machine_mapping = alloc_bootmem(
     8.7 -				max_pfn * sizeof(unsigned long));
     8.8 +				max_pfn * sizeof(u32));
     8.9  			memset(phys_to_machine_mapping, ~0,
    8.10 -			       max_pfn * sizeof(unsigned long));
    8.11 +			       max_pfn * sizeof(u32));
    8.12  			memcpy(phys_to_machine_mapping,
    8.13 -			       (unsigned long *)xen_start_info.mfn_list,
    8.14 -			       xen_start_info.nr_pages * sizeof(unsigned long));
    8.15 +			       (u32 *)xen_start_info.mfn_list,
    8.16 +			       xen_start_info.nr_pages * sizeof(u32));
    8.17  			free_bootmem(
    8.18  				__pa(xen_start_info.mfn_list), 
    8.19  				PFN_PHYS(PFN_UP(xen_start_info.nr_pages *
    8.20 -						sizeof(unsigned long))));
    8.21 +						sizeof(u32))));
    8.22  		}
    8.23  
    8.24  		pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE);
    8.25  
    8.26 -		for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
    8.27 +		for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(u32)), j++ )
    8.28  		{	
    8.29  			pfn_to_mfn_frame_list[j] = 
    8.30  				virt_to_mfn(&phys_to_machine_mapping[i]);
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/Makefile	Tue Aug 23 17:32:44 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/Makefile	Tue Aug 23 17:33:11 2005 +0000
     9.3 @@ -6,10 +6,10 @@ XENARCH	:= $(subst ",,$(CONFIG_XENARCH))
     9.4  
     9.5  CFLAGS	+= -Iarch/$(XENARCH)/mm
     9.6  
     9.7 -obj-y	:= init.o fault.o ioremap.o pageattr.o
     9.8 +obj-y	:= init.o fault.o pageattr.o
     9.9  c-obj-y	:= extable.o
    9.10  
    9.11 -i386-obj-y := hypervisor.o
    9.12 +i386-obj-y := hypervisor.o ioremap.o
    9.13  
    9.14  #obj-y	 := init.o fault.o ioremap.o extable.o pageattr.o
    9.15  #c-obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
    10.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Tue Aug 23 17:32:44 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Tue Aug 23 17:33:11 2005 +0000
    10.3 @@ -559,6 +559,11 @@ static void xen_copy_pt(void)
    10.4  
    10.5  void __init xen_init_pt(void)
    10.6  {
    10.7 +	int i;
    10.8 +
    10.9 +	for (i = 0; i < NR_CPUS; i++)
   10.10 +		per_cpu(cur_pgd, i) = init_mm.pgd;
   10.11 +
   10.12  	memcpy((void *)init_level4_pgt, 
   10.13  	       (void *)xen_start_info.pt_base, PAGE_SIZE);
   10.14  
    11.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/ioremap.c	Tue Aug 23 17:32:44 2005 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,499 +0,0 @@
    11.4 -/*
    11.5 - * arch/x86_64/mm/ioremap.c
    11.6 - *
    11.7 - * Re-map IO memory to kernel address space so that we can access it.
    11.8 - * This is needed for high PCI addresses that aren't mapped in the
    11.9 - * 640k-1MB IO memory area on PC's
   11.10 - *
   11.11 - * (C) Copyright 1995 1996 Linus Torvalds
   11.12 - */
   11.13 -
   11.14 -#include <linux/vmalloc.h>
   11.15 -#include <linux/init.h>
   11.16 -#include <linux/slab.h>
   11.17 -#include <linux/module.h>
   11.18 -#include <asm/io.h>
   11.19 -#include <asm/fixmap.h>
   11.20 -#include <asm/cacheflush.h>
   11.21 -#include <asm/tlbflush.h>
   11.22 -#include <asm/pgtable.h>
   11.23 -#include <asm/pgalloc.h>
   11.24 -
   11.25 -/*
   11.26 - * Reuse arch/xen/i396/mm/ioremap.c. Need to merge later
   11.27 - */
   11.28 -#ifndef CONFIG_XEN_PHYSDEV_ACCESS
   11.29 -
   11.30 -void * __ioremap(unsigned long phys_addr, unsigned long size,
   11.31 -		 unsigned long flags)
   11.32 -{
   11.33 -	return NULL;
   11.34 -}
   11.35 -
   11.36 -void *ioremap_nocache (unsigned long phys_addr, unsigned long size)
   11.37 -{
   11.38 -	return NULL;
   11.39 -}
   11.40 -
   11.41 -void iounmap(volatile void __iomem *addr)
   11.42 -{
   11.43 -}
   11.44 -
   11.45 -void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
   11.46 -{
   11.47 -	return NULL;
   11.48 -}
   11.49 -
   11.50 -void __init bt_iounmap(void *addr, unsigned long size)
   11.51 -{
   11.52 -}
   11.53 -
   11.54 -#else
   11.55 -
   11.56 -#if defined(__i386__)
   11.57 -/*
   11.58 - * Does @address reside within a non-highmem page that is local to this virtual
   11.59 - * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
   11.60 - * See the comment that accompanies pte_pfn() in pgtable-2level.h to understand
   11.61 - * why this works.
   11.62 - */
   11.63 -static inline int is_local_lowmem(unsigned long address)
   11.64 -{
   11.65 -	extern unsigned long max_low_pfn;
   11.66 -	unsigned long mfn = address >> PAGE_SHIFT;
   11.67 -	unsigned long pfn = mfn_to_pfn(mfn);
   11.68 -	return ((pfn < max_low_pfn) && (pfn_to_mfn(pfn) == mfn));
   11.69 -}
   11.70 -#elif defined(__x86_64__)
   11.71 -/*
   11.72 - * 
   11.73 - */
   11.74 -static inline int is_local_lowmem(unsigned long address)
   11.75 -{
   11.76 -        return 0;
   11.77 -}
   11.78 -#endif
   11.79 -
   11.80 -/*
   11.81 - * Generic mapping function (not visible outside):
   11.82 - */
   11.83 -
   11.84 -/*
   11.85 - * Remap an arbitrary physical address space into the kernel virtual
   11.86 - * address space. Needed when the kernel wants to access high addresses
   11.87 - * directly.
   11.88 - *
   11.89 - * NOTE! We need to allow non-page-aligned mappings too: we will obviously
   11.90 - * have to convert them into an offset in a page-aligned mapping, but the
   11.91 - * caller shouldn't need to know that small detail.
   11.92 - */
   11.93 -void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
   11.94 -{
   11.95 -	void __iomem * addr;
   11.96 -	struct vm_struct * area;
   11.97 -	unsigned long offset, last_addr;
   11.98 -	domid_t domid = DOMID_IO;
   11.99 -
  11.100 -	/* Don't allow wraparound or zero size */
  11.101 -	last_addr = phys_addr + size - 1;
  11.102 -	if (!size || last_addr < phys_addr)
  11.103 -		return NULL;
  11.104 -
  11.105 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  11.106 -	/*
  11.107 -	 * Don't remap the low PCI/ISA area, it's always mapped..
  11.108 -	 */
  11.109 -	if (phys_addr >= 0x0 && last_addr < 0x100000)
  11.110 -		return isa_bus_to_virt(phys_addr);
  11.111 -#endif
  11.112 -
  11.113 -	/*
  11.114 -	 * Don't allow anybody to remap normal RAM that we're using..
  11.115 -	 */
  11.116 -	if (is_local_lowmem(phys_addr)) {
  11.117 -		char *t_addr, *t_end;
  11.118 - 		struct page *page;
  11.119 -
  11.120 -		t_addr = bus_to_virt(phys_addr);
  11.121 -		t_end = t_addr + (size - 1);
  11.122 -	   
  11.123 -		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
  11.124 -			if(!PageReserved(page))
  11.125 -				return NULL;
  11.126 -
  11.127 -		domid = DOMID_LOCAL;
  11.128 -	}
  11.129 -
  11.130 -	/*
  11.131 -	 * Mappings have to be page-aligned
  11.132 -	 */
  11.133 -	offset = phys_addr & ~PAGE_MASK;
  11.134 -	phys_addr &= PAGE_MASK;
  11.135 -	size = PAGE_ALIGN(last_addr+1) - phys_addr;
  11.136 -
  11.137 -	/*
  11.138 -	 * Ok, go for it..
  11.139 -	 */
  11.140 -	area = get_vm_area(size, VM_IOREMAP | (flags << 20));
  11.141 -	if (!area)
  11.142 -		return NULL;
  11.143 -	area->phys_addr = phys_addr;
  11.144 -	addr = (void __iomem *) area->addr;
  11.145 -	if (direct_remap_area_pages(&init_mm, (unsigned long) addr, phys_addr,
  11.146 -				    size, __pgprot(_PAGE_PRESENT | _PAGE_RW |
  11.147 -						   _PAGE_DIRTY | _PAGE_ACCESSED
  11.148 -#if defined(__x86_64__)
  11.149 -                                                   | _PAGE_USER
  11.150 -#endif
  11.151 -						   | flags), domid)) {
  11.152 -		vunmap((void __force *) addr);
  11.153 -		return NULL;
  11.154 -	}
  11.155 -	return (void __iomem *) (offset + (char __iomem *)addr);
  11.156 -}
  11.157 -
  11.158 -
  11.159 -/**
  11.160 - * ioremap_nocache     -   map bus memory into CPU space
  11.161 - * @offset:    bus address of the memory
  11.162 - * @size:      size of the resource to map
  11.163 - *
  11.164 - * ioremap_nocache performs a platform specific sequence of operations to
  11.165 - * make bus memory CPU accessible via the readb/readw/readl/writeb/
  11.166 - * writew/writel functions and the other mmio helpers. The returned
  11.167 - * address is not guaranteed to be usable directly as a virtual
  11.168 - * address. 
  11.169 - *
  11.170 - * This version of ioremap ensures that the memory is marked uncachable
  11.171 - * on the CPU as well as honouring existing caching rules from things like
  11.172 - * the PCI bus. Note that there are other caches and buffers on many 
  11.173 - * busses. In particular driver authors should read up on PCI writes
  11.174 - *
  11.175 - * It's useful if some control registers are in such an area and
  11.176 - * write combining or read caching is not desirable:
  11.177 - * 
  11.178 - * Must be freed with iounmap.
  11.179 - */
  11.180 -
  11.181 -void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
  11.182 -{
  11.183 -	unsigned long last_addr;
  11.184 -	void __iomem *p = __ioremap(phys_addr, size, _PAGE_PCD);
  11.185 -	if (!p) 
  11.186 -		return p; 
  11.187 -
  11.188 -	/* Guaranteed to be > phys_addr, as per __ioremap() */
  11.189 -	last_addr = phys_addr + size - 1;
  11.190 -
  11.191 -	if (is_local_lowmem(last_addr)) { 
  11.192 -		struct page *ppage = virt_to_page(bus_to_virt(phys_addr));
  11.193 -		unsigned long npages;
  11.194 -
  11.195 -		phys_addr &= PAGE_MASK;
  11.196 -
  11.197 -		/* This might overflow and become zero.. */
  11.198 -		last_addr = PAGE_ALIGN(last_addr);
  11.199 -
  11.200 -		/* .. but that's ok, because modulo-2**n arithmetic will make
  11.201 -	 	* the page-aligned "last - first" come out right.
  11.202 -	 	*/
  11.203 -		npages = (last_addr - phys_addr) >> PAGE_SHIFT;
  11.204 -
  11.205 -		if (change_page_attr(ppage, npages, PAGE_KERNEL_NOCACHE) < 0) { 
  11.206 -			iounmap(p); 
  11.207 -			p = NULL;
  11.208 -		}
  11.209 -		global_flush_tlb();
  11.210 -	}
  11.211 -
  11.212 -	return p;					
  11.213 -}
  11.214 -
  11.215 -void iounmap(volatile void __iomem *addr)
  11.216 -{
  11.217 -	struct vm_struct *p;
  11.218 -	if ((void __force *) addr <= high_memory) 
  11.219 -		return; 
  11.220 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  11.221 -	if ((unsigned long) addr >= fix_to_virt(FIX_ISAMAP_BEGIN))
  11.222 -		return;
  11.223 -#endif
  11.224 -	p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr));
  11.225 -	if (!p) { 
  11.226 -		printk("__iounmap: bad address %p\n", addr);
  11.227 -		return;
  11.228 -	}
  11.229 -
  11.230 -	if ((p->flags >> 20) && is_local_lowmem(p->phys_addr)) {
  11.231 -		/* p->size includes the guard page, but cpa doesn't like that */
  11.232 -		change_page_attr(virt_to_page(bus_to_virt(p->phys_addr)),
  11.233 -				 (p->size - PAGE_SIZE) >> PAGE_SHIFT,
  11.234 -				 PAGE_KERNEL); 				 
  11.235 -		global_flush_tlb();
  11.236 -	} 
  11.237 -	kfree(p); 
  11.238 -}
  11.239 -
  11.240 -#if defined(__i386__)
  11.241 -void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
  11.242 -{
  11.243 -	unsigned long offset, last_addr;
  11.244 -	unsigned int nrpages;
  11.245 -	enum fixed_addresses idx;
  11.246 -
  11.247 -	/* Don't allow wraparound or zero size */
  11.248 -	last_addr = phys_addr + size - 1;
  11.249 -	if (!size || last_addr < phys_addr)
  11.250 -		return NULL;
  11.251 -
  11.252 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  11.253 -	/*
  11.254 -	 * Don't remap the low PCI/ISA area, it's always mapped..
  11.255 -	 */
  11.256 -	if (phys_addr >= 0x0 && last_addr < 0x100000)
  11.257 -		return isa_bus_to_virt(phys_addr);
  11.258 -#endif
  11.259 -
  11.260 -	/*
  11.261 -	 * Mappings have to be page-aligned
  11.262 -	 */
  11.263 -	offset = phys_addr & ~PAGE_MASK;
  11.264 -	phys_addr &= PAGE_MASK;
  11.265 -	size = PAGE_ALIGN(last_addr) - phys_addr;
  11.266 -
  11.267 -	/*
  11.268 -	 * Mappings have to fit in the FIX_BTMAP area.
  11.269 -	 */
  11.270 -	nrpages = size >> PAGE_SHIFT;
  11.271 -	if (nrpages > NR_FIX_BTMAPS)
  11.272 -		return NULL;
  11.273 -
  11.274 -	/*
  11.275 -	 * Ok, go for it..
  11.276 -	 */
  11.277 -	idx = FIX_BTMAP_BEGIN;
  11.278 -	while (nrpages > 0) {
  11.279 -		set_fixmap(idx, phys_addr);
  11.280 -		phys_addr += PAGE_SIZE;
  11.281 -		--idx;
  11.282 -		--nrpages;
  11.283 -	}
  11.284 -	return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN));
  11.285 -}
  11.286 -
  11.287 -void __init bt_iounmap(void *addr, unsigned long size)
  11.288 -{
  11.289 -	unsigned long virt_addr;
  11.290 -	unsigned long offset;
  11.291 -	unsigned int nrpages;
  11.292 -	enum fixed_addresses idx;
  11.293 -
  11.294 -	virt_addr = (unsigned long)addr;
  11.295 -	if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN))
  11.296 -		return;
  11.297 -#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  11.298 -	if (virt_addr >= fix_to_virt(FIX_ISAMAP_BEGIN))
  11.299 -		return;
  11.300 -#endif
  11.301 -	offset = virt_addr & ~PAGE_MASK;
  11.302 -	nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT;
  11.303 -
  11.304 -	idx = FIX_BTMAP_BEGIN;
  11.305 -	while (nrpages > 0) {
  11.306 -		clear_fixmap(idx);
  11.307 -		--idx;
  11.308 -		--nrpages;
  11.309 -	}
  11.310 -}
  11.311 -#endif /* defined(__i386__) */
  11.312 -
  11.313 -#endif /* CONFIG_XEN_PHYSDEV_ACCESS */
  11.314 -
  11.315 -/* These hacky macros avoid phys->machine translations. */
  11.316 -#define __direct_pte(x) ((pte_t) { (x) } )
  11.317 -#define __direct_mk_pte(page_nr,pgprot) \
  11.318 -  __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
  11.319 -#define direct_mk_pte_phys(physpage, pgprot) \
  11.320 -  __direct_mk_pte((physpage) >> PAGE_SHIFT, pgprot)
  11.321 -
  11.322 -static inline void direct_remap_area_pte(pte_t *pte, 
  11.323 -					 unsigned long address, 
  11.324 -					 unsigned long size,
  11.325 -					 mmu_update_t **v)
  11.326 -{
  11.327 -	unsigned long end;
  11.328 -
  11.329 -	address &= ~PMD_MASK;
  11.330 -	end = address + size;
  11.331 -	if (end > PMD_SIZE)
  11.332 -		end = PMD_SIZE;
  11.333 -	if (address >= end)
  11.334 -		BUG();
  11.335 -
  11.336 -	do {
  11.337 -		(*v)->ptr = virt_to_machine(pte);
  11.338 -		(*v)++;
  11.339 -		address += PAGE_SIZE;
  11.340 -		pte++;
  11.341 -	} while (address && (address < end));
  11.342 -}
  11.343 -
  11.344 -static inline int direct_remap_area_pmd(struct mm_struct *mm,
  11.345 -					pmd_t *pmd, 
  11.346 -					unsigned long address, 
  11.347 -					unsigned long size,
  11.348 -					mmu_update_t **v)
  11.349 -{
  11.350 -	unsigned long end;
  11.351 -
  11.352 -	address &= ~PGDIR_MASK;
  11.353 -	end = address + size;
  11.354 -	if (end > PGDIR_SIZE)
  11.355 -		end = PGDIR_SIZE;
  11.356 -	if (address >= end)
  11.357 -		BUG();
  11.358 -	do {
  11.359 -		pte_t *pte = (mm == &init_mm) ? 
  11.360 -			pte_alloc_kernel(mm, pmd, address) :
  11.361 -			pte_alloc_map(mm, pmd, address);
  11.362 -		if (!pte)
  11.363 -			return -ENOMEM;
  11.364 -		direct_remap_area_pte(pte, address, end - address, v);
  11.365 -		pte_unmap(pte);
  11.366 -		address = (address + PMD_SIZE) & PMD_MASK;
  11.367 -		pmd++;
  11.368 -	} while (address && (address < end));
  11.369 -	return 0;
  11.370 -}
  11.371 - 
  11.372 -int __direct_remap_area_pages(struct mm_struct *mm,
  11.373 -			      unsigned long address, 
  11.374 -			      unsigned long size, 
  11.375 -			      mmu_update_t *v)
  11.376 -{
  11.377 -	pgd_t * dir;
  11.378 -	unsigned long end = address + size;
  11.379 -	int error;
  11.380 -
  11.381 -#if defined(__i386__)
  11.382 -	dir = pgd_offset(mm, address);
  11.383 -#elif defined (__x86_64)
  11.384 -        dir = (mm == &init_mm) ?
  11.385 -		pgd_offset_k(address):
  11.386 -		pgd_offset(mm, address);
  11.387 -#endif
  11.388 -	if (address >= end)
  11.389 -		BUG();
  11.390 -	spin_lock(&mm->page_table_lock);
  11.391 -	do {
  11.392 -		pud_t *pud;
  11.393 -		pmd_t *pmd;
  11.394 -
  11.395 -		error = -ENOMEM;
  11.396 -		pud = pud_alloc(mm, dir, address);
  11.397 -		if (!pud)
  11.398 -			break;
  11.399 -		pmd = pmd_alloc(mm, pud, address);
  11.400 -		if (!pmd)
  11.401 -			break;
  11.402 -		error = 0;
  11.403 -		direct_remap_area_pmd(mm, pmd, address, end - address, &v);
  11.404 -		address = (address + PGDIR_SIZE) & PGDIR_MASK;
  11.405 -		dir++;
  11.406 -
  11.407 -	} while (address && (address < end));
  11.408 -	spin_unlock(&mm->page_table_lock);
  11.409 -	return error;
  11.410 -}
  11.411 -
  11.412 -
  11.413 -int direct_remap_area_pages(struct mm_struct *mm,
  11.414 -			    unsigned long address, 
  11.415 -			    unsigned long machine_addr,
  11.416 -			    unsigned long size, 
  11.417 -			    pgprot_t prot,
  11.418 -			    domid_t  domid)
  11.419 -{
  11.420 -	int i;
  11.421 -	unsigned long start_address;
  11.422 -#define MAX_DIRECTMAP_MMU_QUEUE 130
  11.423 -	mmu_update_t u[MAX_DIRECTMAP_MMU_QUEUE], *v = u;
  11.424 -
  11.425 -	start_address = address;
  11.426 -
  11.427 -	flush_cache_all();
  11.428 -
  11.429 -	for (i = 0; i < size; i += PAGE_SIZE) {
  11.430 -		if ((v - u) == MAX_DIRECTMAP_MMU_QUEUE) {
  11.431 -			/* Fill in the PTE pointers. */
  11.432 -			__direct_remap_area_pages(mm,
  11.433 -						  start_address, 
  11.434 -						  address-start_address, 
  11.435 -						  u);
  11.436 - 
  11.437 -			if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)
  11.438 -				return -EFAULT;
  11.439 -			v = u;
  11.440 -			start_address = address;
  11.441 -		}
  11.442 -
  11.443 -		/*
  11.444 -		 * Fill in the machine address: PTE ptr is done later by
  11.445 -		 * __direct_remap_area_pages(). 
  11.446 -		 */
  11.447 -		v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot);
  11.448 -
  11.449 -		machine_addr += PAGE_SIZE;
  11.450 -		address += PAGE_SIZE; 
  11.451 -		v++;
  11.452 -	}
  11.453 -
  11.454 -	if (v != u) {
  11.455 -		/* get the ptep's filled in */
  11.456 -		__direct_remap_area_pages(mm,
  11.457 -					  start_address, 
  11.458 -					  address-start_address, 
  11.459 -					  u);
  11.460 -		if (unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0))
  11.461 -			return -EFAULT;
  11.462 -	}
  11.463 -
  11.464 -	flush_tlb_all();
  11.465 -
  11.466 -	return 0;
  11.467 -}
  11.468 -
  11.469 -EXPORT_SYMBOL(direct_remap_area_pages);
  11.470 -
  11.471 -static int lookup_pte_fn(
  11.472 -    pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 
  11.473 -{
  11.474 -    unsigned long *ptep = (unsigned long *)data;
  11.475 -    if (ptep) *ptep = (pfn_to_mfn(page_to_pfn(pte_page)) << PAGE_SHIFT)
  11.476 -                  | ((unsigned long)pte & ~PAGE_MASK);
  11.477 -    return 0;
  11.478 -}
  11.479 -
  11.480 -int create_lookup_pte_addr(struct mm_struct *mm, 
  11.481 -                           unsigned long address,
  11.482 -                           unsigned long *ptep)
  11.483 -{
  11.484 -    return generic_page_range(mm, address, PAGE_SIZE, lookup_pte_fn, ptep);
  11.485 -}
  11.486 -
  11.487 -EXPORT_SYMBOL(create_lookup_pte_addr);
  11.488 -
  11.489 -static int noop_fn(
  11.490 -    pte_t *pte, struct page *pte_page, unsigned long addr, void *data) 
  11.491 -{
  11.492 -    return 0;
  11.493 -}
  11.494 -
  11.495 -int touch_pte_range(struct mm_struct *mm,
  11.496 -                    unsigned long address,
  11.497 -                    unsigned long size)
  11.498 -{
  11.499 -    return generic_page_range(mm, address, size, noop_fn, NULL);
  11.500 -}
  11.501 -
  11.502 -EXPORT_SYMBOL(touch_pte_range);
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Aug 23 17:32:44 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Aug 23 17:33:11 2005 +0000
    12.3 @@ -167,7 +167,7 @@ static int privcmd_ioctl(struct inode *i
    12.4              if (ret)
    12.5                  goto batch_err;
    12.6  
    12.7 -            u.val = (mfn << PAGE_SHIFT) | pgprot_val(vma->vm_page_prot);
    12.8 +            u.val = pte_val_ma(pfn_pte_ma(mfn, vma->vm_page_prot));
    12.9              u.ptr = ptep;
   12.10  
   12.11              if ( unlikely(HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0) )
    13.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Tue Aug 23 17:32:44 2005 +0000
    13.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h	Tue Aug 23 17:33:11 2005 +0000
    13.3 @@ -60,9 +60,13 @@
    13.4  #define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
    13.5  
    13.6  /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
    13.7 +#define INVALID_P2M_ENTRY	(~0U)
    13.8 +#define FOREIGN_FRAME(m)	((m) | 0x80000000U)
    13.9  extern unsigned int *phys_to_machine_mapping;
   13.10 -#define pfn_to_mfn(_pfn) ((unsigned long)(phys_to_machine_mapping[(_pfn)]))
   13.11 -#define mfn_to_pfn(_mfn) ((unsigned long)(machine_to_phys_mapping[(_mfn)]))
   13.12 +#define pfn_to_mfn(pfn)	\
   13.13 +((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
   13.14 +#define mfn_to_pfn(mfn)	\
   13.15 +((unsigned long)machine_to_phys_mapping[(unsigned int)(mfn)])
   13.16  
   13.17  /* Definitions for machine and pseudophysical addresses. */
   13.18  #ifdef CONFIG_X86_PAE
    14.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Tue Aug 23 17:32:44 2005 +0000
    14.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-2level.h	Tue Aug 23 17:33:11 2005 +0000
    14.3 @@ -63,17 +63,15 @@ inline static void set_pte_at_sync(struc
    14.4   * 
    14.5   * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
    14.6   *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
    14.7 - *      require. In all the cases we care about, the high bit gets shifted out
    14.8 - *      (e.g., phys_to_machine()) so behaviour there is correct.
    14.9 + *      require. In all the cases we care about, the FOREIGN_FRAME bit is
   14.10 + *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
   14.11   */
   14.12 -#define INVALID_P2M_ENTRY (~0U)
   14.13 -#define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
   14.14  #define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT)
   14.15  #define pte_pfn(_pte)							\
   14.16  ({									\
   14.17  	unsigned long mfn = pte_mfn(_pte);				\
   14.18  	unsigned long pfn = mfn_to_pfn(mfn);				\
   14.19 -	if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))		\
   14.20 +	if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
   14.21  		pfn = max_mapnr; /* special: force !pfn_valid() */	\
   14.22  	pfn;								\
   14.23  })
    15.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h	Tue Aug 23 17:32:44 2005 +0000
    15.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable-3level.h	Tue Aug 23 17:33:11 2005 +0000
    15.3 @@ -150,15 +150,13 @@ static inline int pte_none(pte_t pte)
    15.4  	return !pte.pte_low && !pte.pte_high;
    15.5  }
    15.6  
    15.7 -#define INVALID_P2M_ENTRY (~0U)
    15.8 -#define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
    15.9  #define pte_mfn(_pte) ( ((_pte).pte_low >> PAGE_SHIFT) |\
   15.10  		        (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT)) )
   15.11  #define pte_pfn(_pte)                                                  \
   15.12  ({                                                                     \
   15.13         unsigned long mfn = pte_mfn(_pte);                              \
   15.14         unsigned long pfn = mfn_to_pfn(mfn);                            \
   15.15 -       if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))             \
   15.16 +       if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
   15.17                 pfn = max_mapnr; /* special: force !pfn_valid() */      \
   15.18         pfn;                                                            \
   15.19  })
    16.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h	Tue Aug 23 17:32:44 2005 +0000
    16.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h	Tue Aug 23 17:33:11 2005 +0000
    16.3 @@ -62,9 +62,13 @@ void copy_page(void *, void *);
    16.4  #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
    16.5  
    16.6  /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
    16.7 +#define INVALID_P2M_ENTRY	(~0U)
    16.8 +#define FOREIGN_FRAME(m)	((m) | 0x80000000U)
    16.9  extern u32 *phys_to_machine_mapping;
   16.10 -#define pfn_to_mfn(_pfn) ((unsigned long) phys_to_machine_mapping[(unsigned int)(_pfn)])
   16.11 -#define mfn_to_pfn(_mfn) ((unsigned long) machine_to_phys_mapping[(unsigned int)(_mfn)])
   16.12 +#define pfn_to_mfn(pfn)	\
   16.13 +((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL)
   16.14 +#define mfn_to_pfn(mfn)	\
   16.15 +((unsigned long)machine_to_phys_mapping[(unsigned int)(mfn)])
   16.16  
   16.17  /* Definitions for machine and pseudophysical addresses. */
   16.18  typedef unsigned long paddr_t;
    17.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Tue Aug 23 17:32:44 2005 +0000
    17.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h	Tue Aug 23 17:33:11 2005 +0000
    17.3 @@ -300,17 +300,15 @@ inline static void set_pte_at(struct mm_
    17.4   * 
    17.5   * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
    17.6   *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
    17.7 - *      require. In all the cases we care about, the high bit gets shifted out
    17.8 - *      (e.g., phys_to_machine()) so behaviour there is correct.
    17.9 + *      require. In all the cases we care about, the FOREIGN_FRAME bit is
   17.10 + *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
   17.11   */
   17.12 -#define INVALID_P2M_ENTRY (~0U)
   17.13 -#define FOREIGN_FRAME(_m) ((_m) | (1UL<<((sizeof(unsigned long)*8)-1)))
   17.14  #define pte_mfn(_pte) (((_pte).pte & PTE_MASK) >> PAGE_SHIFT)
   17.15  #define pte_pfn(_pte)							\
   17.16  ({									\
   17.17  	unsigned long mfn = pte_mfn(_pte);                              \
   17.18  	unsigned pfn = mfn_to_pfn(mfn);                                 \
   17.19 -	if ((pfn >= max_mapnr) || (pfn_to_mfn(pfn) != mfn))		\
   17.20 +	if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\
   17.21  		pfn = max_mapnr; /* special: force !pfn_valid() */	\
   17.22  	pfn;								\
   17.23  })
    18.1 --- a/tools/xenstat/xentop/Makefile	Tue Aug 23 17:32:44 2005 +0000
    18.2 +++ b/tools/xenstat/xentop/Makefile	Tue Aug 23 17:33:11 2005 +0000
    18.3 @@ -28,7 +28,7 @@ sbindir=$(prefix)/sbin
    18.4  
    18.5  CFLAGS += -DGCC_PRINTF -Wall -Werror -I$(XEN_LIBXENSTAT)
    18.6  LDFLAGS += -L$(XEN_LIBXENSTAT)
    18.7 -LDLIBS += -lxenstat -lcurses
    18.8 +LDLIBS += -lxenstat -lncurses
    18.9  
   18.10  all: xentop
   18.11  
    19.1 --- a/xen/arch/x86/io_apic.c	Tue Aug 23 17:32:44 2005 +0000
    19.2 +++ b/xen/arch/x86/io_apic.c	Tue Aug 23 17:33:11 2005 +0000
    19.3 @@ -1751,8 +1751,30 @@ int ioapic_guest_write(int apicid, int a
    19.4      
    19.5      pin = (address - 0x10) >> 1;
    19.6  
    19.7 +    *(u32 *)&rte = val;
    19.8      rte.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
    19.9 -    *(int *)&rte = val;
   19.10 +
   19.11 +    /*
   19.12 +     * What about weird destination types?
   19.13 +     *  SMI:    Ignore? Ought to be set up by the BIOS.
   19.14 +     *  NMI:    Ignore? Watchdog functionality is Xen's concern.
   19.15 +     *  INIT:   Definitely ignore: probably a guest OS bug.
   19.16 +     *  ExtINT: Ignore? Linux only asserts this at start of day.
   19.17 +     * For now, print a message and return an error. We can fix up on demand.
   19.18 +     */
   19.19 +    if ( rte.delivery_mode > dest_LowestPrio )
   19.20 +    {
   19.21 +        printk("ERROR: Attempt to write weird IOAPIC destination mode!\n");
   19.22 +        printk("       APIC=%d/%d, lo-reg=%x\n", apicid, pin, val);
   19.23 +        return -EINVAL;
   19.24 +    }
   19.25 +
   19.26 +    /*
   19.27 +     * The guest does not know physical APIC arrangement (flat vs. cluster).
   19.28 +     * Apply genapic conventions for this platform.
   19.29 +     */
   19.30 +    rte.delivery_mode = INT_DELIVERY_MODE;
   19.31 +    rte.dest_mode     = INT_DEST_MODE;
   19.32  
   19.33      if ( rte.vector >= FIRST_DEVICE_VECTOR )
   19.34      {
    20.1 --- a/xen/arch/x86/mm.c	Tue Aug 23 17:32:44 2005 +0000
    20.2 +++ b/xen/arch/x86/mm.c	Tue Aug 23 17:33:11 2005 +0000
    20.3 @@ -444,7 +444,7 @@ get_page_from_l1e(
    20.4  
    20.5      if ( unlikely(l1e_get_flags(l1e) & L1_DISALLOW_MASK) )
    20.6      {
    20.7 -        MEM_LOG("Bad L1 flags %x\n", l1e_get_flags(l1e) & L1_DISALLOW_MASK);
    20.8 +        MEM_LOG("Bad L1 flags %x", l1e_get_flags(l1e) & L1_DISALLOW_MASK);
    20.9          return 0;
   20.10      }
   20.11  
   20.12 @@ -490,7 +490,7 @@ get_page_from_l2e(
   20.13  
   20.14      if ( unlikely((l2e_get_flags(l2e) & L2_DISALLOW_MASK)) )
   20.15      {
   20.16 -        MEM_LOG("Bad L2 flags %x\n", l2e_get_flags(l2e) & L2_DISALLOW_MASK);
   20.17 +        MEM_LOG("Bad L2 flags %x", l2e_get_flags(l2e) & L2_DISALLOW_MASK);
   20.18          return 0;
   20.19      }
   20.20  
   20.21 @@ -523,7 +523,7 @@ get_page_from_l3e(
   20.22  
   20.23      if ( unlikely((l3e_get_flags(l3e) & L3_DISALLOW_MASK)) )
   20.24      {
   20.25 -        MEM_LOG("Bad L3 flags %x\n", l3e_get_flags(l3e) & L3_DISALLOW_MASK);
   20.26 +        MEM_LOG("Bad L3 flags %x", l3e_get_flags(l3e) & L3_DISALLOW_MASK);
   20.27          return 0;
   20.28      }
   20.29  
   20.30 @@ -557,7 +557,7 @@ get_page_from_l4e(
   20.31  
   20.32      if ( unlikely((l4e_get_flags(l4e) & L4_DISALLOW_MASK)) )
   20.33      {
   20.34 -        MEM_LOG("Bad L4 flags %x\n", l4e_get_flags(l4e) & L4_DISALLOW_MASK);
   20.35 +        MEM_LOG("Bad L4 flags %x", l4e_get_flags(l4e) & L4_DISALLOW_MASK);
   20.36          return 0;
   20.37      }
   20.38  
   20.39 @@ -1025,7 +1025,7 @@ static inline int update_l1e(l1_pgentry_
   20.40           unlikely(o != l1e_get_intpte(ol1e)) )
   20.41      {
   20.42          MEM_LOG("Failed to update %" PRIpte " -> %" PRIpte
   20.43 -                ": saw %" PRIpte "\n",
   20.44 +                ": saw %" PRIpte,
   20.45                  l1e_get_intpte(ol1e),
   20.46                  l1e_get_intpte(nl1e),
   20.47                  o);
   20.48 @@ -1051,7 +1051,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
   20.49      {
   20.50          if ( unlikely(l1e_get_flags(nl1e) & L1_DISALLOW_MASK) )
   20.51          {
   20.52 -            MEM_LOG("Bad L1 flags %x\n",
   20.53 +            MEM_LOG("Bad L1 flags %x",
   20.54                      l1e_get_flags(nl1e) & L1_DISALLOW_MASK);
   20.55              return 0;
   20.56          }
   20.57 @@ -1113,7 +1113,7 @@ static int mod_l2_entry(l2_pgentry_t *pl
   20.58      {
   20.59          if ( unlikely(l2e_get_flags(nl2e) & L2_DISALLOW_MASK) )
   20.60          {
   20.61 -            MEM_LOG("Bad L2 flags %x\n",
   20.62 +            MEM_LOG("Bad L2 flags %x",
   20.63                      l2e_get_flags(nl2e) & L2_DISALLOW_MASK);
   20.64              return 0;
   20.65          }
   20.66 @@ -1175,7 +1175,7 @@ static int mod_l3_entry(l3_pgentry_t *pl
   20.67      {
   20.68          if ( unlikely(l3e_get_flags(nl3e) & L3_DISALLOW_MASK) )
   20.69          {
   20.70 -            MEM_LOG("Bad L3 flags %x\n",
   20.71 +            MEM_LOG("Bad L3 flags %x",
   20.72                      l3e_get_flags(nl3e) & L3_DISALLOW_MASK);
   20.73              return 0;
   20.74          }
   20.75 @@ -1237,7 +1237,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
   20.76      {
   20.77          if ( unlikely(l4e_get_flags(nl4e) & L4_DISALLOW_MASK) )
   20.78          {
   20.79 -            MEM_LOG("Bad L4 flags %x\n",
   20.80 +            MEM_LOG("Bad L4 flags %x",
   20.81                      l4e_get_flags(nl4e) & L4_DISALLOW_MASK);
   20.82              return 0;
   20.83          }
   20.84 @@ -1598,7 +1598,7 @@ static int set_foreigndom(unsigned int c
   20.85              percpu_info[cpu].foreign = dom_io;
   20.86              break;
   20.87          default:
   20.88 -            MEM_LOG("Dom %u cannot set foreign dom\n", d->domain_id);
   20.89 +            MEM_LOG("Dom %u cannot set foreign dom", d->domain_id);
   20.90              okay = 0;
   20.91              break;
   20.92          }
   20.93 @@ -1831,7 +1831,7 @@ int do_mmuext_op(
   20.94          case MMUEXT_FLUSH_CACHE:
   20.95              if ( unlikely(!IS_CAPABLE_PHYSDEV(d)) )
   20.96              {
   20.97 -                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.\n");
   20.98 +                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.");
   20.99                  okay = 0;
  20.100              }
  20.101              else
  20.102 @@ -1845,7 +1845,7 @@ int do_mmuext_op(
  20.103              if ( shadow_mode_external(d) )
  20.104              {
  20.105                  MEM_LOG("ignoring SET_LDT hypercall from external "
  20.106 -                        "domain %u\n", d->domain_id);
  20.107 +                        "domain %u", d->domain_id);
  20.108                  okay = 0;
  20.109                  break;
  20.110              }
  20.111 @@ -1916,7 +1916,7 @@ int do_mmuext_op(
  20.112                   unlikely(IS_XEN_HEAP_FRAME(page)) )
  20.113              {
  20.114                  MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
  20.115 -                        "page is in Xen heap (%lx), or dom is dying (%ld).\n",
  20.116 +                        "page is in Xen heap (%lx), or dom is dying (%ld).",
  20.117                          e->tot_pages, e->max_pages, op.mfn, e->domain_flags);
  20.118                  okay = 0;
  20.119                  goto reassign_fail;
  20.120 @@ -1937,7 +1937,7 @@ int do_mmuext_op(
  20.121                       unlikely(_nd != _d) )
  20.122                  {
  20.123                      MEM_LOG("Bad page values %lx: ed=%p(%u), sd=%p,"
  20.124 -                            " caf=%08x, taf=%" PRtype_info "\n",
  20.125 +                            " caf=%08x, taf=%" PRtype_info,
  20.126                              page_to_pfn(page), d, d->domain_id,
  20.127                              unpickle_domptr(_nd), x, page->u.inuse.type_info);
  20.128                      okay = 0;
  20.129 @@ -2301,7 +2301,7 @@ int update_grant_pte_mapping(
  20.130      if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||
  20.131           !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
  20.132      {
  20.133 -        DPRINTK("Grant map attempted to update a non-L1 page\n");
  20.134 +        MEM_LOG("Grant map attempted to update a non-L1 page");
  20.135          rc = GNTST_general_error;
  20.136          goto failed;
  20.137      }
  20.138 @@ -2363,7 +2363,7 @@ int clear_grant_pte_mapping(
  20.139      if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||
  20.140           !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
  20.141      {
  20.142 -        DPRINTK("Grant map attempted to update a non-L1 page\n");
  20.143 +        MEM_LOG("Grant map attempted to update a non-L1 page");
  20.144          rc = GNTST_general_error;
  20.145          goto failed;
  20.146      }
  20.147 @@ -2378,7 +2378,7 @@ int clear_grant_pte_mapping(
  20.148      /* Check that the virtual address supplied is actually mapped to frame. */
  20.149      if ( unlikely((l1e_get_intpte(ol1e) >> PAGE_SHIFT) != frame) )
  20.150      {
  20.151 -        DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
  20.152 +        MEM_LOG("PTE entry %lx for address %lx doesn't match frame %lx",
  20.153                  (unsigned long)l1e_get_intpte(ol1e), addr, frame);
  20.154          put_page_type(page);
  20.155          rc = GNTST_general_error;
  20.156 @@ -2388,7 +2388,7 @@ int clear_grant_pte_mapping(
  20.157      /* Delete pagetable entry. */
  20.158      if ( unlikely(__put_user(0, (intpte_t *)va)))
  20.159      {
  20.160 -        DPRINTK("Cannot delete PTE entry at %p.\n", va);
  20.161 +        MEM_LOG("Cannot delete PTE entry at %p", va);
  20.162          put_page_type(page);
  20.163          rc = GNTST_general_error;
  20.164          goto failed;
  20.165 @@ -2452,7 +2452,7 @@ int clear_grant_va_mapping(unsigned long
  20.166  
  20.167      if ( unlikely(__get_user(ol1e.l1, &pl1e->l1) != 0) )
  20.168      {
  20.169 -        DPRINTK("Could not find PTE entry for address %lx\n", addr);
  20.170 +        MEM_LOG("Could not find PTE entry for address %lx", addr);
  20.171          return GNTST_general_error;
  20.172      }
  20.173  
  20.174 @@ -2462,7 +2462,7 @@ int clear_grant_va_mapping(unsigned long
  20.175       */
  20.176      if ( unlikely(l1e_get_pfn(ol1e) != frame) )
  20.177      {
  20.178 -        DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
  20.179 +        MEM_LOG("PTE entry %lx for address %lx doesn't match frame %lx",
  20.180                  l1e_get_pfn(ol1e), addr, frame);
  20.181          return GNTST_general_error;
  20.182      }
  20.183 @@ -2470,7 +2470,7 @@ int clear_grant_va_mapping(unsigned long
  20.184      /* Delete pagetable entry. */
  20.185      if ( unlikely(__put_user(0, &pl1e->l1)) )
  20.186      {
  20.187 -        DPRINTK("Cannot delete PTE entry at %p.\n", (unsigned long *)pl1e);
  20.188 +        MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
  20.189          return GNTST_general_error;
  20.190      }
  20.191      
  20.192 @@ -2930,7 +2930,7 @@ int revalidate_l1(
  20.193  
  20.194          if ( unlikely(!get_page_from_l1e(nl1e, d)) )
  20.195          {
  20.196 -            MEM_LOG("ptwr: Could not re-validate l1 page\n");
  20.197 +            MEM_LOG("ptwr: Could not re-validate l1 page");
  20.198              /*
  20.199               * Make the remaining p.t's consistent before crashing, so the
  20.200               * reference counts are correct.
  20.201 @@ -3056,7 +3056,7 @@ static int ptwr_emulated_update(
  20.202      /* Aligned access only, thank you. */
  20.203      if ( !access_ok(addr, bytes) || ((addr & (bytes-1)) != 0) )
  20.204      {
  20.205 -        MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %lx)\n",
  20.206 +        MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %lx)",
  20.207                  bytes, addr);
  20.208          return X86EMUL_UNHANDLEABLE;
  20.209      }
  20.210 @@ -3089,7 +3089,7 @@ static int ptwr_emulated_update(
  20.211      if (__copy_from_user(&pte, &linear_pg_table[l1_linear_offset(addr)],
  20.212                           sizeof(pte)))
  20.213      {
  20.214 -        MEM_LOG("ptwr_emulate: Cannot read thru linear_pg_table\n");
  20.215 +        MEM_LOG("ptwr_emulate: Cannot read thru linear_pg_table");
  20.216          return X86EMUL_UNHANDLEABLE;
  20.217      }
  20.218  
  20.219 @@ -3102,7 +3102,7 @@ static int ptwr_emulated_update(
  20.220           (page_get_owner(page) != d) )
  20.221      {
  20.222          MEM_LOG("ptwr_emulate: Page is mistyped or bad pte "
  20.223 -                "(%lx, %" PRtype_info ")\n",
  20.224 +                "(%lx, %" PRtype_info ")",
  20.225                  l1e_get_pfn(pte), page->u.inuse.type_info);
  20.226          return X86EMUL_UNHANDLEABLE;
  20.227      }
    21.1 --- a/xen/arch/x86/vmx.c	Tue Aug 23 17:32:44 2005 +0000
    21.2 +++ b/xen/arch/x86/vmx.c	Tue Aug 23 17:33:11 2005 +0000
    21.3 @@ -1712,9 +1712,6 @@ asmlinkage void vmx_vmexit_handler(struc
    21.4      default:
    21.5          __vmx_bug(&regs);       /* should not happen */
    21.6      }
    21.7 -
    21.8 -    vmx_intr_assist(v);
    21.9 -    return;
   21.10  }
   21.11  
   21.12  asmlinkage void load_cr2(void)
    22.1 --- a/xen/arch/x86/vmx_io.c	Tue Aug 23 17:32:44 2005 +0000
    22.2 +++ b/xen/arch/x86/vmx_io.c	Tue Aug 23 17:33:11 2005 +0000
    22.3 @@ -631,12 +631,14 @@ static inline int irq_masked(unsigned lo
    22.4      return ((eflags & X86_EFLAGS_IF) == 0);
    22.5  }
    22.6  
    22.7 -void vmx_intr_assist(struct vcpu *v) 
    22.8 +asmlinkage void vmx_intr_assist(void) 
    22.9  {
   22.10      int intr_type = 0;
   22.11 -    int highest_vector = find_highest_pending_irq(v, &intr_type);
   22.12 +    int highest_vector;
   22.13      unsigned long intr_fields, eflags, interruptibility, cpu_exec_control;
   22.14 +    struct vcpu *v = current;
   22.15  
   22.16 +    highest_vector = find_highest_pending_irq(v, &intr_type);
   22.17      __vmread(CPU_BASED_VM_EXEC_CONTROL, &cpu_exec_control);
   22.18  
   22.19      if (highest_vector == -1) {
   22.20 @@ -712,9 +714,6 @@ void vmx_do_resume(struct vcpu *d)
   22.21  
   22.22      /* We can't resume the guest if we're waiting on I/O */
   22.23      ASSERT(!test_bit(ARCH_VMX_IO_WAIT, &d->arch.arch_vmx.flags));
   22.24 -
   22.25 -    /* We always check for interrupts before resuming guest */
   22.26 -    vmx_intr_assist(d);
   22.27  }
   22.28  
   22.29  #endif /* CONFIG_VMX */
    23.1 --- a/xen/arch/x86/x86_32/entry.S	Tue Aug 23 17:32:44 2005 +0000
    23.2 +++ b/xen/arch/x86/x86_32/entry.S	Tue Aug 23 17:33:11 2005 +0000
    23.3 @@ -140,6 +140,7 @@ 1:
    23.4          jnz 2f
    23.5  
    23.6  /* vmx_restore_all_guest */
    23.7 +        call vmx_intr_assist
    23.8          call load_cr2
    23.9          .endif
   23.10          VMX_RESTORE_ALL_NOSEGREGS
    24.1 --- a/xen/arch/x86/x86_32/traps.c	Tue Aug 23 17:32:44 2005 +0000
    24.2 +++ b/xen/arch/x86/x86_32/traps.c	Tue Aug 23 17:33:11 2005 +0000
    24.3 @@ -1,5 +1,6 @@
    24.4  
    24.5  #include <xen/config.h>
    24.6 +#include <xen/domain_page.h>
    24.7  #include <xen/init.h>
    24.8  #include <xen/sched.h>
    24.9  #include <xen/lib.h>
   24.10 @@ -86,24 +87,33 @@ void show_registers(struct cpu_user_regs
   24.11  
   24.12  void show_page_walk(unsigned long addr)
   24.13  {
   24.14 -    l2_pgentry_t pmd;
   24.15 -    l1_pgentry_t *pte;
   24.16 -
   24.17 -    if ( addr < PAGE_OFFSET )
   24.18 -        return;
   24.19 +    unsigned long pfn = read_cr3() >> PAGE_SHIFT;
   24.20 +    intpte_t *ptab, ent;
   24.21  
   24.22      printk("Pagetable walk from %08lx:\n", addr);
   24.23 -    
   24.24 -    pmd = idle_pg_table_l2[l2_linear_offset(addr)];
   24.25 -    printk(" L2 = %"PRIpte" %s\n", l2e_get_intpte(pmd),
   24.26 -           (l2e_get_flags(pmd) & _PAGE_PSE) ? "(2/4MB)" : "");
   24.27 -    if ( !(l2e_get_flags(pmd) & _PAGE_PRESENT) ||
   24.28 -         (l2e_get_flags(pmd) & _PAGE_PSE) )
   24.29 +
   24.30 +#ifdef CONFIG_X86_PAE
   24.31 +    ptab = map_domain_page(pfn);
   24.32 +    ent = ptab[l3_table_offset(addr)];
   24.33 +    printk(" L3 = %"PRIpte"\n", ent);
   24.34 +    unmap_domain_page(ptab);
   24.35 +    if ( !(ent & _PAGE_PRESENT) )
   24.36          return;
   24.37 +    pfn = ent >> PAGE_SHIFT;
   24.38 +#endif
   24.39  
   24.40 -    pte  = __va(l2e_get_paddr(pmd));
   24.41 -    pte += l1_table_offset(addr);
   24.42 -    printk("  L1 = %"PRIpte"\n", l1e_get_intpte(*pte));
   24.43 +    ptab = map_domain_page(pfn);
   24.44 +    ent = ptab[l2_table_offset(addr)];
   24.45 +    printk("  L2 = %"PRIpte" %s\n", ent, (ent & _PAGE_PSE) ? "(PSE)" : "");
   24.46 +    unmap_domain_page(ptab);
   24.47 +    if ( !(ent & _PAGE_PRESENT) || (ent & _PAGE_PSE) )
   24.48 +        return;
   24.49 +    pfn = ent >> PAGE_SHIFT;
   24.50 +
   24.51 +    ptab = map_domain_page(ent >> PAGE_SHIFT);
   24.52 +    ent = ptab[l2_table_offset(addr)];
   24.53 +    printk("   L1 = %"PRIpte"\n", ent);
   24.54 +    unmap_domain_page(ptab);
   24.55  }
   24.56  
   24.57  #define DOUBLEFAULT_STACK_SIZE 1024
    25.1 --- a/xen/arch/x86/x86_64/entry.S	Tue Aug 23 17:32:44 2005 +0000
    25.2 +++ b/xen/arch/x86/x86_64/entry.S	Tue Aug 23 17:33:11 2005 +0000
    25.3 @@ -233,6 +233,7 @@ 1:
    25.4          jnz  2f 
    25.5  
    25.6  /* vmx_restore_all_guest */
    25.7 +        call vmx_intr_assist
    25.8          call load_cr2
    25.9          .endif
   25.10          /* 
    26.1 --- a/xen/include/asm-x86/vmx.h	Tue Aug 23 17:32:44 2005 +0000
    26.2 +++ b/xen/include/asm-x86/vmx.h	Tue Aug 23 17:33:11 2005 +0000
    26.3 @@ -31,7 +31,7 @@
    26.4  extern void vmx_asm_vmexit_handler(struct cpu_user_regs);
    26.5  extern void vmx_asm_do_resume(void);
    26.6  extern void vmx_asm_do_launch(void);
    26.7 -extern void vmx_intr_assist(struct vcpu *d);
    26.8 +extern void vmx_intr_assist(void);
    26.9  
   26.10  extern void arch_vmx_do_launch(struct vcpu *);
   26.11  extern void arch_vmx_do_resume(struct vcpu *);
   26.12 @@ -355,7 +355,7 @@ static inline int __vmxon (u64 addr)
   26.13  }
   26.14  
   26.15  /* Make sure that xen intercepts any FP accesses from current */
   26.16 -static inline void vmx_stts()
   26.17 +static inline void vmx_stts(void)
   26.18  {
   26.19      unsigned long cr0;
   26.20