ia64/xen-unstable

changeset 4899:d16ae85cb89e

bitkeeper revision 1.1400 (4284b9fcQX9z9IzwMeHwdHYRkEIjFA)

Merge
author xenbk@gandalf.hpl.hp.com
date Fri May 13 14:30:20 2005 +0000 (2005-05-13)
parents ddd290cc8f0d 7bc5d4e9b217
children bb2558cbc4f8
files .rootkeys BitKeeper/etc/ignore BitKeeper/etc/logging_ok buildconfigs/Rules.mk buildconfigs/mk.linux-2.4-xen0 buildconfigs/mk.linux-2.4-xenU buildconfigs/mk.linux-2.6-xen0 buildconfigs/mk.linux-2.6-xenU buildconfigs/mk.netbsd-2.0-xenU docs/src/user.tex linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h patches/linux-2.6.11/linux-2.6.11.8.patch tools/libxc/xc.h tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_plan9_build.c tools/libxc/xc_private.c tools/libxc/xc_ptrace.c tools/libxc/xc_ptrace_core.c tools/libxc/xc_vmx_build.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendClient.py tools/python/xen/xend/XendDomain.py tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xend/server/SrvDomain.py tools/python/xen/xm/main.py xen/arch/ia64/domain.c xen/arch/ia64/idle0_task.c xen/arch/ia64/patch/linux-2.6.7/init_task.h xen/arch/ia64/process.c xen/arch/ia64/xenmisc.c xen/arch/ia64/xensetup.c xen/arch/x86/acpi/boot.c xen/arch/x86/audit.c xen/arch/x86/cdb.c xen/arch/x86/dom0_ops.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/e820.c xen/arch/x86/i387.c xen/arch/x86/idle0_task.c xen/arch/x86/mm.c xen/arch/x86/physdev.c xen/arch/x86/setup.c xen/arch/x86/shadow.c xen/arch/x86/smpboot.c xen/arch/x86/traps.c xen/arch/x86/vmx.c xen/arch/x86/vmx_io.c xen/arch/x86/vmx_vmcs.c xen/common/dom0_ops.c xen/common/dom_mem_ops.c xen/common/domain.c xen/common/event_channel.c xen/common/grant_table.c xen/common/kernel.c xen/common/keyhandler.c xen/common/lib.c xen/common/page_alloc.c xen/common/sched_bvt.c xen/common/sched_sedf.c xen/common/schedule.c xen/drivers/char/console.c xen/include/asm-x86/acpi.h xen/include/asm-x86/config.h xen/include/asm-x86/debugger.h xen/include/asm-x86/domain.h xen/include/asm-x86/i387.h xen/include/asm-x86/shadow.h xen/include/asm-x86/vmx.h xen/include/public/dom0_ops.h xen/include/public/xen.h xen/include/xen/event.h xen/include/xen/init.h xen/include/xen/lib.h xen/include/xen/sched.h
line diff
     1.1 --- a/.rootkeys	Wed May 11 13:43:50 2005 +0000
     1.2 +++ b/.rootkeys	Fri May 13 14:30:20 2005 +0000
     1.3 @@ -469,6 +469,7 @@ 413cb3b53nyOv1OIeDSsCXhBFDXvJA netbsd-2.
     1.4  413aa1d0oNP8HXLvfPuMe6cSroUfSA patches/linux-2.6.11/agpgart.patch
     1.5  427261074Iy1MkbbqIV6zdZDWWx_Jg patches/linux-2.6.11/i386-cpu-hotplug-updated-for-mm.patch
     1.6  42372652KCUP-IOH9RN19YQmGhs4aA patches/linux-2.6.11/iomap.patch
     1.7 +428359d4b3fDYtazwXi4UUmSWaOUew patches/linux-2.6.11/linux-2.6.11.8.patch
     1.8  424f001e_M1Tnxc52rDrmCLelnDWMQ patches/linux-2.6.11/x86_64-linux.patch
     1.9  3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
    1.10  40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Rules.mk
     2.1 --- a/BitKeeper/etc/ignore	Wed May 11 13:43:50 2005 +0000
     2.2 +++ b/BitKeeper/etc/ignore	Fri May 13 14:30:20 2005 +0000
     2.3 @@ -62,6 +62,7 @@ patches/ebtables-brnf-5_vs_2.4.25.diff
     2.4  patches/ebtables.diff
     2.5  patches/tmp/*
     2.6  pristine-*
     2.7 +ref-*
     2.8  tools/*/build/lib*/*.py
     2.9  tools/Makefile.smh
    2.10  tools/balloon/balloon
    2.11 @@ -89,8 +90,8 @@ tools/blktap/xen/*
    2.12  tools/check/.*
    2.13  tools/cmdline/*
    2.14  tools/cmdline/xen/*
    2.15 +tools/gdb/gdb-6.2.1-linux-i386-xen/*
    2.16  tools/gdb/gdb-6.2.1/*
    2.17 -tools/gdb/gdb-6.2.1-linux-i386-xen/*
    2.18  tools/ioemu/iodev/device-model
    2.19  tools/libxc/xen/*
    2.20  tools/misc/cpuperf/cpuperf-perfcntr
     3.1 --- a/BitKeeper/etc/logging_ok	Wed May 11 13:43:50 2005 +0000
     3.2 +++ b/BitKeeper/etc/logging_ok	Fri May 13 14:30:20 2005 +0000
     3.3 @@ -80,6 +80,7 @@ rn@wyvis.camb.intel-research.net
     3.4  rn@wyvis.research.intel-research.net
     3.5  rneugeba@wyvis.research
     3.6  rneugeba@wyvis.research.intel-research.net
     3.7 +rusty@rustcorp.com.au
     3.8  ryanh@us.ibm.com
     3.9  sd386@font.cl.cam.ac.uk
    3.10  shand@spidean.research.intel-research.net
     4.1 --- a/buildconfigs/Rules.mk	Wed May 11 13:43:50 2005 +0000
     4.2 +++ b/buildconfigs/Rules.mk	Fri May 13 14:30:20 2005 +0000
     4.3 @@ -43,6 +43,12 @@ netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).ta
     4.4  netbsd-%.tar.bz2: netbsd-%-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
     4.5  	ln -fs $< $@
     4.6  
     4.7 +ifeq ($(OS),linux)
     4.8 +OS_VER = $(LINUX_VER)
     4.9 +else
    4.10 +OS_VER = $(NETBSD_VER)
    4.11 +endif
    4.12 +
    4.13  pristine-%: %.tar.bz2
    4.14  	rm -rf tmp-$(@F) $@
    4.15  	mkdir -p tmp-$(@F)
    4.16 @@ -51,9 +57,17 @@ pristine-%: %.tar.bz2
    4.17  	touch $@ # update timestamp to avoid rebuild
    4.18  	touch $@/.bk_skip
    4.19  	@rm -rf tmp-$(@F)
    4.20 +
    4.21 +OS_PATCHES = $(shell echo patches/$(OS)-$(OS_VER)/*.patch)
    4.22 +
    4.23 +ref-%: pristine-% $(OS_PATCHES)
    4.24 +	rm -rf $@
    4.25 +	cp -al $< tmp-$(@F)
    4.26  	[ -d patches/$* ] && \
    4.27 -	  for i in patches/$*/*.patch ; do ( cd $@ ; patch -p1 <../$$i ) ; done || \
    4.28 +	  for i in patches/$*/*.patch ; do ( cd tmp-$(@F) ; patch -p1 <../$$i ) ; done || \
    4.29  	  true
    4.30 +	mv tmp-$(@F) $@
    4.31 +	touch $@ # update timestamp to avoid rebuild
    4.32  
    4.33  %-build:
    4.34  	$(MAKE) -f buildconfigs/mk.$* build
    4.35 @@ -67,7 +81,7 @@ pristine-%: %.tar.bz2
    4.36  %-config:
    4.37  	$(MAKE) -f buildconfigs/mk.$* config
    4.38  
    4.39 -%-xen.patch: pristine-%
    4.40 +%-xen.patch: ref-%
    4.41  	rm -rf tmp-$@
    4.42  	cp -al $< tmp-$@
    4.43  	( cd $*-xen-sparse && ./mkbuildtree ../tmp-$@ )	
    4.44 @@ -75,7 +89,7 @@ pristine-%: %.tar.bz2
    4.45  	rm -rf tmp-$@
    4.46  
    4.47  %-mrproper: %-mrproper-extra
    4.48 -	rm -rf pristine-$* $*.tar.bz2
    4.49 +	rm -rf pristine-$* ref-$* $*.tar.bz2
    4.50  	rm -rf $*-xen.patch
    4.51  
    4.52  netbsd-%-mrproper-extra:
     5.1 --- a/buildconfigs/mk.linux-2.4-xen0	Wed May 11 13:43:50 2005 +0000
     5.2 +++ b/buildconfigs/mk.linux-2.4-xen0	Fri May 13 14:30:20 2005 +0000
     5.3 @@ -1,3 +1,5 @@
     5.4 +
     5.5 +OS           = linux
     5.6  
     5.7  LINUX_SERIES = 2.4
     5.8  
     5.9 @@ -5,7 +7,7 @@ EXTRAVERSION = xen0
    5.10  
    5.11  FULLVERSION  = $(LINUX_VER)-$(EXTRAVERSION)
    5.12  
    5.13 -LINUX_DIR    = linux-$(FULLVERSION)
    5.14 +LINUX_DIR    = $(OS)-$(FULLVERSION)
    5.15  
    5.16  include buildconfigs/Rules.mk
    5.17  
    5.18 @@ -24,7 +26,7 @@ patches/tmp/ebtables.diff:
    5.19  	wget http://www.cl.cam.ac.uk/netos/xen/downloads/ebtables-brnf-5_vs_2.4.27.diff.gz -O- | gunzip -c > $@
    5.20  
    5.21  $(LINUX_DIR)/include/linux/autoconf.h: patches/tmp/ebtables.diff
    5.22 -$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
    5.23 +$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
    5.24  	rm -rf $(LINUX_DIR)
    5.25  	cp -al $< $(LINUX_DIR)
    5.26  	# Apply arch-xen patches
    5.27 @@ -53,4 +55,4 @@ clean:
    5.28  	$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
    5.29  
    5.30  delete: 
    5.31 -	rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) 
    5.32 +	rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR) 
     6.1 --- a/buildconfigs/mk.linux-2.4-xenU	Wed May 11 13:43:50 2005 +0000
     6.2 +++ b/buildconfigs/mk.linux-2.4-xenU	Fri May 13 14:30:20 2005 +0000
     6.3 @@ -1,3 +1,5 @@
     6.4 +
     6.5 +OS           = linux
     6.6  
     6.7  LINUX_SERIES = 2.4
     6.8  
     6.9 @@ -5,7 +7,7 @@ EXTRAVERSION = xenU
    6.10  
    6.11  FULLVERSION  = $(LINUX_VER)-$(EXTRAVERSION)
    6.12  
    6.13 -LINUX_DIR    = linux-$(FULLVERSION)
    6.14 +LINUX_DIR    = $(OS)-$(FULLVERSION)
    6.15  
    6.16  include buildconfigs/Rules.mk
    6.17  
    6.18 @@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoco
    6.19  	fi
    6.20  	$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
    6.21  
    6.22 -$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
    6.23 +$(LINUX_DIR)/include/linux/autoconf.h: ref-linux-$(LINUX_VER)
    6.24  	rm -rf $(LINUX_DIR)
    6.25  	cp -al $< $(LINUX_DIR)
    6.26  	# Apply arch-xen patches
    6.27 @@ -46,4 +48,4 @@ clean:
    6.28  	$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
    6.29  
    6.30  delete: 
    6.31 -	rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) 
    6.32 +	rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR) 
     7.1 --- a/buildconfigs/mk.linux-2.6-xen0	Wed May 11 13:43:50 2005 +0000
     7.2 +++ b/buildconfigs/mk.linux-2.6-xen0	Fri May 13 14:30:20 2005 +0000
     7.3 @@ -1,3 +1,5 @@
     7.4 +
     7.5 +OS           = linux
     7.6  
     7.7  LINUX_SERIES = 2.6
     7.8  
     7.9 @@ -5,7 +7,7 @@ EXTRAVERSION = xen0
    7.10  
    7.11  FULLVERSION  = $(LINUX_VER)-$(EXTRAVERSION)
    7.12  
    7.13 -LINUX_DIR    = linux-$(FULLVERSION)
    7.14 +LINUX_DIR    = $(OS)-$(FULLVERSION)
    7.15  
    7.16  include buildconfigs/Rules.mk
    7.17  
    7.18 @@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoco
    7.19  	fi
    7.20  	$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
    7.21  
    7.22 -$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
    7.23 +$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
    7.24  	rm -rf $(LINUX_DIR)
    7.25  	cp -al $< $(LINUX_DIR)
    7.26  	# Apply arch-xen patches
    7.27 @@ -44,4 +46,4 @@ clean:
    7.28  	$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
    7.29  
    7.30  delete: 
    7.31 -	rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) 
    7.32 +	rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR) 
     8.1 --- a/buildconfigs/mk.linux-2.6-xenU	Wed May 11 13:43:50 2005 +0000
     8.2 +++ b/buildconfigs/mk.linux-2.6-xenU	Fri May 13 14:30:20 2005 +0000
     8.3 @@ -1,3 +1,5 @@
     8.4 +
     8.5 +OS           = linux
     8.6  
     8.7  LINUX_SERIES = 2.6
     8.8  
     8.9 @@ -5,7 +7,7 @@ EXTRAVERSION = xenU
    8.10  
    8.11  FULLVERSION  = $(LINUX_VER)-$(EXTRAVERSION)
    8.12  
    8.13 -LINUX_DIR    = linux-$(FULLVERSION)
    8.14 +LINUX_DIR    = $(OS)-$(FULLVERSION)
    8.15  
    8.16  include buildconfigs/Rules.mk
    8.17  
    8.18 @@ -19,7 +21,7 @@ build: $(LINUX_DIR)/include/linux/autoco
    8.19  	fi
    8.20  	$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
    8.21  
    8.22 -$(LINUX_DIR)/include/linux/autoconf.h: pristine-linux-$(LINUX_VER)
    8.23 +$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)
    8.24  	rm -rf $(LINUX_DIR)
    8.25  	cp -al $< $(LINUX_DIR)
    8.26  	# Apply arch-xen patches
    8.27 @@ -44,4 +46,4 @@ clean:
    8.28  	$(MAKE) -C $(LINUX_DIR) ARCH=xen clean
    8.29  
    8.30  delete: 
    8.31 -	rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) 
    8.32 +	rm -rf tmp-$(OS)-$(LINUX_VER) $(LINUX_DIR) 
     9.1 --- a/buildconfigs/mk.netbsd-2.0-xenU	Wed May 11 13:43:50 2005 +0000
     9.2 +++ b/buildconfigs/mk.netbsd-2.0-xenU	Fri May 13 14:30:20 2005 +0000
     9.3 @@ -1,3 +1,5 @@
     9.4 +
     9.5 +OS                = netbsd
     9.6  
     9.7  NETBSD_RELEASE   ?= 2.0
     9.8  NETBSD_CVSSNAP   ?= 20050309
     9.9 @@ -6,13 +8,13 @@ EXTRAVERSION = xenU
    9.10  
    9.11  FULLVERSION  = $(NETBSD_VER)-$(EXTRAVERSION)
    9.12  
    9.13 -NETBSD_DIR   = netbsd-$(FULLVERSION)
    9.14 +NETBSD_DIR   = $(OS)-$(FULLVERSION)
    9.15  
    9.16  .PHONY: build clean mrproper mkpatch
    9.17  
    9.18  include buildconfigs/Rules.mk
    9.19  
    9.20 -build: netbsd-$(EXTRAVERSION)
    9.21 +build: $(OS)-$(EXTRAVERSION)
    9.22  
    9.23  netbsd-%-tools.tar.bz2:
    9.24  	@echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
    9.25 @@ -22,7 +24,7 @@ netbsd-%-tools: netbsd-%-tools.tar.bz2
    9.26  	tar -jxf $<
    9.27  	touch $@ # update timestamp to avoid rebuild
    9.28  
    9.29 -$(NETBSD_DIR)/.valid: pristine-netbsd-$(NETBSD_VER)
    9.30 +$(NETBSD_DIR)/.valid: ref-$(OS)-$(NETBSD_VER)
    9.31  	$(RM) -rf $(NETBSD_DIR)
    9.32  	cp -al $< $(NETBSD_DIR)
    9.33  	# Apply arch-xen patches
    9.34 @@ -40,4 +42,4 @@ clean:
    9.35  	$(MAKE) -C netbsd-$(FULLVERSION) clean
    9.36  
    9.37  delete:
    9.38 -	rm -rf tmp-netbsd-$(NETBSD_VER) $(NETBSD_DIR)
    9.39 +	rm -rf tmp-$(OS)-$(NETBSD_VER) $(NETBSD_DIR)
    10.1 --- a/docs/src/user.tex	Wed May 11 13:43:50 2005 +0000
    10.2 +++ b/docs/src/user.tex	Fri May 13 14:30:20 2005 +0000
    10.3 @@ -484,7 +484,7 @@ distribution.  The entry should look som
    10.4  {\small
    10.5  \begin{verbatim}
    10.6  title Xen 2.0 / XenLinux 2.6.9
    10.7 -  kernel /boot/xen.gz dom0_mem=131072
    10.8 +  kernel /boot/xen.gz dom0_mem=128M
    10.9    module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro console=tty0
   10.10  \end{verbatim}
   10.11  }
   10.12 @@ -524,7 +524,7 @@ have problems.
   10.13  
   10.14  \subsection{Serial Console (optional)}
   10.15  
   10.16 -%%   kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
   10.17 +%%   kernel /boot/xen.gz dom0_mem=128M com1=115200,8n1
   10.18  %%   module /boot/vmlinuz-2.6.9-xen0 root=/dev/sda4 ro 
   10.19  
   10.20  
   10.21 @@ -534,9 +534,9 @@ with:
   10.22  \begin{quote}
   10.23  {\small
   10.24  \begin{verbatim}
   10.25 -   kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1
   10.26 +   kernel /boot/xen.gz dom0_mem=128M com1=115200,8n1
   10.27  \end{verbatim}}
   10.28 -\end{quote} 
   10.29 +\end{quote}
   10.30  
   10.31  This configures Xen to output on COM1 at 115,200 baud, 8 data bits, 
   10.32  1 stop bit and no parity. Modify these parameters for your set up. 
   10.33 @@ -1680,12 +1680,6 @@ should be appended to Xen's command line
   10.34  editing \path{grub.conf}.
   10.35  
   10.36  \begin{description}
   10.37 -\item [ignorebiostables ] 
   10.38 - Disable parsing of BIOS-supplied tables. This may help with some
   10.39 - chipsets that aren't fully supported by Xen. If you specify this
   10.40 - option then ACPI tables are also ignored, and SMP support is
   10.41 - disabled. 
   10.42 -
   10.43  \item [noreboot ] 
   10.44   Don't reboot the machine automatically on errors.  This is
   10.45   useful to catch debug output if you aren't catching console messages
   10.46 @@ -1695,10 +1689,6 @@ editing \path{grub.conf}.
   10.47   Disable SMP support.
   10.48   This option is implied by `ignorebiostables'. 
   10.49  
   10.50 -\item [noacpi ] 
   10.51 - Disable ACPI tables, which confuse Xen on some chipsets.
   10.52 - This option is implied by `ignorebiostables'. 
   10.53 -
   10.54  \item [watchdog ] 
   10.55   Enable NMI watchdog which can report certain failures. 
   10.56  
   10.57 @@ -1756,8 +1746,18 @@ editing \path{grub.conf}.
   10.58   `nmi=dom0':   Inform DOM0 of the NMI. \\
   10.59   `nmi=ignore': Ignore the NMI. 
   10.60  
   10.61 +\item [mem=xxx ]
   10.62 + Set the physical RAM address limit. Any RAM appearing beyond this
   10.63 + physical address in the memory map will be ignored. This parameter
   10.64 + may be specified with a B, K, M or G suffix, representing bytes,
   10.65 + kilobytes, megabytes and gigabytes respectively. The
   10.66 + default unit, if no suffix is specified, is bytes.
   10.67 +
   10.68  \item [dom0\_mem=xxx ] 
   10.69 - Set the amount of memory (in kB) to be allocated to domain0.  
   10.70 + Set the amount of memory to be allocated to domain0. This parameter
   10.71 + may be specified with a B, K, M or G suffix, representing bytes,
   10.72 + kilobytes, megabytes and gigabytes respectively. The
   10.73 + default unit, if no suffix is specified, is kilobytes.
   10.74  
   10.75  \item [tbuf\_size=xxx ] 
   10.76   Set the size of the per-cpu trace buffers, in pages
   10.77 @@ -1769,16 +1769,29 @@ editing \path{grub.conf}.
   10.78   Select the CPU scheduler Xen should use.  The current
   10.79   possibilities are `bvt' (default), `atropos' and `rrobin'. 
   10.80   For more information see Section~\ref{s:sched}. 
   10.81 -
   10.82 -\item [physdev\_dom0\_hide=(xx:xx.x)(yy:yy.y)\ldots ]
   10.83 -Hide selected PCI devices from domain 0 (for instance, to stop it
   10.84 -taking ownership of them so that they can be driven by another
   10.85 -domain).  Device IDs should be given in hex format.  Bridge devices do
   10.86 -not need to be hidden --- they are hidden implicitly, since guest OSes
   10.87 -do not need to configure them.
   10.88  \end{description} 
   10.89  
   10.90 -
   10.91 +In addition, the following platform-specific options may be specified
   10.92 +on the Xen command line. Since domain 0 shares responsibility for
   10.93 +booting the platform, Xen will automatically propagate these options
   10.94 +to its command line.
   10.95 +
   10.96 +These options are taken from Linux's command-line syntax with
   10.97 +unchanged semantics.
   10.98 +
   10.99 +\begin{description}
  10.100 +\item [acpi=off,force,strict,ht,noirq,\ldots ] 
  10.101 + Modify how Xen (and domain 0) parses the BIOS ACPI tables.
  10.102 +
  10.103 +\item [acpi\_skip\_timer\_override ]
  10.104 + Instruct Xen (and domain 0) to ignore timer-interrupt override
  10.105 + instructions specified by the BIOS ACPI tables.
  10.106 +
  10.107 +\item [noapic ]
  10.108 + Instruct Xen (and domain 0) to ignore any IOAPICs that are present in
  10.109 + the system, and instead continue to use the legacy PIC.
  10.110 +
  10.111 +\end{description} 
  10.112  
  10.113  \section{XenLinux Boot Options}
  10.114  
    11.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c	Wed May 11 13:43:50 2005 +0000
    11.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c	Fri May 13 14:30:20 2005 +0000
    11.3 @@ -289,6 +289,10 @@ static void __init probe_roms(void)
    11.4  	unsigned char *rom;
    11.5  	int	      i;
    11.6  
    11.7 +	/* Nothing to do if not running in dom0. */
    11.8 +	if (!(xen_start_info.flags & SIF_INITDOMAIN))
    11.9 +		return;
   11.10 +
   11.11  	/* video rom */
   11.12  	upper = adapter_rom_resources[0].start;
   11.13  	for (start = video_rom_resource.start; start < upper; start += 2048) {
   11.14 @@ -1213,8 +1217,9 @@ static void __init register_memory(void)
   11.15  	else
   11.16  		legacy_init_iomem_resources(&code_resource, &data_resource);
   11.17  
   11.18 -	/* EFI systems may still have VGA */
   11.19 -	request_resource(&iomem_resource, &video_ram_resource);
   11.20 +	if (xen_start_info.flags & SIF_INITDOMAIN)
   11.21 +		/* EFI systems may still have VGA */
   11.22 +		request_resource(&iomem_resource, &video_ram_resource);
   11.23  
   11.24  	/* request I/O space for devices used on all i[345]86 PCs */
   11.25  	for (i = 0; i < STANDARD_IO_RESOURCES; i++)
   11.26 @@ -1571,6 +1576,14 @@ void __init setup_arch(char **cmdline_p)
   11.27  	op.u.set_iopl.iopl = current->thread.io_pl = 1;
   11.28  	HYPERVISOR_physdev_op(&op);
   11.29  
   11.30 +#ifdef CONFIG_ACPI_BOOT
   11.31 +	if (!(xen_start_info.flags & SIF_INITDOMAIN)) {
   11.32 +		printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
   11.33 +		acpi_disabled = 1;
   11.34 +		acpi_ht = 0;
   11.35 +	}
   11.36 +#endif
   11.37 +
   11.38  	/*
   11.39  	 * Parse the ACPI tables for possible boot-time SMP configuration.
   11.40  	 */
    12.1 --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Wed May 11 13:43:50 2005 +0000
    12.2 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/smpboot.c	Fri May 13 14:30:20 2005 +0000
    12.3 @@ -54,7 +54,9 @@
    12.4  #include <asm/desc.h>
    12.5  #include <asm/arch_hooks.h>
    12.6  
    12.7 -#include <mach_apic.h>
    12.8 +#ifndef CONFIG_X86_IO_APIC
    12.9 +#define Dprintk(args...)
   12.10 +#endif
   12.11  #include <mach_wakecpu.h>
   12.12  #include <smpboot_hooks.h>
   12.13  
   12.14 @@ -1096,6 +1098,7 @@ static void __init smp_boot_cpus(unsigne
   12.15  	cpus_clear(cpu_sibling_map[0]);
   12.16  	cpu_set(0, cpu_sibling_map[0]);
   12.17  
   12.18 +#ifdef CONFIG_X86_IO_APIC
   12.19  	/*
   12.20  	 * If we couldn't find an SMP configuration at boot time,
   12.21  	 * get out of here now!
   12.22 @@ -1106,12 +1109,15 @@ static void __init smp_boot_cpus(unsigne
   12.23  #if 0
   12.24  		phys_cpu_present_map = physid_mask_of_physid(0);
   12.25  #endif
   12.26 +#ifdef CONFIG_X86_LOCAL_APIC
   12.27  		if (APIC_init_uniprocessor())
   12.28  			printk(KERN_NOTICE "Local APIC not detected."
   12.29  					   " Using dummy APIC emulation.\n");
   12.30 +#endif
   12.31  		map_cpu_to_logical_apicid();
   12.32  		return;
   12.33  	}
   12.34 +#endif
   12.35  
   12.36  #if 0
   12.37  	/*
    13.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c	Wed May 11 13:43:50 2005 +0000
    13.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c	Fri May 13 14:30:20 2005 +0000
    13.3 @@ -486,12 +486,11 @@ static void dispatch_rw_block_io(blkif_t
    13.4          preq.nr_sects += seg[i].nsec;
    13.5  
    13.6          aop[i].u.map_grant_ref.host_virt_addr = MMAP_VADDR(pending_idx, i);
    13.7 -
    13.8          aop[i].u.map_grant_ref.dom = blkif->domid;
    13.9          aop[i].u.map_grant_ref.ref = blkif_gref_from_fas(fas);
   13.10 -        aop[i].u.map_grant_ref.flags = ( GNTMAP_host_map   |
   13.11 -                                       ( ( operation == READ ) ?
   13.12 -                                             0 : GNTMAP_readonly ) );
   13.13 +        aop[i].u.map_grant_ref.flags = GNTMAP_host_map;
   13.14 +        if ( operation == WRITE )
   13.15 +            aop[i].u.map_grant_ref.flags |= GNTMAP_readonly;
   13.16      }
   13.17  
   13.18      if ( unlikely(HYPERVISOR_grant_table_op(
    14.1 --- a/linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed May 11 13:43:50 2005 +0000
    14.2 +++ b/linux-2.6.11-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri May 13 14:30:20 2005 +0000
    14.3 @@ -824,7 +824,7 @@ static int blkif_queue_request(unsigned 
    14.4                          buffer_ma >> PAGE_SHIFT,
    14.5                          ( operation == BLKIF_OP_WRITE ? 1 : 0 ) );
    14.6  
    14.7 -            blk_shadow[id].frame[req->nr_segments] =
    14.8 +            blk_shadow[req->id].frame[req->nr_segments] =
    14.9                  buffer_ma >> PAGE_SHIFT;
   14.10  
   14.11              req->frame_and_sects[req->nr_segments] =
    15.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Wed May 11 13:43:50 2005 +0000
    15.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h	Fri May 13 14:30:20 2005 +0000
    15.3 @@ -13,7 +13,12 @@ static char * __init machine_specific_me
    15.4  
    15.5  	who = "Xen";
    15.6  
    15.7 -	start_pfn = 0;
    15.8 +	/* In dom0, we have to start the fake e820 map above the first
    15.9 +	 * 1MB, in other domains, it can start at 0. */
   15.10 +	if (xen_start_info.flags & SIF_INITDOMAIN)
   15.11 +		start_pfn = 0x100;
   15.12 +	else
   15.13 +		start_pfn = 0;
   15.14  	max_pfn = xen_start_info.nr_pages;
   15.15  
   15.16  	e820.nr_map = 0;
    16.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h	Wed May 11 13:43:50 2005 +0000
    16.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-i386/mach-xen/smpboot_hooks.h	Fri May 13 14:30:20 2005 +0000
    16.3 @@ -3,7 +3,9 @@
    16.4  
    16.5  static inline void smpboot_clear_io_apic_irqs(void)
    16.6  {
    16.7 +#ifdef CONFIG_X86_IO_APIC
    16.8  	io_apic_irqs = 0;
    16.9 +#endif
   16.10  }
   16.11  
   16.12  static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
   16.13 @@ -39,12 +41,14 @@ static inline void smpboot_restore_warm_
   16.14  
   16.15  static inline void smpboot_setup_io_apic(void)
   16.16  {
   16.17 +#ifdef CONFIG_X86_IO_APIC
   16.18  	/*
   16.19  	 * Here we can be sure that there is an IO-APIC in the system. Let's
   16.20  	 * go and set it up:
   16.21  	 */
   16.22  	if (!skip_ioapic_setup && nr_ioapics)
   16.23  		setup_IO_APIC();
   16.24 +#endif
   16.25  }
   16.26  
   16.27  
    17.1 --- a/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h	Wed May 11 13:43:50 2005 +0000
    17.2 +++ b/linux-2.6.11-xen-sparse/include/asm-xen/asm-x86_64/mach-xen/smpboot_hooks.h	Fri May 13 14:30:20 2005 +0000
    17.3 @@ -3,7 +3,9 @@
    17.4  
    17.5  static inline void smpboot_clear_io_apic_irqs(void)
    17.6  {
    17.7 +#ifdef CONFIG_X86_IO_APIC
    17.8  	io_apic_irqs = 0;
    17.9 +#endif
   17.10  }
   17.11  
   17.12  static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
   17.13 @@ -39,12 +41,14 @@ static inline void smpboot_restore_warm_
   17.14  
   17.15  static inline void smpboot_setup_io_apic(void)
   17.16  {
   17.17 +#ifdef CONFIG_X86_IO_APIC
   17.18  	/*
   17.19  	 * Here we can be sure that there is an IO-APIC in the system. Let's
   17.20  	 * go and set it up:
   17.21  	 */
   17.22  	if (!skip_ioapic_setup && nr_ioapics)
   17.23  		setup_IO_APIC();
   17.24 +#endif
   17.25  }
   17.26  
   17.27  
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/patches/linux-2.6.11/linux-2.6.11.8.patch	Fri May 13 14:30:20 2005 +0000
    18.3 @@ -0,0 +1,1613 @@
    18.4 +diff -Nru a/Makefile b/Makefile
    18.5 +--- a/Makefile	2005-04-29 18:34:28 -07:00
    18.6 ++++ b/Makefile	2005-04-29 18:34:28 -07:00
    18.7 +@@ -1,8 +1,8 @@
    18.8 + VERSION = 2
    18.9 + PATCHLEVEL = 6
   18.10 + SUBLEVEL = 11
   18.11 +-EXTRAVERSION =
   18.12 +-NAME=Woozy Numbat
   18.13 ++EXTRAVERSION = .8
   18.14 ++NAME=Woozy Beaver
   18.15 + 
   18.16 + # *DOCUMENTATION*
   18.17 + # To see a list of typical targets execute "make help"
   18.18 +diff -Nru a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
   18.19 +--- a/arch/ia64/kernel/fsys.S	2005-04-29 18:34:28 -07:00
   18.20 ++++ b/arch/ia64/kernel/fsys.S	2005-04-29 18:34:28 -07:00
   18.21 +@@ -611,8 +611,10 @@
   18.22 + 	movl r2=ia64_ret_from_syscall
   18.23 + 	;;
   18.24 + 	mov rp=r2				// set the real return addr
   18.25 +-	tbit.z p8,p0=r3,TIF_SYSCALL_TRACE
   18.26 ++	and r3=_TIF_SYSCALL_TRACEAUDIT,r3
   18.27 + 	;;
   18.28 ++	cmp.eq p8,p0=r3,r0
   18.29 ++
   18.30 + (p10)	br.cond.spnt.many ia64_ret_from_syscall	// p10==true means out registers are more than 8
   18.31 + (p8)	br.call.sptk.many b6=b6		// ignore this return addr
   18.32 + 	br.cond.sptk ia64_trace_syscall
   18.33 +diff -Nru a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
   18.34 +--- a/arch/ia64/kernel/signal.c	2005-04-29 18:34:28 -07:00
   18.35 ++++ b/arch/ia64/kernel/signal.c	2005-04-29 18:34:28 -07:00
   18.36 +@@ -224,7 +224,8 @@
   18.37 + 	 * could be corrupted.
   18.38 + 	 */
   18.39 + 	retval = (long) &ia64_leave_kernel;
   18.40 +-	if (test_thread_flag(TIF_SYSCALL_TRACE))
   18.41 ++	if (test_thread_flag(TIF_SYSCALL_TRACE)
   18.42 ++	    || test_thread_flag(TIF_SYSCALL_AUDIT))
   18.43 + 		/*
   18.44 + 		 * strace expects to be notified after sigreturn returns even though the
   18.45 + 		 * context to which we return may not be in the middle of a syscall.
   18.46 +diff -Nru a/arch/ppc/oprofile/op_model_fsl_booke.c b/arch/ppc/oprofile/op_model_fsl_booke.c
   18.47 +--- a/arch/ppc/oprofile/op_model_fsl_booke.c	2005-04-29 18:34:28 -07:00
   18.48 ++++ b/arch/ppc/oprofile/op_model_fsl_booke.c	2005-04-29 18:34:28 -07:00
   18.49 +@@ -150,7 +150,6 @@
   18.50 + 	int is_kernel;
   18.51 + 	int val;
   18.52 + 	int i;
   18.53 +-	unsigned int cpu = smp_processor_id();
   18.54 + 
   18.55 + 	/* set the PMM bit (see comment below) */
   18.56 + 	mtmsr(mfmsr() | MSR_PMM);
   18.57 +@@ -162,7 +161,7 @@
   18.58 + 		val = ctr_read(i);
   18.59 + 		if (val < 0) {
   18.60 + 			if (oprofile_running && ctr[i].enabled) {
   18.61 +-				oprofile_add_sample(pc, is_kernel, i, cpu);
   18.62 ++				oprofile_add_pc(pc, is_kernel, i);
   18.63 + 				ctr_write(i, reset_value[i]);
   18.64 + 			} else {
   18.65 + 				ctr_write(i, 0);
   18.66 +diff -Nru a/arch/ppc/platforms/4xx/ebony.h b/arch/ppc/platforms/4xx/ebony.h
   18.67 +--- a/arch/ppc/platforms/4xx/ebony.h	2005-04-29 18:34:28 -07:00
   18.68 ++++ b/arch/ppc/platforms/4xx/ebony.h	2005-04-29 18:34:28 -07:00
   18.69 +@@ -61,8 +61,8 @@
   18.70 +  */
   18.71 + 
   18.72 + /* OpenBIOS defined UART mappings, used before early_serial_setup */
   18.73 +-#define UART0_IO_BASE	(u8 *) 0xE0000200
   18.74 +-#define UART1_IO_BASE	(u8 *) 0xE0000300
   18.75 ++#define UART0_IO_BASE	0xE0000200
   18.76 ++#define UART1_IO_BASE	0xE0000300
   18.77 + 
   18.78 + /* external Epson SG-615P */
   18.79 + #define BASE_BAUD	691200
   18.80 +diff -Nru a/arch/ppc/platforms/4xx/luan.h b/arch/ppc/platforms/4xx/luan.h
   18.81 +--- a/arch/ppc/platforms/4xx/luan.h	2005-04-29 18:34:28 -07:00
   18.82 ++++ b/arch/ppc/platforms/4xx/luan.h	2005-04-29 18:34:28 -07:00
   18.83 +@@ -47,9 +47,9 @@
   18.84 + #define RS_TABLE_SIZE	3
   18.85 + 
   18.86 + /* PIBS defined UART mappings, used before early_serial_setup */
   18.87 +-#define UART0_IO_BASE	(u8 *) 0xa0000200
   18.88 +-#define UART1_IO_BASE	(u8 *) 0xa0000300
   18.89 +-#define UART2_IO_BASE	(u8 *) 0xa0000600
   18.90 ++#define UART0_IO_BASE	0xa0000200
   18.91 ++#define UART1_IO_BASE	0xa0000300
   18.92 ++#define UART2_IO_BASE	0xa0000600
   18.93 + 
   18.94 + #define BASE_BAUD	11059200
   18.95 + #define STD_UART_OP(num)					\
   18.96 +diff -Nru a/arch/ppc/platforms/4xx/ocotea.h b/arch/ppc/platforms/4xx/ocotea.h
   18.97 +--- a/arch/ppc/platforms/4xx/ocotea.h	2005-04-29 18:34:28 -07:00
   18.98 ++++ b/arch/ppc/platforms/4xx/ocotea.h	2005-04-29 18:34:28 -07:00
   18.99 +@@ -56,8 +56,8 @@
  18.100 + #define RS_TABLE_SIZE	2
  18.101 + 
  18.102 + /* OpenBIOS defined UART mappings, used before early_serial_setup */
  18.103 +-#define UART0_IO_BASE	(u8 *) 0xE0000200
  18.104 +-#define UART1_IO_BASE	(u8 *) 0xE0000300
  18.105 ++#define UART0_IO_BASE	0xE0000200
  18.106 ++#define UART1_IO_BASE	0xE0000300
  18.107 + 
  18.108 + #define BASE_BAUD	11059200/16
  18.109 + #define STD_UART_OP(num)					\
  18.110 +diff -Nru a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
  18.111 +--- a/arch/sparc/kernel/ptrace.c	2005-04-29 18:34:28 -07:00
  18.112 ++++ b/arch/sparc/kernel/ptrace.c	2005-04-29 18:34:28 -07:00
  18.113 +@@ -531,18 +531,6 @@
  18.114 + 			pt_error_return(regs, EIO);
  18.115 + 			goto out_tsk;
  18.116 + 		}
  18.117 +-		if (addr != 1) {
  18.118 +-			if (addr & 3) {
  18.119 +-				pt_error_return(regs, EINVAL);
  18.120 +-				goto out_tsk;
  18.121 +-			}
  18.122 +-#ifdef DEBUG_PTRACE
  18.123 +-			printk ("Original: %08lx %08lx\n", child->thread.kregs->pc, child->thread.kregs->npc);
  18.124 +-			printk ("Continuing with %08lx %08lx\n", addr, addr+4);
  18.125 +-#endif
  18.126 +-			child->thread.kregs->pc = addr;
  18.127 +-			child->thread.kregs->npc = addr + 4;
  18.128 +-		}
  18.129 + 
  18.130 + 		if (request == PTRACE_SYSCALL)
  18.131 + 			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  18.132 +diff -Nru a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
  18.133 +--- a/arch/sparc64/kernel/ptrace.c	2005-04-29 18:34:28 -07:00
  18.134 ++++ b/arch/sparc64/kernel/ptrace.c	2005-04-29 18:34:28 -07:00
  18.135 +@@ -514,25 +514,6 @@
  18.136 + 			pt_error_return(regs, EIO);
  18.137 + 			goto out_tsk;
  18.138 + 		}
  18.139 +-		if (addr != 1) {
  18.140 +-			unsigned long pc_mask = ~0UL;
  18.141 +-
  18.142 +-			if ((child->thread_info->flags & _TIF_32BIT) != 0)
  18.143 +-				pc_mask = 0xffffffff;
  18.144 +-
  18.145 +-			if (addr & 3) {
  18.146 +-				pt_error_return(regs, EINVAL);
  18.147 +-				goto out_tsk;
  18.148 +-			}
  18.149 +-#ifdef DEBUG_PTRACE
  18.150 +-			printk ("Original: %016lx %016lx\n",
  18.151 +-				child->thread_info->kregs->tpc,
  18.152 +-				child->thread_info->kregs->tnpc);
  18.153 +-			printk ("Continuing with %016lx %016lx\n", addr, addr+4);
  18.154 +-#endif
  18.155 +-			child->thread_info->kregs->tpc = (addr & pc_mask);
  18.156 +-			child->thread_info->kregs->tnpc = ((addr + 4) & pc_mask);
  18.157 +-		}
  18.158 + 
  18.159 + 		if (request == PTRACE_SYSCALL) {
  18.160 + 			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
  18.161 +diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
  18.162 +--- a/arch/sparc64/kernel/signal32.c	2005-04-29 18:34:28 -07:00
  18.163 ++++ b/arch/sparc64/kernel/signal32.c	2005-04-29 18:34:28 -07:00
  18.164 +@@ -192,9 +192,12 @@
  18.165 + 			err |= __put_user(from->si_uid, &to->si_uid);
  18.166 + 			break;
  18.167 + 		case __SI_FAULT >> 16:
  18.168 +-		case __SI_POLL >> 16:
  18.169 + 			err |= __put_user(from->si_trapno, &to->si_trapno);
  18.170 + 			err |= __put_user((unsigned long)from->si_addr, &to->si_addr);
  18.171 ++			break;
  18.172 ++		case __SI_POLL >> 16:
  18.173 ++			err |= __put_user(from->si_band, &to->si_band);
  18.174 ++			err |= __put_user(from->si_fd, &to->si_fd);
  18.175 + 			break;
  18.176 + 		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
  18.177 + 		case __SI_MESGQ >> 16:
  18.178 +diff -Nru a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
  18.179 +--- a/arch/sparc64/kernel/systbls.S	2005-04-29 18:34:27 -07:00
  18.180 ++++ b/arch/sparc64/kernel/systbls.S	2005-04-29 18:34:27 -07:00
  18.181 +@@ -75,7 +75,7 @@
  18.182 + /*260*/	.word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
  18.183 + 	.word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
  18.184 + /*270*/	.word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
  18.185 +-	.word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
  18.186 ++	.word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
  18.187 + /*280*/	.word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl
  18.188 + 
  18.189 + #endif /* CONFIG_COMPAT */
  18.190 +diff -Nru a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/include/sysdep-i386/syscalls.h
  18.191 +--- a/arch/um/include/sysdep-i386/syscalls.h	2005-04-29 18:34:27 -07:00
  18.192 ++++ b/arch/um/include/sysdep-i386/syscalls.h	2005-04-29 18:34:27 -07:00
  18.193 +@@ -23,6 +23,9 @@
  18.194 + 		      unsigned long prot, unsigned long flags,
  18.195 + 		      unsigned long fd, unsigned long pgoff);
  18.196 + 
  18.197 ++/* On i386 they choose a meaningless naming.*/
  18.198 ++#define __NR_kexec_load __NR_sys_kexec_load
  18.199 ++
  18.200 + #define ARCH_SYSCALLS \
  18.201 + 	[ __NR_waitpid ] = (syscall_handler_t *) sys_waitpid, \
  18.202 + 	[ __NR_break ] = (syscall_handler_t *) sys_ni_syscall, \
  18.203 +@@ -101,15 +104,12 @@
  18.204 + 	[ 223 ] = (syscall_handler_t *) sys_ni_syscall, \
  18.205 + 	[ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
  18.206 + 	[ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
  18.207 +-	[ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, \
  18.208 + 	[ 251 ] = (syscall_handler_t *) sys_ni_syscall, \
  18.209 +-        [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, \
  18.210 +-	[ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
  18.211 +-	[ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall,
  18.212 +-        
  18.213 ++	[ 285 ] = (syscall_handler_t *) sys_ni_syscall,
  18.214 ++
  18.215 + /* 222 doesn't yet have a name in include/asm-i386/unistd.h */
  18.216 + 
  18.217 +-#define LAST_ARCH_SYSCALL __NR_vserver
  18.218 ++#define LAST_ARCH_SYSCALL 285
  18.219 + 
  18.220 + /*
  18.221 +  * Overrides for Emacs so that we follow Linus's tabbing style.
  18.222 +diff -Nru a/arch/um/include/sysdep-x86_64/syscalls.h b/arch/um/include/sysdep-x86_64/syscalls.h
  18.223 +--- a/arch/um/include/sysdep-x86_64/syscalls.h	2005-04-29 18:34:28 -07:00
  18.224 ++++ b/arch/um/include/sysdep-x86_64/syscalls.h	2005-04-29 18:34:28 -07:00
  18.225 +@@ -71,12 +71,7 @@
  18.226 + 	[ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
  18.227 + 	[ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
  18.228 + 	[ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
  18.229 +-        [ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages, \
  18.230 + 	[ __NR_semtimedop ] = (syscall_handler_t *) sys_semtimedop, \
  18.231 +-	[ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, \
  18.232 +-	[ 223 ] = (syscall_handler_t *) sys_ni_syscall, \
  18.233 +-	[ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
  18.234 +-	[ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall, \
  18.235 + 	[ 251 ] = (syscall_handler_t *) sys_ni_syscall,
  18.236 + 
  18.237 + #define LAST_ARCH_SYSCALL 251
  18.238 +diff -Nru a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
  18.239 +--- a/arch/um/kernel/skas/uaccess.c	2005-04-29 18:34:28 -07:00
  18.240 ++++ b/arch/um/kernel/skas/uaccess.c	2005-04-29 18:34:28 -07:00
  18.241 +@@ -61,7 +61,8 @@
  18.242 + 	void *arg;
  18.243 + 	int *res;
  18.244 + 
  18.245 +-	va_copy(args, *(va_list *)arg_ptr);
  18.246 ++	/* Some old gccs recognize __va_copy, but not va_copy */
  18.247 ++	__va_copy(args, *(va_list *)arg_ptr);
  18.248 + 	addr = va_arg(args, unsigned long);
  18.249 + 	len = va_arg(args, int);
  18.250 + 	is_write = va_arg(args, int);
  18.251 +diff -Nru a/arch/um/kernel/sys_call_table.c b/arch/um/kernel/sys_call_table.c
  18.252 +--- a/arch/um/kernel/sys_call_table.c	2005-04-29 18:34:28 -07:00
  18.253 ++++ b/arch/um/kernel/sys_call_table.c	2005-04-29 18:34:28 -07:00
  18.254 +@@ -48,7 +48,6 @@
  18.255 + extern syscall_handler_t old_select;
  18.256 + extern syscall_handler_t sys_modify_ldt;
  18.257 + extern syscall_handler_t sys_rt_sigsuspend;
  18.258 +-extern syscall_handler_t sys_vserver;
  18.259 + extern syscall_handler_t sys_mbind;
  18.260 + extern syscall_handler_t sys_get_mempolicy;
  18.261 + extern syscall_handler_t sys_set_mempolicy;
  18.262 +@@ -242,6 +241,7 @@
  18.263 + 	[ __NR_epoll_create ] = (syscall_handler_t *) sys_epoll_create,
  18.264 + 	[ __NR_epoll_ctl ] = (syscall_handler_t *) sys_epoll_ctl,
  18.265 + 	[ __NR_epoll_wait ] = (syscall_handler_t *) sys_epoll_wait,
  18.266 ++	[ __NR_remap_file_pages ] = (syscall_handler_t *) sys_remap_file_pages,
  18.267 +         [ __NR_set_tid_address ] = (syscall_handler_t *) sys_set_tid_address,
  18.268 + 	[ __NR_timer_create ] = (syscall_handler_t *) sys_timer_create,
  18.269 + 	[ __NR_timer_settime ] = (syscall_handler_t *) sys_timer_settime,
  18.270 +@@ -252,12 +252,10 @@
  18.271 + 	[ __NR_clock_gettime ] = (syscall_handler_t *) sys_clock_gettime,
  18.272 + 	[ __NR_clock_getres ] = (syscall_handler_t *) sys_clock_getres,
  18.273 + 	[ __NR_clock_nanosleep ] = (syscall_handler_t *) sys_clock_nanosleep,
  18.274 +-	[ __NR_statfs64 ] = (syscall_handler_t *) sys_statfs64,
  18.275 +-	[ __NR_fstatfs64 ] = (syscall_handler_t *) sys_fstatfs64,
  18.276 + 	[ __NR_tgkill ] = (syscall_handler_t *) sys_tgkill,
  18.277 + 	[ __NR_utimes ] = (syscall_handler_t *) sys_utimes,
  18.278 +-	[ __NR_fadvise64_64 ] = (syscall_handler_t *) sys_fadvise64_64,
  18.279 +-	[ __NR_vserver ] = (syscall_handler_t *) sys_vserver,
  18.280 ++	[ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64,
  18.281 ++	[ __NR_vserver ] = (syscall_handler_t *) sys_ni_syscall,
  18.282 + 	[ __NR_mbind ] = (syscall_handler_t *) sys_mbind,
  18.283 + 	[ __NR_get_mempolicy ] = (syscall_handler_t *) sys_get_mempolicy,
  18.284 + 	[ __NR_set_mempolicy ] = (syscall_handler_t *) sys_set_mempolicy,
  18.285 +@@ -267,9 +265,8 @@
  18.286 + 	[ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive,
  18.287 + 	[ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify,
  18.288 + 	[ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr,
  18.289 +-	[ __NR_sys_kexec_load ] = (syscall_handler_t *) sys_ni_syscall,
  18.290 ++	[ __NR_kexec_load ] = (syscall_handler_t *) sys_ni_syscall,
  18.291 + 	[ __NR_waitid ] = (syscall_handler_t *) sys_waitid,
  18.292 +-	[ 285 ] = (syscall_handler_t *) sys_ni_syscall,
  18.293 + 	[ __NR_add_key ] = (syscall_handler_t *) sys_add_key,
  18.294 + 	[ __NR_request_key ] = (syscall_handler_t *) sys_request_key,
  18.295 + 	[ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl,
  18.296 +diff -Nru a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
  18.297 +--- a/drivers/char/drm/drm_ioctl.c	2005-04-29 18:34:27 -07:00
  18.298 ++++ b/drivers/char/drm/drm_ioctl.c	2005-04-29 18:34:27 -07:00
  18.299 +@@ -326,6 +326,8 @@
  18.300 + 
  18.301 + 	DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv));
  18.302 + 
  18.303 ++	memset(&version, 0, sizeof(version));
  18.304 ++
  18.305 + 	dev->driver->version(&version);
  18.306 + 	retv.drm_di_major = DRM_IF_MAJOR;
  18.307 + 	retv.drm_di_minor = DRM_IF_MINOR;
  18.308 +diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
  18.309 +--- a/drivers/i2c/chips/eeprom.c	2005-04-29 18:34:27 -07:00
  18.310 ++++ b/drivers/i2c/chips/eeprom.c	2005-04-29 18:34:27 -07:00
  18.311 +@@ -130,7 +130,8 @@
  18.312 + 
  18.313 + 	/* Hide Vaio security settings to regular users (16 first bytes) */
  18.314 + 	if (data->nature == VAIO && off < 16 && !capable(CAP_SYS_ADMIN)) {
  18.315 +-		int in_row1 = 16 - off;
  18.316 ++		size_t in_row1 = 16 - off;
  18.317 ++		in_row1 = min(in_row1, count);
  18.318 + 		memset(buf, 0, in_row1);
  18.319 + 		if (count - in_row1 > 0)
  18.320 + 			memcpy(buf + in_row1, &data->data[16], count - in_row1);
  18.321 +diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
  18.322 +--- a/drivers/i2c/chips/it87.c	2005-04-29 18:34:28 -07:00
  18.323 ++++ b/drivers/i2c/chips/it87.c	2005-04-29 18:34:28 -07:00
  18.324 +@@ -631,7 +631,7 @@
  18.325 + 	struct it87_data *data = it87_update_device(dev);
  18.326 + 	return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
  18.327 + }
  18.328 +-static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL);
  18.329 ++static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
  18.330 + 
  18.331 + static ssize_t
  18.332 + show_vrm_reg(struct device *dev, char *buf)
  18.333 +diff -Nru a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
  18.334 +--- a/drivers/i2c/chips/via686a.c	2005-04-29 18:34:27 -07:00
  18.335 ++++ b/drivers/i2c/chips/via686a.c	2005-04-29 18:34:27 -07:00
  18.336 +@@ -554,7 +554,7 @@
  18.337 + 	struct via686a_data *data = via686a_update_device(dev);
  18.338 + 	return sprintf(buf,"%d\n", ALARMS_FROM_REG(data->alarms));
  18.339 + }
  18.340 +-static DEVICE_ATTR(alarms, S_IRUGO | S_IWUSR, show_alarms, NULL);
  18.341 ++static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
  18.342 + 
  18.343 + /* The driver. I choose to use type i2c_driver, as at is identical to both
  18.344 +    smbus_driver and isa_driver, and clients could be of either kind */
  18.345 +diff -Nru a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
  18.346 +--- a/drivers/input/serio/i8042-x86ia64io.h	2005-04-29 18:34:28 -07:00
  18.347 ++++ b/drivers/input/serio/i8042-x86ia64io.h	2005-04-29 18:34:28 -07:00
  18.348 +@@ -88,7 +88,7 @@
  18.349 + };
  18.350 + #endif
  18.351 + 
  18.352 +-#ifdef CONFIG_ACPI
  18.353 ++#if defined(__ia64__) && defined(CONFIG_ACPI)
  18.354 + #include <linux/acpi.h>
  18.355 + #include <acpi/acpi_bus.h>
  18.356 + 
  18.357 +@@ -281,7 +281,7 @@
  18.358 + 	i8042_kbd_irq = I8042_MAP_IRQ(1);
  18.359 + 	i8042_aux_irq = I8042_MAP_IRQ(12);
  18.360 + 
  18.361 +-#ifdef CONFIG_ACPI
  18.362 ++#if defined(__ia64__) && defined(CONFIG_ACPI)
  18.363 + 	if (i8042_acpi_init())
  18.364 + 		return -1;
  18.365 + #endif
  18.366 +@@ -300,7 +300,7 @@
  18.367 + 
  18.368 + static inline void i8042_platform_exit(void)
  18.369 + {
  18.370 +-#ifdef CONFIG_ACPI
  18.371 ++#if defined(__ia64__) && defined(CONFIG_ACPI)
  18.372 + 	i8042_acpi_exit();
  18.373 + #endif
  18.374 + }
  18.375 +diff -Nru a/drivers/md/raid6altivec.uc b/drivers/md/raid6altivec.uc
  18.376 +--- a/drivers/md/raid6altivec.uc	2005-04-29 18:34:28 -07:00
  18.377 ++++ b/drivers/md/raid6altivec.uc	2005-04-29 18:34:28 -07:00
  18.378 +@@ -108,7 +108,11 @@
  18.379 + int raid6_have_altivec(void)
  18.380 + {
  18.381 + 	/* This assumes either all CPUs have Altivec or none does */
  18.382 ++#ifdef CONFIG_PPC64
  18.383 + 	return cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC;
  18.384 ++#else
  18.385 ++	return cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC;
  18.386 ++#endif
  18.387 + }
  18.388 + #endif
  18.389 + 
  18.390 +diff -Nru a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c
  18.391 +--- a/drivers/media/video/adv7170.c	2005-04-29 18:34:28 -07:00
  18.392 ++++ b/drivers/media/video/adv7170.c	2005-04-29 18:34:28 -07:00
  18.393 +@@ -130,7 +130,7 @@
  18.394 + 		u8 block_data[32];
  18.395 + 
  18.396 + 		msg.addr = client->addr;
  18.397 +-		msg.flags = client->flags;
  18.398 ++		msg.flags = 0;
  18.399 + 		while (len >= 2) {
  18.400 + 			msg.buf = (char *) block_data;
  18.401 + 			msg.len = 0;
  18.402 +diff -Nru a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
  18.403 +--- a/drivers/media/video/adv7175.c	2005-04-29 18:34:28 -07:00
  18.404 ++++ b/drivers/media/video/adv7175.c	2005-04-29 18:34:28 -07:00
  18.405 +@@ -126,7 +126,7 @@
  18.406 + 		u8 block_data[32];
  18.407 + 
  18.408 + 		msg.addr = client->addr;
  18.409 +-		msg.flags = client->flags;
  18.410 ++		msg.flags = 0;
  18.411 + 		while (len >= 2) {
  18.412 + 			msg.buf = (char *) block_data;
  18.413 + 			msg.len = 0;
  18.414 +diff -Nru a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c
  18.415 +--- a/drivers/media/video/bt819.c	2005-04-29 18:34:27 -07:00
  18.416 ++++ b/drivers/media/video/bt819.c	2005-04-29 18:34:27 -07:00
  18.417 +@@ -146,7 +146,7 @@
  18.418 + 		u8 block_data[32];
  18.419 + 
  18.420 + 		msg.addr = client->addr;
  18.421 +-		msg.flags = client->flags;
  18.422 ++		msg.flags = 0;
  18.423 + 		while (len >= 2) {
  18.424 + 			msg.buf = (char *) block_data;
  18.425 + 			msg.len = 0;
  18.426 +diff -Nru a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
  18.427 +--- a/drivers/media/video/bttv-cards.c	2005-04-29 18:34:28 -07:00
  18.428 ++++ b/drivers/media/video/bttv-cards.c	2005-04-29 18:34:28 -07:00
  18.429 +@@ -2718,8 +2718,6 @@
  18.430 +         }
  18.431 + 	btv->pll.pll_current = -1;
  18.432 + 
  18.433 +-	bttv_reset_audio(btv);
  18.434 +-
  18.435 + 	/* tuner configuration (from card list / autodetect / insmod option) */
  18.436 +  	if (UNSET != bttv_tvcards[btv->c.type].tuner_type)
  18.437 + 		if(UNSET == btv->tuner_type)
  18.438 +diff -Nru a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c
  18.439 +--- a/drivers/media/video/saa7110.c	2005-04-29 18:34:27 -07:00
  18.440 ++++ b/drivers/media/video/saa7110.c	2005-04-29 18:34:27 -07:00
  18.441 +@@ -60,8 +60,10 @@
  18.442 + 
  18.443 + #define	I2C_SAA7110		0x9C	/* or 0x9E */
  18.444 + 
  18.445 ++#define SAA7110_NR_REG		0x35
  18.446 ++
  18.447 + struct saa7110 {
  18.448 +-	unsigned char reg[54];
  18.449 ++	u8 reg[SAA7110_NR_REG];
  18.450 + 
  18.451 + 	int norm;
  18.452 + 	int input;
  18.453 +@@ -95,31 +97,28 @@
  18.454 + 		     unsigned int       len)
  18.455 + {
  18.456 + 	int ret = -1;
  18.457 +-	u8 reg = *data++;
  18.458 ++	u8 reg = *data;		/* first register to write to */
  18.459 + 
  18.460 +-	len--;
  18.461 ++	/* Sanity check */
  18.462 ++	if (reg + (len - 1) > SAA7110_NR_REG)
  18.463 ++		return ret;
  18.464 + 
  18.465 + 	/* the saa7110 has an autoincrement function, use it if
  18.466 + 	 * the adapter understands raw I2C */
  18.467 + 	if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
  18.468 + 		struct saa7110 *decoder = i2c_get_clientdata(client);
  18.469 + 		struct i2c_msg msg;
  18.470 +-		u8 block_data[54];
  18.471 + 
  18.472 +-		msg.len = 0;
  18.473 +-		msg.buf = (char *) block_data;
  18.474 ++		msg.len = len;
  18.475 ++		msg.buf = (char *) data;
  18.476 + 		msg.addr = client->addr;
  18.477 +-		msg.flags = client->flags;
  18.478 +-		while (len >= 1) {
  18.479 +-			msg.len = 0;
  18.480 +-			block_data[msg.len++] = reg;
  18.481 +-			while (len-- >= 1 && msg.len < 54)
  18.482 +-				block_data[msg.len++] =
  18.483 +-				    decoder->reg[reg++] = *data++;
  18.484 +-			ret = i2c_transfer(client->adapter, &msg, 1);
  18.485 +-		}
  18.486 ++		msg.flags = 0;
  18.487 ++		ret = i2c_transfer(client->adapter, &msg, 1);
  18.488 ++
  18.489 ++		/* Cache the written data */
  18.490 ++		memcpy(decoder->reg + reg, data + 1, len - 1);
  18.491 + 	} else {
  18.492 +-		while (len-- >= 1) {
  18.493 ++		for (++data, --len; len; len--) {
  18.494 + 			if ((ret = saa7110_write(client, reg++,
  18.495 + 						 *data++)) < 0)
  18.496 + 				break;
  18.497 +@@ -192,7 +191,7 @@
  18.498 + 	return 0;
  18.499 + }
  18.500 + 
  18.501 +-static const unsigned char initseq[] = {
  18.502 ++static const unsigned char initseq[1 + SAA7110_NR_REG] = {
  18.503 + 	0, 0x4C, 0x3C, 0x0D, 0xEF, 0xBD, 0xF2, 0x03, 0x00,
  18.504 + 	/* 0x08 */ 0xF8, 0xF8, 0x60, 0x60, 0x00, 0x86, 0x18, 0x90,
  18.505 + 	/* 0x10 */ 0x00, 0x59, 0x40, 0x46, 0x42, 0x1A, 0xFF, 0xDA,
  18.506 +diff -Nru a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c
  18.507 +--- a/drivers/media/video/saa7114.c	2005-04-29 18:34:28 -07:00
  18.508 ++++ b/drivers/media/video/saa7114.c	2005-04-29 18:34:28 -07:00
  18.509 +@@ -163,7 +163,7 @@
  18.510 + 		u8 block_data[32];
  18.511 + 
  18.512 + 		msg.addr = client->addr;
  18.513 +-		msg.flags = client->flags;
  18.514 ++		msg.flags = 0;
  18.515 + 		while (len >= 2) {
  18.516 + 			msg.buf = (char *) block_data;
  18.517 + 			msg.len = 0;
  18.518 +diff -Nru a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c
  18.519 +--- a/drivers/media/video/saa7185.c	2005-04-29 18:34:28 -07:00
  18.520 ++++ b/drivers/media/video/saa7185.c	2005-04-29 18:34:28 -07:00
  18.521 +@@ -118,7 +118,7 @@
  18.522 + 		u8 block_data[32];
  18.523 + 
  18.524 + 		msg.addr = client->addr;
  18.525 +-		msg.flags = client->flags;
  18.526 ++		msg.flags = 0;
  18.527 + 		while (len >= 2) {
  18.528 + 			msg.buf = (char *) block_data;
  18.529 + 			msg.len = 0;
  18.530 +diff -Nru a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
  18.531 +--- a/drivers/net/amd8111e.c	2005-04-29 18:34:28 -07:00
  18.532 ++++ b/drivers/net/amd8111e.c	2005-04-29 18:34:28 -07:00
  18.533 +@@ -1381,6 +1381,8 @@
  18.534 + 
  18.535 + 	if(amd8111e_restart(dev)){
  18.536 + 		spin_unlock_irq(&lp->lock);
  18.537 ++		if (dev->irq)
  18.538 ++			free_irq(dev->irq, dev);
  18.539 + 		return -ENOMEM;
  18.540 + 	}
  18.541 + 	/* Start ipg timer */
  18.542 +diff -Nru a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
  18.543 +--- a/drivers/net/ppp_async.c	2005-04-29 18:34:28 -07:00
  18.544 ++++ b/drivers/net/ppp_async.c	2005-04-29 18:34:28 -07:00
  18.545 +@@ -1000,7 +1000,7 @@
  18.546 + 	data += 4;
  18.547 + 	dlen -= 4;
  18.548 + 	/* data[0] is code, data[1] is length */
  18.549 +-	while (dlen >= 2 && dlen >= data[1]) {
  18.550 ++	while (dlen >= 2 && dlen >= data[1] && data[1] >= 2) {
  18.551 + 		switch (data[0]) {
  18.552 + 		case LCP_MRU:
  18.553 + 			val = (data[2] << 8) + data[3];
  18.554 +diff -Nru a/drivers/net/r8169.c b/drivers/net/r8169.c
  18.555 +--- a/drivers/net/r8169.c	2005-04-29 18:34:28 -07:00
  18.556 ++++ b/drivers/net/r8169.c	2005-04-29 18:34:28 -07:00
  18.557 +@@ -1683,16 +1683,19 @@
  18.558 + 	rtl8169_make_unusable_by_asic(desc);
  18.559 + }
  18.560 + 
  18.561 +-static inline void rtl8169_return_to_asic(struct RxDesc *desc, int rx_buf_sz)
  18.562 ++static inline void rtl8169_mark_to_asic(struct RxDesc *desc, u32 rx_buf_sz)
  18.563 + {
  18.564 +-	desc->opts1 |= cpu_to_le32(DescOwn + rx_buf_sz);
  18.565 ++	u32 eor = le32_to_cpu(desc->opts1) & RingEnd;
  18.566 ++
  18.567 ++	desc->opts1 = cpu_to_le32(DescOwn | eor | rx_buf_sz);
  18.568 + }
  18.569 + 
  18.570 +-static inline void rtl8169_give_to_asic(struct RxDesc *desc, dma_addr_t mapping,
  18.571 +-					int rx_buf_sz)
  18.572 ++static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
  18.573 ++				       u32 rx_buf_sz)
  18.574 + {
  18.575 + 	desc->addr = cpu_to_le64(mapping);
  18.576 +-	desc->opts1 |= cpu_to_le32(DescOwn + rx_buf_sz);
  18.577 ++	wmb();
  18.578 ++	rtl8169_mark_to_asic(desc, rx_buf_sz);
  18.579 + }
  18.580 + 
  18.581 + static int rtl8169_alloc_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
  18.582 +@@ -1712,7 +1715,7 @@
  18.583 + 	mapping = pci_map_single(pdev, skb->tail, rx_buf_sz,
  18.584 + 				 PCI_DMA_FROMDEVICE);
  18.585 + 
  18.586 +-	rtl8169_give_to_asic(desc, mapping, rx_buf_sz);
  18.587 ++	rtl8169_map_to_asic(desc, mapping, rx_buf_sz);
  18.588 + 
  18.589 + out:
  18.590 + 	return ret;
  18.591 +@@ -2150,7 +2153,7 @@
  18.592 + 			skb_reserve(skb, NET_IP_ALIGN);
  18.593 + 			eth_copy_and_sum(skb, sk_buff[0]->tail, pkt_size, 0);
  18.594 + 			*sk_buff = skb;
  18.595 +-			rtl8169_return_to_asic(desc, rx_buf_sz);
  18.596 ++			rtl8169_mark_to_asic(desc, rx_buf_sz);
  18.597 + 			ret = 0;
  18.598 + 		}
  18.599 + 	}
  18.600 +diff -Nru a/drivers/net/sis900.c b/drivers/net/sis900.c
  18.601 +--- a/drivers/net/sis900.c	2005-04-29 18:34:27 -07:00
  18.602 ++++ b/drivers/net/sis900.c	2005-04-29 18:34:27 -07:00
  18.603 +@@ -236,7 +236,7 @@
  18.604 + 	signature = (u16) read_eeprom(ioaddr, EEPROMSignature);    
  18.605 + 	if (signature == 0xffff || signature == 0x0000) {
  18.606 + 		printk (KERN_INFO "%s: Error EERPOM read %x\n", 
  18.607 +-			net_dev->name, signature);
  18.608 ++			pci_name(pci_dev), signature);
  18.609 + 		return 0;
  18.610 + 	}
  18.611 + 
  18.612 +@@ -268,7 +268,7 @@
  18.613 + 	if (!isa_bridge)
  18.614 + 		isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0018, isa_bridge);
  18.615 + 	if (!isa_bridge) {
  18.616 +-		printk("%s: Can not find ISA bridge\n", net_dev->name);
  18.617 ++		printk("%s: Can not find ISA bridge\n", pci_name(pci_dev));
  18.618 + 		return 0;
  18.619 + 	}
  18.620 + 	pci_read_config_byte(isa_bridge, 0x48, &reg);
  18.621 +@@ -456,10 +456,6 @@
  18.622 + 	net_dev->tx_timeout = sis900_tx_timeout;
  18.623 + 	net_dev->watchdog_timeo = TX_TIMEOUT;
  18.624 + 	net_dev->ethtool_ops = &sis900_ethtool_ops;
  18.625 +-	
  18.626 +-	ret = register_netdev(net_dev);
  18.627 +-	if (ret)
  18.628 +-		goto err_unmap_rx;
  18.629 + 		
  18.630 + 	/* Get Mac address according to the chip revision */
  18.631 + 	pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &revision);
  18.632 +@@ -476,7 +472,7 @@
  18.633 + 
  18.634 + 	if (ret == 0) {
  18.635 + 		ret = -ENODEV;
  18.636 +-		goto err_out_unregister;
  18.637 ++		goto err_unmap_rx;
  18.638 + 	}
  18.639 + 	
  18.640 + 	/* 630ET : set the mii access mode as software-mode */
  18.641 +@@ -486,7 +482,7 @@
  18.642 + 	/* probe for mii transceiver */
  18.643 + 	if (sis900_mii_probe(net_dev) == 0) {
  18.644 + 		ret = -ENODEV;
  18.645 +-		goto err_out_unregister;
  18.646 ++		goto err_unmap_rx;
  18.647 + 	}
  18.648 + 
  18.649 + 	/* save our host bridge revision */
  18.650 +@@ -496,6 +492,10 @@
  18.651 + 		pci_dev_put(dev);
  18.652 + 	}
  18.653 + 
  18.654 ++	ret = register_netdev(net_dev);
  18.655 ++	if (ret)
  18.656 ++		goto err_unmap_rx;
  18.657 ++
  18.658 + 	/* print some information about our NIC */
  18.659 + 	printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,
  18.660 + 	       card_name, ioaddr, net_dev->irq);
  18.661 +@@ -505,8 +505,6 @@
  18.662 + 
  18.663 + 	return 0;
  18.664 + 
  18.665 +- err_out_unregister:
  18.666 +- 	unregister_netdev(net_dev);
  18.667 +  err_unmap_rx:
  18.668 + 	pci_free_consistent(pci_dev, RX_TOTAL_SIZE, sis_priv->rx_ring,
  18.669 + 		sis_priv->rx_ring_dma);
  18.670 +@@ -533,6 +531,7 @@
  18.671 + static int __init sis900_mii_probe(struct net_device * net_dev)
  18.672 + {
  18.673 + 	struct sis900_private * sis_priv = net_dev->priv;
  18.674 ++	const char *dev_name = pci_name(sis_priv->pci_dev);
  18.675 + 	u16 poll_bit = MII_STAT_LINK, status = 0;
  18.676 + 	unsigned long timeout = jiffies + 5 * HZ;
  18.677 + 	int phy_addr;
  18.678 +@@ -582,21 +581,20 @@
  18.679 + 					mii_phy->phy_types =
  18.680 + 					    (mii_status & (MII_STAT_CAN_TX_FDX | MII_STAT_CAN_TX)) ? LAN : HOME;
  18.681 + 				printk(KERN_INFO "%s: %s transceiver found at address %d.\n",
  18.682 +-				       net_dev->name, mii_chip_table[i].name,
  18.683 ++				       dev_name, mii_chip_table[i].name,
  18.684 + 				       phy_addr);
  18.685 + 				break;
  18.686 + 			}
  18.687 + 			
  18.688 + 		if( !mii_chip_table[i].phy_id1 ) {
  18.689 + 			printk(KERN_INFO "%s: Unknown PHY transceiver found at address %d.\n",
  18.690 +-			       net_dev->name, phy_addr);
  18.691 ++			       dev_name, phy_addr);
  18.692 + 			mii_phy->phy_types = UNKNOWN;
  18.693 + 		}
  18.694 + 	}
  18.695 + 	
  18.696 + 	if (sis_priv->mii == NULL) {
  18.697 +-		printk(KERN_INFO "%s: No MII transceivers found!\n",
  18.698 +-			net_dev->name);
  18.699 ++		printk(KERN_INFO "%s: No MII transceivers found!\n", dev_name);
  18.700 + 		return 0;
  18.701 + 	}
  18.702 + 
  18.703 +@@ -621,7 +619,7 @@
  18.704 + 			poll_bit ^= (mdio_read(net_dev, sis_priv->cur_phy, MII_STATUS) & poll_bit);
  18.705 + 			if (time_after_eq(jiffies, timeout)) {
  18.706 + 				printk(KERN_WARNING "%s: reset phy and link down now\n",
  18.707 +-					net_dev->name);
  18.708 ++				       dev_name);
  18.709 + 				return -ETIME;
  18.710 + 			}
  18.711 + 		}
  18.712 +@@ -691,7 +689,7 @@
  18.713 + 		sis_priv->mii = default_phy;
  18.714 + 		sis_priv->cur_phy = default_phy->phy_addr;
  18.715 + 		printk(KERN_INFO "%s: Using transceiver found at address %d as default\n",
  18.716 +-					net_dev->name,sis_priv->cur_phy);
  18.717 ++		       pci_name(sis_priv->pci_dev), sis_priv->cur_phy);
  18.718 + 	}
  18.719 + 	
  18.720 + 	status = mdio_read(net_dev, sis_priv->cur_phy, MII_CONTROL);
  18.721 +diff -Nru a/drivers/net/tun.c b/drivers/net/tun.c
  18.722 +--- a/drivers/net/tun.c	2005-04-29 18:34:27 -07:00
  18.723 ++++ b/drivers/net/tun.c	2005-04-29 18:34:27 -07:00
  18.724 +@@ -229,7 +229,7 @@
  18.725 + 	size_t len = count;
  18.726 + 
  18.727 + 	if (!(tun->flags & TUN_NO_PI)) {
  18.728 +-		if ((len -= sizeof(pi)) > len)
  18.729 ++		if ((len -= sizeof(pi)) > count)
  18.730 + 			return -EINVAL;
  18.731 + 
  18.732 + 		if(memcpy_fromiovec((void *)&pi, iv, sizeof(pi)))
  18.733 +diff -Nru a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
  18.734 +--- a/drivers/net/via-rhine.c	2005-04-29 18:34:28 -07:00
  18.735 ++++ b/drivers/net/via-rhine.c	2005-04-29 18:34:28 -07:00
  18.736 +@@ -1197,8 +1197,10 @@
  18.737 + 		       dev->name, rp->pdev->irq);
  18.738 + 
  18.739 + 	rc = alloc_ring(dev);
  18.740 +-	if (rc)
  18.741 ++	if (rc) {
  18.742 ++		free_irq(rp->pdev->irq, dev);
  18.743 + 		return rc;
  18.744 ++	}
  18.745 + 	alloc_rbufs(dev);
  18.746 + 	alloc_tbufs(dev);
  18.747 + 	rhine_chip_reset(dev);
  18.748 +@@ -1898,6 +1900,9 @@
  18.749 + 	struct net_device *dev = pci_get_drvdata(pdev);
  18.750 + 	struct rhine_private *rp = netdev_priv(dev);
  18.751 + 	void __iomem *ioaddr = rp->base;
  18.752 ++
  18.753 ++	if (!(rp->quirks & rqWOL))
  18.754 ++		return; /* Nothing to do for non-WOL adapters */
  18.755 + 
  18.756 + 	rhine_power_init(dev);
  18.757 + 
  18.758 +diff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
  18.759 +--- a/drivers/net/wan/hd6457x.c	2005-04-29 18:34:27 -07:00
  18.760 ++++ b/drivers/net/wan/hd6457x.c	2005-04-29 18:34:27 -07:00
  18.761 +@@ -315,7 +315,7 @@
  18.762 + #endif
  18.763 + 	stats->rx_packets++;
  18.764 + 	stats->rx_bytes += skb->len;
  18.765 +-	skb->dev->last_rx = jiffies;
  18.766 ++	dev->last_rx = jiffies;
  18.767 + 	skb->protocol = hdlc_type_trans(skb, dev);
  18.768 + 	netif_rx(skb);
  18.769 + }
  18.770 +diff -Nru a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
  18.771 +--- a/drivers/pci/hotplug/pciehp_ctrl.c	2005-04-29 18:34:27 -07:00
  18.772 ++++ b/drivers/pci/hotplug/pciehp_ctrl.c	2005-04-29 18:34:27 -07:00
  18.773 +@@ -1354,10 +1354,11 @@
  18.774 + 				dbg("PCI Bridge Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", 
  18.775 + 					ctrl->seg, func->bus, func->device, func->function);
  18.776 + 				bridge_slot_remove(func);
  18.777 +-			} else
  18.778 ++			} else {
  18.779 + 				dbg("PCI Function Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", 
  18.780 + 					ctrl->seg, func->bus, func->device, func->function);
  18.781 + 				slot_remove(func);
  18.782 ++			}
  18.783 + 
  18.784 + 			func = pciehp_slot_find(ctrl->slot_bus, device, 0);
  18.785 + 		}
  18.786 +diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c
  18.787 +--- a/fs/binfmt_elf.c	2005-04-29 18:34:28 -07:00
  18.788 ++++ b/fs/binfmt_elf.c	2005-04-29 18:34:28 -07:00
  18.789 +@@ -1008,6 +1008,7 @@
  18.790 + static int load_elf_library(struct file *file)
  18.791 + {
  18.792 + 	struct elf_phdr *elf_phdata;
  18.793 ++	struct elf_phdr *eppnt;
  18.794 + 	unsigned long elf_bss, bss, len;
  18.795 + 	int retval, error, i, j;
  18.796 + 	struct elfhdr elf_ex;
  18.797 +@@ -1031,44 +1032,47 @@
  18.798 + 	/* j < ELF_MIN_ALIGN because elf_ex.e_phnum <= 2 */
  18.799 + 
  18.800 + 	error = -ENOMEM;
  18.801 +-	elf_phdata = (struct elf_phdr *) kmalloc(j, GFP_KERNEL);
  18.802 ++	elf_phdata = kmalloc(j, GFP_KERNEL);
  18.803 + 	if (!elf_phdata)
  18.804 + 		goto out;
  18.805 + 
  18.806 ++	eppnt = elf_phdata;
  18.807 + 	error = -ENOEXEC;
  18.808 +-	retval = kernel_read(file, elf_ex.e_phoff, (char *) elf_phdata, j);
  18.809 ++	retval = kernel_read(file, elf_ex.e_phoff, (char *)eppnt, j);
  18.810 + 	if (retval != j)
  18.811 + 		goto out_free_ph;
  18.812 + 
  18.813 + 	for (j = 0, i = 0; i<elf_ex.e_phnum; i++)
  18.814 +-		if ((elf_phdata + i)->p_type == PT_LOAD) j++;
  18.815 ++		if ((eppnt + i)->p_type == PT_LOAD)
  18.816 ++			j++;
  18.817 + 	if (j != 1)
  18.818 + 		goto out_free_ph;
  18.819 + 
  18.820 +-	while (elf_phdata->p_type != PT_LOAD) elf_phdata++;
  18.821 ++	while (eppnt->p_type != PT_LOAD)
  18.822 ++		eppnt++;
  18.823 + 
  18.824 + 	/* Now use mmap to map the library into memory. */
  18.825 + 	down_write(&current->mm->mmap_sem);
  18.826 + 	error = do_mmap(file,
  18.827 +-			ELF_PAGESTART(elf_phdata->p_vaddr),
  18.828 +-			(elf_phdata->p_filesz +
  18.829 +-			 ELF_PAGEOFFSET(elf_phdata->p_vaddr)),
  18.830 ++			ELF_PAGESTART(eppnt->p_vaddr),
  18.831 ++			(eppnt->p_filesz +
  18.832 ++			 ELF_PAGEOFFSET(eppnt->p_vaddr)),
  18.833 + 			PROT_READ | PROT_WRITE | PROT_EXEC,
  18.834 + 			MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
  18.835 +-			(elf_phdata->p_offset -
  18.836 +-			 ELF_PAGEOFFSET(elf_phdata->p_vaddr)));
  18.837 ++			(eppnt->p_offset -
  18.838 ++			 ELF_PAGEOFFSET(eppnt->p_vaddr)));
  18.839 + 	up_write(&current->mm->mmap_sem);
  18.840 +-	if (error != ELF_PAGESTART(elf_phdata->p_vaddr))
  18.841 ++	if (error != ELF_PAGESTART(eppnt->p_vaddr))
  18.842 + 		goto out_free_ph;
  18.843 + 
  18.844 +-	elf_bss = elf_phdata->p_vaddr + elf_phdata->p_filesz;
  18.845 ++	elf_bss = eppnt->p_vaddr + eppnt->p_filesz;
  18.846 + 	if (padzero(elf_bss)) {
  18.847 + 		error = -EFAULT;
  18.848 + 		goto out_free_ph;
  18.849 + 	}
  18.850 + 
  18.851 +-	len = ELF_PAGESTART(elf_phdata->p_filesz + elf_phdata->p_vaddr + ELF_MIN_ALIGN - 1);
  18.852 +-	bss = elf_phdata->p_memsz + elf_phdata->p_vaddr;
  18.853 ++	len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + ELF_MIN_ALIGN - 1);
  18.854 ++	bss = eppnt->p_memsz + eppnt->p_vaddr;
  18.855 + 	if (bss > len) {
  18.856 + 		down_write(&current->mm->mmap_sem);
  18.857 + 		do_brk(len, bss - len);
  18.858 +diff -Nru a/fs/cramfs/inode.c b/fs/cramfs/inode.c
  18.859 +--- a/fs/cramfs/inode.c	2005-04-29 18:34:27 -07:00
  18.860 ++++ b/fs/cramfs/inode.c	2005-04-29 18:34:27 -07:00
  18.861 +@@ -70,6 +70,7 @@
  18.862 + 			inode->i_data.a_ops = &cramfs_aops;
  18.863 + 		} else {
  18.864 + 			inode->i_size = 0;
  18.865 ++			inode->i_blocks = 0;
  18.866 + 			init_special_inode(inode, inode->i_mode,
  18.867 + 				old_decode_dev(cramfs_inode->size));
  18.868 + 		}
  18.869 +diff -Nru a/fs/eventpoll.c b/fs/eventpoll.c
  18.870 +--- a/fs/eventpoll.c	2005-04-29 18:34:27 -07:00
  18.871 ++++ b/fs/eventpoll.c	2005-04-29 18:34:27 -07:00
  18.872 +@@ -619,6 +619,7 @@
  18.873 + 	return error;
  18.874 + }
  18.875 + 
  18.876 ++#define MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
  18.877 + 
  18.878 + /*
  18.879 +  * Implement the event wait interface for the eventpoll file. It is the kernel
  18.880 +@@ -635,7 +636,7 @@
  18.881 + 		     current, epfd, events, maxevents, timeout));
  18.882 + 
  18.883 + 	/* The maximum number of event must be greater than zero */
  18.884 +-	if (maxevents <= 0)
  18.885 ++	if (maxevents <= 0 || maxevents > MAX_EVENTS)
  18.886 + 		return -EINVAL;
  18.887 + 
  18.888 + 	/* Verify that the area passed by the user is writeable */
  18.889 +diff -Nru a/fs/exec.c b/fs/exec.c
  18.890 +--- a/fs/exec.c	2005-04-29 18:34:27 -07:00
  18.891 ++++ b/fs/exec.c	2005-04-29 18:34:27 -07:00
  18.892 +@@ -814,7 +814,7 @@
  18.893 + {
  18.894 + 	/* buf must be at least sizeof(tsk->comm) in size */
  18.895 + 	task_lock(tsk);
  18.896 +-	memcpy(buf, tsk->comm, sizeof(tsk->comm));
  18.897 ++	strncpy(buf, tsk->comm, sizeof(tsk->comm));
  18.898 + 	task_unlock(tsk);
  18.899 + }
  18.900 + 
  18.901 +diff -Nru a/fs/ext2/dir.c b/fs/ext2/dir.c
  18.902 +--- a/fs/ext2/dir.c	2005-04-29 18:34:28 -07:00
  18.903 ++++ b/fs/ext2/dir.c	2005-04-29 18:34:28 -07:00
  18.904 +@@ -592,6 +592,7 @@
  18.905 + 		goto fail;
  18.906 + 	}
  18.907 + 	kaddr = kmap_atomic(page, KM_USER0);
  18.908 ++       memset(kaddr, 0, chunk_size);
  18.909 + 	de = (struct ext2_dir_entry_2 *)kaddr;
  18.910 + 	de->name_len = 1;
  18.911 + 	de->rec_len = cpu_to_le16(EXT2_DIR_REC_LEN(1));
  18.912 +diff -Nru a/fs/isofs/inode.c b/fs/isofs/inode.c
  18.913 +--- a/fs/isofs/inode.c	2005-04-29 18:34:28 -07:00
  18.914 ++++ b/fs/isofs/inode.c	2005-04-29 18:34:28 -07:00
  18.915 +@@ -685,6 +685,8 @@
  18.916 + 	  sbi->s_log_zone_size = isonum_723 (h_pri->logical_block_size);
  18.917 + 	  sbi->s_max_size = isonum_733(h_pri->volume_space_size);
  18.918 + 	} else {
  18.919 ++	  if (!pri)
  18.920 ++	    goto out_freebh;
  18.921 + 	  rootp = (struct iso_directory_record *) pri->root_directory_record;
  18.922 + 	  sbi->s_nzones = isonum_733 (pri->volume_space_size);
  18.923 + 	  sbi->s_log_zone_size = isonum_723 (pri->logical_block_size);
  18.924 +@@ -1394,6 +1396,9 @@
  18.925 + 	unsigned long hashval;
  18.926 + 	struct inode *inode;
  18.927 + 	struct isofs_iget5_callback_data data;
  18.928 ++
  18.929 ++	if (offset >= 1ul << sb->s_blocksize_bits)
  18.930 ++		return NULL;
  18.931 + 
  18.932 + 	data.block = block;
  18.933 + 	data.offset = offset;
  18.934 +diff -Nru a/fs/isofs/rock.c b/fs/isofs/rock.c
  18.935 +--- a/fs/isofs/rock.c	2005-04-29 18:34:28 -07:00
  18.936 ++++ b/fs/isofs/rock.c	2005-04-29 18:34:28 -07:00
  18.937 +@@ -53,6 +53,7 @@
  18.938 +   if(LEN & 1) LEN++;						\
  18.939 +   CHR = ((unsigned char *) DE) + LEN;				\
  18.940 +   LEN = *((unsigned char *) DE) - LEN;                          \
  18.941 ++  if (LEN<0) LEN=0;                                             \
  18.942 +   if (ISOFS_SB(inode->i_sb)->s_rock_offset!=-1)                \
  18.943 +   {                                                             \
  18.944 +      LEN-=ISOFS_SB(inode->i_sb)->s_rock_offset;                \
  18.945 +@@ -73,6 +74,10 @@
  18.946 +     offset1 = 0; \
  18.947 +     pbh = sb_bread(DEV->i_sb, block); \
  18.948 +     if(pbh){       \
  18.949 ++      if (offset > pbh->b_size || offset + cont_size > pbh->b_size){	\
  18.950 ++	brelse(pbh); \
  18.951 ++	goto out; \
  18.952 ++      } \
  18.953 +       memcpy(buffer + offset1, pbh->b_data + offset, cont_size - offset1); \
  18.954 +       brelse(pbh); \
  18.955 +       chr = (unsigned char *) buffer; \
  18.956 +@@ -103,12 +108,13 @@
  18.957 +     struct rock_ridge * rr;
  18.958 +     int sig;
  18.959 +     
  18.960 +-    while (len > 1){ /* There may be one byte for padding somewhere */
  18.961 ++    while (len > 2){ /* There may be one byte for padding somewhere */
  18.962 +       rr = (struct rock_ridge *) chr;
  18.963 +-      if (rr->len == 0) goto out; /* Something got screwed up here */
  18.964 ++      if (rr->len < 3) goto out; /* Something got screwed up here */
  18.965 +       sig = isonum_721(chr);
  18.966 +       chr += rr->len; 
  18.967 +       len -= rr->len;
  18.968 ++      if (len < 0) goto out;	/* corrupted isofs */
  18.969 + 
  18.970 +       switch(sig){
  18.971 +       case SIG('R','R'):
  18.972 +@@ -122,6 +128,7 @@
  18.973 + 	break;
  18.974 +       case SIG('N','M'):
  18.975 + 	if (truncate) break;
  18.976 ++	if (rr->len < 5) break;
  18.977 +         /*
  18.978 + 	 * If the flags are 2 or 4, this indicates '.' or '..'.
  18.979 + 	 * We don't want to do anything with this, because it
  18.980 +@@ -186,12 +193,13 @@
  18.981 +     struct rock_ridge * rr;
  18.982 +     int rootflag;
  18.983 +     
  18.984 +-    while (len > 1){ /* There may be one byte for padding somewhere */
  18.985 ++    while (len > 2){ /* There may be one byte for padding somewhere */
  18.986 +       rr = (struct rock_ridge *) chr;
  18.987 +-      if (rr->len == 0) goto out; /* Something got screwed up here */
  18.988 ++      if (rr->len < 3) goto out; /* Something got screwed up here */
  18.989 +       sig = isonum_721(chr);
  18.990 +       chr += rr->len; 
  18.991 +       len -= rr->len;
  18.992 ++      if (len < 0) goto out;	/* corrupted isofs */
  18.993 +       
  18.994 +       switch(sig){
  18.995 + #ifndef CONFIG_ZISOFS		/* No flag for SF or ZF */
  18.996 +@@ -462,7 +470,7 @@
  18.997 + 	struct rock_ridge *rr;
  18.998 + 
  18.999 + 	if (!ISOFS_SB(inode->i_sb)->s_rock)
 18.1000 +-		panic ("Cannot have symlink with high sierra variant of iso filesystem\n");
 18.1001 ++		goto error;
 18.1002 + 
 18.1003 + 	block = ei->i_iget5_block;
 18.1004 + 	lock_kernel();
 18.1005 +@@ -487,13 +495,15 @@
 18.1006 + 	SETUP_ROCK_RIDGE(raw_inode, chr, len);
 18.1007 + 
 18.1008 +       repeat:
 18.1009 +-	while (len > 1) { /* There may be one byte for padding somewhere */
 18.1010 ++	while (len > 2) { /* There may be one byte for padding somewhere */
 18.1011 + 		rr = (struct rock_ridge *) chr;
 18.1012 +-		if (rr->len == 0)
 18.1013 ++		if (rr->len < 3)
 18.1014 + 			goto out;	/* Something got screwed up here */
 18.1015 + 		sig = isonum_721(chr);
 18.1016 + 		chr += rr->len;
 18.1017 + 		len -= rr->len;
 18.1018 ++		if (len < 0)
 18.1019 ++			goto out;	/* corrupted isofs */
 18.1020 + 
 18.1021 + 		switch (sig) {
 18.1022 + 		case SIG('R', 'R'):
 18.1023 +@@ -543,6 +553,7 @@
 18.1024 +       fail:
 18.1025 + 	brelse(bh);
 18.1026 + 	unlock_kernel();
 18.1027 ++      error:
 18.1028 + 	SetPageError(page);
 18.1029 + 	kunmap(page);
 18.1030 + 	unlock_page(page);
 18.1031 +diff -Nru a/fs/jbd/transaction.c b/fs/jbd/transaction.c
 18.1032 +--- a/fs/jbd/transaction.c	2005-04-29 18:34:27 -07:00
 18.1033 ++++ b/fs/jbd/transaction.c	2005-04-29 18:34:27 -07:00
 18.1034 +@@ -1775,10 +1775,10 @@
 18.1035 + 			JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget");
 18.1036 + 			ret = __dispose_buffer(jh,
 18.1037 + 					journal->j_running_transaction);
 18.1038 ++			journal_put_journal_head(jh);
 18.1039 + 			spin_unlock(&journal->j_list_lock);
 18.1040 + 			jbd_unlock_bh_state(bh);
 18.1041 + 			spin_unlock(&journal->j_state_lock);
 18.1042 +-			journal_put_journal_head(jh);
 18.1043 + 			return ret;
 18.1044 + 		} else {
 18.1045 + 			/* There is no currently-running transaction. So the
 18.1046 +@@ -1789,10 +1789,10 @@
 18.1047 + 				JBUFFER_TRACE(jh, "give to committing trans");
 18.1048 + 				ret = __dispose_buffer(jh,
 18.1049 + 					journal->j_committing_transaction);
 18.1050 ++				journal_put_journal_head(jh);
 18.1051 + 				spin_unlock(&journal->j_list_lock);
 18.1052 + 				jbd_unlock_bh_state(bh);
 18.1053 + 				spin_unlock(&journal->j_state_lock);
 18.1054 +-				journal_put_journal_head(jh);
 18.1055 + 				return ret;
 18.1056 + 			} else {
 18.1057 + 				/* The orphan record's transaction has
 18.1058 +@@ -1813,10 +1813,10 @@
 18.1059 + 					journal->j_running_transaction);
 18.1060 + 			jh->b_next_transaction = NULL;
 18.1061 + 		}
 18.1062 ++		journal_put_journal_head(jh);
 18.1063 + 		spin_unlock(&journal->j_list_lock);
 18.1064 + 		jbd_unlock_bh_state(bh);
 18.1065 + 		spin_unlock(&journal->j_state_lock);
 18.1066 +-		journal_put_journal_head(jh);
 18.1067 + 		return 0;
 18.1068 + 	} else {
 18.1069 + 		/* Good, the buffer belongs to the running transaction.
 18.1070 +diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c
 18.1071 +--- a/fs/partitions/msdos.c	2005-04-29 18:34:28 -07:00
 18.1072 ++++ b/fs/partitions/msdos.c	2005-04-29 18:34:28 -07:00
 18.1073 +@@ -114,6 +114,9 @@
 18.1074 + 		 */
 18.1075 + 		for (i=0; i<4; i++, p++) {
 18.1076 + 			u32 offs, size, next;
 18.1077 ++
 18.1078 ++			if (SYS_IND(p) == 0)
 18.1079 ++				continue;
 18.1080 + 			if (!NR_SECTS(p) || is_extended_partition(p))
 18.1081 + 				continue;
 18.1082 + 
 18.1083 +@@ -430,6 +433,8 @@
 18.1084 + 	for (slot = 1 ; slot <= 4 ; slot++, p++) {
 18.1085 + 		u32 start = START_SECT(p)*sector_size;
 18.1086 + 		u32 size = NR_SECTS(p)*sector_size;
 18.1087 ++		if (SYS_IND(p) == 0)
 18.1088 ++			continue;
 18.1089 + 		if (!size)
 18.1090 + 			continue;
 18.1091 + 		if (is_extended_partition(p)) {
 18.1092 +diff -Nru a/kernel/signal.c b/kernel/signal.c
 18.1093 +--- a/kernel/signal.c	2005-04-29 18:34:27 -07:00
 18.1094 ++++ b/kernel/signal.c	2005-04-29 18:34:27 -07:00
 18.1095 +@@ -1728,6 +1728,7 @@
 18.1096 + 			 * with another processor delivering a stop signal,
 18.1097 + 			 * then the SIGCONT that wakes us up should clear it.
 18.1098 + 			 */
 18.1099 ++			read_unlock(&tasklist_lock);
 18.1100 + 			return 0;
 18.1101 + 		}
 18.1102 + 
 18.1103 +diff -Nru a/lib/rwsem-spinlock.c b/lib/rwsem-spinlock.c
 18.1104 +--- a/lib/rwsem-spinlock.c	2005-04-29 18:34:28 -07:00
 18.1105 ++++ b/lib/rwsem-spinlock.c	2005-04-29 18:34:28 -07:00
 18.1106 +@@ -140,12 +140,12 @@
 18.1107 + 
 18.1108 + 	rwsemtrace(sem, "Entering __down_read");
 18.1109 + 
 18.1110 +-	spin_lock(&sem->wait_lock);
 18.1111 ++	spin_lock_irq(&sem->wait_lock);
 18.1112 + 
 18.1113 + 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
 18.1114 + 		/* granted */
 18.1115 + 		sem->activity++;
 18.1116 +-		spin_unlock(&sem->wait_lock);
 18.1117 ++		spin_unlock_irq(&sem->wait_lock);
 18.1118 + 		goto out;
 18.1119 + 	}
 18.1120 + 
 18.1121 +@@ -160,7 +160,7 @@
 18.1122 + 	list_add_tail(&waiter.list, &sem->wait_list);
 18.1123 + 
 18.1124 + 	/* we don't need to touch the semaphore struct anymore */
 18.1125 +-	spin_unlock(&sem->wait_lock);
 18.1126 ++	spin_unlock_irq(&sem->wait_lock);
 18.1127 + 
 18.1128 + 	/* wait to be given the lock */
 18.1129 + 	for (;;) {
 18.1130 +@@ -181,10 +181,12 @@
 18.1131 +  */
 18.1132 + int fastcall __down_read_trylock(struct rw_semaphore *sem)
 18.1133 + {
 18.1134 ++	unsigned long flags;
 18.1135 + 	int ret = 0;
 18.1136 ++
 18.1137 + 	rwsemtrace(sem, "Entering __down_read_trylock");
 18.1138 + 
 18.1139 +-	spin_lock(&sem->wait_lock);
 18.1140 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1141 + 
 18.1142 + 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
 18.1143 + 		/* granted */
 18.1144 +@@ -192,7 +194,7 @@
 18.1145 + 		ret = 1;
 18.1146 + 	}
 18.1147 + 
 18.1148 +-	spin_unlock(&sem->wait_lock);
 18.1149 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1150 + 
 18.1151 + 	rwsemtrace(sem, "Leaving __down_read_trylock");
 18.1152 + 	return ret;
 18.1153 +@@ -209,12 +211,12 @@
 18.1154 + 
 18.1155 + 	rwsemtrace(sem, "Entering __down_write");
 18.1156 + 
 18.1157 +-	spin_lock(&sem->wait_lock);
 18.1158 ++	spin_lock_irq(&sem->wait_lock);
 18.1159 + 
 18.1160 + 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
 18.1161 + 		/* granted */
 18.1162 + 		sem->activity = -1;
 18.1163 +-		spin_unlock(&sem->wait_lock);
 18.1164 ++		spin_unlock_irq(&sem->wait_lock);
 18.1165 + 		goto out;
 18.1166 + 	}
 18.1167 + 
 18.1168 +@@ -229,7 +231,7 @@
 18.1169 + 	list_add_tail(&waiter.list, &sem->wait_list);
 18.1170 + 
 18.1171 + 	/* we don't need to touch the semaphore struct anymore */
 18.1172 +-	spin_unlock(&sem->wait_lock);
 18.1173 ++	spin_unlock_irq(&sem->wait_lock);
 18.1174 + 
 18.1175 + 	/* wait to be given the lock */
 18.1176 + 	for (;;) {
 18.1177 +@@ -250,10 +252,12 @@
 18.1178 +  */
 18.1179 + int fastcall __down_write_trylock(struct rw_semaphore *sem)
 18.1180 + {
 18.1181 ++	unsigned long flags;
 18.1182 + 	int ret = 0;
 18.1183 ++
 18.1184 + 	rwsemtrace(sem, "Entering __down_write_trylock");
 18.1185 + 
 18.1186 +-	spin_lock(&sem->wait_lock);
 18.1187 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1188 + 
 18.1189 + 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {
 18.1190 + 		/* granted */
 18.1191 +@@ -261,7 +265,7 @@
 18.1192 + 		ret = 1;
 18.1193 + 	}
 18.1194 + 
 18.1195 +-	spin_unlock(&sem->wait_lock);
 18.1196 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1197 + 
 18.1198 + 	rwsemtrace(sem, "Leaving __down_write_trylock");
 18.1199 + 	return ret;
 18.1200 +@@ -272,14 +276,16 @@
 18.1201 +  */
 18.1202 + void fastcall __up_read(struct rw_semaphore *sem)
 18.1203 + {
 18.1204 ++	unsigned long flags;
 18.1205 ++
 18.1206 + 	rwsemtrace(sem, "Entering __up_read");
 18.1207 + 
 18.1208 +-	spin_lock(&sem->wait_lock);
 18.1209 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1210 + 
 18.1211 + 	if (--sem->activity == 0 && !list_empty(&sem->wait_list))
 18.1212 + 		sem = __rwsem_wake_one_writer(sem);
 18.1213 + 
 18.1214 +-	spin_unlock(&sem->wait_lock);
 18.1215 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1216 + 
 18.1217 + 	rwsemtrace(sem, "Leaving __up_read");
 18.1218 + }
 18.1219 +@@ -289,15 +295,17 @@
 18.1220 +  */
 18.1221 + void fastcall __up_write(struct rw_semaphore *sem)
 18.1222 + {
 18.1223 ++	unsigned long flags;
 18.1224 ++
 18.1225 + 	rwsemtrace(sem, "Entering __up_write");
 18.1226 + 
 18.1227 +-	spin_lock(&sem->wait_lock);
 18.1228 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1229 + 
 18.1230 + 	sem->activity = 0;
 18.1231 + 	if (!list_empty(&sem->wait_list))
 18.1232 + 		sem = __rwsem_do_wake(sem, 1);
 18.1233 + 
 18.1234 +-	spin_unlock(&sem->wait_lock);
 18.1235 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1236 + 
 18.1237 + 	rwsemtrace(sem, "Leaving __up_write");
 18.1238 + }
 18.1239 +@@ -308,15 +316,17 @@
 18.1240 +  */
 18.1241 + void fastcall __downgrade_write(struct rw_semaphore *sem)
 18.1242 + {
 18.1243 ++	unsigned long flags;
 18.1244 ++
 18.1245 + 	rwsemtrace(sem, "Entering __downgrade_write");
 18.1246 + 
 18.1247 +-	spin_lock(&sem->wait_lock);
 18.1248 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1249 + 
 18.1250 + 	sem->activity = 1;
 18.1251 + 	if (!list_empty(&sem->wait_list))
 18.1252 + 		sem = __rwsem_do_wake(sem, 0);
 18.1253 + 
 18.1254 +-	spin_unlock(&sem->wait_lock);
 18.1255 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1256 + 
 18.1257 + 	rwsemtrace(sem, "Leaving __downgrade_write");
 18.1258 + }
 18.1259 +diff -Nru a/lib/rwsem.c b/lib/rwsem.c
 18.1260 +--- a/lib/rwsem.c	2005-04-29 18:34:28 -07:00
 18.1261 ++++ b/lib/rwsem.c	2005-04-29 18:34:28 -07:00
 18.1262 +@@ -150,7 +150,7 @@
 18.1263 + 	set_task_state(tsk, TASK_UNINTERRUPTIBLE);
 18.1264 + 
 18.1265 + 	/* set up my own style of waitqueue */
 18.1266 +-	spin_lock(&sem->wait_lock);
 18.1267 ++	spin_lock_irq(&sem->wait_lock);
 18.1268 + 	waiter->task = tsk;
 18.1269 + 	get_task_struct(tsk);
 18.1270 + 
 18.1271 +@@ -163,7 +163,7 @@
 18.1272 + 	if (!(count & RWSEM_ACTIVE_MASK))
 18.1273 + 		sem = __rwsem_do_wake(sem, 0);
 18.1274 + 
 18.1275 +-	spin_unlock(&sem->wait_lock);
 18.1276 ++	spin_unlock_irq(&sem->wait_lock);
 18.1277 + 
 18.1278 + 	/* wait to be given the lock */
 18.1279 + 	for (;;) {
 18.1280 +@@ -219,15 +219,17 @@
 18.1281 +  */
 18.1282 + struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem)
 18.1283 + {
 18.1284 ++	unsigned long flags;
 18.1285 ++
 18.1286 + 	rwsemtrace(sem, "Entering rwsem_wake");
 18.1287 + 
 18.1288 +-	spin_lock(&sem->wait_lock);
 18.1289 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1290 + 
 18.1291 + 	/* do nothing if list empty */
 18.1292 + 	if (!list_empty(&sem->wait_list))
 18.1293 + 		sem = __rwsem_do_wake(sem, 0);
 18.1294 + 
 18.1295 +-	spin_unlock(&sem->wait_lock);
 18.1296 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1297 + 
 18.1298 + 	rwsemtrace(sem, "Leaving rwsem_wake");
 18.1299 + 
 18.1300 +@@ -241,15 +243,17 @@
 18.1301 +  */
 18.1302 + struct rw_semaphore fastcall *rwsem_downgrade_wake(struct rw_semaphore *sem)
 18.1303 + {
 18.1304 ++	unsigned long flags;
 18.1305 ++
 18.1306 + 	rwsemtrace(sem, "Entering rwsem_downgrade_wake");
 18.1307 + 
 18.1308 +-	spin_lock(&sem->wait_lock);
 18.1309 ++	spin_lock_irqsave(&sem->wait_lock, flags);
 18.1310 + 
 18.1311 + 	/* do nothing if list empty */
 18.1312 + 	if (!list_empty(&sem->wait_list))
 18.1313 + 		sem = __rwsem_do_wake(sem, 1);
 18.1314 + 
 18.1315 +-	spin_unlock(&sem->wait_lock);
 18.1316 ++	spin_unlock_irqrestore(&sem->wait_lock, flags);
 18.1317 + 
 18.1318 + 	rwsemtrace(sem, "Leaving rwsem_downgrade_wake");
 18.1319 + 	return sem;
 18.1320 +diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
 18.1321 +--- a/net/bluetooth/af_bluetooth.c	2005-04-29 18:34:27 -07:00
 18.1322 ++++ b/net/bluetooth/af_bluetooth.c	2005-04-29 18:34:27 -07:00
 18.1323 +@@ -64,7 +64,7 @@
 18.1324 + 
 18.1325 + int bt_sock_register(int proto, struct net_proto_family *ops)
 18.1326 + {
 18.1327 +-	if (proto >= BT_MAX_PROTO)
 18.1328 ++	if (proto < 0 || proto >= BT_MAX_PROTO)
 18.1329 + 		return -EINVAL;
 18.1330 + 
 18.1331 + 	if (bt_proto[proto])
 18.1332 +@@ -77,7 +77,7 @@
 18.1333 + 
 18.1334 + int bt_sock_unregister(int proto)
 18.1335 + {
 18.1336 +-	if (proto >= BT_MAX_PROTO)
 18.1337 ++	if (proto < 0 || proto >= BT_MAX_PROTO)
 18.1338 + 		return -EINVAL;
 18.1339 + 
 18.1340 + 	if (!bt_proto[proto])
 18.1341 +@@ -92,7 +92,7 @@
 18.1342 + {
 18.1343 + 	int err = 0;
 18.1344 + 
 18.1345 +-	if (proto >= BT_MAX_PROTO)
 18.1346 ++	if (proto < 0 || proto >= BT_MAX_PROTO)
 18.1347 + 		return -EINVAL;
 18.1348 + 
 18.1349 + #if defined(CONFIG_KMOD)
 18.1350 +diff -Nru a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
 18.1351 +--- a/net/ipv4/fib_hash.c	2005-04-29 18:34:28 -07:00
 18.1352 ++++ b/net/ipv4/fib_hash.c	2005-04-29 18:34:28 -07:00
 18.1353 +@@ -919,13 +919,23 @@
 18.1354 + 	return fa;
 18.1355 + }
 18.1356 + 
 18.1357 ++static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
 18.1358 ++{
 18.1359 ++	struct fib_alias *fa = fib_get_first(seq);
 18.1360 ++
 18.1361 ++	if (fa)
 18.1362 ++		while (pos && (fa = fib_get_next(seq)))
 18.1363 ++			--pos;
 18.1364 ++	return pos ? NULL : fa;
 18.1365 ++}
 18.1366 ++
 18.1367 + static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
 18.1368 + {
 18.1369 + 	void *v = NULL;
 18.1370 + 
 18.1371 + 	read_lock(&fib_hash_lock);
 18.1372 + 	if (ip_fib_main_table)
 18.1373 +-		v = *pos ? fib_get_next(seq) : SEQ_START_TOKEN;
 18.1374 ++		v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
 18.1375 + 	return v;
 18.1376 + }
 18.1377 + 
 18.1378 +diff -Nru a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
 18.1379 +--- a/net/ipv4/tcp_input.c	2005-04-29 18:34:28 -07:00
 18.1380 ++++ b/net/ipv4/tcp_input.c	2005-04-29 18:34:28 -07:00
 18.1381 +@@ -1653,7 +1653,10 @@
 18.1382 + static void tcp_undo_cwr(struct tcp_sock *tp, int undo)
 18.1383 + {
 18.1384 + 	if (tp->prior_ssthresh) {
 18.1385 +-		tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh<<1);
 18.1386 ++		if (tcp_is_bic(tp))
 18.1387 ++			tp->snd_cwnd = max(tp->snd_cwnd, tp->bictcp.last_max_cwnd);
 18.1388 ++		else
 18.1389 ++			tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh<<1);
 18.1390 + 
 18.1391 + 		if (undo && tp->prior_ssthresh > tp->snd_ssthresh) {
 18.1392 + 			tp->snd_ssthresh = tp->prior_ssthresh;
 18.1393 +diff -Nru a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
 18.1394 +--- a/net/ipv4/tcp_timer.c	2005-04-29 18:34:28 -07:00
 18.1395 ++++ b/net/ipv4/tcp_timer.c	2005-04-29 18:34:28 -07:00
 18.1396 +@@ -38,6 +38,7 @@
 18.1397 + 
 18.1398 + #ifdef TCP_DEBUG
 18.1399 + const char tcp_timer_bug_msg[] = KERN_DEBUG "tcpbug: unknown timer value\n";
 18.1400 ++EXPORT_SYMBOL(tcp_timer_bug_msg);
 18.1401 + #endif
 18.1402 + 
 18.1403 + /*
 18.1404 +diff -Nru a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
 18.1405 +--- a/net/ipv4/xfrm4_output.c	2005-04-29 18:34:27 -07:00
 18.1406 ++++ b/net/ipv4/xfrm4_output.c	2005-04-29 18:34:27 -07:00
 18.1407 +@@ -103,16 +103,16 @@
 18.1408 + 			goto error_nolock;
 18.1409 + 	}
 18.1410 + 
 18.1411 +-	spin_lock_bh(&x->lock);
 18.1412 +-	err = xfrm_state_check(x, skb);
 18.1413 +-	if (err)
 18.1414 +-		goto error;
 18.1415 +-
 18.1416 + 	if (x->props.mode) {
 18.1417 + 		err = xfrm4_tunnel_check_size(skb);
 18.1418 + 		if (err)
 18.1419 +-			goto error;
 18.1420 ++			goto error_nolock;
 18.1421 + 	}
 18.1422 ++
 18.1423 ++	spin_lock_bh(&x->lock);
 18.1424 ++	err = xfrm_state_check(x, skb);
 18.1425 ++	if (err)
 18.1426 ++		goto error;
 18.1427 + 
 18.1428 + 	xfrm4_encap(skb);
 18.1429 + 
 18.1430 +diff -Nru a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
 18.1431 +--- a/net/ipv6/xfrm6_output.c	2005-04-29 18:34:28 -07:00
 18.1432 ++++ b/net/ipv6/xfrm6_output.c	2005-04-29 18:34:28 -07:00
 18.1433 +@@ -103,16 +103,16 @@
 18.1434 + 			goto error_nolock;
 18.1435 + 	}
 18.1436 + 
 18.1437 +-	spin_lock_bh(&x->lock);
 18.1438 +-	err = xfrm_state_check(x, skb);
 18.1439 +-	if (err)
 18.1440 +-		goto error;
 18.1441 +-
 18.1442 + 	if (x->props.mode) {
 18.1443 + 		err = xfrm6_tunnel_check_size(skb);
 18.1444 + 		if (err)
 18.1445 +-			goto error;
 18.1446 ++			goto error_nolock;
 18.1447 + 	}
 18.1448 ++
 18.1449 ++	spin_lock_bh(&x->lock);
 18.1450 ++	err = xfrm_state_check(x, skb);
 18.1451 ++	if (err)
 18.1452 ++		goto error;
 18.1453 + 
 18.1454 + 	xfrm6_encap(skb);
 18.1455 + 
 18.1456 +diff -Nru a/net/netrom/nr_in.c b/net/netrom/nr_in.c
 18.1457 +--- a/net/netrom/nr_in.c	2005-04-29 18:34:27 -07:00
 18.1458 ++++ b/net/netrom/nr_in.c	2005-04-29 18:34:27 -07:00
 18.1459 +@@ -74,7 +74,6 @@
 18.1460 + static int nr_state1_machine(struct sock *sk, struct sk_buff *skb,
 18.1461 + 	int frametype)
 18.1462 + {
 18.1463 +-	bh_lock_sock(sk);
 18.1464 + 	switch (frametype) {
 18.1465 + 	case NR_CONNACK: {
 18.1466 + 		nr_cb *nr = nr_sk(sk);
 18.1467 +@@ -103,8 +102,6 @@
 18.1468 + 	default:
 18.1469 + 		break;
 18.1470 + 	}
 18.1471 +-	bh_unlock_sock(sk);
 18.1472 +-
 18.1473 + 	return 0;
 18.1474 + }
 18.1475 + 
 18.1476 +@@ -116,7 +113,6 @@
 18.1477 + static int nr_state2_machine(struct sock *sk, struct sk_buff *skb,
 18.1478 + 	int frametype)
 18.1479 + {
 18.1480 +-	bh_lock_sock(sk);
 18.1481 + 	switch (frametype) {
 18.1482 + 	case NR_CONNACK | NR_CHOKE_FLAG:
 18.1483 + 		nr_disconnect(sk, ECONNRESET);
 18.1484 +@@ -132,8 +128,6 @@
 18.1485 + 	default:
 18.1486 + 		break;
 18.1487 + 	}
 18.1488 +-	bh_unlock_sock(sk);
 18.1489 +-
 18.1490 + 	return 0;
 18.1491 + }
 18.1492 + 
 18.1493 +@@ -154,7 +148,6 @@
 18.1494 + 	nr = skb->data[18];
 18.1495 + 	ns = skb->data[17];
 18.1496 + 
 18.1497 +-	bh_lock_sock(sk);
 18.1498 + 	switch (frametype) {
 18.1499 + 	case NR_CONNREQ:
 18.1500 + 		nr_write_internal(sk, NR_CONNACK);
 18.1501 +@@ -265,8 +258,6 @@
 18.1502 + 	default:
 18.1503 + 		break;
 18.1504 + 	}
 18.1505 +-	bh_unlock_sock(sk);
 18.1506 +-
 18.1507 + 	return queued;
 18.1508 + }
 18.1509 + 
 18.1510 +diff -Nru a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
 18.1511 +--- a/net/xfrm/xfrm_state.c	2005-04-29 18:34:28 -07:00
 18.1512 ++++ b/net/xfrm/xfrm_state.c	2005-04-29 18:34:28 -07:00
 18.1513 +@@ -609,7 +609,7 @@
 18.1514 + 
 18.1515 + 	for (i = 0; i < XFRM_DST_HSIZE; i++) {
 18.1516 + 		list_for_each_entry(x, xfrm_state_bydst+i, bydst) {
 18.1517 +-			if (x->km.seq == seq) {
 18.1518 ++			if (x->km.seq == seq && x->km.state == XFRM_STATE_ACQ) {
 18.1519 + 				xfrm_state_hold(x);
 18.1520 + 				return x;
 18.1521 + 			}
 18.1522 +diff -Nru a/security/keys/key.c b/security/keys/key.c
 18.1523 +--- a/security/keys/key.c	2005-04-29 18:34:28 -07:00
 18.1524 ++++ b/security/keys/key.c	2005-04-29 18:34:28 -07:00
 18.1525 +@@ -57,9 +57,10 @@
 18.1526 + {
 18.1527 + 	struct key_user *candidate = NULL, *user;
 18.1528 + 	struct rb_node *parent = NULL;
 18.1529 +-	struct rb_node **p = &key_user_tree.rb_node;
 18.1530 ++	struct rb_node **p;
 18.1531 + 
 18.1532 +  try_again:
 18.1533 ++	p = &key_user_tree.rb_node;
 18.1534 + 	spin_lock(&key_user_lock);
 18.1535 + 
 18.1536 + 	/* search the tree for a user record with a matching UID */
 18.1537 +diff -Nru a/sound/core/timer.c b/sound/core/timer.c
 18.1538 +--- a/sound/core/timer.c	2005-04-29 18:34:28 -07:00
 18.1539 ++++ b/sound/core/timer.c	2005-04-29 18:34:28 -07:00
 18.1540 +@@ -1117,7 +1117,8 @@
 18.1541 + 	if (tu->qused >= tu->queue_size) {
 18.1542 + 		tu->overrun++;
 18.1543 + 	} else {
 18.1544 +-		memcpy(&tu->queue[tu->qtail++], tread, sizeof(*tread));
 18.1545 ++		memcpy(&tu->tqueue[tu->qtail++], tread, sizeof(*tread));
 18.1546 ++		tu->qtail %= tu->queue_size;
 18.1547 + 		tu->qused++;
 18.1548 + 	}
 18.1549 + }
 18.1550 +@@ -1140,6 +1141,8 @@
 18.1551 + 	spin_lock(&tu->qlock);
 18.1552 + 	snd_timer_user_append_to_tqueue(tu, &r1);
 18.1553 + 	spin_unlock(&tu->qlock);
 18.1554 ++	kill_fasync(&tu->fasync, SIGIO, POLL_IN);
 18.1555 ++	wake_up(&tu->qchange_sleep);
 18.1556 + }
 18.1557 + 
 18.1558 + static void snd_timer_user_tinterrupt(snd_timer_instance_t *timeri,
 18.1559 +diff -Nru a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
 18.1560 +--- a/sound/pci/ac97/ac97_codec.c	2005-04-29 18:34:28 -07:00
 18.1561 ++++ b/sound/pci/ac97/ac97_codec.c	2005-04-29 18:34:28 -07:00
 18.1562 +@@ -1185,7 +1185,7 @@
 18.1563 + /*
 18.1564 +  * create mute switch(es) for normal stereo controls
 18.1565 +  */
 18.1566 +-static int snd_ac97_cmute_new(snd_card_t *card, char *name, int reg, ac97_t *ac97)
 18.1567 ++static int snd_ac97_cmute_new_stereo(snd_card_t *card, char *name, int reg, int check_stereo, ac97_t *ac97)
 18.1568 + {
 18.1569 + 	snd_kcontrol_t *kctl;
 18.1570 + 	int err;
 18.1571 +@@ -1196,7 +1196,7 @@
 18.1572 + 
 18.1573 + 	mute_mask = 0x8000;
 18.1574 + 	val = snd_ac97_read(ac97, reg);
 18.1575 +-	if (ac97->flags & AC97_STEREO_MUTES) {
 18.1576 ++	if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) {
 18.1577 + 		/* check whether both mute bits work */
 18.1578 + 		val1 = val | 0x8080;
 18.1579 + 		snd_ac97_write(ac97, reg, val1);
 18.1580 +@@ -1254,7 +1254,7 @@
 18.1581 + /*
 18.1582 +  * create a mute-switch and a volume for normal stereo/mono controls
 18.1583 +  */
 18.1584 +-static int snd_ac97_cmix_new(snd_card_t *card, const char *pfx, int reg, ac97_t *ac97)
 18.1585 ++static int snd_ac97_cmix_new_stereo(snd_card_t *card, const char *pfx, int reg, int check_stereo, ac97_t *ac97)
 18.1586 + {
 18.1587 + 	int err;
 18.1588 + 	char name[44];
 18.1589 +@@ -1265,7 +1265,7 @@
 18.1590 + 
 18.1591 + 	if (snd_ac97_try_bit(ac97, reg, 15)) {
 18.1592 + 		sprintf(name, "%s Switch", pfx);
 18.1593 +-		if ((err = snd_ac97_cmute_new(card, name, reg, ac97)) < 0)
 18.1594 ++		if ((err = snd_ac97_cmute_new_stereo(card, name, reg, check_stereo, ac97)) < 0)
 18.1595 + 			return err;
 18.1596 + 	}
 18.1597 + 	check_volume_resolution(ac97, reg, &lo_max, &hi_max);
 18.1598 +@@ -1277,6 +1277,8 @@
 18.1599 + 	return 0;
 18.1600 + }
 18.1601 + 
 18.1602 ++#define snd_ac97_cmix_new(card, pfx, reg, ac97)	snd_ac97_cmix_new_stereo(card, pfx, reg, 0, ac97)
 18.1603 ++#define snd_ac97_cmute_new(card, name, reg, ac97)	snd_ac97_cmute_new_stereo(card, name, reg, 0, ac97)
 18.1604 + 
 18.1605 + static unsigned int snd_ac97_determine_spdif_rates(ac97_t *ac97);
 18.1606 + 
 18.1607 +@@ -1327,7 +1329,8 @@
 18.1608 + 
 18.1609 + 	/* build surround controls */
 18.1610 + 	if (snd_ac97_try_volume_mix(ac97, AC97_SURROUND_MASTER)) {
 18.1611 +-		if ((err = snd_ac97_cmix_new(card, "Surround Playback", AC97_SURROUND_MASTER, ac97)) < 0)
 18.1612 ++		/* Surround Master (0x38) is with stereo mutes */
 18.1613 ++		if ((err = snd_ac97_cmix_new_stereo(card, "Surround Playback", AC97_SURROUND_MASTER, 1, ac97)) < 0)
 18.1614 + 			return err;
 18.1615 + 	}
 18.1616 + 
    19.1 --- a/tools/libxc/xc.h	Wed May 11 13:43:50 2005 +0000
    19.2 +++ b/tools/libxc/xc.h	Fri May 13 14:30:20 2005 +0000
    19.3 @@ -87,22 +87,22 @@ typedef struct xc_core_header {
    19.4  
    19.5  
    19.6  long xc_ptrace(enum __ptrace_request request, 
    19.7 -	       u32  domid,
    19.8 -	       long addr, 
    19.9 -	       long data);
   19.10 +               u32  domid,
   19.11 +               long addr, 
   19.12 +               long data);
   19.13  
   19.14  long xc_ptrace_core(enum __ptrace_request request, 
   19.15 -		    u32 domid, 
   19.16 -		    long addr, 
   19.17 -		    long data);
   19.18 +                    u32 domid, 
   19.19 +                    long addr, 
   19.20 +                    long data);
   19.21  
   19.22  int xc_waitdomain(int domain, 
   19.23 -		  int *status, 
   19.24 -		  int options);
   19.25 +                  int *status, 
   19.26 +                  int options);
   19.27  
   19.28  int xc_waitdomain_core(int domain, 
   19.29 -		       int *status, 
   19.30 -		       int options);
   19.31 +                       int *status, 
   19.32 +                       int options);
   19.33  
   19.34  /*
   19.35   * DOMAIN MANAGEMENT FUNCTIONS
   19.36 @@ -110,7 +110,6 @@ int xc_waitdomain_core(int domain,
   19.37  
   19.38  typedef struct {
   19.39      u32           domid;
   19.40 -    unsigned int  cpu;
   19.41      unsigned int  dying:1, crashed:1, shutdown:1, 
   19.42                    paused:1, blocked:1, running:1;
   19.43      unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
   19.44 @@ -118,6 +117,9 @@ typedef struct {
   19.45      unsigned long shared_info_frame;
   19.46      u64           cpu_time;
   19.47      unsigned long max_memkb;
   19.48 +    unsigned int  vcpus;
   19.49 +    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
   19.50 +    cpumap_t      cpumap[MAX_VIRT_CPUS];
   19.51  } xc_dominfo_t;
   19.52  
   19.53  typedef dom0_getdomaininfo_t xc_domaininfo_t;
   19.54 @@ -129,8 +131,8 @@ int xc_domain_create(int xc_handle,
   19.55  
   19.56  
   19.57  int xc_domain_dumpcore(int xc_handle, 
   19.58 -		       u32 domid,
   19.59 -		       const char *corename);
   19.60 +                       u32 domid,
   19.61 +                       const char *corename);
   19.62  
   19.63  
   19.64  /**
   19.65 @@ -167,7 +169,8 @@ int xc_domain_destroy(int xc_handle,
   19.66                        u32 domid);
   19.67  int xc_domain_pincpu(int xc_handle,
   19.68                       u32 domid,
   19.69 -                     int cpu);
   19.70 +                     int vcpu,
   19.71 +                     cpumap_t *cpumap);
   19.72  /**
   19.73   * This function will return information about one or more domains.
   19.74   *
   19.75 @@ -195,11 +198,11 @@ int xc_domain_getinfo(int xc_handle,
   19.76   *            domain
   19.77   * @return 0 on success, -1 on failure
   19.78   */
   19.79 -int xc_domain_getfullinfo(int xc_handle,
   19.80 -                          u32 domid,
   19.81 -                          u32 vcpu,
   19.82 -                          xc_domaininfo_t *info,
   19.83 -                          vcpu_guest_context_t *ctxt);
   19.84 +int xc_domain_get_vcpu_context(int xc_handle,
   19.85 +                               u32 domid,
   19.86 +                               u32 vcpu,
   19.87 +                               vcpu_guest_context_t *ctxt);
   19.88 +
   19.89  int xc_domain_setcpuweight(int xc_handle,
   19.90                             u32 domid,
   19.91                             float weight);
   19.92 @@ -260,8 +263,8 @@ xc_plan9_build (int xc_handle,
   19.93                  u32 domid, 
   19.94                  const char *image_name,
   19.95                  const char *cmdline, 
   19.96 -		unsigned int control_evtchn, 
   19.97 -		unsigned long flags);
   19.98 +                unsigned int control_evtchn, 
   19.99 +                unsigned long flags);
  19.100  
  19.101  struct mem_map;
  19.102  int xc_vmx_build(int xc_handle,
  19.103 @@ -418,7 +421,7 @@ int xc_msr_write(int xc_handle, int cpu_
  19.104  /**
  19.105   * Memory maps a range within one domain to a local address range.  Mappings
  19.106   * should be unmapped with munmap and should follow the same rules as mmap
  19.107 - * regarding page alignment.
  19.108 + * regarding page alignment.  Returns NULL on failure.
  19.109   *
  19.110   * In Linux, the ring queue for the control channel is accessible by mapping
  19.111   * the shared_info_frame (from xc_domain_getinfo()) + 2048.  The structure
  19.112 @@ -438,7 +441,7 @@ void *xc_map_foreign_batch(int xc_handle
  19.113                             unsigned long *arr, int num );
  19.114  
  19.115  int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  19.116 -		    unsigned long max_pfns);
  19.117 +                    unsigned long max_pfns);
  19.118  
  19.119  /*\
  19.120   *  GRANT TABLE FUNCTIONS
    20.1 --- a/tools/libxc/xc_core.c	Wed May 11 13:43:50 2005 +0000
    20.2 +++ b/tools/libxc/xc_core.c	Fri May 13 14:30:20 2005 +0000
    20.3 @@ -7,6 +7,7 @@
    20.4  /* number of pages to write at a time */
    20.5  #define DUMP_INCREMENT 4 * 1024
    20.6  #define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
    20.7 +
    20.8  static int
    20.9  copy_from_domain_page(int xc_handle,
   20.10  		      u32 domid,
   20.11 @@ -28,13 +29,14 @@ xc_domain_dumpcore(int xc_handle,
   20.12  		   u32 domid,
   20.13  		   const char *corename)
   20.14  {
   20.15 -	vcpu_guest_context_t st_ctxt, *ctxt = &st_ctxt;
   20.16  	unsigned long nr_pages;
   20.17  	unsigned long *page_array;
   20.18 -	xc_domaininfo_t st_info, *info = &st_info;
   20.19 +	xc_dominfo_t info;
   20.20  	int i, dump_fd;
   20.21  	char *dump_mem, *dump_mem_start = NULL;
   20.22  	struct xc_core_header header;
   20.23 +	vcpu_guest_context_t     ctxt[MAX_VIRT_CPUS];
   20.24 +
   20.25  	
   20.26  	if ((dump_fd = open(corename, O_CREAT|O_RDWR, S_IWUSR|S_IRUSR)) < 0) {
   20.27  		PERROR("Could not open corefile %s: %s", corename, strerror(errno));
   20.28 @@ -46,14 +48,25 @@ xc_domain_dumpcore(int xc_handle,
   20.29  		goto error_out;
   20.30  	}
   20.31  	
   20.32 -	if (xc_domain_getfullinfo(xc_handle, domid, 0/* XXX hardcode */, info, ctxt)) {
   20.33 -		PERROR("Could not get full info for domain");
   20.34 +	if (xc_domain_getinfo(xc_handle, domid, 1, &info)) {
   20.35 +		PERROR("Could not get info for domain");
   20.36  		goto error_out;
   20.37  	}
   20.38 +	
   20.39 +	for (i = 0; i < sizeof(info.vcpu_to_cpu) / sizeof(info.vcpu_to_cpu[0]);
   20.40 +	     i++) {
   20.41 +		if (info.vcpu_to_cpu[i] == -1)
   20.42 +			continue;
   20.43 +		if (xc_domain_get_vcpu_context(xc_handle, domid, i, &ctxt[i])) {
   20.44 +			PERROR("Could not get all vcpu contexts for domain");
   20.45 +			goto error_out;
   20.46 +		}
   20.47 +	}
   20.48 +	
   20.49 +	nr_pages = info.nr_pages;
   20.50  
   20.51 -	nr_pages = info->tot_pages;
   20.52  	header.xch_magic = 0xF00FEBED; 
   20.53 -	header.xch_nr_vcpus = 1; /* no interface to query at the moment */
   20.54 +	header.xch_nr_vcpus = info.vcpus;
   20.55  	header.xch_nr_pages = nr_pages;
   20.56  	header.xch_ctxt_offset = sizeof(struct xc_core_header);
   20.57  	header.xch_index_offset = sizeof(struct xc_core_header) +
   20.58 @@ -62,7 +75,7 @@ xc_domain_dumpcore(int xc_handle,
   20.59  	    sizeof(vcpu_guest_context_t) + nr_pages * sizeof(unsigned long));
   20.60  
   20.61  	write(dump_fd, &header, sizeof(struct xc_core_header));
   20.62 -	write(dump_fd, ctxt, sizeof(st_ctxt));
   20.63 +	write(dump_fd, &ctxt, sizeof(ctxt[0]) * info.vcpus);
   20.64  
   20.65  	if ((page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL) {
   20.66  	    printf("Could not allocate memory\n");
    21.1 --- a/tools/libxc/xc_domain.c	Wed May 11 13:43:50 2005 +0000
    21.2 +++ b/tools/libxc/xc_domain.c	Fri May 13 14:30:20 2005 +0000
    21.3 @@ -16,6 +16,8 @@ int xc_domain_create(int xc_handle,
    21.4  {
    21.5      int err, errno_saved;
    21.6      dom0_op_t op;
    21.7 +    u32 vcpu = 0; /* FIXME, hard coded initial pin to vcpu 0 */
    21.8 +    cpumap_t cpumap = 1 << cpu;
    21.9  
   21.10      op.cmd = DOM0_CREATEDOMAIN;
   21.11      op.u.createdomain.domain = (domid_t)*pdomid;
   21.12 @@ -25,7 +27,7 @@ int xc_domain_create(int xc_handle,
   21.13      *pdomid = (u16)op.u.createdomain.domain;
   21.14  
   21.15      if ( (cpu != -1) &&
   21.16 -         ((err = xc_domain_pincpu(xc_handle, *pdomid, cpu)) != 0) )
   21.17 +         ((err = xc_domain_pincpu(xc_handle, *pdomid, vcpu, &cpumap)) != 0) )
   21.18          goto fail;
   21.19  
   21.20      if ( (err = xc_domain_setcpuweight(xc_handle, *pdomid, cpu_weight)) != 0 )
   21.21 @@ -84,13 +86,14 @@ int xc_domain_destroy(int xc_handle,
   21.22  
   21.23  int xc_domain_pincpu(int xc_handle,
   21.24                       u32 domid, 
   21.25 -                     int cpu)
   21.26 +                     int vcpu,
   21.27 +                     cpumap_t *cpumap)
   21.28  {
   21.29      dom0_op_t op;
   21.30      op.cmd = DOM0_PINCPUDOMAIN;
   21.31 -    op.u.pincpudomain.domain = (domid_t)domid;
   21.32 -    op.u.pincpudomain.exec_domain = 0;
   21.33 -    op.u.pincpudomain.cpu  = cpu;
   21.34 +    op.u.pincpudomain.domain  = (domid_t)domid;
   21.35 +    op.u.pincpudomain.vcpu    = vcpu;
   21.36 +    op.u.pincpudomain.cpumap  = cpumap;
   21.37      return do_dom0_op(xc_handle, &op);
   21.38  }
   21.39  
   21.40 @@ -109,14 +112,9 @@ int xc_domain_getinfo(int xc_handle,
   21.41      {
   21.42          op.cmd = DOM0_GETDOMAININFO;
   21.43          op.u.getdomaininfo.domain = (domid_t)next_domid;
   21.44 -        op.u.getdomaininfo.exec_domain = 0; // FIX ME?!?
   21.45 -        op.u.getdomaininfo.ctxt = NULL; /* no exec context info, thanks. */
   21.46          if ( (rc = do_dom0_op(xc_handle, &op)) < 0 )
   21.47              break;
   21.48 -        info->domid   = (u16)op.u.getdomaininfo.domain;
   21.49 -
   21.50 -        info->cpu     =
   21.51 -            (op.u.getdomaininfo.flags>>DOMFLAGS_CPUSHIFT) & DOMFLAGS_CPUMASK;
   21.52 +        info->domid      = (u16)op.u.getdomaininfo.domain;
   21.53  
   21.54          info->dying    = !!(op.u.getdomaininfo.flags & DOMFLAGS_DYING);
   21.55          info->crashed  = !!(op.u.getdomaininfo.flags & DOMFLAGS_CRASHED);
   21.56 @@ -133,29 +131,33 @@ int xc_domain_getinfo(int xc_handle,
   21.57          info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT);
   21.58          info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
   21.59          info->cpu_time = op.u.getdomaininfo.cpu_time;
   21.60 +        info->vcpus = op.u.getdomaininfo.n_vcpu;
   21.61 +        memcpy(&info->vcpu_to_cpu, &op.u.getdomaininfo.vcpu_to_cpu, 
   21.62 +               sizeof(info->vcpu_to_cpu));
   21.63 +        memcpy(&info->cpumap, &op.u.getdomaininfo.cpumap, 
   21.64 +               sizeof(info->cpumap));
   21.65  
   21.66          next_domid = (u16)op.u.getdomaininfo.domain + 1;
   21.67          info++;
   21.68      }
   21.69  
   21.70 -    if(!nr_doms) return rc; 
   21.71 +    if( !nr_doms ) return rc; 
   21.72  
   21.73      return nr_doms;
   21.74  }
   21.75  
   21.76 -int xc_domain_getfullinfo(int xc_handle,
   21.77 -                          u32 domid,
   21.78 -                          u32 vcpu,
   21.79 -                          xc_domaininfo_t *info,
   21.80 -                          vcpu_guest_context_t *ctxt)
   21.81 +int xc_domain_get_vcpu_context(int xc_handle,
   21.82 +                               u32 domid,
   21.83 +                               u32 vcpu,
   21.84 +                               vcpu_guest_context_t *ctxt)
   21.85  {
   21.86      int rc, errno_saved;
   21.87      dom0_op_t op;
   21.88  
   21.89 -    op.cmd = DOM0_GETDOMAININFO;
   21.90 -    op.u.getdomaininfo.domain = (domid_t)domid;
   21.91 -    op.u.getdomaininfo.exec_domain = (u16)vcpu;
   21.92 -    op.u.getdomaininfo.ctxt = ctxt;
   21.93 +    op.cmd = DOM0_GETVCPUCONTEXT;
   21.94 +    op.u.getvcpucontext.domain = (domid_t)domid;
   21.95 +    op.u.getvcpucontext.vcpu   = (u16)vcpu;
   21.96 +    op.u.getvcpucontext.ctxt   = ctxt;
   21.97  
   21.98      if ( (ctxt != NULL) &&
   21.99           ((rc = mlock(ctxt, sizeof(*ctxt))) != 0) )
  21.100 @@ -170,10 +172,7 @@ int xc_domain_getfullinfo(int xc_handle,
  21.101          errno = errno_saved;
  21.102      }
  21.103  
  21.104 -    if ( info != NULL )
  21.105 -        memcpy(info, &op.u.getdomaininfo, sizeof(*info));
  21.106 -
  21.107 -    if ( ((u16)op.u.getdomaininfo.domain != domid) && (rc > 0) )
  21.108 +    if ( rc > 0 )
  21.109          return -ESRCH;
  21.110      else
  21.111          return rc;
    22.1 --- a/tools/libxc/xc_linux_build.c	Wed May 11 13:43:50 2005 +0000
    22.2 +++ b/tools/libxc/xc_linux_build.c	Fri May 13 14:30:20 2005 +0000
    22.3 @@ -356,14 +356,19 @@ int xc_linux_build(int xc_handle,
    22.4  
    22.5      op.cmd = DOM0_GETDOMAININFO;
    22.6      op.u.getdomaininfo.domain = (domid_t)domid;
    22.7 -    op.u.getdomaininfo.exec_domain = 0;
    22.8 -    op.u.getdomaininfo.ctxt = ctxt;
    22.9      if ( (do_dom0_op(xc_handle, &op) < 0) || 
   22.10           ((u16)op.u.getdomaininfo.domain != domid) )
   22.11      {
   22.12          PERROR("Could not get info on domain");
   22.13          goto error_out;
   22.14      }
   22.15 +
   22.16 +    if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
   22.17 +    {
   22.18 +        PERROR("Could not get vcpu context");
   22.19 +        goto error_out;
   22.20 +    }
   22.21 +
   22.22      if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
   22.23           (ctxt->pt_base != 0) )
   22.24      {
   22.25 @@ -409,7 +414,7 @@ int xc_linux_build(int xc_handle,
   22.26      ctxt->user_regs.eip = vkern_entry;
   22.27      ctxt->user_regs.esp = vstartinfo_start + 2*PAGE_SIZE;
   22.28      ctxt->user_regs.esi = vstartinfo_start;
   22.29 -    ctxt->user_regs.eflags = (1<<9) | (1<<2);
   22.30 +    ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
   22.31  
   22.32      /* FPU is set up to default initial state. */
   22.33      memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
   22.34 @@ -452,9 +457,9 @@ int xc_linux_build(int xc_handle,
   22.35  
   22.36      memset( &launch_op, 0, sizeof(launch_op) );
   22.37  
   22.38 -    launch_op.u.setdomaininfo.domain   = (domid_t)domid;
   22.39 -    launch_op.u.setdomaininfo.exec_domain = 0;
   22.40 -    launch_op.u.setdomaininfo.ctxt = ctxt;
   22.41 +    launch_op.u.setdomaininfo.domain = (domid_t)domid;
   22.42 +    launch_op.u.setdomaininfo.vcpu   = 0;
   22.43 +    launch_op.u.setdomaininfo.ctxt   = ctxt;
   22.44  
   22.45      launch_op.cmd = DOM0_SETDOMAININFO;
   22.46      rc = do_dom0_op(xc_handle, &launch_op);
    23.1 --- a/tools/libxc/xc_linux_restore.c	Wed May 11 13:43:50 2005 +0000
    23.2 +++ b/tools/libxc/xc_linux_restore.c	Fri May 13 14:30:20 2005 +0000
    23.3 @@ -181,8 +181,6 @@ int xc_linux_restore(int xc_handle, XcIO
    23.4      /* Get the domain's shared-info frame. */
    23.5      op.cmd = DOM0_GETDOMAININFO;
    23.6      op.u.getdomaininfo.domain = (domid_t)dom;
    23.7 -    op.u.getdomaininfo.exec_domain = 0;
    23.8 -    op.u.getdomaininfo.ctxt = NULL;
    23.9      if ( do_dom0_op(xc_handle, &op) < 0 )
   23.10      {
   23.11          xcio_error(ioctxt, "Could not get information on new domain");
   23.12 @@ -636,9 +634,9 @@ int xc_linux_restore(int xc_handle, XcIO
   23.13      xcio_info(ioctxt, "Domain ready to be built.\n");
   23.14  
   23.15      op.cmd = DOM0_SETDOMAININFO;
   23.16 -    op.u.setdomaininfo.domain   = (domid_t)dom;
   23.17 -    op.u.setdomaininfo.exec_domain   = 0;
   23.18 -    op.u.setdomaininfo.ctxt = &ctxt;
   23.19 +    op.u.setdomaininfo.domain = (domid_t)dom;
   23.20 +    op.u.setdomaininfo.vcpu   = 0;
   23.21 +    op.u.setdomaininfo.ctxt   = &ctxt;
   23.22      rc = do_dom0_op(xc_handle, &op);
   23.23  
   23.24      if ( rc != 0 )
    24.1 --- a/tools/libxc/xc_linux_save.c	Wed May 11 13:43:50 2005 +0000
    24.2 +++ b/tools/libxc/xc_linux_save.c	Fri May 13 14:30:20 2005 +0000
    24.3 @@ -324,7 +324,7 @@ static int analysis_phase( int xc_handle
    24.4  
    24.5  
    24.6  int suspend_and_state(int xc_handle, XcIOContext *ioctxt,		      
    24.7 -                      xc_domaininfo_t *info,
    24.8 +                      xc_dominfo_t *info,
    24.9                        vcpu_guest_context_t *ctxt)
   24.10  {
   24.11      int i=0;
   24.12 @@ -333,27 +333,29 @@ int suspend_and_state(int xc_handle, XcI
   24.13  
   24.14  retry:
   24.15  
   24.16 -    if ( xc_domain_getfullinfo(xc_handle, ioctxt->domain, /* FIXME */ 0, 
   24.17 -                               info, ctxt) )
   24.18 +    if ( xc_domain_getinfo(xc_handle, ioctxt->domain, 1, info) )
   24.19      {
   24.20  	xcio_error(ioctxt, "Could not get full domain info");
   24.21  	return -1;
   24.22      }
   24.23  
   24.24 -    if ( (info->flags & 
   24.25 -          (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT))) ==
   24.26 -         (DOMFLAGS_SHUTDOWN | (SHUTDOWN_suspend<<DOMFLAGS_SHUTDOWNSHIFT)) )
   24.27 +    if ( xc_domain_get_vcpu_context(xc_handle, ioctxt->domain, 0 /* XXX */, 
   24.28 +				    ctxt) )
   24.29 +    {
   24.30 +        xcio_error(ioctxt, "Could not get vcpu context");
   24.31 +    }
   24.32 +
   24.33 +    if ( info->shutdown && info->shutdown_reason == SHUTDOWN_suspend )
   24.34      {
   24.35  	return 0; // success
   24.36      }
   24.37  
   24.38 -    if ( info->flags & DOMFLAGS_PAUSED )
   24.39 +    if ( info->paused )
   24.40      {
   24.41  	// try unpausing domain, wait, and retest	
   24.42  	xc_domain_unpause( xc_handle, ioctxt->domain );
   24.43  
   24.44 -	xcio_error(ioctxt, "Domain was paused. Wait and re-test. (%u)",
   24.45 -		   info->flags);
   24.46 +	xcio_error(ioctxt, "Domain was paused. Wait and re-test.");
   24.47  	usleep(10000);  // 10ms
   24.48  
   24.49  	goto retry;
   24.50 @@ -362,19 +364,19 @@ retry:
   24.51  
   24.52      if( ++i < 100 )
   24.53      {
   24.54 -	xcio_error(ioctxt, "Retry suspend domain (%u)", info->flags);
   24.55 +	xcio_error(ioctxt, "Retry suspend domain.");
   24.56  	usleep(10000);  // 10ms	
   24.57  	goto retry;
   24.58      }
   24.59  
   24.60 -    xcio_error(ioctxt, "Unable to suspend domain. (%u)", info->flags);
   24.61 +    xcio_error(ioctxt, "Unable to suspend domain.");
   24.62  
   24.63      return -1;
   24.64  }
   24.65  
   24.66  int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
   24.67  {
   24.68 -    xc_domaininfo_t info;
   24.69 +    xc_dominfo_t info;
   24.70  
   24.71      int rc = 1, i, j, k, last_iter, iter = 0;
   24.72      unsigned long mfn;
   24.73 @@ -444,13 +446,18 @@ int xc_linux_save(int xc_handle, XcIOCon
   24.74          xcio_perror(ioctxt, "Unable to mlock ctxt");
   24.75          return 1;
   24.76      }
   24.77 -
   24.78 -    if ( xc_domain_getfullinfo( xc_handle, domid, /* FIXME */ 0, 
   24.79 -                                &info, &ctxt) )
   24.80 +    
   24.81 +    if ( xc_domain_getinfo(xc_handle, domid, 1, &info) )
   24.82      {
   24.83          xcio_error(ioctxt, "Could not get full domain info");
   24.84          goto out;
   24.85      }
   24.86 +    if ( xc_domain_get_vcpu_context( xc_handle, domid, /* FIXME */ 0, 
   24.87 +                                &ctxt) )
   24.88 +    {
   24.89 +        xcio_error(ioctxt, "Could not get vcpu context");
   24.90 +        goto out;
   24.91 +    }
   24.92      shared_info_frame = info.shared_info_frame;
   24.93  
   24.94      /* A cheesy test to see whether the domain contains valid state. */
   24.95 @@ -459,7 +466,7 @@ int xc_linux_save(int xc_handle, XcIOCon
   24.96          goto out;
   24.97      }
   24.98      
   24.99 -    nr_pfns = info.max_pages; 
  24.100 +    nr_pfns = info.max_memkb >> PAGE_SHIFT; 
  24.101  
  24.102      /* cheesy sanity check */
  24.103      if ( nr_pfns > 1024*1024 ){
  24.104 @@ -546,8 +553,7 @@ int xc_linux_save(int xc_handle, XcIOCon
  24.105  
  24.106  	if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
  24.107  	{
  24.108 -	    xcio_error(ioctxt, "Domain appears not to have suspended: %u",
  24.109 -		       info.flags);
  24.110 +	    xcio_error(ioctxt, "Domain appears not to have suspended");
  24.111  	    goto out;
  24.112  	}
  24.113  
  24.114 @@ -913,14 +919,12 @@ int xc_linux_save(int xc_handle, XcIOCon
  24.115  		if ( suspend_and_state( xc_handle, ioctxt, &info, &ctxt) )
  24.116  		{
  24.117  		    xcio_error(ioctxt, 
  24.118 -                               "Domain appears not to have suspended: %u",
  24.119 -			       info.flags);
  24.120 +                               "Domain appears not to have suspended");
  24.121  		    goto out;
  24.122  		}
  24.123  
  24.124  		xcio_info(ioctxt,
  24.125 -                          "SUSPEND flags %08u shinfo %08lx eip %08u "
  24.126 -                          "esi %08u\n",info.flags,
  24.127 +                          "SUSPEND shinfo %08lx eip %08u esi %08u\n",
  24.128                            info.shared_info_frame,
  24.129                            ctxt.user_regs.eip, ctxt.user_regs.esi );
  24.130              } 
    25.1 --- a/tools/libxc/xc_plan9_build.c	Wed May 11 13:43:50 2005 +0000
    25.2 +++ b/tools/libxc/xc_plan9_build.c	Fri May 13 14:30:20 2005 +0000
    25.3 @@ -440,17 +440,21 @@ xc_plan9_build(int xc_handle,
    25.4  
    25.5  	op.cmd = DOM0_GETDOMAININFO;
    25.6  	op.u.getdomaininfo.domain = (domid_t) domid;
    25.7 -        op.u.getdomaininfo.exec_domain = 0;
    25.8 -	op.u.getdomaininfo.ctxt = ctxt;
    25.9  	if ((do_dom0_op(xc_handle, &op) < 0) ||
   25.10  	    ((u32) op.u.getdomaininfo.domain != domid)) {
   25.11  		PERROR("Could not get info on domain");
   25.12  		goto error_out;
   25.13  	}
   25.14  	DPRINTF(("xc_get_tot_pages returns %ld pages\n", tot_pages));
   25.15 +	
   25.16 +	if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
   25.17 +	{
   25.18 +	    PERROR("Could not get vcpu context");
   25.19 +	    goto error_out;
   25.20 +	}
   25.21  
   25.22  	if (!(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED)
   25.23 -	    || (op.u.getdomaininfo.ctxt->pt_base != 0)) {
   25.24 +	    || (ctxt->pt_base != 0)) {
   25.25  		ERROR("Domain is already constructed");
   25.26  		goto error_out;
   25.27  	}
   25.28 @@ -495,7 +499,7 @@ xc_plan9_build(int xc_handle,
   25.29  
   25.30  	/* why is this set? */
   25.31  	ctxt->user_regs.esi = ctxt->user_regs.esp;
   25.32 -	ctxt->user_regs.eflags = (1 << 9) | (1 << 2);
   25.33 +	ctxt->user_regs.eflags = 1 << 9; /* Interrupt Enable */
   25.34  
   25.35  	/* FPU is set up to default initial state. */
   25.36  	memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt));
   25.37 @@ -539,7 +543,7 @@ xc_plan9_build(int xc_handle,
   25.38  	memset(&launch_op, 0, sizeof (launch_op));
   25.39  
   25.40  	launch_op.u.setdomaininfo.domain = (domid_t) domid;
   25.41 -	launch_op.u.setdomaininfo.exec_domain = 0;
   25.42 +	launch_op.u.setdomaininfo.vcpu   = 0;
   25.43  	//  launch_op.u.setdomaininfo.num_vifs = 1;
   25.44  	launch_op.u.setdomaininfo.ctxt = ctxt;
   25.45  	launch_op.cmd = DOM0_SETDOMAININFO;
    26.1 --- a/tools/libxc/xc_private.c	Wed May 11 13:43:50 2005 +0000
    26.2 +++ b/tools/libxc/xc_private.c	Fri May 13 14:30:20 2005 +0000
    26.3 @@ -13,18 +13,18 @@ void *xc_map_foreign_batch(int xc_handle
    26.4      privcmd_mmapbatch_t ioctlx; 
    26.5      void *addr;
    26.6      addr = mmap(NULL, num*PAGE_SIZE, prot, MAP_SHARED, xc_handle, 0);
    26.7 -    if ( addr != NULL )
    26.8 +    if ( addr == MAP_FAILED )
    26.9 +	return NULL;
   26.10 +
   26.11 +    ioctlx.num=num;
   26.12 +    ioctlx.dom=dom;
   26.13 +    ioctlx.addr=(unsigned long)addr;
   26.14 +    ioctlx.arr=arr;
   26.15 +    if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) < 0 )
   26.16      {
   26.17 -        ioctlx.num=num;
   26.18 -        ioctlx.dom=dom;
   26.19 -        ioctlx.addr=(unsigned long)addr;
   26.20 -        ioctlx.arr=arr;
   26.21 -        if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx ) < 0 )
   26.22 -        {
   26.23 -            perror("XXXXXXXX");
   26.24 -            munmap(addr, num*PAGE_SIZE);
   26.25 -            return 0;
   26.26 -        }
   26.27 +	perror("XXXXXXXX");
   26.28 +	munmap(addr, num*PAGE_SIZE);
   26.29 +	return NULL;
   26.30      }
   26.31      return addr;
   26.32  
   26.33 @@ -40,19 +40,19 @@ void *xc_map_foreign_range(int xc_handle
   26.34      privcmd_mmap_entry_t entry; 
   26.35      void *addr;
   26.36      addr = mmap(NULL, size, prot, MAP_SHARED, xc_handle, 0);
   26.37 -    if ( addr != NULL )
   26.38 +    if ( addr == MAP_FAILED )
   26.39 +	return NULL;
   26.40 +
   26.41 +    ioctlx.num=1;
   26.42 +    ioctlx.dom=dom;
   26.43 +    ioctlx.entry=&entry;
   26.44 +    entry.va=(unsigned long) addr;
   26.45 +    entry.mfn=mfn;
   26.46 +    entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
   26.47 +    if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) < 0 )
   26.48      {
   26.49 -        ioctlx.num=1;
   26.50 -        ioctlx.dom=dom;
   26.51 -        ioctlx.entry=&entry;
   26.52 -        entry.va=(unsigned long) addr;
   26.53 -        entry.mfn=mfn;
   26.54 -        entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT;
   26.55 -        if ( ioctl( xc_handle, IOCTL_PRIVCMD_MMAP, &ioctlx ) < 0 )
   26.56 -        {
   26.57 -            munmap(addr, size);
   26.58 -            return 0;
   26.59 -        }
   26.60 +	munmap(addr, size);
   26.61 +	return NULL;
   26.62      }
   26.63      return addr;
   26.64  }
   26.65 @@ -173,17 +173,16 @@ long long xc_domain_get_cpu_usage( int x
   26.66  {
   26.67      dom0_op_t op;
   26.68  
   26.69 -    op.cmd = DOM0_GETDOMAININFO;
   26.70 -    op.u.getdomaininfo.domain = (domid_t)domid;
   26.71 -    op.u.getdomaininfo.exec_domain = (u16)vcpu;
   26.72 -    op.u.getdomaininfo.ctxt = NULL;
   26.73 -    if ( (do_dom0_op(xc_handle, &op) < 0) || 
   26.74 -         ((u16)op.u.getdomaininfo.domain != domid) )
   26.75 +    op.cmd = DOM0_GETVCPUCONTEXT;
   26.76 +    op.u.getvcpucontext.domain = (domid_t)domid;
   26.77 +    op.u.getvcpucontext.vcpu   = (u16)vcpu;
   26.78 +    op.u.getvcpucontext.ctxt   = NULL;
   26.79 +    if ( (do_dom0_op(xc_handle, &op) < 0) )
   26.80      {
   26.81          PERROR("Could not get info on domain");
   26.82          return -1;
   26.83      }
   26.84 -    return op.u.getdomaininfo.cpu_time;
   26.85 +    return op.u.getvcpucontext.cpu_time;
   26.86  }
   26.87  
   26.88  
   26.89 @@ -258,8 +257,6 @@ long xc_get_tot_pages(int xc_handle, u32
   26.90      dom0_op_t op;
   26.91      op.cmd = DOM0_GETDOMAININFO;
   26.92      op.u.getdomaininfo.domain = (domid_t)domid;
   26.93 -    op.u.getdomaininfo.exec_domain = 0;
   26.94 -    op.u.getdomaininfo.ctxt = NULL;
   26.95      return (do_dom0_op(xc_handle, &op) < 0) ? 
   26.96          -1 : op.u.getdomaininfo.tot_pages;
   26.97  }
    27.1 --- a/tools/libxc/xc_ptrace.c	Wed May 11 13:43:50 2005 +0000
    27.2 +++ b/tools/libxc/xc_ptrace.c	Fri May 13 14:30:20 2005 +0000
    27.3 @@ -71,7 +71,7 @@ struct gdb_regs {
    27.4  #define FETCH_REGS(cpu) \
    27.5      if (!regs_valid[cpu]) \
    27.6      {                \
    27.7 -	int retval = xc_domain_getfullinfo(xc_handle, domid, cpu, NULL, &ctxt[cpu]); \
    27.8 +	int retval = xc_domain_get_vcpu_context(xc_handle, domid, cpu, &ctxt[cpu]); \
    27.9  	if (retval) \
   27.10  	    goto error_out; \
   27.11  	cr3[cpu] = ctxt[cpu].pt_base; /* physical address */ \
   27.12 @@ -221,7 +221,6 @@ xc_waitdomain(int domain, int *status, i
   27.13  {
   27.14      dom0_op_t op;
   27.15      int retval;
   27.16 -    vcpu_guest_context_t ctxt;
   27.17      struct timespec ts;
   27.18      ts.tv_sec = 0;
   27.19      ts.tv_nsec = 10*1000*1000;
   27.20 @@ -234,12 +233,10 @@ xc_waitdomain(int domain, int *status, i
   27.21  	}
   27.22      op.cmd = DOM0_GETDOMAININFO;
   27.23      op.u.getdomaininfo.domain = domain;
   27.24 -    op.u.getdomaininfo.exec_domain = 0;
   27.25 -    op.u.getdomaininfo.ctxt = &ctxt;
   27.26   retry:
   27.27  
   27.28      retval = do_dom0_op(xc_handle, &op);
   27.29 -    if (retval) {
   27.30 +    if (retval || op.u.getdomaininfo.domain != domain) {
   27.31  	printf("getdomaininfo failed\n");
   27.32  	goto done;
   27.33      }
   27.34 @@ -314,8 +311,8 @@ xc_ptrace(enum __ptrace_request request,
   27.35  	op.cmd = DOM0_SETDOMAININFO;
   27.36  	SET_XC_REGS(((struct gdb_regs *)data), ctxt[VCPU].user_regs);
   27.37  	op.u.setdomaininfo.domain = domid;
   27.38 -	/* XXX need to understand multiple exec_domains */
   27.39 -	op.u.setdomaininfo.exec_domain = cpu;
   27.40 +	/* XXX need to understand multiple vcpus */
   27.41 +	op.u.setdomaininfo.vcpu = cpu;
   27.42  	op.u.setdomaininfo.ctxt = &ctxt[cpu];
   27.43  	retval = do_dom0_op(xc_handle, &op);
   27.44  	if (retval)
   27.45 @@ -325,10 +322,8 @@ xc_ptrace(enum __ptrace_request request,
   27.46      case PTRACE_ATTACH:
   27.47  	op.cmd = DOM0_GETDOMAININFO;
   27.48  	op.u.getdomaininfo.domain = domid;
   27.49 -	op.u.getdomaininfo.exec_domain = 0;
   27.50 -	op.u.getdomaininfo.ctxt = NULL;
   27.51  	retval = do_dom0_op(xc_handle, &op);
   27.52 -	if (retval) {
   27.53 +	if (retval || op.u.getdomaininfo.domain != domid) {
   27.54  	    perror("dom0 op failed");
   27.55  	    goto error_out;
   27.56  	}
   27.57 @@ -345,7 +340,7 @@ xc_ptrace(enum __ptrace_request request,
   27.58  	ctxt[VCPU].user_regs.eflags |= PSL_T;
   27.59  	op.cmd = DOM0_SETDOMAININFO;
   27.60  	op.u.setdomaininfo.domain = domid;
   27.61 -	op.u.setdomaininfo.exec_domain = 0;
   27.62 +	op.u.setdomaininfo.vcpu = 0;
   27.63  	op.u.setdomaininfo.ctxt = &ctxt[cpu];
   27.64  	retval = do_dom0_op(xc_handle, &op);	
   27.65  	if (retval) {
   27.66 @@ -362,7 +357,7 @@ xc_ptrace(enum __ptrace_request request,
   27.67  		ctxt[cpu].user_regs.eflags &= ~PSL_T;
   27.68  		op.cmd = DOM0_SETDOMAININFO;
   27.69  		op.u.setdomaininfo.domain = domid;
   27.70 -		op.u.setdomaininfo.exec_domain = cpu;
   27.71 +		op.u.setdomaininfo.vcpu = cpu;
   27.72  		op.u.setdomaininfo.ctxt = &ctxt[cpu];
   27.73  		retval = do_dom0_op(xc_handle, &op);	
   27.74  		if (retval) {
    28.1 --- a/tools/libxc/xc_ptrace_core.c	Wed May 11 13:43:50 2005 +0000
    28.2 +++ b/tools/libxc/xc_ptrace_core.c	Fri May 13 14:30:20 2005 +0000
    28.3 @@ -107,6 +107,7 @@ map_domain_va(unsigned long domfd, int c
    28.4  {
    28.5      unsigned long pde, page;
    28.6      unsigned long va = (unsigned long)guest_va;
    28.7 +    void *v;
    28.8  
    28.9      static unsigned long  cr3_phys[MAX_VIRT_CPUS];
   28.10      static unsigned long *cr3_virt[MAX_VIRT_CPUS];
   28.11 @@ -120,13 +121,15 @@ map_domain_va(unsigned long domfd, int c
   28.12  	cr3_phys[cpu] = cr3[cpu];
   28.13  	if (cr3_virt[cpu])
   28.14  	    munmap(cr3_virt[cpu], PAGE_SIZE);
   28.15 -	if ((cr3_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ, 
   28.16 -				  MAP_PRIVATE, domfd, map_mtop_offset(cr3_phys[cpu]))) == 
   28.17 -	    (unsigned long*)0xffffffff)
   28.18 +	v = mmap(
   28.19 +            NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
   28.20 +            map_mtop_offset(cr3_phys[cpu]));
   28.21 +        if (v == MAP_FAILED)
   28.22  	{
   28.23  	    perror("mmap failed");
   28.24  	    goto error_out;
   28.25  	}
   28.26 +        cr3_virt[cpu] = v;
   28.27      } 
   28.28      if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */
   28.29  	goto error_out;
   28.30 @@ -137,9 +140,12 @@ map_domain_va(unsigned long domfd, int c
   28.31  	pde_phys[cpu] = pde;
   28.32  	if (pde_virt[cpu])
   28.33  	    munmap(pde_virt[cpu], PAGE_SIZE);
   28.34 -	if ((pde_virt[cpu] =  mmap(NULL, PAGE_SIZE, PROT_READ, 
   28.35 -				  MAP_PRIVATE, domfd, map_mtop_offset(pde_phys[cpu]))) == NULL)
   28.36 +	v = mmap(
   28.37 +            NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
   28.38 +            map_mtop_offset(pde_phys[cpu]));
   28.39 +        if (v == MAP_FAILED)
   28.40  	    goto error_out;
   28.41 +        pde_virt[cpu] = v;
   28.42      }
   28.43      if ((page = pde_virt[cpu][vtopti(va)]) == 0) /* logical address */
   28.44  	goto error_out;
   28.45 @@ -150,12 +156,15 @@ map_domain_va(unsigned long domfd, int c
   28.46  	page_phys[cpu] = page;
   28.47  	if (page_virt[cpu])
   28.48  	    munmap(page_virt[cpu], PAGE_SIZE);
   28.49 -	if ((page_virt[cpu] = mmap(NULL, PAGE_SIZE, PROT_READ, 
   28.50 -				  MAP_PRIVATE, domfd, map_mtop_offset(page_phys[cpu]))) == NULL) {
   28.51 +	v = mmap(
   28.52 +            NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, domfd,
   28.53 +            map_mtop_offset(page_phys[cpu]));
   28.54 +        if (v == MAP_FAILED) {
   28.55  	    printf("cr3 %lx pde %lx page %lx pti %lx\n", cr3[cpu], pde, page, vtopti(va));
   28.56  	    page_phys[cpu] = 0;
   28.57  	    goto error_out;
   28.58  	}
   28.59 +        page_virt[cpu] = v;
   28.60      }	
   28.61      return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
   28.62  
    29.1 --- a/tools/libxc/xc_vmx_build.c	Wed May 11 13:43:50 2005 +0000
    29.2 +++ b/tools/libxc/xc_vmx_build.c	Fri May 13 14:30:20 2005 +0000
    29.3 @@ -447,7 +447,7 @@ static int setup_guest(int xc_handle,
    29.4      ctxt->user_regs.esi = vboot_params_start;
    29.5      ctxt->user_regs.edi = vboot_params_start + 0x2d0;
    29.6  
    29.7 -    ctxt->user_regs.eflags = (1<<2);
    29.8 +    ctxt->user_regs.eflags = 0;
    29.9  
   29.10      return 0;
   29.11  
   29.12 @@ -543,14 +543,19 @@ int xc_vmx_build(int xc_handle,
   29.13  
   29.14      op.cmd = DOM0_GETDOMAININFO;
   29.15      op.u.getdomaininfo.domain = (domid_t)domid;
   29.16 -    op.u.getdomaininfo.exec_domain = 0;
   29.17 -    op.u.getdomaininfo.ctxt = ctxt;
   29.18      if ( (do_dom0_op(xc_handle, &op) < 0) || 
   29.19           ((u16)op.u.getdomaininfo.domain != domid) )
   29.20      {
   29.21          PERROR("Could not get info on domain");
   29.22          goto error_out;
   29.23      }
   29.24 +
   29.25 +    if ( xc_domain_get_vcpu_context(xc_handle, domid, 0, ctxt) )
   29.26 +    {
   29.27 +        PERROR("Could not get vcpu context");
   29.28 +        goto error_out;
   29.29 +    }
   29.30 +
   29.31      if ( !(op.u.getdomaininfo.flags & DOMFLAGS_PAUSED) ||
   29.32           (ctxt->pt_base != 0) )
   29.33      {
   29.34 @@ -618,9 +623,9 @@ int xc_vmx_build(int xc_handle,
   29.35  
   29.36      memset( &launch_op, 0, sizeof(launch_op) );
   29.37  
   29.38 -    launch_op.u.setdomaininfo.domain   = (domid_t)domid;
   29.39 -    launch_op.u.setdomaininfo.exec_domain = 0;
   29.40 -    launch_op.u.setdomaininfo.ctxt = ctxt;
   29.41 +    launch_op.u.setdomaininfo.domain = (domid_t)domid;
   29.42 +    launch_op.u.setdomaininfo.vcpu   = 0;
   29.43 +    launch_op.u.setdomaininfo.ctxt   = ctxt;
   29.44  
   29.45      launch_op.cmd = DOM0_SETDOMAININFO;
   29.46      rc = do_dom0_op(xc_handle, &launch_op);
    30.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed May 11 13:43:50 2005 +0000
    30.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Fri May 13 14:30:20 2005 +0000
    30.3 @@ -155,15 +155,16 @@ static PyObject *pyxc_domain_pincpu(PyOb
    30.4      XcObject *xc = (XcObject *)self;
    30.5  
    30.6      u32 dom;
    30.7 -    int cpu = -1;
    30.8 +    int vcpu = 0;
    30.9 +    cpumap_t cpumap = 0xFFFFFFFF;
   30.10  
   30.11 -    static char *kwd_list[] = { "dom", "cpu", NULL };
   30.12 +    static char *kwd_list[] = { "dom", "vcpu", "cpumap", NULL };
   30.13  
   30.14 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
   30.15 -                                      &dom, &cpu) )
   30.16 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|ii", kwd_list, 
   30.17 +                                      &dom, &vcpu, &cpumap) )
   30.18          return NULL;
   30.19  
   30.20 -    if ( xc_domain_pincpu(xc->xc_handle, dom, cpu) != 0 )
   30.21 +    if ( xc_domain_pincpu(xc->xc_handle, dom, vcpu, &cpumap) != 0 )
   30.22          return PyErr_SetFromErrno(xc_error);
   30.23      
   30.24      Py_INCREF(zero);
   30.25 @@ -175,10 +176,10 @@ static PyObject *pyxc_domain_getinfo(PyO
   30.26                                       PyObject *kwds)
   30.27  {
   30.28      XcObject *xc = (XcObject *)self;
   30.29 -    PyObject *list;
   30.30 +    PyObject *list, *vcpu_list, *cpumap_list, *info_dict;
   30.31  
   30.32      u32 first_dom = 0;
   30.33 -    int max_doms = 1024, nr_doms, i;
   30.34 +    int max_doms = 1024, nr_doms, i, j;
   30.35      xc_dominfo_t *info;
   30.36  
   30.37      static char *kwd_list[] = { "first_dom", "max_doms", NULL };
   30.38 @@ -195,23 +196,33 @@ static PyObject *pyxc_domain_getinfo(PyO
   30.39      list = PyList_New(nr_doms);
   30.40      for ( i = 0 ; i < nr_doms; i++ )
   30.41      {
   30.42 -        PyList_SetItem(
   30.43 -            list, i, 
   30.44 -            Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
   30.45 -                          ",s:l,s:L,s:l,s:i}",
   30.46 -                          "dom",       info[i].domid,
   30.47 -                          "cpu",       info[i].cpu,
   30.48 -                          "dying",     info[i].dying,
   30.49 -                          "crashed",   info[i].crashed,
   30.50 -                          "shutdown",  info[i].shutdown,
   30.51 -                          "paused",    info[i].paused,
   30.52 -                          "blocked",   info[i].blocked,
   30.53 -                          "running",   info[i].running,
   30.54 -                          "mem_kb",    info[i].nr_pages*4,
   30.55 -                          "cpu_time",  info[i].cpu_time,
   30.56 -                          "maxmem_kb", info[i].max_memkb,
   30.57 -                          "shutdown_reason", info[i].shutdown_reason
   30.58 -                ));
   30.59 +        vcpu_list = PyList_New(MAX_VIRT_CPUS);
   30.60 +        cpumap_list = PyList_New(MAX_VIRT_CPUS);
   30.61 +        for ( j = 0; j < MAX_VIRT_CPUS; j++ ) {
   30.62 +            PyList_SetItem( vcpu_list, j, 
   30.63 +                            Py_BuildValue("i", info[i].vcpu_to_cpu[j]));
   30.64 +            PyList_SetItem( cpumap_list, j, 
   30.65 +                            Py_BuildValue("i", info[i].cpumap[j]));
   30.66 +        }
   30.67 +                 
   30.68 +        info_dict = Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i"
   30.69 +                                  ",s:l,s:L,s:l,s:i}",
   30.70 +                                  "dom",       info[i].domid,
   30.71 +                                  "vcpus",     info[i].vcpus,
   30.72 +                                  "dying",     info[i].dying,
   30.73 +                                  "crashed",   info[i].crashed,
   30.74 +                                  "shutdown",  info[i].shutdown,
   30.75 +                                  "paused",    info[i].paused,
   30.76 +                                  "blocked",   info[i].blocked,
   30.77 +                                  "running",   info[i].running,
   30.78 +                                  "mem_kb",    info[i].nr_pages*4,
   30.79 +                                  "cpu_time",  info[i].cpu_time,
   30.80 +                                  "maxmem_kb", info[i].max_memkb,
   30.81 +                                  "shutdown_reason", info[i].shutdown_reason);
   30.82 +        PyDict_SetItemString( info_dict, "vcpu_to_cpu", vcpu_list );
   30.83 +        PyDict_SetItemString( info_dict, "cpumap", cpumap_list );
   30.84 +        PyList_SetItem( list, i, info_dict);
   30.85 + 
   30.86      }
   30.87  
   30.88      free(info);
   30.89 @@ -959,9 +970,10 @@ static PyMethodDef pyxc_methods[] = {
   30.90      { "domain_pincpu", 
   30.91        (PyCFunction)pyxc_domain_pincpu, 
   30.92        METH_VARARGS | METH_KEYWORDS, "\n"
   30.93 -      "Pin a domain to a specified CPU.\n"
   30.94 -      " dom [int]:     Identifier of domain to be pinned.\n"
   30.95 -      " cpu [int, -1]: CPU to pin to, or -1 to unpin\n\n"
   30.96 +      "Pin a VCPU to a specified set CPUs.\n"
   30.97 +      " dom [int]:     Identifier of domain to which VCPU belongs.\n"
   30.98 +      " vcpu [int, 0]: VCPU being pinned.\n"
   30.99 +      " cpumap [int, -1]: Bitmap of usable CPUs.\n\n"
  30.100        "Returns: [int] 0 on success; -1 on error.\n" },
  30.101  
  30.102      { "domain_getinfo", 
  30.103 @@ -976,6 +988,7 @@ static PyMethodDef pyxc_methods[] = {
  30.104        "         domain-id space was reached.\n"
  30.105        " dom      [int]: Identifier of domain to which this info pertains\n"
  30.106        " cpu      [int]:  CPU to which this domain is bound\n"
  30.107 +      " vcpus    [int]:  Number of Virtual CPUS in this domain\n"
  30.108        " dying    [int]:  Bool - is the domain dying?\n"
  30.109        " crashed  [int]:  Bool - has the domain crashed?\n"
  30.110        " shutdown [int]:  Bool - has the domain shut itself down?\n"
  30.111 @@ -986,7 +999,8 @@ static PyMethodDef pyxc_methods[] = {
  30.112        " maxmem_kb [int]: Maximum memory limit, in kilobytes\n"
  30.113        " cpu_time [long]: CPU time consumed, in nanoseconds\n"
  30.114        " shutdown_reason [int]: Numeric code from guest OS, explaining "
  30.115 -      "reason why it shut itself down.\n" },
  30.116 +      "reason why it shut itself down.\n" 
  30.117 +      " vcpu_to_cpu [[int]]: List that maps VCPUS to CPUS\n" },
  30.118  
  30.119      { "linux_save", 
  30.120        (PyCFunction)pyxc_linux_save, 
    31.1 --- a/tools/python/xen/xend/XendClient.py	Wed May 11 13:43:50 2005 +0000
    31.2 +++ b/tools/python/xen/xend/XendClient.py	Fri May 13 14:30:20 2005 +0000
    31.3 @@ -236,10 +236,11 @@ class Xend:
    31.4                                'live'       : live,
    31.5                                'resource'   : resource })
    31.6  
    31.7 -    def xend_domain_pincpu(self, id, cpu):
    31.8 +    def xend_domain_pincpu(self, id, vcpu, cpumap):
    31.9          return self.xendPost(self.domainurl(id),
   31.10                               {'op'      : 'pincpu',
   31.11 -                              'cpu'     : cpu })
   31.12 +                              'vcpu'    : vcpu,
   31.13 +                              'cpumap'  : cpumap })
   31.14  
   31.15      def xend_domain_cpu_bvt_set(self, id, mcuadv, warpback, warpvalue, warpl, warpu):
   31.16          return self.xendPost(self.domainurl(id),
    32.1 --- a/tools/python/xen/xend/XendDomain.py	Wed May 11 13:43:50 2005 +0000
    32.2 +++ b/tools/python/xen/xend/XendDomain.py	Fri May 13 14:30:20 2005 +0000
    32.3 @@ -675,15 +675,16 @@ class XendDomain:
    32.4          xmigrate = XendMigrate.instance()
    32.5          return xmigrate.save_begin(dominfo, dst)
    32.6      
    32.7 -    def domain_pincpu(self, id, cpu):
    32.8 -        """Pin a domain to a cpu.
    32.9 +    def domain_pincpu(self, id, vcpu, cpumap):
   32.10 +        """Set which cpus vcpu can use
   32.11  
   32.12 -        @param id: domain
   32.13 -        @param cpu: cpu number
   32.14 +        @param id:   domain
   32.15 +        @param vcpu: vcpu number
   32.16 +        @param cpumap:  bitmap of usbale cpus
   32.17          """
   32.18          dominfo = self.domain_lookup(id)
   32.19          try:
   32.20 -            return xc.domain_pincpu(int(dominfo.id), cpu)
   32.21 +            return xc.domain_pincpu(int(dominfo.id), vcpu, cpumap)
   32.22          except Exception, ex:
   32.23              raise XendError(str(ex))
   32.24  
    33.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Wed May 11 13:43:50 2005 +0000
    33.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Fri May 13 14:30:20 2005 +0000
    33.3 @@ -419,8 +419,12 @@ class XendDomainInfo:
    33.4              if self.info['shutdown']:
    33.5                  reason = shutdown_reason(self.info['shutdown_reason'])
    33.6                  sxpr.append(['shutdown_reason', reason])
    33.7 -            sxpr.append(['cpu', self.info['cpu']])
    33.8 +            sxpr.append(['cpu', self.info['vcpu_to_cpu'][0]])
    33.9              sxpr.append(['cpu_time', self.info['cpu_time']/1e9])    
   33.10 +            sxpr.append(['vcpus', self.info['vcpus']])
   33.11 +            sxpr.append(['cpumap', self.info['cpumap']])
   33.12 +            sxpr.append(['vcpu_to_cpu', ''.join(map(lambda x: str(x),
   33.13 +                        self.info['vcpu_to_cpu'][0:self.info['vcpus']]))])
   33.14              
   33.15          if self.start_time:
   33.16              up_time =  time.time() - self.start_time  
   33.17 @@ -529,7 +533,8 @@ class XendDomainInfo:
   33.18              raise VmError('missing memory size')
   33.19          cpu = sxp.child_value(config, 'cpu')
   33.20          if self.recreate and self.dom and cpu is not None:
   33.21 -            xc.domain_pincpu(self.dom, int(cpu))
   33.22 +            #xc.domain_pincpu(self.dom, int(cpu))
   33.23 +            xc.domain_pincpu(self.dom, 0, 1<<int(cpu))
   33.24          try:
   33.25              image = sxp.child_value(self.config, 'image')
   33.26              vcpus = sxp.child_value(image, 'vcpus')
    34.1 --- a/tools/python/xen/xend/server/SrvDomain.py	Wed May 11 13:43:50 2005 +0000
    34.2 +++ b/tools/python/xen/xend/server/SrvDomain.py	Fri May 13 14:30:20 2005 +0000
    34.3 @@ -88,7 +88,8 @@ class SrvDomain(SrvDir):
    34.4      def op_pincpu(self, op, req):
    34.5          fn = FormFn(self.xd.domain_pincpu,
    34.6                      [['dom', 'str'],
    34.7 -                     ['cpu', 'int']])
    34.8 +                     ['vcpu', 'int'],
    34.9 +                     ['cpumap', 'int']])
   34.10          val = fn(req.args, {'dom': self.dom.id})
   34.11          return val
   34.12  
    35.1 --- a/tools/python/xen/xm/main.py	Wed May 11 13:43:50 2005 +0000
    35.2 +++ b/tools/python/xen/xm/main.py	Fri May 13 14:30:20 2005 +0000
    35.3 @@ -6,6 +6,8 @@ import os.path
    35.4  import sys
    35.5  from getopt import getopt
    35.6  import socket
    35.7 +import warnings
    35.8 +warnings.filterwarnings('ignore', category=FutureWarning)
    35.9  
   35.10  from xen.xend import PrettyPrint
   35.11  from xen.xend import sxp
   35.12 @@ -340,8 +342,8 @@ class ProgList(Prog):
   35.13      name = "list"
   35.14      info = """List information about domains."""
   35.15  
   35.16 -    short_options = 'l'
   35.17 -    long_options = ['long']
   35.18 +    short_options = 'lv'
   35.19 +    long_options = ['long','vcpus']
   35.20  
   35.21      def help(self, args):
   35.22          if help:
   35.23 @@ -350,11 +352,13 @@ class ProgList(Prog):
   35.24              Either all domains or the domains given.
   35.25  
   35.26              -l, --long   Get more detailed information.
   35.27 +            -v, --vcpus  Show VCPU to CPU mapping.
   35.28              """
   35.29              return
   35.30          
   35.31      def main(self, args):
   35.32          use_long = 0
   35.33 +        show_vcpus = 0
   35.34          (options, params) = getopt(args[1:],
   35.35                                     self.short_options,
   35.36                                     self.long_options)
   35.37 @@ -362,6 +366,8 @@ class ProgList(Prog):
   35.38          for (k, v) in options:
   35.39              if k in ['-l', '--long']:
   35.40                  use_long = 1
   35.41 +            if k in ['-v', '--vcpus']:
   35.42 +                show_vcpus = 1
   35.43                  
   35.44          if n == 0:
   35.45              doms = server.xend_domains()
   35.46 @@ -371,11 +377,13 @@ class ProgList(Prog):
   35.47              
   35.48          if use_long:
   35.49              self.long_list(doms)
   35.50 +        elif show_vcpus:
   35.51 +            self.show_vcpus(doms)
   35.52          else:
   35.53              self.brief_list(doms)
   35.54  
   35.55      def brief_list(self, doms):
   35.56 -        print 'Name              Id  Mem(MB)  CPU  State  Time(s)  Console'
   35.57 +        print 'Name              Id  Mem(MB)  CPU VCPU(s)  State  Time(s)  Console'
   35.58          for dom in doms:
   35.59              info = server.xend_domain(dom)
   35.60              d = {}
   35.61 @@ -383,6 +391,7 @@ class ProgList(Prog):
   35.62              d['name'] = sxp.child_value(info, 'name', '??')
   35.63              d['mem'] = int(sxp.child_value(info, 'memory', '0'))
   35.64              d['cpu'] = int(sxp.child_value(info, 'cpu', '0'))
   35.65 +            d['vcpus'] = int(sxp.child_value(info, 'vcpus', '0'))
   35.66              d['state'] = sxp.child_value(info, 'state', '??')
   35.67              d['cpu_time'] = float(sxp.child_value(info, 'cpu_time', '0'))
   35.68              console = sxp.child(info, 'console')
   35.69 @@ -390,9 +399,27 @@ class ProgList(Prog):
   35.70                  d['port'] = sxp.child_value(console, 'console_port')
   35.71              else:
   35.72                  d['port'] = ''
   35.73 -            print ("%(name)-16s %(dom)3d  %(mem)7d  %(cpu)3d  %(state)5s  %(cpu_time)7.1f    %(port)4s"
   35.74 +            print ("%(name)-16s %(dom)3d  %(mem)7d  %(cpu)3d  %(vcpus)5d   %(state)5s  %(cpu_time)7.1f     %(port)4s"
   35.75                     % d)
   35.76  
   35.77 +    def show_vcpus(self, doms):
   35.78 +        print 'Name              Id  VCPU  CPU  CPUMAP'
   35.79 +        for dom in doms:
   35.80 +            info = server.xend_domain(dom)
   35.81 +            vcpu_to_cpu = sxp.child_value(info, 'vcpu_to_cpu', '?').replace('-','')
   35.82 +            cpumap = sxp.child_value(info, 'cpumap', [])
   35.83 +            mask = ((int(sxp.child_value(info, 'vcpus', '0')))**2) - 1
   35.84 +            count = 0
   35.85 +            for cpu in vcpu_to_cpu:
   35.86 +                d = {}
   35.87 +                d['name']   = sxp.child_value(info, 'name', '??')
   35.88 +                d['dom']    = int(sxp.child_value(info, 'id', '-1'))
   35.89 +                d['vcpu']   = int(count)
   35.90 +                d['cpu']    = int(cpu)
   35.91 +                d['cpumap'] = int(cpumap[count])&mask
   35.92 +                count = count + 1
   35.93 +                print ("%(name)-16s %(dom)3d  %(vcpu)4d  %(cpu)3d  0x%(cpumap)x" % d)
   35.94 +
   35.95      def long_list(self, doms):
   35.96          for dom in doms:
   35.97              info = server.xend_domain(dom)
   35.98 @@ -474,17 +501,35 @@ xm.prog(ProgUnpause)
   35.99  class ProgPincpu(Prog):
  35.100      group = 'domain'
  35.101      name = "pincpu"
  35.102 -    info = """Pin a domain to a cpu. """
  35.103 +    info = """Set which cpus a VCPU can use. """
  35.104  
  35.105      def help(self, args):
  35.106 -        print args[0],'DOM CPU'
  35.107 -        print '\nPin domain DOM to cpu CPU.'
  35.108 +        print args[0],'DOM VCPU CPUS'
  35.109 +        print '\nSet which cpus VCPU in domain DOM can use.'
  35.110 +
  35.111 +    # convert list of cpus to bitmap integer value
  35.112 +    def make_map(self, cpulist):
  35.113 +        cpus = []
  35.114 +        cpumap = 0
  35.115 +        for c in cpulist.split(','):
  35.116 +            if len(c) > 1:
  35.117 +                (x,y) = c.split('-')
  35.118 +                for i in range(int(x),int(y)+1):
  35.119 +                    cpus.append(int(i))
  35.120 +            else:
  35.121 +                cpus.append(int(c))
  35.122 +        cpus.sort()
  35.123 +        for c in cpus:
  35.124 +            cpumap = cpumap | 1<<c
  35.125 +
  35.126 +        return cpumap
  35.127  
  35.128      def main(self, args):
  35.129 -        if len(args) != 3: self.err("%s: Invalid argument(s)" % args[0])
  35.130 -        dom = args[1]
  35.131 -        cpu = int(args[2])
  35.132 -        server.xend_domain_pincpu(dom, cpu)
  35.133 +        if len(args) != 4: self.err("%s: Invalid argument(s)" % args[0])
  35.134 +        dom  = args[1]
  35.135 +        vcpu = int(args[2])
  35.136 +        cpumap  = self.make_map(args[3]);
  35.137 +        server.xend_domain_pincpu(dom, vcpu, cpumap)
  35.138  
  35.139  xm.prog(ProgPincpu)
  35.140  
    36.1 --- a/xen/arch/ia64/domain.c	Wed May 11 13:43:50 2005 +0000
    36.2 +++ b/xen/arch/ia64/domain.c	Fri May 13 14:30:20 2005 +0000
    36.3 @@ -626,7 +626,7 @@ int construct_dom0(struct domain *d,
    36.4  #ifndef CLONE_DOMAIN0
    36.5  	if ( d != dom0 ) 
    36.6  	    BUG();
    36.7 -	if ( test_bit(DF_CONSTRUCTED, &d->flags) ) 
    36.8 +	if ( test_bit(_DOMF_constructed, &d->domain_flags) ) 
    36.9  	    BUG();
   36.10  #endif
   36.11  
   36.12 @@ -753,7 +753,7 @@ int construct_dom0(struct domain *d,
   36.13  #endif
   36.14  	console_endboot(strstr(cmdline, "tty0") != NULL);
   36.15  
   36.16 -	set_bit(DF_CONSTRUCTED, &d->flags);
   36.17 +	set_bit(_DOMF_constructed, &d->domain_flags);
   36.18  
   36.19  	new_thread(ed, pkern_entry, 0, 0);
   36.20  	// FIXME: Hack for keyboard input
   36.21 @@ -783,10 +783,10 @@ int construct_domU(struct domain *d,
   36.22  	unsigned long pkern_entry;
   36.23  
   36.24  #ifndef DOMU_AUTO_RESTART
   36.25 -	if ( test_bit(DF_CONSTRUCTED, &d->flags) ) BUG();
   36.26 +	if ( test_bit(_DOMF_constructed, &d->domain_flags) ) BUG();
   36.27  #endif
   36.28  
   36.29 -	printk("*** LOADING DOMAIN %d ***\n",d->id);
   36.30 +	printk("*** LOADING DOMAIN %d ***\n",d->domain_id);
   36.31  
   36.32  	d->max_pages = dom0_size/PAGE_SIZE;	// FIXME: use dom0 size
   36.33  	// FIXME: use domain0 command line
   36.34 @@ -796,13 +796,13 @@ int construct_domU(struct domain *d,
   36.35  
   36.36  	d->arch.mm = xmalloc(struct mm_struct);
   36.37  	if (unlikely(!d->arch.mm)) {
   36.38 -	    	printk("Can't allocate mm_struct for domain %d\n",d->id);
   36.39 +	    	printk("Can't allocate mm_struct for domain %d\n",d->domain_id);
   36.40  	    	return -ENOMEM;
   36.41  	}
   36.42  	memset(d->arch.mm, 0, sizeof(*d->arch.mm));
   36.43  	d->arch.mm->pgd = pgd_alloc(d->arch.mm);
   36.44  	if (unlikely(!d->arch.mm->pgd)) {
   36.45 -	    	printk("Can't allocate pgd for domain %d\n",d->id);
   36.46 +	    	printk("Can't allocate pgd for domain %d\n",d->domain_id);
   36.47  	    	return -ENOMEM;
   36.48  	}
   36.49  
   36.50 @@ -816,7 +816,7 @@ int construct_domU(struct domain *d,
   36.51  	loaddomainelfimage(d,image_start);
   36.52  	printk("loaddomainelfimage returns\n");
   36.53  
   36.54 -	set_bit(DF_CONSTRUCTED, &d->flags);
   36.55 +	set_bit(_DOMF_constructed, &d->domain_flags);
   36.56  
   36.57  	printk("calling new_thread, entry=%p\n",pkern_entry);
   36.58  #ifdef DOMU_AUTO_RESTART
   36.59 @@ -836,7 +836,7 @@ void reconstruct_domU(struct exec_domain
   36.60  {
   36.61  	/* re-copy the OS image to reset data values to original */
   36.62  	printk("reconstruct_domU: restarting domain %d...\n",
   36.63 -		ed->domain->id);
   36.64 +		ed->domain->domain_id);
   36.65  	loaddomainelfimage(ed->domain,ed->domain->arch.image_start);
   36.66  	new_thread(ed, ed->domain->arch.entry, 0, 0);
   36.67  }
   36.68 @@ -859,7 +859,7 @@ int launch_domainU(unsigned long size)
   36.69  	else next++;
   36.70  	if (construct_domU(d, (unsigned long)domU_staging_area, size,0,0,0)) {
   36.71  		printf("launch_domainU: couldn't construct(id=%d,%lx,%lx)\n",
   36.72 -			d->id,domU_staging_area,size);
   36.73 +			d->domain_id,domU_staging_area,size);
   36.74  		return 2;
   36.75  	}
   36.76  	domain_unpause_by_systemcontroller(d);
    37.1 --- a/xen/arch/ia64/idle0_task.c	Wed May 11 13:43:50 2005 +0000
    37.2 +++ b/xen/arch/ia64/idle0_task.c	Fri May 13 14:30:20 2005 +0000
    37.3 @@ -21,8 +21,8 @@
    37.4  
    37.5  #define IDLE0_DOMAIN(_t)             \
    37.6  {                                    \
    37.7 -    id:          IDLE_DOMAIN_ID,     \
    37.8 -    flags:     1<<DF_IDLETASK,       \
    37.9 +    domain_id:   IDLE_DOMAIN_ID,     \
   37.10 +    domain_flags:DOMF_idle_domain,   \
   37.11      refcnt:      ATOMIC_INIT(1)      \
   37.12  }
   37.13  
    38.1 --- a/xen/arch/ia64/patch/linux-2.6.7/init_task.h	Wed May 11 13:43:50 2005 +0000
    38.2 +++ b/xen/arch/ia64/patch/linux-2.6.7/init_task.h	Fri May 13 14:30:20 2005 +0000
    38.3 @@ -35,8 +35,8 @@
    38.4  +#define INIT_TASK(tsk) \
    38.5  +{							\
    38.6  +	/*processor:	0,*/				\
    38.7 -+	/*id:		IDLE_DOMAIN_ID,*/		\
    38.8 -+	/*flags:	1<<DF_IDLETASK,*/		\
    38.9 ++	/*domain_id:	IDLE_DOMAIN_ID,*/		\
   38.10 ++	/*domain_flags:	DOMF_idle_domain,*/		\
   38.11  +	refcnt:		ATOMIC_INIT(1)			\
   38.12  +}
   38.13  +#else
    39.1 --- a/xen/arch/ia64/process.c	Wed May 11 13:43:50 2005 +0000
    39.2 +++ b/xen/arch/ia64/process.c	Fri May 13 14:30:20 2005 +0000
    39.3 @@ -214,7 +214,7 @@ void deliver_pending_interrupt(struct pt
    39.4  		if (vcpu_deliverable_interrupts(ed)) {
    39.5  			unsigned long isr = regs->cr_ipsr & IA64_PSR_RI;
    39.6  			if (vcpu_timer_pending_early(ed))
    39.7 -printf("*#*#*#* about to deliver early timer to domain %d!!!\n",ed->domain->id);
    39.8 +printf("*#*#*#* about to deliver early timer to domain %d!!!\n",ed->domain->domain_id);
    39.9  			reflect_interruption(0,isr,0,regs,IA64_EXTINT_VECTOR);
   39.10  		}
   39.11  	}
    40.1 --- a/xen/arch/ia64/xenmisc.c	Wed May 11 13:43:50 2005 +0000
    40.2 +++ b/xen/arch/ia64/xenmisc.c	Fri May 13 14:30:20 2005 +0000
    40.3 @@ -234,21 +234,21 @@ void context_switch(struct exec_domain *
    40.4  {
    40.5  //printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
    40.6  //printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
    40.7 -//prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
    40.8 -//if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
    40.9 -//if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
   40.10 -//printk("@@sw %d->%d\n",prev->domain->id,next->domain->id);
   40.11 +//prev->domain->domain_id,(long)prev&0xffffff,next->domain->domain_id,(long)next&0xffffff);
   40.12 +//if (prev->domain->domain_id == 1 && next->domain->domain_id == 0) cs10foo();
   40.13 +//if (prev->domain->domain_id == 0 && next->domain->domain_id == 1) cs01foo();
   40.14 +//printk("@@sw %d->%d\n",prev->domain->domain_id,next->domain->domain_id);
   40.15  	switch_to(prev,next,prev);
   40.16  // leave this debug for now: it acts as a heartbeat when more than
   40.17  // one domain is active
   40.18  {
   40.19  static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
   40.20  static int i = 100;
   40.21 -int id = ((struct exec_domain *)current)->domain->id & 0xf;
   40.22 +int id = ((struct exec_domain *)current)->domain->domain_id & 0xf;
   40.23  if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
   40.24  if (!i--) { printk("+",id); cnt[id] = 100; }
   40.25  }
   40.26 -	clear_bit(EDF_RUNNING, &prev->flags);
   40.27 +	clear_bit(_VCPUF_running, &prev->vcpu_flags);
   40.28  	//if (!is_idle_task(next->domain) )
   40.29  		//send_guest_virq(next, VIRQ_TIMER);
   40.30  	load_region_regs(current);
   40.31 @@ -271,15 +271,15 @@ void panic_domain(struct pt_regs *regs, 
   40.32      
   40.33  loop:
   40.34  	printf("$$$$$ PANIC in domain %d (k6=%p): ",
   40.35 -		ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
   40.36 +		ed->domain->domain_id, ia64_get_kr(IA64_KR_CURRENT));
   40.37  	va_start(args, fmt);
   40.38  	(void)vsnprintf(buf, sizeof(buf), fmt, args);
   40.39  	va_end(args);
   40.40  	printf(buf);
   40.41  	if (regs) show_registers(regs);
   40.42  	domain_pause_by_systemcontroller(current->domain);
   40.43 -	set_bit(DF_CRASHED, ed->domain->flags);
   40.44 -	if (ed->domain->id == 0) {
   40.45 +	set_bit(_DOMF_crashed, ed->domain->domain_flags);
   40.46 +	if (ed->domain->domain_id == 0) {
   40.47  		int i = 1000000000L;
   40.48  		// if domain0 crashes, just periodically print out panic
   40.49  		// message to make post-mortem easier
    41.1 --- a/xen/arch/ia64/xensetup.c	Wed May 11 13:43:50 2005 +0000
    41.2 +++ b/xen/arch/ia64/xensetup.c	Fri May 13 14:30:20 2005 +0000
    41.3 @@ -52,15 +52,10 @@ unsigned char opt_com1[30] = "", opt_com
    41.4  unsigned int opt_dom0_mem = 16000;
    41.5  /* opt_noht: If true, Hyperthreading is ignored. */
    41.6  int opt_noht=0;
    41.7 -/* opt_noacpi: If true, ACPI tables are not parsed. */
    41.8 -int opt_noacpi=0;
    41.9  /* opt_nosmp: If true, secondary processors are ignored. */
   41.10  int opt_nosmp=0;
   41.11  /* opt_noreboot: If true, machine will need manual reset on error. */
   41.12  int opt_noreboot=0;
   41.13 -/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
   41.14 -/* NB. This flag implies 'nosmp' and 'noacpi'. */
   41.15 -int opt_ignorebiostables=0;
   41.16  /* opt_watchdog: If true, run a watchdog NMI on each processor. */
   41.17  int opt_watchdog=0;
   41.18  /* opt_pdb: Name of serial port for Xen pervasive debugger (and enable pdb) */
   41.19 @@ -267,7 +262,7 @@ printk("About to call init_idle_task()\n
   41.20      if ( dom0 == NULL )
   41.21          panic("Error creating domain 0\n");
   41.22  
   41.23 -    set_bit(DF_PRIVILEGED, &dom0->flags);
   41.24 +    set_bit(_DOMF_privileged, &dom0->domain_flags);
   41.25  
   41.26      /*
   41.27       * We're going to setup domain0 using the module(s) that we stashed safely
    42.1 --- a/xen/arch/x86/acpi/boot.c	Wed May 11 13:43:50 2005 +0000
    42.2 +++ b/xen/arch/x86/acpi/boot.c	Fri May 13 14:30:20 2005 +0000
    42.3 @@ -36,26 +36,13 @@
    42.4  #include <asm/io.h>
    42.5  #include <asm/irq.h>
    42.6  #include <asm/mpspec.h>
    42.7 +#include <mach_apic.h>
    42.8 +#include <mach_mpparse.h>
    42.9  
   42.10  int sbf_port;
   42.11  #define end_pfn_map max_page
   42.12  #define CONFIG_ACPI_PCI
   42.13  
   42.14 -#ifdef	CONFIG_X86_64
   42.15 -
   42.16 -static inline void  acpi_madt_oem_check(char *oem_id, char *oem_table_id) { }
   42.17 -extern void __init clustered_apic_check(void);
   42.18 -static inline int ioapic_setup_disabled(void) { return 0; }
   42.19 -
   42.20 -#else	/* X86 */
   42.21 -
   42.22 -#ifdef	CONFIG_X86_LOCAL_APIC
   42.23 -#include <mach_apic.h>
   42.24 -#include <mach_mpparse.h>
   42.25 -#endif	/* CONFIG_X86_LOCAL_APIC */
   42.26 -
   42.27 -#endif	/* X86 */
   42.28 -
   42.29  #define BAD_MADT_ENTRY(entry, end) (					    \
   42.30  		(!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
   42.31  		((acpi_table_entry_header *)entry)->length != sizeof(*entry))
    43.1 --- a/xen/arch/x86/audit.c	Wed May 11 13:43:50 2005 +0000
    43.2 +++ b/xen/arch/x86/audit.c	Fri May 13 14:30:20 2005 +0000
    43.3 @@ -74,7 +74,7 @@ int audit_adjust_pgtables(struct domain 
    43.4              {
    43.5                  APRINTK("Audit %d: type count went below zero "
    43.6                          "mfn=%lx t=%x ot=%x",
    43.7 -                        d->id, page_to_pfn(page),
    43.8 +                        d->domain_id, page_to_pfn(page),
    43.9                          page->u.inuse.type_info,
   43.10                          page->tlbflush_timestamp);
   43.11                  errors++;
   43.12 @@ -83,7 +83,7 @@ int audit_adjust_pgtables(struct domain 
   43.13              {
   43.14                  APRINTK("Audit %d: type count overflowed "
   43.15                          "mfn=%lx t=%x ot=%x",
   43.16 -                        d->id, page_to_pfn(page),
   43.17 +                        d->domain_id, page_to_pfn(page),
   43.18                          page->u.inuse.type_info,
   43.19                          page->tlbflush_timestamp);
   43.20                  errors++;
   43.21 @@ -102,7 +102,7 @@ int audit_adjust_pgtables(struct domain 
   43.22          {
   43.23              APRINTK("Audit %d: general count went below zero "
   43.24                      "mfn=%lx t=%x ot=%x",
   43.25 -                    d->id, page_to_pfn(page),
   43.26 +                    d->domain_id, page_to_pfn(page),
   43.27                      page->u.inuse.type_info,
   43.28                      page->tlbflush_timestamp);
   43.29              errors++;
   43.30 @@ -111,7 +111,7 @@ int audit_adjust_pgtables(struct domain 
   43.31          {
   43.32              APRINTK("Audit %d: general count overflowed "
   43.33                      "mfn=%lx t=%x ot=%x",
   43.34 -                    d->id, page_to_pfn(page),
   43.35 +                    d->domain_id, page_to_pfn(page),
   43.36                      page->u.inuse.type_info,
   43.37                      page->tlbflush_timestamp);
   43.38              errors++;
   43.39 @@ -142,7 +142,7 @@ int audit_adjust_pgtables(struct domain 
   43.40                                     "belonging to a domain %p (id=%d)\n",
   43.41                                     l1mfn,
   43.42                                     page_get_owner(l1page),
   43.43 -                                   page_get_owner(l1page)->id);
   43.44 +                                   page_get_owner(l1page)->domain_id);
   43.45                              errors++;
   43.46                              continue;
   43.47                          }
   43.48 @@ -153,7 +153,7 @@ int audit_adjust_pgtables(struct domain 
   43.49                          {
   43.50                              printk("Audit %d: [Shadow L2 mfn=%lx i=%x] "
   43.51                                     "Expected Shadow L1 t=%x mfn=%lx\n",
   43.52 -                                   d->id, mfn, i,
   43.53 +                                   d->domain_id, mfn, i,
   43.54                                     l1page->u.inuse.type_info, l1mfn);
   43.55                              errors++;
   43.56                          }
   43.57 @@ -167,7 +167,7 @@ int audit_adjust_pgtables(struct domain 
   43.58                                     l1mfn,
   43.59                                     page_get_owner(l1page),
   43.60                                     (page_get_owner(l1page)
   43.61 -                                    ? page_get_owner(l1page)->id
   43.62 +                                    ? page_get_owner(l1page)->domain_id
   43.63                                      : -1));
   43.64                              errors++;
   43.65                              continue;
   43.66 @@ -179,14 +179,14 @@ int audit_adjust_pgtables(struct domain 
   43.67                          {
   43.68                              printk("Audit %d: [%x] Found %s Linear PT "
   43.69                                     "t=%x mfn=%lx\n",
   43.70 -                                   d->id, i, (l1mfn==mfn) ? "Self" : "Other",
   43.71 +                                   d->domain_id, i, (l1mfn==mfn) ? "Self" : "Other",
   43.72                                     l1page->u.inuse.type_info, l1mfn);
   43.73                          }
   43.74                          else if ( page_type != PGT_l1_page_table )
   43.75                          {
   43.76                              printk("Audit %d: [L2 mfn=%lx i=%x] "
   43.77                                     "Expected L1 t=%x mfn=%lx\n",
   43.78 -                                   d->id, mfn, i,
   43.79 +                                   d->domain_id, mfn, i,
   43.80                                     l1page->u.inuse.type_info, l1mfn);
   43.81                              errors++;
   43.82                          }
   43.83 @@ -238,9 +238,9 @@ int audit_adjust_pgtables(struct domain 
   43.84                      {
   43.85                          printk("Audit %d: [hl2mfn=%lx,i=%x] Skip foreign page "
   43.86                                 "dom=%p (id=%d) mfn=%lx c=%08x t=%08x\n",
   43.87 -                               d->id, hl2mfn, i,
   43.88 +                               d->domain_id, hl2mfn, i,
   43.89                                 page_get_owner(gpage),
   43.90 -                               page_get_owner(gpage)->id,
   43.91 +                               page_get_owner(gpage)->domain_id,
   43.92                                 gmfn,
   43.93                                 gpage->count_info,
   43.94                                 gpage->u.inuse.type_info);
   43.95 @@ -289,7 +289,7 @@ int audit_adjust_pgtables(struct domain 
   43.96                          {
   43.97                              printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW "
   43.98                                     "t=%x mfn=%lx\n",
   43.99 -                                   d->id, l1mfn, i,
  43.100 +                                   d->domain_id, l1mfn, i,
  43.101                                     gpage->u.inuse.type_info, gmfn);
  43.102                              errors++;
  43.103                          }
  43.104 @@ -300,7 +300,7 @@ int audit_adjust_pgtables(struct domain 
  43.105                          {
  43.106                              printk("Audit %d: [l1mfn=%lx, i=%x] Illegal RW of "
  43.107                                     "page table gmfn=%lx\n",
  43.108 -                                   d->id, l1mfn, i, gmfn);
  43.109 +                                   d->domain_id, l1mfn, i, gmfn);
  43.110                              errors++;
  43.111                          }
  43.112                      }		   
  43.113 @@ -309,9 +309,9 @@ int audit_adjust_pgtables(struct domain 
  43.114                      {
  43.115                          printk("Audit %d: [l1mfn=%lx,i=%x] Skip foreign page "
  43.116                                 "dom=%p (id=%d) mfn=%lx c=%08x t=%08x\n",
  43.117 -                               d->id, l1mfn, i,
  43.118 +                               d->domain_id, l1mfn, i,
  43.119                                 page_get_owner(gpage),
  43.120 -                               page_get_owner(gpage)->id,
  43.121 +                               page_get_owner(gpage)->domain_id,
  43.122                                 gmfn,
  43.123                                 gpage->count_info,
  43.124                                 gpage->u.inuse.type_info);
  43.125 @@ -455,7 +455,7 @@ int audit_adjust_pgtables(struct domain 
  43.126                      {
  43.127                          printk("Audit %d: found an L2 guest page "
  43.128                                 "mfn=%lx t=%08x c=%08x while in shadow mode\n",
  43.129 -                               d->id, mfn, page->u.inuse.type_info,
  43.130 +                               d->domain_id, mfn, page->u.inuse.type_info,
  43.131                                 page->count_info);
  43.132                          errors++;
  43.133                      }
  43.134 @@ -466,14 +466,14 @@ int audit_adjust_pgtables(struct domain 
  43.135                               PGT_validated )
  43.136                          {
  43.137                              printk("Audit %d: L2 mfn=%lx not validated %08x\n",
  43.138 -                                   d->id, mfn, page->u.inuse.type_info);
  43.139 +                                   d->domain_id, mfn, page->u.inuse.type_info);
  43.140                              errors++;
  43.141                          }
  43.142  
  43.143                          if ( (page->u.inuse.type_info & PGT_pinned) != PGT_pinned )
  43.144                          {
  43.145                              printk("Audit %d: L2 mfn=%lx not pinned t=%08x\n",
  43.146 -                                   d->id, mfn, page->u.inuse.type_info);
  43.147 +                                   d->domain_id, mfn, page->u.inuse.type_info);
  43.148                              errors++;
  43.149                          }
  43.150                      }
  43.151 @@ -506,7 +506,7 @@ int audit_adjust_pgtables(struct domain 
  43.152                               PGT_validated )
  43.153                          {
  43.154                              printk("Audit %d: L1 not validated mfn=%lx t=%08x\n",
  43.155 -                                   d->id, mfn, page->u.inuse.type_info);
  43.156 +                                   d->domain_id, mfn, page->u.inuse.type_info);
  43.157                              errors++;
  43.158                          }
  43.159  
  43.160 @@ -515,7 +515,7 @@ int audit_adjust_pgtables(struct domain 
  43.161                              if ( !VM_ASSIST(d, VMASST_TYPE_writable_pagetables) )
  43.162                              {
  43.163                                  printk("Audit %d: L1 mfn=%lx not pinned t=%08x\n",
  43.164 -                                       d->id, mfn, page->u.inuse.type_info);
  43.165 +                                       d->domain_id, mfn, page->u.inuse.type_info);
  43.166                              }
  43.167                          }
  43.168                      }
  43.169 @@ -601,7 +601,7 @@ void audit_pagelist(struct domain *d)
  43.170      if ( xenpages != d->xenheap_pages ||
  43.171           totpages != d->tot_pages )
  43.172      {
  43.173 -        printk("ARGH! dom %d: xen=%d %d, pages=%d %d\n", d->id,
  43.174 +        printk("ARGH! dom %d: xen=%d %d, pages=%d %d\n", d->domain_id,
  43.175                 xenpages, d->xenheap_pages, 
  43.176                 totpages, d->tot_pages );
  43.177      }
  43.178 @@ -623,7 +623,7 @@ void _audit_domain(struct domain *d, int
  43.179              if ( (pt[i] & _PAGE_PRESENT) && ((pt[i] >> PAGE_SHIFT) == xmfn) )
  43.180                  printk("     found dom=%d mfn=%lx t=%08x c=%08x "
  43.181                         "pt[i=%x]=%lx\n",
  43.182 -                       d->id, mfn, page->u.inuse.type_info,
  43.183 +                       d->domain_id, mfn, page->u.inuse.type_info,
  43.184                         page->count_info, i, pt[i]);
  43.185          }
  43.186  
  43.187 @@ -721,7 +721,7 @@ void _audit_domain(struct domain *d, int
  43.188      {
  43.189          printk("skipping audit domain of translated domain %d "
  43.190                 "from other context\n",
  43.191 -               d->id);
  43.192 +               d->domain_id);
  43.193          return;
  43.194      }
  43.195  
  43.196 @@ -832,7 +832,7 @@ void _audit_domain(struct domain *d, int
  43.197      if ( !(flags & AUDIT_QUIET) &&
  43.198           ((io_mappings > 0) || (lowmem_mappings > 0)) )
  43.199          printk("Audit %d: Found %d lowmem mappings and %d io mappings\n",
  43.200 -               d->id, lowmem_mappings, io_mappings);
  43.201 +               d->domain_id, lowmem_mappings, io_mappings);
  43.202  
  43.203      /* PHASE 2 */
  43.204  
  43.205 @@ -849,7 +849,7 @@ void _audit_domain(struct domain *d, int
  43.206              if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
  43.207              {
  43.208                  printk("Audit %d: type count!=0 t=%x ot=%x c=%x mfn=%lx\n",
  43.209 -                       d->id, page->u.inuse.type_info, 
  43.210 +                       d->domain_id, page->u.inuse.type_info, 
  43.211                         page->tlbflush_timestamp,
  43.212                         page->count_info, mfn);
  43.213                  errors++;
  43.214 @@ -863,7 +863,7 @@ void _audit_domain(struct domain *d, int
  43.215              if ( (page->u.inuse.type_info & PGT_count_mask) != 0 )
  43.216              {
  43.217                  printk("Audit %d: type count!=0 t=%x ot=%x c=%x mfn=%lx\n",
  43.218 -                       d->id, page->u.inuse.type_info, 
  43.219 +                       d->domain_id, page->u.inuse.type_info, 
  43.220                         page->tlbflush_timestamp,
  43.221                         page->count_info, mfn);
  43.222                  //errors++;
  43.223 @@ -876,7 +876,7 @@ void _audit_domain(struct domain *d, int
  43.224          if ( (page->count_info & PGC_count_mask) != 1 )
  43.225          {
  43.226              printk("Audit %d: gen count!=1 (c=%x) t=%x ot=%x mfn=%lx\n",
  43.227 -                   d->id,
  43.228 +                   d->domain_id,
  43.229                     page->count_info,
  43.230                     page->u.inuse.type_info, 
  43.231                     page->tlbflush_timestamp, mfn );
  43.232 @@ -912,7 +912,7 @@ void _audit_domain(struct domain *d, int
  43.233                      {
  43.234                          printk("Audit %d: shadow page counts wrong "
  43.235                                 "mfn=%lx t=%08x c=%08x\n",
  43.236 -                               d->id, page_to_pfn(page),
  43.237 +                               d->domain_id, page_to_pfn(page),
  43.238                                 page->u.inuse.type_info,
  43.239                                 page->count_info);
  43.240                          printk("a->gpfn_and_flags=%p\n",
  43.241 @@ -950,7 +950,7 @@ void _audit_domain(struct domain *d, int
  43.242      if ( !(flags & AUDIT_QUIET) )
  43.243          printk("Audit dom%d Done. "
  43.244                 "pages=%d oos=%d l1=%d l2=%d ctot=%d ttot=%d\n",
  43.245 -               d->id, page_count, oos_count, l1, l2, ctot, ttot);
  43.246 +               d->domain_id, page_count, oos_count, l1, l2, ctot, ttot);
  43.247  
  43.248      if ( !(flags & AUDIT_SHADOW_ALREADY_LOCKED) )
  43.249          shadow_unlock(d);
    44.1 --- a/xen/arch/x86/cdb.c	Wed May 11 13:43:50 2005 +0000
    44.2 +++ b/xen/arch/x86/cdb.c	Fri May 13 14:30:20 2005 +0000
    44.3 @@ -12,7 +12,9 @@
    44.4  #include <asm/irq.h>
    44.5  #include <xen/spinlock.h>
    44.6  #include <asm/debugger.h>
    44.7 -#include <asm/init.h>
    44.8 +#include <xen/init.h>
    44.9 +#include <xen/smp.h>
   44.10 +#include <asm/apic.h>
   44.11  
   44.12  /* Printk isn't particularly safe just after we've trapped to the
   44.13     debugger. so avoid it. */
    45.1 --- a/xen/arch/x86/dom0_ops.c	Wed May 11 13:43:50 2005 +0000
    45.2 +++ b/xen/arch/x86/dom0_ops.c	Fri May 13 14:30:20 2005 +0000
    45.3 @@ -397,7 +397,7 @@ void arch_getdomaininfo_ctxt(
    45.4  #endif
    45.5  
    45.6      c->flags = 0;
    45.7 -    if ( test_bit(EDF_DONEFPUINIT, &ed->flags) )
    45.8 +    if ( test_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags) )
    45.9          c->flags |= VGCF_I387_VALID;
   45.10      if ( KERNEL_MODE(ed, &ed->arch.guest_context.user_regs) )
   45.11          c->flags |= VGCF_IN_KERNEL;
    46.1 --- a/xen/arch/x86/domain.c	Wed May 11 13:43:50 2005 +0000
    46.2 +++ b/xen/arch/x86/domain.c	Fri May 13 14:30:20 2005 +0000
    46.3 @@ -100,7 +100,7 @@ void startup_cpu_idle_loop(void)
    46.4      struct exec_domain *ed = current;
    46.5  
    46.6      /* Just some sanity to ensure that the scheduler is set up okay. */
    46.7 -    ASSERT(ed->domain->id == IDLE_DOMAIN_ID);
    46.8 +    ASSERT(ed->domain->domain_id == IDLE_DOMAIN_ID);
    46.9      percpu_ctxt[smp_processor_id()].curr_ed = ed;
   46.10      set_bit(smp_processor_id(), &ed->domain->cpuset);
   46.11      domain_unpause_by_systemcontroller(ed->domain);
   46.12 @@ -246,13 +246,14 @@ void arch_do_createdomain(struct exec_do
   46.13  
   46.14      ed->arch.flags = TF_kernel_mode;
   46.15  
   46.16 -    if ( d->id != IDLE_DOMAIN_ID )
   46.17 +    if ( d->domain_id != IDLE_DOMAIN_ID )
   46.18      {
   46.19          ed->arch.schedule_tail = continue_nonidle_task;
   46.20  
   46.21          d->shared_info = (void *)alloc_xenheap_page();
   46.22          memset(d->shared_info, 0, PAGE_SIZE);
   46.23 -        ed->vcpu_info = &d->shared_info->vcpu_data[ed->id];
   46.24 +        ed->vcpu_info = &d->shared_info->vcpu_data[ed->vcpu_id];
   46.25 +        ed->cpumap = CPUMAP_RUNANYWHERE;
   46.26          SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
   46.27          machine_to_phys_mapping[virt_to_phys(d->shared_info) >> 
   46.28                                 PAGE_SHIFT] = INVALID_M2P_ENTRY;
   46.29 @@ -294,7 +295,7 @@ void arch_do_boot_vcpu(struct exec_domai
   46.30      struct domain *d = ed->domain;
   46.31      ed->arch.schedule_tail = d->exec_domain[0]->arch.schedule_tail;
   46.32      ed->arch.perdomain_ptes = 
   46.33 -        d->arch.mm_perdomain_pt + (ed->id << PDPT_VCPU_SHIFT);
   46.34 +        d->arch.mm_perdomain_pt + (ed->vcpu_id << PDPT_VCPU_SHIFT);
   46.35      ed->arch.flags = TF_kernel_mode;
   46.36  }
   46.37  
   46.38 @@ -398,9 +399,9 @@ int arch_set_info_guest(
   46.39                  return -EINVAL;
   46.40      }
   46.41  
   46.42 -    clear_bit(EDF_DONEFPUINIT, &ed->flags);
   46.43 +    clear_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags);
   46.44      if ( c->flags & VGCF_I387_VALID )
   46.45 -        set_bit(EDF_DONEFPUINIT, &ed->flags);
   46.46 +        set_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags);
   46.47  
   46.48      ed->arch.flags &= ~TF_kernel_mode;
   46.49      if ( c->flags & VGCF_IN_KERNEL )
   46.50 @@ -408,15 +409,17 @@ int arch_set_info_guest(
   46.51  
   46.52      memcpy(&ed->arch.guest_context, c, sizeof(*c));
   46.53  
   46.54 -    /* IOPL privileges are virtualised. */
   46.55 -    ed->arch.iopl = (ed->arch.guest_context.user_regs.eflags >> 12) & 3;
   46.56 -    ed->arch.guest_context.user_regs.eflags &= ~EF_IOPL;
   46.57 +    if ( !(c->flags & VGCF_VMX_GUEST) )
   46.58 +    {
   46.59 +        /* IOPL privileges are virtualised. */
   46.60 +        ed->arch.iopl = (ed->arch.guest_context.user_regs.eflags >> 12) & 3;
   46.61 +        ed->arch.guest_context.user_regs.eflags &= ~EF_IOPL;
   46.62  
   46.63 -    /* Clear IOPL for unprivileged domains. */
   46.64 -    if ( !IS_PRIV(d) )
   46.65 -        ed->arch.guest_context.user_regs.eflags &= 0xffffcfff;
   46.66 +        /* Ensure real hardware interrupts are enabled. */
   46.67 +        ed->arch.guest_context.user_regs.eflags |= EF_IE;
   46.68 +    }
   46.69  
   46.70 -    if ( test_bit(EDF_DONEINIT, &ed->flags) )
   46.71 +    if ( test_bit(_VCPUF_initialised, &ed->vcpu_flags) )
   46.72          return 0;
   46.73  
   46.74      if ( (rc = (int)set_fast_trap(ed, c->fast_trap_idx)) != 0 )
   46.75 @@ -427,7 +430,7 @@ int arch_set_info_guest(
   46.76      for ( i = 0; i < 8; i++ )
   46.77          (void)set_debugreg(ed, i, c->debugreg[i]);
   46.78  
   46.79 -    if ( ed->id == 0 )
   46.80 +    if ( ed->vcpu_id == 0 )
   46.81          d->vm_assist = c->vm_assist;
   46.82  
   46.83      phys_basetab = c->pt_base;
   46.84 @@ -479,7 +482,7 @@ int arch_set_info_guest(
   46.85      update_pagetables(ed);
   46.86      
   46.87      /* Don't redo final setup */
   46.88 -    set_bit(EDF_DONEINIT, &ed->flags);
   46.89 +    set_bit(_VCPUF_initialised, &ed->vcpu_flags);
   46.90  
   46.91      return 0;
   46.92  }
   46.93 @@ -797,7 +800,7 @@ void context_switch(struct exec_domain *
   46.94       * 'prev' (after this point, a dying domain's info structure may be freed
   46.95       * without warning). 
   46.96       */
   46.97 -    clear_bit(EDF_RUNNING, &prev->flags);
   46.98 +    clear_bit(_VCPUF_running, &prev->vcpu_flags);
   46.99  
  46.100      schedule_tail(next);
  46.101      BUG();
    47.1 --- a/xen/arch/x86/domain_build.c	Wed May 11 13:43:50 2005 +0000
    47.2 +++ b/xen/arch/x86/domain_build.c	Fri May 13 14:30:20 2005 +0000
    47.3 @@ -7,6 +7,7 @@
    47.4  #include <xen/config.h>
    47.5  #include <xen/init.h>
    47.6  #include <xen/lib.h>
    47.7 +#include <xen/ctype.h>
    47.8  #include <xen/sched.h>
    47.9  #include <xen/smp.h>
   47.10  #include <xen/delay.h>
   47.11 @@ -21,9 +22,18 @@
   47.12  #include <asm/i387.h>
   47.13  #include <asm/shadow.h>
   47.14  
   47.15 -/* opt_dom0_mem: Kilobytes of memory allocated to domain 0. */
   47.16 -static unsigned int opt_dom0_mem = 0;
   47.17 -integer_unit_param("dom0_mem", opt_dom0_mem);
   47.18 +/* opt_dom0_mem: memory allocated to domain 0. */
   47.19 +static unsigned int opt_dom0_mem;
   47.20 +static void parse_dom0_mem(char *s)
   47.21 +{
   47.22 +    unsigned long long bytes = memparse(s);
   47.23 +    /* If no unit is specified we default to kB units, not bytes. */
   47.24 +    if ( isdigit(s[strlen(s)-1]) )
   47.25 +        opt_dom0_mem = (unsigned int)bytes;
   47.26 +    else
   47.27 +        opt_dom0_mem = (unsigned int)(bytes >> 10);
   47.28 +}
   47.29 +custom_param("dom0_mem", parse_dom0_mem);
   47.30  
   47.31  static unsigned int opt_dom0_shadow = 0;
   47.32  boolean_param("dom0_shadow", opt_dom0_shadow);
   47.33 @@ -112,9 +122,9 @@ int construct_dom0(struct domain *d,
   47.34      extern void translate_l2pgtable(struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
   47.35  
   47.36      /* Sanity! */
   47.37 -    if ( d->id != 0 ) 
   47.38 +    if ( d->domain_id != 0 ) 
   47.39          BUG();
   47.40 -    if ( test_bit(DF_CONSTRUCTED, &d->flags) ) 
   47.41 +    if ( test_bit(_DOMF_constructed, &d->domain_flags) ) 
   47.42          BUG();
   47.43  
   47.44      memset(&dsi, 0, sizeof(struct domain_setup_info));
   47.45 @@ -540,7 +550,7 @@ int construct_dom0(struct domain *d,
   47.46      /* DOM0 gets access to everything. */
   47.47      physdev_init_dom0(d);
   47.48  
   47.49 -    set_bit(DF_CONSTRUCTED, &d->flags);
   47.50 +    set_bit(_DOMF_constructed, &d->domain_flags);
   47.51  
   47.52      new_thread(ed, dsi.v_kernentry, vstack_end, vstartinfo_start);
   47.53  
    48.1 --- a/xen/arch/x86/e820.c	Wed May 11 13:43:50 2005 +0000
    48.2 +++ b/xen/arch/x86/e820.c	Fri May 13 14:30:20 2005 +0000
    48.3 @@ -3,6 +3,11 @@
    48.4  #include <xen/lib.h>
    48.5  #include <asm/e820.h>
    48.6  
    48.7 +/* opt_mem: Limit of physical RAM. Any RAM beyond this point is ignored. */
    48.8 +unsigned long long opt_mem;
    48.9 +static void parse_mem(char *s) { opt_mem = memparse(s); }
   48.10 +custom_param("mem", parse_mem);
   48.11 +
   48.12  struct e820map e820;
   48.13  
   48.14  static void __init add_memory_region(unsigned long long start,
   48.15 @@ -341,6 +346,31 @@ static void __init clip_4gb(void)
   48.16  #define clip_4gb() ((void)0)
   48.17  #endif
   48.18  
   48.19 +static void __init clip_mem(void)
   48.20 +{
   48.21 +    int i;
   48.22 +
   48.23 +    if ( !opt_mem )
   48.24 +        return;
   48.25 +
   48.26 +    for ( i = 0; i < e820.nr_map; i++ )
   48.27 +    {
   48.28 +        if ( (e820.map[i].addr + e820.map[i].size) <= opt_mem )
   48.29 +            continue;
   48.30 +        printk("Truncating memory map to %lukB\n",
   48.31 +               (unsigned long)(opt_mem >> 10));
   48.32 +        if ( e820.map[i].addr >= opt_mem )
   48.33 +        {
   48.34 +            e820.nr_map = i;
   48.35 +        }
   48.36 +        else
   48.37 +        {
   48.38 +            e820.map[i].size = opt_mem - e820.map[i].addr;
   48.39 +            e820.nr_map = i + 1;          
   48.40 +        }
   48.41 +    }
   48.42 +}
   48.43 +
   48.44  static void __init machine_specific_memory_setup(
   48.45      struct e820entry *raw, int raw_nr)
   48.46  {
   48.47 @@ -348,6 +378,7 @@ static void __init machine_specific_memo
   48.48      sanitize_e820_map(raw, &nr);
   48.49      (void)copy_e820_map(raw, nr);
   48.50      clip_4gb();
   48.51 +    clip_mem();
   48.52  }
   48.53  
   48.54  unsigned long __init init_e820(struct e820entry *raw, int raw_nr)
    49.1 --- a/xen/arch/x86/i387.c	Wed May 11 13:43:50 2005 +0000
    49.2 +++ b/xen/arch/x86/i387.c	Fri May 13 14:30:20 2005 +0000
    49.3 @@ -18,7 +18,7 @@ void init_fpu(void)
    49.4      __asm__ __volatile__ ( "fninit" );
    49.5      if ( cpu_has_xmm )
    49.6          load_mxcsr(0x1f80);
    49.7 -    set_bit(EDF_DONEFPUINIT, &current->flags);
    49.8 +    set_bit(_VCPUF_fpu_initialised, &current->vcpu_flags);
    49.9  }
   49.10  
   49.11  void save_init_fpu(struct exec_domain *tsk)
   49.12 @@ -28,7 +28,7 @@ void save_init_fpu(struct exec_domain *t
   49.13       * This causes us to set the real flag, so we'll need
   49.14       * to temporarily clear it while saving f-p state.
   49.15       */
   49.16 -    if ( test_bit(EDF_GUEST_STTS, &tsk->flags) )
   49.17 +    if ( test_bit(_VCPUF_guest_stts, &tsk->vcpu_flags) )
   49.18          clts();
   49.19  
   49.20      if ( cpu_has_fxsr )
   49.21 @@ -40,7 +40,7 @@ void save_init_fpu(struct exec_domain *t
   49.22              "fnsave %0 ; fwait"
   49.23              : "=m" (tsk->arch.guest_context.fpu_ctxt) );
   49.24  
   49.25 -    clear_bit(EDF_USEDFPU, &tsk->flags);
   49.26 +    clear_bit(_VCPUF_fpu_dirtied, &tsk->vcpu_flags);
   49.27      stts();
   49.28  }
   49.29  
    50.1 --- a/xen/arch/x86/idle0_task.c	Wed May 11 13:43:50 2005 +0000
    50.2 +++ b/xen/arch/x86/idle0_task.c	Fri May 13 14:30:20 2005 +0000
    50.3 @@ -4,8 +4,8 @@
    50.4  #include <asm/desc.h>
    50.5  
    50.6  struct domain idle0_domain = {
    50.7 -    id:          IDLE_DOMAIN_ID,
    50.8 -    flags:       1<<DF_IDLETASK,
    50.9 +    domain_id:   IDLE_DOMAIN_ID,
   50.10 +    domain_flags:DOMF_idle_domain,
   50.11      refcnt:      ATOMIC_INIT(1)
   50.12  };
   50.13  
    51.1 --- a/xen/arch/x86/mm.c	Wed May 11 13:43:50 2005 +0000
    51.2 +++ b/xen/arch/x86/mm.c	Fri May 13 14:30:20 2005 +0000
    51.3 @@ -106,7 +106,7 @@
    51.4  #ifdef VERBOSE
    51.5  #define MEM_LOG(_f, _a...)                           \
    51.6    printk("DOM%u: (file=mm.c, line=%d) " _f "\n", \
    51.7 -         current->domain->id , __LINE__ , ## _a )
    51.8 +         current->domain->domain_id , __LINE__ , ## _a )
    51.9  #else
   51.10  #define MEM_LOG(_f, _a...) ((void)0)
   51.11  #endif
   51.12 @@ -183,7 +183,7 @@ void arch_init_memory(void)
   51.13       */
   51.14      dom_xen = alloc_domain_struct();
   51.15      atomic_set(&dom_xen->refcnt, 1);
   51.16 -    dom_xen->id = DOMID_XEN;
   51.17 +    dom_xen->domain_id = DOMID_XEN;
   51.18  
   51.19      /*
   51.20       * Initialise our DOMID_IO domain.
   51.21 @@ -192,7 +192,7 @@ void arch_init_memory(void)
   51.22       */
   51.23      dom_io = alloc_domain_struct();
   51.24      atomic_set(&dom_io->refcnt, 1);
   51.25 -    dom_io->id = DOMID_IO;
   51.26 +    dom_io->domain_id = DOMID_IO;
   51.27  
   51.28      /* First 1MB of RAM is historically marked as I/O. */
   51.29      for ( i = 0; i < 0x100; i++ )
   51.30 @@ -1162,7 +1162,7 @@ void put_page_type(struct pfn_info *page
   51.31           * See domain.c:relinquish_list().
   51.32           */
   51.33          ASSERT((x & PGT_validated) || 
   51.34 -               test_bit(DF_DYING, &page_get_owner(page)->flags));
   51.35 +               test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags));
   51.36  
   51.37          if ( unlikely((nx & PGT_count_mask) == 0) )
   51.38          {
   51.39 @@ -1392,7 +1392,7 @@ static int set_foreigndom(unsigned int c
   51.40              percpu_info[cpu].foreign = dom_io;
   51.41              break;
   51.42          default:
   51.43 -            MEM_LOG("Dom %u cannot set foreign dom\n", d->id);
   51.44 +            MEM_LOG("Dom %u cannot set foreign dom\n", d->domain_id);
   51.45              okay = 0;
   51.46              break;
   51.47          }
   51.48 @@ -1645,7 +1645,7 @@ int do_mmuext_op(
   51.49              if ( shadow_mode_external(d) )
   51.50              {
   51.51                  MEM_LOG("ignoring SET_LDT hypercall from external "
   51.52 -                        "domain %u\n", d->id);
   51.53 +                        "domain %u\n", d->domain_id);
   51.54                  okay = 0;
   51.55                  break;
   51.56              }
   51.57 @@ -1676,7 +1676,7 @@ int do_mmuext_op(
   51.58          case MMUEXT_REASSIGN_PAGE:
   51.59              if ( unlikely(!IS_PRIV(d)) )
   51.60              {
   51.61 -                MEM_LOG("Dom %u has no reassignment priv", d->id);
   51.62 +                MEM_LOG("Dom %u has no reassignment priv", d->domain_id);
   51.63                  okay = 0;
   51.64                  break;
   51.65              }
   51.66 @@ -1711,13 +1711,13 @@ int do_mmuext_op(
   51.67               * it is dying. 
   51.68               */
   51.69              ASSERT(e->tot_pages <= e->max_pages);
   51.70 -            if ( unlikely(test_bit(DF_DYING, &e->flags)) ||
   51.71 +            if ( unlikely(test_bit(_DOMF_dying, &e->domain_flags)) ||
   51.72                   unlikely(e->tot_pages == e->max_pages) ||
   51.73                   unlikely(IS_XEN_HEAP_FRAME(page)) )
   51.74              {
   51.75                  MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
   51.76                          "page is in Xen heap (%lx), or dom is dying (%ld).\n",
   51.77 -                        e->tot_pages, e->max_pages, op.mfn, e->flags);
   51.78 +                        e->tot_pages, e->max_pages, op.mfn, e->domain_flags);
   51.79                  okay = 0;
   51.80                  goto reassign_fail;
   51.81              }
   51.82 @@ -1738,7 +1738,7 @@ int do_mmuext_op(
   51.83                  {
   51.84                      MEM_LOG("Bad page values %lx: ed=%p(%u), sd=%p,"
   51.85                              " caf=%08x, taf=%08x\n", page_to_pfn(page),
   51.86 -                            d, d->id, unpickle_domptr(_nd), x,
   51.87 +                            d, d->domain_id, unpickle_domptr(_nd), x,
   51.88                              page->u.inuse.type_info);
   51.89                      okay = 0;
   51.90                      goto reassign_fail;
   51.91 @@ -1990,7 +1990,7 @@ int do_mmu_update(
   51.92              {
   51.93                  shadow_lock(FOREIGNDOM);
   51.94                  printk("privileged guest dom%d requests pfn=%lx to map mfn=%lx for dom%d\n",
   51.95 -                       d->id, gpfn, mfn, FOREIGNDOM->id);
   51.96 +                       d->domain_id, gpfn, mfn, FOREIGNDOM->domain_id);
   51.97                  set_machinetophys(mfn, gpfn);
   51.98                  set_p2m_entry(FOREIGNDOM, gpfn, mfn, &sh_mapcache, &mapcache);
   51.99                  okay = 1;
  51.100 @@ -2452,7 +2452,7 @@ int revalidate_l1(struct domain *d, l1_p
  51.101      int modified = 0, i;
  51.102  
  51.103  #if 0
  51.104 -    if ( d->id )
  51.105 +    if ( d->domain_id )
  51.106          printk("%s: l1page mfn=%lx snapshot mfn=%lx\n", __func__,
  51.107                 l1e_get_pfn(linear_pg_table[l1_linear_offset((unsigned long)l1page)]),
  51.108                 l1e_get_pfn(linear_pg_table[l1_linear_offset((unsigned long)snapshot)]));
  51.109 @@ -2909,7 +2909,7 @@ void ptwr_destroy(struct domain *d)
  51.110              {
  51.111                  MEM_LOG("Bad page values %p: ed=%p(%u), sd=%p,"
  51.112                          " caf=%08x, taf=%08x\n", page_to_pfn(page),
  51.113 -                        d, d->id, unpickle_domptr(_nd), x, 
  51.114 +                        d, d->domain_id, unpickle_domptr(_nd), x, 
  51.115                          page->u.inuse.type_info);
  51.116                  spin_unlock(&d->page_alloc_lock);
  51.117                  put_domain(e);
  51.118 @@ -2939,7 +2939,7 @@ void ptwr_destroy(struct domain *d)
  51.119           * Also, a domain mustn't have PGC_allocated pages when it is dying.
  51.120           */
  51.121          ASSERT(e->tot_pages <= e->max_pages);
  51.122 -        if ( unlikely(test_bit(DF_DYING, &e->flags)) ||
  51.123 +        if ( unlikely(test_bit(_DOMF_dying, &e->domain_flags)) ||
  51.124               unlikely(e->tot_pages == e->max_pages) ||
  51.125               unlikely(!gnttab_prepare_for_transfer(e, d, gntref)) )
  51.126          {
    52.1 --- a/xen/arch/x86/physdev.c	Wed May 11 13:43:50 2005 +0000
    52.2 +++ b/xen/arch/x86/physdev.c	Fri May 13 14:30:20 2005 +0000
    52.3 @@ -128,7 +128,7 @@ void physdev_init_dom0(struct domain *d)
    52.4      BUG_ON(d->arch.iobmp_mask == NULL);
    52.5      memset(d->arch.iobmp_mask, 0, IOBMP_BYTES);
    52.6  
    52.7 -    set_bit(DF_PHYSDEV, &d->flags);
    52.8 +    set_bit(_DOMF_physdev_access, &d->domain_flags);
    52.9  }
   52.10  
   52.11  
    53.1 --- a/xen/arch/x86/setup.c	Wed May 11 13:43:50 2005 +0000
    53.2 +++ b/xen/arch/x86/setup.c	Fri May 13 14:30:20 2005 +0000
    53.3 @@ -33,23 +33,29 @@ integer_param("xenheap_megabytes", opt_x
    53.4  int opt_noht = 0;
    53.5  boolean_param("noht", opt_noht);
    53.6  
    53.7 -/* opt_noacpi: If true, ACPI tables are not parsed. */
    53.8 -static int opt_noacpi = 0;
    53.9 -boolean_param("noacpi", opt_noacpi);
   53.10 -
   53.11 -/* opt_nosmp: If true, secondary processors are ignored. */
   53.12 -static int opt_nosmp = 0;
   53.13 -boolean_param("nosmp", opt_nosmp);
   53.14 -
   53.15 -/* opt_ignorebiostables: If true, ACPI and MP tables are ignored. */
   53.16 -/* NB. This flag implies 'nosmp' and 'noacpi'. */
   53.17 -static int opt_ignorebiostables = 0;
   53.18 -boolean_param("ignorebiostables", opt_ignorebiostables);
   53.19 -
   53.20  /* opt_watchdog: If true, run a watchdog NMI on each processor. */
   53.21  static int opt_watchdog = 0;
   53.22  boolean_param("watchdog", opt_watchdog);
   53.23  
   53.24 +/* **** Linux config option: propagated to domain0. */
   53.25 +/* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
   53.26 +/* "acpi=force":  Override the disable blacklist.                   */
   53.27 +/* "acpi=strict": Disables out-of-spec workarounds.                 */
   53.28 +/* "acpi=ht":     Limit ACPI just to boot-time to enable HT.        */
   53.29 +/* "acpi=noirq":  Disables ACPI interrupt routing.                  */
   53.30 +static void parse_acpi_param(char *s);
   53.31 +custom_param("acpi", parse_acpi_param);
   53.32 +
   53.33 +/* **** Linux config option: propagated to domain0. */
   53.34 +/* acpi_skip_timer_override: Skip IRQ0 overrides. */
   53.35 +extern int acpi_skip_timer_override;
   53.36 +boolean_param("acpi_skip_timer_override", acpi_skip_timer_override);
   53.37 +
   53.38 +/* **** Linux config option: propagated to domain0. */
   53.39 +/* noapic: Disable IOAPIC setup. */
   53.40 +extern int skip_ioapic_setup;
   53.41 +boolean_param("noapic", skip_ioapic_setup);
   53.42 +
   53.43  int early_boot = 1;
   53.44  
   53.45  unsigned long xenheap_phys_end;
   53.46 @@ -62,7 +68,6 @@ extern void ac_timer_init(void);
   53.47  extern void initialize_keytable();
   53.48  extern int do_timer_lists_from_pit;
   53.49  
   53.50 -char ignore_irq13; /* set if exception 16 works */
   53.51  struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
   53.52  
   53.53  #if defined(__x86_64__)
   53.54 @@ -328,6 +333,41 @@ void __init cpu_init(void)
   53.55      init_idle_task();
   53.56  }
   53.57  
   53.58 +int acpi_force;
   53.59 +char acpi_param[10] = "";
   53.60 +static void parse_acpi_param(char *s)
   53.61 +{
   53.62 +    /* Save the parameter so it can be propagated to domain0. */
   53.63 +    strncpy(acpi_param, s, sizeof(acpi_param));
   53.64 +    acpi_param[sizeof(acpi_param)-1] = '\0';
   53.65 +
   53.66 +    /* Interpret the parameter for use within Xen. */
   53.67 +    if ( !strcmp(s, "off") )
   53.68 +    {
   53.69 +        disable_acpi();
   53.70 +    }
   53.71 +    else if ( !strcmp(s, "force") )
   53.72 +    {
   53.73 +        acpi_force = 1;
   53.74 +        acpi_ht = 1;
   53.75 +        acpi_disabled = 0;
   53.76 +    }
   53.77 +    else if ( !strcmp(s, "strict") )
   53.78 +    {
   53.79 +        acpi_strict = 1;
   53.80 +    }
   53.81 +    else if ( !strcmp(s, "ht") )
   53.82 +    {
   53.83 +        if ( !acpi_force )
   53.84 +            disable_acpi();
   53.85 +        acpi_ht = 1;
   53.86 +    }
   53.87 +    else if ( !strcmp(s, "noirq") )
   53.88 +    {
   53.89 +        acpi_noirq_set();
   53.90 +    }
   53.91 +}
   53.92 +
   53.93  static void __init do_initcalls(void)
   53.94  {
   53.95      initcall_t *call;
   53.96 @@ -355,54 +395,36 @@ static void __init start_of_day(void)
   53.97      identify_cpu(&boot_cpu_data); /* get CPU type info */
   53.98      if ( cpu_has_fxsr ) set_in_cr4(X86_CR4_OSFXSR);
   53.99      if ( cpu_has_xmm )  set_in_cr4(X86_CR4_OSXMMEXCPT);
  53.100 -#ifdef CONFIG_SMP
  53.101 -    if ( opt_ignorebiostables )
  53.102 -    {
  53.103 -        opt_nosmp  = 1;           /* No SMP without configuration          */
  53.104 -        opt_noacpi = 1;           /* ACPI will just confuse matters also   */
  53.105 -    }
  53.106 -    else
  53.107 -    {
  53.108 -        find_smp_config();
  53.109 -        smp_alloc_memory();       /* trampoline which other CPUs jump at   */
  53.110 -    }
  53.111 -#endif
  53.112 -    paging_init();                /* not much here now, but sets up fixmap */
  53.113 -    if ( !opt_noacpi )
  53.114 -    {
  53.115 -        acpi_boot_table_init();
  53.116 -        acpi_boot_init();
  53.117 -    }
  53.118 -#ifdef CONFIG_SMP
  53.119 +
  53.120 +    find_smp_config();
  53.121 +
  53.122 +    smp_alloc_memory();
  53.123 +
  53.124 +    paging_init();
  53.125 +
  53.126 +    acpi_boot_table_init();
  53.127 +    acpi_boot_init();
  53.128 +
  53.129      if ( smp_found_config ) 
  53.130          get_smp_config();
  53.131 -#endif
  53.132 -    init_apic_mappings(); /* make APICs addressable in our pagetables. */
  53.133 +
  53.134 +    init_apic_mappings();
  53.135 +
  53.136      scheduler_init();	
  53.137 -    init_IRQ();  /* installs simple interrupt wrappers. Starts HZ clock. */
  53.138 +
  53.139 +    init_IRQ();
  53.140 +
  53.141      trap_init();
  53.142 -    time_init(); /* installs software handler for HZ clock. */
  53.143 +
  53.144 +    time_init();
  53.145  
  53.146      arch_init_memory();
  53.147  
  53.148 -#ifndef CONFIG_SMP    
  53.149 -    APIC_init_uniprocessor();
  53.150 -#else
  53.151 -    if ( opt_nosmp )
  53.152 -        APIC_init_uniprocessor();
  53.153 -    else
  53.154 -    	smp_boot_cpus(); 
  53.155 -    /*
  53.156 -     * Does loads of stuff, including kicking the local
  53.157 -     * APIC, and the IO APIC after other CPUs are booted.
  53.158 -     * Each IRQ is preferably handled by IO-APIC, but
  53.159 -     * fall thru to 8259A if we have to (but slower).
  53.160 -     */
  53.161 -#endif
  53.162 +    smp_boot_cpus();
  53.163  
  53.164      __sti();
  53.165  
  53.166 -    initialize_keytable(); /* call back handling for key codes */
  53.167 +    initialize_keytable();
  53.168  
  53.169      serial_init_stage2();
  53.170  
  53.171 @@ -419,19 +441,14 @@ static void __init start_of_day(void)
  53.172  
  53.173      check_nmi_watchdog();
  53.174  
  53.175 -#ifdef CONFIG_PCI
  53.176 -    pci_init();
  53.177 -#endif
  53.178      do_initcalls();
  53.179  
  53.180 -#ifdef CONFIG_SMP
  53.181      wait_init_idle = cpu_online_map;
  53.182      clear_bit(smp_processor_id(), &wait_init_idle);
  53.183      smp_threads_ready = 1;
  53.184      smp_commence(); /* Tell other CPUs that state of the world is stable. */
  53.185      while ( wait_init_idle != 0 )
  53.186          cpu_relax();
  53.187 -#endif
  53.188  
  53.189      watchdog_on = 1;
  53.190  #ifdef __x86_64__ /* x86_32 uses low mappings when building DOM0. */
  53.191 @@ -570,15 +587,34 @@ void __init __start_xen(multiboot_info_t
  53.192      if ( dom0 == NULL )
  53.193          panic("Error creating domain 0\n");
  53.194  
  53.195 -    set_bit(DF_PRIVILEGED, &dom0->flags);
  53.196 +    set_bit(_DOMF_privileged, &dom0->domain_flags);
  53.197  
  53.198 -    /* Grab the DOM0 command line. Skip past the image name. */
  53.199 +    /* Grab the DOM0 command line. */
  53.200      cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
  53.201      if ( cmdline != NULL )
  53.202      {
  53.203 +        static char dom0_cmdline[256];
  53.204 +
  53.205 +        /* Skip past the image name. */
  53.206          while ( *cmdline == ' ' ) cmdline++;
  53.207          if ( (cmdline = strchr(cmdline, ' ')) != NULL )
  53.208              while ( *cmdline == ' ' ) cmdline++;
  53.209 +
  53.210 +        /* Copy the command line to a local buffer. */
  53.211 +        strcpy(dom0_cmdline, cmdline);
  53.212 +        cmdline = dom0_cmdline;
  53.213 +
  53.214 +        /* Append any extra parameters. */
  53.215 +        if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
  53.216 +            strcat(cmdline, " noapic");
  53.217 +        if ( acpi_skip_timer_override &&
  53.218 +             !strstr(cmdline, "acpi_skip_timer_override") )
  53.219 +            strcat(cmdline, " acpi_skip_timer_override");
  53.220 +        if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
  53.221 +        {
  53.222 +            strcat(cmdline, " acpi=");
  53.223 +            strcat(cmdline, acpi_param);
  53.224 +        }
  53.225      }
  53.226  
  53.227      /*
    54.1 --- a/xen/arch/x86/shadow.c	Wed May 11 13:43:50 2005 +0000
    54.2 +++ b/xen/arch/x86/shadow.c	Fri May 13 14:30:20 2005 +0000
    54.3 @@ -117,7 +117,7 @@ shadow_promote(struct domain *d, unsigne
    54.4      {
    54.5          printk("shadow_promote: get_page_type failed "
    54.6                 "dom%d gpfn=%lx gmfn=%lx t=%08lx\n",
    54.7 -               d->id, gpfn, gmfn, new_type);
    54.8 +               d->domain_id, gpfn, gmfn, new_type);
    54.9          okay = 0;
   54.10      }
   54.11  
   54.12 @@ -233,7 +233,7 @@ alloc_shadow_page(struct domain *d,
   54.13      if ( unlikely(page == NULL) )
   54.14      {
   54.15          printk("Couldn't alloc shadow page! dom%d count=%d\n",
   54.16 -               d->id, d->arch.shadow_page_count);
   54.17 +               d->domain_id, d->arch.shadow_page_count);
   54.18          printk("Shadow table counts: l1=%d l2=%d hl2=%d snapshot=%d\n",
   54.19                 perfc_value(shadow_l1_pages), 
   54.20                 perfc_value(shadow_l2_pages),
   54.21 @@ -1179,7 +1179,8 @@ void __shadow_mode_disable(struct domain
   54.22       * Currently this does not fix up page ref counts, so it is valid to call
   54.23       * only when a domain is being destroyed.
   54.24       */
   54.25 -    BUG_ON(!test_bit(DF_DYING, &d->flags) && shadow_mode_refcounts(d));
   54.26 +    BUG_ON(!test_bit(_DOMF_dying, &d->domain_flags) &&
   54.27 +           shadow_mode_refcounts(d));
   54.28      d->arch.shadow_tainted_refcnts = shadow_mode_refcounts(d);
   54.29  
   54.30      free_shadow_pages(d);
   54.31 @@ -1217,7 +1218,7 @@ static int shadow_mode_table_op(
   54.32      int               i, rc = 0;
   54.33      struct exec_domain *ed;
   54.34  
   54.35 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
   54.36 +    ASSERT(shadow_lock_is_acquired(d));
   54.37  
   54.38      SH_VLOG("shadow mode table op %lx %lx count %d",
   54.39              pagetable_val(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
   54.40 @@ -1409,7 +1410,7 @@ gpfn_to_mfn_foreign(struct domain *d, un
   54.41      if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   54.42      {
   54.43          printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l2e=%lx\n",
   54.44 -               d->id, gpfn, l2e_get_value(l2e));
   54.45 +               d->domain_id, gpfn, l2e_get_value(l2e));
   54.46          return INVALID_MFN;
   54.47      }
   54.48      unsigned long l1tab = l2e_get_phys(l2e);
   54.49 @@ -1419,13 +1420,13 @@ gpfn_to_mfn_foreign(struct domain *d, un
   54.50  
   54.51  #if 0
   54.52      printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => %lx phystab=%lx l2e=%lx l1tab=%lx, l1e=%lx\n",
   54.53 -           d->id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, phystab, l2e, l1tab, l1e);
   54.54 +           d->domain_id, gpfn, l1_pgentry_val(l1e) >> PAGE_SHIFT, phystab, l2e, l1tab, l1e);
   54.55  #endif
   54.56  
   54.57      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
   54.58      {
   54.59          printk("gpfn_to_mfn_foreign(d->id=%d, gpfn=%lx) => 0 l1e=%lx\n",
   54.60 -               d->id, gpfn, l1e_get_value(l1e));
   54.61 +               d->domain_id, gpfn, l1e_get_value(l1e));
   54.62          return INVALID_MFN;
   54.63      }
   54.64  
   54.65 @@ -1754,7 +1755,7 @@ shadow_make_snapshot(
   54.66      {
   54.67          printk("Couldn't alloc fullshadow snapshot for pfn=%lx mfn=%lx!\n"
   54.68                 "Dom%d snapshot_count_count=%d\n",
   54.69 -               gpfn, gmfn, d->id, d->arch.snapshot_page_count);
   54.70 +               gpfn, gmfn, d->domain_id, d->arch.snapshot_page_count);
   54.71          BUG(); /* XXX FIXME: try a shadow flush to free up some memory. */
   54.72      }
   54.73  
   54.74 @@ -1813,7 +1814,7 @@ shadow_mark_mfn_out_of_sync(struct exec_
   54.75      struct pfn_info *page = &frame_table[mfn];
   54.76      struct out_of_sync_entry *entry = shadow_alloc_oos_entry(d);
   54.77  
   54.78 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
   54.79 +    ASSERT(shadow_lock_is_acquired(d));
   54.80      ASSERT(pfn_valid(mfn));
   54.81  
   54.82  #ifndef NDEBUG
   54.83 @@ -1943,7 +1944,7 @@ int __shadow_out_of_sync(struct exec_dom
   54.84      l2_pgentry_t l2e;
   54.85      unsigned long l1pfn, l1mfn;
   54.86  
   54.87 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
   54.88 +    ASSERT(shadow_lock_is_acquired(d));
   54.89      ASSERT(VALID_M2P(l2pfn));
   54.90  
   54.91      perfc_incrc(shadow_out_of_sync_calls);
   54.92 @@ -2127,7 +2128,7 @@ int shadow_remove_all_write_access(
   54.93      u32 found = 0, fixups, write_refs;
   54.94      unsigned long prediction, predicted_gpfn, predicted_smfn;
   54.95  
   54.96 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
   54.97 +    ASSERT(shadow_lock_is_acquired(d));
   54.98      ASSERT(VALID_MFN(readonly_gmfn));
   54.99  
  54.100      perfc_incrc(remove_write_access);
  54.101 @@ -2245,7 +2246,7 @@ u32 shadow_remove_all_access(struct doma
  54.102      if ( unlikely(!shadow_mode_enabled(d)) )
  54.103          return 0;
  54.104  
  54.105 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  54.106 +    ASSERT(shadow_lock_is_acquired(d));
  54.107      perfc_incrc(remove_all_access);
  54.108  
  54.109      for (i = 0; i < shadow_ht_buckets; i++)
  54.110 @@ -2287,7 +2288,7 @@ static int resync_all(struct domain *d, 
  54.111      int unshadow;
  54.112      int changed;
  54.113  
  54.114 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  54.115 +    ASSERT(shadow_lock_is_acquired(d));
  54.116  
  54.117      for ( entry = d->arch.out_of_sync; entry; entry = entry->next)
  54.118      {
  54.119 @@ -2485,7 +2486,7 @@ void __shadow_sync_all(struct domain *d)
  54.120  
  54.121      perfc_incrc(shadow_sync_all);
  54.122  
  54.123 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  54.124 +    ASSERT(shadow_lock_is_acquired(d));
  54.125  
  54.126      // First, remove all write permissions to the page tables
  54.127      //
  54.128 @@ -2645,7 +2646,7 @@ int shadow_fault(unsigned long va, struc
  54.129          {
  54.130              printk("%s() failed, crashing domain %d "
  54.131                     "due to a read-only L2 page table (gpde=%lx), va=%lx\n",
  54.132 -                   __func__, d->id, l2e_get_value(gpde), va);
  54.133 +                   __func__, d->domain_id, l2e_get_value(gpde), va);
  54.134              domain_crash_synchronous();
  54.135          }
  54.136  
  54.137 @@ -3146,7 +3147,7 @@ int check_l2_table(
  54.138          FAILPT("bogus owner for snapshot page");
  54.139      if ( page_get_owner(pfn_to_page(smfn)) != NULL )
  54.140          FAILPT("shadow page mfn=0x%lx is owned by someone, domid=%d",
  54.141 -               smfn, page_get_owner(pfn_to_page(smfn))->id);
  54.142 +               smfn, page_get_owner(pfn_to_page(smfn))->domain_id);
  54.143  
  54.144  #if 0
  54.145      if ( memcmp(&spl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
  54.146 @@ -3307,7 +3308,7 @@ int _check_all_pagetables(struct exec_do
  54.147      shadow_status_noswap = 1;
  54.148  
  54.149      sh_check_name = s;
  54.150 -    SH_VVLOG("%s-PT Audit domid=%d", s, d->id);
  54.151 +    SH_VVLOG("%s-PT Audit domid=%d", s, d->domain_id);
  54.152      sh_l2_present = sh_l1_present = 0;
  54.153      perfc_incrc(check_all_pagetables);
  54.154  
    55.1 --- a/xen/arch/x86/smpboot.c	Wed May 11 13:43:50 2005 +0000
    55.2 +++ b/xen/arch/x86/smpboot.c	Fri May 13 14:30:20 2005 +0000
    55.3 @@ -51,8 +51,11 @@
    55.4  #include <mach_apic.h>
    55.5  #include <mach_wakecpu.h>
    55.6  
    55.7 -/* Cconfigured maximum number of CPUs to activate. We name the parameter 
    55.8 -"maxcpus" rather than max_cpus to be compatible with Linux */
    55.9 +/* opt_nosmp: If true, secondary processors are ignored. */
   55.10 +static int opt_nosmp = 0;
   55.11 +boolean_param("nosmp", opt_nosmp);
   55.12 +
   55.13 +/* maxcpus: maximum number of CPUs to activate. */
   55.14  static int max_cpus = -1;
   55.15  integer_param("maxcpus", max_cpus); 
   55.16  
   55.17 @@ -658,7 +661,7 @@ static void __init do_boot_cpu (int apic
   55.18  
   55.19      ed = idle->exec_domain[0];
   55.20  
   55.21 -    set_bit(DF_IDLETASK, &idle->flags);
   55.22 +    set_bit(_DOMF_idle_domain, &idle->domain_flags);
   55.23  
   55.24      ed->arch.monitor_table = mk_pagetable(__pa(idle_pg_table));
   55.25  
   55.26 @@ -797,8 +800,7 @@ void __init smp_boot_cpus(void)
   55.27       * If we couldnt find an SMP configuration at boot time,
   55.28       * get out of here now!
   55.29       */
   55.30 -    if (!smp_found_config) {
   55.31 -        printk("SMP motherboard not detected.\n");
   55.32 +    if (!smp_found_config || opt_nosmp) {
   55.33          io_apic_irqs = 0;
   55.34          phys_cpu_present_map = physid_mask_of_physid(0);
   55.35          cpu_online_map = 1;
    56.1 --- a/xen/arch/x86/traps.c	Wed May 11 13:43:50 2005 +0000
    56.2 +++ b/xen/arch/x86/traps.c	Fri May 13 14:30:20 2005 +0000
    56.3 @@ -152,7 +152,7 @@ static inline int do_trap(int trapnr, ch
    56.4  
    56.5  #ifndef NDEBUG
    56.6      if ( (ed->arch.guest_context.trap_ctxt[trapnr].address == 0) &&
    56.7 -         (ed->domain->id == 0) )
    56.8 +         (ed->domain->domain_id == 0) )
    56.9          goto xen_fault;
   56.10  #endif
   56.11  
   56.12 @@ -326,7 +326,7 @@ asmlinkage int do_page_fault(struct cpu_
   56.13  
   56.14  #ifndef NDEBUG
   56.15      if ( (ed->arch.guest_context.trap_ctxt[TRAP_page_fault].address == 0) &&
   56.16 -         (d->id == 0) )
   56.17 +         (d->domain_id == 0) )
   56.18          goto xen_fault;
   56.19  #endif
   56.20  
   56.21 @@ -361,13 +361,13 @@ long do_fpu_taskswitch(int set)
   56.22  
   56.23      if ( set )
   56.24      {
   56.25 -        set_bit(EDF_GUEST_STTS, &ed->flags);
   56.26 +        set_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
   56.27          stts();
   56.28      }
   56.29      else
   56.30      {
   56.31 -        clear_bit(EDF_GUEST_STTS, &ed->flags);
   56.32 -        if ( test_bit(EDF_USEDFPU, &ed->flags) )
   56.33 +        clear_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
   56.34 +        if ( test_bit(_VCPUF_fpu_dirtied, &ed->vcpu_flags) )
   56.35              clts();
   56.36      }
   56.37  
   56.38 @@ -433,10 +433,19 @@ static inline int admin_io_okay(
   56.39  #define outl_user(_v, _p, _d, _r) \
   56.40      (admin_io_okay(_p, 4, _d, _r) ? outl(_v, _p) : ((void)0))
   56.41  
   56.42 +/* Propagate a fault back to the guest kernel. */
   56.43 +#define USER_READ_FAULT  4 /* user mode, read fault */
   56.44 +#define USER_WRITE_FAULT 6 /* user mode, write fault */
   56.45 +#define PAGE_FAULT(_faultaddr, _errcode)        \
   56.46 +({  propagate_page_fault(_faultaddr, _errcode); \
   56.47 +    return EXCRET_fault_fixed;                  \
   56.48 +})
   56.49 +
   56.50 +/* Isntruction fetch with error handling. */
   56.51  #define insn_fetch(_type, _size, _ptr)          \
   56.52  ({  unsigned long _x;                           \
   56.53      if ( get_user(_x, (_type *)eip) )           \
   56.54 -        goto read_fault;                        \
   56.55 +        PAGE_FAULT(eip, USER_READ_FAULT);       \
   56.56      eip += _size; (_type)_x; })
   56.57  
   56.58  static int emulate_privileged_op(struct cpu_user_regs *regs)
   56.59 @@ -502,17 +511,17 @@ static int emulate_privileged_op(struct 
   56.60              case 1:
   56.61                  data = (u8)inb_user((u16)regs->edx, ed, regs);
   56.62                  if ( put_user((u8)data, (u8 *)regs->edi) )
   56.63 -                    goto write_fault;
   56.64 +                    PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
   56.65                  break;
   56.66              case 2:
   56.67                  data = (u16)inw_user((u16)regs->edx, ed, regs);
   56.68                  if ( put_user((u16)data, (u16 *)regs->edi) )
   56.69 -                    goto write_fault;
   56.70 +                    PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
   56.71                  break;
   56.72              case 4:
   56.73                  data = (u32)inl_user((u16)regs->edx, ed, regs);
   56.74                  if ( put_user((u32)data, (u32 *)regs->edi) )
   56.75 -                    goto write_fault;
   56.76 +                    PAGE_FAULT(regs->edi, USER_WRITE_FAULT);
   56.77                  break;
   56.78              }
   56.79              regs->edi += (regs->eflags & EF_DF) ? -op_bytes : op_bytes;
   56.80 @@ -527,17 +536,17 @@ static int emulate_privileged_op(struct 
   56.81              {
   56.82              case 1:
   56.83                  if ( get_user(data, (u8 *)regs->esi) )
   56.84 -                    goto read_fault;
   56.85 +                    PAGE_FAULT(regs->esi, USER_READ_FAULT);
   56.86                  outb_user((u8)data, (u16)regs->edx, ed, regs);
   56.87                  break;
   56.88              case 2:
   56.89                  if ( get_user(data, (u16 *)regs->esi) )
   56.90 -                    goto read_fault;
   56.91 +                    PAGE_FAULT(regs->esi, USER_READ_FAULT);
   56.92                  outw_user((u16)data, (u16)regs->edx, ed, regs);
   56.93                  break;
   56.94              case 4:
   56.95                  if ( get_user(data, (u32 *)regs->esi) )
   56.96 -                    goto read_fault;
   56.97 +                    PAGE_FAULT(regs->esi, USER_READ_FAULT);
   56.98                  outl_user((u32)data, (u16)regs->edx, ed, regs);
   56.99                  break;
  56.100              }
  56.101 @@ -665,7 +674,7 @@ static int emulate_privileged_op(struct 
  56.102          case 0: /* Read CR0 */
  56.103              *reg = 
  56.104                  (read_cr0() & ~X86_CR0_TS) | 
  56.105 -                (test_bit(EDF_GUEST_STTS, &ed->flags) ? X86_CR0_TS : 0);
  56.106 +                (test_bit(_VCPUF_guest_stts, &ed->vcpu_flags) ? X86_CR0_TS:0);
  56.107              break;
  56.108  
  56.109          case 2: /* Read CR2 */
  56.110 @@ -736,14 +745,6 @@ static int emulate_privileged_op(struct 
  56.111  
  56.112   fail:
  56.113      return 0;
  56.114 -
  56.115 - read_fault:
  56.116 -    propagate_page_fault(eip, 4); /* user mode, read fault */
  56.117 -    return EXCRET_fault_fixed;
  56.118 -
  56.119 - write_fault:
  56.120 -    propagate_page_fault(eip, 6); /* user mode, write fault */
  56.121 -    return EXCRET_fault_fixed;
  56.122  }
  56.123  
  56.124  asmlinkage int do_general_protection(struct cpu_user_regs *regs)
  56.125 @@ -807,7 +808,7 @@ asmlinkage int do_general_protection(str
  56.126  
  56.127  #ifndef NDEBUG
  56.128      if ( (ed->arch.guest_context.trap_ctxt[TRAP_gp_fault].address == 0) &&
  56.129 -         (ed->domain->id == 0) )
  56.130 +         (ed->domain->domain_id == 0) )
  56.131          goto gp_in_kernel;
  56.132  #endif
  56.133  
  56.134 @@ -919,15 +920,9 @@ asmlinkage int math_state_restore(struct
  56.135      /* Prevent recursion. */
  56.136      clts();
  56.137  
  56.138 -    if ( !test_and_set_bit(EDF_USEDFPU, &current->flags) )
  56.139 -    {
  56.140 -        if ( test_bit(EDF_DONEFPUINIT, &current->flags) )
  56.141 -            restore_fpu(current);
  56.142 -        else
  56.143 -            init_fpu();
  56.144 -    }
  56.145 +    setup_fpu(current);
  56.146  
  56.147 -    if ( test_and_clear_bit(EDF_GUEST_STTS, &current->flags) )
  56.148 +    if ( test_and_clear_bit(_VCPUF_guest_stts, &current->vcpu_flags) )
  56.149      {
  56.150          struct trap_bounce *tb = &current->arch.trap_bounce;
  56.151          tb->flags = TBF_EXCEPTION;
    57.1 --- a/xen/arch/x86/vmx.c	Wed May 11 13:43:50 2005 +0000
    57.2 +++ b/xen/arch/x86/vmx.c	Fri May 13 14:30:20 2005 +0000
    57.3 @@ -154,6 +154,21 @@ static int vmx_do_page_fault(unsigned lo
    57.4      return result;
    57.5  }
    57.6  
    57.7 +static void vmx_do_no_device_fault() 
    57.8 +{
    57.9 +    unsigned long cr0;
   57.10 +        
   57.11 +    clts();
   57.12 +    setup_fpu(current);
   57.13 +    __vmread(CR0_READ_SHADOW, &cr0);
   57.14 +    if (!(cr0 & X86_CR0_TS)) {
   57.15 +        __vmread(GUEST_CR0, &cr0);
   57.16 +        cr0 &= ~X86_CR0_TS;
   57.17 +        __vmwrite(GUEST_CR0, cr0);
   57.18 +    }
   57.19 +    __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP);
   57.20 +}
   57.21 +
   57.22  static void vmx_do_general_protection_fault(struct cpu_user_regs *regs) 
   57.23  {
   57.24      unsigned long eip, error_code;
   57.25 @@ -894,6 +909,9 @@ static int vmx_cr_access(unsigned long e
   57.26          mov_from_cr(cr, gp, regs);
   57.27          break;
   57.28      case TYPE_CLTS:
   57.29 +        clts();
   57.30 +        setup_fpu(current);
   57.31 +
   57.32          __vmread(GUEST_CR0, &value);
   57.33          value &= ~X86_CR0_TS; /* clear TS */
   57.34          __vmwrite(GUEST_CR0, value);
   57.35 @@ -966,7 +984,7 @@ static void vmx_print_line(const char c,
   57.36              print_buf[index++] = c;
   57.37          }
   57.38          print_buf[index] = '\0';
   57.39 -        printk("(GUEST: %u) %s\n", d->domain->id, (char *) &print_buf);
   57.40 +        printk("(GUEST: %u) %s\n", d->domain->domain_id, (char *) &print_buf);
   57.41          index = 0;
   57.42      }
   57.43      else
   57.44 @@ -1054,7 +1072,7 @@ asmlinkage void vmx_vmexit_handler(struc
   57.45      }
   57.46  
   57.47      __vmread(GUEST_EIP, &eip);
   57.48 -    TRACE_3D(TRC_VMX_VMEXIT, ed->domain->id, eip, exit_reason);
   57.49 +    TRACE_3D(TRC_VMX_VMEXIT, ed->domain->domain_id, eip, exit_reason);
   57.50  
   57.51      switch (exit_reason) {
   57.52      case EXIT_REASON_EXCEPTION_NMI:
   57.53 @@ -1075,7 +1093,7 @@ asmlinkage void vmx_vmexit_handler(struc
   57.54  
   57.55          perfc_incra(cause_vector, vector);
   57.56  
   57.57 -        TRACE_3D(TRC_VMX_VECTOR, ed->domain->id, eip, vector);
   57.58 +        TRACE_3D(TRC_VMX_VECTOR, ed->domain->domain_id, eip, vector);
   57.59          switch (vector) {
   57.60  #ifdef XEN_DEBUGGER
   57.61          case TRAP_debug:
   57.62 @@ -1093,6 +1111,11 @@ asmlinkage void vmx_vmexit_handler(struc
   57.63              break;
   57.64          }
   57.65  #endif
   57.66 +        case TRAP_no_device:
   57.67 +        {
   57.68 +            vmx_do_no_device_fault();
   57.69 +            break;  
   57.70 +        }
   57.71          case TRAP_gp_fault:
   57.72          {
   57.73              vmx_do_general_protection_fault(&regs);
   57.74 @@ -1122,7 +1145,7 @@ asmlinkage void vmx_vmexit_handler(struc
   57.75                  __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
   57.76                  __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, regs.error_code);
   57.77                  ed->arch.arch_vmx.cpu_cr2 = va;
   57.78 -                TRACE_3D(TRC_VMX_INT, ed->domain->id, TRAP_page_fault, va);
   57.79 +                TRACE_3D(TRC_VMX_INT, ed->domain->domain_id, TRAP_page_fault, va);
   57.80              }
   57.81              break;
   57.82          }
    58.1 --- a/xen/arch/x86/vmx_io.c	Wed May 11 13:43:50 2005 +0000
    58.2 +++ b/xen/arch/x86/vmx_io.c	Fri May 13 14:30:20 2005 +0000
    58.3 @@ -429,6 +429,7 @@ void vmx_intr_assist(struct exec_domain 
    58.4  
    58.5  void vmx_do_resume(struct exec_domain *d) 
    58.6  {
    58.7 +    vmx_stts();
    58.8      if ( test_bit(VMX_CPU_STATE_PG_ENABLED, &d->arch.arch_vmx.cpu_state) )
    58.9          __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table));
   58.10      else
    59.1 --- a/xen/arch/x86/vmx_vmcs.c	Wed May 11 13:43:50 2005 +0000
    59.2 +++ b/xen/arch/x86/vmx_vmcs.c	Fri May 13 14:30:20 2005 +0000
    59.3 @@ -164,6 +164,9 @@ void vmx_do_launch(struct exec_domain *e
    59.4      struct pfn_info *page;
    59.5      struct cpu_user_regs *regs = get_cpu_user_regs();
    59.6  
    59.7 +    vmx_stts();
    59.8 +    set_bit(_VCPUF_guest_stts, &ed->vcpu_flags);
    59.9 +
   59.10      cpu = smp_processor_id();
   59.11  
   59.12      page = (struct pfn_info *) alloc_domheap_page(NULL);
    60.1 --- a/xen/common/dom0_ops.c	Wed May 11 13:43:50 2005 +0000
    60.2 +++ b/xen/common/dom0_ops.c	Fri May 13 14:30:20 2005 +0000
    60.3 @@ -139,7 +139,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    60.4          {
    60.5              ret = -EINVAL;
    60.6              if ( (d != current->domain) && 
    60.7 -                 test_bit(DF_CONSTRUCTED, &d->flags) )
    60.8 +                 test_bit(_DOMF_constructed, &d->domain_flags) )
    60.9              {
   60.10                  domain_unpause_by_systemcontroller(d);
   60.11                  ret = 0;
   60.12 @@ -194,7 +194,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   60.13  
   60.14          ret = 0;
   60.15          
   60.16 -        op->u.createdomain.domain = d->id;
   60.17 +        op->u.createdomain.domain = d->domain_id;
   60.18          copy_to_user(u_dom0_op, op, sizeof(*op));
   60.19      }
   60.20      break;
   60.21 @@ -221,7 +221,8 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   60.22          domid_t dom = op->u.pincpudomain.domain;
   60.23          struct domain *d = find_domain_by_id(dom);
   60.24          struct exec_domain *ed;
   60.25 -        int cpu = op->u.pincpudomain.cpu;
   60.26 +        cpumap_t cpumap;
   60.27 +
   60.28  
   60.29          if ( d == NULL )
   60.30          {
   60.31 @@ -229,6 +230,14 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   60.32              break;
   60.33          }
   60.34          
   60.35 +        if ( (op->u.pincpudomain.exec_domain >= MAX_VIRT_CPUS) ||
   60.36 +             !d->exec_domain[op->u.pincpudomain.exec_domain] )
   60.37 +        {
   60.38 +            ret = -EINVAL;
   60.39 +            put_domain(d);
   60.40 +            break;
   60.41 +        }
   60.42 +
   60.43          ed = d->exec_domain[op->u.pincpudomain.exec_domain];
   60.44          if ( ed == NULL )
   60.45          {
   60.46 @@ -244,17 +253,29 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   60.47              break;
   60.48          }
   60.49  
   60.50 -        if ( cpu == -1 )
   60.51 +        if ( copy_from_user(&cpumap, op->u.pincpudomain.cpumap,
   60.52 +                            sizeof(cpumap)) )
   60.53          {
   60.54 -            clear_bit(EDF_CPUPINNED, &ed->flags);
   60.55 +            ret = -EFAULT;
   60.56 +            put_domain(d);
   60.57 +            break;
   60.58          }
   60.59 +
   60.60 +        /* update cpumap for this ed */
   60.61 +        ed->cpumap = cpumap;
   60.62 +
   60.63 +        if ( cpumap == CPUMAP_RUNANYWHERE )
   60.64 +            clear_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
   60.65          else
   60.66          {
   60.67 +            /* pick a new cpu from the usable map */
   60.68 +            int new_cpu = (int)find_first_set_bit(cpumap) % smp_num_cpus;
   60.69 +
   60.70              exec_domain_pause(ed);
   60.71 -            if ( ed->processor != (cpu % smp_num_cpus) )
   60.72 -                set_bit(EDF_MIGRATED, &ed->flags);
   60.73 -            set_bit(EDF_CPUPINNED, &ed->flags);
   60.74 -            ed->processor = cpu % smp_num_cpus;
   60.75 +            if ( ed->processor != new_cpu )
   60.76 +                set_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags);
   60.77 +            set_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
   60.78 +            ed->processor = new_cpu;
   60.79              exec_domain_unpause(ed);
   60.80          }
   60.81  
   60.82 @@ -278,15 +299,17 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
   60.83  
   60.84      case DOM0_GETDOMAININFO:
   60.85      { 
   60.86 -        struct vcpu_guest_context *c;
   60.87 -        struct domain            *d;
   60.88 -        struct exec_domain       *ed;
   60.89 +        struct domain             *d;
   60.90 +        struct exec_domain        *ed;
   60.91 +        u64 cpu_time = 0;
   60.92 +        int vcpu_count = 0;
   60.93 +        int flags = DOMFLAGS_PAUSED | DOMFLAGS_BLOCKED;
   60.94  
   60.95          read_lock(&domlist_lock);
   60.96  
   60.97          for_each_domain ( d )
   60.98          {
   60.99 -            if ( d->id >= op->u.getdomaininfo.domain )
  60.100 +            if ( d->domain_id >= op->u.getdomaininfo.domain )
  60.101                  break;
  60.102          }
  60.103  
  60.104 @@ -299,36 +322,84 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
  60.105  
  60.106          read_unlock(&domlist_lock);
  60.107  
  60.108 -        op->u.getdomaininfo.domain = d->id;
  60.109 +        op->u.getdomaininfo.domain = d->domain_id;
  60.110  
  60.111 -        if ( (op->u.getdomaininfo.exec_domain >= MAX_VIRT_CPUS) ||
  60.112 -             !d->exec_domain[op->u.getdomaininfo.exec_domain] )
  60.113 -        {
  60.114 -            ret = -EINVAL;
  60.115 -            break;
  60.116 +        memset(&op->u.getdomaininfo.vcpu_to_cpu, -1,
  60.117 +               sizeof(op->u.getdomaininfo.vcpu_to_cpu));
  60.118 +        memset(&op->u.getdomaininfo.cpumap, 0,
  60.119 +               sizeof(op->u.getdomaininfo.cpumap));
  60.120 +
  60.121 +        /* 
  60.122 +         * - domain is marked as paused or blocked only if all its vcpus 
  60.123 +         *   are paused or blocked 
  60.124 +         * - domain is marked as running if any of its vcpus is running
  60.125 +         */
  60.126 +        for_each_exec_domain ( d, ed ) {
  60.127 +            op->u.getdomaininfo.vcpu_to_cpu[ed->vcpu_id] = ed->processor;
  60.128 +            op->u.getdomaininfo.cpumap[ed->vcpu_id]      = ed->cpumap;
  60.129 +            if ( !(ed->vcpu_flags & VCPUF_ctrl_pause) )
  60.130 +                flags &= ~DOMFLAGS_PAUSED;
  60.131 +            if ( !(ed->vcpu_flags & VCPUF_blocked) )
  60.132 +                flags &= ~DOMFLAGS_BLOCKED;
  60.133 +            if ( ed->vcpu_flags & VCPUF_running )
  60.134 +                flags |= DOMFLAGS_RUNNING;
  60.135 +            if ( ed->cpu_time > cpu_time )
  60.136 +                cpu_time += ed->cpu_time;
  60.137 +            vcpu_count++;
  60.138          }
  60.139 -        
  60.140 -        ed = d->exec_domain[op->u.getdomaininfo.exec_domain];
  60.141  
  60.142 -        op->u.getdomaininfo.flags =
  60.143 -            (test_bit( DF_DYING,      &d->flags)  ? DOMFLAGS_DYING    : 0) |
  60.144 -            (test_bit( DF_CRASHED,    &d->flags)  ? DOMFLAGS_CRASHED  : 0) |
  60.145 -            (test_bit( DF_SHUTDOWN,   &d->flags)  ? DOMFLAGS_SHUTDOWN : 0) |
  60.146 -            (test_bit(EDF_CTRLPAUSE, &ed->flags) ? DOMFLAGS_PAUSED   : 0) |
  60.147 -            (test_bit(EDF_BLOCKED,   &ed->flags) ? DOMFLAGS_BLOCKED  : 0) |
  60.148 -            (test_bit(EDF_RUNNING,   &ed->flags) ? DOMFLAGS_RUNNING  : 0);
  60.149 +        op->u.getdomaininfo.cpu_time = cpu_time;
  60.150 +        op->u.getdomaininfo.n_vcpu = vcpu_count;
  60.151  
  60.152 -        op->u.getdomaininfo.flags |= ed->processor << DOMFLAGS_CPUSHIFT;
  60.153 -        op->u.getdomaininfo.flags |= 
  60.154 +        op->u.getdomaininfo.flags = flags |
  60.155 +            ((d->domain_flags & DOMF_dying)    ? DOMFLAGS_DYING    : 0) |
  60.156 +            ((d->domain_flags & DOMF_crashed)  ? DOMFLAGS_CRASHED  : 0) |
  60.157 +            ((d->domain_flags & DOMF_shutdown) ? DOMFLAGS_SHUTDOWN : 0) |
  60.158              d->shutdown_code << DOMFLAGS_SHUTDOWNSHIFT;
  60.159  
  60.160          op->u.getdomaininfo.tot_pages   = d->tot_pages;
  60.161          op->u.getdomaininfo.max_pages   = d->max_pages;
  60.162 -        op->u.getdomaininfo.cpu_time    = ed->cpu_time;
  60.163          op->u.getdomaininfo.shared_info_frame = 
  60.164              __pa(d->shared_info) >> PAGE_SHIFT;
  60.165  
  60.166 -        if ( op->u.getdomaininfo.ctxt != NULL )
  60.167 +        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
  60.168 +            ret = -EINVAL;
  60.169 +
  60.170 +        put_domain(d);
  60.171 +    }
  60.172 +    break;
  60.173 +
  60.174 +    case DOM0_GETVCPUCONTEXT:
  60.175 +    { 
  60.176 +        struct vcpu_guest_context *c;
  60.177 +        struct domain             *d;
  60.178 +        struct exec_domain        *ed;
  60.179 +
  60.180 +        d = find_domain_by_id(op->u.getvcpucontext.domain);
  60.181 +        if ( d == NULL )
  60.182 +        {
  60.183 +            ret = -ESRCH;
  60.184 +            break;
  60.185 +        }
  60.186 +
  60.187 +        if ( op->u.getvcpucontext.exec_domain >= MAX_VIRT_CPUS )
  60.188 +        {
  60.189 +            ret = -EINVAL;
  60.190 +            put_domain(d);
  60.191 +            break;
  60.192 +        }
  60.193 +        
  60.194 +        ed = d->exec_domain[op->u.getvcpucontext.exec_domain];
  60.195 +        if ( ed == NULL )
  60.196 +        {
  60.197 +            ret = -ESRCH;
  60.198 +            put_domain(d);
  60.199 +            break;
  60.200 +        }
  60.201 +
  60.202 +        op->u.getvcpucontext.cpu_time = ed->cpu_time;
  60.203 +
  60.204 +        if ( op->u.getvcpucontext.ctxt != NULL )
  60.205          {
  60.206              if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
  60.207              {
  60.208 @@ -345,7 +416,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
  60.209              if ( ed != current )
  60.210                  exec_domain_unpause(ed);
  60.211  
  60.212 -            if ( copy_to_user(op->u.getdomaininfo.ctxt, c, sizeof(*c)) )
  60.213 +            if ( copy_to_user(op->u.getvcpucontext.ctxt, c, sizeof(*c)) )
  60.214                  ret = -EINVAL;
  60.215  
  60.216              xfree(c);
    61.1 --- a/xen/common/dom_mem_ops.c	Wed May 11 13:43:50 2005 +0000
    61.2 +++ b/xen/common/dom_mem_ops.c	Fri May 13 14:30:20 2005 +0000
    61.3 @@ -29,7 +29,7 @@
    61.4              __HYPERVISOR_dom_mem_op,                \
    61.5              (_op) | (i << START_EXTENT_SHIFT),      \
    61.6              extent_list, nr_extents, extent_order,  \
    61.7 -            (d == current->domain) ? DOMID_SELF : d->id);
    61.8 +            (d == current->domain) ? DOMID_SELF : d->domain_id);
    61.9  
   61.10  static long
   61.11  alloc_dom_mem(struct domain *d, 
   61.12 @@ -95,14 +95,14 @@ free_dom_mem(struct domain *d,
   61.13              if ( unlikely((mpfn + j) >= max_page) )
   61.14              {
   61.15                  DPRINTK("Domain %u page number out of range (%lx >= %lx)\n", 
   61.16 -                        d->id, mpfn + j, max_page);
   61.17 +                        d->domain_id, mpfn + j, max_page);
   61.18                  return i;
   61.19              }
   61.20              
   61.21              page = &frame_table[mpfn + j];
   61.22              if ( unlikely(!get_page(page, d)) )
   61.23              {
   61.24 -                DPRINTK("Bad page free for domain %u\n", d->id);
   61.25 +                DPRINTK("Bad page free for domain %u\n", d->domain_id);
   61.26                  return i;
   61.27              }
   61.28  
    62.1 --- a/xen/common/domain.c	Wed May 11 13:43:50 2005 +0000
    62.2 +++ b/xen/common/domain.c	Fri May 13 14:30:20 2005 +0000
    62.3 @@ -39,7 +39,7 @@ struct domain *do_createdomain(domid_t d
    62.4      atomic_set(&d->refcnt, 1);
    62.5      atomic_set(&ed->pausecnt, 0);
    62.6  
    62.7 -    d->id          = dom_id;
    62.8 +    d->domain_id   = dom_id;
    62.9      ed->processor  = cpu;
   62.10   
   62.11      spin_lock_init(&d->time_lock);
   62.12 @@ -50,7 +50,7 @@ struct domain *do_createdomain(domid_t d
   62.13      INIT_LIST_HEAD(&d->page_list);
   62.14      INIT_LIST_HEAD(&d->xenpage_list);
   62.15  
   62.16 -    if ( (d->id != IDLE_DOMAIN_ID) &&
   62.17 +    if ( (d->domain_id != IDLE_DOMAIN_ID) &&
   62.18           ((init_event_channels(d) != 0) || (grant_table_create(d) != 0)) )
   62.19      {
   62.20          destroy_event_channels(d);
   62.21 @@ -62,12 +62,12 @@ struct domain *do_createdomain(domid_t d
   62.22      
   62.23      sched_add_domain(ed);
   62.24  
   62.25 -    if ( d->id != IDLE_DOMAIN_ID )
   62.26 +    if ( d->domain_id != IDLE_DOMAIN_ID )
   62.27      {
   62.28          write_lock(&domlist_lock);
   62.29          pd = &domain_list; /* NB. domain_list maintained in order of dom_id. */
   62.30          for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
   62.31 -            if ( (*pd)->id > d->id )
   62.32 +            if ( (*pd)->domain_id > d->domain_id )
   62.33                  break;
   62.34          d->next_in_list = *pd;
   62.35          *pd = d;
   62.36 @@ -88,7 +88,7 @@ struct domain *find_domain_by_id(domid_t
   62.37      d = domain_hash[DOMAIN_HASH(dom)];
   62.38      while ( d != NULL )
   62.39      {
   62.40 -        if ( d->id == dom )
   62.41 +        if ( d->domain_id == dom )
   62.42          {
   62.43              if ( unlikely(!get_domain(d)) )
   62.44                  d = NULL;
   62.45 @@ -107,7 +107,7 @@ void domain_kill(struct domain *d)
   62.46      struct exec_domain *ed;
   62.47  
   62.48      domain_pause(d);
   62.49 -    if ( !test_and_set_bit(DF_DYING, &d->flags) )
   62.50 +    if ( !test_and_set_bit(_DOMF_dying, &d->domain_flags) )
   62.51      {
   62.52          for_each_exec_domain(d, ed)
   62.53              sched_rem_domain(ed);
   62.54 @@ -121,10 +121,10 @@ void domain_crash(void)
   62.55  {
   62.56      struct domain *d = current->domain;
   62.57  
   62.58 -    if ( d->id == 0 )
   62.59 +    if ( d->domain_id == 0 )
   62.60          BUG();
   62.61  
   62.62 -    set_bit(DF_CRASHED, &d->flags);
   62.63 +    set_bit(_DOMF_crashed, &d->domain_flags);
   62.64  
   62.65      send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
   62.66  
   62.67 @@ -144,7 +144,7 @@ void domain_shutdown(u8 reason)
   62.68  {
   62.69      struct domain *d = current->domain;
   62.70  
   62.71 -    if ( d->id == 0 )
   62.72 +    if ( d->domain_id == 0 )
   62.73      {
   62.74          extern void machine_restart(char *);
   62.75          extern void machine_halt(void);
   62.76 @@ -164,9 +164,9 @@ void domain_shutdown(u8 reason)
   62.77      }
   62.78  
   62.79      if ( (d->shutdown_code = reason) == SHUTDOWN_crash )
   62.80 -        set_bit(DF_CRASHED, &d->flags);
   62.81 +        set_bit(_DOMF_crashed, &d->domain_flags);
   62.82      else
   62.83 -        set_bit(DF_SHUTDOWN, &d->flags);
   62.84 +        set_bit(_DOMF_shutdown, &d->domain_flags);
   62.85  
   62.86      send_guest_virq(dom0->exec_domain[0], VIRQ_DOM_EXC);
   62.87  
   62.88 @@ -180,7 +180,7 @@ void domain_destruct(struct domain *d)
   62.89      struct domain **pd;
   62.90      atomic_t      old, new;
   62.91  
   62.92 -    if ( !test_bit(DF_DYING, &d->flags) )
   62.93 +    if ( !test_bit(_DOMF_dying, &d->domain_flags) )
   62.94          BUG();
   62.95  
   62.96      /* May be already destructed, or get_domain() can race us. */
   62.97 @@ -196,7 +196,7 @@ void domain_destruct(struct domain *d)
   62.98      while ( *pd != d ) 
   62.99          pd = &(*pd)->next_in_list;
  62.100      *pd = d->next_in_list;
  62.101 -    pd = &domain_hash[DOMAIN_HASH(d->id)];
  62.102 +    pd = &domain_hash[DOMAIN_HASH(d->domain_id)];
  62.103      while ( *pd != d ) 
  62.104          pd = &(*pd)->next_in_hashbucket;
  62.105      *pd = d->next_in_hashbucket;
  62.106 @@ -217,18 +217,18 @@ void domain_destruct(struct domain *d)
  62.107   * of domains other than domain 0. ie. the domains that are being built by 
  62.108   * the userspace dom0 domain builder.
  62.109   */
  62.110 -int set_info_guest(struct domain *p, dom0_setdomaininfo_t *setdomaininfo)
  62.111 +int set_info_guest(struct domain *d, dom0_setdomaininfo_t *setdomaininfo)
  62.112  {
  62.113      int rc = 0;
  62.114      struct vcpu_guest_context *c = NULL;
  62.115      unsigned long vcpu = setdomaininfo->exec_domain;
  62.116      struct exec_domain *ed; 
  62.117  
  62.118 -    if ( (vcpu >= MAX_VIRT_CPUS) || ((ed = p->exec_domain[vcpu]) == NULL) )
  62.119 +    if ( (vcpu >= MAX_VIRT_CPUS) || ((ed = d->exec_domain[vcpu]) == NULL) )
  62.120          return -EINVAL;
  62.121      
  62.122 -    if (test_bit(DF_CONSTRUCTED, &p->flags) && 
  62.123 -        !test_bit(EDF_CTRLPAUSE, &ed->flags))
  62.124 +    if (test_bit(_DOMF_constructed, &d->domain_flags) && 
  62.125 +        !test_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags))
  62.126          return -EINVAL;
  62.127  
  62.128      if ( (c = xmalloc(struct vcpu_guest_context)) == NULL )
  62.129 @@ -243,7 +243,7 @@ int set_info_guest(struct domain *p, dom
  62.130      if ( (rc = arch_set_info_guest(ed, c)) != 0 )
  62.131          goto out;
  62.132  
  62.133 -    set_bit(DF_CONSTRUCTED, &p->flags);
  62.134 +    set_bit(_DOMF_constructed, &d->domain_flags);
  62.135  
  62.136   out:    
  62.137      xfree(c);
  62.138 @@ -283,6 +283,7 @@ long do_boot_vcpu(unsigned long vcpu, st
  62.139      ed = d->exec_domain[vcpu];
  62.140  
  62.141      atomic_set(&ed->pausecnt, 0);
  62.142 +    ed->cpumap = CPUMAP_RUNANYWHERE;
  62.143  
  62.144      memcpy(&ed->arch, &idle0_exec_domain.arch, sizeof(ed->arch));
  62.145  
  62.146 @@ -294,7 +295,7 @@ long do_boot_vcpu(unsigned long vcpu, st
  62.147      sched_add_domain(ed);
  62.148  
  62.149      /* domain_unpause_by_systemcontroller */
  62.150 -    if ( test_and_clear_bit(EDF_CTRLPAUSE, &ed->flags) )
  62.151 +    if ( test_and_clear_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
  62.152          domain_wake(ed);
  62.153  
  62.154      xfree(c);
    63.1 --- a/xen/common/event_channel.c	Wed May 11 13:43:50 2005 +0000
    63.2 +++ b/xen/common/event_channel.c	Fri May 13 14:30:20 2005 +0000
    63.3 @@ -40,7 +40,7 @@ static int get_free_port(struct exec_dom
    63.4      max = d->max_event_channel;
    63.5      chn = d->event_channel;
    63.6  
    63.7 -    for ( port = ed->id * EVENT_CHANNELS_SPREAD; port < max; port++ )
    63.8 +    for ( port = ed->vcpu_id * EVENT_CHANNELS_SPREAD; port < max; port++ )
    63.9          if ( chn[port].state == ECS_FREE )
   63.10              break;
   63.11  
   63.12 @@ -114,9 +114,9 @@ static long evtchn_bind_interdomain(evtc
   63.13          return -EINVAL;
   63.14  
   63.15      if ( dom1 == DOMID_SELF )
   63.16 -        dom1 = current->domain->id;
   63.17 +        dom1 = current->domain->domain_id;
   63.18      if ( dom2 == DOMID_SELF )
   63.19 -        dom2 = current->domain->id;
   63.20 +        dom2 = current->domain->domain_id;
   63.21  
   63.22      if ( ((d1 = find_domain_by_id(dom1)) == NULL) ||
   63.23           ((d2 = find_domain_by_id(dom2)) == NULL) )
   63.24 @@ -429,7 +429,7 @@ static long __evtchn_close(struct domain
   63.25              BUG();
   63.26  
   63.27          chn2[port2].state = ECS_UNBOUND;
   63.28 -        chn2[port2].u.unbound.remote_domid = d1->id;
   63.29 +        chn2[port2].u.unbound.remote_domid = d1->domain_id;
   63.30          break;
   63.31  
   63.32      default:
   63.33 @@ -459,7 +459,7 @@ static long evtchn_close(evtchn_close_t 
   63.34      domid_t        dom = close->dom;
   63.35  
   63.36      if ( dom == DOMID_SELF )
   63.37 -        dom = current->domain->id;
   63.38 +        dom = current->domain->domain_id;
   63.39      else if ( !IS_PRIV(current->domain) )
   63.40          return -EPERM;
   63.41  
   63.42 @@ -522,7 +522,7 @@ static long evtchn_status(evtchn_status_
   63.43      long             rc = 0;
   63.44  
   63.45      if ( dom == DOMID_SELF )
   63.46 -        dom = current->domain->id;
   63.47 +        dom = current->domain->domain_id;
   63.48      else if ( !IS_PRIV(current->domain) )
   63.49          return -EPERM;
   63.50  
   63.51 @@ -552,7 +552,7 @@ static long evtchn_status(evtchn_status_
   63.52      case ECS_INTERDOMAIN:
   63.53          status->status = EVTCHNSTAT_interdomain;
   63.54          status->u.interdomain.dom  =
   63.55 -            chn[port].u.interdomain.remote_dom->domain->id;
   63.56 +            chn[port].u.interdomain.remote_dom->domain->domain_id;
   63.57          status->u.interdomain.port = chn[port].u.interdomain.remote_port;
   63.58          break;
   63.59      case ECS_PIRQ:
    64.1 --- a/xen/common/grant_table.c	Wed May 11 13:43:50 2005 +0000
    64.2 +++ b/xen/common/grant_table.c	Fri May 13 14:30:20 2005 +0000
    64.3 @@ -118,10 +118,10 @@ static int
    64.4              u32 scombo, prev_scombo, new_scombo;
    64.5  
    64.6              if ( unlikely((sflags & GTF_type_mask) != GTF_permit_access) ||
    64.7 -                 unlikely(sdom != mapping_d->id) )
    64.8 +                 unlikely(sdom != mapping_d->domain_id) )
    64.9                  PIN_FAIL(unlock_out, GNTST_general_error,
   64.10                           "Bad flags (%x) or dom (%d). (NB. expected dom %d)\n",
   64.11 -                        sflags, sdom, mapping_d->id);
   64.12 +                        sflags, sdom, mapping_d->domain_id);
   64.13  
   64.14              /* Merge two 16-bit values into a 32-bit combined update. */
   64.15              /* NB. Endianness! */
   64.16 @@ -674,7 +674,7 @@ gnttab_setup_table(
   64.17  
   64.18      if ( op.dom == DOMID_SELF )
   64.19      {
   64.20 -        op.dom = current->domain->id;
   64.21 +        op.dom = current->domain->domain_id;
   64.22      }
   64.23      else if ( unlikely(!IS_PRIV(current->domain)) )
   64.24      {
   64.25 @@ -725,7 +725,7 @@ gnttab_dump_table(gnttab_dump_table_t *u
   64.26  
   64.27      if ( op.dom == DOMID_SELF )
   64.28      {
   64.29 -        op.dom = current->domain->id;
   64.30 +        op.dom = current->domain->domain_id;
   64.31      }
   64.32  
   64.33      if ( unlikely((d = find_domain_by_id(op.dom)) == NULL) )
   64.34 @@ -866,10 +866,10 @@ gnttab_check_unmap(
   64.35      lgt = ld->grant_table;
   64.36  
   64.37  #if GRANT_DEBUG_VERBOSE
   64.38 -    if ( ld->id != 0 )
   64.39 +    if ( ld->domain_id != 0 )
   64.40      {
   64.41          DPRINTK("Foreign unref rd(%d) ld(%d) frm(%x) flgs(%x).\n",
   64.42 -                rd->id, ld->id, frame, readonly);
   64.43 +                rd->domain_id, ld->domain_id, frame, readonly);
   64.44      }
   64.45  #endif
   64.46  
   64.47 @@ -879,7 +879,8 @@ gnttab_check_unmap(
   64.48  
   64.49      if ( get_domain(rd) == 0 )
   64.50      {
   64.51 -        DPRINTK("gnttab_check_unmap: couldn't get_domain rd(%d)\n", rd->id);
   64.52 +        DPRINTK("gnttab_check_unmap: couldn't get_domain rd(%d)\n",
   64.53 +                rd->domain_id);
   64.54          return 0;
   64.55      }
   64.56  
   64.57 @@ -913,7 +914,7 @@ gnttab_check_unmap(
   64.58  
   64.59              /* gotcha */
   64.60              DPRINTK("Grant unref rd(%d) ld(%d) frm(%lx) flgs(%x).\n",
   64.61 -                    rd->id, ld->id, frame, readonly);
   64.62 +                    rd->domain_id, ld->domain_id, frame, readonly);
   64.63  
   64.64              if ( readonly )
   64.65                  act->pin -= GNTPIN_hstr_inc;
   64.66 @@ -963,12 +964,13 @@ gnttab_prepare_for_transfer(
   64.67      unsigned long  target_pfn;
   64.68  
   64.69      DPRINTK("gnttab_prepare_for_transfer rd(%hu) ld(%hu) ref(%hu).\n",
   64.70 -            rd->id, ld->id, ref);
   64.71 +            rd->domain_id, ld->domain_id, ref);
   64.72  
   64.73      if ( unlikely((rgt = rd->grant_table) == NULL) ||
   64.74           unlikely(ref >= NR_GRANT_ENTRIES) )
   64.75      {
   64.76 -        DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n", rd->id, ref);
   64.77 +        DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n",
   64.78 +                rd->domain_id, ref);
   64.79          return 0;
   64.80      }
   64.81  
   64.82 @@ -990,10 +992,10 @@ gnttab_prepare_for_transfer(
   64.83          }
   64.84  
   64.85          if ( unlikely(sflags != GTF_accept_transfer) ||
   64.86 -             unlikely(sdom != ld->id) )
   64.87 +             unlikely(sdom != ld->domain_id) )
   64.88          {
   64.89              DPRINTK("Bad flags (%x) or dom (%d). (NB. expected dom %d)\n",
   64.90 -                    sflags, sdom, ld->id);
   64.91 +                    sflags, sdom, ld->domain_id);
   64.92              goto fail;
   64.93          }
   64.94  
   64.95 @@ -1041,7 +1043,7 @@ gnttab_notify_transfer(
   64.96      unsigned long   pfn;
   64.97  
   64.98      DPRINTK("gnttab_notify_transfer rd(%hu) ld(%hu) ref(%hu).\n",
   64.99 -            rd->id, ld->id, ref);
  64.100 +            rd->domain_id, ld->domain_id, ref);
  64.101  
  64.102      sha = &rd->grant_table->shared[ref];
  64.103  
  64.104 @@ -1062,7 +1064,7 @@ gnttab_notify_transfer(
  64.105              __phys_to_machine_mapping[pfn] = frame;
  64.106      }
  64.107      sha->frame = __mfn_to_gpfn(rd, frame);
  64.108 -    sha->domid = rd->id;
  64.109 +    sha->domid = rd->domain_id;
  64.110      wmb();
  64.111      sha->flags = ( GTF_accept_transfer | GTF_transfer_completed );
  64.112  
    65.1 --- a/xen/common/kernel.c	Wed May 11 13:43:50 2005 +0000
    65.2 +++ b/xen/common/kernel.c	Fri May 13 14:30:20 2005 +0000
    65.3 @@ -55,27 +55,13 @@ void cmdline_parse(char *cmdline)
    65.4                      *(unsigned int *)param->var =
    65.5                          simple_strtol(opt, (char **)&opt, 0);
    65.6                  break;
    65.7 -            case OPT_UINT_UNIT:
    65.8 -                if ( opt != NULL )
    65.9 -                {
   65.10 -                    int base = 1;
   65.11 -                    unsigned int value;
   65.12 -
   65.13 -                    value = simple_strtoul(opt, (char **)&opt, 0);
   65.14 -                    if (*opt == 'G' || *opt == 'g') {
   65.15 -                        base = 1024 * 1024;
   65.16 -                        opt++;
   65.17 -                    } if (*opt == 'M' || *opt == 'm') {
   65.18 -                        base = 1024;
   65.19 -                        opt++;
   65.20 -                    } else if (*opt == 'K' || *opt == 'k')
   65.21 -                        opt++;
   65.22 -                    *(unsigned int *) param->var = value * base;
   65.23 -                }
   65.24 -                break;
   65.25              case OPT_BOOL:
   65.26                  *(int *)param->var = 1;
   65.27                  break;
   65.28 +            case OPT_CUSTOM:
   65.29 +                if ( opt != NULL )
   65.30 +                    ((void (*)(char *))param->var)(opt);
   65.31 +                break;
   65.32              }
   65.33          }
   65.34          cmdline = opt_end;
    66.1 --- a/xen/common/keyhandler.c	Wed May 11 13:43:50 2005 +0000
    66.2 +++ b/xen/common/keyhandler.c	Fri May 13 14:30:20 2005 +0000
    66.3 @@ -109,7 +109,7 @@ static void do_task_queues(unsigned char
    66.4      for_each_domain ( d )
    66.5      {
    66.6          printk("Xen: DOM %u, flags=%lx refcnt=%d nr_pages=%d "
    66.7 -               "xenheap_pages=%d\n", d->id, d->flags,
    66.8 +               "xenheap_pages=%d\n", d->domain_id, d->domain_flags,
    66.9                 atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages);
   66.10  
   66.11          dump_pageframe_info(d);
   66.12 @@ -118,11 +118,11 @@ static void do_task_queues(unsigned char
   66.13              printk("Guest: %p CPU %d [has=%c] flags=%lx "
   66.14                     "upcall_pend = %02x, upcall_mask = %02x\n", ed,
   66.15                     ed->processor,
   66.16 -                   test_bit(EDF_RUNNING, &ed->flags) ? 'T':'F',
   66.17 -                   ed->flags,
   66.18 +                   test_bit(_VCPUF_running, &ed->vcpu_flags) ? 'T':'F',
   66.19 +                   ed->vcpu_flags,
   66.20                     ed->vcpu_info->evtchn_upcall_pending, 
   66.21                     ed->vcpu_info->evtchn_upcall_mask);
   66.22 -            printk("Notifying guest... %d/%d\n", d->id, ed->id); 
   66.23 +            printk("Notifying guest... %d/%d\n", d->domain_id, ed->vcpu_id); 
   66.24              printk("port %d/%d stat %d %d %d\n",
   66.25                     VIRQ_DEBUG, ed->virq_to_evtchn[VIRQ_DEBUG],
   66.26                     test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], 
    67.1 --- a/xen/common/lib.c	Wed May 11 13:43:50 2005 +0000
    67.2 +++ b/xen/common/lib.c	Fri May 13 14:30:20 2005 +0000
    67.3 @@ -441,6 +441,22 @@ s64 __moddi3(s64 a, s64 b)
    67.4  
    67.5  #endif /* BITS_PER_LONG == 32 */
    67.6  
    67.7 +unsigned long long memparse(char *s)
    67.8 +{
    67.9 +	unsigned long long ret = simple_strtoull(s, &s, 0);
   67.10 +
   67.11 +	switch (*s) {
   67.12 +	case 'G': case 'g':
   67.13 +		ret <<= 10;
   67.14 +	case 'M': case 'm':
   67.15 +		ret <<= 10;
   67.16 +	case 'K': case 'k':
   67.17 +		ret <<= 10;
   67.18 +	}
   67.19 +
   67.20 +	return ret;
   67.21 +}
   67.22 +
   67.23  /*
   67.24   * Local variables:
   67.25   * mode: C
    68.1 --- a/xen/common/page_alloc.c	Wed May 11 13:43:50 2005 +0000
    68.2 +++ b/xen/common/page_alloc.c	Fri May 13 14:30:20 2005 +0000
    68.3 @@ -504,13 +504,13 @@ struct pfn_info *alloc_domheap_pages(str
    68.4  
    68.5      spin_lock(&d->page_alloc_lock);
    68.6  
    68.7 -    if ( unlikely(test_bit(DF_DYING, &d->flags)) ||
    68.8 +    if ( unlikely(test_bit(_DOMF_dying, &d->domain_flags)) ||
    68.9           unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
   68.10      {
   68.11          DPRINTK("Over-allocation for domain %u: %u > %u\n",
   68.12 -                d->id, d->tot_pages + (1 << order), d->max_pages);
   68.13 +                d->domain_id, d->tot_pages + (1 << order), d->max_pages);
   68.14          DPRINTK("...or the domain is dying (%d)\n", 
   68.15 -                !!test_bit(DF_DYING, &d->flags));
   68.16 +                !!test_bit(_DOMF_dying, &d->domain_flags));
   68.17          spin_unlock(&d->page_alloc_lock);
   68.18          free_heap_pages(MEMZONE_DOM, pg, order);
   68.19          return NULL;
   68.20 @@ -575,7 +575,7 @@ void free_domheap_pages(struct pfn_info 
   68.21  
   68.22          spin_unlock_recursive(&d->page_alloc_lock);
   68.23  
   68.24 -        if ( likely(!test_bit(DF_DYING, &d->flags)) )
   68.25 +        if ( likely(!test_bit(_DOMF_dying, &d->domain_flags)) )
   68.26          {
   68.27              free_heap_pages(MEMZONE_DOM, pg, order);
   68.28          }
    69.1 --- a/xen/common/sched_bvt.c	Wed May 11 13:43:50 2005 +0000
    69.2 +++ b/xen/common/sched_bvt.c	Fri May 13 14:30:20 2005 +0000
    69.3 @@ -174,9 +174,9 @@ static int bvt_alloc_task(struct exec_do
    69.4              return -1;
    69.5          memset(d->sched_priv, 0, sizeof(struct bvt_dom_info));
    69.6      }
    69.7 -    ed->sched_priv = &BVT_INFO(d)->ed_inf[ed->id];
    69.8 -    BVT_INFO(d)->ed_inf[ed->id].inf = BVT_INFO(d);
    69.9 -    BVT_INFO(d)->ed_inf[ed->id].exec_domain = ed;
   69.10 +    ed->sched_priv = &BVT_INFO(d)->ed_inf[ed->vcpu_id];
   69.11 +    BVT_INFO(d)->ed_inf[ed->vcpu_id].inf = BVT_INFO(d);
   69.12 +    BVT_INFO(d)->ed_inf[ed->vcpu_id].exec_domain = ed;
   69.13      return 0;
   69.14  }
   69.15  
   69.16 @@ -190,7 +190,8 @@ static void bvt_add_task(struct exec_dom
   69.17      ASSERT(inf != NULL);
   69.18      ASSERT(d   != NULL);
   69.19  
   69.20 -    if (d->id == 0) {
   69.21 +    if ( d->vcpu_id == 0 )
   69.22 +    {
   69.23          inf->mcu_advance = MCU_ADVANCE;
   69.24          inf->domain      = d->domain;
   69.25          inf->warpback    = 0;
   69.26 @@ -212,7 +213,7 @@ static void bvt_add_task(struct exec_dom
   69.27  
   69.28      einf->exec_domain = d;
   69.29  
   69.30 -    if ( d->domain->id == IDLE_DOMAIN_ID )
   69.31 +    if ( d->domain->domain_id == IDLE_DOMAIN_ID )
   69.32      {
   69.33          einf->avt = einf->evt = ~0U;
   69.34      } 
   69.35 @@ -231,7 +232,7 @@ static int bvt_init_idle_task(struct exe
   69.36  
   69.37      bvt_add_task(ed);
   69.38  
   69.39 -    set_bit(EDF_RUNNING, &ed->flags);
   69.40 +    set_bit(_VCPUF_running, &ed->vcpu_flags);
   69.41      if ( !__task_on_runqueue(ed) )
   69.42          __add_to_runqueue_head(ed);
   69.43  
   69.44 @@ -256,7 +257,7 @@ static void bvt_wake(struct exec_domain 
   69.45      /* Set the BVT parameters. AVT should always be updated 
   69.46         if CPU migration ocurred.*/
   69.47      if ( einf->avt < CPU_SVT(cpu) || 
   69.48 -         unlikely(test_bit(EDF_MIGRATED, &ed->flags)) )
   69.49 +         unlikely(test_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags)) )
   69.50          einf->avt = CPU_SVT(cpu);
   69.51  
   69.52      /* Deal with warping here. */
   69.53 @@ -279,7 +280,7 @@ static void bvt_wake(struct exec_domain 
   69.54  
   69.55  static void bvt_sleep(struct exec_domain *ed)
   69.56  {
   69.57 -    if ( test_bit(EDF_RUNNING, &ed->flags) )
   69.58 +    if ( test_bit(_VCPUF_running, &ed->vcpu_flags) )
   69.59          cpu_raise_softirq(ed->processor, SCHEDULE_SOFTIRQ);
   69.60      else  if ( __task_on_runqueue(ed) )
   69.61          __del_from_runqueue(ed);
   69.62 @@ -538,8 +539,8 @@ static void bvt_dump_cpu_state(int i)
   69.63      list_for_each_entry ( ed_inf, queue, run_list )
   69.64      {
   69.65          ed = ed_inf->exec_domain;
   69.66 -        printk("%3d: %u has=%c ", loop++, ed->domain->id,
   69.67 -               test_bit(EDF_RUNNING, &ed->flags) ? 'T':'F');
   69.68 +        printk("%3d: %u has=%c ", loop++, ed->domain->domain_id,
   69.69 +               test_bit(_VCPUF_running, &ed->vcpu_flags) ? 'T':'F');
   69.70          bvt_dump_runq_el(ed);
   69.71          printk("c=0x%X%08X\n", (u32)(ed->cpu_time>>32), (u32)ed->cpu_time);
   69.72          printk("         l: %p n: %p  p: %p\n",
    70.1 --- a/xen/common/sched_sedf.c	Wed May 11 13:43:50 2005 +0000
    70.2 +++ b/xen/common/sched_sedf.c	Fri May 13 14:30:20 2005 +0000
    70.3 @@ -162,8 +162,8 @@ static inline void extraq_del(struct exe
    70.4  {
    70.5  	struct list_head *list = EXTRALIST(d,i);
    70.6  	ASSERT(extraq_on(d,i));
    70.7 -	PRINT(3, "Removing domain %i.%i from L%i extraq\n", d->domain->id,
    70.8 -	   d->id, i);	
    70.9 +	PRINT(3, "Removing domain %i.%i from L%i extraq\n", d->domain->domain_id,
   70.10 +	   d->vcpu_id, i);	
   70.11  	list_del(list);
   70.12  	list->next = NULL;
   70.13  	ASSERT(!extraq_on(d, i));
   70.14 @@ -182,7 +182,7 @@ static inline void extraq_add_sort_updat
   70.15  	ASSERT(!extraq_on(d,i));
   70.16  	PRINT(3, "Adding domain %i.%i (score= %i, short_pen= %"PRIi64")"
   70.17                " to L%i extraq\n",
   70.18 -              d->domain->id, d->id, EDOM_INFO(d)->score[i],
   70.19 +              d->domain->domain_id, d->vcpu_id, EDOM_INFO(d)->score[i],
   70.20                EDOM_INFO(d)->short_block_lost_tot, i);	
   70.21  	/*iterate through all elements to find our "hole" and on our way
   70.22  	  update all the other scores*/
   70.23 @@ -193,8 +193,8 @@ static inline void extraq_add_sort_updat
   70.24  	 		break;
   70.25  		else
   70.26  			PRINT(4,"\tbehind domain %i.%i (score= %i)\n",
   70.27 -			      curinf->exec_domain->domain->id,
   70.28 -			      curinf->exec_domain->id, curinf->score[i]);
   70.29 +			      curinf->exec_domain->domain->domain_id,
   70.30 +			      curinf->exec_domain->vcpu_id, curinf->score[i]);
   70.31  	}
   70.32  	/*cur now contains the element, before which we'll enqueue*/
   70.33  	PRINT(3, "\tlist_add to %p\n", cur->prev);
   70.34 @@ -208,23 +208,23 @@ static inline void extraq_add_sort_updat
   70.35  				extralist[i]);
   70.36  			curinf->score[i] -= sub;
   70.37  			PRINT(4, "\tupdating domain %i.%i (score= %u)\n",
   70.38 -			      curinf->exec_domain->domain->id, 
   70.39 -			      curinf->exec_domain->id, curinf->score[i]);
   70.40 +			      curinf->exec_domain->domain->domain_id, 
   70.41 +			      curinf->exec_domain->vcpu_id, curinf->score[i]);
   70.42  		}
   70.43  	ASSERT(extraq_on(d,i));
   70.44  }
   70.45  static inline void extraq_check(struct exec_domain *d) {
   70.46  	if (extraq_on(d, EXTRA_UTIL_Q)) {
   70.47 -		PRINT(2,"Dom %i.%i is on L1 extraQ\n",d->domain->id, d->id);
   70.48 +		PRINT(2,"Dom %i.%i is on L1 extraQ\n",d->domain->domain_id, d->vcpu_id);
   70.49  		if (!(EDOM_INFO(d)->status & EXTRA_AWARE) &&
   70.50  		    !extra_runs(EDOM_INFO(d))) {
   70.51  			extraq_del(d, EXTRA_UTIL_Q);
   70.52  			PRINT(2,"Removed dom %i.%i from L1 extraQ\n",
   70.53 -			      d->domain->id, d->id);
   70.54 +			      d->domain->domain_id, d->vcpu_id);
   70.55  		}
   70.56  	} else {
   70.57 -		PRINT(2,"Dom %i.%i is NOT on L1 extraQ\n",d->domain->id,
   70.58 -		      d->id);
   70.59 +		PRINT(2,"Dom %i.%i is NOT on L1 extraQ\n",d->domain->domain_id,
   70.60 +		      d->vcpu_id);
   70.61  		if ((EDOM_INFO(d)->status & EXTRA_AWARE) && sedf_runnable(d))
   70.62  		{
   70.63  			#if (EXTRA == EXTRA_ROUNDR)
   70.64 @@ -235,8 +235,8 @@ static inline void extraq_check(struct e
   70.65  			#elif
   70.66  			;
   70.67  			#endif
   70.68 -			PRINT(2,"Added dom %i.%i to L1 extraQ\n",d->domain->id,
   70.69 -			      d->id);
   70.70 +			PRINT(2,"Added dom %i.%i to L1 extraQ\n",d->domain->domain_id,
   70.71 +			      d->vcpu_id);
   70.72  		}
   70.73  	}
   70.74  }
   70.75 @@ -268,7 +268,7 @@ static inline void __del_from_queue(stru
   70.76      struct list_head *list = LIST(d);
   70.77      ASSERT(__task_on_queue(d));
   70.78      PRINT(3,"Removing domain %i.%i (bop= %"PRIu64") from runq/waitq\n",
   70.79 -          d->domain->id, d->id, PERIOD_BEGIN(EDOM_INFO(d)));
   70.80 +          d->domain->domain_id, d->vcpu_id, PERIOD_BEGIN(EDOM_INFO(d)));
   70.81      list_del(list);
   70.82      list->next = NULL;
   70.83      ASSERT(!__task_on_queue(d));
   70.84 @@ -309,7 +309,7 @@ DOMAIN_COMPARER(waitq, list, PERIOD_BEGI
   70.85  static inline void __add_to_waitqueue_sort(struct exec_domain *d) {
   70.86  	ASSERT(!__task_on_queue(d));
   70.87  	PRINT(3,"Adding domain %i.%i (bop= %"PRIu64") to waitq\n",
   70.88 -              d->domain->id, d->id, PERIOD_BEGIN(EDOM_INFO(d)));
   70.89 +              d->domain->domain_id, d->vcpu_id, PERIOD_BEGIN(EDOM_INFO(d)));
   70.90  	list_insert_sort(WAITQ(d->processor), LIST(d), waitq_comp);
   70.91  	ASSERT(__task_on_queue(d));
   70.92  }
   70.93 @@ -322,7 +322,7 @@ static inline void __add_to_waitqueue_so
   70.94  DOMAIN_COMPARER(runq, list, d1->deadl_abs, d2->deadl_abs)
   70.95  static inline void __add_to_runqueue_sort(struct exec_domain *d) {
   70.96  	PRINT(3,"Adding domain %i.%i (deadl= %"PRIu64") to runq\n",
   70.97 -              d->domain->id, d->id, EDOM_INFO(d)->deadl_abs);
   70.98 +              d->domain->domain_id, d->vcpu_id, EDOM_INFO(d)->deadl_abs);
   70.99  	list_insert_sort(RUNQ(d->processor), LIST(d), runq_comp);
  70.100  }
  70.101  
  70.102 @@ -346,8 +346,8 @@ static int sedf_init_scheduler() {
  70.103  
  70.104  /* Allocates memory for per domain private scheduling data*/
  70.105  static int sedf_alloc_task(struct exec_domain *d) {
  70.106 -	PRINT(2,"sedf_alloc_task was called, domain-id %i.%i\n",d->domain->id,
  70.107 -	      d->id);
  70.108 +	PRINT(2,"sedf_alloc_task was called, domain-id %i.%i\n",d->domain->domain_id,
  70.109 +	      d->vcpu_id);
  70.110  	if (d->domain->sched_priv == NULL) {
  70.111  		if ((d->domain->sched_priv = 
  70.112  		     xmalloc(struct sedf_dom_info)) == NULL )
  70.113 @@ -366,10 +366,10 @@ static void sedf_add_task(struct exec_do
  70.114  	struct sedf_edom_info *inf = EDOM_INFO(d);
  70.115  	inf->exec_domain = d;
  70.116  	
  70.117 -	PRINT(2,"sedf_add_task was called, domain-id %i.%i\n",d->domain->id,
  70.118 -	      d->id);
  70.119 +	PRINT(2,"sedf_add_task was called, domain-id %i.%i\n",d->domain->domain_id,
  70.120 +	      d->vcpu_id);
  70.121  	      
  70.122 -	if (d->domain->id==0) {
  70.123 +	if (d->domain->domain_id==0) {
  70.124  		/*set dom0 to something useful to boot the machine*/
  70.125  		inf->period    = MILLISECS(20);
  70.126  		inf->slice     = MILLISECS(15);
  70.127 @@ -391,7 +391,7 @@ static void sedf_add_task(struct exec_do
  70.128  	INIT_LIST_HEAD(&(inf->extralist[EXTRA_PEN_Q]));
  70.129  	INIT_LIST_HEAD(&(inf->extralist[EXTRA_UTIL_Q]));
  70.130  	
  70.131 -	if (d->domain->id != IDLE_DOMAIN_ID) {
  70.132 +	if (d->domain->domain_id != IDLE_DOMAIN_ID) {
  70.133  		extraq_check(d);
  70.134  	}
  70.135  }
  70.136 @@ -400,7 +400,7 @@ static void sedf_add_task(struct exec_do
  70.137  static void sedf_free_task(struct domain *d)
  70.138  {
  70.139  	int i;
  70.140 -	PRINT(2,"sedf_free_task was called, domain-id %i\n",d->id);
  70.141 +	PRINT(2,"sedf_free_task was called, domain-id %i\n",d->domain_id);
  70.142  	ASSERT(d->sched_priv != NULL);
  70.143  	xfree(d->sched_priv);
  70.144  	
  70.145 @@ -414,14 +414,14 @@ static void sedf_free_task(struct domain
  70.146  /* Initialises idle task */
  70.147  static int sedf_init_idle_task(struct exec_domain *d) {
  70.148  	PRINT(2,"sedf_init_idle_task was called, domain-id %i.%i\n",
  70.149 -	      d->domain->id, d->id);
  70.150 +	      d->domain->domain_id, d->vcpu_id);
  70.151  	if ( sedf_alloc_task(d) < 0 )
  70.152  		return -1;
  70.153  	
  70.154  	sedf_add_task(d);
  70.155  	EDOM_INFO(d)->deadl_abs = 0;
  70.156  	EDOM_INFO(d)->status &= ~SEDF_ASLEEP;
  70.157 -	set_bit(EDF_RUNNING, &d->flags);
  70.158 +	set_bit(_VCPUF_running, &d->vcpu_flags);
  70.159  	/*the idle task doesn't have to turn up on any list...*/
  70.160  	return 0;
  70.161  }
  70.162 @@ -497,7 +497,7 @@ struct list_head* waitq) {
  70.163  	list_for_each_safe(cur, tmp, waitq) {
  70.164  		curinf = list_entry(cur, struct sedf_edom_info, list);
  70.165  		PRINT(4,"\tLooking @ dom %i.%i\n",
  70.166 -		      curinf->exec_domain->domain->id, curinf->exec_domain->id);
  70.167 +		      curinf->exec_domain->domain->domain_id, curinf->exec_domain->vcpu_id);
  70.168  		if (PERIOD_BEGIN(curinf) <= now) {
  70.169  			__del_from_queue(curinf->exec_domain);
  70.170  			__add_to_runqueue_sort(curinf->exec_domain);
  70.171 @@ -512,12 +512,12 @@ struct list_head* waitq) {
  70.172  	list_for_each_safe(cur, tmp, runq) {
  70.173  		curinf = list_entry(cur,struct sedf_edom_info,list);
  70.174  		PRINT(4,"\tLooking @ dom %i.%i\n",
  70.175 -		      curinf->exec_domain->domain->id, curinf->exec_domain->id);
  70.176 +		      curinf->exec_domain->domain->domain_id, curinf->exec_domain->vcpu_id);
  70.177  		if (unlikely(curinf->slice == 0)) {
  70.178  			/*ignore domains with empty slice*/
  70.179  			PRINT(4,"\tUpdating zero-slice domain %i.%i\n",
  70.180 -			      curinf->exec_domain->domain->id,
  70.181 -			      curinf->exec_domain->id);
  70.182 +			      curinf->exec_domain->domain->domain_id,
  70.183 +			      curinf->exec_domain->vcpu_id);
  70.184  			__del_from_queue(curinf->exec_domain);
  70.185  			
  70.186  			/*move them to their next period*/
  70.187 @@ -534,8 +534,8 @@ struct list_head* waitq) {
  70.188  			PRINT(4,"\tDomain %i.%i exceeded it's deadline/"
  70.189  				"slice (%"PRIu64" / %"PRIu64") now: %"PRIu64
  70.190  				" cputime: %"PRIu64"\n",
  70.191 -				curinf->exec_domain->domain->id,
  70.192 -				curinf->exec_domain->id,
  70.193 +				curinf->exec_domain->domain->domain_id,
  70.194 +				curinf->exec_domain->vcpu_id,
  70.195  				curinf->deadl_abs, curinf->slice, now,
  70.196  				curinf->cputime);
  70.197  			__del_from_queue(curinf->exec_domain);
  70.198 @@ -601,11 +601,11 @@ static inline void desched_extra_dom(s_t
  70.199  		/*inf->short_block_lost_tot -= EXTRA_QUANTUM;*/
  70.200  		inf->short_block_lost_tot -= now - inf->sched_start_abs;
  70.201  		PRINT(3,"Domain %i.%i: Short_block_loss: %"PRIi64"\n", 
  70.202 -		      inf->exec_domain->domain->id, inf->exec_domain->id,
  70.203 +		      inf->exec_domain->domain->domain_id, inf->exec_domain->vcpu_id,
  70.204  		      inf->short_block_lost_tot);
  70.205  		if (inf->short_block_lost_tot <= 0) {
  70.206  			PRINT(4,"Domain %i.%i compensated short block loss!\n",
  70.207 -			  inf->exec_domain->domain->id, inf->exec_domain->id);
  70.208 +			  inf->exec_domain->domain->domain_id, inf->exec_domain->vcpu_id);
  70.209  			/*we have (over-)compensated our block penalty*/
  70.210  			inf->short_block_lost_tot = 0;
  70.211  			/*we don't want a place on the penalty queue anymore!*/
  70.212 @@ -808,14 +808,14 @@ sched_done:
  70.213  }
  70.214  
  70.215  static void sedf_sleep(struct exec_domain *d) {
  70.216 -	PRINT(2,"sedf_sleep was called, domain-id %i.%i\n",d->domain->id, d->id);
  70.217 +	PRINT(2,"sedf_sleep was called, domain-id %i.%i\n",d->domain->domain_id, d->vcpu_id);
  70.218  	
  70.219  	if (is_idle_task(d->domain))
  70.220  		return;
  70.221  
  70.222  	EDOM_INFO(d)->status |= SEDF_ASLEEP;
  70.223  	
  70.224 -	if ( test_bit(EDF_RUNNING, &d->flags) ) {
  70.225 +	if ( test_bit(_VCPUF_running, &d->vcpu_flags) ) {
  70.226  #ifdef ADV_SCHED_HISTO
  70.227  		adv_sched_hist_start(d->processor);
  70.228  #endif
  70.229 @@ -1140,14 +1140,14 @@ void sedf_wake(struct exec_domain *d) {
  70.230  	s_time_t              now = NOW();
  70.231  	struct sedf_edom_info* inf = EDOM_INFO(d);
  70.232  	
  70.233 -	PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->id, d->id);
  70.234 +	PRINT(3, "sedf_wake was called, domain-id %i.%i\n",d->domain->domain_id, d->vcpu_id);
  70.235  	
  70.236  	if (unlikely(is_idle_task(d->domain)))
  70.237  		return;
  70.238  			
  70.239  	if ( unlikely(__task_on_queue(d)) ) {
  70.240  		PRINT(3,"\tdomain %i.%i is already in some queue\n",
  70.241 -		      d->domain->id, d->id);
  70.242 +		      d->domain->domain_id, d->vcpu_id);
  70.243  		return;
  70.244  	}
  70.245  	ASSERT(!sedf_runnable(d));
  70.246 @@ -1160,7 +1160,7 @@ void sedf_wake(struct exec_domain *d) {
  70.247  		inf->deadl_abs = now + inf->slice;
  70.248  		
  70.249  	PRINT(3,"waking up domain %i.%i (deadl= %"PRIu64" period= %"PRIu64" "\
  70.250 -	        "now= %"PRIu64")\n", d->domain->id, d->id, inf->deadl_abs,
  70.251 +	        "now= %"PRIu64")\n", d->domain->domain_id, d->vcpu_id, inf->deadl_abs,
  70.252  		 inf->period, now);
  70.253  #ifdef SEDF_STATS	
  70.254  	inf->block_tot++;
  70.255 @@ -1222,7 +1222,7 @@ void sedf_wake(struct exec_domain *d) {
  70.256  		}
  70.257  	}
  70.258  	PRINT(3,"woke up domain %i.%i (deadl= %"PRIu64" period= %"PRIu64" "\
  70.259 -	        "now= %"PRIu64")\n", d->domain->id, d->id, inf->deadl_abs,
  70.260 +	        "now= %"PRIu64")\n", d->domain->domain_id, d->vcpu_id, inf->deadl_abs,
  70.261  		inf->period, now);
  70.262  	if (PERIOD_BEGIN(inf) > now) {
  70.263  		__add_to_waitqueue_sort(d);
  70.264 @@ -1257,8 +1257,8 @@ void sedf_wake(struct exec_domain *d) {
  70.265  
  70.266  /*Print a lot of use-{full, less} information about a domains in the system*/
  70.267  static void sedf_dump_domain(struct exec_domain *d) {
  70.268 -	printk("%i.%i has=%c ", d->domain->id, d->id,
  70.269 -		test_bit(EDF_RUNNING, &d->flags) ? 'T':'F');
  70.270 +	printk("%i.%i has=%c ", d->domain->domain_id, d->vcpu_id,
  70.271 +		test_bit(_VCPUF_running, &d->vcpu_flags) ? 'T':'F');
  70.272  	printk("p=%"PRIu64" sl=%"PRIu64" ddl=%"PRIu64" w=%hu c=%"PRIu64" sc=%i xtr(%s)=%"PRIu64" ew=%hu",
  70.273  	  EDOM_INFO(d)->period, EDOM_INFO(d)->slice, EDOM_INFO(d)->deadl_abs,
  70.274  	  EDOM_INFO(d)->weight, d->cpu_time, EDOM_INFO(d)->score[EXTRA_UTIL_Q],
  70.275 @@ -1399,7 +1399,7 @@ static int sedf_adjdom(struct domain *p,
  70.276  
  70.277  	PRINT(2,"sedf_adjdom was called, domain-id %i new period %"PRIu64" "\
  70.278  	        "new slice %"PRIu64"\nlatency %"PRIu64" extra:%s\n",
  70.279 -		p->id, cmd->u.sedf.period, cmd->u.sedf.slice,
  70.280 +		p->domain_id, cmd->u.sedf.period, cmd->u.sedf.slice,
  70.281  		cmd->u.sedf.latency, (cmd->u.sedf.extratime)?"yes":"no");
  70.282  	if ( cmd->direction == SCHED_INFO_PUT )
  70.283  	{
    71.1 --- a/xen/common/schedule.c	Wed May 11 13:43:50 2005 +0000
    71.2 +++ b/xen/common/schedule.c	Fri May 13 14:30:20 2005 +0000
    71.3 @@ -107,27 +107,27 @@ struct exec_domain *alloc_exec_domain_st
    71.4  
    71.5      d->exec_domain[vcpu] = ed;
    71.6      ed->domain = d;
    71.7 -    ed->id = vcpu;
    71.8 +    ed->vcpu_id = vcpu;
    71.9  
   71.10      if ( SCHED_OP(alloc_task, ed) < 0 )
   71.11          goto out;
   71.12  
   71.13      if ( vcpu != 0 )
   71.14      {
   71.15 -        ed->vcpu_info = &d->shared_info->vcpu_data[ed->id];
   71.16 +        ed->vcpu_info = &d->shared_info->vcpu_data[ed->vcpu_id];
   71.17  
   71.18          for_each_exec_domain( d, edc )
   71.19          {
   71.20              if ( (edc->next_in_list == NULL) ||
   71.21 -                 (edc->next_in_list->id > vcpu) )
   71.22 +                 (edc->next_in_list->vcpu_id > vcpu) )
   71.23                  break;
   71.24          }
   71.25          ed->next_in_list  = edc->next_in_list;
   71.26          edc->next_in_list = ed;
   71.27  
   71.28 -        if (test_bit(EDF_CPUPINNED, &edc->flags)) {
   71.29 +        if (test_bit(_VCPUF_cpu_pinned, &edc->vcpu_flags)) {
   71.30              ed->processor = (edc->processor + 1) % smp_num_cpus;
   71.31 -            set_bit(EDF_CPUPINNED, &ed->flags);
   71.32 +            set_bit(_VCPUF_cpu_pinned, &ed->vcpu_flags);
   71.33          } else {
   71.34              ed->processor = (edc->processor + 1) % smp_num_cpus;  /* XXX */
   71.35          }
   71.36 @@ -169,9 +169,9 @@ void sched_add_domain(struct exec_domain
   71.37      struct domain *d = ed->domain;
   71.38  
   71.39      /* Must be unpaused by control software to start execution. */
   71.40 -    set_bit(EDF_CTRLPAUSE, &ed->flags);
   71.41 +    set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags);
   71.42  
   71.43 -    if ( d->id != IDLE_DOMAIN_ID )
   71.44 +    if ( d->domain_id != IDLE_DOMAIN_ID )
   71.45      {
   71.46          /* Initialise the per-domain timer. */
   71.47          init_ac_timer(&ed->timer);
   71.48 @@ -185,14 +185,14 @@ void sched_add_domain(struct exec_domain
   71.49      }
   71.50  
   71.51      SCHED_OP(add_task, ed);
   71.52 -    TRACE_2D(TRC_SCHED_DOM_ADD, d->id, ed->id);
   71.53 +    TRACE_2D(TRC_SCHED_DOM_ADD, d->domain_id, ed->vcpu_id);
   71.54  }
   71.55  
   71.56  void sched_rem_domain(struct exec_domain *ed) 
   71.57  {
   71.58      rem_ac_timer(&ed->timer);
   71.59      SCHED_OP(rem_task, ed);
   71.60 -    TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->id, ed->id);
   71.61 +    TRACE_2D(TRC_SCHED_DOM_REM, ed->domain->domain_id, ed->vcpu_id);
   71.62  }
   71.63  
   71.64  void init_idle_task(void)
   71.65 @@ -210,10 +210,10 @@ void domain_sleep(struct exec_domain *ed
   71.66          SCHED_OP(sleep, ed);
   71.67      spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
   71.68  
   71.69 -    TRACE_2D(TRC_SCHED_SLEEP, ed->domain->id, ed->id);
   71.70 +    TRACE_2D(TRC_SCHED_SLEEP, ed->domain->domain_id, ed->vcpu_id);
   71.71   
   71.72      /* Synchronous. */
   71.73 -    while ( test_bit(EDF_RUNNING, &ed->flags) && !domain_runnable(ed) )
   71.74 +    while ( test_bit(_VCPUF_running, &ed->vcpu_flags) && !domain_runnable(ed) )
   71.75          cpu_relax();
   71.76  }
   71.77  
   71.78 @@ -229,10 +229,10 @@ void domain_wake(struct exec_domain *ed)
   71.79          ed->wokenup = NOW();
   71.80  #endif
   71.81      }
   71.82 -    clear_bit(EDF_MIGRATED, &ed->flags);
   71.83 +    clear_bit(_VCPUF_cpu_migrated, &ed->vcpu_flags);
   71.84      spin_unlock_irqrestore(&schedule_data[ed->processor].schedule_lock, flags);
   71.85  
   71.86 -    TRACE_2D(TRC_SCHED_WAKE, ed->domain->id, ed->id);
   71.87 +    TRACE_2D(TRC_SCHED_WAKE, ed->domain->domain_id, ed->vcpu_id);
   71.88  }
   71.89  
   71.90  /* Block the currently-executing domain until a pertinent event occurs. */
   71.91 @@ -245,16 +245,16 @@ long do_block(void)
   71.92  #endif
   71.93  
   71.94      ed->vcpu_info->evtchn_upcall_mask = 0;
   71.95 -    set_bit(EDF_BLOCKED, &ed->flags);
   71.96 +    set_bit(_VCPUF_blocked, &ed->vcpu_flags);
   71.97  
   71.98      /* Check for events /after/ blocking: avoids wakeup waiting race. */
   71.99      if ( event_pending(ed) )
  71.100      {
  71.101 -        clear_bit(EDF_BLOCKED, &ed->flags);
  71.102 +        clear_bit(_VCPUF_blocked, &ed->vcpu_flags);
  71.103      }
  71.104      else
  71.105      {
  71.106 -        TRACE_2D(TRC_SCHED_BLOCK, ed->domain->id, ed->id);
  71.107 +        TRACE_2D(TRC_SCHED_BLOCK, ed->domain->domain_id, ed->vcpu_id);
  71.108          __enter_scheduler();
  71.109      }
  71.110  
  71.111 @@ -268,7 +268,7 @@ static long do_yield(void)
  71.112      adv_sched_hist_start(current->processor);
  71.113  #endif
  71.114      
  71.115 -    TRACE_2D(TRC_SCHED_YIELD, current->domain->id, current->id);
  71.116 +    TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id);
  71.117      __enter_scheduler();
  71.118      return 0;
  71.119  }
  71.120 @@ -297,7 +297,7 @@ long do_sched_op(unsigned long op)
  71.121  
  71.122      case SCHEDOP_shutdown:
  71.123      {
  71.124 -        TRACE_3D(TRC_SCHED_SHUTDOWN, current->domain->id, current->id,
  71.125 +        TRACE_3D(TRC_SCHED_SHUTDOWN, current->domain->domain_id, current->vcpu_id,
  71.126                   (op >> SCHEDOP_reasonshift));
  71.127          domain_shutdown((u8)(op >> SCHEDOP_reasonshift));
  71.128          break;
  71.129 @@ -400,7 +400,7 @@ long sched_adjdom(struct sched_adjdom_cm
  71.130              spin_unlock(&schedule_data[cpu].schedule_lock);
  71.131      __clear_cpu_bits(have_lock);
  71.132  
  71.133 -    TRACE_1D(TRC_SCHED_ADJDOM, d->id);
  71.134 +    TRACE_1D(TRC_SCHED_ADJDOM, d->domain_id);
  71.135      put_domain(d);
  71.136      return 0;
  71.137  }
  71.138 @@ -451,7 +451,7 @@ static void __enter_scheduler(void)
  71.139      add_ac_timer(&schedule_data[cpu].s_timer);
  71.140  
  71.141      /* Must be protected by the schedule_lock! */
  71.142 -    set_bit(EDF_RUNNING, &next->flags);
  71.143 +    set_bit(_VCPUF_running, &next->vcpu_flags);
  71.144  
  71.145      spin_unlock_irq(&schedule_data[cpu].schedule_lock);
  71.146  
  71.147 @@ -492,8 +492,8 @@ static void __enter_scheduler(void)
  71.148      }
  71.149  
  71.150      TRACE_4D(TRC_SCHED_SWITCH,
  71.151 -             prev->domain->id, prev->id,
  71.152 -             next->domain->id, next->id);
  71.153 +             prev->domain->domain_id, prev->vcpu_id,
  71.154 +             next->domain->domain_id, next->vcpu_id);
  71.155  
  71.156  #ifdef ADV_SCHED_HISTO
  71.157      adv_sched_hist_to_stop(cpu);
    72.1 --- a/xen/drivers/char/console.c	Wed May 11 13:43:50 2005 +0000
    72.2 +++ b/xen/drivers/char/console.c	Fri May 13 14:30:20 2005 +0000
    72.3 @@ -303,7 +303,7 @@ long do_console_io(int cmd, int count, c
    72.4  
    72.5  #ifndef VERBOSE
    72.6      /* Only domain-0 may access the emergency console. */
    72.7 -    if ( current->domain->id != 0 )
    72.8 +    if ( current->domain->domain_id != 0 )
    72.9          return -EPERM;
   72.10  #endif
   72.11  
    73.1 --- a/xen/include/asm-x86/acpi.h	Wed May 11 13:43:50 2005 +0000
    73.2 +++ b/xen/include/asm-x86/acpi.h	Fri May 13 14:30:20 2005 +0000
    73.3 @@ -27,7 +27,7 @@
    73.4  #define _ASM_ACPI_H
    73.5  
    73.6  #include <xen/config.h>
    73.7 -#include <asm/system.h>
    73.8 +#include <asm/system.h>		/* defines cmpxchg */
    73.9  
   73.10  #define COMPILER_DEPENDENT_INT64   long long
   73.11  #define COMPILER_DEPENDENT_UINT64  unsigned long long
   73.12 @@ -49,8 +49,8 @@
   73.13  
   73.14  #define ACPI_ASM_MACROS
   73.15  #define BREAKPOINT3
   73.16 -#define ACPI_DISABLE_IRQS() __cli()
   73.17 -#define ACPI_ENABLE_IRQS()  __sti()
   73.18 +#define ACPI_DISABLE_IRQS() local_irq_disable()
   73.19 +#define ACPI_ENABLE_IRQS()  local_irq_enable()
   73.20  #define ACPI_FLUSH_CPU_CACHE()	wbinvd()
   73.21  
   73.22  
   73.23 @@ -100,6 +100,11 @@ static inline int
   73.24          :"=r"(n_hi), "=r"(n_lo)     \
   73.25          :"0"(n_hi), "1"(n_lo))
   73.26  
   73.27 +/*
   73.28 + * Refer Intel ACPI _PDC support document for bit definitions
   73.29 + */
   73.30 +#define ACPI_PDC_EST_CAPABILITY_SMP 	0xa
   73.31 +#define ACPI_PDC_EST_CAPABILITY_MSR	0x1
   73.32  
   73.33  #ifdef CONFIG_ACPI_BOOT 
   73.34  extern int acpi_lapic;
   73.35 @@ -108,47 +113,53 @@ extern int acpi_noirq;
   73.36  extern int acpi_strict;
   73.37  extern int acpi_disabled;
   73.38  extern int acpi_ht;
   73.39 -static inline void disable_acpi(void) { acpi_disabled = 1; acpi_ht = 0; }
   73.40 +extern int acpi_pci_disabled;
   73.41 +static inline void disable_acpi(void) 
   73.42 +{ 
   73.43 +	acpi_disabled = 1; 
   73.44 +	acpi_ht = 0;
   73.45 +	acpi_pci_disabled = 1;
   73.46 +	acpi_noirq = 1;
   73.47 +}
   73.48  
   73.49  /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
   73.50  #define FIX_ACPI_PAGES 4
   73.51  
   73.52 -#else	/* !CONFIG_ACPI_BOOT */
   73.53 +extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq);
   73.54 +
   73.55 +#ifdef CONFIG_X86_IO_APIC
   73.56 +extern int skip_ioapic_setup;
   73.57 +extern int acpi_skip_timer_override;
   73.58 +
   73.59 +extern void check_acpi_pci(void);
   73.60 +
   73.61 +static inline void disable_ioapic_setup(void)
   73.62 +{
   73.63 +	skip_ioapic_setup = 1;
   73.64 +}
   73.65 +
   73.66 +static inline int ioapic_setup_disabled(void)
   73.67 +{
   73.68 +	return skip_ioapic_setup;
   73.69 +}
   73.70 +
   73.71 +#else
   73.72 +static inline void disable_ioapic_setup(void) { }
   73.73 +static inline void check_acpi_pci(void) { }
   73.74 +
   73.75 +#endif
   73.76 +
   73.77 +#else	/* CONFIG_ACPI_BOOT */
   73.78  #  define acpi_lapic 0
   73.79  #  define acpi_ioapic 0
   73.80  
   73.81 -#endif	/* !CONFIG_ACPI_BOOT */
   73.82 +#endif
   73.83  
   73.84 -#ifdef CONFIG_ACPI_PCI
   73.85  static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
   73.86 -extern int acpi_irq_balance_set(char *str);
   73.87 -#else
   73.88 -static inline void acpi_noirq_set(void) { }
   73.89  static inline int acpi_irq_balance_set(char *str) { return 0; }
   73.90 -#endif
   73.91  
   73.92  #ifdef CONFIG_ACPI_SLEEP
   73.93  
   73.94 -extern unsigned long saved_eip;
   73.95 -extern unsigned long saved_esp;
   73.96 -extern unsigned long saved_ebp;
   73.97 -extern unsigned long saved_ebx;
   73.98 -extern unsigned long saved_esi;
   73.99 -extern unsigned long saved_edi;
  73.100 -
  73.101 -static inline void acpi_save_register_state(unsigned long return_point)
  73.102 -{
  73.103 -	saved_eip = return_point;
  73.104 -	asm volatile ("movl %%esp,(%0)" : "=m" (saved_esp));
  73.105 -	asm volatile ("movl %%ebp,(%0)" : "=m" (saved_ebp));
  73.106 -	asm volatile ("movl %%ebx,(%0)" : "=m" (saved_ebx));
  73.107 -	asm volatile ("movl %%edi,(%0)" : "=m" (saved_edi));
  73.108 -	asm volatile ("movl %%esi,(%0)" : "=m" (saved_esi));
  73.109 -}
  73.110 -
  73.111 -#define acpi_restore_register_state()   do {} while (0)
  73.112 -
  73.113 -
  73.114  /* routines for saving/restoring kernel state */
  73.115  extern int acpi_save_state_mem(void);
  73.116  extern int acpi_save_state_disk(void);
  73.117 @@ -156,11 +167,11 @@ extern void acpi_restore_state_mem(void)
  73.118  
  73.119  extern unsigned long acpi_wakeup_address;
  73.120  
  73.121 -extern void do_suspend_lowlevel_s4bios(int resume);
  73.122 -
  73.123  /* early initialization routine */
  73.124  extern void acpi_reserve_bootmem(void);
  73.125  
  73.126  #endif /*CONFIG_ACPI_SLEEP*/
  73.127  
  73.128 +extern u8 x86_acpiid_to_apicid[];
  73.129 +
  73.130  #endif /*_ASM_ACPI_H*/
    74.1 --- a/xen/include/asm-x86/config.h	Wed May 11 13:43:50 2005 +0000
    74.2 +++ b/xen/include/asm-x86/config.h	Fri May 13 14:30:20 2005 +0000
    74.3 @@ -275,9 +275,9 @@ extern unsigned long _end; /* standard E
    74.4  extern unsigned long xenheap_phys_end; /* user-configurable */
    74.5  #endif
    74.6  
    74.7 -#define GDT_VIRT_START(ed)    (PERDOMAIN_VIRT_START + ((ed)->id << PDPT_VCPU_VA_SHIFT))
    74.8 +#define GDT_VIRT_START(ed)    (PERDOMAIN_VIRT_START + ((ed)->vcpu_id << PDPT_VCPU_VA_SHIFT))
    74.9  #define GDT_VIRT_END(ed)      (GDT_VIRT_START(ed) + (64*1024))
   74.10 -#define LDT_VIRT_START(ed)    (PERDOMAIN_VIRT_START + (64*1024) + ((ed)->id << PDPT_VCPU_VA_SHIFT))
   74.11 +#define LDT_VIRT_START(ed)    (PERDOMAIN_VIRT_START + (64*1024) + ((ed)->vcpu_id << PDPT_VCPU_VA_SHIFT))
   74.12  #define LDT_VIRT_END(ed)      (LDT_VIRT_START(ed) + (64*1024))
   74.13  
   74.14  #define PDPT_VCPU_SHIFT       5
    75.1 --- a/xen/include/asm-x86/debugger.h	Wed May 11 13:43:50 2005 +0000
    75.2 +++ b/xen/include/asm-x86/debugger.h	Fri May 13 14:30:20 2005 +0000
    75.3 @@ -62,14 +62,14 @@ static inline int debugger_trap_entry(
    75.4  {
    75.5      struct exec_domain *ed = current;
    75.6  
    75.7 -    if ( !KERNEL_MODE(ed, regs) || (ed->domain->id == 0) )
    75.8 +    if ( !KERNEL_MODE(ed, regs) || (ed->domain->domain_id == 0) )
    75.9          return 0;
   75.10      
   75.11      switch ( vector )
   75.12      {
   75.13      case TRAP_int3:
   75.14      case TRAP_debug:
   75.15 -        set_bit(EDF_CTRLPAUSE, &ed->flags);
   75.16 +        set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags);
   75.17          raise_softirq(SCHEDULE_SOFTIRQ);
   75.18          return 1;
   75.19      }
    76.1 --- a/xen/include/asm-x86/domain.h	Wed May 11 13:43:50 2005 +0000
    76.2 +++ b/xen/include/asm-x86/domain.h	Fri May 13 14:30:20 2005 +0000
    76.3 @@ -30,7 +30,7 @@ struct arch_domain
    76.4  
    76.5      /* Shadow mode status and controls. */
    76.6      unsigned int shadow_mode;  /* flags to control shadow table operation */
    76.7 -    spinlock_t   shadow_lock;
    76.8 +    unsigned int shadow_nest;  /* Recursive depth of shadow_lock() nesting */
    76.9      /* Shadow mode has tainted page reference counts? */
   76.10      unsigned int shadow_tainted_refcnts;
   76.11  
    77.1 --- a/xen/include/asm-x86/i387.h	Wed May 11 13:43:50 2005 +0000
    77.2 +++ b/xen/include/asm-x86/i387.h	Fri May 13 14:30:20 2005 +0000
    77.3 @@ -19,7 +19,7 @@ extern void save_init_fpu(struct exec_do
    77.4  extern void restore_fpu(struct exec_domain *tsk);
    77.5  
    77.6  #define unlazy_fpu(_tsk) do { \
    77.7 -    if ( test_bit(EDF_USEDFPU, &(_tsk)->flags) ) \
    77.8 +    if ( test_bit(_VCPUF_fpu_dirtied, &(_tsk)->vcpu_flags) ) \
    77.9          save_init_fpu(_tsk); \
   77.10  } while ( 0 )
   77.11  
   77.12 @@ -28,4 +28,16 @@ extern void restore_fpu(struct exec_doma
   77.13      __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
   77.14  } while ( 0 )
   77.15  
   77.16 +/* Make domain the FPU owner */
   77.17 +static inline void setup_fpu(struct exec_domain *ed)
   77.18 +{
   77.19 +    if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &ed->vcpu_flags) )
   77.20 +    {
   77.21 +        if ( test_bit(_VCPUF_fpu_initialised, &ed->vcpu_flags) )
   77.22 +            restore_fpu(ed);
   77.23 +        else
   77.24 +            init_fpu();
   77.25 +    }
   77.26 +}
   77.27 +
   77.28  #endif /* __ASM_I386_I387_H */
    78.1 --- a/xen/include/asm-x86/shadow.h	Wed May 11 13:43:50 2005 +0000
    78.2 +++ b/xen/include/asm-x86/shadow.h	Fri May 13 14:30:20 2005 +0000
    78.3 @@ -60,9 +60,45 @@
    78.4  #define __linear_hl2_table ((l1_pgentry_t *)(LINEAR_PT_VIRT_START + \
    78.5       (PERDOMAIN_VIRT_START >> (L2_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT))))
    78.6  
    78.7 -#define shadow_lock_init(_d) spin_lock_init(&(_d)->arch.shadow_lock)
    78.8 -#define shadow_lock(_d)      do { ASSERT(!spin_is_locked(&(_d)->arch.shadow_lock)); spin_lock(&(_d)->arch.shadow_lock); } while (0)
    78.9 -#define shadow_unlock(_d)    spin_unlock(&(_d)->arch.shadow_lock)
   78.10 +/*
   78.11 + * For now we use the per-domain BIGLOCK rather than a shadow-specific lock.
   78.12 + * We usually have the BIGLOCK already acquired anyway, so this is unlikely
   78.13 + * to cause much unnecessary extra serialisation. Also it's a recursive
   78.14 + * lock, and there are some code paths containing nested shadow_lock().
   78.15 + * The #if0'ed code below is therefore broken until such nesting is removed.
   78.16 + */
   78.17 +#if 0
   78.18 +#define shadow_lock_init(_d)                    \
   78.19 +    spin_lock_init(&(_d)->arch.shadow_lock)
   78.20 +#define shadow_lock_is_acquired(_d)             \
   78.21 +    spin_is_locked(&(_d)->arch.shadow_lock)
   78.22 +#define shadow_lock(_d)                         \
   78.23 +do {                                            \
   78.24 +    ASSERT(!shadow_lock_is_acquired(_d));       \
   78.25 +    spin_lock(&(_d)->arch.shadow_lock);         \
   78.26 +} while (0)
   78.27 +#define shadow_unlock(_d)                       \
   78.28 +do {                                            \
   78.29 +    ASSERT(!shadow_lock_is_acquired(_d));       \
   78.30 +    spin_unlock(&(_d)->arch.shadow_lock);       \
   78.31 +} while (0)
   78.32 +#else
   78.33 +#define shadow_lock_init(_d)                    \
   78.34 +    ((_d)->arch.shadow_nest = 0)
   78.35 +#define shadow_lock_is_acquired(_d)             \
   78.36 +    (spin_is_locked(&(_d)->big_lock) && ((_d)->arch.shadow_nest != 0))
   78.37 +#define shadow_lock(_d)                         \
   78.38 +do {                                            \
   78.39 +    LOCK_BIGLOCK(_d);                           \
   78.40 +    (_d)->arch.shadow_nest++;                   \
   78.41 +} while (0)
   78.42 +#define shadow_unlock(_d)                       \
   78.43 +do {                                            \
   78.44 +    ASSERT(shadow_lock_is_acquired(_d));        \
   78.45 +    (_d)->arch.shadow_nest--;                   \
   78.46 +    UNLOCK_BIGLOCK(_d);                         \
   78.47 +} while (0)
   78.48 +#endif
   78.49  
   78.50  #define SHADOW_ENCODE_MIN_MAX(_min, _max) ((((L1_PAGETABLE_ENTRIES - 1) - (_max)) << 16) | (_min))
   78.51  #define SHADOW_MIN(_encoded) ((_encoded) & ((1u<<16) - 1))
   78.52 @@ -281,7 +317,7 @@ extern int shadow_status_noswap;
   78.53  #ifdef VERBOSE
   78.54  #define SH_LOG(_f, _a...)                                               \
   78.55      printk("DOM%uP%u: SH_LOG(%d): " _f "\n",                            \
   78.56 -       current->domain->id , current->processor, __LINE__ , ## _a )
   78.57 +       current->domain->domain_id , current->processor, __LINE__ , ## _a )
   78.58  #else
   78.59  #define SH_LOG(_f, _a...) ((void)0)
   78.60  #endif
   78.61 @@ -289,7 +325,7 @@ extern int shadow_status_noswap;
   78.62  #if SHADOW_VERBOSE_DEBUG
   78.63  #define SH_VLOG(_f, _a...)                                              \
   78.64      printk("DOM%uP%u: SH_VLOG(%d): " _f "\n",                           \
   78.65 -           current->domain->id, current->processor, __LINE__ , ## _a )
   78.66 +           current->domain->domain_id, current->processor, __LINE__ , ## _a )
   78.67  #else
   78.68  #define SH_VLOG(_f, _a...) ((void)0)
   78.69  #endif
   78.70 @@ -297,7 +333,7 @@ extern int shadow_status_noswap;
   78.71  #if SHADOW_VVERBOSE_DEBUG
   78.72  #define SH_VVLOG(_f, _a...)                                             \
   78.73      printk("DOM%uP%u: SH_VVLOG(%d): " _f "\n",                          \
   78.74 -           current->domain->id, current->processor, __LINE__ , ## _a )
   78.75 +           current->domain->domain_id, current->processor, __LINE__ , ## _a )
   78.76  #else
   78.77  #define SH_VVLOG(_f, _a...) ((void)0)
   78.78  #endif
   78.79 @@ -305,7 +341,7 @@ extern int shadow_status_noswap;
   78.80  #if SHADOW_VVVERBOSE_DEBUG
   78.81  #define SH_VVVLOG(_f, _a...)                                            \
   78.82      printk("DOM%uP%u: SH_VVVLOG(%d): " _f "\n",                         \
   78.83 -           current->domain->id, current->processor, __LINE__ , ## _a )
   78.84 +           current->domain->domain_id, current->processor, __LINE__ , ## _a )
   78.85  #else
   78.86  #define SH_VVVLOG(_f, _a...) ((void)0)
   78.87  #endif
   78.88 @@ -313,7 +349,7 @@ extern int shadow_status_noswap;
   78.89  #if FULLSHADOW_DEBUG
   78.90  #define FSH_LOG(_f, _a...)                                              \
   78.91      printk("DOM%uP%u: FSH_LOG(%d): " _f "\n",                           \
   78.92 -           current->domain->id, current->processor, __LINE__ , ## _a )
   78.93 +           current->domain->domain_id, current->processor, __LINE__ , ## _a )
   78.94  #else
   78.95  #define FSH_LOG(_f, _a...) ((void)0)
   78.96  #endif
   78.97 @@ -348,7 +384,8 @@ shadow_get_page_from_l1e(l1_pgentry_t l1
   78.98          res = get_page_from_l1e(nl1e, owner);
   78.99          printk("tried to map mfn %lx from domain %d into shadow page tables "
  78.100                 "of domain %d; %s\n",
  78.101 -               mfn, owner->id, d->id, res ? "success" : "failed");
  78.102 +               mfn, owner->domain_id, d->domain_id,
  78.103 +               res ? "success" : "failed");
  78.104      }
  78.105  
  78.106      if ( unlikely(!res) )
  78.107 @@ -403,7 +440,7 @@ static inline int __mark_dirty(struct do
  78.108      unsigned long pfn;
  78.109      int           rc = 0;
  78.110  
  78.111 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  78.112 +    ASSERT(shadow_lock_is_acquired(d));
  78.113      ASSERT(d->arch.shadow_dirty_bitmap != NULL);
  78.114  
  78.115      if ( !VALID_MFN(mfn) )
  78.116 @@ -1137,7 +1174,7 @@ static inline unsigned long __shadow_sta
  78.117                            ? __gpfn_to_mfn(d, gpfn)
  78.118                            : INVALID_MFN);
  78.119  
  78.120 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  78.121 +    ASSERT(shadow_lock_is_acquired(d));
  78.122      ASSERT(gpfn == (gpfn & PGT_mfn_mask));
  78.123      ASSERT(stype && !(stype & ~PGT_type_mask));
  78.124  
  78.125 @@ -1153,7 +1190,7 @@ static inline unsigned long __shadow_sta
  78.126          {
  78.127              printk("d->id=%d gpfn=%lx gmfn=%lx stype=%lx c=%x t=%x "
  78.128                     "mfn_out_of_sync(gmfn)=%d mfn_is_page_table(gmfn)=%d\n",
  78.129 -                   d->id, gpfn, gmfn, stype,
  78.130 +                   d->domain_id, gpfn, gmfn, stype,
  78.131                     frame_table[gmfn].count_info,
  78.132                     frame_table[gmfn].u.inuse.type_info,
  78.133                     mfn_out_of_sync(gmfn), mfn_is_page_table(gmfn));
  78.134 @@ -1186,7 +1223,7 @@ shadow_max_pgtable_type(struct domain *d
  78.135      struct shadow_status *x;
  78.136      u32 pttype = PGT_none, type;
  78.137  
  78.138 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  78.139 +    ASSERT(shadow_lock_is_acquired(d));
  78.140      ASSERT(gpfn == (gpfn & PGT_mfn_mask));
  78.141  
  78.142      perfc_incrc(shadow_max_type);
  78.143 @@ -1280,7 +1317,7 @@ static inline void delete_shadow_status(
  78.144      struct shadow_status *p, *x, *n, *head;
  78.145      unsigned long key = gpfn | stype;
  78.146  
  78.147 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  78.148 +    ASSERT(shadow_lock_is_acquired(d));
  78.149      ASSERT(!(gpfn & ~PGT_mfn_mask));
  78.150      ASSERT(stype && !(stype & ~PGT_type_mask));
  78.151  
  78.152 @@ -1362,7 +1399,7 @@ static inline void set_shadow_status(
  78.153  
  78.154      SH_VVLOG("set gpfn=%lx gmfn=%lx smfn=%lx t=%lx", gpfn, gmfn, smfn, stype);
  78.155  
  78.156 -    ASSERT(spin_is_locked(&d->arch.shadow_lock));
  78.157 +    ASSERT(shadow_lock_is_acquired(d));
  78.158  
  78.159      ASSERT(shadow_mode_translate(d) || gpfn);
  78.160      ASSERT(!(gpfn & ~PGT_mfn_mask));
    79.1 --- a/xen/include/asm-x86/vmx.h	Wed May 11 13:43:50 2005 +0000
    79.2 +++ b/xen/include/asm-x86/vmx.h	Fri May 13 14:30:20 2005 +0000
    79.3 @@ -24,6 +24,7 @@
    79.4  #include <asm/regs.h>
    79.5  #include <asm/processor.h>
    79.6  #include <asm/vmx_vmcs.h>
    79.7 +#include <asm/i387.h>
    79.8  
    79.9  extern void vmx_asm_vmexit_handler(struct cpu_user_regs);
   79.10  extern void vmx_asm_do_resume(void);
   79.11 @@ -251,4 +252,19 @@ static inline int __vmxon (u64 addr)
   79.12      return 0;
   79.13  }
   79.14  
   79.15 +/* Make sure that xen intercepts any FP accesses from current */
   79.16 +static inline void vmx_stts()
   79.17 +{
   79.18 +    unsigned long cr0;
   79.19 +
   79.20 +    __vmread(GUEST_CR0, &cr0);
   79.21 +    if (!(cr0 & X86_CR0_TS))
   79.22 +        __vmwrite(GUEST_CR0, cr0 | X86_CR0_TS);
   79.23 +
   79.24 +    __vmread(CR0_READ_SHADOW, &cr0);
   79.25 +    if (!(cr0 & X86_CR0_TS))
   79.26 +       __vmwrite(EXCEPTION_BITMAP, MONITOR_DEFAULT_EXCEPTION_BITMAP | 
   79.27 +                                   EXCEPTION_BITMAP_NM);
   79.28 +}
   79.29 + 
   79.30  #endif /* __ASM_X86_VMX_H__ */
    80.1 --- a/xen/include/public/dom0_ops.h	Wed May 11 13:43:50 2005 +0000
    80.2 +++ b/xen/include/public/dom0_ops.h	Fri May 13 14:30:20 2005 +0000
    80.3 @@ -19,7 +19,7 @@
    80.4   * This makes sure that old versions of dom0 tools will stop working in a
    80.5   * well-defined way (rather than crashing the machine, for instance).
    80.6   */
    80.7 -#define DOM0_INTERFACE_VERSION   0xAAAA1004
    80.8 +#define DOM0_INTERFACE_VERSION   0xAAAA1005
    80.9  
   80.10  /************************************************************************/
   80.11  
   80.12 @@ -70,7 +70,6 @@ typedef struct {
   80.13  typedef struct {
   80.14      /* IN variables. */
   80.15      domid_t  domain;                  /* NB. IN/OUT variable. */
   80.16 -    u16      exec_domain;
   80.17      /* OUT variables. */
   80.18  #define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
   80.19  #define DOMFLAGS_CRASHED   (1<<1) /* Crashed domain; frozen for postmortem.  */
   80.20 @@ -83,18 +82,20 @@ typedef struct {
   80.21  #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
   80.22  #define DOMFLAGS_SHUTDOWNSHIFT 16
   80.23      u32      flags;
   80.24 -    vcpu_guest_context_t *ctxt;   /* NB. IN/OUT variable. */
   80.25      memory_t tot_pages;
   80.26      memory_t max_pages;
   80.27      memory_t shared_info_frame;       /* MFN of shared_info struct */
   80.28      u64      cpu_time;
   80.29 +    u32      n_vcpu;
   80.30 +    s32      vcpu_to_cpu[MAX_VIRT_CPUS];  /* current mapping   */
   80.31 +    cpumap_t cpumap[MAX_VIRT_CPUS];       /* allowable mapping */
   80.32  } dom0_getdomaininfo_t;
   80.33  
   80.34  #define DOM0_SETDOMAININFO      13
   80.35  typedef struct {
   80.36      /* IN variables. */
   80.37      domid_t                   domain;
   80.38 -    u16                       exec_domain;
   80.39 +    u16                       vcpu;
   80.40      /* IN/OUT parameters */
   80.41      vcpu_guest_context_t *ctxt;
   80.42  } dom0_setdomaininfo_t;
   80.43 @@ -170,14 +171,14 @@ typedef struct {
   80.44  } dom0_readconsole_t;
   80.45  
   80.46  /* 
   80.47 - * Pin Domain to a particular CPU  (use -1 to unpin)
   80.48 + * Set which physical cpus a vcpu can execute on.
   80.49   */
   80.50  #define DOM0_PINCPUDOMAIN     20
   80.51  typedef struct {
   80.52      /* IN variables. */
   80.53      domid_t      domain;
   80.54 -    u16          exec_domain;
   80.55 -    s32          cpu;                 /*  -1 implies unpin */
   80.56 +    u16          vcpu;
   80.57 +    cpumap_t     *cpumap;
   80.58  } dom0_pincpudomain_t;
   80.59  
   80.60  /* Get trace buffers machine base address */
   80.61 @@ -342,6 +343,14 @@ typedef struct {
   80.62      u16     allow_access;             /* allow or deny access to range? */
   80.63  } dom0_ioport_permission_t;
   80.64  
   80.65 +#define DOM0_GETVCPUCONTEXT      37
   80.66 +typedef struct {
   80.67 +    domid_t domain;                   /* domain to be affected */
   80.68 +    u16     vcpu;                     /* vcpu # */
   80.69 +    vcpu_guest_context_t *ctxt;       /* NB. IN/OUT variable. */
   80.70 +    u64     cpu_time;                 
   80.71 +} dom0_getvcpucontext_t;
   80.72 +
   80.73  typedef struct {
   80.74      u32 cmd;
   80.75      u32 interface_version; /* DOM0_INTERFACE_VERSION */
   80.76 @@ -373,6 +382,7 @@ typedef struct {
   80.77          dom0_perfccontrol_t      perfccontrol;
   80.78          dom0_microcode_t         microcode;
   80.79          dom0_ioport_permission_t ioport_permission;
   80.80 +        dom0_getvcpucontext_t    getvcpucontext;
   80.81      } u;
   80.82  } dom0_op_t;
   80.83  
    81.1 --- a/xen/include/public/xen.h	Wed May 11 13:43:50 2005 +0000
    81.2 +++ b/xen/include/public/xen.h	Fri May 13 14:30:20 2005 +0000
    81.3 @@ -473,6 +473,8 @@ typedef struct {
    81.4  /* For use in guest OSes. */
    81.5  extern shared_info_t *HYPERVISOR_shared_info;
    81.6  
    81.7 +typedef u64 cpumap_t;
    81.8 +
    81.9  #endif /* !__ASSEMBLY__ */
   81.10  
   81.11  #endif /* __XEN_PUBLIC_XEN_H__ */
    82.1 --- a/xen/include/xen/event.h	Wed May 11 13:43:50 2005 +0000
    82.2 +++ b/xen/include/xen/event.h	Fri May 13 14:30:20 2005 +0000
    82.3 @@ -35,15 +35,15 @@ static inline void evtchn_set_pending(st
    82.4          set_bit(0, &ed->vcpu_info->evtchn_upcall_pending);
    82.5  
    82.6          /*
    82.7 -         * NB1. 'flags' and 'processor' must be checked /after/ update of
    82.8 +         * NB1. 'vcpu_flags' and 'processor' must be checked /after/ update of
    82.9           * pending flag. These values may fluctuate (after all, we hold no
   82.10           * locks) but the key insight is that each change will cause
   82.11           * evtchn_upcall_pending to be polled.
   82.12           * 
   82.13 -         * NB2. We save DF_RUNNING across the unblock to avoid a needless
   82.14 +         * NB2. We save VCPUF_running across the unblock to avoid a needless
   82.15           * IPI for domains that we IPI'd to unblock.
   82.16           */
   82.17 -        running = test_bit(EDF_RUNNING, &ed->flags);
   82.18 +        running = test_bit(_VCPUF_running, &ed->vcpu_flags);
   82.19          exec_domain_unblock(ed);
   82.20          if ( running )
   82.21              smp_send_event_check_cpu(ed->processor);
    83.1 --- a/xen/include/xen/init.h	Wed May 11 13:43:50 2005 +0000
    83.2 +++ b/xen/include/xen/init.h	Fri May 13 14:30:20 2005 +0000
    83.3 @@ -59,13 +59,17 @@ extern initcall_t __initcall_start, __in
    83.4   */
    83.5  struct kernel_param {
    83.6      const char *name;
    83.7 -    enum { OPT_STR, OPT_UINT, OPT_UINT_UNIT, OPT_BOOL } type;
    83.8 +    enum { OPT_STR, OPT_UINT, OPT_BOOL, OPT_CUSTOM } type;
    83.9      void *var;
   83.10      unsigned int len;
   83.11  };
   83.12  
   83.13  extern struct kernel_param __setup_start, __setup_end;
   83.14  
   83.15 +#define custom_param(_name, _var) \
   83.16 +    static char __setup_str_##_var[] __initdata = _name; \
   83.17 +    static struct kernel_param __setup_##_var __attribute_used__ \
   83.18 +        __initsetup = { __setup_str_##_var, OPT_CUSTOM, &_var, 0 }
   83.19  #define boolean_param(_name, _var) \
   83.20      static char __setup_str_##_var[] __initdata = _name; \
   83.21      static struct kernel_param __setup_##_var __attribute_used__ \
   83.22 @@ -74,10 +78,6 @@ extern struct kernel_param __setup_start
   83.23      static char __setup_str_##_var[] __initdata = _name; \
   83.24      static struct kernel_param __setup_##_var __attribute_used__ \
   83.25          __initsetup = { __setup_str_##_var, OPT_UINT, &_var, sizeof(_var) }
   83.26 -#define integer_unit_param(_name, _var) \
   83.27 -    static char __setup_str_##_var[] __initdata = _name; \
   83.28 -    static struct kernel_param __setup_##_var __attribute_used__ \
   83.29 -        __initsetup = { __setup_str_##_var, OPT_UINT_UNIT, &_var, sizeof(_var) }
   83.30  #define string_param(_name, _var) \
   83.31      static char __setup_str_##_var[] __initdata = _name; \
   83.32      static struct kernel_param __setup_##_var __attribute_used__ \
    84.1 --- a/xen/include/xen/lib.h	Wed May 11 13:43:50 2005 +0000
    84.2 +++ b/xen/include/xen/lib.h	Fri May 13 14:30:20 2005 +0000
    84.3 @@ -57,8 +57,15 @@ extern int snprintf(char * buf, size_t s
    84.4      __attribute__ ((format (printf, 3, 4)));
    84.5  extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
    84.6  
    84.7 -long simple_strtol(const char *cp,char **endp,unsigned int base);
    84.8 -unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
    84.9 -long long simple_strtoll(const char *cp,char **endp,unsigned int base);
   84.10 +long simple_strtol(
   84.11 +    const char *cp,char **endp, unsigned int base);
   84.12 +unsigned long simple_strtoul(
   84.13 +    const char *cp,char **endp, unsigned int base);
   84.14 +long long simple_strtoll(
   84.15 +    const char *cp,char **endp, unsigned int base);
   84.16 +unsigned long long simple_strtoull(
   84.17 +    const char *cp,char **endp, unsigned int base);
   84.18 +
   84.19 +unsigned long long memparse(char *s);
   84.20  
   84.21  #endif /* __LIB_H__ */
    85.1 --- a/xen/include/xen/sched.h	Wed May 11 13:43:50 2005 +0000
    85.2 +++ b/xen/include/xen/sched.h	Fri May 13 14:30:20 2005 +0000
    85.3 @@ -58,9 +58,11 @@ int  init_event_channels(struct domain *
    85.4  void destroy_event_channels(struct domain *d);
    85.5  int  init_exec_domain_event_channels(struct exec_domain *ed);
    85.6  
    85.7 +#define CPUMAP_RUNANYWHERE 0xFFFFFFFF
    85.8 +
    85.9  struct exec_domain 
   85.10  {
   85.11 -    int              id;
   85.12 +    int              vcpu_id;
   85.13  
   85.14      int              processor;
   85.15  
   85.16 @@ -78,12 +80,14 @@ struct exec_domain
   85.17      s_time_t         wokenup;       /* time domain got woken up */
   85.18      void            *sched_priv;    /* scheduler-specific data */
   85.19  
   85.20 -    unsigned long    flags;
   85.21 +    unsigned long    vcpu_flags;
   85.22  
   85.23      u16              virq_to_evtchn[NR_VIRQS];
   85.24  
   85.25      atomic_t         pausecnt;
   85.26  
   85.27 +    cpumap_t         cpumap;        /* which cpus this domain can run on */
   85.28 +
   85.29      struct arch_exec_domain arch;
   85.30  };
   85.31  
   85.32 @@ -93,7 +97,7 @@ struct exec_domain
   85.33  
   85.34  struct domain
   85.35  {
   85.36 -    domid_t          id;
   85.37 +    domid_t          domain_id;
   85.38  
   85.39      shared_info_t   *shared_info;     /* shared data area */
   85.40      spinlock_t       time_lock;
   85.41 @@ -109,7 +113,7 @@ struct domain
   85.42      unsigned int     xenheap_pages;   /* # pages allocated from Xen heap    */
   85.43  
   85.44      /* Scheduling. */
   85.45 -    int              shutdown_code; /* code value from OS (if DF_SHUTDOWN). */
   85.46 +    int              shutdown_code; /* code value from OS (if DOMF_shutdown) */
   85.47      void            *sched_priv;    /* scheduler-specific data */
   85.48  
   85.49      struct domain   *next_in_list;
   85.50 @@ -131,7 +135,7 @@ struct domain
   85.51      u16              pirq_to_evtchn[NR_PIRQS];
   85.52      u32              pirq_mask[NR_PIRQS/32];
   85.53  
   85.54 -    unsigned long    flags;
   85.55 +    unsigned long    domain_flags;
   85.56      unsigned long    vm_assist;
   85.57  
   85.58      atomic_t         refcnt;
   85.59 @@ -168,7 +172,7 @@ extern struct exec_domain idle0_exec_dom
   85.60  
   85.61  extern struct exec_domain *idle_task[NR_CPUS];
   85.62  #define IDLE_DOMAIN_ID   (0x7FFFU)
   85.63 -#define is_idle_task(_p) (test_bit(DF_IDLETASK, &(_p)->flags))
   85.64 +#define is_idle_task(_d) (test_bit(_DOMF_idle_domain, &(_d)->domain_flags))
   85.65  
   85.66  struct exec_domain *alloc_exec_domain_struct(struct domain *d,
   85.67                                               unsigned long vcpu);
   85.68 @@ -324,29 +328,67 @@ extern struct domain *domain_list;
   85.69         (_ed) != NULL;                \
   85.70         (_ed) = (_ed)->next_in_list )
   85.71  
   85.72 -#define EDF_DONEFPUINIT  0 /* Has the FPU been initialised for this task?    */
   85.73 -#define EDF_USEDFPU      1 /* Has this task used the FPU since last save?    */
   85.74 -#define EDF_GUEST_STTS   2 /* Has the guest OS requested 'stts'?             */
   85.75 -#define EDF_BLOCKED      3 /* Domain is blocked waiting for an event.        */
   85.76 -#define EDF_CTRLPAUSE    4 /* Domain is paused by controller software.       */
   85.77 -#define EDF_RUNNING      5 /* Currently running on a CPU.                    */
   85.78 -#define EDF_CPUPINNED    6 /* Disables auto-migration.                       */
   85.79 -#define EDF_MIGRATED     7 /* Domain migrated between CPUs.                  */
   85.80 -#define EDF_DONEINIT     8 /* Initialization completed    .                  */
   85.81 +/*
   85.82 + * Per-VCPU flags (vcpu_flags).
   85.83 + */
   85.84 + /* Has the FPU been initialised? */
   85.85 +#define _VCPUF_fpu_initialised 0
   85.86 +#define VCPUF_fpu_initialised  (1UL<<_VCPUF_fpu_initialised)
   85.87 + /* Has the FPU been used since it was last saved? */
   85.88 +#define _VCPUF_fpu_dirtied     1
   85.89 +#define VCPUF_fpu_dirtied      (1UL<<_VCPUF_fpu_dirtied)
   85.90 + /* Has the guest OS requested 'stts'? */
   85.91 +#define _VCPUF_guest_stts      2
   85.92 +#define VCPUF_guest_stts       (1UL<<_VCPUF_guest_stts)
   85.93 + /* Domain is blocked waiting for an event. */
   85.94 +#define _VCPUF_blocked         3
   85.95 +#define VCPUF_blocked          (1UL<<_VCPUF_blocked)
   85.96 + /* Domain is paused by controller software. */
   85.97 +#define _VCPUF_ctrl_pause      4
   85.98 +#define VCPUF_ctrl_pause       (1UL<<_VCPUF_ctrl_pause)
   85.99 + /* Currently running on a CPU? */
  85.100 +#define _VCPUF_running         5
  85.101 +#define VCPUF_running          (1UL<<_VCPUF_running)
  85.102 + /* Disables auto-migration between CPUs. */
  85.103 +#define _VCPUF_cpu_pinned      6
  85.104 +#define VCPUF_cpu_pinned       (1UL<<_VCPUF_cpu_pinned)
  85.105 + /* Domain migrated between CPUs. */
  85.106 +#define _VCPUF_cpu_migrated    7
  85.107 +#define VCPUF_cpu_migrated     (1UL<<_VCPUF_cpu_migrated)
  85.108 + /* Initialization completed. */
  85.109 +#define _VCPUF_initialised     8
  85.110 +#define VCPUF_initialised      (1UL<<_VCPUF_initialised)
  85.111  
  85.112 -#define DF_CONSTRUCTED   0 /* Has the guest OS been fully built yet?         */
  85.113 -#define DF_IDLETASK      1 /* Is this one of the per-CPU idle domains?       */
  85.114 -#define DF_PRIVILEGED    2 /* Is this domain privileged?                     */
  85.115 -#define DF_PHYSDEV       3 /* May this domain do IO to physical devices?     */
  85.116 -#define DF_SHUTDOWN      4 /* Guest shut itself down for some reason.        */
  85.117 -#define DF_CRASHED       5 /* Domain crashed inside Xen, cannot continue.    */
  85.118 -#define DF_DYING         6 /* Death rattle.                                  */
  85.119 +/*
  85.120 + * Per-domain flags (domain_flags).
  85.121 + */
  85.122 + /* Has the guest OS been fully built yet? */
  85.123 +#define _DOMF_constructed      0
  85.124 +#define DOMF_constructed       (1UL<<_DOMF_constructed)
  85.125 + /* Is this one of the per-CPU idle domains? */
  85.126 +#define _DOMF_idle_domain      1
  85.127 +#define DOMF_idle_domain       (1UL<<_DOMF_idle_domain)
  85.128 + /* Is this domain privileged? */
  85.129 +#define _DOMF_privileged       2
  85.130 +#define DOMF_privileged        (1UL<<_DOMF_privileged)
  85.131 + /* May this domain do IO to physical devices? */
  85.132 +#define _DOMF_physdev_access   3
  85.133 +#define DOMF_physdev_access    (1UL<<_DOMF_physdev_access)
  85.134 + /* Guest shut itself down for some reason. */
  85.135 +#define _DOMF_shutdown         4
  85.136 +#define DOMF_shutdown          (1UL<<_DOMF_shutdown)
  85.137 + /* Domain has crashed and cannot continue to execute. */
  85.138 +#define _DOMF_crashed          5
  85.139 +#define DOMF_crashed           (1UL<<_DOMF_crashed)
  85.140 + /* Death rattle. */
  85.141 +#define _DOMF_dying            6
  85.142 +#define DOMF_dying             (1UL<<_DOMF_dying)
  85.143  
  85.144  static inline int domain_runnable(struct exec_domain *ed)
  85.145  {
  85.146      return ( (atomic_read(&ed->pausecnt) == 0) &&
  85.147 -             !(ed->flags & ((1<<EDF_BLOCKED)|(1<<EDF_CTRLPAUSE))) &&
  85.148 -             !(ed->domain->flags & ((1<<DF_SHUTDOWN)|(1<<DF_CRASHED))) );
  85.149 +             !(ed->vcpu_flags & (VCPUF_blocked|VCPUF_ctrl_pause)) &&
  85.150 +             !(ed->domain->domain_flags & (DOMF_shutdown|DOMF_crashed)) );
  85.151  }
  85.152  
  85.153  static inline void exec_domain_pause(struct exec_domain *ed)
  85.154 @@ -388,7 +430,7 @@ static inline void domain_unpause(struct
  85.155  
  85.156  static inline void exec_domain_unblock(struct exec_domain *ed)
  85.157  {
  85.158 -    if ( test_and_clear_bit(EDF_BLOCKED, &ed->flags) )
  85.159 +    if ( test_and_clear_bit(_VCPUF_blocked, &ed->vcpu_flags) )
  85.160          domain_wake(ed);
  85.161  }
  85.162  
  85.163 @@ -399,7 +441,7 @@ static inline void domain_pause_by_syste
  85.164      for_each_exec_domain ( d, ed )
  85.165      {
  85.166          ASSERT(ed != current);
  85.167 -        if ( !test_and_set_bit(EDF_CTRLPAUSE, &ed->flags) )
  85.168 +        if ( !test_and_set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
  85.169              domain_sleep(ed);
  85.170      }
  85.171  
  85.172 @@ -412,14 +454,15 @@ static inline void domain_unpause_by_sys
  85.173  
  85.174      for_each_exec_domain ( d, ed )
  85.175      {
  85.176 -        if ( test_and_clear_bit(EDF_CTRLPAUSE, &ed->flags) )
  85.177 +        if ( test_and_clear_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags) )
  85.178              domain_wake(ed);
  85.179      }
  85.180  }
  85.181  
  85.182 -
  85.183 -#define IS_PRIV(_d) (test_bit(DF_PRIVILEGED, &(_d)->flags))
  85.184 -#define IS_CAPABLE_PHYSDEV(_d) (test_bit(DF_PHYSDEV, &(_d)->flags))
  85.185 +#define IS_PRIV(_d)                                         \
  85.186 +    (test_bit(_DOMF_privileged, &(_d)->domain_flags))
  85.187 +#define IS_CAPABLE_PHYSDEV(_d)                              \
  85.188 +    (test_bit(_DOMF_physdev_access, &(_d)->domain_flags))
  85.189  
  85.190  #define VM_ASSIST(_d,_t) (test_bit((_t), &(_d)->vm_assist))
  85.191