ia64/xen-unstable

changeset 6560:287d36b46fa3

Merge.
author adsharma@los-vmm.sc.intel.com
date Tue Aug 30 13:36:49 2005 -0700 (2005-08-30)
parents ae390c2b9d4c 551870a55f24
children 38312fe7ec38
files .hgignore Config.mk Makefile buildconfigs/Rules.mk buildconfigs/mk.linux-2.6-xen buildconfigs/mk.linux-2.6-xen0 buildconfigs/mk.linux-2.6-xenU docs/src/user.tex extras/mini-os/include/hypervisor.h extras/mini-os/include/lib.h extras/mini-os/include/mm.h extras/mini-os/include/time.h extras/mini-os/include/types.h extras/mini-os/include/xmalloc.h extras/mini-os/kernel.c extras/mini-os/lib/xmalloc.c extras/mini-os/mm.c extras/mini-os/time.c linux-2.4-xen-sparse/Makefile linux-2.4-xen-sparse/arch/xen/Makefile linux-2.4-xen-sparse/arch/xen/boot/Makefile linux-2.4-xen-sparse/arch/xen/config.in linux-2.4-xen-sparse/arch/xen/defconfig-xen0 linux-2.4-xen-sparse/arch/xen/defconfig-xenU linux-2.4-xen-sparse/arch/xen/drivers/balloon/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/backend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/common.h linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c linux-2.4-xen-sparse/arch/xen/drivers/console/Makefile linux-2.4-xen-sparse/arch/xen/drivers/dom0/Makefile linux-2.4-xen-sparse/arch/xen/drivers/evtchn/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/backend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/frontend/Makefile linux-2.4-xen-sparse/arch/xen/kernel/Makefile linux-2.4-xen-sparse/arch/xen/kernel/entry.S linux-2.4-xen-sparse/arch/xen/kernel/head.S linux-2.4-xen-sparse/arch/xen/kernel/i386_ksyms.c linux-2.4-xen-sparse/arch/xen/kernel/irq.c linux-2.4-xen-sparse/arch/xen/kernel/ldt.c linux-2.4-xen-sparse/arch/xen/kernel/pci-pc.c linux-2.4-xen-sparse/arch/xen/kernel/process.c linux-2.4-xen-sparse/arch/xen/kernel/setup.c linux-2.4-xen-sparse/arch/xen/kernel/signal.c linux-2.4-xen-sparse/arch/xen/kernel/time.c linux-2.4-xen-sparse/arch/xen/kernel/traps.c linux-2.4-xen-sparse/arch/xen/lib/Makefile linux-2.4-xen-sparse/arch/xen/lib/delay.c linux-2.4-xen-sparse/arch/xen/mm/Makefile linux-2.4-xen-sparse/arch/xen/mm/fault.c linux-2.4-xen-sparse/arch/xen/mm/init.c linux-2.4-xen-sparse/arch/xen/mm/ioremap.c linux-2.4-xen-sparse/arch/xen/vmlinux.lds linux-2.4-xen-sparse/drivers/block/ll_rw_blk.c linux-2.4-xen-sparse/drivers/char/Makefile linux-2.4-xen-sparse/drivers/char/mem.c linux-2.4-xen-sparse/drivers/char/tty_io.c linux-2.4-xen-sparse/drivers/scsi/aic7xxx/Makefile linux-2.4-xen-sparse/include/asm-xen/bugs.h linux-2.4-xen-sparse/include/asm-xen/desc.h linux-2.4-xen-sparse/include/asm-xen/fixmap.h linux-2.4-xen-sparse/include/asm-xen/highmem.h linux-2.4-xen-sparse/include/asm-xen/hw_irq.h linux-2.4-xen-sparse/include/asm-xen/io.h linux-2.4-xen-sparse/include/asm-xen/irq.h linux-2.4-xen-sparse/include/asm-xen/keyboard.h linux-2.4-xen-sparse/include/asm-xen/mmu_context.h linux-2.4-xen-sparse/include/asm-xen/module.h linux-2.4-xen-sparse/include/asm-xen/page.h linux-2.4-xen-sparse/include/asm-xen/pci.h linux-2.4-xen-sparse/include/asm-xen/pgalloc.h linux-2.4-xen-sparse/include/asm-xen/pgtable-2level.h linux-2.4-xen-sparse/include/asm-xen/pgtable.h linux-2.4-xen-sparse/include/asm-xen/processor.h linux-2.4-xen-sparse/include/asm-xen/queues.h linux-2.4-xen-sparse/include/asm-xen/segment.h linux-2.4-xen-sparse/include/asm-xen/smp.h linux-2.4-xen-sparse/include/asm-xen/system.h linux-2.4-xen-sparse/include/asm-xen/vga.h linux-2.4-xen-sparse/include/asm-xen/xor.h linux-2.4-xen-sparse/include/linux/blk.h linux-2.4-xen-sparse/include/linux/highmem.h linux-2.4-xen-sparse/include/linux/irq.h linux-2.4-xen-sparse/include/linux/mm.h linux-2.4-xen-sparse/include/linux/sched.h linux-2.4-xen-sparse/include/linux/skbuff.h linux-2.4-xen-sparse/include/linux/timer.h linux-2.4-xen-sparse/kernel/time.c linux-2.4-xen-sparse/kernel/timer.c linux-2.4-xen-sparse/mkbuildtree linux-2.4-xen-sparse/mm/highmem.c linux-2.4-xen-sparse/mm/memory.c linux-2.4-xen-sparse/mm/mprotect.c linux-2.4-xen-sparse/mm/mremap.c linux-2.4-xen-sparse/mm/page_alloc.c linux-2.4-xen-sparse/net/core/skbuff.c linux-2.6-xen-sparse/arch/xen/Kconfig linux-2.6-xen-sparse/arch/xen/Kconfig.drivers linux-2.6-xen-sparse/arch/xen/Makefile linux-2.6-xen-sparse/arch/xen/boot/Makefile 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/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/acpi/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/acpi/boot.c linux-2.6-xen-sparse/arch/xen/i386/kernel/apic.c linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S 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/init_task.c linux-2.6-xen-sparse/arch/xen/i386/kernel/io_apic.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/i386/kernel/irq.c linux-2.6-xen-sparse/arch/xen/i386/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/i386/kernel/microcode.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/signal.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/swiotlb.c linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6-xen-sparse/arch/xen/i386/kernel/traps.c linux-2.6-xen-sparse/arch/xen/i386/kernel/vsyscall.S linux-2.6-xen-sparse/arch/xen/i386/mach-default/Makefile linux-2.6-xen-sparse/arch/xen/i386/mm/Makefile 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/i386/pci/irq.c linux-2.6-xen-sparse/arch/xen/kernel/Makefile linux-2.6-xen-sparse/arch/xen/kernel/ctrl_if.c linux-2.6-xen-sparse/arch/xen/kernel/devmem.c linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6-xen-sparse/arch/xen/kernel/fixup.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/kernel/smp.c linux-2.6-xen-sparse/arch/xen/kernel/xen_proc.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/ia32/ia32entry.S linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c linux-2.6-xen-sparse/arch/xen/x86_64/ia32/vsyscall-int80.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/kernel/acpi/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/early_printk.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/entry.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/genapic_xen.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/io_apic.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ioport.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/irq.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/ldt.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/mpparse.c 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/signal.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smp.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/smpboot.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/traps.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/vsyscall.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/x8664_ksyms.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S 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/mm/pageattr.c linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile linux-2.6-xen-sparse/arch/xen/x86_64/pci/Makefile-BUS linux-2.6-xen-sparse/drivers/Makefile linux-2.6-xen-sparse/drivers/acpi/tables.c linux-2.6-xen-sparse/drivers/char/mem.c linux-2.6-xen-sparse/drivers/char/tty_io.c linux-2.6-xen-sparse/drivers/xen/Makefile linux-2.6-xen-sparse/drivers/xen/balloon/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/Kconfig linux-2.6-xen-sparse/drivers/xen/blkfront/Makefile 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/Makefile 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_datapath.c linux-2.6-xen-sparse/drivers/xen/blktap/blktap_userdev.c linux-2.6-xen-sparse/drivers/xen/console/Makefile linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.h linux-2.6-xen-sparse/drivers/xen/evtchn/Makefile linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c linux-2.6-xen-sparse/drivers/xen/netback/Makefile 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/loopback.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netback/xenbus.c linux-2.6-xen-sparse/drivers/xen/netfront/Kconfig linux-2.6-xen-sparse/drivers/xen/netfront/Makefile linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/privcmd/Makefile linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/usbback/common.h linux-2.6-xen-sparse/drivers/xen/usbback/control.c linux-2.6-xen-sparse/drivers/xen/usbback/interface.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/usbfront/xhci.h linux-2.6-xen-sparse/drivers/xen/xenbus/Makefile 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-generic/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/agp.h 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/floppy.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/highmem.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/hw_irq.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/kmap_types.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/irq_vectors.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/mmu.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/param.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-i386/processor.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/ptrace.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/scatterlist.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/segment.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/spinlock.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/swiotlb.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/synch_bitops.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/tlbflush.h linux-2.6-xen-sparse/include/asm-xen/asm-i386/vga.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/arch_hooks.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/bootsetup.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/fixmap.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/floppy.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hw_irq.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/io.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/irq.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/io_ports.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/irq_vectors.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/mach_timer.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/setup_arch_post.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/setup_arch_pre.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/mmu_context.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/param.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/pgalloc.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/processor.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/ptrace.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/segment.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/smp.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/timer.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/tlbflush.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/vga.h linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/xor.h linux-2.6-xen-sparse/include/asm-xen/balloon.h linux-2.6-xen-sparse/include/asm-xen/ctrl_if.h linux-2.6-xen-sparse/include/asm-xen/evtchn.h linux-2.6-xen-sparse/include/asm-xen/foreign_page.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/linux-public/privcmd.h linux-2.6-xen-sparse/include/asm-xen/linux-public/suspend.h linux-2.6-xen-sparse/include/asm-xen/queues.h linux-2.6-xen-sparse/include/asm-xen/synch_bitops.h linux-2.6-xen-sparse/include/asm-xen/xen_proc.h linux-2.6-xen-sparse/include/asm-xen/xenbus.h linux-2.6-xen-sparse/include/linux/gfp.h linux-2.6-xen-sparse/include/linux/highmem.h linux-2.6-xen-sparse/include/linux/irq.h linux-2.6-xen-sparse/include/linux/mm.h linux-2.6-xen-sparse/include/linux/skbuff.h linux-2.6-xen-sparse/kernel/irq/manage.c linux-2.6-xen-sparse/mkbuildtree linux-2.6-xen-sparse/mm/highmem.c linux-2.6-xen-sparse/mm/memory.c linux-2.6-xen-sparse/mm/mmap.c linux-2.6-xen-sparse/mm/page_alloc.c linux-2.6-xen-sparse/net/core/dev.c linux-2.6-xen-sparse/net/core/skbuff.c patches/linux-2.6.12/i386-cpu-hotplug-updated-for-mm.patch patches/linux-2.6.12/net-csum.patch patches/linux-2.6.12/patch-2.6.12.5 patches/linux-2.6.12/rcu-nohz.patch patches/linux-2.6.12/smp-alts.patch tools/Makefile tools/Rules.mk tools/blktap/blktaplib.c tools/blktap/blktaplib.h tools/blktap/parallax/Makefile tools/blktap/parallax/block-async.h tools/blktap/parallax/blockstore.h tools/console/Makefile tools/console/client/main.c tools/console/daemon/io.c tools/console/daemon/io.h tools/console/daemon/main.c tools/console/daemon/utils.c tools/console/daemon/utils.h tools/console/testsuite/Makefile tools/console/testsuite/README tools/console/testsuite/console-dom0.c tools/console/testsuite/console-domU.c tools/console/testsuite/procpipe.c tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c tools/debugger/gdb/gdbbuild tools/debugger/libxendebug/Makefile 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/Util.ml tools/debugger/pdb/Xen_domain.ml tools/debugger/pdb/Xen_domain.mli tools/debugger/pdb/debugger.ml tools/debugger/pdb/linux-2.6-module/Makefile 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/Makefile tools/debugger/pdb/linux-2.6-patches/i386_ksyms.patch tools/debugger/pdb/linux-2.6-patches/kdebug.patch tools/debugger/pdb/linux-2.6-patches/makefile.patch tools/debugger/pdb/linux-2.6-patches/ptrace.patch tools/debugger/pdb/linux-2.6-patches/traps.patch tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_evtchn.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xc.c tools/debugger/pdb/pdb_caml_xcs.c tools/debugger/pdb/pdb_caml_xen.h tools/debugger/pdb/pdb_xen.c tools/debugger/pdb/readme tools/debugger/pdb/server.ml tools/examples/Makefile tools/examples/README tools/examples/backend.hotplug tools/examples/network-bridge tools/examples/vif-bridge tools/examples/xend-config.sxp tools/examples/xmexample.vmx tools/firmware/acpi/acpi2_0.h tools/firmware/rombios/rombios.c tools/firmware/vmxassist/vm86.c tools/ioemu/cpu-all.h tools/ioemu/exec.c tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/hw/ide.c tools/ioemu/hw/ioapic.h tools/ioemu/hw/pc.c tools/ioemu/hw/pckbd.c tools/ioemu/hw/vga.c tools/ioemu/monitor.c tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/helper2.c tools/ioemu/target-i386-dm/qemu-dm.debug tools/ioemu/vl.c tools/ioemu/vl.h tools/ioemu/vnc.c tools/libxc/Makefile tools/libxc/linux_boot_params.h tools/libxc/xc_core.c tools/libxc/xc_domain.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_aout9.c tools/libxc/xc_load_bin.c tools/libxc/xc_load_elf.c tools/libxc/xc_private.c tools/libxc/xc_private.h tools/libxc/xc_ptrace.c tools/libxc/xc_vmx_build.c tools/libxc/xenctrl.h tools/libxc/xenguest.h tools/libxc/xg_private.c tools/libxc/xg_private.h tools/misc/Makefile tools/misc/cpuperf/Makefile tools/misc/cpuperf/cpuperf.c tools/misc/cpuperf/cpuperf_xeno.h tools/misc/mbootpack/Makefile tools/misc/mbootpack/buildimage.c tools/misc/mbootpack/mbootpack.c tools/misc/mbootpack/mbootpack.h tools/misc/xc_shadow.c tools/misc/xend tools/misc/xenperf.c tools/python/setup.py tools/python/xen/lowlevel/xc/xc.c tools/python/xen/lowlevel/xs/xs.c tools/python/xen/lowlevel/xu/xu.c tools/python/xen/sv/CreateDomain.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/GenTabbed.py tools/python/xen/sv/HTMLBase.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/RestoreDomain.py tools/python/xen/sv/Wizard.py tools/python/xen/sv/__init__.py tools/python/xen/sv/util.py tools/python/xen/util/Brctl.py tools/python/xen/web/SrvBase.py tools/python/xen/web/SrvDir.py tools/python/xen/web/__init__.py tools/python/xen/web/connection.py tools/python/xen/web/httpserver.py tools/python/xen/web/protocol.py tools/python/xen/web/reactor.py tools/python/xen/web/resource.py tools/python/xen/web/static.py tools/python/xen/web/tcp.py tools/python/xen/web/unix.py tools/python/xen/xend/Args.py tools/python/xen/xend/EventServer.py tools/python/xen/xend/PrettyPrint.py tools/python/xen/xend/Vifctl.py tools/python/xen/xend/XendCheckpoint.py tools/python/xen/xend/XendClient.py tools/python/xen/xend/XendDB.py tools/python/xen/xend/XendDmesg.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/XendError.py tools/python/xen/xend/XendLogging.py tools/python/xen/xend/XendNode.py tools/python/xen/xend/XendProtocol.py tools/python/xen/xend/XendRoot.py tools/python/xen/xend/XendVnet.py tools/python/xen/xend/encode.py tools/python/xen/xend/image.py tools/python/xen/xend/scheduler.py tools/python/xen/xend/server/SrvDaemon.py tools/python/xen/xend/server/SrvDmesg.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xend/server/SrvDomainDir.py tools/python/xen/xend/server/SrvNode.py tools/python/xen/xend/server/SrvRoot.py tools/python/xen/xend/server/SrvServer.py tools/python/xen/xend/server/SrvVnetDir.py tools/python/xen/xend/server/SrvXendLog.py tools/python/xen/xend/server/blkif.py tools/python/xen/xend/server/channel.py tools/python/xen/xend/server/controller.py tools/python/xen/xend/server/event.py tools/python/xen/xend/server/messages.py tools/python/xen/xend/server/netif.py tools/python/xen/xend/server/params.py tools/python/xen/xend/server/pciif.py tools/python/xen/xend/server/relocate.py tools/python/xen/xend/sxp.py tools/python/xen/xend/uuid.py tools/python/xen/xend/xenstore/__init__.py tools/python/xen/xend/xenstore/xsnode.py tools/python/xen/xend/xenstore/xsobj.py tools/python/xen/xend/xenstore/xsresource.py tools/python/xen/xm/create.py tools/python/xen/xm/destroy.py tools/python/xen/xm/help.py tools/python/xen/xm/main.py tools/python/xen/xm/migrate.py tools/python/xen/xm/opts.py tools/python/xen/xm/shutdown.py tools/python/xen/xm/sysrq.py tools/security/Makefile tools/security/example.txt tools/security/install.txt tools/security/policies/chwall/chwall-security_label_template.xml tools/security/policies/chwall/chwall-security_policy.xml tools/security/policies/chwall_ste/chwall_ste-security_label_template.xml tools/security/policies/chwall_ste/chwall_ste-security_policy.xml tools/security/policies/null/null-security_label_template.xml tools/security/policies/null/null-security_policy.xml tools/security/policies/security_policy.xsd tools/security/policies/ste/ste-security_label_template.xml tools/security/policies/ste/ste-security_policy.xml tools/security/policy.txt tools/security/readme.txt tools/security/secpol_compat.h tools/security/secpol_tool.c tools/security/secpol_xml2bin.c tools/security/secpol_xml2bin.h tools/security/setlabel.sh tools/security/updategrub.sh tools/sv/Makefile tools/sv/images/destroy.png tools/sv/images/finish.png tools/sv/images/next.png tools/sv/images/pause.png tools/sv/images/previous.png tools/sv/images/reboot.png tools/sv/images/shutdown.png tools/sv/images/small-destroy.png tools/sv/images/small-pause.png tools/sv/images/small-unpause.png tools/sv/images/unpause.png tools/sv/images/xen.png tools/sv/inc/script.js tools/sv/inc/style.css tools/sv/index.psp tools/vnet/00INSTALL tools/vnet/Makefile tools/vnet/doc/vnet-module.txt tools/vnet/doc/vnet-xend.txt tools/vnet/examples/Makefile tools/vnet/examples/network-vnet tools/vnet/examples/vnet97.sxp tools/vnet/examples/vnet98.sxp tools/vnet/examples/vnet99.sxp tools/vnet/libxutil/Makefile tools/vnet/libxutil/debug.h tools/vnet/libxutil/sxpr.c tools/vnet/libxutil/sxpr.h tools/vnet/libxutil/sxpr_parser.c tools/vnet/libxutil/sxpr_parser.h tools/vnet/libxutil/sys_string.c tools/vnet/libxutil/sys_string.h tools/vnet/vnet-module/00README tools/vnet/vnet-module/Makefile tools/vnet/vnet-module/Makefile-2.4 tools/vnet/vnet-module/Makefile-2.6 tools/vnet/vnet-module/Makefile.ver tools/vnet/vnet-module/Makefile.vnet tools/vnet/vnet-module/etherip.c tools/vnet/vnet-module/if_etherip.h tools/vnet/vnet-module/if_varp.h tools/vnet/vnet-module/skb_util.h tools/vnet/vnet-module/tunnel.c tools/vnet/vnet-module/tunnel.h tools/vnet/vnet-module/varp.c tools/vnet/vnet-module/varp.h tools/vnet/vnet-module/varp_socket.c tools/vnet/vnet-module/vif.c tools/vnet/vnet-module/vif.h tools/vnet/vnet-module/vnet.c tools/vnet/vnet-module/vnet.h tools/vnet/vnet-module/vnet_dev.c tools/vnet/vnet-module/vnet_dev.h tools/vnet/vnet-module/vnet_ioctl.c tools/vnet/vnetd/Makefile tools/vnet/vnetd/vcache.c tools/vnet/vnetd/vcache.h tools/vnet/vnetd/vnetd.c tools/vnet/vnetd/vnetd.h tools/xcs/Makefile tools/xcs/dump.h tools/xcs/xcs.h tools/xcs/xcsdump.c tools/xcutils/Makefile tools/xcutils/xc_restore.c tools/xcutils/xc_save.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/COPYING tools/xenstore/Makefile tools/xenstore/TODO tools/xenstore/testsuite/01simple.test tools/xenstore/testsuite/02directory.test tools/xenstore/testsuite/03write.test tools/xenstore/testsuite/04rm.test tools/xenstore/testsuite/05filepermissions.test tools/xenstore/testsuite/06dirpermissions.test tools/xenstore/testsuite/07watch.test tools/xenstore/testsuite/08transaction.slowtest tools/xenstore/testsuite/08transaction.test tools/xenstore/testsuite/09domain.test tools/xenstore/testsuite/10domain-homedir.test tools/xenstore/testsuite/11domain-watch.test tools/xenstore/testsuite/12readonly.test tools/xenstore/testsuite/13watch-ack.test tools/xenstore/testsuite/14complexperms.test tools/xenstore/testsuite/15nowait.test tools/xenstore/testsuite/test.sh tools/xenstore/testsuite/vg-suppressions tools/xenstore/utils.c tools/xenstore/utils.h tools/xenstore/xenstored.h tools/xenstore/xenstored_core.c tools/xenstore/xenstored_core.h tools/xenstore/xenstored_domain.c tools/xenstore/xenstored_domain.h tools/xenstore/xenstored_transaction.c tools/xenstore/xenstored_transaction.h tools/xenstore/xenstored_watch.c tools/xenstore/xenstored_watch.h tools/xenstore/xs.c tools/xenstore/xs.h tools/xenstore/xs_crashme.c tools/xenstore/xs_dom0_test.c tools/xenstore/xs_lib.c tools/xenstore/xs_lib.h tools/xenstore/xs_random.c tools/xenstore/xs_test.c tools/xentrace/Makefile tools/xentrace/formats tools/xentrace/xenctx.c tools/xentrace/xentrace.c xen/Makefile xen/Rules.mk xen/acm/acm_core.c xen/acm/acm_policy.c xen/arch/ia64/Makefile xen/arch/ia64/Rules.mk xen/arch/ia64/asm-offsets.c xen/arch/ia64/asm-xsi-offsets.c xen/arch/ia64/dom_fw.c xen/arch/ia64/domain.c xen/arch/ia64/grant_table.c xen/arch/ia64/hypercall.c xen/arch/ia64/hyperprivop.S xen/arch/ia64/ivt.S xen/arch/ia64/linux-xen/entry.S xen/arch/ia64/linux-xen/head.S xen/arch/ia64/linux-xen/irq_ia64.c xen/arch/ia64/linux-xen/setup.c xen/arch/ia64/linux/minstate.h xen/arch/ia64/mmio.c xen/arch/ia64/pal_emul.c xen/arch/ia64/pcdp.c xen/arch/ia64/process.c xen/arch/ia64/regionreg.c xen/arch/ia64/tools/mkbuildtree xen/arch/ia64/vcpu.c xen/arch/ia64/vlsapic.c xen/arch/ia64/vmmu.c xen/arch/ia64/vmx_hypercall.c xen/arch/ia64/vmx_init.c xen/arch/ia64/vmx_ivt.S xen/arch/ia64/vmx_phy_mode.c xen/arch/ia64/vmx_support.c xen/arch/ia64/vmx_vcpu.c xen/arch/ia64/vmx_virt.c xen/arch/ia64/vtlb.c xen/arch/ia64/xenasm.S xen/arch/ia64/xenirq.c xen/arch/ia64/xenmem.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/arch/ia64/xentime.c xen/arch/x86/Makefile xen/arch/x86/acpi/boot.c xen/arch/x86/apic.c xen/arch/x86/audit.c xen/arch/x86/cpu/amd.c xen/arch/x86/cpu/common.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/genapic/es7000plat.c xen/arch/x86/i8259.c xen/arch/x86/io_apic.c xen/arch/x86/mm.c xen/arch/x86/mpparse.c xen/arch/x86/physdev.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/shadow32.c xen/arch/x86/shadow_public.c xen/arch/x86/smpboot.c xen/arch/x86/time.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_platform.c xen/arch/x86/vmx_vmcs.c xen/arch/x86/x86_32/asm-offsets.c xen/arch/x86/x86_32/entry.S xen/arch/x86/x86_32/mm.c xen/arch/x86/x86_32/traps.c xen/arch/x86/x86_64/asm-offsets.c xen/arch/x86/x86_64/entry.S xen/arch/x86/x86_64/mm.c xen/arch/x86/x86_64/traps.c xen/common/Makefile xen/common/ac_timer.c xen/common/dom0_ops.c xen/common/domain.c xen/common/event_channel.c xen/common/grant_table.c xen/common/kernel.c xen/common/lib.c xen/common/memory.c xen/common/multicall.c xen/common/page_alloc.c xen/common/perfc.c xen/common/sched_sedf.c xen/common/schedule.c xen/common/symbols.c xen/common/trace.c xen/common/xmalloc.c xen/drivers/char/console.c xen/drivers/char/ns16550.c xen/include/acm/acm_core.h xen/include/acm/acm_hooks.h xen/include/asm-ia64/config.h xen/include/asm-ia64/domain.h xen/include/asm-ia64/event.h xen/include/asm-ia64/ia64_int.h xen/include/asm-ia64/linux-xen/asm/pal.h xen/include/asm-ia64/linux-xen/asm/processor.h xen/include/asm-ia64/mm.h xen/include/asm-ia64/mmu_context.h xen/include/asm-ia64/privop.h xen/include/asm-ia64/regionreg.h xen/include/asm-ia64/regs.h xen/include/asm-ia64/serial.h xen/include/asm-ia64/tlb.h xen/include/asm-ia64/vcpu.h xen/include/asm-ia64/vmmu.h xen/include/asm-ia64/vmx.h xen/include/asm-ia64/vmx_uaccess.h xen/include/asm-ia64/vmx_vcpu.h xen/include/asm-ia64/vmx_vpd.h xen/include/asm-ia64/xenprocessor.h xen/include/asm-ia64/xensystem.h xen/include/asm-x86/apicdef.h xen/include/asm-x86/config.h xen/include/asm-x86/e820.h xen/include/asm-x86/event.h xen/include/asm-x86/fixmap.h xen/include/asm-x86/genapic.h xen/include/asm-x86/hpet.h xen/include/asm-x86/io.h xen/include/asm-x86/mach-bigsmp/mach_apic.h xen/include/asm-x86/mach-default/mach_apic.h xen/include/asm-x86/mach-es7000/mach_apic.h xen/include/asm-x86/mach-generic/mach_apic.h xen/include/asm-x86/mach-summit/mach_apic.h xen/include/asm-x86/mach-summit/mach_mpparse.h xen/include/asm-x86/mm.h xen/include/asm-x86/page.h xen/include/asm-x86/shadow.h xen/include/asm-x86/shadow_64.h xen/include/asm-x86/shadow_public.h xen/include/asm-x86/time.h xen/include/asm-x86/types.h xen/include/asm-x86/uaccess.h xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_platform.h xen/include/asm-x86/vmx_virpit.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/asm-x86/x86_64/page.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/memory.h xen/include/public/physdev.h xen/include/public/trace.h xen/include/public/xen.h xen/include/xen/ac_timer.h xen/include/xen/domain.h xen/include/xen/event.h xen/include/xen/grant_table.h xen/include/xen/mm.h xen/include/xen/perfc.h xen/include/xen/perfc_defn.h xen/include/xen/sched.h xen/include/xen/serial.h xen/include/xen/symbols.h xen/include/xen/time.h xen/include/xen/trace.h xen/tools/Makefile xen/tools/symbols.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Mon Aug 29 16:05:29 2005 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen0_defconfig_x86_64	Tue Aug 30 13:36:49 2005 -0700
     1.3 @@ -195,6 +195,7 @@ CONFIG_BLK_DEV_LOOP=y
     1.4  # CONFIG_BLK_DEV_CRYPTOLOOP is not set
     1.5  # CONFIG_BLK_DEV_NBD is not set
     1.6  # CONFIG_BLK_DEV_SX8 is not set
     1.7 +# CONFIG_BLK_DEV_UB is not set
     1.8  CONFIG_BLK_DEV_RAM=y
     1.9  CONFIG_BLK_DEV_RAM_COUNT=16
    1.10  CONFIG_BLK_DEV_RAM_SIZE=16384
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c	Mon Aug 29 16:05:29 2005 -0700
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c	Tue Aug 30 13:36:49 2005 -0700
     2.3 @@ -115,9 +115,9 @@ dma_supported(struct device *dev, u64 ma
     2.4  	if (swiotlb)
     2.5  		return swiotlb_dma_supported(dev, mask);
     2.6  	/*
     2.7 -         * By default we'll BUG when an infeasible DMA is requested, and
     2.8 -         * request swiotlb=force (see IOMMU_BUG_ON).
     2.9 -         */
    2.10 +	 * By default we'll BUG when an infeasible DMA is requested, and
    2.11 +	 * request swiotlb=force (see IOMMU_BUG_ON).
    2.12 +	 */
    2.13  	return 1;
    2.14  }
    2.15  EXPORT_SYMBOL(dma_supported);
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Mon Aug 29 16:05:29 2005 -0700
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c	Tue Aug 30 13:36:49 2005 -0700
     3.3 @@ -55,6 +55,7 @@
     3.4  #include <asm/io.h>
     3.5  #include <asm-xen/hypervisor.h>
     3.6  #include <asm-xen/xen-public/physdev.h>
     3.7 +#include <asm-xen/xen-public/memory.h>
     3.8  #include "setup_arch_pre.h"
     3.9  #include <bios_ebda.h>
    3.10  
    3.11 @@ -1585,15 +1586,21 @@ void __init setup_arch(char **cmdline_p)
    3.12  				(unsigned int *)xen_start_info.mfn_list,
    3.13  				xen_start_info.nr_pages * sizeof(unsigned int));
    3.14  		} else {
    3.15 +			struct xen_memory_reservation reservation = {
    3.16 +				.extent_start = (unsigned long *)xen_start_info.mfn_list + max_pfn,
    3.17 +				.nr_extents   = xen_start_info.nr_pages - max_pfn,
    3.18 +				.extent_order = 0,
    3.19 +				.domid        = DOMID_SELF
    3.20 +			};
    3.21 +
    3.22  			memcpy(phys_to_machine_mapping,
    3.23  				(unsigned int *)xen_start_info.mfn_list,
    3.24  				max_pfn * sizeof(unsigned int));
    3.25  			/* N.B. below relies on sizeof(int) == sizeof(long). */
    3.26 -			if (HYPERVISOR_dom_mem_op(
    3.27 -				MEMOP_decrease_reservation,
    3.28 -				(unsigned long *)xen_start_info.mfn_list + max_pfn,
    3.29 -				xen_start_info.nr_pages - max_pfn, 0) !=
    3.30 -			    (xen_start_info.nr_pages - max_pfn)) BUG();
    3.31 +			BUG_ON(HYPERVISOR_memory_op(
    3.32 +				XENMEM_decrease_reservation,
    3.33 +				&reservation) !=
    3.34 +			    (xen_start_info.nr_pages - max_pfn));
    3.35  		}
    3.36  		free_bootmem(
    3.37  			__pa(xen_start_info.mfn_list), 
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Mon Aug 29 16:05:29 2005 -0700
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Tue Aug 30 13:36:49 2005 -0700
     4.3 @@ -35,6 +35,7 @@
     4.4  #include <asm/pgtable.h>
     4.5  #include <asm-xen/hypervisor.h>
     4.6  #include <asm-xen/balloon.h>
     4.7 +#include <asm-xen/xen-public/memory.h>
     4.8  #include <linux/module.h>
     4.9  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.10  #include <linux/percpu.h>
    4.11 @@ -320,6 +321,12 @@ void xen_create_contiguous_region(unsign
    4.12  	pmd_t         *pmd;
    4.13  	pte_t         *pte;
    4.14  	unsigned long  mfn, i, flags;
    4.15 +	struct xen_memory_reservation reservation = {
    4.16 +		.extent_start = &mfn,
    4.17 +		.nr_extents   = 1,
    4.18 +		.extent_order = 0,
    4.19 +		.domid        = DOMID_SELF
    4.20 +	};
    4.21  
    4.22  	scrub_pages(vstart, 1 << order);
    4.23  
    4.24 @@ -336,13 +343,15 @@ void xen_create_contiguous_region(unsign
    4.25  			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
    4.26  		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    4.27  			INVALID_P2M_ENTRY;
    4.28 -		BUG_ON(HYPERVISOR_dom_mem_op(
    4.29 -			MEMOP_decrease_reservation, &mfn, 1, 0) != 1);
    4.30 +		BUG_ON(HYPERVISOR_memory_op(
    4.31 +			XENMEM_decrease_reservation, &reservation) != 1);
    4.32  	}
    4.33  
    4.34  	/* 2. Get a new contiguous memory extent. */
    4.35 -	BUG_ON(HYPERVISOR_dom_mem_op(
    4.36 -		MEMOP_increase_reservation, &mfn, 1, order | (32<<8)) != 1);
    4.37 +	reservation.extent_order = order;
    4.38 +	reservation.address_bits = 31; /* aacraid limitation */
    4.39 +	BUG_ON(HYPERVISOR_memory_op(
    4.40 +		XENMEM_increase_reservation, &reservation) != 1);
    4.41  
    4.42  	/* 3. Map the new extent in place of old pages. */
    4.43  	for (i = 0; i < (1<<order); i++) {
    4.44 @@ -367,6 +376,12 @@ void xen_destroy_contiguous_region(unsig
    4.45  	pmd_t         *pmd;
    4.46  	pte_t         *pte;
    4.47  	unsigned long  mfn, i, flags;
    4.48 +	struct xen_memory_reservation reservation = {
    4.49 +		.extent_start = &mfn,
    4.50 +		.nr_extents   = 1,
    4.51 +		.extent_order = 0,
    4.52 +		.domid        = DOMID_SELF
    4.53 +	};
    4.54  
    4.55  	scrub_pages(vstart, 1 << order);
    4.56  
    4.57 @@ -385,14 +400,14 @@ void xen_destroy_contiguous_region(unsig
    4.58  			vstart + (i*PAGE_SIZE), __pte_ma(0), 0));
    4.59  		phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] =
    4.60  			INVALID_P2M_ENTRY;
    4.61 -		BUG_ON(HYPERVISOR_dom_mem_op(
    4.62 -			MEMOP_decrease_reservation, &mfn, 1, 0) != 1);
    4.63 +		BUG_ON(HYPERVISOR_memory_op(
    4.64 +			XENMEM_decrease_reservation, &reservation) != 1);
    4.65  	}
    4.66  
    4.67  	/* 2. Map new pages in place of old pages. */
    4.68  	for (i = 0; i < (1<<order); i++) {
    4.69 -		BUG_ON(HYPERVISOR_dom_mem_op(
    4.70 -			MEMOP_increase_reservation, &mfn, 1, 0) != 1);
    4.71 +		BUG_ON(HYPERVISOR_memory_op(
    4.72 +			XENMEM_increase_reservation, &reservation) != 1);
    4.73  		BUG_ON(HYPERVISOR_update_va_mapping(
    4.74  			vstart + (i*PAGE_SIZE),
    4.75  			pfn_pte_ma(mfn, PAGE_KERNEL), 0));
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Mon Aug 29 16:05:29 2005 -0700
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Tue Aug 30 13:36:49 2005 -0700
     5.3 @@ -44,13 +44,6 @@
     5.4  #include <asm-xen/hypervisor.h>
     5.5  #include <asm-xen/evtchn.h>
     5.6  
     5.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     5.8 -EXPORT_SYMBOL(force_evtchn_callback);
     5.9 -EXPORT_SYMBOL(evtchn_do_upcall);
    5.10 -EXPORT_SYMBOL(bind_evtchn_to_irq);
    5.11 -EXPORT_SYMBOL(unbind_evtchn_from_irq);
    5.12 -#endif
    5.13 -
    5.14  /*
    5.15   * This lock protects updates to the following mapping and reference-count
    5.16   * arrays. The lock does not need to be acquired to read the mapping tables.
    5.17 @@ -133,6 +126,7 @@ void force_evtchn_callback(void)
    5.18  {
    5.19      (void)HYPERVISOR_xen_version(0);
    5.20  }
    5.21 +EXPORT_SYMBOL(force_evtchn_callback);
    5.22  
    5.23  /* NB. Interrupts are disabled on entry. */
    5.24  asmlinkage void evtchn_do_upcall(struct pt_regs *regs)
    5.25 @@ -165,6 +159,7 @@ asmlinkage void evtchn_do_upcall(struct 
    5.26          }
    5.27      }
    5.28  }
    5.29 +EXPORT_SYMBOL(evtchn_do_upcall);
    5.30  
    5.31  static int find_unbound_irq(void)
    5.32  {
    5.33 @@ -211,6 +206,7 @@ int bind_virq_to_irq(int virq)
    5.34      
    5.35      return irq;
    5.36  }
    5.37 +EXPORT_SYMBOL(bind_virq_to_irq);
    5.38  
    5.39  void unbind_virq_from_irq(int virq)
    5.40  {
    5.41 @@ -244,6 +240,7 @@ void unbind_virq_from_irq(int virq)
    5.42  
    5.43      spin_unlock(&irq_mapping_update_lock);
    5.44  }
    5.45 +EXPORT_SYMBOL(unbind_virq_from_irq);
    5.46  
    5.47  int bind_ipi_to_irq(int ipi)
    5.48  {
    5.49 @@ -279,6 +276,7 @@ int bind_ipi_to_irq(int ipi)
    5.50  
    5.51      return irq;
    5.52  }
    5.53 +EXPORT_SYMBOL(bind_ipi_to_irq);
    5.54  
    5.55  void unbind_ipi_from_irq(int ipi)
    5.56  {
    5.57 @@ -306,6 +304,7 @@ void unbind_ipi_from_irq(int ipi)
    5.58  
    5.59      spin_unlock(&irq_mapping_update_lock);
    5.60  }
    5.61 +EXPORT_SYMBOL(unbind_ipi_from_irq);
    5.62  
    5.63  int bind_evtchn_to_irq(unsigned int evtchn)
    5.64  {
    5.65 @@ -326,6 +325,7 @@ int bind_evtchn_to_irq(unsigned int evtc
    5.66      
    5.67      return irq;
    5.68  }
    5.69 +EXPORT_SYMBOL(bind_evtchn_to_irq);
    5.70  
    5.71  void unbind_evtchn_from_irq(unsigned int evtchn)
    5.72  {
    5.73 @@ -341,6 +341,7 @@ void unbind_evtchn_from_irq(unsigned int
    5.74  
    5.75      spin_unlock(&irq_mapping_update_lock);
    5.76  }
    5.77 +EXPORT_SYMBOL(unbind_evtchn_from_irq);
    5.78  
    5.79  int bind_evtchn_to_irqhandler(
    5.80      unsigned int evtchn,
    5.81 @@ -359,6 +360,7 @@ int bind_evtchn_to_irqhandler(
    5.82  
    5.83      return retval;
    5.84  }
    5.85 +EXPORT_SYMBOL(bind_evtchn_to_irqhandler);
    5.86  
    5.87  void unbind_evtchn_from_irqhandler(unsigned int evtchn, void *dev_id)
    5.88  {
    5.89 @@ -366,6 +368,7 @@ void unbind_evtchn_from_irqhandler(unsig
    5.90      free_irq(irq, dev_id);
    5.91      unbind_evtchn_from_irq(evtchn);
    5.92  }
    5.93 +EXPORT_SYMBOL(unbind_evtchn_from_irqhandler);
    5.94  
    5.95  #ifdef CONFIG_SMP
    5.96  static void do_nothing_function(void *ign)
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Mon Aug 29 16:05:29 2005 -0700
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c	Tue Aug 30 13:36:49 2005 -0700
     6.3 @@ -65,17 +65,12 @@ static int shutting_down = SHUTDOWN_INVA
     6.4  #define cpu_up(x) (-EOPNOTSUPP)
     6.5  #endif
     6.6  
     6.7 -#ifdef CONFIG_SMP
     6.8 -#endif
     6.9  
    6.10  static int __do_suspend(void *ignore)
    6.11  {
    6.12      int i, j;
    6.13      suspend_record_t *suspend_record;
    6.14  
    6.15 -    /* Hmmm... a cleaner interface to suspend/resume blkdevs would be nice. */
    6.16 -	/* XXX SMH: yes it would :-( */	
    6.17 -
    6.18  #ifdef CONFIG_XEN_USB_FRONTEND
    6.19      extern void usbif_resume();
    6.20  #else
    6.21 @@ -108,7 +103,8 @@ static int __do_suspend(void *ignore)
    6.22  
    6.23  #if defined(CONFIG_SMP) && !defined(CONFIG_HOTPLUG_CPU)
    6.24      if (num_online_cpus() > 1) {
    6.25 -	printk(KERN_WARNING "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n");
    6.26 +	printk(KERN_WARNING 
    6.27 +               "Can't suspend SMP guests without CONFIG_HOTPLUG_CPU\n");
    6.28  	return -EOPNOTSUPP;
    6.29      }
    6.30  #endif
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Mon Aug 29 16:05:29 2005 -0700
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c	Tue Aug 30 13:36:49 2005 -0700
     7.3 @@ -734,9 +734,9 @@ void __init setup_arch(char **cmdline_p)
     7.4  		/* Make sure we have a large enough P->M table. */
     7.5  		if (end_pfn > xen_start_info.nr_pages) {
     7.6  			phys_to_machine_mapping = alloc_bootmem(
     7.7 -				max_pfn * sizeof(u32));
     7.8 +				end_pfn * sizeof(u32));
     7.9  			memset(phys_to_machine_mapping, ~0,
    7.10 -			       max_pfn * sizeof(u32));
    7.11 +			       end_pfn * sizeof(u32));
    7.12  			memcpy(phys_to_machine_mapping,
    7.13  			       (u32 *)xen_start_info.mfn_list,
    7.14  			       xen_start_info.nr_pages * sizeof(u32));
    7.15 @@ -749,11 +749,8 @@ void __init setup_arch(char **cmdline_p)
    7.16  		pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE);
    7.17  
    7.18  		for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(u32)), j++ )
    7.19 -		{	
    7.20  			pfn_to_mfn_frame_list[j] = 
    7.21  				virt_to_mfn(&phys_to_machine_mapping[i]);
    7.22 -		}
    7.23 -
    7.24  	}
    7.25  #endif
    7.26  
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Mon Aug 29 16:05:29 2005 -0700
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Tue Aug 30 13:36:49 2005 -0700
     8.3 @@ -149,7 +149,7 @@ void dump_pagetable(unsigned long addres
     8.4  	pmd_t *pmd;
     8.5  	pte_t *pte;
     8.6  
     8.7 -        pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
     8.8 +	pgd = (pgd_t *)per_cpu(cur_pgd, smp_processor_id());
     8.9  	pgd += pgd_index(address);
    8.10  
    8.11  	printk("PGD %lx ", pgd_val(*pgd));
    8.12 @@ -296,9 +296,9 @@ int exception_trace = 1;
    8.13  #define MEM_VERBOSE 1
    8.14  
    8.15  #ifdef MEM_VERBOSE
    8.16 -#define MEM_LOG(_f, _a...)                           \
    8.17 -  printk("fault.c:[%d]-> " _f "\n", \
    8.18 -          __LINE__ , ## _a )
    8.19 +#define MEM_LOG(_f, _a...)			\
    8.20 +	printk("fault.c:[%d]-> " _f "\n",	\
    8.21 +	__LINE__ , ## _a )
    8.22  #else
    8.23  #define MEM_LOG(_f, _a...) ((void)0)
    8.24  #endif
    8.25 @@ -325,7 +325,7 @@ asmlinkage void do_page_fault(struct pt_
    8.26  	siginfo_t info;
    8.27  
    8.28  	if (!user_mode(regs))
    8.29 -                error_code &= ~4; /* means kernel */
    8.30 +		error_code &= ~4; /* means kernel */
    8.31  
    8.32  #ifdef CONFIG_CHECKING
    8.33  	{ 
     9.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Mon Aug 29 16:05:29 2005 -0700
     9.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c	Tue Aug 30 13:36:49 2005 -0700
     9.3 @@ -62,14 +62,16 @@ static int init_mapping_done;
     9.4   * avaialble in init_memory_mapping().
     9.5   */
     9.6  
     9.7 -#define addr_to_page(addr, page)                                             \
     9.8 -        (addr) &= PHYSICAL_PAGE_MASK;                                   \
     9.9 -        (page) = ((unsigned long *) ((unsigned long)(((mfn_to_pfn((addr) >> PAGE_SHIFT)) << PAGE_SHIFT) + __START_KERNEL_map)))
    9.10 +#define addr_to_page(addr, page)				\
    9.11 +	(addr) &= PHYSICAL_PAGE_MASK;				\
    9.12 +	(page) = ((unsigned long *) ((unsigned long)		\
    9.13 +	(((mfn_to_pfn((addr) >> PAGE_SHIFT)) << PAGE_SHIFT) +	\
    9.14 +	__START_KERNEL_map)))
    9.15  
    9.16  static void __make_page_readonly(unsigned long va)
    9.17  {
    9.18 -        unsigned long addr;
    9.19 -        pte_t pte, *ptep;
    9.20 +	unsigned long addr;
    9.21 +	pte_t pte, *ptep;
    9.22  	unsigned long *page = (unsigned long *) init_level4_pgt;
    9.23  
    9.24  	addr = (unsigned long) page[pgd_index(va)];
    9.25 @@ -89,22 +91,22 @@ static void __make_page_readonly(unsigne
    9.26  
    9.27  static void __make_page_writable(unsigned long va)
    9.28  {
    9.29 -        unsigned long addr;
    9.30 -        pte_t pte, *ptep;
    9.31 -        unsigned long *page = (unsigned long *) init_level4_pgt;
    9.32 -
    9.33 -        addr = (unsigned long) page[pgd_index(va)];
    9.34 -        addr_to_page(addr, page);
    9.35 +	unsigned long addr;
    9.36 +	pte_t pte, *ptep;
    9.37 +	unsigned long *page = (unsigned long *) init_level4_pgt;
    9.38  
    9.39 -        addr = page[pud_index(va)];
    9.40 -        addr_to_page(addr, page);
    9.41 -        
    9.42 -        addr = page[pmd_index(va)];
    9.43 -        addr_to_page(addr, page);
    9.44 +	addr = (unsigned long) page[pgd_index(va)];
    9.45 +	addr_to_page(addr, page);
    9.46  
    9.47 -        ptep = (pte_t *) &page[pte_index(va)];
    9.48 +	addr = page[pud_index(va)];
    9.49 +	addr_to_page(addr, page);
    9.50 + 
    9.51 +	addr = page[pmd_index(va)];
    9.52 +	addr_to_page(addr, page);
    9.53 +
    9.54 +	ptep = (pte_t *) &page[pte_index(va)];
    9.55  	pte.pte = (ptep->pte | _PAGE_RW);
    9.56 -        xen_l1_entry_update(ptep, pte);
    9.57 +	xen_l1_entry_update(ptep, pte);
    9.58  	__flush_tlb_one(addr);
    9.59  }
    9.60  
    9.61 @@ -115,55 +117,55 @@ static void __make_page_writable(unsigne
    9.62  void make_page_readonly(void *va)
    9.63  {
    9.64  	pgd_t* pgd; pud_t *pud; pmd_t* pmd; pte_t pte, *ptep;
    9.65 -        unsigned long addr = (unsigned long) va;
    9.66 +	unsigned long addr = (unsigned long) va;
    9.67  
    9.68 -        if (!init_mapping_done) {
    9.69 -                __make_page_readonly(addr);
    9.70 -                return;
    9.71 -        }
    9.72 -                
    9.73 -        pgd = pgd_offset_k(addr);
    9.74 -        pud = pud_offset(pgd, addr);
    9.75 -        pmd = pmd_offset(pud, addr);
    9.76 -        ptep = pte_offset_kernel(pmd, addr);
    9.77 +	if (!init_mapping_done) {
    9.78 +		__make_page_readonly(addr);
    9.79 +		return;
    9.80 +	}
    9.81 +  
    9.82 +	pgd = pgd_offset_k(addr);
    9.83 +	pud = pud_offset(pgd, addr);
    9.84 +	pmd = pmd_offset(pud, addr);
    9.85 +	ptep = pte_offset_kernel(pmd, addr);
    9.86  	pte.pte = (ptep->pte & ~_PAGE_RW);
    9.87 -        xen_l1_entry_update(ptep, pte);
    9.88 +	xen_l1_entry_update(ptep, pte);
    9.89  	__flush_tlb_one(addr);
    9.90  }
    9.91  
    9.92  void make_page_writable(void *va)
    9.93  {
    9.94 -        pgd_t* pgd; pud_t *pud; pmd_t* pmd; pte_t pte, *ptep;
    9.95 -        unsigned long addr = (unsigned long) va;
    9.96 +	pgd_t* pgd; pud_t *pud; pmd_t* pmd; pte_t pte, *ptep;
    9.97 +	unsigned long addr = (unsigned long) va;
    9.98  
    9.99 -        if (!init_mapping_done) {
   9.100 -                __make_page_writable(addr);
   9.101 -                return;
   9.102 -        }
   9.103 +	if (!init_mapping_done) {
   9.104 +		__make_page_writable(addr);
   9.105 +		return;
   9.106 +	}
   9.107  
   9.108 -        pgd = pgd_offset_k(addr);
   9.109 -        pud = pud_offset(pgd, addr);
   9.110 -        pmd = pmd_offset(pud, addr);
   9.111 -        ptep = pte_offset_kernel(pmd, addr);
   9.112 +	pgd = pgd_offset_k(addr);
   9.113 +	pud = pud_offset(pgd, addr);
   9.114 +	pmd = pmd_offset(pud, addr);
   9.115 +	ptep = pte_offset_kernel(pmd, addr);
   9.116  	pte.pte = (ptep->pte | _PAGE_RW);
   9.117 -        xen_l1_entry_update(ptep, pte);
   9.118 +	xen_l1_entry_update(ptep, pte);
   9.119  	__flush_tlb_one(addr);
   9.120  }
   9.121  
   9.122  void make_pages_readonly(void* va, unsigned nr)
   9.123  {
   9.124 -        while ( nr-- != 0 ) {
   9.125 -                make_page_readonly(va);
   9.126 -                va = (void*)((unsigned long)va + PAGE_SIZE);
   9.127 -        }
   9.128 +	while (nr-- != 0) {
   9.129 +		make_page_readonly(va);
   9.130 +		va = (void*)((unsigned long)va + PAGE_SIZE);
   9.131 +	}
   9.132  }
   9.133  
   9.134  void make_pages_writable(void* va, unsigned nr)
   9.135  {
   9.136 -        while ( nr-- != 0 ) {
   9.137 -                make_page_writable(va);
   9.138 -                va = (void*)((unsigned long)va + PAGE_SIZE);
   9.139 -        }
   9.140 +	while (nr-- != 0) {
   9.141 +		make_page_writable(va);
   9.142 +		va = (void*)((unsigned long)va + PAGE_SIZE);
   9.143 +	}
   9.144  }
   9.145  
   9.146  /*
   9.147 @@ -389,7 +391,7 @@ void __set_fixmap_user (enum fixed_addre
   9.148          set_pte_phys(address, phys, prot, SET_FIXMAP_USER); 
   9.149  }
   9.150  
   9.151 -unsigned long __initdata table_start, table_end, tables_space; 
   9.152 +unsigned long __initdata table_start, tables_space; 
   9.153  
   9.154  unsigned long get_machine_pfn(unsigned long addr)
   9.155  {
   9.156 @@ -400,38 +402,13 @@ unsigned long get_machine_pfn(unsigned l
   9.157          return pte_mfn(*pte);
   9.158  } 
   9.159  
   9.160 -#define ALIGN_TO_4K __attribute__((section(".data.page_aligned")))
   9.161 -#define MAX_LOW_PAGES	0x20
   9.162 -static unsigned long __init_pgt[MAX_LOW_PAGES][512]  ALIGN_TO_4K;
   9.163 -static int __init_pgt_index;
   9.164 -
   9.165 -/*
   9.166 - * We start using from start_pfn
   9.167 - */
   9.168  static __init void *alloc_static_page(unsigned long *phys)
   9.169  {
   9.170 -	int i = __init_pgt_index++;
   9.171 -
   9.172 -	if (__init_pgt_index >= MAX_LOW_PAGES) {
   9.173 -		printk("Need to increase MAX_LOW_PAGES");
   9.174 -		BUG();
   9.175 -	}
   9.176 -		
   9.177 -	*phys = __pa(__init_pgt[i]);
   9.178 -
   9.179 -	return (void *) __init_pgt[i];
   9.180 -} 
   9.181 -
   9.182 -/*
   9.183 - * Get RO page
   9.184 - */
   9.185 -static void __init *alloc_low_page(unsigned long *phys)
   9.186 -{ 
   9.187 -        unsigned long pfn = table_end++;
   9.188 -    
   9.189 -        *phys = (pfn << PAGE_SHIFT);
   9.190 -        memset((void *) ((pfn << PAGE_SHIFT) + __START_KERNEL_map), 0, PAGE_SIZE);
   9.191 -        return (void *)((pfn << PAGE_SHIFT) + __START_KERNEL_map);
   9.192 +	unsigned long va = (start_pfn << PAGE_SHIFT) + __START_KERNEL_map;
   9.193 +	*phys = start_pfn << PAGE_SHIFT;
   9.194 +	start_pfn++;
   9.195 +	memset((void *)va, 0, PAGE_SIZE);
   9.196 +	return (void *)va;
   9.197  } 
   9.198  
   9.199  #define PTE_SIZE PAGE_SIZE
   9.200 @@ -443,30 +420,24 @@ static inline void __set_pte(pte_t *dst,
   9.201  
   9.202  static inline int make_readonly(unsigned long paddr)
   9.203  {
   9.204 -    int readonly = 0;
   9.205 -
   9.206 -    /* Make new page tables read-only. */
   9.207 -    if ((paddr < ((table_start << PAGE_SHIFT) + tables_space)) &&
   9.208 -        (paddr >= (table_start << PAGE_SHIFT)))
   9.209 -        readonly = 1;
   9.210 +	int readonly = 0;
   9.211  
   9.212 -    /* Make old page tables read-only. */
   9.213 -    if ((paddr < ((xen_start_info.pt_base - __START_KERNEL_map) +
   9.214 -                  (xen_start_info.nr_pt_frames << PAGE_SHIFT))) &&
   9.215 -        (paddr >= (xen_start_info.pt_base - __START_KERNEL_map)))
   9.216 -        readonly = 1;
   9.217 +	/* Make old and new page tables read-only. */
   9.218 +	if ((paddr >= (xen_start_info.pt_base - __START_KERNEL_map))
   9.219 +	    && (paddr < ((table_start << PAGE_SHIFT) + tables_space)))
   9.220 +		readonly = 1;
   9.221 +	/*
   9.222 +	 * No need for writable mapping of kernel image. This also ensures that
   9.223 +	 * page and descriptor tables embedded inside don't have writable
   9.224 +	 * mappings. 
   9.225 +	 */
   9.226 +	if ((paddr >= __pa_symbol(&_text)) && (paddr < __pa_symbol(&_end)))
   9.227 +		readonly = 1;
   9.228  
   9.229 -    /*
   9.230 -     * No need for writable mapping of kernel image. This also ensures that
   9.231 -     * page and descriptor tables embedded inside don't have writable mappings.
   9.232 -     */
   9.233 -    if ((paddr >= __pa_symbol(&_text)) && (paddr < __pa_symbol(&_end)))
   9.234 -        readonly = 1;
   9.235 -
   9.236 -    return readonly;
   9.237 +	return readonly;
   9.238  }
   9.239  
   9.240 -void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
   9.241 +static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
   9.242  { 
   9.243          long i, j, k; 
   9.244          unsigned long paddr;
   9.245 @@ -485,7 +456,7 @@ void __init phys_pud_init(pud_t *pud, un
   9.246  			break;
   9.247  		} 
   9.248  
   9.249 -		pmd = alloc_low_page(&pmd_phys);
   9.250 +		pmd = alloc_static_page(&pmd_phys);
   9.251                  make_page_readonly(pmd);
   9.252                  xen_pmd_pin(pmd_phys);
   9.253  		set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
   9.254 @@ -499,19 +470,20 @@ void __init phys_pud_init(pud_t *pud, un
   9.255  					set_pmd(pmd,  __pmd(0)); 
   9.256  				break;
   9.257  			}
   9.258 -                        pte = alloc_low_page(&pte_phys);
   9.259 +                        pte = alloc_static_page(&pte_phys);
   9.260                          pte_save = pte;
   9.261                          for (k = 0; k < PTRS_PER_PTE; pte++, k++, paddr += PTE_SIZE) {
   9.262 +                                if ((paddr >= end) ||
   9.263 +                                    ((paddr >> PAGE_SHIFT)
   9.264 +                                     >= xen_start_info.nr_pages)) { 
   9.265 +                                        __set_pte(pte, __pte(0)); 
   9.266 +                                        continue;
   9.267 +                                }
   9.268                                  if (make_readonly(paddr)) {
   9.269                                          __set_pte(pte, 
   9.270                                                  __pte(paddr | (_KERNPG_TABLE & ~_PAGE_RW)));
   9.271                                          continue;
   9.272                                  }
   9.273 -                                if (paddr >= end) { 
   9.274 -                                        for (; k < PTRS_PER_PTE; k++, pte++)
   9.275 -                                                __set_pte(pte, __pte(0)); 
   9.276 -                                        break;
   9.277 -                                }
   9.278                                  __set_pte(pte, __pte(paddr | _KERNPG_TABLE));
   9.279                          }
   9.280                          pte = pte_save;
   9.281 @@ -525,15 +497,16 @@ void __init phys_pud_init(pud_t *pud, un
   9.282  
   9.283  static void __init find_early_table_space(unsigned long end)
   9.284  {
   9.285 -        unsigned long puds, pmds, ptes; 
   9.286 +	unsigned long puds, pmds, ptes; 
   9.287  
   9.288  	puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
   9.289  	pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
   9.290 -        ptes = (end + PTE_SIZE - 1) >> PAGE_SHIFT;
   9.291 +	ptes = (end + PTE_SIZE - 1) >> PAGE_SHIFT;
   9.292  
   9.293 -        tables_space = round_up(puds * 8, PAGE_SIZE) + 
   9.294 -	    		  round_up(pmds * 8, PAGE_SIZE) + 
   9.295 -	    		  round_up(ptes * 8, PAGE_SIZE); 
   9.296 +	tables_space =
   9.297 +		round_up(puds * 8, PAGE_SIZE) + 
   9.298 +		round_up(pmds * 8, PAGE_SIZE) + 
   9.299 +		round_up(ptes * 8, PAGE_SIZE); 
   9.300  }
   9.301  
   9.302  void __init xen_init_pt(void)
   9.303 @@ -579,66 +552,59 @@ void __init xen_init_pt(void)
   9.304  		mk_kernel_pgd(__pa_symbol(level3_user_pgt)));
   9.305  }
   9.306  
   9.307 -/*
   9.308 - * Extend kernel mapping to access pages for page tables.  The initial
   9.309 - * mapping done by Xen is minimal (e.g. 8MB) and we need to extend the
   9.310 - * mapping for early initialization.
   9.311 - */
   9.312 -static unsigned long current_size, extended_size;
   9.313 -
   9.314  void __init extend_init_mapping(void) 
   9.315  {
   9.316  	unsigned long va = __START_KERNEL_map;
   9.317  	unsigned long phys, addr, *pte_page;
   9.318 -        pmd_t *pmd;
   9.319 +	pmd_t *pmd;
   9.320  	pte_t *pte, new_pte;
   9.321 -	unsigned long *page = (unsigned long *) init_level4_pgt;
   9.322 -	int i;
   9.323 +	unsigned long *page = (unsigned long *)init_level4_pgt;
   9.324  
   9.325  	addr = page[pgd_index(va)];
   9.326  	addr_to_page(addr, page);
   9.327  	addr = page[pud_index(va)];
   9.328  	addr_to_page(addr, page);
   9.329  
   9.330 -	for (;;) {
   9.331 -		pmd = (pmd_t *)&page[pmd_index(va)];
   9.332 -		if (!pmd_present(*pmd))
   9.333 -			break;
   9.334 -		addr = page[pmd_index(va)];
   9.335 -		addr_to_page(addr, pte_page);
   9.336 -		for (i = 0; i < PTRS_PER_PTE; i++) {
   9.337 -			pte = (pte_t *) &pte_page[pte_index(va)];
   9.338 -			if (!pte_present(*pte))
   9.339 -				break;
   9.340 -			va += PAGE_SIZE;
   9.341 -			current_size += PAGE_SIZE;
   9.342 -		}
   9.343 +	/* Kill mapping of low 1MB. */
   9.344 +	while (va < (unsigned long)&_text) {
   9.345 +		HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
   9.346 +		va += PAGE_SIZE;
   9.347  	}
   9.348  
   9.349 -	while (va < __START_KERNEL_map + current_size + tables_space) {
   9.350 -		pmd = (pmd_t *) &page[pmd_index(va)];
   9.351 -		if (!pmd_none(*pmd))
   9.352 -			continue;
   9.353 -		pte_page = (unsigned long *) alloc_static_page(&phys);
   9.354 -		make_page_readonly(pte_page);
   9.355 -		xen_pte_pin(phys);
   9.356 -		set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
   9.357 -		for (i = 0; i < PTRS_PER_PTE; i++, va += PAGE_SIZE) {
   9.358 +	/* Ensure init mappings cover kernel text/data and initial tables. */
   9.359 +	while (va < (__START_KERNEL_map
   9.360 +		     + (start_pfn << PAGE_SHIFT)
   9.361 +		     + tables_space)) {
   9.362 +		pmd = (pmd_t *)&page[pmd_index(va)];
   9.363 +		if (pmd_none(*pmd)) {
   9.364 +			pte_page = alloc_static_page(&phys);
   9.365 +			make_page_readonly(pte_page);
   9.366 +			xen_pte_pin(phys);
   9.367 +			set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
   9.368 +		} else {
   9.369 +			addr = page[pmd_index(va)];
   9.370 +			addr_to_page(addr, pte_page);
   9.371 +		}
   9.372 +		pte = (pte_t *)&pte_page[pte_index(va)];
   9.373 +		if (pte_none(*pte)) {
   9.374  			new_pte = pfn_pte(
   9.375  				(va - __START_KERNEL_map) >> PAGE_SHIFT, 
   9.376  				__pgprot(_KERNPG_TABLE | _PAGE_USER));
   9.377 -			pte = (pte_t *)&pte_page[pte_index(va)];
   9.378  			xen_l1_entry_update(pte, new_pte);
   9.379 -			extended_size += PAGE_SIZE;
   9.380  		}
   9.381 +		va += PAGE_SIZE;
   9.382  	}
   9.383  
   9.384 -	/* Kill mapping of low 1MB. */
   9.385 -	for (va = __START_KERNEL_map; va < (unsigned long)&_text; va += PAGE_SIZE)
   9.386 +	/* Finally, blow away any spurious initial mappings. */
   9.387 +	while (1) {
   9.388 +		pmd = (pmd_t *)&page[pmd_index(va)];
   9.389 +		if (pmd_none(*pmd))
   9.390 +			break;
   9.391  		HYPERVISOR_update_va_mapping(va, __pte_ma(0), 0);
   9.392 +		va += PAGE_SIZE;
   9.393 +	}
   9.394  }
   9.395  
   9.396 -
   9.397  /* Setup the direct mapping of the physical memory at PAGE_OFFSET.
   9.398     This runs before bootmem is initialized and gets pages directly from the 
   9.399     physical memory. To access them they are temporarily mapped. */
   9.400 @@ -650,34 +616,31 @@ void __init init_memory_mapping(unsigned
   9.401  
   9.402  	find_early_table_space(end);
   9.403  	extend_init_mapping();
   9.404 -	start_pfn = current_size >> PAGE_SHIFT;
   9.405  
   9.406  	table_start = start_pfn;
   9.407 -	table_end = table_start;
   9.408  
   9.409  	start = (unsigned long)__va(start);
   9.410  	end = (unsigned long)__va(end);
   9.411  
   9.412  	for (; start < end; start = next) {
   9.413  		unsigned long pud_phys; 
   9.414 -                pud_t *pud = alloc_low_page(&pud_phys);
   9.415 -                make_page_readonly(pud);
   9.416 -                xen_pud_pin(pud_phys);
   9.417 +		pud_t *pud = alloc_static_page(&pud_phys);
   9.418 +		make_page_readonly(pud);
   9.419 +		xen_pud_pin(pud_phys);
   9.420  		next = start + PGDIR_SIZE;
   9.421  		if (next > end) 
   9.422  			next = end; 
   9.423  		phys_pud_init(pud, __pa(start), __pa(next));
   9.424  		set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
   9.425 -	} 
   9.426 +	}
   9.427  
   9.428 -	printk("kernel direct mapping tables upto %lx @ %lx-%lx\n", end, 
   9.429 -	       table_start<<PAGE_SHIFT, 
   9.430 -	       table_end<<PAGE_SHIFT);
   9.431 +	printk("kernel direct mapping tables upto %lx @ %lx-%lx\n",
   9.432 +	       __pa(end), table_start<<PAGE_SHIFT, start_pfn<<PAGE_SHIFT);
   9.433  
   9.434 -        start_pfn = ((current_size + extended_size) >> PAGE_SHIFT);
   9.435 +	BUG_ON(start_pfn != (table_start + (tables_space >> PAGE_SHIFT)));
   9.436  
   9.437  	__flush_tlb_all();
   9.438 -        init_mapping_done = 1;
   9.439 +	init_mapping_done = 1;
   9.440  }
   9.441  
   9.442  extern struct x8664_pda cpu_pda[NR_CPUS];
   9.443 @@ -1002,3 +965,13 @@ int in_gate_area_no_task(unsigned long a
   9.444  {
   9.445  	return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
   9.446  }
   9.447 +
   9.448 +/*
   9.449 + * Local variables:
   9.450 + *  c-file-style: "linux"
   9.451 + *  indent-tabs-mode: t
   9.452 + *  c-indent-level: 8
   9.453 + *  c-basic-offset: 8
   9.454 + *  tab-width: 8
   9.455 + * End:
   9.456 + */
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Mon Aug 29 16:05:29 2005 -0700
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Tue Aug 30 13:36:49 2005 -0700
    10.3 @@ -44,6 +44,7 @@
    10.4  #include <asm-xen/xen_proc.h>
    10.5  #include <asm-xen/hypervisor.h>
    10.6  #include <asm-xen/balloon.h>
    10.7 +#include <asm-xen/xen-public/memory.h>
    10.8  #include <asm/pgalloc.h>
    10.9  #include <asm/pgtable.h>
   10.10  #include <asm/uaccess.h>
   10.11 @@ -168,6 +169,11 @@ static void balloon_process(void *unused
   10.12  	struct page   *page;
   10.13  	long           credit, debt, rc;
   10.14  	void          *v;
   10.15 +	struct xen_memory_reservation reservation = {
   10.16 +		.address_bits = 0,
   10.17 +		.extent_order = 0,
   10.18 +		.domid        = DOMID_SELF
   10.19 +	};
   10.20  
   10.21  	down(&balloon_mutex);
   10.22  
   10.23 @@ -180,14 +186,18 @@ static void balloon_process(void *unused
   10.24  			goto out;
   10.25  
   10.26  		balloon_lock(flags);
   10.27 -		rc = HYPERVISOR_dom_mem_op(
   10.28 -			MEMOP_increase_reservation, mfn_list, credit, 0);
   10.29 +		reservation.extent_start = mfn_list;
   10.30 +		reservation.nr_extents   = credit;
   10.31 +		rc = HYPERVISOR_memory_op(
   10.32 +			XENMEM_increase_reservation, &reservation);
   10.33  		balloon_unlock(flags);
   10.34  		if (rc < credit) {
   10.35  			/* We hit the Xen hard limit: reprobe. */
   10.36 -			BUG_ON(HYPERVISOR_dom_mem_op(
   10.37 -				MEMOP_decrease_reservation,
   10.38 -				mfn_list, rc, 0) != rc);
   10.39 +			reservation.extent_start = mfn_list;
   10.40 +			reservation.nr_extents   = rc;
   10.41 +			BUG_ON(HYPERVISOR_memory_op(
   10.42 +				XENMEM_decrease_reservation,
   10.43 +				&reservation) != rc);
   10.44  			hard_limit = current_pages + rc - driver_pages;
   10.45  			vfree(mfn_list);
   10.46  			goto retry;
   10.47 @@ -261,8 +271,10 @@ static void balloon_process(void *unused
   10.48  			balloon_append(pfn_to_page(pfn));
   10.49  		}
   10.50  
   10.51 -		BUG_ON(HYPERVISOR_dom_mem_op(
   10.52 -			MEMOP_decrease_reservation,mfn_list, debt, 0) != debt);
   10.53 +		reservation.extent_start = mfn_list;
   10.54 +		reservation.nr_extents   = debt;
   10.55 +		BUG_ON(HYPERVISOR_memory_op(
   10.56 +			XENMEM_decrease_reservation, &reservation) != debt);
   10.57  
   10.58  		current_pages -= debt;
   10.59  	}
   10.60 @@ -438,11 +450,17 @@ static int dealloc_pte_fn(
   10.61  	pte_t *pte, struct page *pte_page, unsigned long addr, void *data)
   10.62  {
   10.63  	unsigned long mfn = pte_mfn(*pte);
   10.64 +	struct xen_memory_reservation reservation = {
   10.65 +		.extent_start = &mfn,
   10.66 +		.nr_extents   = 1,
   10.67 +		.extent_order = 0,
   10.68 +		.domid        = DOMID_SELF
   10.69 +	};
   10.70  	set_pte(pte, __pte_ma(0));
   10.71  	phys_to_machine_mapping[__pa(addr) >> PAGE_SHIFT] =
   10.72  		INVALID_P2M_ENTRY;
   10.73 -	BUG_ON(HYPERVISOR_dom_mem_op(
   10.74 -		MEMOP_decrease_reservation, &mfn, 1, 0) != 1);
   10.75 +	BUG_ON(HYPERVISOR_memory_op(
   10.76 +		XENMEM_decrease_reservation, &reservation) != 1);
   10.77  	return 0;
   10.78  }
   10.79  
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Aug 29 16:05:29 2005 -0700
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Aug 30 13:36:49 2005 -0700
    11.3 @@ -368,7 +368,7 @@ static void blkif_free(struct blkfront_i
    11.4  		free_page((unsigned long)info->ring.sring);
    11.5  		info->ring.sring = NULL;
    11.6  	}
    11.7 -	unbind_evtchn_from_irqhandler(info->evtchn, NULL);
    11.8 +	unbind_evtchn_from_irqhandler(info->evtchn, info); 
    11.9  	info->evtchn = 0;
   11.10  }
   11.11  
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/Makefile	Mon Aug 29 16:05:29 2005 -0700
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/Makefile	Tue Aug 30 13:36:49 2005 -0700
    12.3 @@ -1,2 +1,2 @@
    12.4  
    12.5 -obj-y	:= console.o
    12.6 +obj-y	:= console.o xencons_ring.o
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Mon Aug 29 16:05:29 2005 -0700
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Tue Aug 30 13:36:49 2005 -0700
    13.3 @@ -51,8 +51,8 @@
    13.4  #include <asm-xen/xen-public/event_channel.h>
    13.5  #include <asm-xen/hypervisor.h>
    13.6  #include <asm-xen/evtchn.h>
    13.7 -#include <asm-xen/ctrl_if.h>
    13.8  
    13.9 +#include "xencons_ring.h"
   13.10  /*
   13.11   * Modes:
   13.12   *  'xencons=off'  [XC_OFF]:     Console is disabled.
   13.13 @@ -118,13 +118,6 @@ static spinlock_t xencons_lock = SPIN_LO
   13.14  /* Common transmit-kick routine. */
   13.15  static void __xencons_tx_flush(void);
   13.16  
   13.17 -/* This task is used to defer sending console data until there is space. */
   13.18 -static void xencons_tx_flush_task_routine(void *data);
   13.19 -
   13.20 -static DECLARE_TQUEUE(xencons_tx_flush_task, 
   13.21 -                      xencons_tx_flush_task_routine,
   13.22 -                      NULL);
   13.23 -
   13.24  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   13.25  static struct tty_driver *xencons_driver;
   13.26  #else
   13.27 @@ -264,39 +257,22 @@ asmlinkage int xprintk(const char *fmt, 
   13.28  /*** Forcibly flush console data before dying. ***/
   13.29  void xencons_force_flush(void)
   13.30  {
   13.31 -    ctrl_msg_t msg;
   13.32      int        sz;
   13.33  
   13.34      /* Emergency console is synchronous, so there's nothing to flush. */
   13.35      if ( xen_start_info.flags & SIF_INITDOMAIN )
   13.36          return;
   13.37  
   13.38 -    /*
   13.39 -     * We use dangerous control-interface functions that require a quiescent
   13.40 -     * system and no interrupts. Try to ensure this with a global cli().
   13.41 -     */
   13.42 -    local_irq_disable(); /* XXXsmp */
   13.43  
   13.44      /* Spin until console data is flushed through to the domain controller. */
   13.45 -    while ( (wc != wp) && !ctrl_if_transmitter_empty() )
   13.46 +    while ( (wc != wp) )
   13.47      {
   13.48 -        /* Interrupts are disabled -- we must manually reap responses. */
   13.49 -        ctrl_if_discard_responses();
   13.50 -
   13.51 +	int sent = 0;
   13.52          if ( (sz = wp - wc) == 0 )
   13.53              continue;
   13.54 -        if ( sz > sizeof(msg.msg) )
   13.55 -            sz = sizeof(msg.msg);
   13.56 -        if ( sz > (wbuf_size - WBUF_MASK(wc)) )
   13.57 -            sz = wbuf_size - WBUF_MASK(wc);
   13.58 -
   13.59 -        msg.type    = CMSG_CONSOLE;
   13.60 -        msg.subtype = CMSG_CONSOLE_DATA;
   13.61 -        msg.length  = sz;
   13.62 -        memcpy(msg.msg, &wbuf[WBUF_MASK(wc)], sz);
   13.63 -            
   13.64 -        if ( ctrl_if_send_message_noblock(&msg, NULL, 0) == 0 )
   13.65 -            wc += sz;
   13.66 +	sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
   13.67 +	if (sent > 0)
   13.68 +	    wc += sent;
   13.69      }
   13.70  }
   13.71  
   13.72 @@ -320,7 +296,7 @@ static int xencons_priv_irq;
   13.73  static char x_char;
   13.74  
   13.75  /* Non-privileged receive callback. */
   13.76 -static void xencons_rx(ctrl_msg_t *msg, unsigned long id)
   13.77 +static void xencons_rx(char *buf, unsigned len)
   13.78  {
   13.79      int           i;
   13.80      unsigned long flags;
   13.81 @@ -328,21 +304,18 @@ static void xencons_rx(ctrl_msg_t *msg, 
   13.82      spin_lock_irqsave(&xencons_lock, flags);
   13.83      if ( xencons_tty != NULL )
   13.84      {
   13.85 -        for ( i = 0; i < msg->length; i++ )
   13.86 -            tty_insert_flip_char(xencons_tty, msg->msg[i], 0);
   13.87 +        for ( i = 0; i < len; i++ )
   13.88 +            tty_insert_flip_char(xencons_tty, buf[i], 0);
   13.89          tty_flip_buffer_push(xencons_tty);
   13.90      }
   13.91      spin_unlock_irqrestore(&xencons_lock, flags);
   13.92  
   13.93 -    msg->length = 0;
   13.94 -    ctrl_if_send_response(msg);
   13.95  }
   13.96  
   13.97  /* Privileged and non-privileged transmit worker. */
   13.98  static void __xencons_tx_flush(void)
   13.99  {
  13.100      int        sz, work_done = 0;
  13.101 -    ctrl_msg_t msg;
  13.102  
  13.103      if ( xen_start_info.flags & SIF_INITDOMAIN )
  13.104      {
  13.105 @@ -367,38 +340,23 @@ static void __xencons_tx_flush(void)
  13.106      {
  13.107          while ( x_char )
  13.108          {
  13.109 -            msg.type    = CMSG_CONSOLE;
  13.110 -            msg.subtype = CMSG_CONSOLE_DATA;
  13.111 -            msg.length  = 1;
  13.112 -            msg.msg[0]  = x_char;
  13.113 -
  13.114 -            if ( ctrl_if_send_message_noblock(&msg, NULL, 0) == 0 )
  13.115 -                x_char = 0;
  13.116 -            else if ( ctrl_if_enqueue_space_callback(&xencons_tx_flush_task) )
  13.117 -                break;
  13.118 -
  13.119 -            work_done = 1;
  13.120 +	    if (xencons_ring_send(&x_char, 1) == 1) {
  13.121 +		x_char = 0;
  13.122 +		work_done = 1;
  13.123 +	    }
  13.124          }
  13.125  
  13.126          while ( wc != wp )
  13.127          {
  13.128 +	    int sent;
  13.129              sz = wp - wc;
  13.130 -            if ( sz > sizeof(msg.msg) )
  13.131 -                sz = sizeof(msg.msg);
  13.132 -            if ( sz > (wbuf_size - WBUF_MASK(wc)) )
  13.133 -                sz = wbuf_size - WBUF_MASK(wc);
  13.134 -
  13.135 -            msg.type    = CMSG_CONSOLE;
  13.136 -            msg.subtype = CMSG_CONSOLE_DATA;
  13.137 -            msg.length  = sz;
  13.138 -            memcpy(msg.msg, &wbuf[WBUF_MASK(wc)], sz);
  13.139 -            
  13.140 -            if ( ctrl_if_send_message_noblock(&msg, NULL, 0) == 0 )
  13.141 -                wc += sz;
  13.142 -            else if ( ctrl_if_enqueue_space_callback(&xencons_tx_flush_task) )
  13.143 -                break;
  13.144 -
  13.145 -            work_done = 1;
  13.146 +	    if ( sz > (wbuf_size - WBUF_MASK(wc)) )
  13.147 +		sz = wbuf_size - WBUF_MASK(wc);
  13.148 +	    sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
  13.149 +	    if ( sent > 0 ) {
  13.150 +		wc += sent;
  13.151 +		work_done = 1;
  13.152 +	    }
  13.153          }
  13.154      }
  13.155  
  13.156 @@ -411,15 +369,6 @@ static void __xencons_tx_flush(void)
  13.157      }
  13.158  }
  13.159  
  13.160 -/* Non-privileged transmit kicker. */
  13.161 -static void xencons_tx_flush_task_routine(void *data)
  13.162 -{
  13.163 -    unsigned long flags;
  13.164 -    spin_lock_irqsave(&xencons_lock, flags);
  13.165 -    __xencons_tx_flush();
  13.166 -    spin_unlock_irqrestore(&xencons_lock, flags);
  13.167 -}
  13.168 -
  13.169  /* Privileged receive callback and transmit kicker. */
  13.170  static irqreturn_t xencons_priv_interrupt(int irq, void *dev_id,
  13.171                                            struct pt_regs *regs)
  13.172 @@ -726,6 +675,8 @@ static int __init xencons_init(void)
  13.173      if ( xc_mode == XC_OFF )
  13.174          return 0;
  13.175  
  13.176 +    xencons_ring_init();
  13.177 +
  13.178  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
  13.179      xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ? 
  13.180                                        1 : MAX_NR_CONSOLES);
  13.181 @@ -802,7 +753,8 @@ static int __init xencons_init(void)
  13.182      }
  13.183      else
  13.184      {
  13.185 -        (void)ctrl_if_register_receiver(CMSG_CONSOLE, xencons_rx, 0);
  13.186 +	
  13.187 +	xencons_ring_register_receiver(xencons_rx);
  13.188      }
  13.189  
  13.190      printk("Xen virtual console successfully installed as %s%d\n",
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c	Tue Aug 30 13:36:49 2005 -0700
    14.3 @@ -0,0 +1,124 @@
    14.4 +#include <linux/version.h>
    14.5 +#include <linux/module.h>
    14.6 +#include <linux/errno.h>
    14.7 +#include <linux/signal.h>
    14.8 +#include <linux/sched.h>
    14.9 +#include <linux/interrupt.h>
   14.10 +#include <linux/tty.h>
   14.11 +#include <linux/tty_flip.h>
   14.12 +#include <linux/serial.h>
   14.13 +#include <linux/major.h>
   14.14 +#include <linux/ptrace.h>
   14.15 +#include <linux/ioport.h>
   14.16 +#include <linux/mm.h>
   14.17 +#include <linux/slab.h>
   14.18 +
   14.19 +#include <asm-xen/hypervisor.h>
   14.20 +#include <asm-xen/evtchn.h>
   14.21 +#include <linux/wait.h>
   14.22 +#include <linux/interrupt.h>
   14.23 +#include <linux/sched.h>
   14.24 +#include <linux/err.h>
   14.25 +#include "xencons_ring.h"
   14.26 +
   14.27 +
   14.28 +struct ring_head
   14.29 +{
   14.30 +	u32 cons;
   14.31 +	u32 prod;
   14.32 +	char buf[0];
   14.33 +} __attribute__((packed));
   14.34 +
   14.35 +
   14.36 +#define XENCONS_RING_SIZE (PAGE_SIZE/2 - sizeof (struct ring_head))
   14.37 +#define XENCONS_IDX(cnt) ((cnt) % XENCONS_RING_SIZE)
   14.38 +#define XENCONS_FULL(ring) (((ring)->prod - (ring)->cons) == XENCONS_RING_SIZE)
   14.39 +
   14.40 +static inline struct ring_head *outring(void)
   14.41 +{
   14.42 +	return machine_to_virt(xen_start_info.console_mfn << PAGE_SHIFT);
   14.43 +}
   14.44 +
   14.45 +static inline struct ring_head *inring(void)
   14.46 +{
   14.47 +	return machine_to_virt(xen_start_info.console_mfn << PAGE_SHIFT)
   14.48 +		+ PAGE_SIZE/2;
   14.49 +}
   14.50 +
   14.51 +
   14.52 +/* don't block -  write as much as possible and return */
   14.53 +static int __xencons_ring_send(struct ring_head *ring, const char *data, unsigned len)
   14.54 +{
   14.55 +	int copied = 0;
   14.56 +
   14.57 +	mb();
   14.58 +	while (copied < len && !XENCONS_FULL(ring)) {
   14.59 +		ring->buf[XENCONS_IDX(ring->prod)] = data[copied];
   14.60 +		ring->prod++;
   14.61 +		copied++;
   14.62 +	}
   14.63 +	mb();
   14.64 +
   14.65 +	return copied;
   14.66 +}
   14.67 +
   14.68 +int xencons_ring_send(const char *data, unsigned len)
   14.69 +{
   14.70 +	struct ring_head *out = outring();
   14.71 +	int sent = 0;
   14.72 +	
   14.73 +	sent = __xencons_ring_send(out, data, len);
   14.74 +	notify_via_evtchn(xen_start_info.console_evtchn);
   14.75 +	return sent;
   14.76 +
   14.77 +}	
   14.78 +
   14.79 +
   14.80 +static xencons_receiver_func *xencons_receiver;
   14.81 +
   14.82 +static irqreturn_t handle_input(int irq, void *unused, struct pt_regs *regs)
   14.83 +{
   14.84 +	struct ring_head *ring = inring();
   14.85 +	while (ring->cons < ring->prod) {
   14.86 +		if (xencons_receiver != NULL) {
   14.87 +			xencons_receiver(ring->buf + XENCONS_IDX(ring->cons),
   14.88 +					 1);
   14.89 +		}
   14.90 +		ring->cons++;
   14.91 +	}
   14.92 +	return IRQ_HANDLED;
   14.93 +}
   14.94 +
   14.95 +void xencons_ring_register_receiver(xencons_receiver_func *f)
   14.96 +{
   14.97 +	xencons_receiver = f;
   14.98 +}
   14.99 +
  14.100 +int xencons_ring_init(void)
  14.101 +{
  14.102 +	int err;
  14.103 +
  14.104 +	if (!xen_start_info.console_evtchn)
  14.105 +		return 0;
  14.106 +
  14.107 +	err = bind_evtchn_to_irqhandler(
  14.108 +		xen_start_info.console_evtchn, handle_input,
  14.109 +		0, "xencons", inring());
  14.110 +	if (err) {
  14.111 +		xprintk(KERN_ERR "XEN console request irq failed %i\n", err);
  14.112 +		unbind_evtchn_from_irq(xen_start_info.console_evtchn);
  14.113 +		return err;
  14.114 +	}
  14.115 +
  14.116 +	return 0;
  14.117 +}
  14.118 +
  14.119 +void xencons_suspend_comms(void)
  14.120 +{
  14.121 +
  14.122 +	if (!xen_start_info.console_evtchn)
  14.123 +		return;
  14.124 +
  14.125 +	unbind_evtchn_from_irqhandler(xen_start_info.console_evtchn, inring());
  14.126 +}
  14.127 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.h	Tue Aug 30 13:36:49 2005 -0700
    15.3 @@ -0,0 +1,13 @@
    15.4 +#ifndef _XENCONS_RING_H
    15.5 +#define _XENCONS_RING_H
    15.6 +
    15.7 +asmlinkage int xprintk(const char *fmt, ...);
    15.8 +
    15.9 +
   15.10 +int xencons_ring_init(void);
   15.11 +int xencons_ring_send(const char *data, unsigned len);
   15.12 +
   15.13 +typedef void (xencons_receiver_func)(char *buf, unsigned len);
   15.14 +void xencons_ring_register_receiver(xencons_receiver_func *f);
   15.15 +
   15.16 +#endif /* _XENCONS_RING_H */
    16.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Mon Aug 29 16:05:29 2005 -0700
    16.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Tue Aug 30 13:36:49 2005 -0700
    16.3 @@ -12,6 +12,7 @@
    16.4  
    16.5  #include "common.h"
    16.6  #include <asm-xen/balloon.h>
    16.7 +#include <asm-xen/xen-public/memory.h>
    16.8  
    16.9  #if defined(CONFIG_XEN_NETDEV_GRANT_TX) || defined(CONFIG_XEN_NETDEV_GRANT_RX)
   16.10  #include <asm-xen/xen-public/grant_table.h>
   16.11 @@ -110,10 +111,16 @@ static spinlock_t mfn_lock = SPIN_LOCK_U
   16.12  static unsigned long alloc_mfn(void)
   16.13  {
   16.14      unsigned long mfn = 0, flags;
   16.15 +    struct xen_memory_reservation reservation = {
   16.16 +        .extent_start = mfn_list,
   16.17 +        .nr_extents   = MAX_MFN_ALLOC,
   16.18 +        .extent_order = 0,
   16.19 +        .domid        = DOMID_SELF
   16.20 +    };
   16.21      spin_lock_irqsave(&mfn_lock, flags);
   16.22      if ( unlikely(alloc_index == 0) )
   16.23 -        alloc_index = HYPERVISOR_dom_mem_op(
   16.24 -            MEMOP_increase_reservation, mfn_list, MAX_MFN_ALLOC, 0);
   16.25 +        alloc_index = HYPERVISOR_memory_op(
   16.26 +            XENMEM_increase_reservation, &reservation);
   16.27      if ( alloc_index != 0 )
   16.28          mfn = mfn_list[--alloc_index];
   16.29      spin_unlock_irqrestore(&mfn_lock, flags);
   16.30 @@ -124,11 +131,17 @@ static unsigned long alloc_mfn(void)
   16.31  static void free_mfn(unsigned long mfn)
   16.32  {
   16.33      unsigned long flags;
   16.34 +    struct xen_memory_reservation reservation = {
   16.35 +        .extent_start = &mfn,
   16.36 +        .nr_extents   = 1,
   16.37 +        .extent_order = 0,
   16.38 +        .domid        = DOMID_SELF
   16.39 +    };
   16.40      spin_lock_irqsave(&mfn_lock, flags);
   16.41      if ( alloc_index != MAX_MFN_ALLOC )
   16.42          mfn_list[alloc_index++] = mfn;
   16.43 -    else if ( HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation,
   16.44 -                                    &mfn, 1, 0) != 1 )
   16.45 +    else if ( HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation)
   16.46 +              != 1 )
   16.47          BUG();
   16.48      spin_unlock_irqrestore(&mfn_lock, flags);
   16.49  }
    17.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Mon Aug 29 16:05:29 2005 -0700
    17.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Aug 30 13:36:49 2005 -0700
    17.3 @@ -50,6 +50,7 @@
    17.4  #include <asm-xen/evtchn.h>
    17.5  #include <asm-xen/xenbus.h>
    17.6  #include <asm-xen/xen-public/io/netif.h>
    17.7 +#include <asm-xen/xen-public/memory.h>
    17.8  #include <asm-xen/balloon.h>
    17.9  #include <asm/page.h>
   17.10  #include <asm/uaccess.h>
   17.11 @@ -328,6 +329,7 @@ static void network_alloc_rx_buffers(str
   17.12      struct sk_buff *skb;
   17.13      int i, batch_target;
   17.14      NETIF_RING_IDX req_prod = np->rx->req_prod;
   17.15 +    struct xen_memory_reservation reservation;
   17.16  #ifdef CONFIG_XEN_NETDEV_GRANT_RX
   17.17      int ref;
   17.18  #endif
   17.19 @@ -388,12 +390,15 @@ static void network_alloc_rx_buffers(str
   17.20      rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL;
   17.21  
   17.22      /* Give away a batch of pages. */
   17.23 -    rx_mcl[i].op = __HYPERVISOR_dom_mem_op;
   17.24 -    rx_mcl[i].args[0] = MEMOP_decrease_reservation;
   17.25 -    rx_mcl[i].args[1] = (unsigned long)rx_pfn_array;
   17.26 -    rx_mcl[i].args[2] = (unsigned long)i;
   17.27 -    rx_mcl[i].args[3] = 0;
   17.28 -    rx_mcl[i].args[4] = DOMID_SELF;
   17.29 +    rx_mcl[i].op = __HYPERVISOR_memory_op;
   17.30 +    rx_mcl[i].args[0] = XENMEM_decrease_reservation;
   17.31 +    rx_mcl[i].args[1] = (unsigned long)&reservation;
   17.32 +
   17.33 +    reservation.extent_start = rx_pfn_array;
   17.34 +    reservation.nr_extents   = i;
   17.35 +    reservation.extent_order = 0;
   17.36 +    reservation.address_bits = 0;
   17.37 +    reservation.domid        = DOMID_SELF;
   17.38  
   17.39      /* Tell the ballon driver what is going on. */
   17.40      balloon_update_driver_allowance(i);
   17.41 @@ -401,7 +406,7 @@ static void network_alloc_rx_buffers(str
   17.42      /* Zap PTEs and give away pages in one big multicall. */
   17.43      (void)HYPERVISOR_multicall(rx_mcl, i+1);
   17.44  
   17.45 -    /* Check return status of HYPERVISOR_dom_mem_op(). */
   17.46 +    /* Check return status of HYPERVISOR_memory_op(). */
   17.47      if (unlikely(rx_mcl[i].result != i))
   17.48          panic("Unable to reduce memory reservation\n");
   17.49  
    18.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Mon Aug 29 16:05:29 2005 -0700
    18.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Aug 30 13:36:49 2005 -0700
    18.3 @@ -66,7 +66,7 @@ static int privcmd_ioctl(struct inode *i
    18.4          {
    18.5              long ign1, ign2, ign3;
    18.6              __asm__ __volatile__ (
    18.7 -                "movq   %5,%%r10; movq %6,%%r8;" TRAP_INSTR
    18.8 +                "movq %8,%%r10; movq %9,%%r8;" TRAP_INSTR
    18.9                  : "=a" (ret), "=D" (ign1), "=S" (ign2), "=d" (ign3)
   18.10                  : "0" ((unsigned long)hypercall.op), 
   18.11                  "1" ((unsigned long)hypercall.arg[0]), 
    19.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Aug 29 16:05:29 2005 -0700
    19.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Aug 30 13:36:49 2005 -0700
    19.3 @@ -209,6 +209,7 @@ int xenbus_register_device(struct xenbus
    19.4  {
    19.5  	return xenbus_register_driver(drv, &xenbus_frontend);
    19.6  }
    19.7 +EXPORT_SYMBOL(xenbus_register_device);
    19.8  
    19.9  int xenbus_register_backend(struct xenbus_driver *drv)
   19.10  {
    20.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Mon Aug 29 16:05:29 2005 -0700
    20.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Tue Aug 30 13:36:49 2005 -0700
    20.3 @@ -45,7 +45,9 @@
    20.4  
    20.5  static char printf_buffer[4096];
    20.6  static LIST_HEAD(watches);
    20.7 +
    20.8  DECLARE_MUTEX(xenbus_lock);
    20.9 +EXPORT_SYMBOL(xenbus_lock);
   20.10  
   20.11  static int get_error(const char *errorstring)
   20.12  {
   20.13 @@ -224,6 +226,7 @@ char **xenbus_directory(const char *dir,
   20.14  		ret[(*num)++] = p;
   20.15  	return ret;
   20.16  }
   20.17 +EXPORT_SYMBOL(xenbus_directory);
   20.18  
   20.19  /* Check if a path exists. Return 1 if it does. */
   20.20  int xenbus_exists(const char *dir, const char *node)
   20.21 @@ -237,6 +240,7 @@ int xenbus_exists(const char *dir, const
   20.22  	kfree(d);
   20.23  	return 1;
   20.24  }
   20.25 +EXPORT_SYMBOL(xenbus_exists);
   20.26  
   20.27  /* Get the value of a single file.
   20.28   * Returns a kmalloced value: call free() on it after use.
   20.29 @@ -246,6 +250,7 @@ void *xenbus_read(const char *dir, const
   20.30  {
   20.31  	return xs_single(XS_READ, join(dir, node), len);
   20.32  }
   20.33 +EXPORT_SYMBOL(xenbus_read);
   20.34  
   20.35  /* Write the value of a single file.
   20.36   * Returns -err on failure.  createflags can be 0, O_CREAT, or O_CREAT|O_EXCL.
   20.37 @@ -276,18 +281,21 @@ int xenbus_write(const char *dir, const 
   20.38  
   20.39  	return xs_error(xs_talkv(XS_WRITE, iovec, ARRAY_SIZE(iovec), NULL));
   20.40  }
   20.41 +EXPORT_SYMBOL(xenbus_write);
   20.42  
   20.43  /* Create a new directory. */
   20.44  int xenbus_mkdir(const char *dir, const char *node)
   20.45  {
   20.46  	return xs_error(xs_single(XS_MKDIR, join(dir, node), NULL));
   20.47  }
   20.48 +EXPORT_SYMBOL(xenbus_mkdir);
   20.49  
   20.50  /* Destroy a file or directory (directories must be empty). */
   20.51  int xenbus_rm(const char *dir, const char *node)
   20.52  {
   20.53  	return xs_error(xs_single(XS_RM, join(dir, node), NULL));
   20.54  }
   20.55 +EXPORT_SYMBOL(xenbus_rm);
   20.56  
   20.57  /* Start a transaction: changes by others will not be seen during this
   20.58   * transaction, and changes will not be visible to others until end.
   20.59 @@ -298,6 +306,7 @@ int xenbus_transaction_start(const char 
   20.60  {
   20.61  	return xs_error(xs_single(XS_TRANSACTION_START, subtree, NULL));
   20.62  }
   20.63 +EXPORT_SYMBOL(xenbus_transaction_start);
   20.64  
   20.65  /* End a transaction.
   20.66   * If abandon is true, transaction is discarded instead of committed.
   20.67 @@ -312,6 +321,7 @@ int xenbus_transaction_end(int abort)
   20.68  		strcpy(abortstr, "T");
   20.69  	return xs_error(xs_single(XS_TRANSACTION_END, abortstr, NULL));
   20.70  }
   20.71 +EXPORT_SYMBOL(xenbus_transaction_end);
   20.72  
   20.73  /* Single read and scanf: returns -errno or num scanned. */
   20.74  int xenbus_scanf(const char *dir, const char *node, const char *fmt, ...)
   20.75 @@ -333,6 +343,7 @@ int xenbus_scanf(const char *dir, const 
   20.76  		return -ERANGE;
   20.77  	return ret;
   20.78  }
   20.79 +EXPORT_SYMBOL(xenbus_scanf);
   20.80  
   20.81  /* Single printf and write: returns -errno or 0. */
   20.82  int xenbus_printf(const char *dir, const char *node, const char *fmt, ...)
   20.83 @@ -348,6 +359,7 @@ int xenbus_printf(const char *dir, const
   20.84  	BUG_ON(ret > sizeof(printf_buffer)-1);
   20.85  	return xenbus_write(dir, node, printf_buffer, O_CREAT);
   20.86  }
   20.87 +EXPORT_SYMBOL(xenbus_printf);
   20.88  
   20.89  /* Report a (negative) errno into the store, with explanation. */
   20.90  void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt, ...)
   20.91 @@ -369,6 +381,7 @@ void xenbus_dev_error(struct xenbus_devi
   20.92  		printk("xenbus: failed to write error node for %s (%s)\n",
   20.93  		       dev->nodename, printf_buffer);
   20.94  }
   20.95 +EXPORT_SYMBOL(xenbus_dev_error);
   20.96  
   20.97  /* Clear any error. */
   20.98  void xenbus_dev_ok(struct xenbus_device *dev)
   20.99 @@ -381,6 +394,7 @@ void xenbus_dev_ok(struct xenbus_device 
  20.100  			dev->has_error = 0;
  20.101  	}
  20.102  }
  20.103 +EXPORT_SYMBOL(xenbus_dev_ok);
  20.104  	
  20.105  /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
  20.106  int xenbus_gather(const char *dir, ...)
  20.107 @@ -410,6 +424,7 @@ int xenbus_gather(const char *dir, ...)
  20.108  	va_end(ap);
  20.109  	return ret;
  20.110  }
  20.111 +EXPORT_SYMBOL(xenbus_gather);
  20.112  
  20.113  static int xs_watch(const char *path, const char *token)
  20.114  {
  20.115 @@ -482,6 +497,7 @@ int register_xenbus_watch(struct xenbus_
  20.116  		list_add(&watch->list, &watches);
  20.117  	return err;
  20.118  }
  20.119 +EXPORT_SYMBOL(register_xenbus_watch);
  20.120  
  20.121  void unregister_xenbus_watch(struct xenbus_watch *watch)
  20.122  {
  20.123 @@ -499,6 +515,7 @@ void unregister_xenbus_watch(struct xenb
  20.124  		       "XENBUS Failed to release watch %s: %i\n",
  20.125  		       watch->node, err);
  20.126  }
  20.127 +EXPORT_SYMBOL(unregister_xenbus_watch);
  20.128  
  20.129  /* Re-register callbacks to all watches. */
  20.130  void reregister_xenbus_watches(void)
    21.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypercall.h	Mon Aug 29 16:05:29 2005 -0700
    21.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypercall.h	Tue Aug 30 13:36:49 2005 -0700
    21.3 @@ -236,12 +236,10 @@ HYPERVISOR_update_descriptor(
    21.4  }
    21.5  
    21.6  static inline int
    21.7 -HYPERVISOR_dom_mem_op(
    21.8 -	unsigned int op, unsigned long *extent_list,
    21.9 -	unsigned long nr_extents, unsigned int extent_order)
   21.10 +HYPERVISOR_memory_op(
   21.11 +	unsigned int cmd, void *arg)
   21.12  {
   21.13 -	return _hypercall5(int, dom_mem_op, op, extent_list,
   21.14 -			   nr_extents, extent_order, DOMID_SELF);
   21.15 +	return _hypercall2(int, memory_op, cmd, arg);
   21.16  }
   21.17  
   21.18  static inline int
    22.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Mon Aug 29 16:05:29 2005 -0700
    22.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypercall.h	Tue Aug 30 13:36:49 2005 -0700
    22.3 @@ -231,12 +231,10 @@ HYPERVISOR_update_descriptor(
    22.4  }
    22.5  
    22.6  static inline int
    22.7 -HYPERVISOR_dom_mem_op(
    22.8 -	unsigned int op, unsigned long *extent_list,
    22.9 -	unsigned long nr_extents, unsigned int extent_order)
   22.10 +HYPERVISOR_memory_op(
   22.11 +	unsigned int cmd, void *arg)
   22.12  {
   22.13 -	return _hypercall5(int, dom_mem_op, op, extent_list,
   22.14 -			   nr_extents, extent_order, DOMID_SELF);
   22.15 +	return _hypercall2(int, memory_op, cmd, arg);
   22.16  }
   22.17  
   22.18  static inline int
    23.1 --- a/tools/Makefile	Mon Aug 29 16:05:29 2005 -0700
    23.2 +++ b/tools/Makefile	Tue Aug 30 13:36:49 2005 -0700
    23.3 @@ -7,15 +7,19 @@ SUBDIRS += xenstore
    23.4  SUBDIRS += misc
    23.5  SUBDIRS += examples
    23.6  SUBDIRS += xentrace
    23.7 -SUBDIRS += python
    23.8  SUBDIRS += xcs
    23.9  SUBDIRS += xcutils
   23.10 -#SUBDIRS += pygrub
   23.11  SUBDIRS += firmware
   23.12  SUBDIRS += security
   23.13  SUBDIRS += console
   23.14  SUBDIRS += xenstat
   23.15  
   23.16 +# These don't cross-compile
   23.17 +ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
   23.18 +SUBDIRS += python
   23.19 +#SUBDIRS += pygrub
   23.20 +endif
   23.21 +
   23.22  .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
   23.23  
   23.24  all: check
    24.1 --- a/tools/console/Makefile	Mon Aug 29 16:05:29 2005 -0700
    24.2 +++ b/tools/console/Makefile	Tue Aug 30 13:36:49 2005 -0700
    24.3 @@ -9,8 +9,7 @@ INSTALL         = install
    24.4  INSTALL_PROG    = $(INSTALL) -m0755
    24.5  INSTALL_DIR     = $(INSTALL) -d -m0755
    24.6  
    24.7 -CC       = gcc
    24.8 -CFLAGS   = -Wall -Werror -g3
    24.9 +CFLAGS  += -Wall -Werror -g3
   24.10  
   24.11  CFLAGS  += -I $(XEN_XCS)
   24.12  CFLAGS  += -I $(XEN_LIBXC)
    25.1 --- a/tools/console/daemon/io.c	Mon Aug 29 16:05:29 2005 -0700
    25.2 +++ b/tools/console/daemon/io.c	Tue Aug 30 13:36:49 2005 -0700
    25.3 @@ -36,6 +36,9 @@
    25.4  #include <fcntl.h>
    25.5  #include <unistd.h>
    25.6  #include <termios.h>
    25.7 +#include <stdarg.h>
    25.8 +#include <sys/ioctl.h>
    25.9 +#include <sys/mman.h>
   25.10  
   25.11  #define MAX(a, b) (((a) > (b)) ? (a) : (b))
   25.12  #define MIN(a, b) (((a) < (b)) ? (a) : (b))
   25.13 @@ -48,26 +51,67 @@ struct buffer
   25.14  	size_t max_capacity;
   25.15  };
   25.16  
   25.17 -static void buffer_append(struct buffer *buffer, const void *data, size_t size)
   25.18 +struct domain
   25.19  {
   25.20 -	if ((buffer->capacity - buffer->size) < size) {
   25.21 -		buffer->capacity += (size + 1024);
   25.22 -		buffer->data = realloc(buffer->data, buffer->capacity);
   25.23 -		if (buffer->data == NULL) {
   25.24 -			dolog(LOG_ERR, "Memory allocation failed");
   25.25 -			exit(ENOMEM);
   25.26 +	int domid;
   25.27 +	int tty_fd;
   25.28 +	bool is_dead;
   25.29 +	struct buffer buffer;
   25.30 +	struct domain *next;
   25.31 +	unsigned long mfn;
   25.32 +	int local_port;
   25.33 +	int remote_port;
   25.34 +	char *page;
   25.35 +	int evtchn_fd;
   25.36 +};
   25.37 +
   25.38 +static struct domain *dom_head;
   25.39 +
   25.40 +struct ring_head
   25.41 +{
   25.42 +	u32 cons;
   25.43 +	u32 prod;
   25.44 +	char buf[0];
   25.45 +} __attribute__((packed));
   25.46 +
   25.47 +#define PAGE_SIZE (getpagesize())
   25.48 +#define XENCONS_RING_SIZE (PAGE_SIZE/2 - sizeof (struct ring_head))
   25.49 +#define XENCONS_IDX(cnt) ((cnt) % XENCONS_RING_SIZE)
   25.50 +#define XENCONS_FULL(ring) (((ring)->prod - (ring)->cons) == XENCONS_RING_SIZE)
   25.51 +#define XENCONS_SPACE(ring) (XENCONS_RING_SIZE - ((ring)->prod - (ring)->cons))
   25.52 +
   25.53 +static void buffer_append(struct domain *dom)
   25.54 +{
   25.55 +	struct buffer *buffer = &dom->buffer;
   25.56 +	struct ring_head *ring = (struct ring_head *)dom->page;
   25.57 +	size_t size;
   25.58 +
   25.59 +	while ((size = ring->prod - ring->cons) != 0) {
   25.60 +		if ((buffer->capacity - buffer->size) < size) {
   25.61 +			buffer->capacity += (size + 1024);
   25.62 +			buffer->data = realloc(buffer->data, buffer->capacity);
   25.63 +			if (buffer->data == NULL) {
   25.64 +				dolog(LOG_ERR, "Memory allocation failed");
   25.65 +				exit(ENOMEM);
   25.66 +			}
   25.67  		}
   25.68 -	}
   25.69 -
   25.70 -	memcpy(buffer->data + buffer->size, data, size);
   25.71 -	buffer->size += size;
   25.72  
   25.73 -	if (buffer->max_capacity &&
   25.74 -	    buffer->size > buffer->max_capacity) {
   25.75 -		memmove(buffer->data + (buffer->size - buffer->max_capacity),
   25.76 -			buffer->data, buffer->max_capacity);
   25.77 -		buffer->data = realloc(buffer->data, buffer->max_capacity);
   25.78 -		buffer->capacity = buffer->max_capacity;
   25.79 +		while (ring->cons < ring->prod) {
   25.80 +			buffer->data[buffer->size] =
   25.81 +				ring->buf[XENCONS_IDX(ring->cons)];
   25.82 +			buffer->size++;
   25.83 +			ring->cons++;
   25.84 +		}
   25.85 +
   25.86 +		if (buffer->max_capacity &&
   25.87 +		    buffer->size > buffer->max_capacity) {
   25.88 +			memmove(buffer->data + (buffer->size -
   25.89 +						buffer->max_capacity),
   25.90 +				buffer->data, buffer->max_capacity);
   25.91 +			buffer->data = realloc(buffer->data,
   25.92 +					       buffer->max_capacity);
   25.93 +			buffer->capacity = buffer->max_capacity;
   25.94 +		}
   25.95  	}
   25.96  }
   25.97  
   25.98 @@ -83,17 +127,6 @@ static void buffer_advance(struct buffer
   25.99  	buffer->size -= size;
  25.100  }
  25.101  
  25.102 -struct domain
  25.103 -{
  25.104 -	int domid;
  25.105 -	int tty_fd;
  25.106 -	bool is_dead;
  25.107 -	struct buffer buffer;
  25.108 -	struct domain *next;
  25.109 -};
  25.110 -
  25.111 -static struct domain *dom_head;
  25.112 -
  25.113  static bool domain_is_valid(int domid)
  25.114  {
  25.115  	bool ret;
  25.116 @@ -107,7 +140,7 @@ static bool domain_is_valid(int domid)
  25.117  
  25.118  static int domain_create_tty(struct domain *dom)
  25.119  {
  25.120 -	char path[1024];
  25.121 +	char *path;
  25.122  	int master;
  25.123  
  25.124  	if ((master = getpt()) == -1 ||
  25.125 @@ -126,24 +159,108 @@ static int domain_create_tty(struct doma
  25.126  			tcsetattr(master, TCSAFLUSH, &term);
  25.127  		}
  25.128  
  25.129 -		xs_mkdir(xs, "/console");
  25.130 -		snprintf(path, sizeof(path), "/console/%d", dom->domid);
  25.131 -		xs_mkdir(xs, path);
  25.132 -		strcat(path, "/tty");
  25.133 +		asprintf(&path, "/console/%d/tty", dom->domid);
  25.134 +		xs_write(xs, path, slave, strlen(slave), O_CREAT);
  25.135 +		free(path);
  25.136  
  25.137 -		xs_write(xs, path, slave, strlen(slave), O_CREAT);
  25.138 -
  25.139 -		snprintf(path, sizeof(path), "/console/%d/limit", dom->domid);
  25.140 +		asprintf(&path, "/console/%d/limit", dom->domid);
  25.141  		data = xs_read(xs, path, &len);
  25.142  		if (data) {
  25.143  			dom->buffer.max_capacity = strtoul(data, 0, 0);
  25.144  			free(data);
  25.145  		}
  25.146 +		free(path);
  25.147  	}
  25.148  
  25.149  	return master;
  25.150  }
  25.151  
  25.152 +/* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
  25.153 +int xs_gather(struct xs_handle *xs, const char *dir, ...)
  25.154 +{
  25.155 +	va_list ap;
  25.156 +	const char *name;
  25.157 +	char *path;
  25.158 +	int ret = 0;
  25.159 +
  25.160 +	va_start(ap, dir);
  25.161 +	while (ret == 0 && (name = va_arg(ap, char *)) != NULL) {
  25.162 +		const char *fmt = va_arg(ap, char *);
  25.163 +		void *result = va_arg(ap, void *);
  25.164 +		char *p;
  25.165 +
  25.166 +		asprintf(&path, "%s/%s", dir, name);
  25.167 +		p = xs_read(xs, path, NULL);
  25.168 +		free(path);
  25.169 +		if (p == NULL) {
  25.170 +			ret = ENOENT;
  25.171 +			break;
  25.172 +		}
  25.173 +		if (fmt) {
  25.174 +			if (sscanf(p, fmt, result) == 0)
  25.175 +				ret = EINVAL;
  25.176 +			free(p);
  25.177 +		} else
  25.178 +			*(char **)result = p;
  25.179 +	}
  25.180 +	va_end(ap);
  25.181 +	return ret;
  25.182 +}
  25.183 +
  25.184 +#define EVENTCHN_BIND		_IO('E', 2)
  25.185 +#define EVENTCHN_UNBIND 	_IO('E', 3)
  25.186 +
  25.187 +static int domain_create_ring(struct domain *dom)
  25.188 +{
  25.189 +	char *dompath, *path;
  25.190 +	int err;
  25.191 +
  25.192 +	dom->page = NULL;
  25.193 +	dom->evtchn_fd = -1;
  25.194 +
  25.195 +	asprintf(&path, "/console/%d/domain", dom->domid);
  25.196 +	dompath = xs_read(xs, path, NULL);
  25.197 +	free(path);
  25.198 +	if (!dompath)
  25.199 +		return ENOENT;
  25.200 +
  25.201 +	err = xs_gather(xs, dompath,
  25.202 +			"console_mfn", "%li", &dom->mfn,
  25.203 +			"console_channel/port1", "%i", &dom->local_port,
  25.204 +			"console_channel/port2", "%i", &dom->remote_port,
  25.205 +			NULL);
  25.206 +	if (err)
  25.207 +		goto out;
  25.208 +
  25.209 +	dom->page = xc_map_foreign_range(xc, dom->domid, getpagesize(),
  25.210 +					 PROT_READ|PROT_WRITE, dom->mfn);
  25.211 +	if (dom->page == NULL) {
  25.212 +		err = EINVAL;
  25.213 +		goto out;
  25.214 +	}
  25.215 +
  25.216 +	/* Opening evtchn independently for each console is a bit
  25.217 +	 * wastefule, but that's how the code is structured... */
  25.218 +	err = open("/dev/xen/evtchn", O_RDWR);
  25.219 +	if (err == -1) {
  25.220 +		err = errno;
  25.221 +		goto out;
  25.222 +	}
  25.223 +	dom->evtchn_fd = err;
  25.224 +
  25.225 +	if (ioctl(dom->evtchn_fd, EVENTCHN_BIND, dom->local_port) == -1) {
  25.226 +		err = errno;
  25.227 +		munmap(dom->page, getpagesize());
  25.228 +		close(dom->evtchn_fd);
  25.229 +		dom->evtchn_fd = -1;
  25.230 +		goto out;
  25.231 +	}
  25.232 +
  25.233 + out:
  25.234 +	free(dompath);
  25.235 +	return err;
  25.236 +}
  25.237 +
  25.238  static struct domain *create_domain(int domid)
  25.239  {
  25.240  	struct domain *dom;
  25.241 @@ -162,7 +279,9 @@ static struct domain *create_domain(int 
  25.242  	dom->buffer.size = 0;
  25.243  	dom->buffer.capacity = 0;
  25.244  	dom->buffer.max_capacity = 0;
  25.245 -	dom->next = 0;
  25.246 +	dom->next = NULL;
  25.247 +
  25.248 +	domain_create_ring(dom);
  25.249  
  25.250  	dolog(LOG_DEBUG, "New domain %d", domid);
  25.251  
  25.252 @@ -200,9 +319,14 @@ static void remove_domain(struct domain 
  25.253  
  25.254  		if (dom->domid == d->domid) {
  25.255  			*pp = d->next;
  25.256 -			if (d->buffer.data) {
  25.257 +			if (d->buffer.data)
  25.258  				free(d->buffer.data);
  25.259 -			}
  25.260 +			if (d->page)
  25.261 +				munmap(d->page, getpagesize());
  25.262 +			if (d->evtchn_fd != -1)
  25.263 +				close(d->evtchn_fd);
  25.264 +			if (d->tty_fd != -1)
  25.265 +				close(d->tty_fd);
  25.266  			free(d);
  25.267  			break;
  25.268  		}
  25.269 @@ -211,28 +335,28 @@ static void remove_domain(struct domain 
  25.270  
  25.271  static void remove_dead_domains(struct domain *dom)
  25.272  {
  25.273 -	if (dom == NULL) return;
  25.274 -	remove_dead_domains(dom->next);
  25.275 +	struct domain *n;
  25.276  
  25.277 -	if (dom->is_dead) {
  25.278 -		remove_domain(dom);
  25.279 +	while (dom != NULL) {
  25.280 +		n = dom->next;
  25.281 +		if (dom->is_dead)
  25.282 +			remove_domain(dom);
  25.283 +		dom = n;
  25.284  	}
  25.285  }
  25.286  
  25.287  static void handle_tty_read(struct domain *dom)
  25.288  {
  25.289  	ssize_t len;
  25.290 -	xcs_msg_t msg;
  25.291 +	char msg[80];
  25.292 +	struct ring_head *inring =
  25.293 +		(struct ring_head *)(dom->page + PAGE_SIZE/2);
  25.294 +	int i;
  25.295  
  25.296 -	msg.type = XCS_REQUEST;
  25.297 -	msg.u.control.remote_dom = dom->domid;
  25.298 -	msg.u.control.msg.type = CMSG_CONSOLE;
  25.299 -	msg.u.control.msg.subtype = CMSG_CONSOLE_DATA;
  25.300 -	msg.u.control.msg.id = 1;
  25.301 -
  25.302 -	len = read(dom->tty_fd, msg.u.control.msg.msg, 60);
  25.303 +	len = read(dom->tty_fd, msg, MAX(XENCONS_SPACE(inring), sizeof(msg)));
  25.304  	if (len < 1) {
  25.305  		close(dom->tty_fd);
  25.306 +		dom->tty_fd = -1;
  25.307  
  25.308  		if (domain_is_valid(dom->domid)) {
  25.309  			dom->tty_fd = domain_create_tty(dom);
  25.310 @@ -240,14 +364,14 @@ static void handle_tty_read(struct domai
  25.311  			dom->is_dead = true;
  25.312  		}
  25.313  	} else if (domain_is_valid(dom->domid)) {
  25.314 -		msg.u.control.msg.length = len;
  25.315 -
  25.316 -		if (!write_sync(xcs_data_fd, &msg, sizeof(msg))) {
  25.317 -			dolog(LOG_ERR, "Write to xcs failed: %m");
  25.318 -			exit(1);
  25.319 +		for (i = 0; i < len; i++) {
  25.320 +			inring->buf[XENCONS_IDX(inring->prod)] = msg[i];
  25.321 +			inring->prod++;
  25.322  		}
  25.323 +		xc_evtchn_send(xc, dom->local_port);
  25.324  	} else {
  25.325  		close(dom->tty_fd);
  25.326 +		dom->tty_fd = -1;
  25.327  		dom->is_dead = true;
  25.328  	}
  25.329  }
  25.330 @@ -259,6 +383,7 @@ static void handle_tty_write(struct doma
  25.331  	len = write(dom->tty_fd, dom->buffer.data, dom->buffer.size);
  25.332  	if (len < 1) {
  25.333  		close(dom->tty_fd);
  25.334 +		dom->tty_fd = -1;
  25.335  
  25.336  		if (domain_is_valid(dom->domid)) {
  25.337  			dom->tty_fd = domain_create_tty(dom);
  25.338 @@ -270,6 +395,18 @@ static void handle_tty_write(struct doma
  25.339  	}
  25.340  }
  25.341  
  25.342 +static void handle_ring_read(struct domain *dom)
  25.343 +{
  25.344 +	u16 v;
  25.345 +
  25.346 +	if (!read_sync(dom->evtchn_fd, &v, sizeof(v)))
  25.347 +		return;
  25.348 +
  25.349 +	buffer_append(dom);
  25.350 +
  25.351 +	(void)write_sync(dom->evtchn_fd, &v, sizeof(v));
  25.352 +}
  25.353 +
  25.354  static void handle_xcs_msg(int fd)
  25.355  {
  25.356  	xcs_msg_t msg;
  25.357 @@ -277,13 +414,6 @@ static void handle_xcs_msg(int fd)
  25.358  	if (!read_sync(fd, &msg, sizeof(msg))) {
  25.359  		dolog(LOG_ERR, "read from xcs failed! %m");
  25.360  		exit(1);
  25.361 -	} else if (msg.type == XCS_REQUEST) {
  25.362 -		struct domain *dom;
  25.363 -
  25.364 -		dom = lookup_domain(msg.u.control.remote_dom);
  25.365 -		buffer_append(&dom->buffer,
  25.366 -			      msg.u.control.msg.msg,
  25.367 -			      msg.u.control.msg.length);
  25.368  	}
  25.369  }
  25.370  
  25.371 @@ -291,9 +421,12 @@ static void enum_domains(void)
  25.372  {
  25.373  	int domid = 0;
  25.374  	xc_dominfo_t dominfo;
  25.375 +	struct domain *dom;
  25.376  
  25.377  	while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) {
  25.378 -		lookup_domain(dominfo.domid);
  25.379 +		dom = lookup_domain(dominfo.domid);
  25.380 +		if (dominfo.dying || dominfo.crashed || dominfo.shutdown)
  25.381 +			dom->is_dead = true;
  25.382  		domid = dominfo.domid + 1;
  25.383  	}
  25.384  }
  25.385 @@ -302,12 +435,11 @@ void handle_io(void)
  25.386  {
  25.387  	fd_set readfds, writefds;
  25.388  	int ret;
  25.389 -	int max_fd = -1;
  25.390 -	int num_of_writes = 0;
  25.391  
  25.392  	do {
  25.393  		struct domain *d;
  25.394  		struct timeval tv = { 1, 0 };
  25.395 +		int max_fd = -1;
  25.396  
  25.397  		FD_ZERO(&readfds);
  25.398  		FD_ZERO(&writefds);
  25.399 @@ -319,42 +451,36 @@ void handle_io(void)
  25.400  			if (d->tty_fd != -1) {
  25.401  				FD_SET(d->tty_fd, &readfds);
  25.402  			}
  25.403 +			if (d->evtchn_fd != -1)
  25.404 +				FD_SET(d->evtchn_fd, &readfds);
  25.405  
  25.406  			if (d->tty_fd != -1 && !buffer_empty(&d->buffer)) {
  25.407  				FD_SET(d->tty_fd, &writefds);
  25.408  			}
  25.409  
  25.410  			max_fd = MAX(d->tty_fd, max_fd);
  25.411 +			max_fd = MAX(d->evtchn_fd, max_fd);
  25.412  		}
  25.413  
  25.414  		ret = select(max_fd + 1, &readfds, &writefds, 0, &tv);
  25.415 -		if (tv.tv_sec == 1 && (++num_of_writes % 100) == 0) {
  25.416 -#if 0
  25.417 -			/* FIXME */
  25.418 -			/* This is a nasty hack.  xcs does not handle the
  25.419 -			   control channels filling up well at all.  We'll
  25.420 -			   throttle ourselves here since we do proper
  25.421 -			   queueing to give the domains a shot at pulling out
  25.422 -			   the data.  Fixing xcs is not worth it as it's
  25.423 -			   going away */
  25.424 -			tv.tv_usec = 1000;
  25.425 -			select(0, 0, 0, 0, &tv);
  25.426 -#endif
  25.427 -		}
  25.428  		enum_domains();
  25.429  
  25.430 -		if (FD_ISSET(xcs_data_fd, &readfds)) {
  25.431 +		if (FD_ISSET(xcs_data_fd, &readfds))
  25.432  			handle_xcs_msg(xcs_data_fd);
  25.433 -		}
  25.434  
  25.435  		for (d = dom_head; d; d = d->next) {
  25.436 -			if (!d->is_dead && FD_ISSET(d->tty_fd, &readfds)) {
  25.437 +			if (d->is_dead || d->tty_fd == -1 ||
  25.438 +			    d->evtchn_fd == -1)
  25.439 +				continue;
  25.440 +
  25.441 +			if (FD_ISSET(d->tty_fd, &readfds))
  25.442  				handle_tty_read(d);
  25.443 -			}
  25.444  
  25.445 -			if (!d->is_dead && FD_ISSET(d->tty_fd, &writefds)) {
  25.446 +			if (FD_ISSET(d->evtchn_fd, &readfds))
  25.447 +				handle_ring_read(d);
  25.448 +
  25.449 +			if (FD_ISSET(d->tty_fd, &writefds))
  25.450  				handle_tty_write(d);
  25.451 -			}
  25.452  		}
  25.453  
  25.454  		remove_dead_domains(dom_head);
    26.1 --- a/tools/console/daemon/utils.c	Mon Aug 29 16:05:29 2005 -0700
    26.2 +++ b/tools/console/daemon/utils.c	Tue Aug 30 13:36:49 2005 -0700
    26.3 @@ -226,14 +226,10 @@ bool xen_setup(void)
    26.4  		goto out_close_data;
    26.5  	}
    26.6  
    26.7 -	/* Since the vast majority of control messages are console messages
    26.8 -	   it's just easier to ignore other messages that try to bind to 
    26.9 -	   a specific type. */
   26.10 -	msg.type = XCS_MSG_BIND;
   26.11 -	msg.u.bind.port = PORT_WILDCARD;
   26.12 -	msg.u.bind.type = TYPE_WILDCARD;
   26.13 +	msg.type = XCS_VIRQ_BIND;
   26.14 +	msg.u.virq.virq = VIRQ_DOM_EXC;
   26.15  	if (!xcs_send_recv(xcs_ctrl_fd, &msg) || msg.result != XCS_RSLT_OK) {
   26.16 -		dolog(LOG_ERR, "xcs vind failed.  Possible bug.");
   26.17 +		dolog(LOG_ERR, "xcs virq bind failed.  Possible bug.");
   26.18  		goto out_close_data;
   26.19  	}
   26.20  	
    27.1 --- a/tools/examples/Makefile	Mon Aug 29 16:05:29 2005 -0700
    27.2 +++ b/tools/examples/Makefile	Tue Aug 30 13:36:49 2005 -0700
    27.3 @@ -1,3 +1,6 @@
    27.4 +XEN_ROOT = ../../
    27.5 +include $(XEN_ROOT)/tools/Rules.mk
    27.6 +
    27.7  INSTALL		= install
    27.8  INSTALL_DIR	= $(INSTALL) -d -m0755
    27.9  INSTALL_PROG	= $(INSTALL) -m0755
    28.1 --- a/tools/libxc/xc_core.c	Mon Aug 29 16:05:29 2005 -0700
    28.2 +++ b/tools/libxc/xc_core.c	Tue Aug 30 13:36:49 2005 -0700
    28.3 @@ -2,6 +2,7 @@
    28.4  #define ELFSIZE 32
    28.5  #include "xc_elf.h"
    28.6  #include <stdlib.h>
    28.7 +#include <unistd.h>
    28.8  #include <zlib.h>
    28.9  
   28.10  /* number of pages to write at a time */
    29.1 --- a/tools/libxc/xc_domain.c	Mon Aug 29 16:05:29 2005 -0700
    29.2 +++ b/tools/libxc/xc_domain.c	Tue Aug 30 13:36:49 2005 -0700
    29.3 @@ -7,6 +7,7 @@
    29.4   */
    29.5  
    29.6  #include "xc_private.h"
    29.7 +#include <xen/memory.h>
    29.8  
    29.9  int xc_domain_create(int xc_handle,
   29.10                       u32 ssidref,
   29.11 @@ -265,9 +266,13 @@ int xc_domain_memory_increase_reservatio
   29.12  {
   29.13      int err;
   29.14      unsigned int npages = mem_kb / (PAGE_SIZE/1024);
   29.15 +    struct xen_memory_reservation reservation = {
   29.16 +        .nr_extents   = npages,
   29.17 +        .extent_order = 0,
   29.18 +        .domid        = domid
   29.19 +    };
   29.20  
   29.21 -    err = xc_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
   29.22 -                        npages, 0, domid);
   29.23 +    err = xc_memory_op(xc_handle, XENMEM_increase_reservation, &reservation);
   29.24      if (err == npages)
   29.25          return 0;
   29.26  
    30.1 --- a/tools/libxc/xc_linux_build.c	Mon Aug 29 16:05:29 2005 -0700
    30.2 +++ b/tools/libxc/xc_linux_build.c	Tue Aug 30 13:36:49 2005 -0700
    30.3 @@ -17,6 +17,7 @@
    30.4  #include "xc_elf.h"
    30.5  #include "xc_aout9.h"
    30.6  #include <stdlib.h>
    30.7 +#include <unistd.h>
    30.8  #include <zlib.h>
    30.9  
   30.10  #if defined(__i386__)
   30.11 @@ -335,7 +336,8 @@ static int setup_guest(int xc_handle,
   30.12                         unsigned int control_evtchn,
   30.13                         unsigned long flags,
   30.14                         unsigned int vcpus,
   30.15 -		       unsigned int store_evtchn, unsigned long *store_mfn)
   30.16 +		       unsigned int store_evtchn, unsigned long *store_mfn,
   30.17 +		       unsigned int console_evtchn, unsigned long *console_mfn)
   30.18  {
   30.19      unsigned long *page_array = NULL;
   30.20      unsigned long count, i;
   30.21 @@ -358,6 +360,8 @@ static int setup_guest(int xc_handle,
   30.22      unsigned long vstartinfo_end;
   30.23      unsigned long vstoreinfo_start;
   30.24      unsigned long vstoreinfo_end;
   30.25 +    unsigned long vconsole_start;
   30.26 +    unsigned long vconsole_end;
   30.27      unsigned long vstack_start;
   30.28      unsigned long vstack_end;
   30.29      unsigned long vpt_start;
   30.30 @@ -393,7 +397,9 @@ static int setup_guest(int xc_handle,
   30.31      vphysmap_end     = vphysmap_start + (nr_pages * sizeof(unsigned long));
   30.32      vstoreinfo_start = round_pgup(vphysmap_end);
   30.33      vstoreinfo_end   = vstoreinfo_start + PAGE_SIZE;
   30.34 -    vpt_start        = vstoreinfo_end; 
   30.35 +    vconsole_start   = vstoreinfo_end;
   30.36 +    vconsole_end     = vstoreinfo_end + PAGE_SIZE;
   30.37 +    vpt_start        = vconsole_end; 
   30.38  
   30.39      for ( nr_pt_pages = 2; ; nr_pt_pages++ )
   30.40      {
   30.41 @@ -437,6 +443,7 @@ static int setup_guest(int xc_handle,
   30.42             " Init. ramdisk: %p->%p\n"
   30.43             " Phys-Mach map: %p->%p\n"
   30.44             " Store page:    %p->%p\n"
   30.45 +           " Console page:  %p->%p\n"
   30.46             " Page tables:   %p->%p\n"
   30.47             " Start info:    %p->%p\n"
   30.48             " Boot stack:    %p->%p\n"
   30.49 @@ -445,6 +452,7 @@ static int setup_guest(int xc_handle,
   30.50             _p(vinitrd_start), _p(vinitrd_end),
   30.51             _p(vphysmap_start), _p(vphysmap_end),
   30.52             _p(vstoreinfo_start), _p(vstoreinfo_end),
   30.53 +           _p(vconsole_start), _p(vconsole_end),
   30.54             _p(vpt_start), _p(vpt_end),
   30.55             _p(vstartinfo_start), _p(vstartinfo_end),
   30.56             _p(vstack_start), _p(vstack_end),
   30.57 @@ -566,6 +574,8 @@ static int setup_guest(int xc_handle,
   30.58  #endif
   30.59  
   30.60      *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
   30.61 +    *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT];
   30.62 +
   30.63  
   30.64      start_info = xc_map_foreign_range(
   30.65          xc_handle, dom, PAGE_SIZE, PROT_READ|PROT_WRITE,
   30.66 @@ -580,6 +590,8 @@ static int setup_guest(int xc_handle,
   30.67      start_info->domain_controller_evtchn = control_evtchn;
   30.68      start_info->store_mfn    = *store_mfn;
   30.69      start_info->store_evtchn = store_evtchn;
   30.70 +    start_info->console_mfn   = *console_mfn;
   30.71 +    start_info->console_evtchn = console_evtchn;
   30.72      if ( initrd_len != 0 )
   30.73      {
   30.74          start_info->mod_start    = vinitrd_start;
   30.75 @@ -631,7 +643,9 @@ int xc_linux_build(int xc_handle,
   30.76                     unsigned long flags,
   30.77                     unsigned int vcpus,
   30.78                     unsigned int store_evtchn,
   30.79 -                   unsigned long *store_mfn)
   30.80 +                   unsigned long *store_mfn,
   30.81 +                   unsigned int console_evtchn,
   30.82 +                   unsigned long *console_mfn)
   30.83  {
   30.84      dom0_op_t launch_op, op;
   30.85      int initrd_fd = -1;
   30.86 @@ -707,7 +721,8 @@ int xc_linux_build(int xc_handle,
   30.87                       &vstack_start, ctxt, cmdline,
   30.88                       op.u.getdomaininfo.shared_info_frame,
   30.89                       control_evtchn, flags, vcpus,
   30.90 -                     store_evtchn, store_mfn) < 0 )
   30.91 +                     store_evtchn, store_mfn,
   30.92 +		     console_evtchn, console_mfn) < 0 )
   30.93      {
   30.94          ERROR("Error constructing guest OS");
   30.95          goto error_out;
    31.1 --- a/tools/libxc/xc_linux_restore.c	Mon Aug 29 16:05:29 2005 -0700
    31.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Aug 30 13:36:49 2005 -0700
    31.3 @@ -8,24 +8,23 @@
    31.4  
    31.5  #include <stdlib.h>
    31.6  #include <unistd.h>
    31.7 -
    31.8  #include "xg_private.h"
    31.9  #include <xenctrl.h>
   31.10 -
   31.11  #include <xen/linux/suspend.h>
   31.12 +#include <xen/memory.h>
   31.13  
   31.14  #define MAX_BATCH_SIZE 1024
   31.15  
   31.16  #define DEBUG 0
   31.17  
   31.18  #if 1
   31.19 -#define ERR(_f, _a...) fprintf ( stderr, _f , ## _a ); fflush(stderr)
   31.20 +#define ERR(_f, _a...) do { fprintf ( stderr, _f , ## _a ); fflush(stderr); } while(0)
   31.21  #else
   31.22  #define ERR(_f, _a...) ((void)0)
   31.23  #endif
   31.24  
   31.25  #if DEBUG
   31.26 -#define DPRINTF(_f, _a...) fprintf ( stdout, _f , ## _a ); fflush(stdout)
   31.27 +#define DPRINTF(_f, _a...) do { fprintf ( stdout, _f , ## _a ); fflush(stdout); } while (0)
   31.28  #else
   31.29  #define DPRINTF(_f, _a...) ((void)0)
   31.30  #endif
   31.31 @@ -103,7 +102,7 @@ int xc_linux_restore(int xc_handle, int 
   31.32      struct mmuext_op pin[MAX_PIN_BATCH];
   31.33      unsigned int nr_pins = 0;
   31.34  
   31.35 -    DPRINTF("xc_linux_restore start\n");
   31.36 +    DPRINTF("xc_linux_restore start: nr_pfns = %lx\n", nr_pfns);
   31.37  
   31.38      if (mlock(&ctxt, sizeof(ctxt))) {
   31.39          /* needed for when we do the build dom0 op, 
   31.40 @@ -152,6 +151,8 @@ int xc_linux_restore(int xc_handle, int 
   31.41      err = xc_domain_memory_increase_reservation(xc_handle, dom,
   31.42                                                  nr_pfns * PAGE_SIZE / 1024);
   31.43      if (err != 0) {
   31.44 +        ERR("Failed to increate reservation by %lx\n", 
   31.45 +            nr_pfns * PAGE_SIZE / 1024); 
   31.46          errno = ENOMEM;
   31.47          goto out;
   31.48      }
   31.49 @@ -409,7 +410,8 @@ int xc_linux_restore(int xc_handle, int 
   31.50  
   31.51      /* Get the list of PFNs that are not in the psuedo-phys map */
   31.52      {
   31.53 -	unsigned int count, *pfntab;
   31.54 +	unsigned int count;
   31.55 +        unsigned long *pfntab;
   31.56  	int rc;
   31.57  
   31.58  	if ( read_exact(io_fd, &count, sizeof(count)) != sizeof(count) )
   31.59 @@ -441,9 +443,15 @@ int xc_linux_restore(int xc_handle, int 
   31.60  
   31.61  	if ( count > 0 )
   31.62  	{
   31.63 -	    if ( (rc = xc_dom_mem_op( xc_handle,
   31.64 -				       MEMOP_decrease_reservation,
   31.65 -				       pfntab, count, 0, dom )) <0 )
   31.66 +            struct xen_memory_reservation reservation = {
   31.67 +                .extent_start = pfntab,
   31.68 +                .nr_extents   = count,
   31.69 +                .extent_order = 0,
   31.70 +                .domid        = dom
   31.71 +            };
   31.72 +	    if ( (rc = xc_memory_op(xc_handle,
   31.73 +                                    XENMEM_decrease_reservation,
   31.74 +                                    &reservation)) != count )
   31.75  	    {
   31.76  		ERR("Could not decrease reservation : %d",rc);
   31.77  		goto out;
    32.1 --- a/tools/libxc/xc_private.c	Mon Aug 29 16:05:29 2005 -0700
    32.2 +++ b/tools/libxc/xc_private.c	Tue Aug 30 13:36:49 2005 -0700
    32.3 @@ -6,6 +6,7 @@
    32.4  
    32.5  #include <zlib.h>
    32.6  #include "xc_private.h"
    32.7 +#include <xen/memory.h>
    32.8  
    32.9  void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
   32.10                             unsigned long *arr, int num )
   32.11 @@ -187,28 +188,43 @@ int xc_finish_mmu_updates(int xc_handle,
   32.12      return flush_mmu_updates(xc_handle, mmu);
   32.13  }
   32.14  
   32.15 -int xc_dom_mem_op(int xc_handle,
   32.16 -		  unsigned int memop, 
   32.17 -		  unsigned int *extent_list, 
   32.18 -		  unsigned int nr_extents,
   32.19 -		  unsigned int extent_order,
   32.20 -		  domid_t domid)
   32.21 +int xc_memory_op(int xc_handle,
   32.22 +                 int cmd,
   32.23 +                 void *arg)
   32.24  {
   32.25      privcmd_hypercall_t hypercall;
   32.26 +    struct xen_memory_reservation *reservation = arg;
   32.27      long ret = -EINVAL;
   32.28  
   32.29 -    hypercall.op     = __HYPERVISOR_dom_mem_op;
   32.30 -    hypercall.arg[0] = (unsigned long)memop;
   32.31 -    hypercall.arg[1] = (unsigned long)extent_list;
   32.32 -    hypercall.arg[2] = (unsigned long)nr_extents;
   32.33 -    hypercall.arg[3] = (unsigned long)extent_order;
   32.34 -    hypercall.arg[4] = (unsigned long)domid;
   32.35 +    hypercall.op     = __HYPERVISOR_memory_op;
   32.36 +    hypercall.arg[0] = (unsigned long)cmd;
   32.37 +    hypercall.arg[1] = (unsigned long)arg;
   32.38  
   32.39 -    if ( (extent_list != NULL) && 
   32.40 -         (mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
   32.41 +    switch ( cmd )
   32.42      {
   32.43 -        PERROR("Could not lock memory for Xen hypercall");
   32.44 -        goto out1;
   32.45 +    case XENMEM_increase_reservation:
   32.46 +    case XENMEM_decrease_reservation:
   32.47 +        if ( mlock(reservation, sizeof(*reservation)) != 0 )
   32.48 +        {
   32.49 +            PERROR("Could not mlock");
   32.50 +            goto out1;
   32.51 +        }
   32.52 +        if ( (reservation->extent_start != NULL) &&
   32.53 +             (mlock(reservation->extent_start,
   32.54 +                    reservation->nr_extents * sizeof(unsigned long)) != 0) )
   32.55 +        {
   32.56 +            PERROR("Could not mlock");
   32.57 +            safe_munlock(reservation, sizeof(*reservation));
   32.58 +            goto out1;
   32.59 +        }
   32.60 +        break;
   32.61 +    case XENMEM_maximum_ram_page:
   32.62 +        if ( mlock(arg, sizeof(unsigned long)) != 0 )
   32.63 +        {
   32.64 +            PERROR("Could not mlock");
   32.65 +            goto out1;
   32.66 +        }
   32.67 +        break;
   32.68      }
   32.69  
   32.70      if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   32.71 @@ -217,8 +233,19 @@ int xc_dom_mem_op(int xc_handle,
   32.72                  " rebuild the user-space tool set?\n",ret,errno);
   32.73      }
   32.74  
   32.75 -    if ( extent_list != NULL )
   32.76 -        safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
   32.77 +    switch ( cmd )
   32.78 +    {
   32.79 +    case XENMEM_increase_reservation:
   32.80 +    case XENMEM_decrease_reservation:
   32.81 +        safe_munlock(reservation, sizeof(*reservation));
   32.82 +        if ( reservation->extent_start != NULL )
   32.83 +            safe_munlock(reservation->extent_start,
   32.84 +                         reservation->nr_extents * sizeof(unsigned long));
   32.85 +        break;
   32.86 +    case XENMEM_maximum_ram_page:
   32.87 +        safe_munlock(arg, sizeof(unsigned long));
   32.88 +        break;
   32.89 +    }
   32.90  
   32.91   out1:
   32.92      return ret;
    33.1 --- a/tools/libxc/xc_vmx_build.c	Mon Aug 29 16:05:29 2005 -0700
    33.2 +++ b/tools/libxc/xc_vmx_build.c	Tue Aug 30 13:36:49 2005 -0700
    33.3 @@ -7,6 +7,7 @@
    33.4  #define ELFSIZE 32
    33.5  #include "xc_elf.h"
    33.6  #include <stdlib.h>
    33.7 +#include <unistd.h>
    33.8  #include <zlib.h>
    33.9  #include <xen/io/ioreq.h>
   33.10  #include "linux_boot_params.h"
    34.1 --- a/tools/libxc/xenctrl.h	Mon Aug 29 16:05:29 2005 -0700
    34.2 +++ b/tools/libxc/xenctrl.h	Tue Aug 30 13:36:49 2005 -0700
    34.3 @@ -430,9 +430,7 @@ int xc_ia64_get_pfn_list(int xc_handle, 
    34.4  int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
    34.5  		 domid_t dom);
    34.6  
    34.7 -int xc_dom_mem_op(int xc_handle, unsigned int memop, unsigned int *extent_list,
    34.8 -		  unsigned int nr_extents, unsigned int extent_order,
    34.9 -		  domid_t domid);
   34.10 +int xc_memory_op(int xc_handle, int cmd, void *arg);
   34.11  
   34.12  int xc_get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
   34.13  
    35.1 --- a/tools/libxc/xenguest.h	Mon Aug 29 16:05:29 2005 -0700
    35.2 +++ b/tools/libxc/xenguest.h	Tue Aug 30 13:36:49 2005 -0700
    35.3 @@ -47,7 +47,9 @@ int xc_linux_build(int xc_handle,
    35.4                     unsigned long flags,
    35.5                     unsigned int vcpus,
    35.6                     unsigned int store_evtchn,
    35.7 -                   unsigned long *store_mfn);
    35.8 +                   unsigned long *store_mfn,
    35.9 +                   unsigned int console_evtchn,
   35.10 +                   unsigned long *console_mfn);
   35.11  
   35.12  struct mem_map;
   35.13  int xc_vmx_build(int xc_handle,
    36.1 --- a/tools/libxc/xg_private.c	Mon Aug 29 16:05:29 2005 -0700
    36.2 +++ b/tools/libxc/xg_private.c	Tue Aug 30 13:36:49 2005 -0700
    36.3 @@ -5,6 +5,7 @@
    36.4   */
    36.5  
    36.6  #include <stdlib.h>
    36.7 +#include <unistd.h>
    36.8  #include <zlib.h>
    36.9  
   36.10  #include "xg_private.h"
    37.1 --- a/tools/misc/cpuperf/cpuperf.c	Mon Aug 29 16:05:29 2005 -0700
    37.2 +++ b/tools/misc/cpuperf/cpuperf.c	Tue Aug 30 13:36:49 2005 -0700
    37.3 @@ -243,16 +243,12 @@ int main(int argc, char **argv)
    37.4      }
    37.5  
    37.6      if (read) {
    37.7 -        while((cpu_mask&1)) {
    37.8 -            int i;
    37.9 -            for (i=0x300;i<0x312;i++) {
   37.10 -                printf("%010llu ",cpus_rdmsr( cpu_mask, i ) );
   37.11 -            }
   37.12 -            printf("\n");
   37.13 -            cpu_mask>>=1;
   37.14 -        }
   37.15 +        int i;
   37.16 +        for (i=0x300;i<0x312;i++)
   37.17 +            printf("%010llu ",cpus_rdmsr( cpu_mask, i ) );
   37.18 +        printf("\n");
   37.19          exit(1);
   37.20 -    } 
   37.21 +    }
   37.22      
   37.23      if (!escr) {
   37.24          fprintf(stderr, "Need an ESCR.\n");
    38.1 --- a/tools/misc/mbootpack/Makefile	Mon Aug 29 16:05:29 2005 -0700
    38.2 +++ b/tools/misc/mbootpack/Makefile	Tue Aug 30 13:36:49 2005 -0700
    38.3 @@ -20,8 +20,7 @@ GDB	:= gdb
    38.4  INCS	:= -I. -I-
    38.5  DEFS	:= 
    38.6  LDFLAGS	:= 
    38.7 -CC	:= gcc
    38.8 -CFLAGS 	:= -Wall -Wpointer-arith -Wcast-qual -Wno-unused -Wno-format
    38.9 +CFLAGS	:= -Wall -Wpointer-arith -Wcast-qual -Wno-unused -Wno-format
   38.10  CFLAGS	+= -Wmissing-prototypes
   38.11  #CFLAGS	+= -pipe -g -O0 -Wcast-align
   38.12  CFLAGS	+= -pipe -O3 
   38.13 @@ -34,7 +33,7 @@ DEPFLAGS = -Wp,-MD,.$(@F).d
   38.14  DEPS     = .*.d
   38.15  
   38.16  mbootpack: $(OBJS)
   38.17 -	$(CC) -o $@ $(filter-out %.a, $^) $(LDFLAGS)
   38.18 +	$(HOSTCC) -o $@ $(filter-out %.a, $^) $(LDFLAGS)
   38.19  
   38.20  clean:
   38.21  	$(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c
   38.22 @@ -48,7 +47,7 @@ setup: setup.S
   38.23  	$(LD) -m elf_i386 -Ttext 0x0 -s --oformat binary setup.o -o $@
   38.24  
   38.25  bin2c: bin2c.o 
   38.26 -	$(CC) -o $@ $^ 
   38.27 +	$(HOSTCC) -o $@ $^ 
   38.28  
   38.29  bzimage_header.c: bootsect setup bin2c
   38.30  	./bin2c -n 8 -b1 -a bzimage_bootsect bootsect > bzimage_header.c
   38.31 @@ -58,10 +57,10 @@ buildimage.c: bzimage_header.c
   38.32  	@
   38.33  
   38.34  %.o: %.S
   38.35 -	$(CC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   38.36 +	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   38.37  
   38.38  %.o: %.c
   38.39 -	$(CC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   38.40 +	$(HOSTCC) $(DEPFLAGS) $(CFLAGS) $(INCS) $(DEFS) -c $< -o $@
   38.41  
   38.42  .PHONY: all clean gdb
   38.43  .PRECIOUS: $(OBJS) $(OBJS:.o=.c) $(DEPS)
    39.1 --- a/tools/misc/mbootpack/buildimage.c	Mon Aug 29 16:05:29 2005 -0700
    39.2 +++ b/tools/misc/mbootpack/buildimage.c	Tue Aug 30 13:36:49 2005 -0700
    39.3 @@ -43,6 +43,7 @@
    39.4  #include "mbootpack.h"
    39.5  #include "mb_header.h"
    39.6  
    39.7 +
    39.8  /*  We will build an image that a bzImage-capable bootloader will load like 
    39.9   *  this:
   39.10   * 
   39.11 @@ -105,8 +106,8 @@ void make_bzImage(section_t *sections,
   39.12      section_t *s;
   39.13  
   39.14      /* Patch the kernel and mbi addresses into the setup code */
   39.15 -    *(address_t *)(bzimage_setup + BZ_ENTRY_OFFSET) = entry;
   39.16 -    *(address_t *)(bzimage_setup + BZ_MBI_OFFSET) = mbi;
   39.17 +    *(address_t *)(bzimage_setup + BZ_ENTRY_OFFSET) = eswap(entry);
   39.18 +    *(address_t *)(bzimage_setup + BZ_MBI_OFFSET) = eswap(mbi);
   39.19      if (!quiet) printf("Kernel entry is %p, MBI is %p.\n", entry, mbi);
   39.20  
   39.21      /* Write out header and trampoline */
    40.1 --- a/tools/misc/mbootpack/mbootpack.c	Mon Aug 29 16:05:29 2005 -0700
    40.2 +++ b/tools/misc/mbootpack/mbootpack.c	Tue Aug 30 13:36:49 2005 -0700
    40.3 @@ -252,20 +252,21 @@ static address_t load_kernel(const char 
    40.4      for (i = 0; i <= MIN(len - 12, MULTIBOOT_SEARCH - 12); i += 4)
    40.5      {
    40.6          mbh = (struct multiboot_header *)(headerbuf + i);
    40.7 -        if (mbh->magic != MULTIBOOT_MAGIC 
    40.8 -            || ((mbh->magic+mbh->flags+mbh->checksum) & 0xffffffff))
    40.9 +        if (eswap(mbh->magic) != MULTIBOOT_MAGIC 
   40.10 +            || ((eswap(mbh->magic)+eswap(mbh->flags)+eswap(mbh->checksum)) 
   40.11 +				& 0xffffffff))
   40.12          {
   40.13              /* Not a multiboot header */
   40.14              continue;
   40.15          }
   40.16 -        if (mbh->flags & MULTIBOOT_UNSUPPORTED) {
   40.17 +        if (eswap(mbh->flags) & MULTIBOOT_UNSUPPORTED) {
   40.18              /* Requires options we don't support */
   40.19              printf("Fatal: found a multiboot header, but it "
   40.20                      "requires multiboot options that I\n"
   40.21                      "don't understand.  Sorry.\n");
   40.22              exit(1);
   40.23          } 
   40.24 -        if (mbh->flags & MULTIBOOT_VIDEO_MODE) { 
   40.25 +        if (eswap(mbh->flags) & MULTIBOOT_VIDEO_MODE) { 
   40.26              /* Asked for screen mode information */
   40.27              /* XXX carry on regardless */
   40.28              printf("Warning: found a multiboot header which asks "
   40.29 @@ -275,22 +276,22 @@ static address_t load_kernel(const char 
   40.30          }
   40.31          /* This kernel will do: place and load it */
   40.32  
   40.33 -        if (mbh->flags & MULTIBOOT_AOUT_KLUDGE) {
   40.34 +        if (eswap(mbh->flags) & MULTIBOOT_AOUT_KLUDGE) {
   40.35  
   40.36              /* Load using the offsets in the multiboot header */
   40.37              if(!quiet) 
   40.38                  printf("Loading %s using multiboot header.\n", filename);
   40.39  
   40.40              /* How much is there? */
   40.41 -            start = mbh->load_addr;            
   40.42 -            if (mbh->load_end_addr != 0) 
   40.43 -                loadsize = mbh->load_end_addr - mbh->load_addr;
   40.44 +            start = eswap(mbh->load_addr);            
   40.45 +            if (eswap(mbh->load_end_addr) != 0) 
   40.46 +                loadsize = eswap(mbh->load_end_addr) - eswap(mbh->load_addr);
   40.47              else 
   40.48                  loadsize = sb.st_size;
   40.49              
   40.50              /* How much memory will it take up? */ 
   40.51 -            if (mbh->bss_end_addr != 0)
   40.52 -                size = mbh->bss_end_addr - mbh->load_addr;
   40.53 +            if (eswap(mbh->bss_end_addr) != 0)
   40.54 +                size = eswap(mbh->bss_end_addr) - eswap(mbh->load_addr);
   40.55              else
   40.56                  size = loadsize;
   40.57              
   40.58 @@ -335,32 +336,34 @@ static address_t load_kernel(const char 
   40.59              
   40.60              /* Done. */
   40.61              if (!quiet) printf("Loaded kernel from %s\n", filename);
   40.62 -            return mbh->entry_addr;
   40.63 +            return eswap(mbh->entry_addr);
   40.64              
   40.65          } else {
   40.66  
   40.67              /* Now look for an ELF32 header */    
   40.68              ehdr = (Elf32_Ehdr *)headerbuf;
   40.69 -            if (*(unsigned long *)ehdr != 0x464c457f 
   40.70 +            if (*(unsigned long *)ehdr != eswap(0x464c457f)
   40.71                  || ehdr->e_ident[EI_DATA] != ELFDATA2LSB
   40.72                  || ehdr->e_ident[EI_CLASS] != ELFCLASS32
   40.73 -                || ehdr->e_machine != EM_386)
   40.74 +                || eswap(ehdr->e_machine) != EM_386)
   40.75              {
   40.76                  printf("Fatal: kernel has neither ELF32/x86 nor multiboot load"
   40.77                         " headers.\n");
   40.78                  exit(1);
   40.79              }
   40.80 -            if (ehdr->e_phoff + ehdr->e_phnum*sizeof(*phdr) > HEADERBUF_SIZE) {
   40.81 +            if (eswap(ehdr->e_phoff) + eswap(ehdr->e_phnum)*sizeof(*phdr) 
   40.82 +				> HEADERBUF_SIZE) {
   40.83                  /* Don't expect this will happen with sane kernels */
   40.84                  printf("Fatal: too much ELF for me.  Try increasing "
   40.85                         "HEADERBUF_SIZE in mbootpack.\n");
   40.86                  exit(1);
   40.87              }
   40.88 -            if (ehdr->e_phoff + ehdr->e_phnum*sizeof (*phdr) > len) {
   40.89 +            if (eswap(ehdr->e_phoff) + eswap(ehdr->e_phnum)*sizeof (*phdr) 
   40.90 +				> len) {
   40.91                  printf("Fatal: malformed ELF header overruns EOF.\n");
   40.92                  exit(1);
   40.93              }
   40.94 -            if (ehdr->e_phnum <= 0) {
   40.95 +            if (eswap(ehdr->e_phnum) <= 0) {
   40.96                  printf("Fatal: ELF kernel has no program headers.\n");
   40.97                  exit(1);
   40.98              }
   40.99 @@ -368,22 +371,22 @@ static address_t load_kernel(const char 
  40.100              if(!quiet) 
  40.101                  printf("Loading %s using ELF header.\n", filename);
  40.102  
  40.103 -            if (ehdr->e_type != ET_EXEC 
  40.104 -                || ehdr->e_version != EV_CURRENT
  40.105 -                || ehdr->e_phentsize != sizeof (Elf32_Phdr)) {
  40.106 +            if (eswap(ehdr->e_type) != ET_EXEC 
  40.107 +                || eswap(ehdr->e_version) != EV_CURRENT
  40.108 +                || eswap(ehdr->e_phentsize) != sizeof (Elf32_Phdr)) {
  40.109                  printf("Warning: funny-looking ELF header.\n");
  40.110              }
  40.111 -            phdr = (Elf32_Phdr *)(headerbuf + ehdr->e_phoff);
  40.112 +            phdr = (Elf32_Phdr *)(headerbuf + eswap(ehdr->e_phoff));
  40.113  
  40.114              /* Obey the program headers to load the kernel */
  40.115 -            for(i = 0; i < ehdr->e_phnum; i++) {
  40.116 +            for(i = 0; i < eswap(ehdr->e_phnum); i++) {
  40.117  
  40.118 -                start = phdr[i].p_paddr;
  40.119 -                size = phdr[i].p_memsz;
  40.120 -                if (phdr[i].p_type != PT_LOAD) 
  40.121 +                start = eswap(phdr[i].p_paddr);
  40.122 +                size = eswap(phdr[i].p_memsz);
  40.123 +                if (eswap(phdr[i].p_type) != PT_LOAD) 
  40.124                      loadsize = 0;
  40.125                  else 
  40.126 -                    loadsize = MIN((long int)phdr[i].p_filesz, size);
  40.127 +                    loadsize = MIN((long int)eswap(phdr[i].p_filesz), size);
  40.128  
  40.129                  if ((buffer = malloc(size)) == NULL) {
  40.130                      printf("Fatal: malloc() for kernel load failed: %s\n",
  40.131 @@ -396,7 +399,7 @@ static address_t load_kernel(const char 
  40.132  
  40.133                  /* Load section from file */ 
  40.134                  if (loadsize > 0) {
  40.135 -                    if (fseek(fp, phdr[i].p_offset, SEEK_SET) != 0) {
  40.136 +                    if (fseek(fp, eswap(phdr[i].p_offset), SEEK_SET) != 0) {
  40.137                          printf("Fatal: seek failed in %s\n",
  40.138                                  strerror(errno));
  40.139                          exit(1);
  40.140 @@ -452,7 +455,7 @@ static address_t load_kernel(const char 
  40.141           
  40.142              /* Done! */
  40.143              if (!quiet) printf("Loaded kernel from %s\n", filename);
  40.144 -            return ehdr->e_entry;
  40.145 +            return eswap(ehdr->e_entry);
  40.146          }
  40.147  
  40.148      }
  40.149 @@ -568,12 +571,12 @@ int main(int argc, char **argv)
  40.150      /* Command line */
  40.151      p = (char *)(mbi + 1);
  40.152      sprintf(p, "%s %s", imagename, command_line);
  40.153 -    mbi->cmdline = ((address_t)p) + mbi_reloc_offset;
  40.154 +    mbi->cmdline = eswap(((address_t)p) + mbi_reloc_offset);
  40.155      p += command_line_len;
  40.156  
  40.157      /* Bootloader ID */
  40.158      sprintf(p, version_string);
  40.159 -    mbi->boot_loader_name = ((address_t)p) + mbi_reloc_offset;
  40.160 +    mbi->boot_loader_name = eswap(((address_t)p) + mbi_reloc_offset);
  40.161      p += strlen(version_string) + 1;
  40.162  
  40.163      /* Next is space for the module command lines */
  40.164 @@ -582,17 +585,17 @@ int main(int argc, char **argv)
  40.165      /* Last come the module info structs */
  40.166      modp = (struct mod_list *)
  40.167          ((((address_t)p + mod_command_line_space) + 3) & ~3);
  40.168 -    mbi->mods_count = modules;
  40.169 -    mbi->mods_addr = ((address_t)modp) + mbi_reloc_offset;
  40.170 +    mbi->mods_count = eswap(modules);
  40.171 +    mbi->mods_addr = eswap(((address_t)modp) + mbi_reloc_offset);
  40.172  
  40.173      /* Memory information will be added at boot time, by setup.S 
  40.174       * or trampoline.S. */
  40.175 -    mbi->flags = MB_INFO_CMDLINE | MB_INFO_BOOT_LOADER_NAME;
  40.176 +    mbi->flags = eswap(MB_INFO_CMDLINE | MB_INFO_BOOT_LOADER_NAME);
  40.177  
  40.178  
  40.179      /* Load the modules */
  40.180      if (modules) {
  40.181 -        mbi->flags |= MB_INFO_MODS;
  40.182 +        mbi->flags = eswap(eswap(mbi->flags) | MB_INFO_MODS);
  40.183                  
  40.184          /* Go back and parse the module command lines */
  40.185          optind = opterr = 1;
  40.186 @@ -652,10 +655,10 @@ int main(int argc, char **argv)
  40.187              if (p != NULL) *p = ' ';
  40.188  
  40.189              /* Fill in the module info struct */
  40.190 -            modp->mod_start = start;
  40.191 -            modp->mod_end = start + size;
  40.192 -            modp->cmdline = (address_t)mod_clp + mbi_reloc_offset;
  40.193 -            modp->pad = 0;
  40.194 +            modp->mod_start = eswap(start);
  40.195 +            modp->mod_end = eswap(start + size);
  40.196 +            modp->cmdline = eswap((address_t)mod_clp + mbi_reloc_offset);
  40.197 +            modp->pad = eswap(0);
  40.198              modp++;
  40.199  
  40.200              /* Store the module command line */
    41.1 --- a/tools/misc/mbootpack/mbootpack.h	Mon Aug 29 16:05:29 2005 -0700
    41.2 +++ b/tools/misc/mbootpack/mbootpack.h	Tue Aug 30 13:36:49 2005 -0700
    41.3 @@ -32,6 +32,24 @@
    41.4  #undef NDEBUG
    41.5  #include <stdio.h>
    41.6  
    41.7 +#include <endian.h>
    41.8 +#include <byteswap.h>
    41.9 +#if __BYTE_ORDER == __LITTLE_ENDIAN
   41.10 +#define eswap(x) (x)
   41.11 +#else 
   41.12 +#define eswap(x)                                               \
   41.13 +        ({                                                      \
   41.14 +               typeof(x) y = (x);                              \
   41.15 +               switch(sizeof(y))                               \
   41.16 +               {                                               \
   41.17 +               case 2: y = __bswap_16(y); break;               \
   41.18 +               case 4: y = __bswap_32(y); break;               \
   41.19 +               case 8: y = __bswap_64(y); break;               \
   41.20 +               }                                               \
   41.21 +               y;                                              \
   41.22 +        })	
   41.23 +#endif			
   41.24 +
   41.25  /* Flags */
   41.26  extern int quiet;
   41.27  
    42.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Mon Aug 29 16:05:29 2005 -0700
    42.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Aug 30 13:36:49 2005 -0700
    42.3 @@ -268,25 +268,33 @@ static PyObject *pyxc_linux_build(PyObje
    42.4      u32 dom;
    42.5      char *image, *ramdisk = NULL, *cmdline = "";
    42.6      int flags = 0, vcpus = 1;
    42.7 -    int control_evtchn, store_evtchn;
    42.8 +    int control_evtchn, store_evtchn, console_evtchn;
    42.9      unsigned long store_mfn = 0;
   42.10 +    unsigned long console_mfn = 0;
   42.11  
   42.12      static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn", 
   42.13 -                                "image", "ramdisk", "cmdline", "flags",
   42.14 +                                "console_evtchn", "image", 
   42.15 +				/* optional */
   42.16 +				"ramdisk", "cmdline", "flags",
   42.17  				"vcpus", NULL };
   42.18  
   42.19 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiis|ssii", kwd_list,
   42.20 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssii", kwd_list,
   42.21                                        &dom, &control_evtchn, &store_evtchn,
   42.22 -                                      &image, &ramdisk, &cmdline, &flags,
   42.23 +				      &console_evtchn, &image, 
   42.24 +				      /* optional */
   42.25 +				      &ramdisk, &cmdline, &flags,
   42.26                                        &vcpus) )
   42.27          return NULL;
   42.28  
   42.29      if ( xc_linux_build(xc->xc_handle, dom, image,
   42.30                          ramdisk, cmdline, control_evtchn, flags, vcpus,
   42.31 -                        store_evtchn, &store_mfn) != 0 )
   42.32 +                        store_evtchn, &store_mfn, 
   42.33 +			console_evtchn, &console_mfn) != 0 )
   42.34          return PyErr_SetFromErrno(xc_error);
   42.35      
   42.36 -    return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
   42.37 +    return Py_BuildValue("{s:i,s:i}", 
   42.38 +			 "store_mfn", store_mfn,
   42.39 +			 "console_mfn", console_mfn);
   42.40  }
   42.41  
   42.42  static PyObject *pyxc_vmx_build(PyObject *self,
    43.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Mon Aug 29 16:05:29 2005 -0700
    43.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Aug 30 13:36:49 2005 -0700
    43.3 @@ -47,7 +47,7 @@ from xen.xend.XendError import XendError
    43.4  from xen.xend.XendRoot import get_component
    43.5  
    43.6  from xen.xend.uuid import getUuid
    43.7 -from xen.xend.xenstore import DBVar
    43.8 +from xen.xend.xenstore import DBVar, XenNode, DBMap
    43.9  
   43.10  """Shutdown code for poweroff."""
   43.11  DOMAIN_POWEROFF = 0
   43.12 @@ -231,6 +231,7 @@ class XendDomainInfo:
   43.13          DBVar('start_time',    ty='float'),
   43.14          DBVar('state',         ty='str'),
   43.15          DBVar('store_mfn',     ty='long'),
   43.16 +        DBVar('console_mfn',     ty='long'),
   43.17          DBVar('restart_mode',  ty='str'),
   43.18          DBVar('restart_state', ty='str'),
   43.19          DBVar('restart_time',  ty='float'),
   43.20 @@ -260,6 +261,8 @@ class XendDomainInfo:
   43.21          self.channel = None
   43.22          self.store_channel = None
   43.23          self.store_mfn = None
   43.24 +        self.console_channel = None
   43.25 +        self.console_mfn = None
   43.26          self.controllers = {}
   43.27          
   43.28          self.info = None
   43.29 @@ -297,6 +300,9 @@ class XendDomainInfo:
   43.30          if self.store_channel:
   43.31              self.store_channel.saveToDB(self.db.addChild("store_channel"),
   43.32                                          save=save)
   43.33 +        if self.console_channel:
   43.34 +            self.console_channel.saveToDB(self.db.addChild("console_channel"),
   43.35 +                                        save=save)
   43.36          if self.image:
   43.37              self.image.exportToDB(save=save, sync=sync)
   43.38          self.db.exportToDB(self, fields=self.__exports__, save=save, sync=sync)
   43.39 @@ -329,6 +335,9 @@ class XendDomainInfo:
   43.40      def getStoreChannel(self):
   43.41          return self.store_channel
   43.42  
   43.43 +    def getConsoleChannel(self):
   43.44 +        return self.console_channel
   43.45 +
   43.46      def update(self, info):
   43.47          """Update with  info from xc.domain_getinfo().
   43.48          """
   43.49 @@ -518,6 +527,14 @@ class XendDomainInfo:
   43.50              sxpr.append(self.store_channel.sxpr())
   43.51          if self.store_mfn:
   43.52              sxpr.append(['store_mfn', self.store_mfn])
   43.53 +        if self.console_channel:
   43.54 +            sxpr.append(['console_channel', self.console_channel.sxpr()])
   43.55 +        if self.console_mfn:
   43.56 +            sxpr.append(['console_mfn', self.console_mfn])
   43.57 +# already in (devices)
   43.58 +#        console = self.getConsole()
   43.59 +#        if console:
   43.60 +#            sxpr.append(console.sxpr())
   43.61  
   43.62          if self.restart_count:
   43.63              sxpr.append(['restart_count', self.restart_count])
   43.64 @@ -712,6 +729,13 @@ class XendDomainInfo:
   43.65              except Exception, ex:
   43.66                  log.warning("error in domain release on xenstore: %s", ex)
   43.67                  pass
   43.68 +        if self.console_channel:
   43.69 +            # notify processes using this cosole?
   43.70 +            try:
   43.71 +                self.console_channel.close()
   43.72 +                self.console_channel = None
   43.73 +            except:
   43.74 +                pass
   43.75          if self.image:
   43.76              try:
   43.77                  self.device_model_pid = 0
   43.78 @@ -808,6 +832,7 @@ class XendDomainInfo:
   43.79          """
   43.80          self.channel = self.openChannel("channel", 0, 1)
   43.81          self.store_channel = self.eventChannel("store_channel")
   43.82 +        self.console_channel = self.eventChannel("console_channel")
   43.83  
   43.84      def create_configured_devices(self):
   43.85          devices = sxp.children(self.config, 'device')
   43.86 @@ -1003,6 +1028,7 @@ class XendDomainInfo:
   43.87          self.configure_fields()
   43.88          self.create_devices()
   43.89          self.create_blkif()
   43.90 +        self.publish_console()
   43.91  
   43.92      def create_blkif(self):
   43.93          """Create the block device interface (blkif) for the vm.
   43.94 @@ -1017,6 +1043,12 @@ class XendDomainInfo:
   43.95              backend = blkif.getBackend(0)
   43.96              backend.connect(recreate=self.recreate)
   43.97  
   43.98 +    def publish_console(self):
   43.99 +        db = DBMap(db=XenNode("/console/%d" % self.id))
  43.100 +        db.clear()
  43.101 +        db['domain'] = self.db.getPath()
  43.102 +        db.saveDB(save=True)
  43.103 +        
  43.104      def configure_fields(self):
  43.105          """Process the vm configuration fields using the registered handlers.
  43.106          """
    44.1 --- a/tools/python/xen/xend/image.py	Mon Aug 29 16:05:29 2005 -0700
    44.2 +++ b/tools/python/xen/xend/image.py	Tue Aug 30 13:36:49 2005 -0700
    44.3 @@ -238,16 +238,33 @@ class LinuxImageHandler(ImageHandler):
    44.4              store_evtchn = self.vm.store_channel.port2
    44.5          else:
    44.6              store_evtchn = 0
    44.7 +        if self.vm.console_channel:
    44.8 +            console_evtchn = self.vm.console_channel.port2
    44.9 +        else:
   44.10 +            console_evtchn = 0
   44.11 +
   44.12 +        log.debug("dom            = %d", self.vm.getDomain())
   44.13 +        log.debug("image          = %s", self.kernel)
   44.14 +        log.debug("control_evtchn = %s", self.vm.channel.getRemotePort())
   44.15 +        log.debug("store_evtchn   = %d", store_evtchn)
   44.16 +        log.debug("console_evtchn = %d", console_evtchn)
   44.17 +        log.debug("cmdline        = %s", self.cmdline)
   44.18 +        log.debug("ramdisk        = %s", self.ramdisk)
   44.19 +        log.debug("flags          = %d", self.flags)
   44.20 +        log.debug("vcpus          = %d", self.vm.vcpus)
   44.21 +
   44.22          ret = xc.linux_build(dom            = self.vm.getDomain(),
   44.23                               image          = self.kernel,
   44.24                               control_evtchn = self.vm.channel.getRemotePort(),
   44.25                               store_evtchn   = store_evtchn,
   44.26 +                             console_evtchn = console_evtchn,
   44.27                               cmdline        = self.cmdline,
   44.28                               ramdisk        = self.ramdisk,
   44.29                               flags          = self.flags,
   44.30                               vcpus          = self.vm.vcpus)
   44.31          if isinstance(ret, dict):
   44.32              self.vm.store_mfn = ret.get('store_mfn')
   44.33 +            self.vm.console_mfn = ret.get('console_mfn')
   44.34              return 0
   44.35          return ret
   44.36  
    45.1 --- a/tools/xcs/Makefile	Mon Aug 29 16:05:29 2005 -0700
    45.2 +++ b/tools/xcs/Makefile	Tue Aug 30 13:36:49 2005 -0700
    45.3 @@ -10,8 +10,7 @@ INSTALL         = install
    45.4  INSTALL_PROG    = $(INSTALL) -m0755
    45.5  INSTALL_DIR     = $(INSTALL) -d -m0755
    45.6  
    45.7 -CC       = gcc
    45.8 -CFLAGS   = -Wall -Werror -g3 -D _XOPEN_SOURCE=600
    45.9 +CFLAGS   += -Wall -Werror -g3 -D _XOPEN_SOURCE=600
   45.10  
   45.11  CFLAGS  += -I $(XEN_XC)
   45.12  CFLAGS  += -I $(XEN_LIBXC)
    46.1 --- a/tools/xcutils/Makefile	Mon Aug 29 16:05:29 2005 -0700
    46.2 +++ b/tools/xcutils/Makefile	Tue Aug 30 13:36:49 2005 -0700
    46.3 @@ -19,8 +19,6 @@ PROGRAMS_INSTALL_DIR	= /usr/libexec/xen
    46.4  
    46.5  INCLUDES += -I $(XEN_LIBXC)
    46.6  
    46.7 -CC := gcc
    46.8 -
    46.9  CFLAGS += -Wall -Werror -O3 -fno-strict-aliasing
   46.10  CFLAGS += $(INCLUDES)
   46.11  
    47.1 --- a/tools/xenstat/Makefile	Mon Aug 29 16:05:29 2005 -0700
    47.2 +++ b/tools/xenstat/Makefile	Tue Aug 30 13:36:49 2005 -0700
    47.3 @@ -3,7 +3,11 @@ include $(XEN_ROOT)/tools/Rules.mk
    47.4  
    47.5  SUBDIRS :=
    47.6  SUBDIRS += libxenstat
    47.7 +
    47.8 +# This doesn't cross-compile (cross-compile environments rarely have curses)
    47.9 +ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
   47.10  SUBDIRS += xentop
   47.11 +endif
   47.12  
   47.13  .PHONY: all install clean
   47.14  
    48.1 --- a/xen/arch/x86/domain.c	Mon Aug 29 16:05:29 2005 -0700
    48.2 +++ b/xen/arch/x86/domain.c	Tue Aug 30 13:36:49 2005 -0700
    48.3 @@ -255,13 +255,13 @@ void arch_do_createdomain(struct vcpu *v
    48.4      v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
    48.5      v->cpumap = CPUMAP_RUNANYWHERE;
    48.6      SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
    48.7 -    machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
    48.8 -                           PAGE_SHIFT] = INVALID_M2P_ENTRY;
    48.9 +    set_pfn_from_mfn(virt_to_phys(d->shared_info) >> PAGE_SHIFT,
   48.10 +            INVALID_M2P_ENTRY);
   48.11      
   48.12      d->arch.mm_perdomain_pt = alloc_xenheap_page();
   48.13      memset(d->arch.mm_perdomain_pt, 0, PAGE_SIZE);
   48.14 -    machine_to_phys_mapping[virt_to_phys(d->arch.mm_perdomain_pt) >> 
   48.15 -                           PAGE_SHIFT] = INVALID_M2P_ENTRY;
   48.16 +    set_pfn_from_mfn(virt_to_phys(d->arch.mm_perdomain_pt) >> PAGE_SHIFT,
   48.17 +            INVALID_M2P_ENTRY);
   48.18      v->arch.perdomain_ptes = d->arch.mm_perdomain_pt;
   48.19      v->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] =
   48.20          l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
    49.1 --- a/xen/arch/x86/domain_build.c	Mon Aug 29 16:05:29 2005 -0700
    49.2 +++ b/xen/arch/x86/domain_build.c	Tue Aug 30 13:36:49 2005 -0700
    49.3 @@ -592,8 +592,7 @@ int construct_dom0(struct domain *d,
    49.4      if ( opt_dom0_translate )
    49.5      {
    49.6          si->shared_info  = d->next_io_page << PAGE_SHIFT;
    49.7 -        set_machinetophys(virt_to_phys(d->shared_info) >> PAGE_SHIFT,
    49.8 -                          d->next_io_page);
    49.9 +        set_pfn_from_mfn(virt_to_phys(d->shared_info) >> PAGE_SHIFT, d->next_io_page);
   49.10          d->next_io_page++;
   49.11      }
   49.12      else
   49.13 @@ -614,7 +613,7 @@ int construct_dom0(struct domain *d,
   49.14              mfn = alloc_epfn - (pfn - REVERSE_START);
   49.15  #endif
   49.16          ((u32 *)vphysmap_start)[pfn] = mfn;
   49.17 -        machine_to_phys_mapping[mfn] = pfn;
   49.18 +        set_pfn_from_mfn(mfn, pfn);
   49.19      }
   49.20      while ( pfn < nr_pages )
   49.21      {
   49.22 @@ -627,7 +626,7 @@ int construct_dom0(struct domain *d,
   49.23  #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn)))
   49.24  #endif
   49.25              ((u32 *)vphysmap_start)[pfn] = mfn;
   49.26 -            machine_to_phys_mapping[mfn] = pfn;
   49.27 +            set_pfn_from_mfn(mfn, pfn);
   49.28  #undef pfn
   49.29              page++; pfn++;
   49.30          }
    50.1 --- a/xen/arch/x86/mm.c	Mon Aug 29 16:05:29 2005 -0700
    50.2 +++ b/xen/arch/x86/mm.c	Tue Aug 30 13:36:49 2005 -0700
    50.3 @@ -1452,7 +1452,7 @@ int get_page_type(struct pfn_info *page,
    50.4                                  "!= exp %" PRtype_info ") "
    50.5                                  "for mfn %lx (pfn %x)",
    50.6                                  x, type, page_to_pfn(page),
    50.7 -                                machine_to_phys_mapping[page_to_pfn(page)]);
    50.8 +                                get_pfn_from_mfn(page_to_pfn(page)));
    50.9                      return 0;
   50.10                  }
   50.11                  else if ( (x & PGT_va_mask) == PGT_va_mutable )
   50.12 @@ -2206,7 +2206,7 @@ int do_mmu_update(
   50.13                  printk("privileged guest dom%d requests pfn=%lx to "
   50.14                         "map mfn=%lx for dom%d\n",
   50.15                         d->domain_id, gpfn, mfn, FOREIGNDOM->domain_id);
   50.16 -                set_machinetophys(mfn, gpfn);
   50.17 +                set_pfn_from_mfn(mfn, gpfn);
   50.18                  set_p2m_entry(FOREIGNDOM, gpfn, mfn, &sh_mapcache, &mapcache);
   50.19                  okay = 1;
   50.20                  shadow_unlock(FOREIGNDOM);
   50.21 @@ -2225,7 +2225,7 @@ int do_mmu_update(
   50.22                  break;
   50.23              }
   50.24  
   50.25 -            set_machinetophys(mfn, gpfn);
   50.26 +            set_pfn_from_mfn(mfn, gpfn);
   50.27              okay = 1;
   50.28  
   50.29              /*
    51.1 --- a/xen/arch/x86/shadow32.c	Mon Aug 29 16:05:29 2005 -0700
    51.2 +++ b/xen/arch/x86/shadow32.c	Tue Aug 30 13:36:49 2005 -0700
    51.3 @@ -827,7 +827,7 @@ alloc_p2m_table(struct domain *d)
    51.4      {
    51.5          page = list_entry(list_ent, struct pfn_info, list);
    51.6          mfn = page_to_pfn(page);
    51.7 -        pfn = machine_to_phys_mapping[mfn];
    51.8 +        pfn = get_pfn_from_mfn(mfn);
    51.9          ASSERT(pfn != INVALID_M2P_ENTRY);
   51.10          ASSERT(pfn < (1u<<20));
   51.11  
   51.12 @@ -841,7 +841,7 @@ alloc_p2m_table(struct domain *d)
   51.13      {
   51.14          page = list_entry(list_ent, struct pfn_info, list);
   51.15          mfn = page_to_pfn(page);
   51.16 -        pfn = machine_to_phys_mapping[mfn];
   51.17 +        pfn = get_pfn_from_mfn(mfn);
   51.18          if ( (pfn != INVALID_M2P_ENTRY) &&
   51.19               (pfn < (1u<<20)) )
   51.20          {
    52.1 --- a/xen/arch/x86/shadow_public.c	Mon Aug 29 16:05:29 2005 -0700
    52.2 +++ b/xen/arch/x86/shadow_public.c	Tue Aug 30 13:36:49 2005 -0700
    52.3 @@ -1311,7 +1311,7 @@ alloc_p2m_table(struct domain *d)
    52.4      {
    52.5          page = list_entry(list_ent, struct pfn_info, list);
    52.6          mfn = page_to_pfn(page);
    52.7 -        pfn = machine_to_phys_mapping[mfn];
    52.8 +        pfn = get_pfn_from_mfn(mfn);
    52.9          ASSERT(pfn != INVALID_M2P_ENTRY);
   52.10          ASSERT(pfn < (1u<<20));
   52.11  
   52.12 @@ -1325,7 +1325,7 @@ alloc_p2m_table(struct domain *d)
   52.13      {
   52.14          page = list_entry(list_ent, struct pfn_info, list);
   52.15          mfn = page_to_pfn(page);
   52.16 -        pfn = machine_to_phys_mapping[mfn];
   52.17 +        pfn = get_pfn_from_mfn(mfn);
   52.18          if ( (pfn != INVALID_M2P_ENTRY) &&
   52.19               (pfn < (1u<<20)) )
   52.20          {
    53.1 --- a/xen/arch/x86/traps.c	Mon Aug 29 16:05:29 2005 -0700
    53.2 +++ b/xen/arch/x86/traps.c	Tue Aug 30 13:36:49 2005 -0700
    53.3 @@ -100,6 +100,7 @@ unsigned long do_get_debugreg(int reg);
    53.4  
    53.5  static int debug_stack_lines = 20;
    53.6  integer_param("debug_stack_lines", debug_stack_lines);
    53.7 +#define stack_words_per_line (32 / BYTES_PER_LONG)
    53.8  
    53.9  int is_kernel_text(unsigned long addr)
   53.10  {
   53.11 @@ -125,7 +126,7 @@ void show_guest_stack(void)
   53.12  
   53.13      printk("Guest stack trace from "__OP"sp=%p:\n   ", stack);
   53.14  
   53.15 -    for ( i = 0; i < (debug_stack_lines*8); i++ )
   53.16 +    for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
   53.17      {
   53.18          if ( ((long)stack & (STACK_SIZE-1)) == 0 )
   53.19              break;
   53.20 @@ -137,7 +138,7 @@ void show_guest_stack(void)
   53.21              i = 1;
   53.22              break;
   53.23          }
   53.24 -        if ( (i != 0) && ((i % 8) == 0) )
   53.25 +        if ( (i != 0) && ((i % stack_words_per_line) == 0) )
   53.26              printk("\n   ");
   53.27          printk("%p ", _p(addr));
   53.28          stack++;
   53.29 @@ -176,11 +177,11 @@ void show_stack(unsigned long *esp)
   53.30  
   53.31      printk("Xen stack trace from "__OP"sp=%p:\n   ", stack);
   53.32  
   53.33 -    for ( i = 0; i < (debug_stack_lines*8); i++ )
   53.34 +    for ( i = 0; i < (debug_stack_lines*stack_words_per_line); i++ )
   53.35      {
   53.36          if ( ((long)stack & (STACK_SIZE-1)) == 0 )
   53.37              break;
   53.38 -        if ( (i != 0) && ((i % 8) == 0) )
   53.39 +        if ( (i != 0) && ((i % stack_words_per_line) == 0) )
   53.40              printk("\n   ");
   53.41          addr = *stack++;
   53.42          printk("%p ", _p(addr));
    54.1 --- a/xen/arch/x86/vmx.c	Mon Aug 29 16:05:29 2005 -0700
    54.2 +++ b/xen/arch/x86/vmx.c	Tue Aug 30 13:36:49 2005 -0700
    54.3 @@ -704,7 +704,7 @@ vmx_copy(void *buf, unsigned long laddr,
    54.4          return 0;
    54.5      }
    54.6  
    54.7 -    mfn = phys_to_machine_mapping(laddr >> PAGE_SHIFT);
    54.8 +    mfn = get_mfn_from_pfn(laddr >> PAGE_SHIFT);
    54.9      addr = (char *)map_domain_page(mfn) + (laddr & ~PAGE_MASK);
   54.10  
   54.11      if (dir == COPY_IN)
   54.12 @@ -805,7 +805,7 @@ vmx_world_restore(struct vcpu *d, struct
   54.13  	 * removed some translation or changed page attributes.
   54.14  	 * We simply invalidate the shadow.
   54.15  	 */
   54.16 -	mfn = phys_to_machine_mapping(c->cr3 >> PAGE_SHIFT);
   54.17 +	mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
   54.18  	if (mfn != pagetable_get_pfn(d->arch.guest_table)) {
   54.19  	    printk("Invalid CR3 value=%x", c->cr3);
   54.20  	    domain_crash_synchronous();
   54.21 @@ -823,7 +823,7 @@ vmx_world_restore(struct vcpu *d, struct
   54.22  	    domain_crash_synchronous(); 
   54.23  	    return 0;
   54.24  	}
   54.25 -	mfn = phys_to_machine_mapping(c->cr3 >> PAGE_SHIFT);
   54.26 +	mfn = get_mfn_from_pfn(c->cr3 >> PAGE_SHIFT);
   54.27  	d->arch.guest_table = mk_pagetable(mfn << PAGE_SHIFT);
   54.28  	update_pagetables(d);
   54.29  	/* 
   54.30 @@ -978,7 +978,7 @@ static int vmx_set_cr0(unsigned long val
   54.31          /*
   54.32           * The guest CR3 must be pointing to the guest physical.
   54.33           */
   54.34 -        if ( !VALID_MFN(mfn = phys_to_machine_mapping(
   54.35 +        if ( !VALID_MFN(mfn = get_mfn_from_pfn(
   54.36                              d->arch.arch_vmx.cpu_cr3 >> PAGE_SHIFT)) ||
   54.37               !get_page(pfn_to_page(mfn), d->domain) )
   54.38          {
   54.39 @@ -1174,7 +1174,7 @@ static int mov_to_cr(int gp, int cr, str
   54.40               * removed some translation or changed page attributes.
   54.41               * We simply invalidate the shadow.
   54.42               */
   54.43 -            mfn = phys_to_machine_mapping(value >> PAGE_SHIFT);
   54.44 +            mfn = get_mfn_from_pfn(value >> PAGE_SHIFT);
   54.45              if (mfn != pagetable_get_pfn(d->arch.guest_table))
   54.46                  __vmx_bug(regs);
   54.47              shadow_sync_all(d->domain);
   54.48 @@ -1185,7 +1185,7 @@ static int mov_to_cr(int gp, int cr, str
   54.49               */
   54.50              VMX_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
   54.51              if ( ((value >> PAGE_SHIFT) > d->domain->max_pages ) ||
   54.52 -                 !VALID_MFN(mfn = phys_to_machine_mapping(value >> PAGE_SHIFT)) ||
   54.53 +                 !VALID_MFN(mfn = get_mfn_from_pfn(value >> PAGE_SHIFT)) ||
   54.54                   !get_page(pfn_to_page(mfn), d->domain) )
   54.55              {
   54.56                  printk("Invalid CR3 value=%lx", value);
    55.1 --- a/xen/arch/x86/vmx_platform.c	Mon Aug 29 16:05:29 2005 -0700
    55.2 +++ b/xen/arch/x86/vmx_platform.c	Tue Aug 30 13:36:49 2005 -0700
    55.3 @@ -521,7 +521,7 @@ int inst_copy_from_guest(unsigned char *
    55.4      if ( vmx_paging_enabled(current) )
    55.5      {
    55.6          gpa = gva_to_gpa(guest_eip);
    55.7 -        mfn = phys_to_machine_mapping(gpa >> PAGE_SHIFT);
    55.8 +        mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT);
    55.9  
   55.10          /* Does this cross a page boundary ? */
   55.11          if ( (guest_eip & PAGE_MASK) != ((guest_eip + inst_len) & PAGE_MASK) )
   55.12 @@ -532,7 +532,7 @@ int inst_copy_from_guest(unsigned char *
   55.13      }
   55.14      else
   55.15      {
   55.16 -        mfn = phys_to_machine_mapping(guest_eip >> PAGE_SHIFT);
   55.17 +        mfn = get_mfn_from_pfn(guest_eip >> PAGE_SHIFT);
   55.18      }
   55.19  
   55.20      inst_start = map_domain_page(mfn);
   55.21 @@ -542,7 +542,7 @@ int inst_copy_from_guest(unsigned char *
   55.22      if ( remaining )
   55.23      {
   55.24          gpa = gva_to_gpa(guest_eip+inst_len+remaining);
   55.25 -        mfn = phys_to_machine_mapping(gpa >> PAGE_SHIFT);
   55.26 +        mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT);
   55.27  
   55.28          inst_start = map_domain_page(mfn);
   55.29          memcpy((char *)buf+inst_len, inst_start, remaining);
    56.1 --- a/xen/arch/x86/vmx_vmcs.c	Mon Aug 29 16:05:29 2005 -0700
    56.2 +++ b/xen/arch/x86/vmx_vmcs.c	Tue Aug 30 13:36:49 2005 -0700
    56.3 @@ -148,7 +148,7 @@ int vmx_setup_platform(struct vcpu *d, s
    56.4      offset = (addr & ~PAGE_MASK);
    56.5      addr = round_pgdown(addr);
    56.6  
    56.7 -    mpfn = phys_to_machine_mapping(addr >> PAGE_SHIFT);
    56.8 +    mpfn = get_mfn_from_pfn(addr >> PAGE_SHIFT);
    56.9      p = map_domain_page(mpfn);
   56.10  
   56.11      e820p = (struct e820entry *) ((unsigned long) p + offset); 
   56.12 @@ -175,7 +175,7 @@ int vmx_setup_platform(struct vcpu *d, s
   56.13      unmap_domain_page(p);        
   56.14  
   56.15      /* Initialise shared page */
   56.16 -    mpfn = phys_to_machine_mapping(gpfn);
   56.17 +    mpfn = get_mfn_from_pfn(gpfn);
   56.18      p = map_domain_page(mpfn);
   56.19      d->domain->arch.vmx_platform.shared_page_va = (unsigned long)p;
   56.20  
    57.1 --- a/xen/arch/x86/x86_32/entry.S	Mon Aug 29 16:05:29 2005 -0700
    57.2 +++ b/xen/arch/x86/x86_32/entry.S	Tue Aug 30 13:36:49 2005 -0700
    57.3 @@ -796,7 +796,7 @@ ENTRY(hypercall_table)
    57.4          .long do_get_debugreg
    57.5          .long do_update_descriptor  /* 10 */
    57.6          .long do_ni_hypercall
    57.7 -        .long do_dom_mem_op
    57.8 +        .long do_memory_op
    57.9          .long do_multicall
   57.10          .long do_update_va_mapping
   57.11          .long do_set_timer_op       /* 15 */
   57.12 @@ -829,7 +829,7 @@ ENTRY(hypercall_args_table)
   57.13          .byte 1 /* do_get_debugreg      */
   57.14          .byte 4 /* do_update_descriptor */  /* 10 */
   57.15          .byte 0 /* do_ni_hypercall      */
   57.16 -        .byte 5 /* do_dom_mem_op        */
   57.17 +        .byte 2 /* do_memory_op         */
   57.18          .byte 2 /* do_multicall         */
   57.19          .byte 4 /* do_update_va_mapping */
   57.20          .byte 2 /* do_set_timer_op      */  /* 15 */
    58.1 --- a/xen/arch/x86/x86_64/entry.S	Mon Aug 29 16:05:29 2005 -0700
    58.2 +++ b/xen/arch/x86/x86_64/entry.S	Tue Aug 30 13:36:49 2005 -0700
    58.3 @@ -339,7 +339,8 @@ create_bounce_frame:
    58.4  1:      /* In kernel context already: push new frame at existing %rsp. */
    58.5          movq  UREGS_rsp+8(%rsp),%rsi
    58.6          andb  $0xfc,UREGS_cs+8(%rsp)    # Indicate kernel context to guest.
    58.7 -2:      movq  $HYPERVISOR_VIRT_START,%rax
    58.8 +2:      andq  $~0xf,%rsi                # Stack frames are 16-byte aligned.
    58.9 +        movq  $HYPERVISOR_VIRT_START,%rax
   58.10          cmpq  %rax,%rsi
   58.11          jb    1f                        # In +ve address space? Then okay.
   58.12          movq  $HYPERVISOR_VIRT_END+60,%rax
   58.13 @@ -616,7 +617,7 @@ ENTRY(hypercall_table)
   58.14          .quad do_get_debugreg
   58.15          .quad do_update_descriptor  /* 10 */
   58.16          .quad do_ni_hypercall
   58.17 -        .quad do_dom_mem_op
   58.18 +        .quad do_memory_op
   58.19          .quad do_multicall
   58.20          .quad do_update_va_mapping
   58.21          .quad do_set_timer_op       /* 15 */
   58.22 @@ -649,7 +650,7 @@ ENTRY(hypercall_args_table)
   58.23          .byte 1 /* do_get_debugreg      */
   58.24          .byte 2 /* do_update_descriptor */  /* 10 */
   58.25          .byte 0 /* do_ni_hypercall      */
   58.26 -        .byte 5 /* do_dom_mem_op        */
   58.27 +        .byte 2 /* do_memory_op         */
   58.28          .byte 2 /* do_multicall         */
   58.29          .byte 3 /* do_update_va_mapping */
   58.30          .byte 1 /* do_set_timer_op      */  /* 15 */
    59.1 --- a/xen/arch/x86/x86_64/traps.c	Mon Aug 29 16:05:29 2005 -0700
    59.2 +++ b/xen/arch/x86/x86_64/traps.c	Tue Aug 30 13:36:49 2005 -0700
    59.3 @@ -15,19 +15,22 @@
    59.4  
    59.5  void show_registers(struct cpu_user_regs *regs)
    59.6  {
    59.7 -    printk("CPU:    %d\nEIP:    %04x:[<%016lx>]",
    59.8 +    printk("CPU:    %d\nRIP:    %04x:[<%016lx>]",
    59.9             smp_processor_id(), 0xffff & regs->cs, regs->rip);
   59.10      if ( !GUEST_MODE(regs) )
   59.11          print_symbol(" %s", regs->rip);
   59.12 -    printk("\nEFLAGS: %016lx\n", regs->eflags);
   59.13 -    printk("rax: %016lx   rbx: %016lx   rcx: %016lx   rdx: %016lx\n",
   59.14 -           regs->rax, regs->rbx, regs->rcx, regs->rdx);
   59.15 -    printk("rsi: %016lx   rdi: %016lx   rbp: %016lx   rsp: %016lx\n",
   59.16 -           regs->rsi, regs->rdi, regs->rbp, regs->rsp);
   59.17 -    printk("r8:  %016lx   r9:  %016lx   r10: %016lx   r11: %016lx\n",
   59.18 -           regs->r8,  regs->r9,  regs->r10, regs->r11);
   59.19 -    printk("r12: %016lx   r13: %016lx   r14: %016lx   r15: %016lx\n",
   59.20 -           regs->r12, regs->r13, regs->r14, regs->r15);
   59.21 +    printk("\nRFLAGS: %016lx\n", regs->eflags);
   59.22 +    printk("rax: %016lx   rbx: %016lx   rcx: %016lx\n",
   59.23 +           regs->rax, regs->rbx, regs->rcx);
   59.24 +    printk("rdx: %016lx   rsi: %016lx   rdi: %016lx\n",
   59.25 +           regs->rdx, regs->rsi, regs->rdi);
   59.26 +    printk("rbp: %016lx   rsp: %016lx   r8:  %016lx\n",
   59.27 +           regs->rbp, regs->rsp, regs->r8);
   59.28 +    printk("r9:  %016lx   r10: %016lx   r11: %016lx\n",
   59.29 +           regs->r9,  regs->r10, regs->r11);
   59.30 +    printk("r12: %016lx   r13: %016lx   r14: %016lx\n",
   59.31 +           regs->r12, regs->r13, regs->r14);
   59.32 +    printk("r15: %016lx\n", regs->r15);
   59.33  
   59.34      if ( GUEST_MODE(regs) )
   59.35          show_guest_stack();
    60.1 --- a/xen/common/Makefile	Mon Aug 29 16:05:29 2005 -0700
    60.2 +++ b/xen/common/Makefile	Tue Aug 30 13:36:49 2005 -0700
    60.3 @@ -2,7 +2,6 @@
    60.4  include $(BASEDIR)/Rules.mk
    60.5  
    60.6  ifeq ($(TARGET_ARCH),ia64)
    60.7 -#OBJS := $(subst dom_mem_ops.o,,$(OBJS))
    60.8  OBJS := $(subst grant_table.o,,$(OBJS))
    60.9  endif
   60.10  
    61.1 --- a/xen/common/dom_mem_ops.c	Mon Aug 29 16:05:29 2005 -0700
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,186 +0,0 @@
    61.4 -/******************************************************************************
    61.5 - * dom_mem_ops.c
    61.6 - *
    61.7 - * Code to handle memory related requests from domains eg. balloon driver.
    61.8 - *
    61.9 - * Copyright (c) 2003-2004, B Dragovic & K A Fraser.
   61.10 - */
   61.11 -
   61.12 -#include <xen/config.h>
   61.13 -#include <xen/types.h>
   61.14 -#include <xen/lib.h>
   61.15 -#include <xen/mm.h>
   61.16 -#include <xen/perfc.h>
   61.17 -#include <xen/sched.h>
   61.18 -#include <xen/event.h>
   61.19 -#include <xen/shadow.h>
   61.20 -#include <asm/current.h>
   61.21 -#include <asm/hardirq.h>
   61.22 -
   61.23 -/*
   61.24 - * To allow safe resume of do_dom_mem_op() after preemption, we need to know 
   61.25 - * at what point in the page list to resume. For this purpose I steal the 
   61.26 - * high-order bits of the @op parameter, which are otherwise unused and zero.
   61.27 - */
   61.28 -#define START_EXTENT_SHIFT 4 /* op[:4] == start_extent */
   61.29 -
   61.30 -#define PREEMPT_CHECK(_op)                          \
   61.31 -    if ( hypercall_preempt_check() )                \
   61.32 -        return hypercall5_create_continuation(      \
   61.33 -            __HYPERVISOR_dom_mem_op,                \
   61.34 -            (_op) | (i << START_EXTENT_SHIFT),      \
   61.35 -            extent_list, nr_extents, extent_order,  \
   61.36 -            (d == current->domain) ? DOMID_SELF : d->domain_id);
   61.37 -
   61.38 -static long
   61.39 -alloc_dom_mem(struct domain *d, 
   61.40 -              unsigned long *extent_list, 
   61.41 -              unsigned long  start_extent,
   61.42 -              unsigned int   nr_extents,
   61.43 -              unsigned int   extent_order,
   61.44 -    		  unsigned int   flags)
   61.45 -{
   61.46 -    struct pfn_info *page;
   61.47 -    unsigned long    i;
   61.48 -
   61.49 -    if ( (extent_list != NULL) && 
   61.50 -         !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
   61.51 -        return start_extent;
   61.52 -
   61.53 -    if ( (extent_order != 0) && !IS_CAPABLE_PHYSDEV(current->domain) )
   61.54 -    {
   61.55 -        DPRINTK("Only I/O-capable domains may allocate > order-0 memory.\n");
   61.56 -        return start_extent;
   61.57 -    }
   61.58 -
   61.59 -    for ( i = start_extent; i < nr_extents; i++ )
   61.60 -    {
   61.61 -        PREEMPT_CHECK(MEMOP_increase_reservation);
   61.62 -
   61.63 -        if ( unlikely((page = alloc_domheap_pages(d, extent_order,
   61.64 -                                                  flags)) == NULL) )
   61.65 -        {
   61.66 -            DPRINTK("Could not allocate a frame\n");
   61.67 -            return i;
   61.68 -        }
   61.69 -
   61.70 -        /* Inform the domain of the new page's machine address. */ 
   61.71 -        if ( (extent_list != NULL) && 
   61.72 -             (__put_user(page_to_pfn(page), &extent_list[i]) != 0) )
   61.73 -            return i;
   61.74 -    }
   61.75 -
   61.76 -    return i;
   61.77 -}
   61.78 -    
   61.79 -static long
   61.80 -free_dom_mem(struct domain *d,
   61.81 -             unsigned long *extent_list, 
   61.82 -             unsigned long  start_extent,
   61.83 -             unsigned int   nr_extents,
   61.84 -             unsigned int   extent_order)
   61.85 -{
   61.86 -    struct pfn_info *page;
   61.87 -    unsigned long    i, j, mpfn;
   61.88 -
   61.89 -    if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
   61.90 -        return start_extent;
   61.91 -
   61.92 -    for ( i = start_extent; i < nr_extents; i++ )
   61.93 -    {
   61.94 -        PREEMPT_CHECK(MEMOP_decrease_reservation);
   61.95 -
   61.96 -        if ( unlikely(__get_user(mpfn, &extent_list[i]) != 0) )
   61.97 -            return i;
   61.98 -
   61.99 -        for ( j = 0; j < (1 << extent_order); j++ )
  61.100 -        {
  61.101 -            if ( unlikely((mpfn + j) >= max_page) )
  61.102 -            {
  61.103 -                DPRINTK("Domain %u page number out of range (%lx >= %lx)\n", 
  61.104 -                        d->domain_id, mpfn + j, max_page);
  61.105 -                return i;
  61.106 -            }
  61.107 -            
  61.108 -            page = &frame_table[mpfn + j];
  61.109 -            if ( unlikely(!get_page(page, d)) )
  61.110 -            {
  61.111 -                DPRINTK("Bad page free for domain %u\n", d->domain_id);
  61.112 -                return i;
  61.113 -            }
  61.114 -
  61.115 -            if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
  61.116 -                put_page_and_type(page);
  61.117 -            
  61.118 -            if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
  61.119 -                put_page(page);
  61.120 -
  61.121 -            shadow_sync_and_drop_references(d, page);
  61.122 -
  61.123 -            put_page(page);
  61.124 -        }
  61.125 -    }
  61.126 -
  61.127 -    return i;
  61.128 -}
  61.129 -
  61.130 -long
  61.131 -do_dom_mem_op(unsigned long  op, 
  61.132 -              unsigned long *extent_list, 
  61.133 -              unsigned int   nr_extents,
  61.134 -              unsigned int   extent_order,
  61.135 -              domid_t        domid)
  61.136 -{
  61.137 -    struct domain *d;
  61.138 -    unsigned long  rc, start_extent;
  61.139 -    unsigned int   address_bits_order;
  61.140 -
  61.141 -    /* Extract @start_extent from @op. */
  61.142 -    start_extent  = op >> START_EXTENT_SHIFT;
  61.143 -    op           &= (1 << START_EXTENT_SHIFT) - 1;
  61.144 -
  61.145 -    /* seperate extent_order and address_bits_order */
  61.146 -    address_bits_order = (extent_order >> 8) & 0xff;
  61.147 -    extent_order &= 0xff;
  61.148 -
  61.149 -    if ( unlikely(start_extent > nr_extents) )
  61.150 -        return -EINVAL;
  61.151 -
  61.152 -    if ( likely(domid == DOMID_SELF) )
  61.153 -        d = current->domain;
  61.154 -    else if ( unlikely(!IS_PRIV(current->domain)) )
  61.155 -        return -EPERM;
  61.156 -    else if ( unlikely((d = find_domain_by_id(domid)) == NULL) )
  61.157 -        return -ESRCH;
  61.158 -
  61.159 -    switch ( op )
  61.160 -    {
  61.161 -    case MEMOP_increase_reservation:
  61.162 -        rc = alloc_dom_mem(
  61.163 -            d, extent_list, start_extent, nr_extents, extent_order,
  61.164 -            (address_bits_order <= 32) ? ALLOC_DOM_DMA : 0);
  61.165 -        break;
  61.166 -    case MEMOP_decrease_reservation:
  61.167 -        rc = free_dom_mem(
  61.168 -            d, extent_list, start_extent, nr_extents, extent_order);
  61.169 -        break;
  61.170 -    default:
  61.171 -        rc = -ENOSYS;
  61.172 -        break;
  61.173 -    }
  61.174 -
  61.175 -    if ( unlikely(domid != DOMID_SELF) )
  61.176 -        put_domain(d);
  61.177 -
  61.178 -    return rc;
  61.179 -}
  61.180 -
  61.181 -/*
  61.182 - * Local variables:
  61.183 - * mode: C
  61.184 - * c-set-style: "BSD"
  61.185 - * c-basic-offset: 4
  61.186 - * tab-width: 4
  61.187 - * indent-tabs-mode: nil
  61.188 - * End:
  61.189 - */
    62.1 --- a/xen/common/grant_table.c	Mon Aug 29 16:05:29 2005 -0700
    62.2 +++ b/xen/common/grant_table.c	Tue Aug 30 13:36:49 2005 -0700
    62.3 @@ -1211,13 +1211,13 @@ gnttab_notify_transfer(
    62.4          DPRINTK("Bad pfn (%lx)\n", pfn);
    62.5      else
    62.6      {
    62.7 -        machine_to_phys_mapping[frame] = pfn;
    62.8 +        set_pfn_from_mfn(frame, pfn);
    62.9  
   62.10          if ( unlikely(shadow_mode_log_dirty(ld)))
   62.11               mark_dirty(ld, frame);
   62.12  
   62.13          if (shadow_mode_translate(ld))
   62.14 -            __phys_to_machine_mapping[pfn] = frame;
   62.15 +            set_mfn_from_pfn(pfn, frame);
   62.16      }
   62.17      sha->frame = __mfn_to_gpfn(rd, frame);
   62.18      sha->domid = rd->domain_id;
   62.19 @@ -1268,8 +1268,7 @@ grant_table_create(
   62.20      {
   62.21          SHARE_PFN_WITH_DOMAIN(
   62.22              virt_to_page((char *)(t->shared)+(i*PAGE_SIZE)), d);
   62.23 -        machine_to_phys_mapping[(virt_to_phys(t->shared) >> PAGE_SHIFT) + i] =
   62.24 -            INVALID_M2P_ENTRY;
   62.25 +        set_pfn_from_mfn((virt_to_phys(t->shared) >> PAGE_SHIFT) + i, INVALID_M2P_ENTRY);
   62.26      }
   62.27  
   62.28      /* Okay, install the structure. */
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/xen/common/memory.c	Tue Aug 30 13:36:49 2005 -0700
    63.3 @@ -0,0 +1,205 @@
    63.4 +/******************************************************************************
    63.5 + * memory.c
    63.6 + *
    63.7 + * Code to handle memory-related requests.
    63.8 + *
    63.9 + * Copyright (c) 2003-2004, B Dragovic
   63.10 + * Copyright (c) 2003-2005, K A Fraser
   63.11 + */
   63.12 +
   63.13 +#include <xen/config.h>
   63.14 +#include <xen/types.h>
   63.15 +#include <xen/lib.h>
   63.16 +#include <xen/mm.h>
   63.17 +#include <xen/perfc.h>
   63.18 +#include <xen/sched.h>
   63.19 +#include <xen/event.h>
   63.20 +#include <xen/shadow.h>
   63.21 +#include <asm/current.h>
   63.22 +#include <asm/hardirq.h>
   63.23 +#include <public/memory.h>
   63.24 +
   63.25 +static long
   63.26 +increase_reservation(
   63.27 +    struct domain *d, 
   63.28 +    unsigned long *extent_list, 
   63.29 +    unsigned int   nr_extents,
   63.30 +    unsigned int   extent_order,
   63.31 +    unsigned int   flags)
   63.32 +{
   63.33 +    struct pfn_info *page;
   63.34 +    unsigned long    i;
   63.35 +
   63.36 +    if ( (extent_list != NULL)
   63.37 +         && !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
   63.38 +        return 0;
   63.39 +
   63.40 +    if ( (extent_order != 0) && !IS_CAPABLE_PHYSDEV(current->domain) )
   63.41 +    {
   63.42 +        DPRINTK("Only I/O-capable domains may allocate > order-0 memory.\n");
   63.43 +        return 0;
   63.44 +    }
   63.45 +
   63.46 +    for ( i = 0; i < nr_extents; i++ )
   63.47 +    {
   63.48 +        if ( hypercall_preempt_check() )
   63.49 +            return i;
   63.50 +
   63.51 +        if ( unlikely((page = alloc_domheap_pages(
   63.52 +            d, extent_order, flags)) == NULL) )
   63.53 +        {
   63.54 +            DPRINTK("Could not allocate a frame\n");
   63.55 +            return i;
   63.56 +        }
   63.57 +
   63.58 +        /* Inform the domain of the new page's machine address. */ 
   63.59 +        if ( (extent_list != NULL)
   63.60 +             && (__put_user(page_to_pfn(page), &extent_list[i]) != 0) )
   63.61 +            return i;
   63.62 +    }
   63.63 +
   63.64 +    return nr_extents;
   63.65 +}
   63.66 +    
   63.67 +static long
   63.68 +decrease_reservation(
   63.69 +    struct domain *d, 
   63.70 +    unsigned long *extent_list, 
   63.71 +    unsigned int   nr_extents,
   63.72 +    unsigned int   extent_order,
   63.73 +    unsigned int   flags)
   63.74 +{
   63.75 +    struct pfn_info *page;
   63.76 +    unsigned long    i, j, mpfn;
   63.77 +
   63.78 +    if ( !array_access_ok(extent_list, nr_extents, sizeof(*extent_list)) )
   63.79 +        return 0;
   63.80 +
   63.81 +    for ( i = 0; i < nr_extents; i++ )
   63.82 +    {
   63.83 +        if ( hypercall_preempt_check() )
   63.84 +            return i;
   63.85 +
   63.86 +        if ( unlikely(__get_user(mpfn, &extent_list[i]) != 0) )
   63.87 +            return i;
   63.88 +
   63.89 +        for ( j = 0; j < (1 << extent_order); j++ )
   63.90 +        {
   63.91 +            if ( unlikely((mpfn + j) >= max_page) )
   63.92 +            {
   63.93 +                DPRINTK("Domain %u page number out of range (%lx >= %lx)\n", 
   63.94 +                        d->domain_id, mpfn + j, max_page);
   63.95 +                return i;
   63.96 +            }
   63.97 +            
   63.98 +            page = &frame_table[mpfn + j];
   63.99 +            if ( unlikely(!get_page(page, d)) )
  63.100 +            {
  63.101 +                DPRINTK("Bad page free for domain %u\n", d->domain_id);
  63.102 +                return i;
  63.103 +            }
  63.104 +
  63.105 +            if ( test_and_clear_bit(_PGT_pinned, &page->u.inuse.type_info) )
  63.106 +                put_page_and_type(page);
  63.107 +            
  63.108 +            if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
  63.109 +                put_page(page);
  63.110 +
  63.111 +            shadow_sync_and_drop_references(d, page);
  63.112 +
  63.113 +            put_page(page);
  63.114 +        }
  63.115 +    }
  63.116 +
  63.117 +    return nr_extents;
  63.118 +}
  63.119 +
  63.120 +/*
  63.121 + * To allow safe resume of do_memory_op() after preemption, we need to know 
  63.122 + * at what point in the page list to resume. For this purpose I steal the 
  63.123 + * high-order bits of the @cmd parameter, which are otherwise unused and zero.
  63.124 + */
  63.125 +#define START_EXTENT_SHIFT 4 /* cmd[:4] == start_extent */
  63.126 +
  63.127 +long do_memory_op(int cmd, void *arg)
  63.128 +{
  63.129 +    struct domain *d;
  63.130 +    int rc, start_extent, op, flags = 0;
  63.131 +    struct xen_memory_reservation reservation;
  63.132 +
  63.133 +    op = cmd & ((1 << START_EXTENT_SHIFT) - 1);
  63.134 +
  63.135 +    switch ( op )
  63.136 +    {
  63.137 +    case XENMEM_increase_reservation:
  63.138 +    case XENMEM_decrease_reservation:
  63.139 +        if ( copy_from_user(&reservation, arg, sizeof(reservation)) )
  63.140 +            return -EFAULT;
  63.141 +
  63.142 +        start_extent = cmd >> START_EXTENT_SHIFT;
  63.143 +        if ( unlikely(start_extent > reservation.nr_extents) )
  63.144 +            return -EINVAL;
  63.145 +        
  63.146 +        if ( reservation.extent_start != NULL )
  63.147 +            reservation.extent_start += start_extent;
  63.148 +        reservation.nr_extents -= start_extent;
  63.149 +
  63.150 +        if ( unlikely(reservation.address_bits != 0)
  63.151 +             && (reservation.address_bits > (get_order(max_page)+PAGE_SHIFT)) )
  63.152 +        {
  63.153 +            if ( reservation.address_bits < 31 )
  63.154 +                return -ENOMEM;
  63.155 +            flags = ALLOC_DOM_DMA;
  63.156 +        }
  63.157 +
  63.158 +        if ( likely(reservation.domid == DOMID_SELF) )
  63.159 +            d = current->domain;
  63.160 +        else if ( !IS_PRIV(current->domain) )
  63.161 +            return -EPERM;
  63.162 +        else if ( (d = find_domain_by_id(reservation.domid)) == NULL )
  63.163 +            return -ESRCH;
  63.164 +
  63.165 +        rc = ((op == XENMEM_increase_reservation) ?
  63.166 +              increase_reservation : decrease_reservation)(
  63.167 +                  d,
  63.168 +                  reservation.extent_start,
  63.169 +                  reservation.nr_extents,
  63.170 +                  reservation.extent_order,
  63.171 +                  flags);
  63.172 +
  63.173 +        if ( unlikely(reservation.domid != DOMID_SELF) )
  63.174 +            put_domain(d);
  63.175 +
  63.176 +        rc += start_extent;
  63.177 +
  63.178 +        if ( (rc != reservation.nr_extents) && hypercall_preempt_check() )
  63.179 +            return hypercall2_create_continuation(
  63.180 +                __HYPERVISOR_memory_op,
  63.181 +                op | (rc << START_EXTENT_SHIFT),
  63.182 +                arg);
  63.183 +        
  63.184 +        break;
  63.185 +
  63.186 +    case XENMEM_maximum_ram_page:
  63.187 +        if ( put_user(max_page, (unsigned long *)arg) )
  63.188 +            return -EFAULT;
  63.189 +        rc = -ENOSYS;
  63.190 +        break;
  63.191 +
  63.192 +    default:
  63.193 +        rc = -ENOSYS;
  63.194 +        break;
  63.195 +    }
  63.196 +
  63.197 +    return rc;
  63.198 +}
  63.199 +
  63.200 +/*
  63.201 + * Local variables:
  63.202 + * mode: C
  63.203 + * c-set-style: "BSD"
  63.204 + * c-basic-offset: 4
  63.205 + * tab-width: 4
  63.206 + * indent-tabs-mode: nil
  63.207 + * End:
  63.208 + */
    64.1 --- a/xen/common/page_alloc.c	Mon Aug 29 16:05:29 2005 -0700
    64.2 +++ b/xen/common/page_alloc.c	Tue Aug 30 13:36:49 2005 -0700
    64.3 @@ -216,7 +216,7 @@ unsigned long alloc_boot_pages(unsigned 
    64.4  #define NR_ZONES    3
    64.5  
    64.6  
    64.7 -#define MAX_DMADOM_PFN 0xFFFFF
    64.8 +#define MAX_DMADOM_PFN 0x7FFFF /* 31 addressable bits */
    64.9  #define pfn_dom_zone_type(_pfn)                                 \
   64.10      (((_pfn) <= MAX_DMADOM_PFN) ? MEMZONE_DMADOM : MEMZONE_DOM)
   64.11  
    65.1 --- a/xen/include/asm-ia64/mm.h	Mon Aug 29 16:05:29 2005 -0700
    65.2 +++ b/xen/include/asm-ia64/mm.h	Tue Aug 30 13:36:49 2005 -0700
    65.3 @@ -405,7 +405,7 @@ extern unsigned long *mpt_table;
    65.4  /* If pmt table is provided by control pannel later, we need __get_user
    65.5  * here. However if it's allocated by HV, we should access it directly
    65.6  */
    65.7 -#define phys_to_machine_mapping(d, gpfn)			\
    65.8 +#define get_mfn_from_pfn(d, gpfn)			\
    65.9      ((d) == dom0 ? gpfn : 					\
   65.10  	(gpfn <= d->arch.max_pfn ? (d)->arch.pmt[(gpfn)] :	\
   65.11  		INVALID_MFN))
   65.12 @@ -414,7 +414,7 @@ extern unsigned long *mpt_table;
   65.13      machine_to_phys_mapping[(mfn)]
   65.14  
   65.15  #define __gpfn_to_mfn(_d, gpfn)			\
   65.16 -    phys_to_machine_mapping((_d), (gpfn))
   65.17 +    get_mfn_from_pfn((_d), (gpfn))
   65.18  
   65.19  #define __gpfn_invalid(_d, gpfn)			\
   65.20  	(__gpfn_to_mfn((_d), (gpfn)) & GPFN_INV_MASK)
    66.1 --- a/xen/include/asm-x86/mm.h	Mon Aug 29 16:05:29 2005 -0700
    66.2 +++ b/xen/include/asm-x86/mm.h	Tue Aug 30 13:36:49 2005 -0700
    66.3 @@ -255,28 +255,31 @@ int check_descriptor(struct desc_struct 
    66.4   * contiguous (or near contiguous) physical memory.
    66.5   */
    66.6  #undef  machine_to_phys_mapping
    66.7 -#define machine_to_phys_mapping ((u32 *)RDWR_MPT_VIRT_START)
    66.8 +#define machine_to_phys_mapping  ((u32 *)RDWR_MPT_VIRT_START)
    66.9  #define INVALID_M2P_ENTRY        (~0U)
   66.10  #define VALID_M2P(_e)            (!((_e) & (1U<<31)))
   66.11  #define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e))
   66.12  
   66.13 +#define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
   66.14 +#define get_pfn_from_mfn(mfn)      (machine_to_phys_mapping[(mfn)])
   66.15 +
   66.16  /*
   66.17   * The phys_to_machine_mapping is the reversed mapping of MPT for full
   66.18   * virtualization.  It is only used by shadow_mode_translate()==true
   66.19   * guests, so we steal the address space that would have normally
   66.20   * been used by the read-only MPT map.
   66.21   */
   66.22 -#define __phys_to_machine_mapping ((unsigned long *)RO_MPT_VIRT_START)
   66.23 -#define INVALID_MFN               (~0UL)
   66.24 -#define VALID_MFN(_mfn)           (!((_mfn) & (1U<<31)))
   66.25 +#define phys_to_machine_mapping ((unsigned long *)RO_MPT_VIRT_START)
   66.26 +#define INVALID_MFN             (~0UL)
   66.27 +#define VALID_MFN(_mfn)         (!((_mfn) & (1U<<31)))
   66.28  
   66.29 -/* Returns the machine physical */
   66.30 -static inline unsigned long phys_to_machine_mapping(unsigned long pfn) 
   66.31 +#define set_mfn_from_pfn(pfn, mfn) (phys_to_machine_mapping[(pfn)] = (mfn))
   66.32 +static inline unsigned long get_mfn_from_pfn(unsigned long pfn) 
   66.33  {
   66.34      unsigned long mfn;
   66.35      l1_pgentry_t pte;
   66.36  
   66.37 -    if ( (__copy_from_user(&pte, &__phys_to_machine_mapping[pfn],
   66.38 +    if ( (__copy_from_user(&pte, &phys_to_machine_mapping[pfn],
   66.39                             sizeof(pte)) == 0) &&
   66.40           (l1e_get_flags(pte) & _PAGE_PRESENT) )
   66.41  	mfn = l1e_get_pfn(pte);
   66.42 @@ -285,7 +288,6 @@ static inline unsigned long phys_to_mach
   66.43      
   66.44      return mfn; 
   66.45  }
   66.46 -#define set_machinetophys(_mfn, _pfn) machine_to_phys_mapping[(_mfn)] = (_pfn)
   66.47  
   66.48  #ifdef MEMORY_GUARD
   66.49  void memguard_init(void);
    67.1 --- a/xen/include/asm-x86/shadow.h	Mon Aug 29 16:05:29 2005 -0700
    67.2 +++ b/xen/include/asm-x86/shadow.h	Tue Aug 30 13:36:49 2005 -0700
    67.3 @@ -269,14 +269,14 @@ static inline void shadow_mode_disable(s
    67.4  
    67.5  #define __mfn_to_gpfn(_d, mfn)                         \
    67.6      ( (shadow_mode_translate(_d))                      \
    67.7 -      ? machine_to_phys_mapping[(mfn)]                 \
    67.8 +      ? get_pfn_from_mfn(mfn)                                   \
    67.9        : (mfn) )
   67.10  
   67.11  #define __gpfn_to_mfn(_d, gpfn)                        \
   67.12      ({                                                 \
   67.13          ASSERT(current->domain == (_d));               \
   67.14          (shadow_mode_translate(_d))                    \
   67.15 -        ? phys_to_machine_mapping(gpfn)                \
   67.16 +        ? get_mfn_from_pfn(gpfn)                \
   67.17          : (gpfn);                                      \
   67.18      })
   67.19  
   67.20 @@ -461,7 +461,7 @@ static inline int __mark_dirty(struct do
   67.21      // This wants the nice compact set of PFNs from 0..domain's max,
   67.22      // which __mfn_to_gpfn() only returns for translated domains.
   67.23      //
   67.24 -    pfn = machine_to_phys_mapping[mfn];
   67.25 +    pfn = get_pfn_from_mfn(mfn);
   67.26  
   67.27      /*
   67.28       * Values with the MSB set denote MFNs that aren't really part of the 
   67.29 @@ -562,7 +562,7 @@ update_hl2e(struct vcpu *v, unsigned lon
   67.30      old_hl2e = v->arch.hl2_vtable[index];
   67.31  
   67.32      if ( (l2e_get_flags(gl2e) & _PAGE_PRESENT) &&
   67.33 -         VALID_MFN(mfn = phys_to_machine_mapping(l2e_get_pfn(gl2e))) )
   67.34 +         VALID_MFN(mfn = get_mfn_from_pfn(l2e_get_pfn(gl2e))) )
   67.35          new_hl2e = l1e_from_pfn(mfn, __PAGE_HYPERVISOR);
   67.36      else
   67.37          new_hl2e = l1e_empty();
    68.1 --- a/xen/include/asm-x86/shadow_64.h	Mon Aug 29 16:05:29 2005 -0700
    68.2 +++ b/xen/include/asm-x86/shadow_64.h	Tue Aug 30 13:36:49 2005 -0700
    68.3 @@ -138,7 +138,7 @@ static inline pgentry_64_t *__entry(
    68.4              return NULL;
    68.5          mfn = entry_get_value(*le_e) >> PAGE_SHIFT;
    68.6          if ((flag & GUEST_ENTRY) && shadow_mode_translate(d))
    68.7 -            mfn = phys_to_machine_mapping(mfn);
    68.8 +            mfn = get_mfn_from_pfn(mfn);
    68.9          le_p = (pgentry_64_t *)phys_to_virt(mfn << PAGE_SHIFT);
   68.10          index = table_offset_64(va, (level + i - 1));
   68.11          le_e = &le_p[index];
   68.12 @@ -257,7 +257,7 @@ static inline void *  __guest_set_l1e(
   68.13                  if (unlikely(!(l2e_get_flags_32(gl2e) & _PAGE_PRESENT)))
   68.14                      return NULL;
   68.15  
   68.16 -                l1mfn = phys_to_machine_mapping(
   68.17 +                l1mfn = get_mfn_from_pfn(
   68.18                    l2e_get_pfn(gl2e));
   68.19  
   68.20                  l1va = (l1_pgentry_32_t *)
   68.21 @@ -299,7 +299,7 @@ static inline void *  __guest_get_l1e(
   68.22                      return NULL;
   68.23  
   68.24  
   68.25 -                l1mfn = phys_to_machine_mapping(
   68.26 +                l1mfn = get_mfn_from_pfn(
   68.27                    l2e_get_pfn(gl2e));
   68.28                  l1va = (l1_pgentry_32_t *) phys_to_virt(
   68.29                    l1mfn << L1_PAGETABLE_SHIFT);
    69.1 --- a/xen/include/asm-x86/vmx_platform.h	Mon Aug 29 16:05:29 2005 -0700
    69.2 +++ b/xen/include/asm-x86/vmx_platform.h	Tue Aug 30 13:36:49 2005 -0700
    69.3 @@ -91,6 +91,6 @@ extern int vmx_setup_platform(struct vcp
    69.4  extern void vmx_io_assist(struct vcpu *v);
    69.5  
    69.6  // XXX - think about this -- maybe use bit 30 of the mfn to signify an MMIO frame.
    69.7 -#define mmio_space(gpa) (!VALID_MFN(phys_to_machine_mapping((gpa) >> PAGE_SHIFT)))
    69.8 +#define mmio_space(gpa) (!VALID_MFN(get_mfn_from_pfn((gpa) >> PAGE_SHIFT)))
    69.9  
   69.10  #endif
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/xen/include/public/memory.h	Tue Aug 30 13:36:49 2005 -0700
    70.3 @@ -0,0 +1,50 @@
    70.4 +/******************************************************************************
    70.5 + * memory.h
    70.6 + * 
    70.7 + * Memory reservation and information.
    70.8 + * 
    70.9 + * Copyright (c) 2005, Keir Fraser <keir@xensource.com>
   70.10 + */
   70.11 +
   70.12 +#ifndef __XEN_PUBLIC_MEMORY_H__
   70.13 +#define __XEN_PUBLIC_MEMORY_H__
   70.14 +
   70.15 +/* arg == addr of struct xen_memory_reservation. */
   70.16 +#define XENMEM_increase_reservation 0
   70.17 +
   70.18 +/* arg == addr of struct xen_memory_reservation. */
   70.19 +#define XENMEM_decrease_reservation 1
   70.20 +
   70.21 +/* arg == addr of unsigned long. */
   70.22 +#define XENMEM_maximum_ram_page     2
   70.23 +
   70.24 +typedef struct xen_memory_reservation {
   70.25 +
   70.26 +    /*
   70.27 +     * MFN bases of extents to free (XENMEM_decrease_reservation).
   70.28 +     * MFN bases of extents that were allocated (XENMEM_increase_reservation).
   70.29 +     */
   70.30 +    unsigned long *extent_start;
   70.31 +
   70.32 +    /* Number of extents, and size/alignment of each (2^extent_order pages). */
   70.33 +    unsigned long  nr_extents;
   70.34 +    unsigned int   extent_order;
   70.35 +
   70.36 +    /*
   70.37 +     * XENMEM_increase_reservation: maximum # bits addressable by the user
   70.38 +     * of the allocated region (e.g., I/O devices often have a 32-bit
   70.39 +     * limitation even in 64-bit systems). If zero then the user has no
   70.40 +     * addressing restriction.
   70.41 +     * XENMEM_decrease_reservation: unused.
   70.42 +     */
   70.43 +    unsigned int   address_bits;
   70.44 +
   70.45 +    /*
   70.46 +     * Domain whose reservation is being changed.
   70.47 +     * Unprivileged domains can specify only DOMID_SELF.
   70.48 +     */
   70.49 +    domid_t        domid;
   70.50 +
   70.51 +} xen_memory_reservation_t;
   70.52 +
   70.53 +#endif /* __XEN_PUBLIC_MEMORY_H__ */
    71.1 --- a/xen/include/public/xen.h	Mon Aug 29 16:05:29 2005 -0700
    71.2 +++ b/xen/include/public/xen.h	Tue Aug 30 13:36:49 2005 -0700
    71.3 @@ -42,7 +42,7 @@
    71.4  #define __HYPERVISOR_set_debugreg          8
    71.5  #define __HYPERVISOR_get_debugreg          9
    71.6  #define __HYPERVISOR_update_descriptor    10
    71.7 -#define __HYPERVISOR_dom_mem_op           12
    71.8 +#define __HYPERVISOR_memory_op            12
    71.9  #define __HYPERVISOR_multicall            13
   71.10  #define __HYPERVISOR_update_va_mapping    14
   71.11  #define __HYPERVISOR_set_timer_op         15
   71.12 @@ -225,12 +225,6 @@ struct mmuext_op {
   71.13  #define CONSOLEIO_read          1
   71.14  
   71.15  /*
   71.16 - * Commands to HYPERVISOR_dom_mem_op().
   71.17 - */
   71.18 -#define MEMOP_increase_reservation 0
   71.19 -#define MEMOP_decrease_reservation 1
   71.20 -
   71.21 -/*
   71.22   * Commands to HYPERVISOR_vm_assist().
   71.23   */
   71.24  #define VMASST_CMD_enable                0
   71.25 @@ -438,19 +432,21 @@ typedef struct shared_info {
   71.26  #define MAX_GUEST_CMDLINE 1024
   71.27  typedef struct start_info {
   71.28      /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.    */
   71.29 -    unsigned long nr_pages;   /* Total pages allocated to this domain.    */
   71.30 -    unsigned long shared_info;/* MACHINE address of shared info struct.   */
   71.31 -    u32      flags;           /* SIF_xxx flags.                           */
   71.32 +    unsigned long nr_pages;     /* Total pages allocated to this domain.  */
   71.33 +    unsigned long shared_info;  /* MACHINE address of shared info struct. */
   71.34 +    u32      flags;             /* SIF_xxx flags.                         */
   71.35      u16      domain_controller_evtchn;
   71.36      /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
   71.37 -    unsigned long pt_base;    /* VIRTUAL address of page directory.       */
   71.38 -    unsigned long nr_pt_frames;/* Number of bootstrap p.t. frames.        */
   71.39 -    unsigned long mfn_list;   /* VIRTUAL address of page-frame list.      */
   71.40 -    unsigned long mod_start;  /* VIRTUAL address of pre-loaded module.    */
   71.41 -    unsigned long mod_len;    /* Size (bytes) of pre-loaded module.       */
   71.42 +    unsigned long pt_base;      /* VIRTUAL address of page directory.     */
   71.43 +    unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */
   71.44 +    unsigned long mfn_list;     /* VIRTUAL address of page-frame list.    */
   71.45 +    unsigned long mod_start;    /* VIRTUAL address of pre-loaded module.  */
   71.46 +    unsigned long mod_len;      /* Size (bytes) of pre-loaded module.     */
   71.47      s8 cmd_line[MAX_GUEST_CMDLINE];
   71.48 -    unsigned long store_mfn;  /* MACHINE page number of shared page.      */
   71.49 -    u16      store_evtchn;    /* Event channel for store communication.   */
   71.50 +    unsigned long store_mfn;    /* MACHINE page number of shared page.    */
   71.51 +    u16      store_evtchn;      /* Event channel for store communication. */
   71.52 +    unsigned long console_mfn;  /* MACHINE address of console page.       */
   71.53 +    u16      console_evtchn;    /* Event channel for console messages.    */
   71.54  } start_info_t;
   71.55  
   71.56  /* These flags are passed in the 'flags' field of start_info_t. */
    72.1 --- a/xen/include/xen/perfc.h	Mon Aug 29 16:05:29 2005 -0700
    72.2 +++ b/xen/include/xen/perfc.h	Tue Aug 30 13:36:49 2005 -0700
    72.3 @@ -4,6 +4,7 @@
    72.4  
    72.5  #ifdef PERF_COUNTERS
    72.6  
    72.7 +#include <xen/lib.h>
    72.8  #include <asm/atomic.h>
    72.9  
   72.10  /* 
   72.11 @@ -87,7 +88,7 @@ extern struct perfcounter perfcounters;
   72.12   * Histogram: special treatment for 0 and 1 count. After that equally spaced 
   72.13   * with last bucket taking the rest.
   72.14   */
   72.15 -#ifdef PERFC_ARRAYS
   72.16 +#ifdef PERF_ARRAYS
   72.17  #define perfc_incr_histo(_x,_v,_n)                                          \
   72.18      do {                                                                    \
   72.19          if ( (_v) == 0 )                                                    \