direct-io.hg

changeset 5729:02282ff7cc8c

lose latest digit of the sparse tree for 2.4
linux-2.4.30-xen-sparse is now linux-2.4-xen-sparse

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vh249@kneesaa.uk.xensource.com
date Mon Jul 11 09:29:56 2005 -0500 (2005-07-11)
parents c3c51a34c924
children 22541999d8bb
files buildconfigs/mk.linux-2.4-xenU linux-2.4-xen-sparse/Makefile linux-2.4-xen-sparse/arch/xen/Makefile linux-2.4-xen-sparse/arch/xen/boot/Makefile linux-2.4-xen-sparse/arch/xen/config.in linux-2.4-xen-sparse/arch/xen/defconfig-xen0 linux-2.4-xen-sparse/arch/xen/defconfig-xenU linux-2.4-xen-sparse/arch/xen/drivers/balloon/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/backend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/common.h linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c linux-2.4-xen-sparse/arch/xen/drivers/console/Makefile linux-2.4-xen-sparse/arch/xen/drivers/dom0/Makefile linux-2.4-xen-sparse/arch/xen/drivers/evtchn/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/backend/Makefile linux-2.4-xen-sparse/arch/xen/drivers/netif/frontend/Makefile linux-2.4-xen-sparse/arch/xen/kernel/Makefile linux-2.4-xen-sparse/arch/xen/kernel/entry.S linux-2.4-xen-sparse/arch/xen/kernel/head.S linux-2.4-xen-sparse/arch/xen/kernel/i386_ksyms.c linux-2.4-xen-sparse/arch/xen/kernel/irq.c linux-2.4-xen-sparse/arch/xen/kernel/ldt.c linux-2.4-xen-sparse/arch/xen/kernel/pci-pc.c linux-2.4-xen-sparse/arch/xen/kernel/process.c linux-2.4-xen-sparse/arch/xen/kernel/setup.c linux-2.4-xen-sparse/arch/xen/kernel/signal.c linux-2.4-xen-sparse/arch/xen/kernel/time.c linux-2.4-xen-sparse/arch/xen/kernel/traps.c linux-2.4-xen-sparse/arch/xen/lib/Makefile linux-2.4-xen-sparse/arch/xen/lib/delay.c linux-2.4-xen-sparse/arch/xen/mm/Makefile linux-2.4-xen-sparse/arch/xen/mm/fault.c linux-2.4-xen-sparse/arch/xen/mm/init.c linux-2.4-xen-sparse/arch/xen/mm/ioremap.c linux-2.4-xen-sparse/arch/xen/vmlinux.lds linux-2.4-xen-sparse/drivers/block/ll_rw_blk.c linux-2.4-xen-sparse/drivers/char/Makefile linux-2.4-xen-sparse/drivers/char/mem.c linux-2.4-xen-sparse/drivers/char/tty_io.c linux-2.4-xen-sparse/drivers/scsi/aic7xxx/Makefile linux-2.4-xen-sparse/include/asm-xen/bugs.h linux-2.4-xen-sparse/include/asm-xen/desc.h linux-2.4-xen-sparse/include/asm-xen/fixmap.h linux-2.4-xen-sparse/include/asm-xen/highmem.h linux-2.4-xen-sparse/include/asm-xen/hw_irq.h linux-2.4-xen-sparse/include/asm-xen/io.h linux-2.4-xen-sparse/include/asm-xen/irq.h linux-2.4-xen-sparse/include/asm-xen/keyboard.h linux-2.4-xen-sparse/include/asm-xen/mmu_context.h linux-2.4-xen-sparse/include/asm-xen/module.h linux-2.4-xen-sparse/include/asm-xen/page.h linux-2.4-xen-sparse/include/asm-xen/pci.h linux-2.4-xen-sparse/include/asm-xen/pgalloc.h linux-2.4-xen-sparse/include/asm-xen/pgtable-2level.h linux-2.4-xen-sparse/include/asm-xen/pgtable.h linux-2.4-xen-sparse/include/asm-xen/processor.h linux-2.4-xen-sparse/include/asm-xen/queues.h linux-2.4-xen-sparse/include/asm-xen/segment.h linux-2.4-xen-sparse/include/asm-xen/smp.h linux-2.4-xen-sparse/include/asm-xen/system.h linux-2.4-xen-sparse/include/asm-xen/vga.h linux-2.4-xen-sparse/include/asm-xen/xor.h linux-2.4-xen-sparse/include/linux/blk.h linux-2.4-xen-sparse/include/linux/highmem.h linux-2.4-xen-sparse/include/linux/irq.h linux-2.4-xen-sparse/include/linux/mm.h linux-2.4-xen-sparse/include/linux/sched.h linux-2.4-xen-sparse/include/linux/skbuff.h linux-2.4-xen-sparse/include/linux/timer.h linux-2.4-xen-sparse/kernel/time.c linux-2.4-xen-sparse/kernel/timer.c linux-2.4-xen-sparse/mkbuildtree linux-2.4-xen-sparse/mm/highmem.c linux-2.4-xen-sparse/mm/memory.c linux-2.4-xen-sparse/mm/mprotect.c linux-2.4-xen-sparse/mm/mremap.c linux-2.4-xen-sparse/mm/page_alloc.c linux-2.4-xen-sparse/net/core/skbuff.c
line diff
     1.1 --- a/buildconfigs/mk.linux-2.4-xenU	Mon Jul 11 09:25:11 2005 -0500
     1.2 +++ b/buildconfigs/mk.linux-2.4-xenU	Mon Jul 11 09:29:56 2005 -0500
     1.3 @@ -2,6 +2,7 @@
     1.4  OS           = linux
     1.5  
     1.6  LINUX_SERIES = 2.4
     1.7 +LINUX_VER    = 2.4.30
     1.8  
     1.9  EXTRAVERSION = xenU
    1.10  
    1.11 @@ -19,11 +20,11 @@ build: $(LINUX_DIR)/include/linux/autoco
    1.12  	fi
    1.13  	$(MAKE) -C $(LINUX_DIR) ARCH=xen INSTALL_PATH=$(DESTDIR) install
    1.14  
    1.15 -$(LINUX_DIR)/include/linux/autoconf.h: ref-linux-$(LINUX_VER)/.valid-ref
    1.16 +$(LINUX_DIR)/include/linux/autoconf.h: ref-$(OS)-$(LINUX_VER)/.valid-ref
    1.17  	rm -rf $(LINUX_DIR)
    1.18  	cp -al $(<D) $(LINUX_DIR)
    1.19  	# Apply arch-xen patches
    1.20 -	( cd linux-$(LINUX_VER)-xen-sparse ; \
    1.21 +	( cd linux-$(LINUX_SERIES)-xen-sparse ; \
    1.22            ./mkbuildtree ../$(LINUX_DIR) )
    1.23  	# Re-use config from install dir if one exits else use default config
    1.24  	CONFIG_VERSION=$$(sed -ne 's/^EXTRAVERSION = //p' $(LINUX_DIR)/Makefile); \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.4-xen-sparse/Makefile	Mon Jul 11 09:29:56 2005 -0500
     2.3 @@ -0,0 +1,592 @@
     2.4 +VERSION = 2
     2.5 +PATCHLEVEL = 4
     2.6 +SUBLEVEL = 30
     2.7 +EXTRAVERSION =
     2.8 +
     2.9 +KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
    2.10 +
    2.11 +# SUBARCH always tells us the underlying machine architecture.
    2.12 +# Unless overridden, by default ARCH is equivalent to SUBARCH.
    2.13 +# This will be overriden for Xen and UML builds.
    2.14 +SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
    2.15 +ARCH ?= $(SUBARCH)
    2.16 +
    2.17 +## XXX The following hack can be discarded after users have adjusted to the
    2.18 +## architectural name change 'xeno' -> 'xen'.
    2.19 +ifeq ($(ARCH),xeno)
    2.20 +  ARCH := xen
    2.21 +endif
    2.22 +
    2.23 +KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
    2.24 +
    2.25 +CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
    2.26 +	  else if [ -x /bin/bash ]; then echo /bin/bash; \
    2.27 +	  else echo sh; fi ; fi)
    2.28 +TOPDIR	:= $(shell /bin/pwd)
    2.29 +
    2.30 +HPATH   	= $(TOPDIR)/include
    2.31 +FINDHPATH	= $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net $(HPATH)/math-emu
    2.32 +
    2.33 +HOSTCC  	= gcc
    2.34 +HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
    2.35 +
    2.36 +CROSS_COMPILE 	=
    2.37 +
    2.38 +#
    2.39 +# Include the make variables (CC, etc...)
    2.40 +#
    2.41 +
    2.42 +AS		= $(CROSS_COMPILE)as
    2.43 +LD		= $(CROSS_COMPILE)ld
    2.44 +CC		= $(CROSS_COMPILE)gcc
    2.45 +CPP		= $(CC) -E
    2.46 +AR		= $(CROSS_COMPILE)ar
    2.47 +NM		= $(CROSS_COMPILE)nm
    2.48 +STRIP		= $(CROSS_COMPILE)strip
    2.49 +OBJCOPY		= $(CROSS_COMPILE)objcopy
    2.50 +OBJDUMP		= $(CROSS_COMPILE)objdump
    2.51 +MAKEFILES	= $(TOPDIR)/.config
    2.52 +GENKSYMS	= /sbin/genksyms
    2.53 +DEPMOD		= /sbin/depmod
    2.54 +MODFLAGS	= -DMODULE
    2.55 +CFLAGS_KERNEL	=
    2.56 +PERL		= perl
    2.57 +AWK		= awk
    2.58 +RPM 		:= $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
    2.59 +		    	else echo rpm; fi)
    2.60 +
    2.61 +export	VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
    2.62 +	CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
    2.63 +	CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS MODFLAGS PERL AWK
    2.64 +
    2.65 +all:	do-it-all
    2.66 +
    2.67 +#
    2.68 +# Make "config" the default target if there is no configuration file or
    2.69 +# "depend" the target if there is no top-level dependency information.
    2.70 +#
    2.71 +
    2.72 +ifeq (.config,$(wildcard .config))
    2.73 +include .config
    2.74 +ifeq (.depend,$(wildcard .depend))
    2.75 +include .depend
    2.76 +do-it-all:	Version vmlinux
    2.77 +else
    2.78 +CONFIGURATION = depend
    2.79 +do-it-all:	depend
    2.80 +endif
    2.81 +else
    2.82 +CONFIGURATION = config
    2.83 +do-it-all:	config
    2.84 +endif
    2.85 +
    2.86 +#
    2.87 +# INSTALL_PATH specifies where to place the updated kernel and system map
    2.88 +# images.  Uncomment if you want to place them anywhere other than root.
    2.89 +#
    2.90 +
    2.91 +#export	INSTALL_PATH=/boot
    2.92 +
    2.93 +#
    2.94 +# INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory
    2.95 +# relocations required by build roots.  This is not defined in the
    2.96 +# makefile but the arguement can be passed to make if needed.
    2.97 +#
    2.98 +
    2.99 +MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
   2.100 +export MODLIB
   2.101 +
   2.102 +#
   2.103 +# standard CFLAGS
   2.104 +#
   2.105 +
   2.106 +CPPFLAGS := -D__KERNEL__ -I$(HPATH)
   2.107 +
   2.108 +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
   2.109 +	  -fno-strict-aliasing -fno-common
   2.110 +ifndef CONFIG_FRAME_POINTER
   2.111 +CFLAGS += -fomit-frame-pointer
   2.112 +endif
   2.113 +AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
   2.114 +
   2.115 +#
   2.116 +# ROOT_DEV specifies the default root-device when making the image.
   2.117 +# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
   2.118 +# the default of FLOPPY is used by 'build'.
   2.119 +# This is i386 specific.
   2.120 +#
   2.121 +
   2.122 +export ROOT_DEV = CURRENT
   2.123 +
   2.124 +#
   2.125 +# If you want to preset the SVGA mode, uncomment the next line and
   2.126 +# set SVGA_MODE to whatever number you want.
   2.127 +# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
   2.128 +# The number is the same as you would ordinarily press at bootup.
   2.129 +# This is i386 specific.
   2.130 +#
   2.131 +
   2.132 +export SVGA_MODE = -DSVGA_MODE=NORMAL_VGA
   2.133 +
   2.134 +#
   2.135 +# If you want the RAM disk device, define this to be the size in blocks.
   2.136 +# This is i386 specific.
   2.137 +#
   2.138 +
   2.139 +#export RAMDISK = -DRAMDISK=512
   2.140 +
   2.141 +CORE_FILES	=kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
   2.142 +NETWORKS	=net/network.o
   2.143 +
   2.144 +LIBS		=$(TOPDIR)/lib/lib.a
   2.145 +SUBDIRS		=kernel drivers mm fs net ipc lib crypto
   2.146 +
   2.147 +DRIVERS-n :=
   2.148 +DRIVERS-y :=
   2.149 +DRIVERS-m :=
   2.150 +DRIVERS-  :=
   2.151 +
   2.152 +DRIVERS-$(CONFIG_ACPI_BOOT) += drivers/acpi/acpi.o
   2.153 +DRIVERS-$(CONFIG_PARPORT) += drivers/parport/driver.o
   2.154 +DRIVERS-y += drivers/char/char.o \
   2.155 +	drivers/block/block.o \
   2.156 +	drivers/misc/misc.o \
   2.157 +	drivers/net/net.o
   2.158 +DRIVERS-$(CONFIG_AGP) += drivers/char/agp/agp.o
   2.159 +DRIVERS-$(CONFIG_DRM_NEW) += drivers/char/drm/drm.o
   2.160 +DRIVERS-$(CONFIG_DRM_OLD) += drivers/char/drm-4.0/drm.o
   2.161 +DRIVERS-$(CONFIG_NUBUS) += drivers/nubus/nubus.a
   2.162 +DRIVERS-$(CONFIG_NET_FC) += drivers/net/fc/fc.o
   2.163 +DRIVERS-$(CONFIG_DEV_APPLETALK) += drivers/net/appletalk/appletalk.o
   2.164 +DRIVERS-$(CONFIG_TR) += drivers/net/tokenring/tr.o
   2.165 +DRIVERS-$(CONFIG_WAN) += drivers/net/wan/wan.o
   2.166 +DRIVERS-$(CONFIG_ARCNET) += drivers/net/arcnet/arcnetdrv.o
   2.167 +DRIVERS-$(CONFIG_ATM) += drivers/atm/atm.o
   2.168 +DRIVERS-$(CONFIG_IDE) += drivers/ide/idedriver.o
   2.169 +DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
   2.170 +DRIVERS-$(CONFIG_SCSI) += drivers/scsi/scsidrv.o
   2.171 +DRIVERS-$(CONFIG_FUSION_BOOT) += drivers/message/fusion/fusion.o
   2.172 +DRIVERS-$(CONFIG_IEEE1394) += drivers/ieee1394/ieee1394drv.o
   2.173 +
   2.174 +ifneq ($(CONFIG_CD_NO_IDESCSI)$(CONFIG_BLK_DEV_IDECD)$(CONFIG_BLK_DEV_SR)$(CONFIG_PARIDE_PCD),)
   2.175 +DRIVERS-y += drivers/cdrom/driver.o
   2.176 +endif
   2.177 +
   2.178 +DRIVERS-$(CONFIG_SOUND) += drivers/sound/sounddrivers.o
   2.179 +DRIVERS-$(CONFIG_PCI) += drivers/pci/driver.o
   2.180 +DRIVERS-$(CONFIG_MTD) += drivers/mtd/mtdlink.o
   2.181 +DRIVERS-$(CONFIG_PCMCIA) += drivers/pcmcia/pcmcia.o
   2.182 +DRIVERS-$(CONFIG_NET_PCMCIA) += drivers/net/pcmcia/pcmcia_net.o
   2.183 +DRIVERS-$(CONFIG_NET_WIRELESS) += drivers/net/wireless/wireless_net.o
   2.184 +DRIVERS-$(CONFIG_PCMCIA_CHRDEV) += drivers/char/pcmcia/pcmcia_char.o
   2.185 +DRIVERS-$(CONFIG_DIO) += drivers/dio/dio.a
   2.186 +DRIVERS-$(CONFIG_SBUS) += drivers/sbus/sbus_all.o
   2.187 +DRIVERS-$(CONFIG_ZORRO) += drivers/zorro/driver.o
   2.188 +DRIVERS-$(CONFIG_FC4) += drivers/fc4/fc4.a
   2.189 +DRIVERS-$(CONFIG_PPC32) += drivers/macintosh/macintosh.o
   2.190 +DRIVERS-$(CONFIG_MAC) += drivers/macintosh/macintosh.o
   2.191 +DRIVERS-$(CONFIG_ISAPNP) += drivers/pnp/pnp.o
   2.192 +DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o
   2.193 +DRIVERS-$(CONFIG_VT) += drivers/video/video.o
   2.194 +DRIVERS-$(CONFIG_PARIDE) += drivers/block/paride/paride.a
   2.195 +DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o
   2.196 +DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a
   2.197 +DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o
   2.198 +DRIVERS-$(CONFIG_USB_GADGET) += drivers/usb/gadget/built-in.o
   2.199 +DRIVERS-y +=drivers/media/media.o
   2.200 +DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o
   2.201 +DRIVERS-$(CONFIG_HIL) += drivers/hil/hil.o
   2.202 +DRIVERS-$(CONFIG_I2O) += drivers/message/i2o/i2o.o
   2.203 +DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda.o
   2.204 +DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.o
   2.205 +DRIVERS-$(CONFIG_MD) += drivers/md/mddev.o
   2.206 +DRIVERS-$(CONFIG_GSC) += drivers/gsc/gscbus.o
   2.207 +DRIVERS-$(CONFIG_BLUEZ) += drivers/bluetooth/bluetooth.o
   2.208 +DRIVERS-$(CONFIG_HOTPLUG_PCI) += drivers/hotplug/vmlinux-obj.o
   2.209 +DRIVERS-$(CONFIG_ISDN_BOOL) += drivers/isdn/vmlinux-obj.o
   2.210 +DRIVERS-$(CONFIG_CRYPTO) += crypto/crypto.o
   2.211 +
   2.212 +DRIVERS := $(DRIVERS-y)
   2.213 +
   2.214 +
   2.215 +# files removed with 'make clean'
   2.216 +CLEAN_FILES = \
   2.217 +	kernel/ksyms.lst include/linux/compile.h \
   2.218 +	vmlinux System.map \
   2.219 +	.tmp* \
   2.220 +	drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \
   2.221 +	drivers/char/conmakehash \
   2.222 +	drivers/char/drm/*-mod.c \
   2.223 +	drivers/pci/devlist.h drivers/pci/classlist.h drivers/pci/gen-devlist \
   2.224 +	drivers/zorro/devlist.h drivers/zorro/gen-devlist \
   2.225 +	drivers/sound/bin2hex drivers/sound/hex2hex \
   2.226 +	drivers/atm/fore200e_mkfirm drivers/atm/{pca,sba}*{.bin,.bin1,.bin2} \
   2.227 +	drivers/scsi/aic7xxx/aicasm/aicasm \
   2.228 +	drivers/scsi/aic7xxx/aicasm/aicasm_gram.c \
   2.229 +	drivers/scsi/aic7xxx/aicasm/aicasm_gram.h \
   2.230 +	drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.c \
   2.231 +	drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.h \
   2.232 +	drivers/scsi/aic7xxx/aicasm/aicasm_macro_scan.c \
   2.233 +	drivers/scsi/aic7xxx/aicasm/aicasm_scan.c \
   2.234 +	drivers/scsi/aic7xxx/aicasm/aicdb.h \
   2.235 +	drivers/scsi/aic7xxx/aicasm/y.tab.h \
   2.236 +	drivers/scsi/53c700_d.h \
   2.237 +	drivers/tc/lk201-map.c \
   2.238 +	net/khttpd/make_times_h \
   2.239 +	net/khttpd/times.h \
   2.240 +	submenu* \
   2.241 +	drivers/ieee1394/oui.c
   2.242 +# directories removed with 'make clean'
   2.243 +CLEAN_DIRS = \
   2.244 +	modules
   2.245 +
   2.246 +# files removed with 'make mrproper'
   2.247 +MRPROPER_FILES = \
   2.248 +	include/linux/autoconf.h include/linux/version.h \
   2.249 +	lib/crc32table.h lib/gen_crc32table \
   2.250 +	drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h \
   2.251 +	drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h \
   2.252 +	drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h \
   2.253 +	drivers/net/hamradio/soundmodem/gentbl \
   2.254 +	drivers/sound/*_boot.h drivers/sound/.*.boot \
   2.255 +	drivers/sound/msndinit.c \
   2.256 +	drivers/sound/msndperm.c \
   2.257 +	drivers/sound/pndsperm.c \
   2.258 +	drivers/sound/pndspini.c \
   2.259 +	drivers/atm/fore200e_*_fw.c drivers/atm/.fore200e_*.fw \
   2.260 +	.version .config* config.in config.old \
   2.261 +	scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp \
   2.262 +	scripts/lxdialog/*.o scripts/lxdialog/lxdialog \
   2.263 +	.menuconfig.log \
   2.264 +	include/asm \
   2.265 +	.hdepend scripts/mkdep scripts/split-include scripts/docproc \
   2.266 +	$(TOPDIR)/include/linux/modversions.h \
   2.267 +	kernel.spec
   2.268 +
   2.269 +# directories removed with 'make mrproper'
   2.270 +MRPROPER_DIRS = \
   2.271 +	include/config \
   2.272 +	$(TOPDIR)/include/linux/modules
   2.273 +
   2.274 +
   2.275 +include arch/$(ARCH)/Makefile
   2.276 +
   2.277 +# Extra cflags for kbuild 2.4.  The default is to forbid includes by kernel code
   2.278 +# from user space headers.  Some UML code requires user space headers, in the
   2.279 +# UML Makefiles add 'kbuild_2_4_nostdinc :=' before include Rules.make.  No
   2.280 +# other kernel code should include user space headers, if you need
   2.281 +# 'kbuild_2_4_nostdinc :=' or -I/usr/include for kernel code and you are not UML
   2.282 +# then your code is broken!  KAO.
   2.283 +
   2.284 +kbuild_2_4_nostdinc	:= -nostdinc -iwithprefix include
   2.285 +export kbuild_2_4_nostdinc
   2.286 +
   2.287 +export	CPPFLAGS CFLAGS CFLAGS_KERNEL AFLAGS AFLAGS_KERNEL
   2.288 +
   2.289 +export	NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
   2.290 +
   2.291 +.S.s:
   2.292 +	$(CPP) $(AFLAGS) $(AFLAGS_KERNEL) -traditional -o $*.s $<
   2.293 +.S.o:
   2.294 +	$(CC) $(AFLAGS) $(AFLAGS_KERNEL) -traditional -c -o $*.o $<
   2.295 +
   2.296 +Version: dummy
   2.297 +	@rm -f include/linux/compile.h
   2.298 +
   2.299 +boot: vmlinux
   2.300 +	@$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C arch/$(ARCH)/boot
   2.301 +
   2.302 +vmlinux: include/linux/version.h $(CONFIGURATION) init/main.o init/version.o init/do_mounts.o linuxsubdirs
   2.303 +	$(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o init/do_mounts.o \
   2.304 +		--start-group \
   2.305 +		$(CORE_FILES) \
   2.306 +		$(DRIVERS) \
   2.307 +		$(NETWORKS) \
   2.308 +		$(LIBS) \
   2.309 +		--end-group \
   2.310 +		-o vmlinux
   2.311 +	$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
   2.312 +
   2.313 +symlinks:
   2.314 +	rm -f include/asm
   2.315 +	( cd include ; ln -sf asm-$(ARCH) asm)
   2.316 +	@if [ ! -d include/linux/modules ]; then \
   2.317 +		mkdir include/linux/modules; \
   2.318 +	fi
   2.319 +
   2.320 +oldconfig: symlinks
   2.321 +	$(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
   2.322 +
   2.323 +xconfig: symlinks
   2.324 +	$(MAKE) -C scripts kconfig.tk
   2.325 +	wish -f scripts/kconfig.tk
   2.326 +
   2.327 +menuconfig: include/linux/version.h symlinks
   2.328 +	$(MAKE) -C scripts/lxdialog all
   2.329 +	$(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
   2.330 +
   2.331 +config: symlinks
   2.332 +	$(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
   2.333 +
   2.334 +include/config/MARKER: scripts/split-include include/linux/autoconf.h
   2.335 +	scripts/split-include include/linux/autoconf.h include/config
   2.336 +	@ touch include/config/MARKER
   2.337 +
   2.338 +linuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
   2.339 +
   2.340 +$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER
   2.341 +	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C $(patsubst _dir_%, %, $@)
   2.342 +
   2.343 +$(TOPDIR)/include/linux/version.h: include/linux/version.h
   2.344 +$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
   2.345 +
   2.346 +newversion:
   2.347 +	. scripts/mkversion > .tmpversion
   2.348 +	@mv -f .tmpversion .version
   2.349 +
   2.350 +uts_len		:= 64
   2.351 +uts_truncate	:= sed -e 's/\(.\{1,$(uts_len)\}\).*/\1/'
   2.352 +
   2.353 +include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
   2.354 +	@echo -n \#`cat .version` > .ver1
   2.355 +	@if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver1; fi
   2.356 +	@if [ -f .name ]; then  echo -n \-`cat .name` >> .ver1; fi
   2.357 +	@LANG=C echo ' '`date` >> .ver1
   2.358 +	@echo \#define UTS_VERSION \"`cat .ver1 | $(uts_truncate)`\" > .ver
   2.359 +	@LANG=C echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
   2.360 +	@echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
   2.361 +	@echo \#define LINUX_COMPILE_HOST \"`hostname | $(uts_truncate)`\" >> .ver
   2.362 +	@([ -x /bin/dnsdomainname ] && /bin/dnsdomainname > .ver1) || \
   2.363 +	 ([ -x /bin/domainname ] && /bin/domainname > .ver1) || \
   2.364 +	 echo > .ver1
   2.365 +	@echo \#define LINUX_COMPILE_DOMAIN \"`cat .ver1 | $(uts_truncate)`\" >> .ver
   2.366 +	@echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -n 1`\" >> .ver
   2.367 +	@mv -f .ver $@
   2.368 +	@rm -f .ver1
   2.369 +
   2.370 +include/linux/version.h: ./Makefile
   2.371 +	@expr length "$(KERNELRELEASE)" \<= $(uts_len) > /dev/null || \
   2.372 +	  (echo KERNELRELEASE \"$(KERNELRELEASE)\" exceeds $(uts_len) characters >&2; false)
   2.373 +	@echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver
   2.374 +	@echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
   2.375 +	@echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver
   2.376 +	@mv -f .ver $@
   2.377 +
   2.378 +comma	:= ,
   2.379 +
   2.380 +init/version.o: init/version.c include/linux/compile.h include/config/MARKER
   2.381 +	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(SUBARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c
   2.382 +
   2.383 +init/main.o: init/main.c include/config/MARKER
   2.384 +	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $@ $<
   2.385 +
   2.386 +init/do_mounts.o: init/do_mounts.c include/config/MARKER
   2.387 +	$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $@ $<
   2.388 +
   2.389 +fs lib mm ipc kernel drivers net: dummy
   2.390 +	$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)
   2.391 +
   2.392 +TAGS: dummy
   2.393 +	{ find include/asm-${ARCH} -name '*.h' -print ; \
   2.394 +	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print ; \
   2.395 +	find $(SUBDIRS) init arch/${ARCH} -name '*.[chS]' ; } | grep -v SCCS | grep -v '\.svn' | etags -
   2.396 +
   2.397 +# Exuberant ctags works better with -I
   2.398 +tags: dummy
   2.399 +	CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
   2.400 +	ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
   2.401 +	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
   2.402 +	find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -a
   2.403 +
   2.404 +ifdef CONFIG_MODULES
   2.405 +ifdef CONFIG_MODVERSIONS
   2.406 +MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
   2.407 +endif
   2.408 +
   2.409 +.PHONY: modules
   2.410 +modules: $(patsubst %, _mod_%, $(SUBDIRS))
   2.411 +
   2.412 +.PHONY: $(patsubst %, _mod_%, $(SUBDIRS))
   2.413 +$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER
   2.414 +	$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
   2.415 +
   2.416 +.PHONY: modules_install
   2.417 +modules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post
   2.418 +
   2.419 +.PHONY: _modinst_
   2.420 +_modinst_:
   2.421 +	@rm -rf $(MODLIB)/kernel
   2.422 +	@rm -f $(MODLIB)/build
   2.423 +	@mkdir -p $(MODLIB)/kernel
   2.424 +	@ln -s $(TOPDIR) $(MODLIB)/build
   2.425 +
   2.426 +# If System.map exists, run depmod.  This deliberately does not have a
   2.427 +# dependency on System.map since that would run the dependency tree on
   2.428 +# vmlinux.  This depmod is only for convenience to give the initial
   2.429 +# boot a modules.dep even before / is mounted read-write.  However the
   2.430 +# boot script depmod is the master version.
   2.431 +ifeq "$(strip $(INSTALL_MOD_PATH))" ""
   2.432 +depmod_opts	:=
   2.433 +else
   2.434 +depmod_opts	:= -b $(INSTALL_MOD_PATH) -r
   2.435 +endif
   2.436 +.PHONY: _modinst_post
   2.437 +_modinst_post: _modinst_post_pcmcia
   2.438 +	if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi
   2.439 +
   2.440 +# Backwards compatibilty symlinks for people still using old versions
   2.441 +# of pcmcia-cs with hard coded pathnames on insmod.  Remove
   2.442 +# _modinst_post_pcmcia for kernel 2.4.1.
   2.443 +.PHONY: _modinst_post_pcmcia
   2.444 +_modinst_post_pcmcia:
   2.445 +	cd $(MODLIB); \
   2.446 +	mkdir -p pcmcia; \
   2.447 +	find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia
   2.448 +
   2.449 +.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
   2.450 +$(patsubst %, _modinst_%, $(SUBDIRS)) :
   2.451 +	$(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install
   2.452 +
   2.453 +# modules disabled....
   2.454 +
   2.455 +else
   2.456 +modules modules_install: dummy
   2.457 +	@echo
   2.458 +	@echo "The present kernel configuration has modules disabled."
   2.459 +	@echo "Type 'make config' and enable loadable module support."
   2.460 +	@echo "Then build a kernel with module support enabled."
   2.461 +	@echo
   2.462 +	@exit 1
   2.463 +endif
   2.464 +
   2.465 +clean:	archclean
   2.466 +	find . \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \
   2.467 +		| grep -v lxdialog/ | xargs rm -f
   2.468 +	rm -f $(CLEAN_FILES)
   2.469 +	rm -rf $(CLEAN_DIRS)
   2.470 +	$(MAKE) -C Documentation/DocBook clean
   2.471 +
   2.472 +mrproper: clean archmrproper
   2.473 +	find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
   2.474 +	rm -f $(MRPROPER_FILES)
   2.475 +	rm -rf $(MRPROPER_DIRS)
   2.476 +	$(MAKE) -C Documentation/DocBook mrproper
   2.477 +
   2.478 +distclean: mrproper
   2.479 +	rm -f core `find . \( -not -type d \) -and \
   2.480 +		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
   2.481 +		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
   2.482 +		-o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tags
   2.483 +
   2.484 +backup: mrproper
   2.485 +	cd .. && tar cf - linux/ | gzip -9 > backup.gz
   2.486 +	sync
   2.487 +
   2.488 +sgmldocs: 
   2.489 +	chmod 755 $(TOPDIR)/scripts/docgen
   2.490 +	chmod 755 $(TOPDIR)/scripts/gen-all-syms
   2.491 +	chmod 755 $(TOPDIR)/scripts/kernel-doc
   2.492 +	$(MAKE) -C $(TOPDIR)/Documentation/DocBook books
   2.493 +
   2.494 +psdocs: sgmldocs
   2.495 +	$(MAKE) -C Documentation/DocBook ps
   2.496 +
   2.497 +pdfdocs: sgmldocs
   2.498 +	$(MAKE) -C Documentation/DocBook pdf
   2.499 +
   2.500 +htmldocs: sgmldocs
   2.501 +	$(MAKE) -C Documentation/DocBook html
   2.502 +
   2.503 +mandocs:
   2.504 +	chmod 755 $(TOPDIR)/scripts/kernel-doc
   2.505 +	chmod 755 $(TOPDIR)/scripts/split-man
   2.506 +	$(MAKE) -C Documentation/DocBook man
   2.507 +
   2.508 +sums:
   2.509 +	find . -type f -print | sort | xargs sum > .SUMS
   2.510 +
   2.511 +dep-files: scripts/mkdep archdep include/linux/version.h
   2.512 +	rm -f .depend .hdepend
   2.513 +	$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
   2.514 +ifdef CONFIG_MODVERSIONS
   2.515 +	$(MAKE) update-modverfile
   2.516 +endif
   2.517 +	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
   2.518 +	scripts/mkdep -- init/*.c > .depend
   2.519 +
   2.520 +ifdef CONFIG_MODVERSIONS
   2.521 +MODVERFILE := $(TOPDIR)/include/linux/modversions.h
   2.522 +else
   2.523 +MODVERFILE :=
   2.524 +endif
   2.525 +export	MODVERFILE
   2.526 +
   2.527 +depend dep: dep-files
   2.528 +
   2.529 +checkconfig:
   2.530 +	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.pl
   2.531 +
   2.532 +checkhelp:
   2.533 +	find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.pl
   2.534 +
   2.535 +checkincludes:
   2.536 +	find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
   2.537 +
   2.538 +ifdef CONFIGURATION
   2.539 +..$(CONFIGURATION):
   2.540 +	@echo
   2.541 +	@echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
   2.542 +	@echo
   2.543 +	$(MAKE) $(CONFIGURATION)
   2.544 +	@echo
   2.545 +	@echo "Successful. Try re-making (ignore the error that follows)"
   2.546 +	@echo
   2.547 +	exit 1
   2.548 +
   2.549 +#dummy: ..$(CONFIGURATION)
   2.550 +dummy:
   2.551 +
   2.552 +else
   2.553 +
   2.554 +dummy:
   2.555 +
   2.556 +endif
   2.557 +
   2.558 +include Rules.make
   2.559 +
   2.560 +#
   2.561 +# This generates dependencies for the .h files.
   2.562 +#
   2.563 +
   2.564 +scripts/mkdep: scripts/mkdep.c
   2.565 +	$(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c
   2.566 +
   2.567 +scripts/split-include: scripts/split-include.c
   2.568 +	$(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c
   2.569 +
   2.570 +#
   2.571 +# RPM target
   2.572 +#
   2.573 +#	If you do a make spec before packing the tarball you can rpm -ta it
   2.574 +#
   2.575 +spec:
   2.576 +	. scripts/mkspec >kernel.spec
   2.577 +
   2.578 +#
   2.579 +#	Build a tar ball, generate an rpm from it and pack the result
   2.580 +#	There arw two bits of magic here
   2.581 +#	1) The use of /. to avoid tar packing just the symlink
   2.582 +#	2) Removing the .dep files as they have source paths in them that
   2.583 +#	   will become invalid
   2.584 +#
   2.585 +rpm:	clean spec
   2.586 +	find . \( -size 0 -o -name .depend -o -name .hdepend \) -type f -print | xargs rm -f
   2.587 +	set -e; \
   2.588 +	cd $(TOPDIR)/.. ; \
   2.589 +	ln -sf $(TOPDIR) $(KERNELPATH) ; \
   2.590 +	tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
   2.591 +	rm $(KERNELPATH) ; \
   2.592 +	cd $(TOPDIR) ; \
   2.593 +	. scripts/mkversion > .version ; \
   2.594 +	$(RPM) -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
   2.595 +	rm $(TOPDIR)/../$(KERNELPATH).tar.gz
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/linux-2.4-xen-sparse/arch/xen/Makefile	Mon Jul 11 09:29:56 2005 -0500
     3.3 @@ -0,0 +1,139 @@
     3.4 +#
     3.5 +# xen/Makefile
     3.6 +#
     3.7 +# This file is included by the global makefile so that you can add your own
     3.8 +# architecture-specific flags and dependencies. Remember to do have actions
     3.9 +# for "archclean" and "archdep" for cleaning up and making dependencies for
    3.10 +# this architecture
    3.11 +#
    3.12 +# This file is subject to the terms and conditions of the GNU General Public
    3.13 +# License.  See the file "COPYING" in the main directory of this archive
    3.14 +# for more details.
    3.15 +#
    3.16 +# Copyright (C) 1994 by Linus Torvalds
    3.17 +#
    3.18 +# 19990713  Artur Skawina <skawina@geocities.com>
    3.19 +#           Added '-march' and '-mpreferred-stack-boundary' support
    3.20 +#
    3.21 +
    3.22 +# If no .config file exists then use the appropriate defconfig-* file
    3.23 +ifneq (.config,$(wildcard .config))
    3.24 +DUMMYX:=$(shell cp $(TOPDIR)/arch/xen/defconfig$(EXTRAVERSION) $(TOPDIR)/.config)
    3.25 +-include $(TOPDIR)/.config
    3.26 +endif
    3.27 +
    3.28 +LD=$(CROSS_COMPILE)ld -m elf_i386
    3.29 +OBJCOPY=$(CROSS_COMPILE)objcopy -R .note -R .comment -S
    3.30 +LDFLAGS=-e stext
    3.31 +LINKFLAGS =-T $(TOPDIR)/arch/xen/vmlinux.lds $(LDFLAGS)
    3.32 +
    3.33 +CFLAGS += -pipe
    3.34 +
    3.35 +check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
    3.36 +
    3.37 +# prevent gcc from keeping the stack 16 byte aligned
    3.38 +CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
    3.39 +
    3.40 +ifdef CONFIG_M686
    3.41 +CFLAGS += -march=i686
    3.42 +endif
    3.43 +
    3.44 +ifdef CONFIG_MPENTIUMIII
    3.45 +CFLAGS += -march=i686
    3.46 +endif
    3.47 +
    3.48 +ifdef CONFIG_MPENTIUM4
    3.49 +CFLAGS += -march=i686
    3.50 +endif
    3.51 +
    3.52 +ifdef CONFIG_MK7
    3.53 +CFLAGS += $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
    3.54 +endif
    3.55 +
    3.56 +# Disable unit-at-a-time mode, it makes gcc use a lot more stack
    3.57 +# due to the lack of sharing of stacklots.
    3.58 +CFLAGS += $(call check_gcc,-fno-unit-at-a-time,)
    3.59 +
    3.60 +HEAD := arch/xen/kernel/head.o arch/xen/kernel/init_task.o
    3.61 +
    3.62 +SUBDIRS += arch/xen/kernel arch/xen/mm arch/xen/lib
    3.63 +SUBDIRS += arch/xen/drivers/console 
    3.64 +SUBDIRS += arch/xen/drivers/evtchn
    3.65 +SUBDIRS += arch/xen/drivers/blkif
    3.66 +SUBDIRS += arch/xen/drivers/netif
    3.67 +SUBDIRS += arch/xen/drivers/usbif
    3.68 +SUBDIRS += arch/xen/drivers/balloon
    3.69 +ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.70 +SUBDIRS += arch/xen/drivers/dom0 
    3.71 +endif
    3.72 +
    3.73 +CORE_FILES += arch/xen/kernel/kernel.o arch/xen/mm/mm.o
    3.74 +CORE_FILES += arch/xen/drivers/evtchn/drv.o
    3.75 +CORE_FILES += arch/xen/drivers/console/drv.o
    3.76 +DRIVERS += arch/xen/drivers/blkif/drv.o
    3.77 +DRIVERS += arch/xen/drivers/netif/drv.o
    3.78 +DRIVERS += arch/xen/drivers/usbif/drv.o
    3.79 +ifdef CONFIG_XEN_PRIVILEGED_GUEST
    3.80 +CORE_FILES += arch/xen/drivers/dom0/drv.o
    3.81 +endif
    3.82 +CORE_FILES += arch/xen/drivers/balloon/drv.o
    3.83 +LIBS := $(TOPDIR)/arch/xen/lib/lib.a $(LIBS) $(TOPDIR)/arch/xen/lib/lib.a
    3.84 +
    3.85 +arch/xen/kernel: dummy
    3.86 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/kernel
    3.87 +
    3.88 +arch/xen/mm: dummy
    3.89 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/mm
    3.90 +
    3.91 +arch/xen/drivers/console: dummy
    3.92 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/drivers/console
    3.93 +
    3.94 +arch/xen/drivers/network: dummy
    3.95 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/drivers/network
    3.96 +
    3.97 +arch/xen/drivers/block: dummy
    3.98 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/drivers/block
    3.99 +
   3.100 +arch/xen/drivers/dom0: dummy
   3.101 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/drivers/dom0
   3.102 +
   3.103 +arch/xen/drivers/balloon: dummy
   3.104 +	$(MAKE) linuxsubdirs SUBDIRS=arch/xen/drivers/balloon
   3.105 +
   3.106 +MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
   3.107 +
   3.108 +vmlinux: arch/xen/vmlinux.lds
   3.109 +
   3.110 +FORCE: ;
   3.111 +
   3.112 +.PHONY: bzImage compressed clean archclean archmrproper archdep
   3.113 +
   3.114 +
   3.115 +bzImage: vmlinux
   3.116 +	@$(MAKEBOOT) bzImage
   3.117 +
   3.118 +INSTALL_NAME ?= $(KERNELRELEASE)
   3.119 +install: bzImage
   3.120 +	mkdir -p $(INSTALL_PATH)/boot
   3.121 +	ln -f -s vmlinuz-$(INSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_PATH)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
   3.122 +	rm -f $(INSTALL_PATH)/boot/vmlinuz-$(INSTALL_NAME)$(INSTALL_SUFFIX)
   3.123 +	install -m0644 arch/$(ARCH)/boot/bzImage $(INSTALL_PATH)/boot/vmlinuz-$(INSTALL_NAME)$(INSTALL_SUFFIX)
   3.124 +	install -m0644 vmlinux $(INSTALL_PATH)/boot/vmlinux-syms-$(INSTALL_NAME)$(INSTALL_SUFFIX)
   3.125 +	install -m0664 .config $(INSTALL_PATH)/boot/config-$(INSTALL_NAME)$(INSTALL_SUFFIX)
   3.126 +	install -m0664 System.map $(INSTALL_PATH)/boot/System.map-$(INSTALL_NAME)$(INSTALL_SUFFIX)
   3.127 +	ln -f -s vmlinuz-$(INSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_PATH)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
   3.128 +
   3.129 +%_config: arch/xen/defconfig-%
   3.130 +	rm -f .config arch/xen/defconfig
   3.131 +	cp -f arch/xen/defconfig-$(@:_config=) arch/xen/defconfig
   3.132 +	cp -f arch/xen/defconfig-$(@:_config=) .config
   3.133 +
   3.134 +
   3.135 +archclean:
   3.136 +	@$(MAKEBOOT) clean
   3.137 +
   3.138 +archmrproper:
   3.139 +	rm -f include/asm-xen/xen-public/arch
   3.140 +
   3.141 +archdep:
   3.142 +	@$(MAKEBOOT) dep
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.4-xen-sparse/arch/xen/boot/Makefile	Mon Jul 11 09:29:56 2005 -0500
     4.3 @@ -0,0 +1,13 @@
     4.4 +#
     4.5 +# arch/xen/boot/Makefile
     4.6 +#
     4.7 +
     4.8 +bzImage: $(TOPDIR)/vmlinux
     4.9 +	$(OBJCOPY) $< Image
    4.10 +	gzip -f -9 < Image > $@
    4.11 +	rm -f Image
    4.12 +
    4.13 +dep:
    4.14 +
    4.15 +clean:
    4.16 +	rm -f bzImage Image
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux-2.4-xen-sparse/arch/xen/config.in	Mon Jul 11 09:29:56 2005 -0500
     5.3 @@ -0,0 +1,337 @@
     5.4 +#
     5.5 +# For a description of the syntax of this configuration file,
     5.6 +# see Documentation/kbuild/config-language.txt.
     5.7 +#
     5.8 +mainmenu_name "Linux Kernel Configuration"
     5.9 +
    5.10 +define_bool CONFIG_XEN y
    5.11 +
    5.12 +define_bool CONFIG_X86 y
    5.13 +define_bool CONFIG_ISA y
    5.14 +define_bool CONFIG_SBUS n
    5.15 +
    5.16 +define_bool CONFIG_UID16 y
    5.17 +
    5.18 +mainmenu_option next_comment
    5.19 +comment 'Xen'
    5.20 +bool 'Support for privileged operations (domain 0)' CONFIG_XEN_PRIVILEGED_GUEST
    5.21 +bool 'Device-driver domain (physical device access)' CONFIG_XEN_PHYSDEV_ACCESS
    5.22 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
    5.23 +    bool 'USB-device backend driver' CONFIG_XEN_USB_BACKEND
    5.24 +fi
    5.25 +bool 'Scrub memory before freeing it to Xen' CONFIG_XEN_SCRUB_PAGES
    5.26 +bool 'Network-device frontend driver' CONFIG_XEN_NETDEV_FRONTEND
    5.27 +bool 'Block-device frontend driver' CONFIG_XEN_BLKDEV_FRONTEND
    5.28 +bool 'Block-device uses grant tables' CONFIG_XEN_BLKDEV_GRANT
    5.29 +bool 'USB-device frontend driver' CONFIG_XEN_USB_FRONTEND
    5.30 +endmenu
    5.31 +# The IBM S/390 patch needs this.
    5.32 +define_bool CONFIG_NO_IDLE_HZ y
    5.33 +
    5.34 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
    5.35 +   define_bool CONFIG_FOREIGN_PAGES y
    5.36 +else
    5.37 +   define_bool CONFIG_FOREIGN_PAGES n
    5.38 +   define_bool CONFIG_NETDEVICES y
    5.39 +   define_bool CONFIG_VT n
    5.40 +fi
    5.41 +
    5.42 +mainmenu_option next_comment
    5.43 +comment 'Code maturity level options'
    5.44 +bool 'Prompt for development and/or incomplete code/drivers' CONFIG_EXPERIMENTAL
    5.45 +endmenu
    5.46 +
    5.47 +mainmenu_option next_comment
    5.48 +comment 'Loadable module support'
    5.49 +bool 'Enable loadable module support' CONFIG_MODULES
    5.50 +if [ "$CONFIG_MODULES" = "y" ]; then
    5.51 +   bool '  Set version information on all module symbols' CONFIG_MODVERSIONS
    5.52 +   bool '  Kernel module loader' CONFIG_KMOD
    5.53 +fi
    5.54 +endmenu
    5.55 +
    5.56 +mainmenu_option next_comment
    5.57 +comment 'Processor type and features'
    5.58 +choice 'Processor family' \
    5.59 +	"Pentium-Pro/Celeron/Pentium-II		CONFIG_M686 \
    5.60 +	 Pentium-III/Celeron(Coppermine)	CONFIG_MPENTIUMIII \
    5.61 +	 Pentium-4				CONFIG_MPENTIUM4 \
    5.62 +	 Athlon/Duron/K7			CONFIG_MK7 \
    5.63 +	 Opteron/Athlon64/Hammer/K8             CONFIG_MK8 \
    5.64 +	 VIA-C3-2                               CONFIG_MVIAC3_2" Pentium-Pro
    5.65 +
    5.66 +   define_bool CONFIG_X86_WP_WORKS_OK y
    5.67 +   define_bool CONFIG_X86_INVLPG y
    5.68 +   define_bool CONFIG_X86_CMPXCHG y
    5.69 +   define_bool CONFIG_X86_XADD y
    5.70 +   define_bool CONFIG_X86_BSWAP y
    5.71 +   define_bool CONFIG_X86_POPAD_OK y
    5.72 +   define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n
    5.73 +   define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y
    5.74 +
    5.75 +   define_bool CONFIG_X86_GOOD_APIC y
    5.76 +   define_bool CONFIG_X86_PGE y
    5.77 +   define_bool CONFIG_X86_USE_PPRO_CHECKSUM y
    5.78 +   define_bool CONFIG_X86_TSC y
    5.79 +
    5.80 +if [ "$CONFIG_M686" = "y" ]; then
    5.81 +   define_int  CONFIG_X86_L1_CACHE_SHIFT 5
    5.82 +fi
    5.83 +if [ "$CONFIG_MPENTIUMIII" = "y" ]; then
    5.84 +   define_int  CONFIG_X86_L1_CACHE_SHIFT 5
    5.85 +fi
    5.86 +if [ "$CONFIG_MPENTIUM4" = "y" ]; then
    5.87 +   define_int  CONFIG_X86_L1_CACHE_SHIFT 7
    5.88 +fi
    5.89 +if [ "$CONFIG_MK8" = "y" ]; then
    5.90 +   define_bool CONFIG_MK7 y
    5.91 +fi
    5.92 +if [ "$CONFIG_MK7" = "y" ]; then
    5.93 +   define_int  CONFIG_X86_L1_CACHE_SHIFT 6
    5.94 +   define_bool CONFIG_X86_USE_3DNOW y
    5.95 +fi
    5.96 +if [ "$CONFIG_MVIAC3_2" = "y" ]; then
    5.97 +   define_int  CONFIG_X86_L1_CACHE_SHIFT 5
    5.98 +fi
    5.99 +
   5.100 +#if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
   5.101 +#   tristate 'BIOS Enhanced Disk Drive calls determine boot disk (EXPERIMENTAL)' CONFIG_EDD
   5.102 +#fi
   5.103 +
   5.104 +choice 'High Memory Support' \
   5.105 +	"off    CONFIG_NOHIGHMEM \
   5.106 +	 4GB    CONFIG_HIGHMEM4G" off
   5.107 +#	 64GB   CONFIG_HIGHMEM64G" off
   5.108 +if [ "$CONFIG_HIGHMEM4G" = "y" ]; then
   5.109 +   define_bool CONFIG_HIGHMEM y
   5.110 +fi
   5.111 +if [ "$CONFIG_HIGHMEM64G" = "y" ]; then
   5.112 +   define_bool CONFIG_HIGHMEM y
   5.113 +   define_bool CONFIG_X86_PAE y
   5.114 +fi
   5.115 +
   5.116 +if [ "$CONFIG_HIGHMEM" = "y" ]; then
   5.117 +   bool 'HIGHMEM I/O support' CONFIG_HIGHIO
   5.118 +fi
   5.119 +
   5.120 +define_int CONFIG_FORCE_MAX_ZONEORDER 11
   5.121 +
   5.122 +#bool 'Symmetric multi-processing support' CONFIG_SMP
   5.123 +#if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
   5.124 +#   define_bool CONFIG_HAVE_DEC_LOCK y
   5.125 +#fi
   5.126 +endmenu
   5.127 +
   5.128 +mainmenu_option next_comment
   5.129 +comment 'General setup'
   5.130 +
   5.131 +bool 'Networking support' CONFIG_NET
   5.132 +
   5.133 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.134 +   bool 'PCI support' CONFIG_PCI
   5.135 +   source drivers/pci/Config.in
   5.136 +
   5.137 +   bool 'Support for hot-pluggable devices' CONFIG_HOTPLUG
   5.138 +
   5.139 +   if [ "$CONFIG_HOTPLUG" = "y" ] ; then
   5.140 +      source drivers/pcmcia/Config.in
   5.141 +      source drivers/hotplug/Config.in
   5.142 +   else
   5.143 +      define_bool CONFIG_PCMCIA n
   5.144 +      define_bool CONFIG_HOTPLUG_PCI n
   5.145 +   fi
   5.146 +fi
   5.147 +
   5.148 +bool 'System V IPC' CONFIG_SYSVIPC
   5.149 +bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT
   5.150 +bool 'Sysctl support' CONFIG_SYSCTL
   5.151 +if [ "$CONFIG_PROC_FS" = "y" ]; then
   5.152 +   choice 'Kernel core (/proc/kcore) format' \
   5.153 +	"ELF		CONFIG_KCORE_ELF	\
   5.154 +	 A.OUT		CONFIG_KCORE_AOUT" ELF
   5.155 +fi
   5.156 +tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
   5.157 +bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
   5.158 +tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC
   5.159 +bool 'Select task to kill on out of memory condition' CONFIG_OOM_KILLER
   5.160 +
   5.161 +endmenu
   5.162 +
   5.163 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.164 +   source drivers/mtd/Config.in
   5.165 +
   5.166 +   source drivers/parport/Config.in
   5.167 +
   5.168 +   source drivers/pnp/Config.in
   5.169 +
   5.170 +   source drivers/block/Config.in
   5.171 +
   5.172 +   source drivers/md/Config.in
   5.173 +fi
   5.174 +
   5.175 +if [ "$CONFIG_NET" = "y" ]; then
   5.176 +   source net/Config.in
   5.177 +fi
   5.178 +
   5.179 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.180 +   mainmenu_option next_comment
   5.181 +   comment 'ATA/IDE/MFM/RLL support'
   5.182 +
   5.183 +   tristate 'ATA/IDE/MFM/RLL support' CONFIG_IDE
   5.184 +
   5.185 +   if [ "$CONFIG_IDE" != "n" ]; then
   5.186 +      source drivers/ide/Config.in
   5.187 +   else
   5.188 +      define_bool CONFIG_BLK_DEV_HD n
   5.189 +   fi
   5.190 +   endmenu
   5.191 +fi
   5.192 +
   5.193 +mainmenu_option next_comment
   5.194 +comment 'SCSI support'
   5.195 +
   5.196 +tristate 'SCSI support' CONFIG_SCSI
   5.197 +
   5.198 +if [ "$CONFIG_SCSI" != "n" ]; then
   5.199 +   source drivers/scsi/Config.in
   5.200 +fi
   5.201 +endmenu
   5.202 +
   5.203 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.204 +   source drivers/message/fusion/Config.in
   5.205 +
   5.206 +   source drivers/ieee1394/Config.in
   5.207 +
   5.208 +   source drivers/message/i2o/Config.in
   5.209 +
   5.210 +   if [ "$CONFIG_NET" = "y" ]; then
   5.211 +      mainmenu_option next_comment
   5.212 +      comment 'Network device support'
   5.213 +
   5.214 +      bool 'Network device support' CONFIG_NETDEVICES
   5.215 +      if [ "$CONFIG_NETDEVICES" = "y" ]; then
   5.216 +         source drivers/net/Config.in
   5.217 +         if [ "$CONFIG_ATM" = "y" -o "$CONFIG_ATM" = "m" ]; then
   5.218 +            source drivers/atm/Config.in
   5.219 +         fi
   5.220 +      fi
   5.221 +      endmenu
   5.222 +   fi
   5.223 +
   5.224 +   source net/ax25/Config.in
   5.225 +
   5.226 +   source net/irda/Config.in
   5.227 +
   5.228 +   mainmenu_option next_comment
   5.229 +   comment 'ISDN subsystem'
   5.230 +   if [ "$CONFIG_NET" != "n" ]; then
   5.231 +      tristate 'ISDN support' CONFIG_ISDN
   5.232 +      if [ "$CONFIG_ISDN" != "n" ]; then
   5.233 +         source drivers/isdn/Config.in
   5.234 +      fi
   5.235 +   fi
   5.236 +   endmenu
   5.237 +
   5.238 +   if [ "$CONFIG_ISA" = "y" ]; then
   5.239 +       mainmenu_option next_comment
   5.240 +       comment 'Old CD-ROM drivers (not SCSI, not IDE)'
   5.241 +   
   5.242 +       bool 'Support non-SCSI/IDE/ATAPI CDROM drives' CONFIG_CD_NO_IDESCSI
   5.243 +       if [ "$CONFIG_CD_NO_IDESCSI" != "n" ]; then
   5.244 +          source drivers/cdrom/Config.in
   5.245 +       fi
   5.246 +       endmenu
   5.247 +   fi
   5.248 +
   5.249 +   #
   5.250 +   # input before char - char/joystick depends on it. As does USB.
   5.251 +   #
   5.252 +   source drivers/input/Config.in
   5.253 +else
   5.254 +   #
   5.255 +   # Block device driver configuration
   5.256 +   #
   5.257 +   mainmenu_option next_comment
   5.258 +   comment 'Block devices'
   5.259 +   tristate 'Loopback device support' CONFIG_BLK_DEV_LOOP
   5.260 +   dep_tristate 'Network block device support' CONFIG_BLK_DEV_NBD $CONFIG_NET
   5.261 +   tristate 'RAM disk support' CONFIG_BLK_DEV_RAM
   5.262 +   if [ "$CONFIG_BLK_DEV_RAM" = "y" -o "$CONFIG_BLK_DEV_RAM" = "m" ]; then
   5.263 +      int '  Default RAM disk size' CONFIG_BLK_DEV_RAM_SIZE 4096
   5.264 +   fi
   5.265 +   dep_bool '  Initial RAM disk (initrd) support' CONFIG_BLK_DEV_INITRD $CONFIG_BLK_DEV_RAM
   5.266 +   bool 'Per partition statistics in /proc/partitions' CONFIG_BLK_STATS
   5.267 +   define_bool CONFIG_BLK_DEV_HD n
   5.268 +   endmenu
   5.269 +fi
   5.270 +
   5.271 +source drivers/char/Config.in
   5.272 +
   5.273 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" -o "$CONFIG_XEN_USB_FRONTEND" = "y" ]; then
   5.274 +   source drivers/media/Config.in
   5.275 +fi
   5.276 +
   5.277 +source fs/Config.in
   5.278 +
   5.279 +mainmenu_option next_comment
   5.280 +comment 'Console drivers'
   5.281 +
   5.282 +define_bool CONFIG_XEN_CONSOLE y
   5.283 +
   5.284 +if [ "$CONFIG_VT" = "y" ]; then
   5.285 +   bool 'VGA text console' CONFIG_VGA_CONSOLE
   5.286 +   bool 'Dummy console' CONFIG_DUMMY_CONSOLE 
   5.287 +   if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.288 +      bool 'Video mode selection support' CONFIG_VIDEO_SELECT
   5.289 +      if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
   5.290 +         tristate 'MDA text console (dual-headed) (EXPERIMENTAL)' CONFIG_MDA_CONSOLE
   5.291 +         source drivers/video/Config.in
   5.292 +      fi
   5.293 +   fi
   5.294 +fi
   5.295 +endmenu
   5.296 +
   5.297 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.298 +   mainmenu_option next_comment
   5.299 +   comment 'Sound'
   5.300 +
   5.301 +   tristate 'Sound card support' CONFIG_SOUND
   5.302 +   if [ "$CONFIG_SOUND" != "n" ]; then
   5.303 +      source drivers/sound/Config.in
   5.304 +   fi
   5.305 +   endmenu
   5.306 +fi
   5.307 +
   5.308 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" -o "$CONFIG_XEN_USB_FRONTEND" = "y" ]; then
   5.309 +   if [ "$CONFIG_XEN_USB_FRONTEND" = "y" -o "$CONFIG_XEN_USB_BACKEND" = "y" ]; then
   5.310 +       define_bool CONFIG_USB y
   5.311 +   fi
   5.312 +   source drivers/usb/Config.in
   5.313 +fi
   5.314 +
   5.315 +if [ "$CONFIG_XEN_PHYSDEV_ACCESS" = "y" ]; then
   5.316 +   source net/bluetooth/Config.in
   5.317 +fi
   5.318 +
   5.319 +mainmenu_option next_comment
   5.320 +comment 'Kernel hacking'
   5.321 +
   5.322 +bool 'Kernel debugging' CONFIG_DEBUG_KERNEL
   5.323 +if [ "$CONFIG_DEBUG_KERNEL" != "n" ]; then
   5.324 +   bool '  Check for stack overflows' CONFIG_DEBUG_STACKOVERFLOW
   5.325 +   bool '  Debug high memory support' CONFIG_DEBUG_HIGHMEM
   5.326 +   bool '  Debug memory allocations' CONFIG_DEBUG_SLAB
   5.327 +   bool '  Memory mapped I/O debugging' CONFIG_DEBUG_IOVIRT
   5.328 +   bool '  Magic SysRq key' CONFIG_MAGIC_SYSRQ
   5.329 +   bool '  Spinlock debugging' CONFIG_DEBUG_SPINLOCK
   5.330 +   bool '  Verbose BUG() reporting (adds 70K)' CONFIG_DEBUG_BUGVERBOSE
   5.331 +   bool '  Load all symbols for debugging' CONFIG_KALLSYMS
   5.332 +   bool '  Compile the kernel with frame pointers' CONFIG_FRAME_POINTER
   5.333 +fi
   5.334 +
   5.335 +int 'Kernel messages buffer length shift (0 = default)' CONFIG_LOG_BUF_SHIFT 0
   5.336 +
   5.337 +endmenu
   5.338 +
   5.339 +source crypto/Config.in
   5.340 +source lib/Config.in
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux-2.4-xen-sparse/arch/xen/defconfig-xen0	Mon Jul 11 09:29:56 2005 -0500
     6.3 @@ -0,0 +1,927 @@
     6.4 +#
     6.5 +# Automatically generated by make menuconfig: don't edit
     6.6 +#
     6.7 +CONFIG_XEN=y
     6.8 +CONFIG_X86=y
     6.9 +CONFIG_ISA=y
    6.10 +# CONFIG_SBUS is not set
    6.11 +CONFIG_UID16=y
    6.12 +
    6.13 +#
    6.14 +# Xen
    6.15 +#
    6.16 +CONFIG_XEN_PRIVILEGED_GUEST=y
    6.17 +CONFIG_XEN_PHYSDEV_ACCESS=y
    6.18 +# CONFIG_XEN_USB_BACKEND is not set
    6.19 +CONFIG_XEN_SCRUB_PAGES=y
    6.20 +CONFIG_XEN_NETDEV_FRONTEND=y
    6.21 +CONFIG_XEN_BLKDEV_FRONTEND=y
    6.22 +CONFIG_XEN_BLKDEV_GRANT=y
    6.23 +# CONFIG_XEN_USB_FRONTEND is not set
    6.24 +CONFIG_NO_IDLE_HZ=y
    6.25 +CONFIG_FOREIGN_PAGES=y
    6.26 +
    6.27 +#
    6.28 +# Code maturity level options
    6.29 +#
    6.30 +CONFIG_EXPERIMENTAL=y
    6.31 +
    6.32 +#
    6.33 +# Loadable module support
    6.34 +#
    6.35 +CONFIG_MODULES=y
    6.36 +CONFIG_MODVERSIONS=y
    6.37 +CONFIG_KMOD=y
    6.38 +
    6.39 +#
    6.40 +# Processor type and features
    6.41 +#
    6.42 +CONFIG_M686=y
    6.43 +# CONFIG_MPENTIUMIII is not set
    6.44 +# CONFIG_MPENTIUM4 is not set
    6.45 +# CONFIG_MK7 is not set
    6.46 +# CONFIG_MK8 is not set
    6.47 +# CONFIG_MVIAC3_2 is not set
    6.48 +CONFIG_X86_WP_WORKS_OK=y
    6.49 +CONFIG_X86_INVLPG=y
    6.50 +CONFIG_X86_CMPXCHG=y
    6.51 +CONFIG_X86_XADD=y
    6.52 +CONFIG_X86_BSWAP=y
    6.53 +CONFIG_X86_POPAD_OK=y
    6.54 +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
    6.55 +CONFIG_RWSEM_XCHGADD_ALGORITHM=y
    6.56 +CONFIG_X86_GOOD_APIC=y
    6.57 +CONFIG_X86_PGE=y
    6.58 +CONFIG_X86_USE_PPRO_CHECKSUM=y
    6.59 +CONFIG_X86_TSC=y
    6.60 +CONFIG_X86_L1_CACHE_SHIFT=5
    6.61 +CONFIG_NOHIGHMEM=y
    6.62 +# CONFIG_HIGHMEM4G is not set
    6.63 +CONFIG_FORCE_MAX_ZONEORDER=11
    6.64 +
    6.65 +#
    6.66 +# General setup
    6.67 +#
    6.68 +CONFIG_NET=y
    6.69 +CONFIG_PCI=y
    6.70 +CONFIG_PCI_NAMES=y
    6.71 +CONFIG_HOTPLUG=y
    6.72 +
    6.73 +#
    6.74 +# PCMCIA/CardBus support
    6.75 +#
    6.76 +# CONFIG_PCMCIA is not set
    6.77 +
    6.78 +#
    6.79 +# PCI Hotplug Support
    6.80 +#
    6.81 +# CONFIG_HOTPLUG_PCI is not set
    6.82 +# CONFIG_HOTPLUG_PCI_COMPAQ is not set
    6.83 +# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
    6.84 +# CONFIG_HOTPLUG_PCI_SHPC is not set
    6.85 +# CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE is not set
    6.86 +# CONFIG_HOTPLUG_PCI_PCIE is not set
    6.87 +# CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE is not set
    6.88 +CONFIG_SYSVIPC=y
    6.89 +# CONFIG_BSD_PROCESS_ACCT is not set
    6.90 +CONFIG_SYSCTL=y
    6.91 +CONFIG_KCORE_ELF=y
    6.92 +# CONFIG_KCORE_AOUT is not set
    6.93 +CONFIG_BINFMT_AOUT=y
    6.94 +CONFIG_BINFMT_ELF=y
    6.95 +# CONFIG_BINFMT_MISC is not set
    6.96 +# CONFIG_OOM_KILLER is not set
    6.97 +
    6.98 +#
    6.99 +# Memory Technology Devices (MTD)
   6.100 +#
   6.101 +# CONFIG_MTD is not set
   6.102 +
   6.103 +#
   6.104 +# Parallel port support
   6.105 +#
   6.106 +# CONFIG_PARPORT is not set
   6.107 +
   6.108 +#
   6.109 +# Plug and Play configuration
   6.110 +#
   6.111 +CONFIG_PNP=y
   6.112 +# CONFIG_ISAPNP is not set
   6.113 +
   6.114 +#
   6.115 +# Block devices
   6.116 +#
   6.117 +# CONFIG_BLK_DEV_FD is not set
   6.118 +# CONFIG_BLK_DEV_XD is not set
   6.119 +# CONFIG_PARIDE is not set
   6.120 +# CONFIG_BLK_CPQ_DA is not set
   6.121 +# CONFIG_BLK_CPQ_CISS_DA is not set
   6.122 +# CONFIG_CISS_SCSI_TAPE is not set
   6.123 +# CONFIG_CISS_MONITOR_THREAD is not set
   6.124 +# CONFIG_BLK_DEV_DAC960 is not set
   6.125 +# CONFIG_BLK_DEV_UMEM is not set
   6.126 +# CONFIG_BLK_DEV_SX8 is not set
   6.127 +CONFIG_BLK_DEV_LOOP=y
   6.128 +CONFIG_BLK_DEV_NBD=y
   6.129 +CONFIG_BLK_DEV_RAM=y
   6.130 +CONFIG_BLK_DEV_RAM_SIZE=4096
   6.131 +CONFIG_BLK_DEV_INITRD=y
   6.132 +# CONFIG_BLK_STATS is not set
   6.133 +
   6.134 +#
   6.135 +# Multi-device support (RAID and LVM)
   6.136 +#
   6.137 +CONFIG_MD=y
   6.138 +CONFIG_BLK_DEV_MD=y
   6.139 +CONFIG_MD_LINEAR=y
   6.140 +# CONFIG_MD_RAID0 is not set
   6.141 +CONFIG_MD_RAID1=y
   6.142 +# CONFIG_MD_RAID5 is not set
   6.143 +# CONFIG_MD_MULTIPATH is not set
   6.144 +CONFIG_BLK_DEV_LVM=y
   6.145 +
   6.146 +#
   6.147 +# Networking options
   6.148 +#
   6.149 +CONFIG_PACKET=y
   6.150 +CONFIG_PACKET_MMAP=y
   6.151 +# CONFIG_NETLINK_DEV is not set
   6.152 +CONFIG_NETFILTER=y
   6.153 +# CONFIG_NETFILTER_DEBUG is not set
   6.154 +CONFIG_FILTER=y
   6.155 +CONFIG_UNIX=y
   6.156 +CONFIG_INET=y
   6.157 +# CONFIG_IP_MULTICAST is not set
   6.158 +# CONFIG_IP_ADVANCED_ROUTER is not set
   6.159 +CONFIG_IP_PNP=y
   6.160 +CONFIG_IP_PNP_DHCP=y
   6.161 +# CONFIG_IP_PNP_BOOTP is not set
   6.162 +# CONFIG_IP_PNP_RARP is not set
   6.163 +# CONFIG_NET_IPIP is not set
   6.164 +# CONFIG_NET_IPGRE is not set
   6.165 +# CONFIG_ARPD is not set
   6.166 +# CONFIG_INET_ECN is not set
   6.167 +# CONFIG_SYN_COOKIES is not set
   6.168 +
   6.169 +#
   6.170 +#   IP: Netfilter Configuration
   6.171 +#
   6.172 +CONFIG_IP_NF_CONNTRACK=m
   6.173 +CONFIG_IP_NF_FTP=m
   6.174 +# CONFIG_IP_NF_AMANDA is not set
   6.175 +CONFIG_IP_NF_TFTP=m
   6.176 +CONFIG_IP_NF_IRC=m
   6.177 +# CONFIG_IP_NF_QUEUE is not set
   6.178 +CONFIG_IP_NF_IPTABLES=y
   6.179 +# CONFIG_IP_NF_MATCH_LIMIT is not set
   6.180 +# CONFIG_IP_NF_MATCH_MAC is not set
   6.181 +# CONFIG_IP_NF_MATCH_PKTTYPE is not set
   6.182 +# CONFIG_IP_NF_MATCH_MARK is not set
   6.183 +# CONFIG_IP_NF_MATCH_MULTIPORT is not set
   6.184 +# CONFIG_IP_NF_MATCH_TOS is not set
   6.185 +# CONFIG_IP_NF_MATCH_RECENT is not set
   6.186 +# CONFIG_IP_NF_MATCH_ECN is not set
   6.187 +# CONFIG_IP_NF_MATCH_DSCP is not set
   6.188 +# CONFIG_IP_NF_MATCH_AH_ESP is not set
   6.189 +# CONFIG_IP_NF_MATCH_LENGTH is not set
   6.190 +# CONFIG_IP_NF_MATCH_TTL is not set
   6.191 +# CONFIG_IP_NF_MATCH_TCPMSS is not set
   6.192 +# CONFIG_IP_NF_MATCH_HELPER is not set
   6.193 +CONFIG_IP_NF_MATCH_STATE=m
   6.194 +CONFIG_IP_NF_MATCH_CONNTRACK=m
   6.195 +# CONFIG_IP_NF_MATCH_UNCLEAN is not set
   6.196 +# CONFIG_IP_NF_MATCH_OWNER is not set
   6.197 +CONFIG_IP_NF_MATCH_PHYSDEV=y
   6.198 +CONFIG_IP_NF_FILTER=y
   6.199 +CONFIG_IP_NF_TARGET_REJECT=y
   6.200 +# CONFIG_IP_NF_TARGET_MIRROR is not set
   6.201 +CONFIG_IP_NF_NAT=m
   6.202 +CONFIG_IP_NF_NAT_NEEDED=y
   6.203 +CONFIG_IP_NF_TARGET_MASQUERADE=m
   6.204 +CONFIG_IP_NF_TARGET_REDIRECT=m
   6.205 +# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
   6.206 +CONFIG_IP_NF_NAT_IRC=m
   6.207 +CONFIG_IP_NF_NAT_FTP=m
   6.208 +CONFIG_IP_NF_NAT_TFTP=m
   6.209 +# CONFIG_IP_NF_MANGLE is not set
   6.210 +CONFIG_IP_NF_TARGET_LOG=y
   6.211 +CONFIG_IP_NF_TARGET_ULOG=y
   6.212 +# CONFIG_IP_NF_TARGET_TCPMSS is not set
   6.213 +# CONFIG_IP_NF_ARPTABLES is not set
   6.214 +
   6.215 +#
   6.216 +#   IP: Virtual Server Configuration
   6.217 +#
   6.218 +# CONFIG_IP_VS is not set
   6.219 +# CONFIG_IPV6 is not set
   6.220 +# CONFIG_KHTTPD is not set
   6.221 +
   6.222 +#
   6.223 +#    SCTP Configuration (EXPERIMENTAL)
   6.224 +#
   6.225 +# CONFIG_IP_SCTP is not set
   6.226 +# CONFIG_ATM is not set
   6.227 +CONFIG_VLAN_8021Q=y
   6.228 +# CONFIG_IPX is not set
   6.229 +# CONFIG_ATALK is not set
   6.230 +# CONFIG_DECNET is not set
   6.231 +CONFIG_BRIDGE=y
   6.232 +CONFIG_BRIDGE_NF_EBTABLES=m
   6.233 +CONFIG_BRIDGE_EBT_T_FILTER=m
   6.234 +CONFIG_BRIDGE_EBT_T_NAT=m
   6.235 +CONFIG_BRIDGE_EBT_BROUTE=m
   6.236 +CONFIG_BRIDGE_EBT_LOG=m
   6.237 +CONFIG_BRIDGE_EBT_IPF=m
   6.238 +CONFIG_BRIDGE_EBT_ARPF=m
   6.239 +CONFIG_BRIDGE_EBT_AMONG=m
   6.240 +CONFIG_BRIDGE_EBT_LIMIT=m
   6.241 +CONFIG_BRIDGE_EBT_VLANF=m
   6.242 +CONFIG_BRIDGE_EBT_802_3=m
   6.243 +CONFIG_BRIDGE_EBT_PKTTYPE=m
   6.244 +CONFIG_BRIDGE_EBT_STP=m
   6.245 +CONFIG_BRIDGE_EBT_MARKF=m
   6.246 +CONFIG_BRIDGE_EBT_ARPREPLY=m
   6.247 +CONFIG_BRIDGE_EBT_SNAT=m
   6.248 +CONFIG_BRIDGE_EBT_DNAT=m
   6.249 +CONFIG_BRIDGE_EBT_REDIRECT=m
   6.250 +CONFIG_BRIDGE_EBT_MARK_T=m
   6.251 +# CONFIG_X25 is not set
   6.252 +# CONFIG_LAPB is not set
   6.253 +# CONFIG_LLC is not set
   6.254 +# CONFIG_NET_DIVERT is not set
   6.255 +# CONFIG_ECONET is not set
   6.256 +# CONFIG_WAN_ROUTER is not set
   6.257 +# CONFIG_NET_FASTROUTE is not set
   6.258 +# CONFIG_NET_HW_FLOWCONTROL is not set
   6.259 +
   6.260 +#
   6.261 +# QoS and/or fair queueing
   6.262 +#
   6.263 +# CONFIG_NET_SCHED is not set
   6.264 +
   6.265 +#
   6.266 +# Network testing
   6.267 +#
   6.268 +# CONFIG_NET_PKTGEN is not set
   6.269 +
   6.270 +#
   6.271 +# ATA/IDE/MFM/RLL support
   6.272 +#
   6.273 +CONFIG_IDE=y
   6.274 +
   6.275 +#
   6.276 +# IDE, ATA and ATAPI Block devices
   6.277 +#
   6.278 +CONFIG_BLK_DEV_IDE=y
   6.279 +# CONFIG_BLK_DEV_HD_IDE is not set
   6.280 +# CONFIG_BLK_DEV_HD is not set
   6.281 +# CONFIG_BLK_DEV_IDE_SATA is not set
   6.282 +CONFIG_BLK_DEV_IDEDISK=y
   6.283 +CONFIG_IDEDISK_MULTI_MODE=y
   6.284 +CONFIG_IDEDISK_STROKE=y
   6.285 +# CONFIG_BLK_DEV_IDECS is not set
   6.286 +# CONFIG_BLK_DEV_DELKIN is not set
   6.287 +CONFIG_BLK_DEV_IDECD=y
   6.288 +CONFIG_BLK_DEV_IDETAPE=y
   6.289 +CONFIG_BLK_DEV_IDEFLOPPY=y
   6.290 +CONFIG_BLK_DEV_IDESCSI=y
   6.291 +CONFIG_IDE_TASK_IOCTL=y
   6.292 +CONFIG_BLK_DEV_CMD640=y
   6.293 +CONFIG_BLK_DEV_CMD640_ENHANCED=y
   6.294 +# CONFIG_BLK_DEV_ISAPNP is not set
   6.295 +CONFIG_BLK_DEV_IDEPCI=y
   6.296 +CONFIG_BLK_DEV_GENERIC=y
   6.297 +CONFIG_IDEPCI_SHARE_IRQ=y
   6.298 +CONFIG_BLK_DEV_IDEDMA_PCI=y
   6.299 +CONFIG_BLK_DEV_OFFBOARD=y
   6.300 +# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
   6.301 +CONFIG_IDEDMA_PCI_AUTO=y
   6.302 +# CONFIG_IDEDMA_ONLYDISK is not set
   6.303 +CONFIG_BLK_DEV_IDEDMA=y
   6.304 +# CONFIG_IDEDMA_PCI_WIP is not set
   6.305 +CONFIG_BLK_DEV_ADMA100=y
   6.306 +CONFIG_BLK_DEV_AEC62XX=y
   6.307 +CONFIG_BLK_DEV_ALI15X3=y
   6.308 +CONFIG_WDC_ALI15X3=y
   6.309 +CONFIG_BLK_DEV_AMD74XX=y
   6.310 +CONFIG_AMD74XX_OVERRIDE=y
   6.311 +# CONFIG_BLK_DEV_ATIIXP is not set
   6.312 +CONFIG_BLK_DEV_CMD64X=y
   6.313 +CONFIG_BLK_DEV_TRIFLEX=y
   6.314 +CONFIG_BLK_DEV_CY82C693=y
   6.315 +CONFIG_BLK_DEV_CS5530=y
   6.316 +CONFIG_BLK_DEV_HPT34X=y
   6.317 +# CONFIG_HPT34X_AUTODMA is not set
   6.318 +CONFIG_BLK_DEV_HPT366=y
   6.319 +CONFIG_BLK_DEV_PIIX=y
   6.320 +CONFIG_BLK_DEV_NS87415=y
   6.321 +# CONFIG_BLK_DEV_OPTI621 is not set
   6.322 +CONFIG_BLK_DEV_PDC202XX_OLD=y
   6.323 +CONFIG_PDC202XX_BURST=y
   6.324 +CONFIG_BLK_DEV_PDC202XX_NEW=y
   6.325 +CONFIG_PDC202XX_FORCE=y
   6.326 +CONFIG_BLK_DEV_RZ1000=y
   6.327 +CONFIG_BLK_DEV_SC1200=y
   6.328 +CONFIG_BLK_DEV_SVWKS=y
   6.329 +CONFIG_BLK_DEV_SIIMAGE=y
   6.330 +CONFIG_BLK_DEV_SIS5513=y
   6.331 +CONFIG_BLK_DEV_SLC90E66=y
   6.332 +CONFIG_BLK_DEV_TRM290=y
   6.333 +CONFIG_BLK_DEV_VIA82CXXX=y
   6.334 +CONFIG_IDE_CHIPSETS=y
   6.335 +# CONFIG_BLK_DEV_4DRIVES is not set
   6.336 +# CONFIG_BLK_DEV_ALI14XX is not set
   6.337 +# CONFIG_BLK_DEV_DTC2278 is not set
   6.338 +# CONFIG_BLK_DEV_HT6560B is not set
   6.339 +# CONFIG_BLK_DEV_PDC4030 is not set
   6.340 +# CONFIG_BLK_DEV_QD65XX is not set
   6.341 +# CONFIG_BLK_DEV_UMC8672 is not set
   6.342 +CONFIG_IDEDMA_AUTO=y
   6.343 +# CONFIG_IDEDMA_IVB is not set
   6.344 +# CONFIG_DMA_NONPCI is not set
   6.345 +CONFIG_BLK_DEV_PDC202XX=y
   6.346 +# CONFIG_BLK_DEV_ATARAID is not set
   6.347 +# CONFIG_BLK_DEV_ATARAID_PDC is not set
   6.348 +# CONFIG_BLK_DEV_ATARAID_HPT is not set
   6.349 +# CONFIG_BLK_DEV_ATARAID_MEDLEY is not set
   6.350 +# CONFIG_BLK_DEV_ATARAID_SII is not set
   6.351 +
   6.352 +#
   6.353 +# SCSI support
   6.354 +#
   6.355 +CONFIG_SCSI=y
   6.356 +CONFIG_BLK_DEV_SD=y
   6.357 +CONFIG_SD_EXTRA_DEVS=40
   6.358 +# CONFIG_CHR_DEV_ST is not set
   6.359 +# CONFIG_CHR_DEV_OSST is not set
   6.360 +# CONFIG_BLK_DEV_SR is not set
   6.361 +CONFIG_CHR_DEV_SG=y
   6.362 +# CONFIG_SCSI_DEBUG_QUEUES is not set
   6.363 +# CONFIG_SCSI_MULTI_LUN is not set
   6.364 +# CONFIG_SCSI_CONSTANTS is not set
   6.365 +# CONFIG_SCSI_LOGGING is not set
   6.366 +
   6.367 +#
   6.368 +# SCSI low-level drivers
   6.369 +#
   6.370 +# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
   6.371 +# CONFIG_SCSI_7000FASST is not set
   6.372 +# CONFIG_SCSI_ACARD is not set
   6.373 +# CONFIG_SCSI_AHA152X is not set
   6.374 +# CONFIG_SCSI_AHA1542 is not set
   6.375 +# CONFIG_SCSI_AHA1740 is not set
   6.376 +CONFIG_SCSI_AACRAID=y
   6.377 +CONFIG_SCSI_AIC7XXX=y
   6.378 +CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
   6.379 +CONFIG_AIC7XXX_RESET_DELAY_MS=15000
   6.380 +# CONFIG_AIC7XXX_PROBE_EISA_VL is not set
   6.381 +# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
   6.382 +# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
   6.383 +CONFIG_AIC7XXX_DEBUG_MASK=0
   6.384 +# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
   6.385 +CONFIG_SCSI_AIC79XX=y
   6.386 +CONFIG_AIC79XX_CMDS_PER_DEVICE=32
   6.387 +CONFIG_AIC79XX_RESET_DELAY_MS=15000
   6.388 +# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
   6.389 +# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
   6.390 +# CONFIG_AIC79XX_DEBUG_ENABLE is not set
   6.391 +CONFIG_AIC79XX_DEBUG_MASK=0
   6.392 +# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
   6.393 +# CONFIG_SCSI_DPT_I2O is not set
   6.394 +# CONFIG_SCSI_ADVANSYS is not set
   6.395 +# CONFIG_SCSI_IN2000 is not set
   6.396 +# CONFIG_SCSI_AM53C974 is not set
   6.397 +CONFIG_SCSI_MEGARAID=y
   6.398 +# CONFIG_SCSI_MEGARAID2 is not set
   6.399 +CONFIG_SCSI_SATA=y
   6.400 +# CONFIG_SCSI_SATA_AHCI is not set
   6.401 +# CONFIG_SCSI_SATA_SVW is not set
   6.402 +CONFIG_SCSI_ATA_PIIX=y
   6.403 +# CONFIG_SCSI_SATA_NV is not set
   6.404 +# CONFIG_SCSI_SATA_QSTOR is not set
   6.405 +CONFIG_SCSI_SATA_PROMISE=y
   6.406 +CONFIG_SCSI_SATA_SX4=y
   6.407 +CONFIG_SCSI_SATA_SIL=y
   6.408 +CONFIG_SCSI_SATA_SIS=y
   6.409 +# CONFIG_SCSI_SATA_ULI is not set
   6.410 +CONFIG_SCSI_SATA_VIA=y
   6.411 +CONFIG_SCSI_SATA_VITESSE=y
   6.412 +CONFIG_SCSI_BUSLOGIC=y
   6.413 +# CONFIG_SCSI_OMIT_FLASHPOINT is not set
   6.414 +# CONFIG_SCSI_CPQFCTS is not set
   6.415 +# CONFIG_SCSI_DMX3191D is not set
   6.416 +# CONFIG_SCSI_DTC3280 is not set
   6.417 +# CONFIG_SCSI_EATA is not set
   6.418 +# CONFIG_SCSI_EATA_DMA is not set
   6.419 +# CONFIG_SCSI_EATA_PIO is not set
   6.420 +# CONFIG_SCSI_FUTURE_DOMAIN is not set
   6.421 +# CONFIG_SCSI_GDTH is not set
   6.422 +# CONFIG_SCSI_GENERIC_NCR5380 is not set
   6.423 +# CONFIG_SCSI_IPS is not set
   6.424 +# CONFIG_SCSI_INITIO is not set
   6.425 +# CONFIG_SCSI_INIA100 is not set
   6.426 +# CONFIG_SCSI_NCR53C406A is not set
   6.427 +# CONFIG_SCSI_NCR53C7xx is not set
   6.428 +CONFIG_SCSI_SYM53C8XX_2=y
   6.429 +CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
   6.430 +CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
   6.431 +CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
   6.432 +# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
   6.433 +# CONFIG_SCSI_PAS16 is not set
   6.434 +# CONFIG_SCSI_PCI2000 is not set
   6.435 +# CONFIG_SCSI_PCI2220I is not set
   6.436 +# CONFIG_SCSI_PSI240I is not set
   6.437 +# CONFIG_SCSI_QLOGIC_FAS is not set
   6.438 +# CONFIG_SCSI_QLOGIC_ISP is not set
   6.439 +# CONFIG_SCSI_QLOGIC_FC is not set
   6.440 +# CONFIG_SCSI_QLOGIC_1280 is not set
   6.441 +# CONFIG_SCSI_SEAGATE is not set
   6.442 +# CONFIG_SCSI_SIM710 is not set
   6.443 +# CONFIG_SCSI_SYM53C416 is not set
   6.444 +# CONFIG_SCSI_DC390T is not set
   6.445 +# CONFIG_SCSI_T128 is not set
   6.446 +# CONFIG_SCSI_U14_34F is not set
   6.447 +# CONFIG_SCSI_ULTRASTOR is not set
   6.448 +# CONFIG_SCSI_NSP32 is not set
   6.449 +# CONFIG_SCSI_DEBUG is not set
   6.450 +
   6.451 +#
   6.452 +# Fusion MPT device support
   6.453 +#
   6.454 +# CONFIG_FUSION is not set
   6.455 +# CONFIG_FUSION_BOOT is not set
   6.456 +# CONFIG_FUSION_ISENSE is not set
   6.457 +# CONFIG_FUSION_CTL is not set
   6.458 +# CONFIG_FUSION_LAN is not set
   6.459 +
   6.460 +#
   6.461 +# IEEE 1394 (FireWire) support (EXPERIMENTAL)
   6.462 +#
   6.463 +# CONFIG_IEEE1394 is not set
   6.464 +
   6.465 +#
   6.466 +# I2O device support
   6.467 +#
   6.468 +# CONFIG_I2O is not set
   6.469 +# CONFIG_I2O_PCI is not set
   6.470 +# CONFIG_I2O_BLOCK is not set
   6.471 +# CONFIG_I2O_LAN is not set
   6.472 +# CONFIG_I2O_SCSI is not set
   6.473 +# CONFIG_I2O_PROC is not set
   6.474 +
   6.475 +#
   6.476 +# Network device support
   6.477 +#
   6.478 +CONFIG_NETDEVICES=y
   6.479 +
   6.480 +#
   6.481 +# ARCnet devices
   6.482 +#
   6.483 +# CONFIG_ARCNET is not set
   6.484 +# CONFIG_DUMMY is not set
   6.485 +# CONFIG_BONDING is not set
   6.486 +# CONFIG_EQUALIZER is not set
   6.487 +# CONFIG_TUN is not set
   6.488 +# CONFIG_ETHERTAP is not set
   6.489 +
   6.490 +#
   6.491 +# Ethernet (10 or 100Mbit)
   6.492 +#
   6.493 +CONFIG_NET_ETHERNET=y
   6.494 +# CONFIG_SUNLANCE is not set
   6.495 +# CONFIG_HAPPYMEAL is not set
   6.496 +# CONFIG_SUNBMAC is not set
   6.497 +# CONFIG_SUNQE is not set
   6.498 +# CONFIG_SUNGEM is not set
   6.499 +CONFIG_NET_VENDOR_3COM=y
   6.500 +# CONFIG_EL1 is not set
   6.501 +# CONFIG_EL2 is not set
   6.502 +# CONFIG_ELPLUS is not set
   6.503 +# CONFIG_EL16 is not set
   6.504 +# CONFIG_EL3 is not set
   6.505 +# CONFIG_3C515 is not set
   6.506 +# CONFIG_ELMC is not set
   6.507 +# CONFIG_ELMC_II is not set
   6.508 +CONFIG_VORTEX=y
   6.509 +# CONFIG_TYPHOON is not set
   6.510 +# CONFIG_LANCE is not set
   6.511 +# CONFIG_NET_VENDOR_SMC is not set
   6.512 +# CONFIG_NET_VENDOR_RACAL is not set
   6.513 +# CONFIG_AT1700 is not set
   6.514 +# CONFIG_DEPCA is not set
   6.515 +# CONFIG_HP100 is not set
   6.516 +# CONFIG_NET_ISA is not set
   6.517 +CONFIG_NET_PCI=y
   6.518 +CONFIG_PCNET32=y
   6.519 +# CONFIG_AMD8111_ETH is not set
   6.520 +# CONFIG_ADAPTEC_STARFIRE is not set
   6.521 +# CONFIG_AC3200 is not set
   6.522 +# CONFIG_APRICOT is not set
   6.523 +# CONFIG_B44 is not set
   6.524 +# CONFIG_CS89x0 is not set
   6.525 +# CONFIG_TULIP is not set
   6.526 +# CONFIG_DE4X5 is not set
   6.527 +# CONFIG_DGRS is not set
   6.528 +# CONFIG_DM9102 is not set
   6.529 +# CONFIG_EEPRO100 is not set
   6.530 +# CONFIG_EEPRO100_PIO is not set
   6.531 +CONFIG_E100=y
   6.532 +# CONFIG_LNE390 is not set
   6.533 +# CONFIG_FEALNX is not set
   6.534 +# CONFIG_NATSEMI is not set
   6.535 +CONFIG_NE2K_PCI=y
   6.536 +# CONFIG_FORCEDETH is not set
   6.537 +# CONFIG_NE3210 is not set
   6.538 +# CONFIG_ES3210 is not set
   6.539 +# CONFIG_8139CP is not set
   6.540 +# CONFIG_8139TOO is not set
   6.541 +# CONFIG_8139TOO_PIO is not set
   6.542 +# CONFIG_8139TOO_TUNE_TWISTER is not set
   6.543 +# CONFIG_8139TOO_8129 is not set
   6.544 +# CONFIG_8139_OLD_RX_RESET is not set
   6.545 +# CONFIG_SIS900 is not set
   6.546 +# CONFIG_EPIC100 is not set
   6.547 +# CONFIG_SUNDANCE is not set
   6.548 +# CONFIG_SUNDANCE_MMIO is not set
   6.549 +# CONFIG_TLAN is not set
   6.550 +# CONFIG_VIA_RHINE is not set
   6.551 +# CONFIG_VIA_RHINE_MMIO is not set
   6.552 +# CONFIG_WINBOND_840 is not set
   6.553 +# CONFIG_NET_POCKET is not set
   6.554 +
   6.555 +#
   6.556 +# Ethernet (1000 Mbit)
   6.557 +#
   6.558 +# CONFIG_ACENIC is not set
   6.559 +# CONFIG_DL2K is not set
   6.560 +CONFIG_E1000=y
   6.561 +# CONFIG_E1000_NAPI is not set
   6.562 +# CONFIG_MYRI_SBUS is not set
   6.563 +# CONFIG_NS83820 is not set
   6.564 +# CONFIG_HAMACHI is not set
   6.565 +# CONFIG_YELLOWFIN is not set
   6.566 +# CONFIG_R8169 is not set
   6.567 +# CONFIG_SK98LIN is not set
   6.568 +CONFIG_TIGON3=y
   6.569 +# CONFIG_FDDI is not set
   6.570 +# CONFIG_HIPPI is not set
   6.571 +# CONFIG_PLIP is not set
   6.572 +# CONFIG_PPP is not set
   6.573 +# CONFIG_SLIP is not set
   6.574 +
   6.575 +#
   6.576 +# Wireless LAN (non-hamradio)
   6.577 +#
   6.578 +# CONFIG_NET_RADIO is not set
   6.579 +
   6.580 +#
   6.581 +# Token Ring devices
   6.582 +#
   6.583 +# CONFIG_TR is not set
   6.584 +# CONFIG_NET_FC is not set
   6.585 +# CONFIG_RCPCI is not set
   6.586 +# CONFIG_SHAPER is not set
   6.587 +
   6.588 +#
   6.589 +# Wan interfaces
   6.590 +#
   6.591 +# CONFIG_WAN is not set
   6.592 +
   6.593 +#
   6.594 +# Amateur Radio support
   6.595 +#
   6.596 +# CONFIG_HAMRADIO is not set
   6.597 +
   6.598 +#
   6.599 +# IrDA (infrared) support
   6.600 +#
   6.601 +# CONFIG_IRDA is not set
   6.602 +
   6.603 +#
   6.604 +# ISDN subsystem
   6.605 +#
   6.606 +# CONFIG_ISDN is not set
   6.607 +
   6.608 +#
   6.609 +# Old CD-ROM drivers (not SCSI, not IDE)
   6.610 +#
   6.611 +# CONFIG_CD_NO_IDESCSI is not set
   6.612 +
   6.613 +#
   6.614 +# Input core support
   6.615 +#
   6.616 +# CONFIG_INPUT is not set
   6.617 +# CONFIG_INPUT_KEYBDEV is not set
   6.618 +# CONFIG_INPUT_MOUSEDEV is not set
   6.619 +# CONFIG_INPUT_JOYDEV is not set
   6.620 +# CONFIG_INPUT_EVDEV is not set
   6.621 +# CONFIG_INPUT_UINPUT is not set
   6.622 +
   6.623 +#
   6.624 +# Character devices
   6.625 +#
   6.626 +CONFIG_VT=y
   6.627 +CONFIG_VT_CONSOLE=y
   6.628 +# CONFIG_SERIAL is not set
   6.629 +# CONFIG_SERIAL_EXTENDED is not set
   6.630 +# CONFIG_SERIAL_NONSTANDARD is not set
   6.631 +CONFIG_UNIX98_PTYS=y
   6.632 +CONFIG_UNIX98_PTY_COUNT=256
   6.633 +
   6.634 +#
   6.635 +# I2C support
   6.636 +#
   6.637 +# CONFIG_I2C is not set
   6.638 +
   6.639 +#
   6.640 +# Mice
   6.641 +#
   6.642 +# CONFIG_BUSMOUSE is not set
   6.643 +CONFIG_MOUSE=y
   6.644 +CONFIG_PSMOUSE=y
   6.645 +# CONFIG_82C710_MOUSE is not set
   6.646 +# CONFIG_PC110_PAD is not set
   6.647 +# CONFIG_MK712_MOUSE is not set
   6.648 +
   6.649 +#
   6.650 +# Joysticks
   6.651 +#
   6.652 +# CONFIG_INPUT_GAMEPORT is not set
   6.653 +# CONFIG_QIC02_TAPE is not set
   6.654 +# CONFIG_IPMI_HANDLER is not set
   6.655 +# CONFIG_IPMI_PANIC_EVENT is not set
   6.656 +# CONFIG_IPMI_DEVICE_INTERFACE is not set
   6.657 +# CONFIG_IPMI_KCS is not set
   6.658 +# CONFIG_IPMI_WATCHDOG is not set
   6.659 +
   6.660 +#
   6.661 +# Watchdog Cards
   6.662 +#
   6.663 +# CONFIG_WATCHDOG is not set
   6.664 +# CONFIG_SCx200 is not set
   6.665 +# CONFIG_SCx200_GPIO is not set
   6.666 +# CONFIG_AMD_RNG is not set
   6.667 +# CONFIG_INTEL_RNG is not set
   6.668 +# CONFIG_HW_RANDOM is not set
   6.669 +# CONFIG_AMD_PM768 is not set
   6.670 +# CONFIG_NVRAM is not set
   6.671 +# CONFIG_RTC is not set
   6.672 +# CONFIG_DTLK is not set
   6.673 +# CONFIG_R3964 is not set
   6.674 +# CONFIG_APPLICOM is not set
   6.675 +# CONFIG_SONYPI is not set
   6.676 +
   6.677 +#
   6.678 +# Ftape, the floppy tape device driver
   6.679 +#
   6.680 +# CONFIG_FTAPE is not set
   6.681 +# CONFIG_AGP is not set
   6.682 +
   6.683 +#
   6.684 +# Direct Rendering Manager (XFree86 DRI support)
   6.685 +#
   6.686 +# CONFIG_DRM is not set
   6.687 +# CONFIG_MWAVE is not set
   6.688 +# CONFIG_OBMOUSE is not set
   6.689 +
   6.690 +#
   6.691 +# Multimedia devices
   6.692 +#
   6.693 +# CONFIG_VIDEO_DEV is not set
   6.694 +
   6.695 +#
   6.696 +# File systems
   6.697 +#
   6.698 +# CONFIG_QUOTA is not set
   6.699 +# CONFIG_QFMT_V2 is not set
   6.700 +CONFIG_AUTOFS_FS=y
   6.701 +CONFIG_AUTOFS4_FS=y
   6.702 +# CONFIG_REISERFS_FS is not set
   6.703 +# CONFIG_REISERFS_CHECK is not set
   6.704 +# CONFIG_REISERFS_PROC_INFO is not set
   6.705 +# CONFIG_ADFS_FS is not set
   6.706 +# CONFIG_ADFS_FS_RW is not set
   6.707 +# CONFIG_AFFS_FS is not set
   6.708 +# CONFIG_HFS_FS is not set
   6.709 +# CONFIG_HFSPLUS_FS is not set
   6.710 +# CONFIG_BEFS_FS is not set
   6.711 +# CONFIG_BEFS_DEBUG is not set
   6.712 +# CONFIG_BFS_FS is not set
   6.713 +CONFIG_EXT3_FS=y
   6.714 +CONFIG_JBD=y
   6.715 +# CONFIG_JBD_DEBUG is not set
   6.716 +CONFIG_FAT_FS=y
   6.717 +CONFIG_MSDOS_FS=y
   6.718 +CONFIG_UMSDOS_FS=y
   6.719 +CONFIG_VFAT_FS=y
   6.720 +# CONFIG_EFS_FS is not set
   6.721 +# CONFIG_JFFS_FS is not set
   6.722 +# CONFIG_JFFS2_FS is not set
   6.723 +# CONFIG_CRAMFS is not set
   6.724 +CONFIG_TMPFS=y
   6.725 +CONFIG_RAMFS=y
   6.726 +CONFIG_ISO9660_FS=y
   6.727 +CONFIG_JOLIET=y
   6.728 +CONFIG_ZISOFS=y
   6.729 +# CONFIG_JFS_FS is not set
   6.730 +# CONFIG_JFS_DEBUG is not set
   6.731 +# CONFIG_JFS_STATISTICS is not set
   6.732 +# CONFIG_MINIX_FS is not set
   6.733 +# CONFIG_VXFS_FS is not set
   6.734 +# CONFIG_NTFS_FS is not set
   6.735 +# CONFIG_NTFS_RW is not set
   6.736 +# CONFIG_HPFS_FS is not set
   6.737 +CONFIG_PROC_FS=y
   6.738 +# CONFIG_DEVFS_FS is not set
   6.739 +# CONFIG_DEVFS_MOUNT is not set
   6.740 +# CONFIG_DEVFS_DEBUG is not set
   6.741 +CONFIG_DEVPTS_FS=y
   6.742 +# CONFIG_QNX4FS_FS is not set
   6.743 +# CONFIG_QNX4FS_RW is not set
   6.744 +# CONFIG_ROMFS_FS is not set
   6.745 +CONFIG_EXT2_FS=y
   6.746 +# CONFIG_SYSV_FS is not set
   6.747 +# CONFIG_UDF_FS is not set
   6.748 +# CONFIG_UDF_RW is not set
   6.749 +# CONFIG_UFS_FS is not set
   6.750 +# CONFIG_UFS_FS_WRITE is not set
   6.751 +# CONFIG_XFS_FS is not set
   6.752 +# CONFIG_XFS_QUOTA is not set
   6.753 +# CONFIG_XFS_RT is not set
   6.754 +# CONFIG_XFS_TRACE is not set
   6.755 +# CONFIG_XFS_DEBUG is not set
   6.756 +
   6.757 +#
   6.758 +# Network File Systems
   6.759 +#
   6.760 +# CONFIG_CODA_FS is not set
   6.761 +# CONFIG_INTERMEZZO_FS is not set
   6.762 +CONFIG_NFS_FS=y
   6.763 +CONFIG_NFS_V3=y
   6.764 +# CONFIG_NFS_DIRECTIO is not set
   6.765 +CONFIG_ROOT_NFS=y
   6.766 +CONFIG_NFSD=y
   6.767 +CONFIG_NFSD_V3=y
   6.768 +# CONFIG_NFSD_TCP is not set
   6.769 +CONFIG_SUNRPC=y
   6.770 +CONFIG_LOCKD=y
   6.771 +CONFIG_LOCKD_V4=y
   6.772 +# CONFIG_SMB_FS is not set
   6.773 +# CONFIG_NCP_FS is not set
   6.774 +# CONFIG_NCPFS_PACKET_SIGNING is not set
   6.775 +# CONFIG_NCPFS_IOCTL_LOCKING is not set
   6.776 +# CONFIG_NCPFS_STRONG is not set
   6.777 +# CONFIG_NCPFS_NFS_NS is not set
   6.778 +# CONFIG_NCPFS_OS2_NS is not set
   6.779 +# CONFIG_NCPFS_SMALLDOS is not set
   6.780 +# CONFIG_NCPFS_NLS is not set
   6.781 +# CONFIG_NCPFS_EXTRAS is not set
   6.782 +CONFIG_ZISOFS_FS=y
   6.783 +
   6.784 +#
   6.785 +# Partition Types
   6.786 +#
   6.787 +CONFIG_PARTITION_ADVANCED=y
   6.788 +# CONFIG_ACORN_PARTITION is not set
   6.789 +# CONFIG_OSF_PARTITION is not set
   6.790 +# CONFIG_AMIGA_PARTITION is not set
   6.791 +# CONFIG_ATARI_PARTITION is not set
   6.792 +# CONFIG_MAC_PARTITION is not set
   6.793 +CONFIG_MSDOS_PARTITION=y
   6.794 +# CONFIG_BSD_DISKLABEL is not set
   6.795 +# CONFIG_MINIX_SUBPARTITION is not set
   6.796 +# CONFIG_SOLARIS_X86_PARTITION is not set
   6.797 +# CONFIG_UNIXWARE_DISKLABEL is not set
   6.798 +# CONFIG_LDM_PARTITION is not set
   6.799 +# CONFIG_SGI_PARTITION is not set
   6.800 +# CONFIG_ULTRIX_PARTITION is not set
   6.801 +# CONFIG_SUN_PARTITION is not set
   6.802 +# CONFIG_EFI_PARTITION is not set
   6.803 +# CONFIG_SMB_NLS is not set
   6.804 +CONFIG_NLS=y
   6.805 +
   6.806 +#
   6.807 +# Native Language Support
   6.808 +#
   6.809 +CONFIG_NLS_DEFAULT="iso8559-1"
   6.810 +# CONFIG_NLS_CODEPAGE_437 is not set
   6.811 +# CONFIG_NLS_CODEPAGE_737 is not set
   6.812 +# CONFIG_NLS_CODEPAGE_775 is not set
   6.813 +# CONFIG_NLS_CODEPAGE_850 is not set
   6.814 +# CONFIG_NLS_CODEPAGE_852 is not set
   6.815 +# CONFIG_NLS_CODEPAGE_855 is not set
   6.816 +# CONFIG_NLS_CODEPAGE_857 is not set
   6.817 +# CONFIG_NLS_CODEPAGE_860 is not set
   6.818 +# CONFIG_NLS_CODEPAGE_861 is not set
   6.819 +# CONFIG_NLS_CODEPAGE_862 is not set
   6.820 +# CONFIG_NLS_CODEPAGE_863 is not set
   6.821 +# CONFIG_NLS_CODEPAGE_864 is not set
   6.822 +# CONFIG_NLS_CODEPAGE_865 is not set
   6.823 +# CONFIG_NLS_CODEPAGE_866 is not set
   6.824 +# CONFIG_NLS_CODEPAGE_869 is not set
   6.825 +# CONFIG_NLS_CODEPAGE_936 is not set
   6.826 +# CONFIG_NLS_CODEPAGE_950 is not set
   6.827 +# CONFIG_NLS_CODEPAGE_932 is not set
   6.828 +# CONFIG_NLS_CODEPAGE_949 is not set
   6.829 +# CONFIG_NLS_CODEPAGE_874 is not set
   6.830 +# CONFIG_NLS_ISO8859_8 is not set
   6.831 +# CONFIG_NLS_CODEPAGE_1250 is not set
   6.832 +# CONFIG_NLS_CODEPAGE_1251 is not set
   6.833 +CONFIG_NLS_ISO8859_1=y
   6.834 +# CONFIG_NLS_ISO8859_2 is not set
   6.835 +# CONFIG_NLS_ISO8859_3 is not set
   6.836 +# CONFIG_NLS_ISO8859_4 is not set
   6.837 +# CONFIG_NLS_ISO8859_5 is not set
   6.838 +# CONFIG_NLS_ISO8859_6 is not set
   6.839 +# CONFIG_NLS_ISO8859_7 is not set
   6.840 +# CONFIG_NLS_ISO8859_9 is not set
   6.841 +# CONFIG_NLS_ISO8859_13 is not set
   6.842 +# CONFIG_NLS_ISO8859_14 is not set
   6.843 +# CONFIG_NLS_ISO8859_15 is not set
   6.844 +# CONFIG_NLS_KOI8_R is not set
   6.845 +# CONFIG_NLS_KOI8_U is not set
   6.846 +# CONFIG_NLS_UTF8 is not set
   6.847 +
   6.848 +#
   6.849 +# Console drivers
   6.850 +#
   6.851 +CONFIG_XEN_CONSOLE=y
   6.852 +CONFIG_VGA_CONSOLE=y
   6.853 +CONFIG_DUMMY_CONSOLE=y
   6.854 +# CONFIG_VIDEO_SELECT is not set
   6.855 +# CONFIG_MDA_CONSOLE is not set
   6.856 +
   6.857 +#
   6.858 +# Frame-buffer support
   6.859 +#
   6.860 +# CONFIG_FB is not set
   6.861 +
   6.862 +#
   6.863 +# Sound
   6.864 +#
   6.865 +# CONFIG_SOUND is not set
   6.866 +
   6.867 +#
   6.868 +# USB support
   6.869 +#
   6.870 +# CONFIG_USB is not set
   6.871 +
   6.872 +#
   6.873 +# Support for USB gadgets
   6.874 +#
   6.875 +# CONFIG_USB_GADGET is not set
   6.876 +
   6.877 +#
   6.878 +# Bluetooth support
   6.879 +#
   6.880 +# CONFIG_BLUEZ is not set
   6.881 +
   6.882 +#
   6.883 +# Kernel hacking
   6.884 +#
   6.885 +CONFIG_DEBUG_KERNEL=y
   6.886 +# CONFIG_DEBUG_STACKOVERFLOW is not set
   6.887 +# CONFIG_DEBUG_HIGHMEM is not set
   6.888 +# CONFIG_DEBUG_SLAB is not set
   6.889 +# CONFIG_DEBUG_IOVIRT is not set
   6.890 +# CONFIG_MAGIC_SYSRQ is not set
   6.891 +# CONFIG_DEBUG_SPINLOCK is not set
   6.892 +# CONFIG_DEBUG_BUGVERBOSE is not set
   6.893 +CONFIG_KALLSYMS=y
   6.894 +# CONFIG_FRAME_POINTER is not set
   6.895 +CONFIG_LOG_BUF_SHIFT=0
   6.896 +
   6.897 +#
   6.898 +# Cryptographic options
   6.899 +#
   6.900 +CONFIG_CRYPTO=y
   6.901 +CONFIG_CRYPTO_HMAC=y
   6.902 +CONFIG_CRYPTO_NULL=m
   6.903 +CONFIG_CRYPTO_MD4=m
   6.904 +CONFIG_CRYPTO_MD5=m
   6.905 +CONFIG_CRYPTO_SHA1=m
   6.906 +CONFIG_CRYPTO_SHA256=m
   6.907 +CONFIG_CRYPTO_SHA512=m
   6.908 +# CONFIG_CRYPTO_WP512 is not set
   6.909 +CONFIG_CRYPTO_DES=m
   6.910 +CONFIG_CRYPTO_BLOWFISH=m
   6.911 +CONFIG_CRYPTO_TWOFISH=m
   6.912 +CONFIG_CRYPTO_SERPENT=m
   6.913 +CONFIG_CRYPTO_AES=m
   6.914 +CONFIG_CRYPTO_CAST5=m
   6.915 +CONFIG_CRYPTO_CAST6=m
   6.916 +# CONFIG_CRYPTO_TEA is not set
   6.917 +# CONFIG_CRYPTO_KHAZAD is not set
   6.918 +# CONFIG_CRYPTO_ANUBIS is not set
   6.919 +CONFIG_CRYPTO_ARC4=m
   6.920 +CONFIG_CRYPTO_DEFLATE=m
   6.921 +# CONFIG_CRYPTO_MICHAEL_MIC is not set
   6.922 +# CONFIG_CRYPTO_TEST is not set
   6.923 +
   6.924 +#
   6.925 +# Library routines
   6.926 +#
   6.927 +# CONFIG_CRC32 is not set
   6.928 +CONFIG_ZLIB_INFLATE=y
   6.929 +CONFIG_ZLIB_DEFLATE=m
   6.930 +# CONFIG_FW_LOADER is not set
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/linux-2.4-xen-sparse/arch/xen/defconfig-xenU	Mon Jul 11 09:29:56 2005 -0500
     7.3 @@ -0,0 +1,562 @@
     7.4 +#
     7.5 +# Automatically generated make config: don't edit
     7.6 +#
     7.7 +CONFIG_XEN=y
     7.8 +CONFIG_X86=y
     7.9 +CONFIG_ISA=y
    7.10 +# CONFIG_SBUS is not set
    7.11 +CONFIG_UID16=y
    7.12 +
    7.13 +#
    7.14 +# Xen
    7.15 +#
    7.16 +# CONFIG_XEN_PRIVILEGED_GUEST is not set
    7.17 +# CONFIG_XEN_PHYSDEV_ACCESS is not set
    7.18 +CONFIG_XEN_SCRUB_PAGES=y
    7.19 +CONFIG_XEN_NETDEV_FRONTEND=y
    7.20 +CONFIG_XEN_BLKDEV_FRONTEND=y
    7.21 +CONFIG_XEN_BLKDEV_GRANT=y
    7.22 +# CONFIG_XEN_USB_FRONTEND is not set
    7.23 +CONFIG_NO_IDLE_HZ=y
    7.24 +# CONFIG_FOREIGN_PAGES is not set
    7.25 +CONFIG_NETDEVICES=y
    7.26 +# CONFIG_VT is not set
    7.27 +
    7.28 +#
    7.29 +# Code maturity level options
    7.30 +#
    7.31 +CONFIG_EXPERIMENTAL=y
    7.32 +
    7.33 +#
    7.34 +# Loadable module support
    7.35 +#
    7.36 +CONFIG_MODULES=y
    7.37 +CONFIG_MODVERSIONS=y
    7.38 +CONFIG_KMOD=y
    7.39 +
    7.40 +#
    7.41 +# Processor type and features
    7.42 +#
    7.43 +CONFIG_M686=y
    7.44 +# CONFIG_MPENTIUMIII is not set
    7.45 +# CONFIG_MPENTIUM4 is not set
    7.46 +# CONFIG_MK7 is not set
    7.47 +# CONFIG_MK8 is not set
    7.48 +# CONFIG_MVIAC3_2 is not set
    7.49 +CONFIG_X86_WP_WORKS_OK=y
    7.50 +CONFIG_X86_INVLPG=y
    7.51 +CONFIG_X86_CMPXCHG=y
    7.52 +CONFIG_X86_XADD=y
    7.53 +CONFIG_X86_BSWAP=y
    7.54 +CONFIG_X86_POPAD_OK=y
    7.55 +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set
    7.56 +CONFIG_RWSEM_XCHGADD_ALGORITHM=y
    7.57 +CONFIG_X86_GOOD_APIC=y
    7.58 +CONFIG_X86_PGE=y
    7.59 +CONFIG_X86_USE_PPRO_CHECKSUM=y
    7.60 +CONFIG_X86_TSC=y
    7.61 +CONFIG_X86_L1_CACHE_SHIFT=5
    7.62 +CONFIG_NOHIGHMEM=y
    7.63 +# CONFIG_HIGHMEM4G is not set
    7.64 +CONFIG_FORCE_MAX_ZONEORDER=11
    7.65 +
    7.66 +#
    7.67 +# General setup
    7.68 +#
    7.69 +CONFIG_NET=y
    7.70 +CONFIG_SYSVIPC=y
    7.71 +# CONFIG_BSD_PROCESS_ACCT is not set
    7.72 +CONFIG_SYSCTL=y
    7.73 +CONFIG_KCORE_ELF=y
    7.74 +# CONFIG_KCORE_AOUT is not set
    7.75 +CONFIG_BINFMT_AOUT=y
    7.76 +CONFIG_BINFMT_ELF=y
    7.77 +# CONFIG_BINFMT_MISC is not set
    7.78 +# CONFIG_OOM_KILLER is not set
    7.79 +
    7.80 +#
    7.81 +# Networking options
    7.82 +#
    7.83 +CONFIG_PACKET=y
    7.84 +CONFIG_PACKET_MMAP=y
    7.85 +# CONFIG_NETLINK_DEV is not set
    7.86 +CONFIG_NETFILTER=y
    7.87 +# CONFIG_NETFILTER_DEBUG is not set
    7.88 +CONFIG_FILTER=y
    7.89 +CONFIG_UNIX=y
    7.90 +CONFIG_INET=y
    7.91 +# CONFIG_IP_MULTICAST is not set
    7.92 +# CONFIG_IP_ADVANCED_ROUTER is not set
    7.93 +CONFIG_IP_PNP=y
    7.94 +CONFIG_IP_PNP_DHCP=y
    7.95 +# CONFIG_IP_PNP_BOOTP is not set
    7.96 +# CONFIG_IP_PNP_RARP is not set
    7.97 +# CONFIG_NET_IPIP is not set
    7.98 +# CONFIG_NET_IPGRE is not set
    7.99 +# CONFIG_ARPD is not set
   7.100 +# CONFIG_INET_ECN is not set
   7.101 +# CONFIG_SYN_COOKIES is not set
   7.102 +
   7.103 +#
   7.104 +#   IP: Netfilter Configuration
   7.105 +#
   7.106 +CONFIG_IP_NF_CONNTRACK=y
   7.107 +CONFIG_IP_NF_FTP=y
   7.108 +# CONFIG_IP_NF_AMANDA is not set
   7.109 +CONFIG_IP_NF_TFTP=y
   7.110 +CONFIG_IP_NF_IRC=y
   7.111 +# CONFIG_IP_NF_QUEUE is not set
   7.112 +CONFIG_IP_NF_IPTABLES=y
   7.113 +# CONFIG_IP_NF_MATCH_LIMIT is not set
   7.114 +# CONFIG_IP_NF_MATCH_MAC is not set
   7.115 +# CONFIG_IP_NF_MATCH_PKTTYPE is not set
   7.116 +# CONFIG_IP_NF_MATCH_MARK is not set
   7.117 +# CONFIG_IP_NF_MATCH_MULTIPORT is not set
   7.118 +# CONFIG_IP_NF_MATCH_TOS is not set
   7.119 +# CONFIG_IP_NF_MATCH_RECENT is not set
   7.120 +# CONFIG_IP_NF_MATCH_ECN is not set
   7.121 +# CONFIG_IP_NF_MATCH_DSCP is not set
   7.122 +# CONFIG_IP_NF_MATCH_AH_ESP is not set
   7.123 +# CONFIG_IP_NF_MATCH_LENGTH is not set
   7.124 +# CONFIG_IP_NF_MATCH_TTL is not set
   7.125 +# CONFIG_IP_NF_MATCH_TCPMSS is not set
   7.126 +# CONFIG_IP_NF_MATCH_HELPER is not set
   7.127 +CONFIG_IP_NF_MATCH_STATE=y
   7.128 +CONFIG_IP_NF_MATCH_CONNTRACK=y
   7.129 +# CONFIG_IP_NF_MATCH_UNCLEAN is not set
   7.130 +# CONFIG_IP_NF_MATCH_OWNER is not set
   7.131 +CONFIG_IP_NF_FILTER=y
   7.132 +CONFIG_IP_NF_TARGET_REJECT=y
   7.133 +# CONFIG_IP_NF_TARGET_MIRROR is not set
   7.134 +CONFIG_IP_NF_NAT=y
   7.135 +CONFIG_IP_NF_NAT_NEEDED=y
   7.136 +CONFIG_IP_NF_TARGET_MASQUERADE=y
   7.137 +CONFIG_IP_NF_TARGET_REDIRECT=y
   7.138 +# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
   7.139 +CONFIG_IP_NF_NAT_IRC=y
   7.140 +CONFIG_IP_NF_NAT_FTP=y
   7.141 +CONFIG_IP_NF_NAT_TFTP=y
   7.142 +# CONFIG_IP_NF_MANGLE is not set
   7.143 +CONFIG_IP_NF_TARGET_LOG=y
   7.144 +CONFIG_IP_NF_TARGET_ULOG=y
   7.145 +# CONFIG_IP_NF_TARGET_TCPMSS is not set
   7.146 +# CONFIG_IP_NF_ARPTABLES is not set
   7.147 +
   7.148 +#
   7.149 +#   IP: Virtual Server Configuration
   7.150 +#
   7.151 +# CONFIG_IP_VS is not set
   7.152 +# CONFIG_IPV6 is not set
   7.153 +# CONFIG_KHTTPD is not set
   7.154 +
   7.155 +#
   7.156 +#    SCTP Configuration (EXPERIMENTAL)
   7.157 +#
   7.158 +# CONFIG_IP_SCTP is not set
   7.159 +# CONFIG_ATM is not set
   7.160 +CONFIG_VLAN_8021Q=y
   7.161 +
   7.162 +#
   7.163 +#  
   7.164 +#
   7.165 +# CONFIG_IPX is not set
   7.166 +# CONFIG_ATALK is not set
   7.167 +# CONFIG_DECNET is not set
   7.168 +# CONFIG_BRIDGE is not set
   7.169 +# CONFIG_X25 is not set
   7.170 +# CONFIG_LAPB is not set
   7.171 +# CONFIG_LLC is not set
   7.172 +# CONFIG_NET_DIVERT is not set
   7.173 +# CONFIG_ECONET is not set
   7.174 +# CONFIG_WAN_ROUTER is not set
   7.175 +# CONFIG_NET_FASTROUTE is not set
   7.176 +# CONFIG_NET_HW_FLOWCONTROL is not set
   7.177 +
   7.178 +#
   7.179 +# QoS and/or fair queueing
   7.180 +#
   7.181 +# CONFIG_NET_SCHED is not set
   7.182 +
   7.183 +#
   7.184 +# Network testing
   7.185 +#
   7.186 +# CONFIG_NET_PKTGEN is not set
   7.187 +
   7.188 +#
   7.189 +# SCSI support
   7.190 +#
   7.191 +CONFIG_SCSI=y
   7.192 +
   7.193 +#
   7.194 +# SCSI support type (disk, tape, CD-ROM)
   7.195 +#
   7.196 +CONFIG_BLK_DEV_SD=y
   7.197 +CONFIG_SD_EXTRA_DEVS=40
   7.198 +# CONFIG_CHR_DEV_ST is not set
   7.199 +# CONFIG_CHR_DEV_OSST is not set
   7.200 +# CONFIG_BLK_DEV_SR is not set
   7.201 +CONFIG_CHR_DEV_SG=y
   7.202 +
   7.203 +#
   7.204 +# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
   7.205 +#
   7.206 +# CONFIG_SCSI_DEBUG_QUEUES is not set
   7.207 +# CONFIG_SCSI_MULTI_LUN is not set
   7.208 +# CONFIG_SCSI_CONSTANTS is not set
   7.209 +# CONFIG_SCSI_LOGGING is not set
   7.210 +
   7.211 +#
   7.212 +# SCSI low-level drivers
   7.213 +#
   7.214 +# CONFIG_SCSI_7000FASST is not set
   7.215 +# CONFIG_SCSI_ACARD is not set
   7.216 +# CONFIG_SCSI_AHA152X is not set
   7.217 +# CONFIG_SCSI_AHA1542 is not set
   7.218 +# CONFIG_SCSI_AHA1740 is not set
   7.219 +# CONFIG_SCSI_AACRAID is not set
   7.220 +# CONFIG_SCSI_AIC7XXX is not set
   7.221 +# CONFIG_SCSI_AIC79XX is not set
   7.222 +# CONFIG_SCSI_AIC7XXX_OLD is not set
   7.223 +# CONFIG_SCSI_DPT_I2O is not set
   7.224 +# CONFIG_SCSI_ADVANSYS is not set
   7.225 +# CONFIG_SCSI_IN2000 is not set
   7.226 +# CONFIG_SCSI_AM53C974 is not set
   7.227 +# CONFIG_SCSI_MEGARAID is not set
   7.228 +# CONFIG_SCSI_MEGARAID2 is not set
   7.229 +# CONFIG_SCSI_SATA is not set
   7.230 +# CONFIG_SCSI_SATA_AHCI is not set
   7.231 +# CONFIG_SCSI_SATA_SVW is not set
   7.232 +# CONFIG_SCSI_ATA_PIIX is not set
   7.233 +# CONFIG_SCSI_SATA_NV is not set
   7.234 +# CONFIG_SCSI_SATA_QSTOR is not set
   7.235 +# CONFIG_SCSI_SATA_PROMISE is not set
   7.236 +# CONFIG_SCSI_SATA_SX4 is not set
   7.237 +# CONFIG_SCSI_SATA_SIL is not set
   7.238 +# CONFIG_SCSI_SATA_SIS is not set
   7.239 +# CONFIG_SCSI_SATA_ULI is not set
   7.240 +# CONFIG_SCSI_SATA_VIA is not set
   7.241 +# CONFIG_SCSI_SATA_VITESSE is not set
   7.242 +# CONFIG_SCSI_BUSLOGIC is not set
   7.243 +# CONFIG_SCSI_DMX3191D is not set
   7.244 +# CONFIG_SCSI_DTC3280 is not set
   7.245 +# CONFIG_SCSI_EATA is not set
   7.246 +# CONFIG_SCSI_EATA_DMA is not set
   7.247 +# CONFIG_SCSI_EATA_PIO is not set
   7.248 +# CONFIG_SCSI_FUTURE_DOMAIN is not set
   7.249 +# CONFIG_SCSI_GDTH is not set
   7.250 +# CONFIG_SCSI_GENERIC_NCR5380 is not set
   7.251 +# CONFIG_SCSI_IPS is not set
   7.252 +# CONFIG_SCSI_INITIO is not set
   7.253 +# CONFIG_SCSI_INIA100 is not set
   7.254 +# CONFIG_SCSI_PPA is not set
   7.255 +# CONFIG_SCSI_IMM is not set
   7.256 +# CONFIG_SCSI_NCR53C406A is not set
   7.257 +# CONFIG_SCSI_NCR53C7xx is not set
   7.258 +# CONFIG_SCSI_PAS16 is not set
   7.259 +# CONFIG_SCSI_PCI2000 is not set
   7.260 +# CONFIG_SCSI_PCI2220I is not set
   7.261 +# CONFIG_SCSI_PSI240I is not set
   7.262 +# CONFIG_SCSI_QLOGIC_FAS is not set
   7.263 +# CONFIG_SCSI_SEAGATE is not set
   7.264 +# CONFIG_SCSI_SIM710 is not set
   7.265 +# CONFIG_SCSI_SYM53C416 is not set
   7.266 +# CONFIG_SCSI_T128 is not set
   7.267 +# CONFIG_SCSI_U14_34F is not set
   7.268 +# CONFIG_SCSI_ULTRASTOR is not set
   7.269 +# CONFIG_SCSI_NSP32 is not set
   7.270 +# CONFIG_SCSI_DEBUG is not set
   7.271 +
   7.272 +#
   7.273 +# Block devices
   7.274 +#
   7.275 +CONFIG_BLK_DEV_LOOP=y
   7.276 +CONFIG_BLK_DEV_NBD=y
   7.277 +CONFIG_BLK_DEV_RAM=y
   7.278 +CONFIG_BLK_DEV_RAM_SIZE=4096
   7.279 +CONFIG_BLK_DEV_INITRD=y
   7.280 +# CONFIG_BLK_STATS is not set
   7.281 +# CONFIG_BLK_DEV_HD is not set
   7.282 +
   7.283 +#
   7.284 +# Character devices
   7.285 +#
   7.286 +# CONFIG_VT is not set
   7.287 +# CONFIG_SERIAL is not set
   7.288 +# CONFIG_SERIAL_EXTENDED is not set
   7.289 +# CONFIG_SERIAL_NONSTANDARD is not set
   7.290 +CONFIG_UNIX98_PTYS=y
   7.291 +CONFIG_UNIX98_PTY_COUNT=256
   7.292 +# CONFIG_PRINTER is not set
   7.293 +# CONFIG_PPDEV is not set
   7.294 +# CONFIG_TIPAR is not set
   7.295 +
   7.296 +#
   7.297 +# I2C support
   7.298 +#
   7.299 +# CONFIG_I2C is not set
   7.300 +
   7.301 +#
   7.302 +# Mice
   7.303 +#
   7.304 +# CONFIG_BUSMOUSE is not set
   7.305 +CONFIG_MOUSE=y
   7.306 +CONFIG_PSMOUSE=y
   7.307 +# CONFIG_82C710_MOUSE is not set
   7.308 +# CONFIG_PC110_PAD is not set
   7.309 +# CONFIG_MK712_MOUSE is not set
   7.310 +
   7.311 +#
   7.312 +# Joysticks
   7.313 +#
   7.314 +# CONFIG_INPUT_GAMEPORT is not set
   7.315 +# CONFIG_INPUT_NS558 is not set
   7.316 +# CONFIG_INPUT_LIGHTNING is not set
   7.317 +# CONFIG_INPUT_PCIGAME is not set
   7.318 +# CONFIG_INPUT_CS461X is not set
   7.319 +# CONFIG_INPUT_EMU10K1 is not set
   7.320 +# CONFIG_INPUT_SERIO is not set
   7.321 +# CONFIG_INPUT_SERPORT is not set
   7.322 +
   7.323 +#
   7.324 +# Joysticks
   7.325 +#
   7.326 +# CONFIG_INPUT_ANALOG is not set
   7.327 +# CONFIG_INPUT_A3D is not set
   7.328 +# CONFIG_INPUT_ADI is not set
   7.329 +# CONFIG_INPUT_COBRA is not set
   7.330 +# CONFIG_INPUT_GF2K is not set
   7.331 +# CONFIG_INPUT_GRIP is not set
   7.332 +# CONFIG_INPUT_INTERACT is not set
   7.333 +# CONFIG_INPUT_TMDC is not set
   7.334 +# CONFIG_INPUT_SIDEWINDER is not set
   7.335 +# CONFIG_INPUT_IFORCE_USB is not set
   7.336 +# CONFIG_INPUT_IFORCE_232 is not set
   7.337 +# CONFIG_INPUT_WARRIOR is not set
   7.338 +# CONFIG_INPUT_MAGELLAN is not set
   7.339 +# CONFIG_INPUT_SPACEORB is not set
   7.340 +# CONFIG_INPUT_SPACEBALL is not set
   7.341 +# CONFIG_INPUT_STINGER is not set
   7.342 +# CONFIG_INPUT_DB9 is not set
   7.343 +# CONFIG_INPUT_GAMECON is not set
   7.344 +# CONFIG_INPUT_TURBOGRAFX is not set
   7.345 +# CONFIG_QIC02_TAPE is not set
   7.346 +# CONFIG_IPMI_HANDLER is not set
   7.347 +# CONFIG_IPMI_PANIC_EVENT is not set
   7.348 +# CONFIG_IPMI_DEVICE_INTERFACE is not set
   7.349 +# CONFIG_IPMI_KCS is not set
   7.350 +# CONFIG_IPMI_WATCHDOG is not set
   7.351 +
   7.352 +#
   7.353 +# Watchdog Cards
   7.354 +#
   7.355 +# CONFIG_WATCHDOG is not set
   7.356 +# CONFIG_SCx200 is not set
   7.357 +# CONFIG_SCx200_GPIO is not set
   7.358 +# CONFIG_AMD_RNG is not set
   7.359 +# CONFIG_INTEL_RNG is not set
   7.360 +# CONFIG_HW_RANDOM is not set
   7.361 +# CONFIG_AMD_PM768 is not set
   7.362 +# CONFIG_NVRAM is not set
   7.363 +# CONFIG_RTC is not set
   7.364 +# CONFIG_DTLK is not set
   7.365 +# CONFIG_R3964 is not set
   7.366 +# CONFIG_APPLICOM is not set
   7.367 +# CONFIG_SONYPI is not set
   7.368 +
   7.369 +#
   7.370 +# Ftape, the floppy tape device driver
   7.371 +#
   7.372 +# CONFIG_FTAPE is not set
   7.373 +# CONFIG_AGP is not set
   7.374 +
   7.375 +#
   7.376 +# Direct Rendering Manager (XFree86 DRI support)
   7.377 +#
   7.378 +# CONFIG_DRM is not set
   7.379 +# CONFIG_MWAVE is not set
   7.380 +# CONFIG_OBMOUSE is not set
   7.381 +
   7.382 +#
   7.383 +# File systems
   7.384 +#
   7.385 +# CONFIG_QUOTA is not set
   7.386 +# CONFIG_QFMT_V2 is not set
   7.387 +CONFIG_AUTOFS_FS=y
   7.388 +CONFIG_AUTOFS4_FS=y
   7.389 +# CONFIG_REISERFS_FS is not set
   7.390 +# CONFIG_REISERFS_CHECK is not set
   7.391 +# CONFIG_REISERFS_PROC_INFO is not set
   7.392 +# CONFIG_ADFS_FS is not set
   7.393 +# CONFIG_ADFS_FS_RW is not set
   7.394 +# CONFIG_AFFS_FS is not set
   7.395 +# CONFIG_HFS_FS is not set
   7.396 +# CONFIG_HFSPLUS_FS is not set
   7.397 +# CONFIG_BEFS_FS is not set
   7.398 +# CONFIG_BEFS_DEBUG is not set
   7.399 +# CONFIG_BFS_FS is not set
   7.400 +CONFIG_EXT3_FS=y
   7.401 +CONFIG_JBD=y
   7.402 +# CONFIG_JBD_DEBUG is not set
   7.403 +CONFIG_FAT_FS=y
   7.404 +CONFIG_MSDOS_FS=y
   7.405 +CONFIG_UMSDOS_FS=y
   7.406 +CONFIG_VFAT_FS=y
   7.407 +# CONFIG_EFS_FS is not set
   7.408 +# CONFIG_JFFS_FS is not set
   7.409 +# CONFIG_JFFS2_FS is not set
   7.410 +# CONFIG_CRAMFS is not set
   7.411 +CONFIG_TMPFS=y
   7.412 +CONFIG_RAMFS=y
   7.413 +CONFIG_ISO9660_FS=y
   7.414 +CONFIG_JOLIET=y
   7.415 +CONFIG_ZISOFS=y
   7.416 +# CONFIG_JFS_FS is not set
   7.417 +# CONFIG_JFS_DEBUG is not set
   7.418 +# CONFIG_JFS_STATISTICS is not set
   7.419 +# CONFIG_MINIX_FS is not set
   7.420 +# CONFIG_VXFS_FS is not set
   7.421 +# CONFIG_NTFS_FS is not set
   7.422 +# CONFIG_NTFS_RW is not set
   7.423 +# CONFIG_HPFS_FS is not set
   7.424 +CONFIG_PROC_FS=y
   7.425 +# CONFIG_DEVFS_FS is not set
   7.426 +# CONFIG_DEVFS_MOUNT is not set
   7.427 +# CONFIG_DEVFS_DEBUG is not set
   7.428 +CONFIG_DEVPTS_FS=y
   7.429 +# CONFIG_QNX4FS_FS is not set
   7.430 +# CONFIG_QNX4FS_RW is not set
   7.431 +# CONFIG_ROMFS_FS is not set
   7.432 +CONFIG_EXT2_FS=y
   7.433 +# CONFIG_SYSV_FS is not set
   7.434 +# CONFIG_UDF_FS is not set
   7.435 +# CONFIG_UDF_RW is not set
   7.436 +# CONFIG_UFS_FS is not set
   7.437 +# CONFIG_UFS_FS_WRITE is not set
   7.438 +# CONFIG_XFS_FS is not set
   7.439 +# CONFIG_XFS_QUOTA is not set
   7.440 +# CONFIG_XFS_RT is not set
   7.441 +# CONFIG_XFS_TRACE is not set
   7.442 +# CONFIG_XFS_DEBUG is not set
   7.443 +
   7.444 +#
   7.445 +# Network File Systems
   7.446 +#
   7.447 +# CONFIG_CODA_FS is not set
   7.448 +# CONFIG_INTERMEZZO_FS is not set
   7.449 +CONFIG_NFS_FS=y
   7.450 +CONFIG_NFS_V3=y
   7.451 +# CONFIG_NFS_DIRECTIO is not set
   7.452 +CONFIG_ROOT_NFS=y
   7.453 +CONFIG_NFSD=y
   7.454 +CONFIG_NFSD_V3=y
   7.455 +# CONFIG_NFSD_TCP is not set
   7.456 +CONFIG_SUNRPC=y
   7.457 +CONFIG_LOCKD=y
   7.458 +CONFIG_LOCKD_V4=y
   7.459 +# CONFIG_SMB_FS is not set
   7.460 +# CONFIG_NCP_FS is not set
   7.461 +# CONFIG_NCPFS_PACKET_SIGNING is not set
   7.462 +# CONFIG_NCPFS_IOCTL_LOCKING is not set
   7.463 +# CONFIG_NCPFS_STRONG is not set
   7.464 +# CONFIG_NCPFS_NFS_NS is not set
   7.465 +# CONFIG_NCPFS_OS2_NS is not set
   7.466 +# CONFIG_NCPFS_SMALLDOS is not set
   7.467 +# CONFIG_NCPFS_NLS is not set
   7.468 +# CONFIG_NCPFS_EXTRAS is not set
   7.469 +CONFIG_ZISOFS_FS=y
   7.470 +
   7.471 +#
   7.472 +# Partition Types
   7.473 +#
   7.474 +CONFIG_PARTITION_ADVANCED=y
   7.475 +# CONFIG_ACORN_PARTITION is not set
   7.476 +# CONFIG_OSF_PARTITION is not set
   7.477 +# CONFIG_AMIGA_PARTITION is not set
   7.478 +# CONFIG_ATARI_PARTITION is not set
   7.479 +# CONFIG_MAC_PARTITION is not set
   7.480 +CONFIG_MSDOS_PARTITION=y
   7.481 +# CONFIG_BSD_DISKLABEL is not set
   7.482 +# CONFIG_MINIX_SUBPARTITION is not set
   7.483 +# CONFIG_SOLARIS_X86_PARTITION is not set
   7.484 +# CONFIG_UNIXWARE_DISKLABEL is not set
   7.485 +# CONFIG_LDM_PARTITION is not set
   7.486 +# CONFIG_SGI_PARTITION is not set
   7.487 +# CONFIG_ULTRIX_PARTITION is not set
   7.488 +# CONFIG_SUN_PARTITION is not set
   7.489 +# CONFIG_EFI_PARTITION is not set
   7.490 +# CONFIG_SMB_NLS is not set
   7.491 +CONFIG_NLS=y
   7.492 +
   7.493 +#
   7.494 +# Native Language Support
   7.495 +#
   7.496 +CONFIG_NLS_DEFAULT="iso8559-1"
   7.497 +# CONFIG_NLS_CODEPAGE_437 is not set
   7.498 +# CONFIG_NLS_CODEPAGE_737 is not set
   7.499 +# CONFIG_NLS_CODEPAGE_775 is not set
   7.500 +# CONFIG_NLS_CODEPAGE_850 is not set
   7.501 +# CONFIG_NLS_CODEPAGE_852 is not set
   7.502 +# CONFIG_NLS_CODEPAGE_855 is not set
   7.503 +# CONFIG_NLS_CODEPAGE_857 is not set
   7.504 +# CONFIG_NLS_CODEPAGE_860 is not set
   7.505 +# CONFIG_NLS_CODEPAGE_861 is not set
   7.506 +# CONFIG_NLS_CODEPAGE_862 is not set
   7.507 +# CONFIG_NLS_CODEPAGE_863 is not set
   7.508 +# CONFIG_NLS_CODEPAGE_864 is not set
   7.509 +# CONFIG_NLS_CODEPAGE_865 is not set
   7.510 +# CONFIG_NLS_CODEPAGE_866 is not set
   7.511 +# CONFIG_NLS_CODEPAGE_869 is not set
   7.512 +# CONFIG_NLS_CODEPAGE_936 is not set
   7.513 +# CONFIG_NLS_CODEPAGE_950 is not set
   7.514 +# CONFIG_NLS_CODEPAGE_932 is not set
   7.515 +# CONFIG_NLS_CODEPAGE_949 is not set
   7.516 +# CONFIG_NLS_CODEPAGE_874 is not set
   7.517 +# CONFIG_NLS_ISO8859_8 is not set
   7.518 +# CONFIG_NLS_CODEPAGE_1250 is not set
   7.519 +# CONFIG_NLS_CODEPAGE_1251 is not set
   7.520 +CONFIG_NLS_ISO8859_1=y
   7.521 +# CONFIG_NLS_ISO8859_2 is not set
   7.522 +# CONFIG_NLS_ISO8859_3 is not set
   7.523 +# CONFIG_NLS_ISO8859_4 is not set
   7.524 +# CONFIG_NLS_ISO8859_5 is not set
   7.525 +# CONFIG_NLS_ISO8859_6 is not set
   7.526 +# CONFIG_NLS_ISO8859_7 is not set
   7.527 +# CONFIG_NLS_ISO8859_9 is not set
   7.528 +# CONFIG_NLS_ISO8859_13 is not set
   7.529 +# CONFIG_NLS_ISO8859_14 is not set
   7.530 +# CONFIG_NLS_ISO8859_15 is not set
   7.531 +# CONFIG_NLS_KOI8_R is not set
   7.532 +# CONFIG_NLS_KOI8_U is not set
   7.533 +# CONFIG_NLS_UTF8 is not set
   7.534 +
   7.535 +#
   7.536 +# Console drivers
   7.537 +#
   7.538 +CONFIG_XEN_CONSOLE=y
   7.539 +
   7.540 +#
   7.541 +# Kernel hacking
   7.542 +#
   7.543 +CONFIG_DEBUG_KERNEL=y
   7.544 +# CONFIG_DEBUG_STACKOVERFLOW is not set
   7.545 +# CONFIG_DEBUG_HIGHMEM is not set
   7.546 +# CONFIG_DEBUG_SLAB is not set
   7.547 +# CONFIG_DEBUG_IOVIRT is not set
   7.548 +# CONFIG_MAGIC_SYSRQ is not set
   7.549 +# CONFIG_DEBUG_SPINLOCK is not set
   7.550 +# CONFIG_DEBUG_BUGVERBOSE is not set
   7.551 +CONFIG_KALLSYMS=y
   7.552 +# CONFIG_FRAME_POINTER is not set
   7.553 +CONFIG_LOG_BUF_SHIFT=0
   7.554 +
   7.555 +#
   7.556 +# Cryptographic options
   7.557 +#
   7.558 +# CONFIG_CRYPTO is not set
   7.559 +
   7.560 +#
   7.561 +# Library routines
   7.562 +#
   7.563 +# CONFIG_CRC32 is not set
   7.564 +CONFIG_ZLIB_INFLATE=y
   7.565 +# CONFIG_ZLIB_DEFLATE is not set
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/balloon/Makefile	Mon Jul 11 09:29:56 2005 -0500
     8.3 @@ -0,0 +1,4 @@
     8.4 +O_TARGET := drv.o
     8.5 +export-objs := balloon.o
     8.6 +obj-y := balloon.o
     8.7 +include $(TOPDIR)/Rules.make
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/blkif/Makefile	Mon Jul 11 09:29:56 2005 -0500
     9.3 @@ -0,0 +1,10 @@
     9.4 +
     9.5 +O_TARGET := drv.o
     9.6 +
     9.7 +subdir-$(CONFIG_XEN_BLKDEV_FRONTEND) += frontend
     9.8 +obj-$(CONFIG_XEN_BLKDEV_FRONTEND)    += frontend/drv.o
     9.9 +
    9.10 +subdir-$(CONFIG_XEN_PHYSDEV_ACCESS) += backend
    9.11 +obj-$(CONFIG_XEN_PHYSDEV_ACCESS)    += backend/drv.o
    9.12 +
    9.13 +include $(TOPDIR)/Rules.make
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/blkif/backend/Makefile	Mon Jul 11 09:29:56 2005 -0500
    10.3 @@ -0,0 +1,3 @@
    10.4 +O_TARGET := drv.o
    10.5 +obj-y := main.o control.o interface.o vbd.o
    10.6 +include $(TOPDIR)/Rules.make
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/Makefile	Mon Jul 11 09:29:56 2005 -0500
    11.3 @@ -0,0 +1,3 @@
    11.4 +O_TARGET := drv.o
    11.5 +obj-y := blkfront.o vbd.o
    11.6 +include $(TOPDIR)/Rules.make
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/common.h	Mon Jul 11 09:29:56 2005 -0500
    12.3 @@ -0,0 +1,93 @@
    12.4 +/******************************************************************************
    12.5 + * arch/xen/drivers/blkif/frontend/common.h
    12.6 + * 
    12.7 + * Shared definitions between all levels of XenoLinux Virtual block devices.
    12.8 + */
    12.9 +
   12.10 +#ifndef __XEN_DRIVERS_COMMON_H__
   12.11 +#define __XEN_DRIVERS_COMMON_H__
   12.12 +
   12.13 +#include <linux/config.h>
   12.14 +#include <linux/module.h>
   12.15 +#include <linux/kernel.h>
   12.16 +#include <linux/sched.h>
   12.17 +#include <linux/slab.h>
   12.18 +#include <linux/string.h>
   12.19 +#include <linux/errno.h>
   12.20 +#include <linux/fs.h>
   12.21 +#include <linux/hdreg.h>
   12.22 +#include <linux/blkdev.h>
   12.23 +#include <linux/major.h>
   12.24 +#include <asm-xen/xen-public/xen.h>
   12.25 +#include <asm/io.h>
   12.26 +#include <asm/atomic.h>
   12.27 +#include <asm/uaccess.h>
   12.28 +#include <asm-xen/xen-public/io/blkif.h>
   12.29 +
   12.30 +#if 1
   12.31 +#define IPRINTK(fmt, args...) \
   12.32 +    printk(KERN_INFO "xen_blk: " fmt, ##args)
   12.33 +#else
   12.34 +#define IPRINTK(fmt, args...) ((void)0)
   12.35 +#endif
   12.36 +
   12.37 +#if 1
   12.38 +#define WPRINTK(fmt, args...) \
   12.39 +    printk(KERN_WARNING "xen_blk: " fmt, ##args)
   12.40 +#else
   12.41 +#define WPRINTK(fmt, args...) ((void)0)
   12.42 +#endif
   12.43 +
   12.44 +#if 0
   12.45 +#define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
   12.46 +#else
   12.47 +#define DPRINTK(_f, _a...) ((void)0)
   12.48 +#endif
   12.49 +
   12.50 +#if 0
   12.51 +#define DPRINTK_IOCTL(_f, _a...) printk ( KERN_ALERT _f , ## _a )
   12.52 +#else
   12.53 +#define DPRINTK_IOCTL(_f, _a...) ((void)0)
   12.54 +#endif
   12.55 +
   12.56 +/* Private gendisk->flags[] values. */
   12.57 +#define GENHD_FL_XEN        2 /* Is unit a Xen block device?  */
   12.58 +#define GENHD_FL_VIRT_PARTNS 4 /* Are unit partitions virtual? */
   12.59 +
   12.60 +/*
   12.61 + * We have one of these per vbd, whether ide, scsi or 'other'.
   12.62 + * They hang in an array off the gendisk structure. We may end up putting
   12.63 + * all kinds of interesting stuff here :-)
   12.64 + */
   12.65 +typedef struct xl_disk {
   12.66 +    int usage;
   12.67 +} xl_disk_t;
   12.68 +
   12.69 +extern int blkif_open(struct inode *inode, struct file *filep);
   12.70 +extern int blkif_release(struct inode *inode, struct file *filep);
   12.71 +extern int blkif_ioctl(struct inode *inode, struct file *filep,
   12.72 +                                 unsigned command, unsigned long argument);
   12.73 +extern int blkif_check(kdev_t dev);
   12.74 +extern int blkif_revalidate(kdev_t dev);
   12.75 +extern void blkif_control_send(blkif_request_t *req, blkif_response_t *rsp);
   12.76 +extern void do_blkif_request (request_queue_t *rq); 
   12.77 +
   12.78 +extern void xlvbd_update_vbds(void);
   12.79 +
   12.80 +static inline xl_disk_t *xldev_to_xldisk(kdev_t xldev)
   12.81 +{
   12.82 +    struct gendisk *gd = get_gendisk(xldev);
   12.83 +    
   12.84 +    if ( gd == NULL ) 
   12.85 +        return NULL;
   12.86 +    
   12.87 +    return (xl_disk_t *)gd->real_devices + 
   12.88 +        (MINOR(xldev) >> gd->minor_shift);
   12.89 +}
   12.90 +
   12.91 +
   12.92 +/* Virtual block-device subsystem. */
   12.93 +extern int  xlvbd_init(void);
   12.94 +extern void xlvbd_cleanup(void); 
   12.95 +
   12.96 +#endif /* __XEN_DRIVERS_COMMON_H__ */
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/blkif/frontend/vbd.c	Mon Jul 11 09:29:56 2005 -0500
    13.3 @@ -0,0 +1,540 @@
    13.4 +/******************************************************************************
    13.5 + * arch/xen/drivers/blkif/frontend/vbd.c
    13.6 + * 
    13.7 + * Xenolinux virtual block-device driver.
    13.8 + * 
    13.9 + * Copyright (c) 2003-2004, Keir Fraser & Steve Hand
   13.10 + * Modifications by Mark A. Williamson are (c) Intel Research Cambridge
   13.11 + */
   13.12 +
   13.13 +#include "common.h"
   13.14 +#include <linux/blk.h>
   13.15 +
   13.16 +/*
   13.17 + * For convenience we distinguish between ide, scsi and 'other' (i.e.
   13.18 + * potentially combinations of the two) in the naming scheme and in a few 
   13.19 + * other places (like default readahead, etc).
   13.20 + */
   13.21 +#define XLIDE_MAJOR_NAME  "hd"
   13.22 +#define XLSCSI_MAJOR_NAME "sd"
   13.23 +#define XLVBD_MAJOR_NAME "xvd"
   13.24 +
   13.25 +#define XLIDE_DEVS_PER_MAJOR   2
   13.26 +#define XLSCSI_DEVS_PER_MAJOR 16
   13.27 +#define XLVBD_DEVS_PER_MAJOR  16
   13.28 +
   13.29 +#define XLIDE_PARTN_SHIFT  6    /* amount to shift minor to get 'real' minor */
   13.30 +#define XLIDE_MAX_PART    (1 << XLIDE_PARTN_SHIFT)     /* minors per ide vbd */
   13.31 +
   13.32 +#define XLSCSI_PARTN_SHIFT 4    /* amount to shift minor to get 'real' minor */
   13.33 +#define XLSCSI_MAX_PART   (1 << XLSCSI_PARTN_SHIFT)   /* minors per scsi vbd */
   13.34 +
   13.35 +#define XLVBD_PARTN_SHIFT  4    /* amount to shift minor to get 'real' minor */
   13.36 +#define XLVBD_MAX_PART    (1 << XLVBD_PARTN_SHIFT) /* minors per 'other' vbd */
   13.37 +
   13.38 +/* The below are for the generic drivers/block/ll_rw_block.c code. */
   13.39 +static int xlide_blksize_size[256];
   13.40 +static int xlide_hardsect_size[256];
   13.41 +static int xlide_max_sectors[256];
   13.42 +static int xlscsi_blksize_size[256];
   13.43 +static int xlscsi_hardsect_size[256];
   13.44 +static int xlscsi_max_sectors[256];
   13.45 +static int xlvbd_blksize_size[256];
   13.46 +static int xlvbd_hardsect_size[256];
   13.47 +static int xlvbd_max_sectors[256];
   13.48 +
   13.49 +/* Information about our VBDs. */
   13.50 +#define MAX_VBDS 64
   13.51 +static int nr_vbds;
   13.52 +static vdisk_t *vbd_info;
   13.53 +
   13.54 +static struct block_device_operations xlvbd_block_fops = 
   13.55 +{
   13.56 +    open:               blkif_open,
   13.57 +    release:            blkif_release,
   13.58 +    ioctl:              blkif_ioctl,
   13.59 +    check_media_change: blkif_check,
   13.60 +    revalidate:         blkif_revalidate,
   13.61 +};
   13.62 +
   13.63 +static int xlvbd_get_vbd_info(vdisk_t *disk_info)
   13.64 +{
   13.65 +    vdisk_t         *buf = (vdisk_t *)__get_free_page(GFP_KERNEL);
   13.66 +    blkif_request_t  req;
   13.67 +    blkif_response_t rsp;
   13.68 +    int              nr;
   13.69 +
   13.70 +    memset(&req, 0, sizeof(req));
   13.71 +    req.operation   = BLKIF_OP_PROBE;
   13.72 +    req.nr_segments = 1;
   13.73 +#ifdef CONFIG_XEN_BLKDEV_GRANT
   13.74 +    blkif_control_probe_send(&req, &rsp,
   13.75 +                             (unsigned long)(virt_to_machine(buf)));
   13.76 +#else
   13.77 +    req.frame_and_sects[0] = virt_to_machine(buf) | 7;
   13.78 +
   13.79 +    blkif_control_send(&req, &rsp);
   13.80 +#endif
   13.81 +
   13.82 +    if ( rsp.status <= 0 )
   13.83 +    {
   13.84 +        printk(KERN_ALERT "Could not probe disks (%d)\n", rsp.status);
   13.85 +        return -1;
   13.86 +    }
   13.87 +
   13.88 +    if ( (nr = rsp.status) > MAX_VBDS )
   13.89 +         nr = MAX_VBDS;
   13.90 +    memcpy(disk_info, buf, nr * sizeof(vdisk_t));
   13.91 +
   13.92 +    return nr;
   13.93 +}
   13.94 +
   13.95 +/*
   13.96 + * xlvbd_init_device - initialise a VBD device
   13.97 + * @disk:              a vdisk_t describing the VBD
   13.98 + *
   13.99 + * Takes a vdisk_t * that describes a VBD the domain has access to.
  13.100 + * Performs appropriate initialisation and registration of the device.
  13.101 + *
  13.102 + * Care needs to be taken when making re-entrant calls to ensure that
  13.103 + * corruption does not occur.  Also, devices that are in use should not have
  13.104 + * their details updated.  This is the caller's responsibility.
  13.105 + */
  13.106 +static int xlvbd_init_device(vdisk_t *xd)
  13.107 +{
  13.108 +    int device = xd->device;
  13.109 +    int major  = MAJOR(device); 
  13.110 +    int minor  = MINOR(device);
  13.111 +    int is_ide = IDE_DISK_MAJOR(major);  /* is this an ide device? */
  13.112 +    int is_scsi= SCSI_BLK_MAJOR(major);  /* is this a scsi device? */
  13.113 +    char *major_name;
  13.114 +    struct gendisk *gd;
  13.115 +    struct block_device *bd;
  13.116 +    xl_disk_t *disk;
  13.117 +    int i, rc = 0, max_part, partno;
  13.118 +    unsigned long capacity;
  13.119 +
  13.120 +    unsigned char buf[64];
  13.121 +
  13.122 +    if ( (bd = bdget(device)) == NULL )
  13.123 +        return -1;
  13.124 +
  13.125 +    if ( ((disk = xldev_to_xldisk(device)) != NULL) && (disk->usage != 0) )
  13.126 +    {
  13.127 +        printk(KERN_ALERT "VBD update failed - in use [dev=%x]\n", device);
  13.128 +        rc = -1;
  13.129 +        goto out;
  13.130 +    }
  13.131 +
  13.132 +    if ( is_ide ) {
  13.133 +
  13.134 +	major_name = XLIDE_MAJOR_NAME; 
  13.135 +	max_part   = XLIDE_MAX_PART;
  13.136 +
  13.137 +    } else if ( is_scsi ) {
  13.138 +
  13.139 +	major_name = XLSCSI_MAJOR_NAME;
  13.140 +	max_part   = XLSCSI_MAX_PART;
  13.141 +
  13.142 +    } else { 
  13.143 +
  13.144 +        /* SMH: hmm - probably a CCISS driver or sim; assume CCISS for now */
  13.145 +	printk(KERN_ALERT "Assuming device %02x:%02x is CCISS/SCSI\n", 
  13.146 +	       major, minor);
  13.147 +	is_scsi    = 1; 
  13.148 +	major_name = "cciss"; 
  13.149 +	max_part   = XLSCSI_MAX_PART;
  13.150 +
  13.151 +    }
  13.152 +    
  13.153 +    partno = minor & (max_part - 1); 
  13.154 +    
  13.155 +    if ( (gd = get_gendisk(device)) == NULL )
  13.156 +    {
  13.157 +        rc = register_blkdev(major, major_name, &xlvbd_block_fops);
  13.158 +        if ( rc < 0 )
  13.159 +        {
  13.160 +            printk(KERN_ALERT "XL VBD: can't get major %d\n", major);
  13.161 +            goto out;
  13.162 +        }
  13.163 +
  13.164 +        if ( is_ide )
  13.165 +        { 
  13.166 +            blksize_size[major]  = xlide_blksize_size;
  13.167 +            hardsect_size[major] = xlide_hardsect_size;
  13.168 +            max_sectors[major]   = xlide_max_sectors;
  13.169 +            read_ahead[major]    = 8;
  13.170 +        } 
  13.171 +        else if ( is_scsi )
  13.172 +        { 
  13.173 +            blksize_size[major]  = xlscsi_blksize_size;
  13.174 +            hardsect_size[major] = xlscsi_hardsect_size;
  13.175 +            max_sectors[major]   = xlscsi_max_sectors;
  13.176 +            read_ahead[major]    = 8;
  13.177 +        }
  13.178 +        else
  13.179 +        { 
  13.180 +            blksize_size[major]  = xlvbd_blksize_size;
  13.181 +            hardsect_size[major] = xlvbd_hardsect_size;
  13.182 +            max_sectors[major]   = xlvbd_max_sectors;
  13.183 +            read_ahead[major]    = 8;
  13.184 +        }
  13.185 +
  13.186 +        blk_init_queue(BLK_DEFAULT_QUEUE(major), do_blkif_request);
  13.187 +
  13.188 +        /*
  13.189 +         * Turn off barking 'headactive' mode. We dequeue buffer heads as
  13.190 +         * soon as we pass them to the back-end driver.
  13.191 +         */
  13.192 +        blk_queue_headactive(BLK_DEFAULT_QUEUE(major), 0);
  13.193 +
  13.194 +        /* Construct an appropriate gendisk structure. */
  13.195 +        gd             = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
  13.196 +        gd->major      = major;
  13.197 +        gd->major_name = major_name; 
  13.198 +    
  13.199 +        gd->max_p      = max_part; 
  13.200 +        if ( is_ide )
  13.201 +        { 
  13.202 +            gd->minor_shift  = XLIDE_PARTN_SHIFT; 
  13.203 +            gd->nr_real      = XLIDE_DEVS_PER_MAJOR; 
  13.204 +        } 
  13.205 +        else if ( is_scsi )
  13.206 +        { 
  13.207 +            gd->minor_shift  = XLSCSI_PARTN_SHIFT; 
  13.208 +            gd->nr_real      = XLSCSI_DEVS_PER_MAJOR; 
  13.209 +        }
  13.210 +        else
  13.211 +        { 
  13.212 +            gd->minor_shift  = XLVBD_PARTN_SHIFT; 
  13.213 +            gd->nr_real      = XLVBD_DEVS_PER_MAJOR; 
  13.214 +        }
  13.215 +
  13.216 +        /* 
  13.217 +        ** The sizes[] and part[] arrays hold the sizes and other 
  13.218 +        ** information about every partition with this 'major' (i.e. 
  13.219 +        ** every disk sharing the 8 bit prefix * max partns per disk) 
  13.220 +        */
  13.221 +        gd->sizes = kmalloc(max_part*gd->nr_real*sizeof(int), GFP_KERNEL);
  13.222 +        gd->part  = kmalloc(max_part*gd->nr_real*sizeof(struct hd_struct), 
  13.223 +                            GFP_KERNEL);
  13.224 +        memset(gd->sizes, 0, max_part * gd->nr_real * sizeof(int));
  13.225 +        memset(gd->part,  0, max_part * gd->nr_real 
  13.226 +               * sizeof(struct hd_struct));
  13.227 +
  13.228 +
  13.229 +        gd->real_devices = kmalloc(gd->nr_real * sizeof(xl_disk_t), 
  13.230 +                                   GFP_KERNEL);
  13.231 +        memset(gd->real_devices, 0, gd->nr_real * sizeof(xl_disk_t));
  13.232 +
  13.233 +        gd->next   = NULL;            
  13.234 +        gd->fops   = &xlvbd_block_fops;
  13.235 +
  13.236 +        gd->de_arr = kmalloc(gd->nr_real * sizeof(*gd->de_arr), 
  13.237 +                             GFP_KERNEL);
  13.238 +        gd->flags  = kmalloc(gd->nr_real * sizeof(*gd->flags), GFP_KERNEL);
  13.239 +    
  13.240 +        memset(gd->de_arr, 0, gd->nr_real * sizeof(*gd->de_arr));
  13.241 +        memset(gd->flags, 0, gd->nr_real *  sizeof(*gd->flags));
  13.242 +
  13.243 +        add_gendisk(gd);
  13.244 +
  13.245 +        blk_size[major] = gd->sizes;
  13.246 +    }
  13.247 +
  13.248 +    if ( xd->info & VDISK_READONLY )
  13.249 +        set_device_ro(device, 1);
  13.250 +
  13.251 +    gd->flags[minor >> gd->minor_shift] |= GENHD_FL_XEN;
  13.252 +
  13.253 +    /* NB. Linux 2.4 only handles 32-bit sector offsets and capacities. */
  13.254 +    capacity = (unsigned long)xd->capacity;
  13.255 +
  13.256 +    if ( partno != 0 )
  13.257 +    {
  13.258 +        /*
  13.259 +         * If this was previously set up as a real disc we will have set 
  13.260 +         * up partition-table information. Virtual partitions override 
  13.261 +         * 'real' partitions, and the two cannot coexist on a device.
  13.262 +         */
  13.263 +        if ( !(gd->flags[minor >> gd->minor_shift] & GENHD_FL_VIRT_PARTNS) &&
  13.264 +             (gd->sizes[minor & ~(max_part-1)] != 0) )
  13.265 +        {
  13.266 +            /*
  13.267 +             * Any non-zero sub-partition entries must be cleaned out before
  13.268 +             * installing 'virtual' partition entries. The two types cannot
  13.269 +             * coexist, and virtual partitions are favoured.
  13.270 +             */
  13.271 +            kdev_t dev = device & ~(max_part-1);
  13.272 +            for ( i = max_part - 1; i > 0; i-- )
  13.273 +            {
  13.274 +                invalidate_device(dev+i, 1);
  13.275 +                gd->part[MINOR(dev+i)].start_sect = 0;
  13.276 +                gd->part[MINOR(dev+i)].nr_sects   = 0;
  13.277 +                gd->sizes[MINOR(dev+i)]           = 0;
  13.278 +            }
  13.279 +            printk(KERN_ALERT
  13.280 +                   "Virtual partitions found for /dev/%s - ignoring any "
  13.281 +                   "real partition information we may have found.\n",
  13.282 +                   disk_name(gd, MINOR(device), buf));
  13.283 +        }
  13.284 +
  13.285 +        /* Need to skankily setup 'partition' information */
  13.286 +        gd->part[minor].start_sect = 0; 
  13.287 +        gd->part[minor].nr_sects   = capacity; 
  13.288 +        gd->sizes[minor]           = capacity >>(BLOCK_SIZE_BITS-9); 
  13.289 +
  13.290 +        gd->flags[minor >> gd->minor_shift] |= GENHD_FL_VIRT_PARTNS;
  13.291 +    }
  13.292 +    else
  13.293 +    {
  13.294 +        gd->part[minor].nr_sects = capacity;
  13.295 +        gd->sizes[minor] = capacity>>(BLOCK_SIZE_BITS-9);
  13.296 +        
  13.297 +        /* Some final fix-ups depending on the device type */
  13.298 +        if ( xd->info & VDISK_REMOVABLE )
  13.299 +        { 
  13.300 +            gd->flags[minor >> gd->minor_shift] |= GENHD_FL_REMOVABLE; 
  13.301 +            printk(KERN_ALERT 
  13.302 +                   "Skipping partition check on %s /dev/%s\n", 
  13.303 +                   (xd->info & VDISK_CDROM) ? "cdrom" : "removable",
  13.304 +                   disk_name(gd, MINOR(device), buf)); 
  13.305 +        }
  13.306 +        else
  13.307 +        {
  13.308 +            /* Only check partitions on real discs (not virtual!). */
  13.309 +            if ( gd->flags[minor>>gd->minor_shift] & GENHD_FL_VIRT_PARTNS )
  13.310 +            {
  13.311 +                printk(KERN_ALERT
  13.312 +                       "Skipping partition check on virtual /dev/%s\n",
  13.313 +                       disk_name(gd, MINOR(device), buf));
  13.314 +                break;
  13.315 +            }
  13.316 +            register_disk(gd, device, gd->max_p, &xlvbd_block_fops, capacity);
  13.317 +        }
  13.318 +    }
  13.319 +
  13.320 + out:
  13.321 +    bdput(bd);    
  13.322 +    return rc;
  13.323 +}
  13.324 +
  13.325 +
  13.326 +/*
  13.327 + * xlvbd_remove_device - remove a device node if possible
  13.328 + * @device:       numeric device ID
  13.329 + *
  13.330 + * Updates the gendisk structure and invalidates devices.
  13.331 + *
  13.332 + * This is OK for now but in future, should perhaps consider where this should
  13.333 + * deallocate gendisks / unregister devices.
  13.334 + */
  13.335 +static int xlvbd_remove_device(int device)
  13.336 +{
  13.337 +    int i, rc = 0, minor = MINOR(device);
  13.338 +    struct gendisk *gd;
  13.339 +    struct block_device *bd;
  13.340 +    xl_disk_t *disk = NULL;
  13.341 +
  13.342 +    if ( (bd = bdget(device)) == NULL )
  13.343 +        return -1;
  13.344 +
  13.345 +    if ( ((gd = get_gendisk(device)) == NULL) ||
  13.346 +         ((disk = xldev_to_xldisk(device)) == NULL) )
  13.347 +        BUG();
  13.348 +
  13.349 +    if ( disk->usage != 0 )
  13.350 +    {
  13.351 +        printk(KERN_ALERT "VBD removal failed - in use [dev=%x]\n", device);
  13.352 +        rc = -1;
  13.353 +        goto out;
  13.354 +    }
  13.355 + 
  13.356 +    if ( (minor & (gd->max_p-1)) != 0 )
  13.357 +    {
  13.358 +        /* 1: The VBD is mapped to a partition rather than a whole unit. */
  13.359 +        invalidate_device(device, 1);
  13.360 +	gd->part[minor].start_sect = 0;
  13.361 +        gd->part[minor].nr_sects   = 0;
  13.362 +        gd->sizes[minor]           = 0;
  13.363 +
  13.364 +        /* Clear the consists-of-virtual-partitions flag if possible. */
  13.365 +        gd->flags[minor >> gd->minor_shift] &= ~GENHD_FL_VIRT_PARTNS;
  13.366 +        for ( i = 1; i < gd->max_p; i++ )
  13.367 +            if ( gd->sizes[(minor & ~(gd->max_p-1)) + i] != 0 )
  13.368 +                gd->flags[minor >> gd->minor_shift] |= GENHD_FL_VIRT_PARTNS;
  13.369 +
  13.370 +        /*
  13.371 +         * If all virtual partitions are now gone, and a 'whole unit' VBD is
  13.372 +         * present, then we can try to grok the unit's real partition table.
  13.373 +         */
  13.374 +        if ( !(gd->flags[minor >> gd->minor_shift] & GENHD_FL_VIRT_PARTNS) &&
  13.375 +             (gd->sizes[minor & ~(gd->max_p-1)] != 0) &&
  13.376 +             !(gd->flags[minor >> gd->minor_shift] & GENHD_FL_REMOVABLE) )
  13.377 +        {
  13.378 +            register_disk(gd,
  13.379 +                          device&~(gd->max_p-1), 
  13.380 +                          gd->max_p, 
  13.381 +                          &xlvbd_block_fops,
  13.382 +                          gd->part[minor&~(gd->max_p-1)].nr_sects);
  13.383 +        }
  13.384 +    }
  13.385 +    else
  13.386 +    {
  13.387 +        /*
  13.388 +         * 2: The VBD is mapped to an entire 'unit'. Clear all partitions.
  13.389 +         * NB. The partition entries are only cleared if there are no VBDs
  13.390 +         * mapped to individual partitions on this unit.
  13.391 +         */
  13.392 +        i = gd->max_p - 1; /* Default: clear subpartitions as well. */
  13.393 +        if ( gd->flags[minor >> gd->minor_shift] & GENHD_FL_VIRT_PARTNS )
  13.394 +            i = 0; /* 'Virtual' mode: only clear the 'whole unit' entry. */
  13.395 +        while ( i >= 0 )
  13.396 +        {
  13.397 +            invalidate_device(device+i, 1);
  13.398 +            gd->part[minor+i].start_sect = 0;
  13.399 +            gd->part[minor+i].nr_sects   = 0;
  13.400 +            gd->sizes[minor+i]           = 0;
  13.401 +            i--;
  13.402 +        }
  13.403 +    }
  13.404 +
  13.405 + out:
  13.406 +    bdput(bd);
  13.407 +    return rc;
  13.408 +}
  13.409 +
  13.410 +/*
  13.411 + * xlvbd_update_vbds - reprobes the VBD status and performs updates driver
  13.412 + * state. The VBDs need to be updated in this way when the domain is
  13.413 + * initialised and also each time we receive an XLBLK_UPDATE event.
  13.414 + */
  13.415 +void xlvbd_update_vbds(void)
  13.416 +{
  13.417 +    int i, j, k, old_nr, new_nr;
  13.418 +    vdisk_t *old_info, *new_info, *merged_info;
  13.419 +
  13.420 +    old_info = vbd_info;
  13.421 +    old_nr   = nr_vbds;
  13.422 +
  13.423 +    new_info = kmalloc(MAX_VBDS * sizeof(vdisk_t), GFP_KERNEL);
  13.424 +    if (!new_info)
  13.425 +        return;
  13.426 +
  13.427 +    if ( unlikely(new_nr = xlvbd_get_vbd_info(new_info)) < 0 )
  13.428 +        goto out;
  13.429 +
  13.430 +    /*
  13.431 +     * Final list maximum size is old list + new list. This occurs only when
  13.432 +     * old list and new list do not overlap at all, and we cannot yet destroy
  13.433 +     * VBDs in the old list because the usage counts are busy.
  13.434 +     */
  13.435 +    merged_info = kmalloc((old_nr + new_nr) * sizeof(vdisk_t), GFP_KERNEL);
  13.436 +    if (!merged_info)
  13.437 +        goto out;
  13.438 +
  13.439 +    /* @i tracks old list; @j tracks new list; @k tracks merged list. */
  13.440 +    i = j = k = 0;
  13.441 +
  13.442 +    while ( (i < old_nr) && (j < new_nr) )
  13.443 +    {
  13.444 +        if ( old_info[i].device < new_info[j].device )
  13.445 +        {
  13.446 +            if ( xlvbd_remove_device(old_info[i].device) != 0 )
  13.447 +                memcpy(&merged_info[k++], &old_info[i], sizeof(vdisk_t));
  13.448 +            i++;
  13.449 +        }
  13.450 +        else if ( old_info[i].device > new_info[j].device )
  13.451 +        {
  13.452 +            if ( xlvbd_init_device(&new_info[j]) == 0 )
  13.453 +                memcpy(&merged_info[k++], &new_info[j], sizeof(vdisk_t));
  13.454 +            j++;
  13.455 +        }
  13.456 +        else
  13.457 +        {
  13.458 +            if ( ((old_info[i].capacity == new_info[j].capacity) &&
  13.459 +                  (old_info[i].info == new_info[j].info)) ||
  13.460 +                 (xlvbd_remove_device(old_info[i].device) != 0) )
  13.461 +                memcpy(&merged_info[k++], &old_info[i], sizeof(vdisk_t));
  13.462 +            else if ( xlvbd_init_device(&new_info[j]) == 0 )
  13.463 +                memcpy(&merged_info[k++], &new_info[j], sizeof(vdisk_t));
  13.464 +            i++; j++;
  13.465 +        }
  13.466 +    }
  13.467 +
  13.468 +    for ( ; i < old_nr; i++ )
  13.469 +    {
  13.470 +        if ( xlvbd_remove_device(old_info[i].device) != 0 )
  13.471 +            memcpy(&merged_info[k++], &old_info[i], sizeof(vdisk_t));
  13.472 +    }
  13.473 +
  13.474 +    for ( ; j < new_nr; j++ )
  13.475 +    {
  13.476 +        if ( xlvbd_init_device(&new_info[j]) == 0 )
  13.477 +            memcpy(&merged_info[k++], &new_info[j], sizeof(vdisk_t));
  13.478 +    }
  13.479 +
  13.480 +    vbd_info = merged_info;
  13.481 +    nr_vbds  = k;
  13.482 +
  13.483 +    kfree(old_info);
  13.484 +out:
  13.485 +    kfree(new_info);
  13.486 +}
  13.487 +
  13.488 +
  13.489 +/*
  13.490 + * Set up all the linux device goop for the virtual block devices (vbd's) that
  13.491 + * we know about. Note that although from the backend driver's p.o.v. VBDs are
  13.492 + * addressed simply an opaque 16-bit device number, the domain creation tools 
  13.493 + * conventionally allocate these numbers to correspond to those used by 'real' 
  13.494 + * linux -- this is just for convenience as it means e.g. that the same 
  13.495 + * /etc/fstab can be used when booting with or without Xen.
  13.496 + */
  13.497 +int xlvbd_init(void)
  13.498 +{
  13.499 +    int i;
  13.500 +    
  13.501 +    /*
  13.502 +     * If compiled as a module, we don't support unloading yet. We therefore 
  13.503 +     * permanently increment the reference count to disallow it.
  13.504 +     */
  13.505 +    SET_MODULE_OWNER(&xlvbd_block_fops);
  13.506 +    MOD_INC_USE_COUNT;
  13.507 +
  13.508 +    /* Initialize the global arrays. */
  13.509 +    for ( i = 0; i < 256; i++ ) 
  13.510 +    {
  13.511 +        xlide_blksize_size[i]  = 1024;
  13.512 +        xlide_hardsect_size[i] = 512;
  13.513 +        xlide_max_sectors[i]   = 512;
  13.514 +
  13.515 +        xlscsi_blksize_size[i]  = 1024;
  13.516 +        xlscsi_hardsect_size[i] = 512;
  13.517 +        xlscsi_max_sectors[i]   = 512;
  13.518 +
  13.519 +        xlvbd_blksize_size[i]  = 512;
  13.520 +        xlvbd_hardsect_size[i] = 512;
  13.521 +        xlvbd_max_sectors[i]   = 512;
  13.522 +    }
  13.523 +
  13.524 +    vbd_info = kmalloc(MAX_VBDS * sizeof(vdisk_t), GFP_KERNEL);
  13.525 +    if (!vbd_info)
  13.526 +        return -ENOMEM;
  13.527 +
  13.528 +    nr_vbds  = xlvbd_get_vbd_info(vbd_info);
  13.529 +
  13.530 +    if ( nr_vbds < 0 )
  13.531 +    {
  13.532 +        kfree(vbd_info);
  13.533 +        vbd_info = NULL;
  13.534 +        nr_vbds  = 0;
  13.535 +    }
  13.536 +    else
  13.537 +    {
  13.538 +        for ( i = 0; i < nr_vbds; i++ )
  13.539 +            xlvbd_init_device(&vbd_info[i]);
  13.540 +    }
  13.541 +
  13.542 +    return 0;
  13.543 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/console/Makefile	Mon Jul 11 09:29:56 2005 -0500
    14.3 @@ -0,0 +1,3 @@
    14.4 +O_TARGET := drv.o
    14.5 +obj-$(CONFIG_XEN_CONSOLE) := console.o
    14.6 +include $(TOPDIR)/Rules.make
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/dom0/Makefile	Mon Jul 11 09:29:56 2005 -0500
    15.3 @@ -0,0 +1,3 @@
    15.4 +O_TARGET := drv.o
    15.5 +obj-y := core.o
    15.6 +include $(TOPDIR)/Rules.make
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/evtchn/Makefile	Mon Jul 11 09:29:56 2005 -0500
    16.3 @@ -0,0 +1,3 @@
    16.4 +O_TARGET := drv.o
    16.5 +obj-y := evtchn.o
    16.6 +include $(TOPDIR)/Rules.make
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/netif/Makefile	Mon Jul 11 09:29:56 2005 -0500
    17.3 @@ -0,0 +1,10 @@
    17.4 +
    17.5 +O_TARGET := drv.o
    17.6 +
    17.7 +subdir-$(CONFIG_XEN_NETDEV_FRONTEND) += frontend
    17.8 +obj-$(CONFIG_XEN_NETDEV_FRONTEND)    += frontend/drv.o
    17.9 +
   17.10 +subdir-$(CONFIG_XEN_PHYSDEV_ACCESS) += backend
   17.11 +obj-$(CONFIG_XEN_PHYSDEV_ACCESS)    += backend/drv.o
   17.12 +
   17.13 +include $(TOPDIR)/Rules.make
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/netif/backend/Makefile	Mon Jul 11 09:29:56 2005 -0500
    18.3 @@ -0,0 +1,4 @@
    18.4 +O_TARGET := drv.o
    18.5 +export-objs := interface.o
    18.6 +obj-y := main.o control.o interface.o
    18.7 +include $(TOPDIR)/Rules.make
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/linux-2.4-xen-sparse/arch/xen/drivers/netif/frontend/Makefile	Mon Jul 11 09:29:56 2005 -0500
    19.3 @@ -0,0 +1,3 @@
    19.4 +O_TARGET := drv.o
    19.5 +obj-y := main.o
    19.6 +include $(TOPDIR)/Rules.make
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/Makefile	Mon Jul 11 09:29:56 2005 -0500
    20.3 @@ -0,0 +1,20 @@
    20.4 +
    20.5 +.S.o:
    20.6 +	$(CC) $(AFLAGS) -traditional -c $< -o $*.o
    20.7 +
    20.8 +all: kernel.o head.o init_task.o
    20.9 +
   20.10 +O_TARGET := kernel.o
   20.11 +
   20.12 +export-objs     := i386_ksyms.o gnttab.o skbuff.o ctrl_if.o
   20.13 +
   20.14 +obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o  \
   20.15 +		ptrace.o ioport.o ldt.o setup.o time.o sys_i386.o \
   20.16 +		i386_ksyms.o i387.o evtchn.o ctrl_if.o pci-dma.o \
   20.17 +		reboot.o fixup.o gnttab.o skbuff.o
   20.18 +
   20.19 +ifdef CONFIG_PCI
   20.20 +obj-y	+= pci-i386.o pci-pc.o
   20.21 +endif
   20.22 +
   20.23 +include $(TOPDIR)/Rules.make
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/entry.S	Mon Jul 11 09:29:56 2005 -0500
    21.3 @@ -0,0 +1,779 @@
    21.4 +/*
    21.5 + *  linux/arch/i386/entry.S
    21.6 + *
    21.7 + *  Copyright (C) 1991, 1992  Linus Torvalds
    21.8 + */
    21.9 +
   21.10 +/*
   21.11 + * entry.S contains the system-call and fault low-level handling routines.
   21.12 + * This also contains the timer-interrupt handler, as well as all interrupts
   21.13 + * and faults that can result in a task-switch.
   21.14 + *
   21.15 + * NOTE: This code handles signal-recognition, which happens every time
   21.16 + * after a timer-interrupt and after each system call.
   21.17 + *
   21.18 + * I changed all the .align's to 4 (16 byte alignment), as that's faster
   21.19 + * on a 486.
   21.20 + *
   21.21 + * Stack layout in 'ret_to_user':
   21.22 + * 	ptrace needs to have all regs on the stack.
   21.23 + *	if the order here is changed, it needs to be
   21.24 + *	updated in fork.c:copy_process, signal.c:do_signal,
   21.25 + *	ptrace.c and ptrace.h
   21.26 + *
   21.27 + *	 0(%esp) - %ebx
   21.28 + *	 4(%esp) - %ecx
   21.29 + *	 8(%esp) - %edx
   21.30 + *       C(%esp) - %esi
   21.31 + *	10(%esp) - %edi
   21.32 + *	14(%esp) - %ebp
   21.33 + *	18(%esp) - %eax
   21.34 + *	1C(%esp) - %ds
   21.35 + *	20(%esp) - %es
   21.36 + *	24(%esp) - orig_eax
   21.37 + *	28(%esp) - %eip
   21.38 + *	2C(%esp) - %cs
   21.39 + *	30(%esp) - %eflags
   21.40 + *	34(%esp) - %oldesp
   21.41 + *	38(%esp) - %oldss
   21.42 + *
   21.43 + * "current" is in register %ebx during any slow entries.
   21.44 + */
   21.45 +
   21.46 +#include <linux/config.h>
   21.47 +#include <linux/sys.h>
   21.48 +#include <linux/linkage.h>
   21.49 +#include <asm/segment.h>
   21.50 +#include <asm/smp.h>
   21.51 +
   21.52 +EBX		= 0x00
   21.53 +ECX		= 0x04
   21.54 +EDX		= 0x08
   21.55 +ESI		= 0x0C
   21.56 +EDI		= 0x10
   21.57 +EBP		= 0x14
   21.58 +EAX		= 0x18
   21.59 +DS		= 0x1C
   21.60 +ES		= 0x20
   21.61 +ORIG_EAX	= 0x24
   21.62 +EIP		= 0x28
   21.63 +CS		= 0x2C
   21.64 +EFLAGS		= 0x30
   21.65 +OLDESP		= 0x34
   21.66 +OLDSS		= 0x38
   21.67 +
   21.68 +CF_MASK		= 0x00000001
   21.69 +TF_MASK		= 0x00000100
   21.70 +IF_MASK		= 0x00000200
   21.71 +DF_MASK		= 0x00000400
   21.72 +NT_MASK		= 0x00004000
   21.73 +
   21.74 +/* Offsets into task_struct. */
   21.75 +state		=  0
   21.76 +flags		=  4
   21.77 +sigpending	=  8
   21.78 +addr_limit	= 12
   21.79 +exec_domain	= 16
   21.80 +need_resched	= 20
   21.81 +tsk_ptrace	= 24
   21.82 +processor	= 52
   21.83 +
   21.84 +/* Offsets into shared_info_t. */
   21.85 +#define evtchn_upcall_pending /* 0 */
   21.86 +#define evtchn_upcall_mask       1
   21.87 +
   21.88 +ENOSYS = 38
   21.89 +
   21.90 +
   21.91 +#define SAVE_ALL \
   21.92 +	cld; \
   21.93 +	pushl %es; \
   21.94 +	pushl %ds; \
   21.95 +	pushl %eax; \
   21.96 +	pushl %ebp; \
   21.97 +	pushl %edi; \
   21.98 +	pushl %esi; \
   21.99 +	pushl %edx; \
  21.100 +	pushl %ecx; \
  21.101 +	pushl %ebx; \
  21.102 +	movl $(__KERNEL_DS),%edx; \
  21.103 +	movl %edx,%ds; \
  21.104 +	movl %edx,%es;
  21.105 +
  21.106 +#define RESTORE_ALL	\
  21.107 +	popl %ebx;	\
  21.108 +	popl %ecx;	\
  21.109 +	popl %edx;	\
  21.110 +	popl %esi;	\
  21.111 +	popl %edi;	\
  21.112 +	popl %ebp;	\
  21.113 +	popl %eax;	\
  21.114 +1:	popl %ds;	\
  21.115 +2:	popl %es;	\
  21.116 +	addl $4,%esp;	\
  21.117 +3:	iret;		\
  21.118 +.section .fixup,"ax";	\
  21.119 +4:	movl $0,(%esp);	\
  21.120 +	jmp 1b;		\
  21.121 +5:	movl $0,(%esp);	\
  21.122 +	jmp 2b;		\
  21.123 +6:	pushl %ss;	\
  21.124 +	popl %ds;	\
  21.125 +	pushl %ss;	\
  21.126 +	popl %es;	\
  21.127 +	pushl $11;	\
  21.128 +	call do_exit;	\
  21.129 +.previous;		\
  21.130 +.section __ex_table,"a";\
  21.131 +	.align 4;	\
  21.132 +	.long 1b,4b;	\
  21.133 +	.long 2b,5b;	\
  21.134 +	.long 3b,6b;	\
  21.135 +.previous
  21.136 +
  21.137 +#define GET_CURRENT(reg) \
  21.138 +	movl $-8192, reg; \
  21.139 +	andl %esp, reg
  21.140 +
  21.141 +ENTRY(lcall7)
  21.142 +	pushfl			# We get a different stack layout with call
  21.143 +	pushl %eax		# gates, which has to be cleaned up later..
  21.144 +	SAVE_ALL
  21.145 +	movl EIP(%esp),%eax	# due to call gates, this is eflags, not eip..
  21.146 +	movl CS(%esp),%edx	# this is eip..
  21.147 +	movl EFLAGS(%esp),%ecx	# and this is cs..
  21.148 +	movl %eax,EFLAGS(%esp)	#
  21.149 +	andl $~(NT_MASK|TF_MASK|DF_MASK), %eax
  21.150 +	pushl %eax
  21.151 +	popfl
  21.152 +	movl %edx,EIP(%esp)	# Now we move them to their "normal" places
  21.153 +	movl %ecx,CS(%esp)	#
  21.154 +	movl %esp,%ebx
  21.155 +	pushl %ebx
  21.156 +	andl $-8192,%ebx	# GET_CURRENT
  21.157 +	movl exec_domain(%ebx),%edx	# Get the execution domain
  21.158 +	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
  21.159 +	pushl $0x7
  21.160 +	call *%edx
  21.161 +	addl $4, %esp
  21.162 +	popl %eax
  21.163 +	jmp ret_to_user
  21.164 +
  21.165 +ENTRY(lcall27)
  21.166 +	pushfl			# We get a different stack layout with call
  21.167 +	pushl %eax		# gates, which has to be cleaned up later..
  21.168 +	SAVE_ALL
  21.169 +	movl EIP(%esp),%eax	# due to call gates, this is eflags, not eip..
  21.170 +	movl CS(%esp),%edx	# this is eip..
  21.171 +	movl EFLAGS(%esp),%ecx	# and this is cs..
  21.172 +	movl %eax,EFLAGS(%esp)	#
  21.173 +	andl $~(NT_MASK|TF_MASK|DF_MASK), %eax
  21.174 +	pushl %eax
  21.175 +	popfl
  21.176 +	movl %edx,EIP(%esp)	# Now we move them to their "normal" places
  21.177 +	movl %ecx,CS(%esp)	#
  21.178 +	movl %esp,%ebx
  21.179 +	pushl %ebx
  21.180 +	andl $-8192,%ebx	# GET_CURRENT
  21.181 +	movl exec_domain(%ebx),%edx	# Get the execution domain
  21.182 +	movl 4(%edx),%edx	# Get the lcall7 handler for the domain
  21.183 +	pushl $0x27
  21.184 +	call *%edx
  21.185 +	addl $4, %esp
  21.186 +	popl %eax
  21.187 +	jmp ret_to_user
  21.188 +
  21.189 +ENTRY(ret_from_fork)
  21.190 +	pushl %ebx
  21.191 +	call SYMBOL_NAME(schedule_tail)
  21.192 +	addl $4, %esp
  21.193 +	GET_CURRENT(%ebx)
  21.194 +	testb $0x02,tsk_ptrace(%ebx)	# PT_TRACESYS
  21.195 +	jne tracesys_exit
  21.196 +	jmp ret_to_user
  21.197 +
  21.198 +/*
  21.199 + * Return to user mode is not as complex as all this looks,
  21.200 + * but we want the default path for a system call return to
  21.201 + * go as quickly as possible which is why some of this is
  21.202 + * less clear than it otherwise should be.
  21.203 + */
  21.204 +ENTRY(system_call)
  21.205 +	pushl %eax			# save orig_eax
  21.206 +	SAVE_ALL
  21.207 +	GET_CURRENT(%ebx)
  21.208 +	testb $0x02,tsk_ptrace(%ebx)	# PT_TRACESYS
  21.209 +	jne tracesys
  21.210 +	cmpl $(NR_syscalls),%eax
  21.211 +	jae badsys
  21.212 +	call *SYMBOL_NAME(sys_call_table)(,%eax,4)
  21.213 +	movl %eax,EAX(%esp)		# save the return value
  21.214 +ret_to_user:
  21.215 +        movl SYMBOL_NAME(HYPERVISOR_shared_info),%esi
  21.216 +        movb $1,evtchn_upcall_mask(%esi) # make tests atomic
  21.217 +ret_to_user_nocli:
  21.218 +	cmpl $0,need_resched(%ebx)
  21.219 +	jne  reschedule
  21.220 +	cmpl $0,sigpending(%ebx)
  21.221 +	je   safesti                    # ensure need_resched updates are seen
  21.222 +/*signal_return:*/
  21.223 +	movb $0,evtchn_upcall_mask(%esi) # reenable event callbacks
  21.224 +	movl %esp,%eax
  21.225 +	xorl %edx,%edx
  21.226 +	call SYMBOL_NAME(do_signal)
  21.227 +	jmp  safesti
  21.228 +
  21.229 +	ALIGN
  21.230 +restore_all:
  21.231 +	RESTORE_ALL
  21.232 +
  21.233 +	ALIGN
  21.234 +tracesys:
  21.235 +	movl $-ENOSYS,EAX(%esp)
  21.236 +	call SYMBOL_NAME(syscall_trace)
  21.237 +	movl ORIG_EAX(%esp),%eax
  21.238 +	cmpl $(NR_syscalls),%eax
  21.239 +	jae tracesys_exit
  21.240 +	call *SYMBOL_NAME(sys_call_table)(,%eax,4)
  21.241 +	movl %eax,EAX(%esp)		# save the return value
  21.242 +tracesys_exit:
  21.243 +	call SYMBOL_NAME(syscall_trace)
  21.244 +	jmp ret_to_user
  21.245 +badsys:
  21.246 +	movl $-ENOSYS,EAX(%esp)
  21.247 +	jmp ret_to_user
  21.248 +
  21.249 +	ALIGN
  21.250 +ENTRY(ret_from_intr)
  21.251 +	GET_CURRENT(%ebx)
  21.252 +ret_from_exception:
  21.253 +	movb CS(%esp),%al
  21.254 +	testl $2,%eax
  21.255 +	jne ret_to_user
  21.256 +	jmp restore_all
  21.257 +
  21.258 +	ALIGN
  21.259 +reschedule:
  21.260 +        movb $0,evtchn_upcall_mask(%esi)  # reenable event callbacks
  21.261 +	call SYMBOL_NAME(schedule)        # test
  21.262 +	jmp  ret_to_user
  21.263 +
  21.264 +ENTRY(divide_error)
  21.265 +	pushl $0		# no error code
  21.266 +	pushl $ SYMBOL_NAME(do_divide_error)
  21.267 +	ALIGN
  21.268 +error_code:
  21.269 +	pushl %ds
  21.270 +	pushl %eax
  21.271 +	xorl %eax,%eax
  21.272 +	pushl %ebp
  21.273 +	pushl %edi
  21.274 +	pushl %esi
  21.275 +	pushl %edx
  21.276 +	decl %eax			# eax = -1
  21.277 +	pushl %ecx
  21.278 +	pushl %ebx
  21.279 +	GET_CURRENT(%ebx)
  21.280 +	cld
  21.281 +	movl %es,%ecx
  21.282 +	movl ORIG_EAX(%esp), %esi	# get the error code
  21.283 +	movl ES(%esp), %edi		# get the function address
  21.284 +	movl %eax, ORIG_EAX(%esp)
  21.285 +	movl %ecx, ES(%esp)
  21.286 +	movl %esp,%edx
  21.287 +	pushl %esi			# push the error code
  21.288 +	pushl %edx			# push the pt_regs pointer
  21.289 +	movl $(__KERNEL_DS),%edx
  21.290 +	movl %edx,%ds
  21.291 +	movl %edx,%es
  21.292 +	call *%edi
  21.293 +	addl $8,%esp
  21.294 +	jmp ret_from_exception
  21.295 +
  21.296 +# A note on the "critical region" in our callback handler.
  21.297 +# We want to avoid stacking callback handlers due to events occurring
  21.298 +# during handling of the last event. To do this, we keep events disabled
  21.299 +# until we've done all processing. HOWEVER, we must enable events before
  21.300 +# popping the stack frame (can't be done atomically) and so it would still
  21.301 +# be possible to get enough handler activations to overflow the stack.
  21.302 +# Although unlikely, bugs of that kind are hard to track down, so we'd
  21.303 +# like to avoid the possibility.
  21.304 +# So, on entry to the handler we detect whether we interrupted an
  21.305 +# existing activation in its critical region -- if so, we pop the current
  21.306 +# activation and restart the handler using the previous one.
  21.307 +ENTRY(hypervisor_callback)
  21.308 +        pushl %eax
  21.309 +        SAVE_ALL
  21.310 +        GET_CURRENT(%ebx)
  21.311 +        movl EIP(%esp),%eax
  21.312 +        cmpl $scrit,%eax
  21.313 +        jb   11f
  21.314 +        cmpl $ecrit,%eax
  21.315 +        jb   critical_region_fixup
  21.316 +11:     push %esp
  21.317 +        call evtchn_do_upcall
  21.318 +        add  $4,%esp
  21.319 +        movl SYMBOL_NAME(HYPERVISOR_shared_info),%esi
  21.320 +        movb CS(%esp),%cl
  21.321 +	test $2,%cl          # slow return to ring 2 or 3
  21.322 +	jne  ret_to_user_nocli
  21.323 +safesti:movb $0,evtchn_upcall_mask(%esi) # reenable event callbacks
  21.324 +scrit:  /**** START OF CRITICAL REGION ****/
  21.325 +        testb $0xFF,evtchn_upcall_pending(%esi)
  21.326 +        jnz  14f              # process more events if necessary...
  21.327 +        RESTORE_ALL
  21.328 +14:     movb $1,evtchn_upcall_mask(%esi)
  21.329 +        jmp  11b
  21.330 +ecrit:  /**** END OF CRITICAL REGION ****/
  21.331 +# [How we do the fixup]. We want to merge the current stack frame with the
  21.332 +# just-interrupted frame. How we do this depends on where in the critical
  21.333 +# region the interrupted handler was executing, and so how many saved
  21.334 +# registers are in each frame. We do this quickly using the lookup table
  21.335 +# 'critical_fixup_table'. For each byte offset in the critical region, it
  21.336 +# provides the number of bytes which have already been popped from the
  21.337 +# interrupted stack frame. 
  21.338 +critical_region_fixup:
  21.339 +        addl $critical_fixup_table-scrit,%eax
  21.340 +        movzbl (%eax),%eax    # %eax contains num bytes popped
  21.341 +        mov  %esp,%esi
  21.342 +        add  %eax,%esi        # %esi points at end of src region
  21.343 +        mov  %esp,%edi
  21.344 +        add  $0x34,%edi       # %edi points at end of dst region
  21.345 +        mov  %eax,%ecx
  21.346 +        shr  $2,%ecx          # convert words to bytes
  21.347 +        je   16f              # skip loop if nothing to copy
  21.348 +15:     subl $4,%esi          # pre-decrementing copy loop
  21.349 +        subl $4,%edi
  21.350 +        movl (%esi),%eax
  21.351 +        movl %eax,(%edi)
  21.352 +        loop 15b
  21.353 +16:     movl %edi,%esp        # final %edi is top of merged stack
  21.354 +        jmp  11b
  21.355 +        
  21.356 +critical_fixup_table:        
  21.357 +        .byte 0x00,0x00,0x00                  # testb $0xFF,(%esi)
  21.358 +        .byte 0x00,0x00                       # jnz  14f
  21.359 +        .byte 0x00                            # pop  %ebx
  21.360 +        .byte 0x04                            # pop  %ecx
  21.361 +        .byte 0x08                            # pop  %edx
  21.362 +        .byte 0x0c                            # pop  %esi
  21.363 +        .byte 0x10                            # pop  %edi
  21.364 +        .byte 0x14                            # pop  %ebp
  21.365 +        .byte 0x18                            # pop  %eax
  21.366 +        .byte 0x1c                            # pop  %ds
  21.367 +        .byte 0x20                            # pop  %es
  21.368 +        .byte 0x24,0x24,0x24                  # add  $4,%esp
  21.369 +        .byte 0x28                            # iret
  21.370 +        .byte 0x00,0x00,0x00,0x00             # movb $1,4(%esi)
  21.371 +        .byte 0x00,0x00                       # jmp  11b
  21.372 +
  21.373 +# Hypervisor uses this for application faults while it executes.
  21.374 +ENTRY(failsafe_callback)
  21.375 +1:      popl %ds
  21.376 +2:      popl %es
  21.377 +3:      popl %fs
  21.378 +4:      popl %gs
  21.379 +5:      iret
  21.380 +.section .fixup,"ax";	\
  21.381 +6:	movl $0,(%esp);	\
  21.382 +	jmp 1b;		\
  21.383 +7:	movl $0,(%esp);	\
  21.384 +	jmp 2b;		\
  21.385 +8:	movl $0,(%esp);	\
  21.386 +	jmp 3b;		\
  21.387 +9:	movl $0,(%esp);	\
  21.388 +	jmp 4b;		\
  21.389 +10:	pushl %ss;	\
  21.390 +	popl %ds;	\
  21.391 +	pushl %ss;	\
  21.392 +	popl %es;	\
  21.393 +	pushl $11;	\
  21.394 +	call do_exit;	\
  21.395 +.previous;		\
  21.396 +.section __ex_table,"a";\
  21.397 +	.align 4;	\
  21.398 +	.long 1b,6b;	\
  21.399 +	.long 2b,7b;	\
  21.400 +	.long 3b,8b;	\
  21.401 +	.long 4b,9b;	\
  21.402 +	.long 5b,10b;	\
  21.403 +.previous
  21.404 +        
  21.405 +ENTRY(coprocessor_error)
  21.406 +	pushl $0
  21.407 +	pushl $ SYMBOL_NAME(do_coprocessor_error)
  21.408 +	jmp error_code
  21.409 +
  21.410 +ENTRY(simd_coprocessor_error)
  21.411 +	pushl $0
  21.412 +	pushl $ SYMBOL_NAME(do_simd_coprocessor_error)
  21.413 +	jmp error_code
  21.414 +
  21.415 +ENTRY(device_not_available)
  21.416 +	pushl $-1		# mark this as an int
  21.417 +	SAVE_ALL
  21.418 +	GET_CURRENT(%ebx)
  21.419 +	call SYMBOL_NAME(math_state_restore)
  21.420 +	jmp ret_from_exception
  21.421 +
  21.422 +ENTRY(debug)
  21.423 +	pushl $0
  21.424 +	pushl $ SYMBOL_NAME(do_debug)
  21.425 +	jmp error_code
  21.426 +
  21.427 +ENTRY(int3)
  21.428 +	pushl $0
  21.429 +	pushl $ SYMBOL_NAME(do_int3)
  21.430 +	jmp error_code
  21.431 +
  21.432 +ENTRY(overflow)
  21.433 +	pushl $0
  21.434 +	pushl $ SYMBOL_NAME(do_overflow)
  21.435 +	jmp error_code
  21.436 +
  21.437 +ENTRY(bounds)
  21.438 +	pushl $0
  21.439 +	pushl $ SYMBOL_NAME(do_bounds)
  21.440 +	jmp error_code
  21.441 +
  21.442 +ENTRY(invalid_op)
  21.443 +	pushl $0
  21.444 +	pushl $ SYMBOL_NAME(do_invalid_op)
  21.445 +	jmp error_code
  21.446 +
  21.447 +ENTRY(coprocessor_segment_overrun)
  21.448 +	pushl $0
  21.449 +	pushl $ SYMBOL_NAME(do_coprocessor_segment_overrun)
  21.450 +	jmp error_code
  21.451 +
  21.452 +ENTRY(double_fault)
  21.453 +	pushl $ SYMBOL_NAME(do_double_fault)
  21.454 +	jmp error_code
  21.455 +
  21.456 +ENTRY(invalid_TSS)
  21.457 +	pushl $ SYMBOL_NAME(do_invalid_TSS)
  21.458 +	jmp error_code
  21.459 +
  21.460 +ENTRY(segment_not_present)
  21.461 +	pushl $ SYMBOL_NAME(do_segment_not_present)
  21.462 +	jmp error_code
  21.463 +
  21.464 +ENTRY(stack_segment)
  21.465 +	pushl $ SYMBOL_NAME(do_stack_segment)
  21.466 +	jmp error_code
  21.467 +
  21.468 +ENTRY(general_protection)
  21.469 +	pushl $ SYMBOL_NAME(do_general_protection)
  21.470 +	jmp error_code
  21.471 +
  21.472 +ENTRY(alignment_check)
  21.473 +	pushl $ SYMBOL_NAME(do_alignment_check)
  21.474 +	jmp error_code
  21.475 +
  21.476 +# This handler is special, because it gets an extra value on its stack,
  21.477 +# which is the linear faulting address.
  21.478 +#define PAGE_FAULT_STUB(_name1, _name2)                                  \
  21.479 +ENTRY(_name1)                                                            \
  21.480 +	pushl %ds                                                      ; \
  21.481 +	pushl %eax                                                     ; \
  21.482 +	xorl %eax,%eax                                                 ; \
  21.483 +	pushl %ebp                                                     ; \
  21.484 +	pushl %edi                                                     ; \
  21.485 +	pushl %esi                                                     ; \
  21.486 +	pushl %edx                                                     ; \
  21.487 +	decl %eax                      /* eax = -1 */                  ; \
  21.488 +	pushl %ecx                                                     ; \
  21.489 +	pushl %ebx                                                     ; \
  21.490 +	GET_CURRENT(%ebx)                                              ; \
  21.491 +	cld                                                            ; \
  21.492 +	movl %es,%ecx                                                  ; \
  21.493 +	movl ORIG_EAX(%esp), %esi      /* get the error code */        ; \
  21.494 +	movl ES(%esp), %edi            /* get the faulting address */  ; \
  21.495 +	movl %eax, ORIG_EAX(%esp)                                      ; \
  21.496 +	movl %ecx, ES(%esp)                                            ; \
  21.497 +	movl %esp,%edx                                                 ; \
  21.498 +        pushl %edi                     /* push the faulting address */ ; \
  21.499 +	pushl %esi                     /* push the error code */       ; \
  21.500 +	pushl %edx                     /* push the pt_regs pointer */  ; \
  21.501 +	movl $(__KERNEL_DS),%edx                                       ; \
  21.502 +	movl %edx,%ds                                                  ; \
  21.503 +	movl %edx,%es                                                  ; \
  21.504 +	call SYMBOL_NAME(_name2)                                       ; \
  21.505 +	addl $12,%esp                                                  ; \
  21.506 +	jmp ret_from_exception                                         ;
  21.507 +PAGE_FAULT_STUB(page_fault, do_page_fault)
  21.508 +
  21.509 +ENTRY(machine_check)
  21.510 +	pushl $0
  21.511 +	pushl $ SYMBOL_NAME(do_machine_check)
  21.512 +	jmp error_code
  21.513 +
  21.514 +ENTRY(fixup_4gb_segment)
  21.515 +	pushl $ SYMBOL_NAME(do_fixup_4gb_segment)
  21.516 +	jmp error_code
  21.517 +
  21.518 +.data
  21.519 +ENTRY(sys_call_table)
  21.520 +	.long SYMBOL_NAME(sys_ni_syscall)	/* 0  -  old "setup()" system call*/
  21.521 +	.long SYMBOL_NAME(sys_exit)
  21.522 +	.long SYMBOL_NAME(sys_fork)
  21.523 +	.long SYMBOL_NAME(sys_read)
  21.524 +	.long SYMBOL_NAME(sys_write)
  21.525 +	.long SYMBOL_NAME(sys_open)		/* 5 */
  21.526 +	.long SYMBOL_NAME(sys_close)
  21.527 +	.long SYMBOL_NAME(sys_waitpid)
  21.528 +	.long SYMBOL_NAME(sys_creat)
  21.529 +	.long SYMBOL_NAME(sys_link)
  21.530 +	.long SYMBOL_NAME(sys_unlink)		/* 10 */
  21.531 +	.long SYMBOL_NAME(sys_execve)
  21.532 +	.long SYMBOL_NAME(sys_chdir)
  21.533 +	.long SYMBOL_NAME(sys_time)
  21.534 +	.long SYMBOL_NAME(sys_mknod)
  21.535 +	.long SYMBOL_NAME(sys_chmod)		/* 15 */
  21.536 +	.long SYMBOL_NAME(sys_lchown16)
  21.537 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old break syscall holder */
  21.538 +	.long SYMBOL_NAME(sys_stat)
  21.539 +	.long SYMBOL_NAME(sys_lseek)
  21.540 +	.long SYMBOL_NAME(sys_getpid)		/* 20 */
  21.541 +	.long SYMBOL_NAME(sys_mount)
  21.542 +	.long SYMBOL_NAME(sys_oldumount)
  21.543 +	.long SYMBOL_NAME(sys_setuid16)
  21.544 +	.long SYMBOL_NAME(sys_getuid16)
  21.545 +	.long SYMBOL_NAME(sys_stime)		/* 25 */
  21.546 +	.long SYMBOL_NAME(sys_ptrace)
  21.547 +	.long SYMBOL_NAME(sys_alarm)
  21.548 +	.long SYMBOL_NAME(sys_fstat)
  21.549 +	.long SYMBOL_NAME(sys_pause)
  21.550 +	.long SYMBOL_NAME(sys_utime)		/* 30 */
  21.551 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old stty syscall holder */
  21.552 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old gtty syscall holder */
  21.553 +	.long SYMBOL_NAME(sys_access)
  21.554 +	.long SYMBOL_NAME(sys_nice)
  21.555 +	.long SYMBOL_NAME(sys_ni_syscall)	/* 35 */		/* old ftime syscall holder */
  21.556 +	.long SYMBOL_NAME(sys_sync)
  21.557 +	.long SYMBOL_NAME(sys_kill)
  21.558 +	.long SYMBOL_NAME(sys_rename)
  21.559 +	.long SYMBOL_NAME(sys_mkdir)
  21.560 +	.long SYMBOL_NAME(sys_rmdir)		/* 40 */
  21.561 +	.long SYMBOL_NAME(sys_dup)
  21.562 +	.long SYMBOL_NAME(sys_pipe)
  21.563 +	.long SYMBOL_NAME(sys_times)
  21.564 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old prof syscall holder */
  21.565 +	.long SYMBOL_NAME(sys_brk)		/* 45 */
  21.566 +	.long SYMBOL_NAME(sys_setgid16)
  21.567 +	.long SYMBOL_NAME(sys_getgid16)
  21.568 +	.long SYMBOL_NAME(sys_signal)
  21.569 +	.long SYMBOL_NAME(sys_geteuid16)
  21.570 +	.long SYMBOL_NAME(sys_getegid16)	/* 50 */
  21.571 +	.long SYMBOL_NAME(sys_acct)
  21.572 +	.long SYMBOL_NAME(sys_umount)					/* recycled never used phys() */
  21.573 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old lock syscall holder */
  21.574 +	.long SYMBOL_NAME(sys_ioctl)
  21.575 +	.long SYMBOL_NAME(sys_fcntl)		/* 55 */
  21.576 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old mpx syscall holder */
  21.577 +	.long SYMBOL_NAME(sys_setpgid)
  21.578 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old ulimit syscall holder */
  21.579 +	.long SYMBOL_NAME(sys_olduname)
  21.580 +	.long SYMBOL_NAME(sys_umask)		/* 60 */
  21.581 +	.long SYMBOL_NAME(sys_chroot)
  21.582 +	.long SYMBOL_NAME(sys_ustat)
  21.583 +	.long SYMBOL_NAME(sys_dup2)
  21.584 +	.long SYMBOL_NAME(sys_getppid)
  21.585 +	.long SYMBOL_NAME(sys_getpgrp)		/* 65 */
  21.586 +	.long SYMBOL_NAME(sys_setsid)
  21.587 +	.long SYMBOL_NAME(sys_sigaction)
  21.588 +	.long SYMBOL_NAME(sys_sgetmask)
  21.589 +	.long SYMBOL_NAME(sys_ssetmask)
  21.590 +	.long SYMBOL_NAME(sys_setreuid16)	/* 70 */
  21.591 +	.long SYMBOL_NAME(sys_setregid16)
  21.592 +	.long SYMBOL_NAME(sys_sigsuspend)
  21.593 +	.long SYMBOL_NAME(sys_sigpending)
  21.594 +	.long SYMBOL_NAME(sys_sethostname)
  21.595 +	.long SYMBOL_NAME(sys_setrlimit)	/* 75 */
  21.596 +	.long SYMBOL_NAME(sys_old_getrlimit)
  21.597 +	.long SYMBOL_NAME(sys_getrusage)
  21.598 +	.long SYMBOL_NAME(sys_gettimeofday)
  21.599 +	.long SYMBOL_NAME(sys_settimeofday)
  21.600 +	.long SYMBOL_NAME(sys_getgroups16)	/* 80 */
  21.601 +	.long SYMBOL_NAME(sys_setgroups16)
  21.602 +	.long SYMBOL_NAME(old_select)
  21.603 +	.long SYMBOL_NAME(sys_symlink)
  21.604 +	.long SYMBOL_NAME(sys_lstat)
  21.605 +	.long SYMBOL_NAME(sys_readlink)		/* 85 */
  21.606 +	.long SYMBOL_NAME(sys_uselib)
  21.607 +	.long SYMBOL_NAME(sys_swapon)
  21.608 +	.long SYMBOL_NAME(sys_reboot)
  21.609 +	.long SYMBOL_NAME(old_readdir)
  21.610 +	.long SYMBOL_NAME(old_mmap)		/* 90 */
  21.611 +	.long SYMBOL_NAME(sys_munmap)
  21.612 +	.long SYMBOL_NAME(sys_truncate)
  21.613 +	.long SYMBOL_NAME(sys_ftruncate)
  21.614 +	.long SYMBOL_NAME(sys_fchmod)
  21.615 +	.long SYMBOL_NAME(sys_fchown16)		/* 95 */
  21.616 +	.long SYMBOL_NAME(sys_getpriority)
  21.617 +	.long SYMBOL_NAME(sys_setpriority)
  21.618 +	.long SYMBOL_NAME(sys_ni_syscall)				/* old profil syscall holder */
  21.619 +	.long SYMBOL_NAME(sys_statfs)
  21.620 +	.long SYMBOL_NAME(sys_fstatfs)		/* 100 */
  21.621 +	.long SYMBOL_NAME(sys_ioperm)
  21.622 +	.long SYMBOL_NAME(sys_socketcall)
  21.623 +	.long SYMBOL_NAME(sys_syslog)
  21.624 +	.long SYMBOL_NAME(sys_setitimer)
  21.625 +	.long SYMBOL_NAME(sys_getitimer)	/* 105 */
  21.626 +	.long SYMBOL_NAME(sys_newstat)
  21.627 +	.long SYMBOL_NAME(sys_newlstat)
  21.628 +	.long SYMBOL_NAME(sys_newfstat)
  21.629 +	.long SYMBOL_NAME(sys_uname)
  21.630 +	.long SYMBOL_NAME(sys_iopl)		/* 110 */
  21.631 +	.long SYMBOL_NAME(sys_vhangup)
  21.632 +	.long SYMBOL_NAME(sys_ni_syscall)	/* old "idle" system call */
  21.633 +	.long SYMBOL_NAME(sys_ni_syscall) /* was VM86 */
  21.634 +	.long SYMBOL_NAME(sys_wait4)
  21.635 +	.long SYMBOL_NAME(sys_swapoff)		/* 115 */
  21.636 +	.long SYMBOL_NAME(sys_sysinfo)
  21.637 +	.long SYMBOL_NAME(sys_ipc)
  21.638 +	.long SYMBOL_NAME(sys_fsync)
  21.639 +	.long SYMBOL_NAME(sys_sigreturn)
  21.640 +	.long SYMBOL_NAME(sys_clone)		/* 120 */
  21.641 +	.long SYMBOL_NAME(sys_setdomainname)
  21.642 +	.long SYMBOL_NAME(sys_newuname)
  21.643 +	.long SYMBOL_NAME(sys_modify_ldt)
  21.644 +	.long SYMBOL_NAME(sys_adjtimex)
  21.645 +	.long SYMBOL_NAME(sys_mprotect)		/* 125 */
  21.646 +	.long SYMBOL_NAME(sys_sigprocmask)
  21.647 +	.long SYMBOL_NAME(sys_create_module)
  21.648 +	.long SYMBOL_NAME(sys_init_module)
  21.649 +	.long SYMBOL_NAME(sys_delete_module)
  21.650 +	.long SYMBOL_NAME(sys_get_kernel_syms)	/* 130 */
  21.651 +	.long SYMBOL_NAME(sys_quotactl)
  21.652 +	.long SYMBOL_NAME(sys_getpgid)
  21.653 +	.long SYMBOL_NAME(sys_fchdir)
  21.654 +	.long SYMBOL_NAME(sys_bdflush)
  21.655 +	.long SYMBOL_NAME(sys_sysfs)		/* 135 */
  21.656 +	.long SYMBOL_NAME(sys_personality)
  21.657 +	.long SYMBOL_NAME(sys_ni_syscall)	/* for afs_syscall */
  21.658 +	.long SYMBOL_NAME(sys_setfsuid16)
  21.659 +	.long SYMBOL_NAME(sys_setfsgid16)
  21.660 +	.long SYMBOL_NAME(sys_llseek)		/* 140 */
  21.661 +	.long SYMBOL_NAME(sys_getdents)
  21.662 +	.long SYMBOL_NAME(sys_select)
  21.663 +	.long SYMBOL_NAME(sys_flock)
  21.664 +	.long SYMBOL_NAME(sys_msync)
  21.665 +	.long SYMBOL_NAME(sys_readv)		/* 145 */
  21.666 +	.long SYMBOL_NAME(sys_writev)
  21.667 +	.long SYMBOL_NAME(sys_getsid)
  21.668 +	.long SYMBOL_NAME(sys_fdatasync)
  21.669 +	.long SYMBOL_NAME(sys_sysctl)
  21.670 +	.long SYMBOL_NAME(sys_mlock)		/* 150 */
  21.671 +	.long SYMBOL_NAME(sys_munlock)
  21.672 +	.long SYMBOL_NAME(sys_mlockall)
  21.673 +	.long SYMBOL_NAME(sys_munlockall)
  21.674 +	.long SYMBOL_NAME(sys_sched_setparam)
  21.675 +	.long SYMBOL_NAME(sys_sched_getparam)   /* 155 */
  21.676 +	.long SYMBOL_NAME(sys_sched_setscheduler)
  21.677 +	.long SYMBOL_NAME(sys_sched_getscheduler)
  21.678 +	.long SYMBOL_NAME(sys_sched_yield)
  21.679 +	.long SYMBOL_NAME(sys_sched_get_priority_max)
  21.680 +	.long SYMBOL_NAME(sys_sched_get_priority_min)  /* 160 */
  21.681 +	.long SYMBOL_NAME(sys_sched_rr_get_interval)
  21.682 +	.long SYMBOL_NAME(sys_nanosleep)
  21.683 +	.long SYMBOL_NAME(sys_mremap)
  21.684 +	.long SYMBOL_NAME(sys_setresuid16)
  21.685 +	.long SYMBOL_NAME(sys_getresuid16)	/* 165 */
  21.686 +	.long SYMBOL_NAME(sys_ni_syscall) /* was VM86 */
  21.687 +	.long SYMBOL_NAME(sys_query_module)
  21.688 +	.long SYMBOL_NAME(sys_poll)
  21.689 +	.long SYMBOL_NAME(sys_nfsservctl)
  21.690 +	.long SYMBOL_NAME(sys_setresgid16)	/* 170 */
  21.691 +	.long SYMBOL_NAME(sys_getresgid16)
  21.692 +	.long SYMBOL_NAME(sys_prctl)
  21.693 +	.long SYMBOL_NAME(sys_rt_sigreturn)
  21.694 +	.long SYMBOL_NAME(sys_rt_sigaction)
  21.695 +	.long SYMBOL_NAME(sys_rt_sigprocmask)	/* 175 */
  21.696 +	.long SYMBOL_NAME(sys_rt_sigpending)
  21.697 +	.long SYMBOL_NAME(sys_rt_sigtimedwait)
  21.698 +	.long SYMBOL_NAME(sys_rt_sigqueueinfo)
  21.699 +	.long SYMBOL_NAME(sys_rt_sigsuspend)
  21.700 +	.long SYMBOL_NAME(sys_pread)		/* 180 */
  21.701 +	.long SYMBOL_NAME(sys_pwrite)
  21.702 +	.long SYMBOL_NAME(sys_chown16)
  21.703 +	.long SYMBOL_NAME(sys_getcwd)
  21.704 +	.long SYMBOL_NAME(sys_capget)
  21.705 +	.long SYMBOL_NAME(sys_capset)           /* 185 */
  21.706 +	.long SYMBOL_NAME(sys_sigaltstack)
  21.707 +	.long SYMBOL_NAME(sys_sendfile)
  21.708 +	.long SYMBOL_NAME(sys_ni_syscall)		/* streams1 */
  21.709 +	.long SYMBOL_NAME(sys_ni_syscall)		/* streams2 */
  21.710 +	.long SYMBOL_NAME(sys_vfork)            /* 190 */
  21.711 +	.long SYMBOL_NAME(sys_getrlimit)
  21.712 +	.long SYMBOL_NAME(sys_mmap2)
  21.713 +	.long SYMBOL_NAME(sys_truncate64)
  21.714 +	.long SYMBOL_NAME(sys_ftruncate64)
  21.715 +	.long SYMBOL_NAME(sys_stat64)		/* 195 */
  21.716 +	.long SYMBOL_NAME(sys_lstat64)
  21.717 +	.long SYMBOL_NAME(sys_fstat64)
  21.718 +	.long SYMBOL_NAME(sys_lchown)
  21.719 +	.long SYMBOL_NAME(sys_getuid)
  21.720 +	.long SYMBOL_NAME(sys_getgid)		/* 200 */
  21.721 +	.long SYMBOL_NAME(sys_geteuid)
  21.722 +	.long SYMBOL_NAME(sys_getegid)
  21.723 +	.long SYMBOL_NAME(sys_setreuid)
  21.724 +	.long SYMBOL_NAME(sys_setregid)
  21.725 +	.long SYMBOL_NAME(sys_getgroups)	/* 205 */
  21.726 +	.long SYMBOL_NAME(sys_setgroups)
  21.727 +	.long SYMBOL_NAME(sys_fchown)
  21.728 +	.long SYMBOL_NAME(sys_setresuid)
  21.729 +	.long SYMBOL_NAME(sys_getresuid)
  21.730 +	.long SYMBOL_NAME(sys_setresgid)	/* 210 */
  21.731 +	.long SYMBOL_NAME(sys_getresgid)
  21.732 +	.long SYMBOL_NAME(sys_chown)
  21.733 +	.long SYMBOL_NAME(sys_setuid)
  21.734 +	.long SYMBOL_NAME(sys_setgid)
  21.735 +	.long SYMBOL_NAME(sys_setfsuid)		/* 215 */
  21.736 +	.long SYMBOL_NAME(sys_setfsgid)
  21.737 +	.long SYMBOL_NAME(sys_pivot_root)
  21.738 +	.long SYMBOL_NAME(sys_mincore)
  21.739 +	.long SYMBOL_NAME(sys_madvise)
  21.740 +	.long SYMBOL_NAME(sys_getdents64)	/* 220 */
  21.741 +	.long SYMBOL_NAME(sys_fcntl64)
  21.742 +	.long SYMBOL_NAME(sys_ni_syscall)	/* reserved for TUX */
  21.743 +	.long SYMBOL_NAME(sys_ni_syscall)	/* Reserved for Security */
  21.744 +	.long SYMBOL_NAME(sys_gettid)
  21.745 +	.long SYMBOL_NAME(sys_readahead)	/* 225 */
  21.746 +	.long SYMBOL_NAME(sys_setxattr)
  21.747 +	.long SYMBOL_NAME(sys_lsetxattr)
  21.748 +	.long SYMBOL_NAME(sys_fsetxattr)
  21.749 +	.long SYMBOL_NAME(sys_getxattr)
  21.750 +	.long SYMBOL_NAME(sys_lgetxattr)	/* 230 */
  21.751 +	.long SYMBOL_NAME(sys_fgetxattr)
  21.752 +	.long SYMBOL_NAME(sys_listxattr)
  21.753 +	.long SYMBOL_NAME(sys_llistxattr)
  21.754 +	.long SYMBOL_NAME(sys_flistxattr)
  21.755 +	.long SYMBOL_NAME(sys_removexattr)	/* 235 */
  21.756 +	.long SYMBOL_NAME(sys_lremovexattr)
  21.757 +	.long SYMBOL_NAME(sys_fremovexattr)
  21.758 + 	.long SYMBOL_NAME(sys_tkill)
  21.759 +	.long SYMBOL_NAME(sys_sendfile64)
  21.760 +	.long SYMBOL_NAME(sys_ni_syscall)	/* 240 reserved for futex */
  21.761 +	.long SYMBOL_NAME(sys_ni_syscall)	/* reserved for sched_setaffinity */
  21.762 +	.long SYMBOL_NAME(sys_ni_syscall)	/* reserved for sched_getaffinity */
  21.763 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_set_thread_area */
  21.764 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_get_thread_area */
  21.765 +	.long SYMBOL_NAME(sys_ni_syscall)	/* 245 sys_io_setup */
  21.766 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_io_destroy */
  21.767 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_io_getevents */
  21.768 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_io_submit */
  21.769 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_io_cancel */
  21.770 +	.long SYMBOL_NAME(sys_ni_syscall)	/* 250 sys_alloc_hugepages */
  21.771 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_free_hugepages */
  21.772 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_exit_group */
  21.773 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_lookup_dcookie */
  21.774 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_epoll_create */
  21.775 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_epoll_ctl 255 */
  21.776 +	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_epoll_wait */
  21.777 + 	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_remap_file_pages */
  21.778 + 	.long SYMBOL_NAME(sys_ni_syscall)	/* sys_set_tid_address */
  21.779 +
  21.780 +	.rept NR_syscalls-(.-sys_call_table)/4
  21.781 +		.long SYMBOL_NAME(sys_ni_syscall)
  21.782 +	.endr
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/head.S	Mon Jul 11 09:29:56 2005 -0500
    22.3 @@ -0,0 +1,41 @@
    22.4 +
    22.5 +.section __xen_guest
    22.6 +    .ascii "GUEST_OS=linux,GUEST_VER=2.4,XEN_VER=3.0,VIRT_BASE=0xC0000000"
    22.7 +    .ascii ",LOADER=generic"
    22.8 +    .byte  0
    22.9 +
   22.10 +.text
   22.11 +#include <linux/config.h>
   22.12 +#include <linux/threads.h>
   22.13 +#include <linux/linkage.h>
   22.14 +#include <asm/segment.h>
   22.15 +#include <asm/page.h>
   22.16 +#include <asm/pgtable.h>
   22.17 +#include <asm/desc.h>
   22.18 +
   22.19 +ENTRY(stext)
   22.20 +ENTRY(_stext)
   22.21 +        cld
   22.22 +        lss stack_start,%esp
   22.23 +        /* Copy the necessary stuff from xen_start_info structure. */
   22.24 +        mov $SYMBOL_NAME(xen_start_info_union),%edi
   22.25 +        mov $128,%ecx
   22.26 +        rep movsl
   22.27 +        jmp SYMBOL_NAME(start_kernel)
   22.28 +
   22.29 +ENTRY(stack_start)
   22.30 +	.long SYMBOL_NAME(init_task_union)+8192, __KERNEL_DS
   22.31 +
   22.32 +.org 0x1000
   22.33 +ENTRY(empty_zero_page)
   22.34 +
   22.35 +.org 0x2000
   22.36 +ENTRY(default_ldt)
   22.37 +
   22.38 +.org 0x3000
   22.39 +ENTRY(cpu0_pte_quicklist)
   22.40 +
   22.41 +.org 0x3400
   22.42 +ENTRY(cpu0_pgd_quicklist)
   22.43 +        
   22.44 +.org 0x3800
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/i386_ksyms.c	Mon Jul 11 09:29:56 2005 -0500
    23.3 @@ -0,0 +1,180 @@
    23.4 +#include <linux/config.h>
    23.5 +#include <linux/module.h>
    23.6 +#include <linux/smp.h>
    23.7 +#include <linux/user.h>
    23.8 +#include <linux/elfcore.h>
    23.9 +#include <linux/mca.h>
   23.10 +#include <linux/sched.h>
   23.11 +#include <linux/in6.h>
   23.12 +#include <linux/interrupt.h>
   23.13 +#include <linux/smp_lock.h>
   23.14 +#include <linux/pm.h>
   23.15 +#include <linux/pci.h>
   23.16 +#include <linux/apm_bios.h>
   23.17 +#include <linux/kernel.h>
   23.18 +#include <linux/string.h>
   23.19 +#include <linux/tty.h>
   23.20 +
   23.21 +#include <asm/semaphore.h>
   23.22 +#include <asm/processor.h>
   23.23 +#include <asm/i387.h>
   23.24 +#include <asm/uaccess.h>
   23.25 +#include <asm/checksum.h>
   23.26 +#include <asm/io.h>
   23.27 +#include <asm/hardirq.h>
   23.28 +#include <asm/delay.h>
   23.29 +#include <asm/irq.h>
   23.30 +#include <asm/mmx.h>
   23.31 +#include <asm/desc.h>
   23.32 +#include <asm/pgtable.h>
   23.33 +#include <asm/pgalloc.h>
   23.34 +
   23.35 +extern void dump_thread(struct pt_regs *, struct user *);
   23.36 +extern spinlock_t rtc_lock;
   23.37 +
   23.38 +#if defined(CONFIG_APMXXX) || defined(CONFIG_APM_MODULEXXX)
   23.39 +extern void machine_real_restart(unsigned char *, int);
   23.40 +EXPORT_SYMBOL(machine_real_restart);
   23.41 +extern void default_idle(void);
   23.42 +EXPORT_SYMBOL(default_idle);
   23.43 +#endif
   23.44 +
   23.45 +#ifdef CONFIG_SMP
   23.46 +extern void FASTCALL( __write_lock_failed(rwlock_t *rw));
   23.47 +extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
   23.48 +#endif
   23.49 +
   23.50 +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
   23.51 +extern struct drive_info_struct drive_info;
   23.52 +EXPORT_SYMBOL(drive_info);
   23.53 +#endif
   23.54 +
   23.55 +// XXX extern unsigned long get_cmos_time(void);
   23.56 +
   23.57 +/* platform dependent support */
   23.58 +EXPORT_SYMBOL(boot_cpu_data);
   23.59 +EXPORT_SYMBOL(dump_thread);
   23.60 +EXPORT_SYMBOL(dump_fpu);
   23.61 +EXPORT_SYMBOL(dump_extended_fpu);
   23.62 +EXPORT_SYMBOL(__ioremap);
   23.63 +EXPORT_SYMBOL(iounmap);
   23.64 +EXPORT_SYMBOL(enable_irq);
   23.65 +EXPORT_SYMBOL(disable_irq);
   23.66 +EXPORT_SYMBOL(disable_irq_nosync);
   23.67 +EXPORT_SYMBOL(probe_irq_mask);
   23.68 +EXPORT_SYMBOL(kernel_thread);
   23.69 +EXPORT_SYMBOL(pm_idle);
   23.70 +EXPORT_SYMBOL(pm_power_off);
   23.71 +EXPORT_SYMBOL(apm_info);
   23.72 +//EXPORT_SYMBOL(gdt);
   23.73 +EXPORT_SYMBOL(empty_zero_page);
   23.74 +EXPORT_SYMBOL(phys_to_machine_mapping);
   23.75 +
   23.76 +
   23.77 +#ifdef CONFIG_DEBUG_IOVIRT
   23.78 +EXPORT_SYMBOL(__io_virt_debug);
   23.79 +#endif
   23.80 +
   23.81 +EXPORT_SYMBOL_NOVERS(__down_failed);
   23.82 +EXPORT_SYMBOL_NOVERS(__down_failed_interruptible);
   23.83 +EXPORT_SYMBOL_NOVERS(__down_failed_trylock);
   23.84 +EXPORT_SYMBOL_NOVERS(__up_wakeup);
   23.85 +/* Networking helper routines. */
   23.86 +EXPORT_SYMBOL(csum_partial_copy_generic);
   23.87 +/* Delay loops */
   23.88 +EXPORT_SYMBOL(__ndelay);
   23.89 +EXPORT_SYMBOL(__udelay);
   23.90 +EXPORT_SYMBOL(__delay);
   23.91 +EXPORT_SYMBOL(__const_udelay);
   23.92 +
   23.93 +EXPORT_SYMBOL_NOVERS(__get_user_1);
   23.94 +EXPORT_SYMBOL_NOVERS(__get_user_2);
   23.95 +EXPORT_SYMBOL_NOVERS(__get_user_4);
   23.96 +
   23.97 +EXPORT_SYMBOL(strtok);
   23.98 +EXPORT_SYMBOL(strpbrk);
   23.99 +EXPORT_SYMBOL(strstr);
  23.100 +
  23.101 +EXPORT_SYMBOL(strncpy_from_user);
  23.102 +EXPORT_SYMBOL(__strncpy_from_user);
  23.103 +EXPORT_SYMBOL(clear_user);
  23.104 +EXPORT_SYMBOL(__clear_user);
  23.105 +EXPORT_SYMBOL(__generic_copy_from_user);
  23.106 +EXPORT_SYMBOL(__generic_copy_to_user);
  23.107 +EXPORT_SYMBOL(strnlen_user);
  23.108 +
  23.109 +
  23.110 +EXPORT_SYMBOL(pci_alloc_consistent);
  23.111 +EXPORT_SYMBOL(pci_free_consistent);
  23.112 +
  23.113 +#ifdef CONFIG_PCI
  23.114 +EXPORT_SYMBOL(pcibios_penalize_isa_irq);
  23.115 +EXPORT_SYMBOL(pci_mem_start);
  23.116 +#endif
  23.117 +
  23.118 +
  23.119 +#ifdef CONFIG_X86_USE_3DNOW
  23.120 +EXPORT_SYMBOL(_mmx_memcpy);
  23.121 +EXPORT_SYMBOL(mmx_clear_page);
  23.122 +EXPORT_SYMBOL(mmx_copy_page);
  23.123 +#endif
  23.124 +
  23.125 +#ifdef CONFIG_SMP
  23.126 +EXPORT_SYMBOL(cpu_data);
  23.127 +EXPORT_SYMBOL(kernel_flag_cacheline);
  23.128 +EXPORT_SYMBOL(smp_num_cpus);
  23.129 +EXPORT_SYMBOL(cpu_online_map);
  23.130 +EXPORT_SYMBOL_NOVERS(__write_lock_failed);
  23.131 +EXPORT_SYMBOL_NOVERS(__read_lock_failed);
  23.132 +
  23.133 +/* Global SMP irq stuff */
  23.134 +EXPORT_SYMBOL(synchronize_irq);
  23.135 +EXPORT_SYMBOL(global_irq_holder);
  23.136 +EXPORT_SYMBOL(__global_cli);
  23.137 +EXPORT_SYMBOL(__global_sti);
  23.138 +EXPORT_SYMBOL(__global_save_flags);
  23.139 +EXPORT_SYMBOL(__global_restore_flags);
  23.140 +EXPORT_SYMBOL(smp_call_function);
  23.141 +
  23.142 +/* TLB flushing */
  23.143 +EXPORT_SYMBOL(flush_tlb_page);
  23.144 +
  23.145 +/* HT support */
  23.146 +EXPORT_SYMBOL(smp_num_siblings);
  23.147 +EXPORT_SYMBOL(cpu_sibling_map);
  23.148 +#endif
  23.149 +
  23.150 +#ifdef CONFIG_X86_IO_APIC
  23.151 +EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
  23.152 +#endif
  23.153 +
  23.154 +#ifdef CONFIG_VT
  23.155 +EXPORT_SYMBOL(screen_info);
  23.156 +#endif
  23.157 +
  23.158 +EXPORT_SYMBOL(get_wchan);
  23.159 +
  23.160 +EXPORT_SYMBOL(rtc_lock);
  23.161 +
  23.162 +#undef memcpy
  23.163 +#undef memset
  23.164 +extern void * memset(void *,int,__kernel_size_t);
  23.165 +extern void * memcpy(void *,const void *,__kernel_size_t);
  23.166 +EXPORT_SYMBOL_NOVERS(memcpy);
  23.167 +EXPORT_SYMBOL_NOVERS(memset);
  23.168 +
  23.169 +#ifdef CONFIG_HAVE_DEC_LOCK
  23.170 +EXPORT_SYMBOL(atomic_dec_and_lock);
  23.171 +#endif
  23.172 +
  23.173 +#ifdef CONFIG_MULTIQUAD
  23.174 +EXPORT_SYMBOL(xquad_portio);
  23.175 +#endif
  23.176 +
  23.177 +#include <asm/xen_proc.h>
  23.178 +EXPORT_SYMBOL(create_xen_proc_entry);
  23.179 +EXPORT_SYMBOL(remove_xen_proc_entry);
  23.180 +
  23.181 +EXPORT_SYMBOL(evtchn_do_upcall);
  23.182 +EXPORT_SYMBOL(force_evtchn_callback);
  23.183 +EXPORT_SYMBOL(HYPERVISOR_shared_info);
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/irq.c	Mon Jul 11 09:29:56 2005 -0500
    24.3 @@ -0,0 +1,1242 @@
    24.4 +/*
    24.5 + *	linux/arch/i386/kernel/irq.c
    24.6 + *
    24.7 + *	Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
    24.8 + *
    24.9 + * This file contains the code used by various IRQ handling routines:
   24.10 + * asking for different IRQ's should be done through these routines
   24.11 + * instead of just grabbing them. Thus setups with different IRQ numbers
   24.12 + * shouldn't result in any weird surprises, and installing new handlers
   24.13 + * should be easier.
   24.14 + */
   24.15 +
   24.16 +/*
   24.17 + * (mostly architecture independent, will move to kernel/irq.c in 2.5.)
   24.18 + *
   24.19 + * IRQs are in fact implemented a bit like signal handlers for the kernel.
   24.20 + * Naturally it's not a 1:1 relation, but there are similarities.
   24.21 + */
   24.22 +
   24.23 +#include <linux/config.h>
   24.24 +#include <linux/ptrace.h>
   24.25 +#include <linux/errno.h>
   24.26 +#include <linux/signal.h>
   24.27 +#include <linux/sched.h>
   24.28 +#include <linux/ioport.h>
   24.29 +#include <linux/interrupt.h>
   24.30 +#include <linux/timex.h>
   24.31 +#include <linux/slab.h>
   24.32 +#include <linux/random.h>
   24.33 +#include <linux/smp_lock.h>
   24.34 +#include <linux/init.h>
   24.35 +#include <linux/kernel_stat.h>
   24.36 +#include <linux/irq.h>
   24.37 +#include <linux/proc_fs.h>
   24.38 +#include <linux/seq_file.h>
   24.39 +
   24.40 +#include <asm/atomic.h>
   24.41 +#include <asm/io.h>
   24.42 +#include <asm/smp.h>
   24.43 +#include <asm/system.h>
   24.44 +#include <asm/bitops.h>
   24.45 +#include <asm/uaccess.h>
   24.46 +#include <asm/pgalloc.h>
   24.47 +#include <asm/delay.h>
   24.48 +#include <asm/desc.h>
   24.49 +#include <asm/irq.h>
   24.50 +
   24.51 +
   24.52 +
   24.53 +/*
   24.54 + * Linux has a controller-independent x86 interrupt architecture.
   24.55 + * every controller has a 'controller-template', that is used
   24.56 + * by the main code to do the right thing. Each driver-visible
   24.57 + * interrupt source is transparently wired to the apropriate
   24.58 + * controller. Thus drivers need not be aware of the
   24.59 + * interrupt-controller.
   24.60 + *
   24.61 + * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC,
   24.62 + * PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC.
   24.63 + * (IO-APICs assumed to be messaging to Pentium local-APICs)
   24.64 + *
   24.65 + * the code is designed to be easily extended with new/different
   24.66 + * interrupt controllers, without having to do assembly magic.
   24.67 + */
   24.68 +
   24.69 +/*
   24.70 + * Controller mappings for all interrupt sources:
   24.71 + */
   24.72 +irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned =
   24.73 +	{ [0 ... NR_IRQS-1] = { 0, &no_irq_type, NULL, 0, SPIN_LOCK_UNLOCKED}};
   24.74 +
   24.75 +static void register_irq_proc (unsigned int irq);
   24.76 +
   24.77 +/*
   24.78 + * Special irq handlers.
   24.79 + */
   24.80 +
   24.81 +void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
   24.82 +
   24.83 +/*
   24.84 + * Generic no controller code
   24.85 + */
   24.86 +
   24.87 +static void enable_none(unsigned int irq) { }
   24.88 +static unsigned int startup_none(unsigned int irq) { return 0; }
   24.89 +static void disable_none(unsigned int irq) { }
   24.90 +static void ack_none(unsigned int irq)
   24.91 +{
   24.92 +/*
   24.93 + * 'what should we do if we get a hw irq event on an illegal vector'.
   24.94 + * each architecture has to answer this themselves, it doesnt deserve
   24.95 + * a generic callback i think.
   24.96 + */
   24.97 +#if CONFIG_X86
   24.98 +	printk("unexpected IRQ trap at vector %02x\n", irq);
   24.99 +#ifdef CONFIG_X86_LOCAL_APIC
  24.100 +	/*
  24.101 +	 * Currently unexpected vectors happen only on SMP and APIC.
  24.102 +	 * We _must_ ack these because every local APIC has only N
  24.103 +	 * irq slots per priority level, and a 'hanging, unacked' IRQ
  24.104 +	 * holds up an irq slot - in excessive cases (when multiple
  24.105 +	 * unexpected vectors occur) that might lock up the APIC
  24.106 +	 * completely.
  24.107 +	 */
  24.108 +	ack_APIC_irq();
  24.109 +#endif
  24.110 +#endif
  24.111 +}
  24.112 +
  24.113 +/* startup is the same as "enable", shutdown is same as "disable" */
  24.114 +#define shutdown_none	disable_none
  24.115 +#define end_none	enable_none
  24.116 +
  24.117 +struct hw_interrupt_type no_irq_type = {
  24.118 +	"none",
  24.119 +	startup_none,
  24.120 +	shutdown_none,
  24.121 +	enable_none,
  24.122 +	disable_none,
  24.123 +	ack_none,
  24.124 +	end_none
  24.125 +};
  24.126 +
  24.127 +atomic_t irq_err_count;
  24.128 +#ifdef CONFIG_X86_IO_APIC
  24.129 +#ifdef APIC_MISMATCH_DEBUG
  24.130 +atomic_t irq_mis_count;
  24.131 +#endif
  24.132 +#endif
  24.133 +
  24.134 +/*
  24.135 + * Generic, controller-independent functions:
  24.136 + */
  24.137 +
  24.138 +int show_interrupts(struct seq_file *p, void *v)
  24.139 +{
  24.140 +	int i, j;
  24.141 +	struct irqaction * action;
  24.142 +
  24.143 +	seq_printf(p, "           ");
  24.144 +	for (j=0; j<smp_num_cpus; j++)
  24.145 +		seq_printf(p, "CPU%d       ",j);
  24.146 +	seq_putc(p,'\n');
  24.147 +
  24.148 +	for (i = 0 ; i < NR_IRQS ; i++) {
  24.149 +		action = irq_desc[i].action;
  24.150 +		if (!action) 
  24.151 +			continue;
  24.152 +		seq_printf(p, "%3d: ",i);
  24.153 +#ifndef CONFIG_SMP
  24.154 +		seq_printf(p, "%10u ", kstat_irqs(i));
  24.155 +#else
  24.156 +		for (j = 0; j < smp_num_cpus; j++)
  24.157 +			seq_printf(p, "%10u ",
  24.158 +				kstat.irqs[cpu_logical_map(j)][i]);
  24.159 +#endif
  24.160 +		seq_printf(p, " %14s", irq_desc[i].handler->typename);
  24.161 +		seq_printf(p, "  %s", action->name);
  24.162 +
  24.163 +		for (action=action->next; action; action = action->next)
  24.164 +			seq_printf(p, ", %s", action->name);
  24.165 +		seq_putc(p,'\n');
  24.166 +	}
  24.167 +	seq_printf(p, "NMI: ");
  24.168 +	for (j = 0; j < smp_num_cpus; j++)
  24.169 +		seq_printf(p, "%10u ",
  24.170 +			nmi_count(cpu_logical_map(j)));
  24.171 +	seq_printf(p, "\n");
  24.172 +#if CONFIG_X86_LOCAL_APIC
  24.173 +	seq_printf(p, "LOC: ");
  24.174 +	for (j = 0; j < smp_num_cpus; j++)
  24.175 +		seq_printf(p, "%10u ",
  24.176 +			apic_timer_irqs[cpu_logical_map(j)]);
  24.177 +	seq_printf(p, "\n");
  24.178 +#endif
  24.179 +	seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
  24.180 +#ifdef CONFIG_X86_IO_APIC
  24.181 +#ifdef APIC_MISMATCH_DEBUG
  24.182 +	seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
  24.183 +#endif
  24.184 +#endif
  24.185 +
  24.186 +	return 0;
  24.187 +}
  24.188 +
  24.189 +
  24.190 +/*
  24.191 + * Global interrupt locks for SMP. Allow interrupts to come in on any
  24.192 + * CPU, yet make cli/sti act globally to protect critical regions..
  24.193 + */
  24.194 +
  24.195 +#ifdef CONFIG_SMP
  24.196 +unsigned char global_irq_holder = NO_PROC_ID;
  24.197 +unsigned volatile long global_irq_lock; /* pendantic: long for set_bit --RR */
  24.198 +
  24.199 +extern void show_stack(unsigned long* esp);
  24.200 +
  24.201 +static void show(char * str)
  24.202 +{
  24.203 +	int i;
  24.204 +	int cpu = smp_processor_id();
  24.205 +
  24.206 +	printk("\n%s, CPU %d:\n", str, cpu);
  24.207 +	printk("irq:  %d [",irqs_running());
  24.208 +	for(i=0;i < smp_num_cpus;i++)
  24.209 +		printk(" %d",local_irq_count(i));
  24.210 +	printk(" ]\nbh:   %d [",spin_is_locked(&global_bh_lock) ? 1 : 0);
  24.211 +	for(i=0;i < smp_num_cpus;i++)
  24.212 +		printk(" %d",local_bh_count(i));
  24.213 +
  24.214 +	printk(" ]\nStack dumps:");
  24.215 +	for(i = 0; i < smp_num_cpus; i++) {
  24.216 +		unsigned long esp;
  24.217 +		if (i == cpu)
  24.218 +			continue;
  24.219 +		printk("\nCPU %d:",i);
  24.220 +		esp = init_tss[i].esp0;
  24.221 +		if (!esp) {
  24.222 +			/* tss->esp0 is set to NULL in cpu_init(),
  24.223 +			 * it's initialized when the cpu returns to user
  24.224 +			 * space. -- manfreds
  24.225 +			 */
  24.226 +			printk(" <unknown> ");
  24.227 +			continue;
  24.228 +		}
  24.229 +		esp &= ~(THREAD_SIZE-1);
  24.230 +		esp += sizeof(struct task_struct);
  24.231 +		show_stack((void*)esp);
  24.232 + 	}
  24.233 +	printk("\nCPU %d:",cpu);
  24.234 +	show_stack(NULL);
  24.235 +	printk("\n");
  24.236 +}
  24.237 +	
  24.238 +#define MAXCOUNT 100000000
  24.239 +
  24.240 +/*
  24.241 + * I had a lockup scenario where a tight loop doing
  24.242 + * spin_unlock()/spin_lock() on CPU#1 was racing with
  24.243 + * spin_lock() on CPU#0. CPU#0 should have noticed spin_unlock(), but
  24.244 + * apparently the spin_unlock() information did not make it
  24.245 + * through to CPU#0 ... nasty, is this by design, do we have to limit
  24.246 + * 'memory update oscillation frequency' artificially like here?
  24.247 + *
  24.248 + * Such 'high frequency update' races can be avoided by careful design, but
  24.249 + * some of our major constructs like spinlocks use similar techniques,
  24.250 + * it would be nice to clarify this issue. Set this define to 0 if you
  24.251 + * want to check whether your system freezes.  I suspect the delay done
  24.252 + * by SYNC_OTHER_CORES() is in correlation with 'snooping latency', but
  24.253 + * i thought that such things are guaranteed by design, since we use
  24.254 + * the 'LOCK' prefix.
  24.255 + */
  24.256 +#define SUSPECTED_CPU_OR_CHIPSET_BUG_WORKAROUND 0
  24.257 +
  24.258 +#if SUSPECTED_CPU_OR_CHIPSET_BUG_WORKAROUND
  24.259 +# define SYNC_OTHER_CORES(x) udelay(x+1)
  24.260 +#else
  24.261 +/*
  24.262 + * We have to allow irqs to arrive between __sti and __cli
  24.263 + */
  24.264 +# define SYNC_OTHER_CORES(x) __asm__ __volatile__ ("nop")
  24.265 +#endif
  24.266 +
  24.267 +static inline void wait_on_irq(int cpu)
  24.268 +{
  24.269 +	int count = MAXCOUNT;
  24.270 +
  24.271 +	for (;;) {
  24.272 +
  24.273 +		/*
  24.274 +		 * Wait until all interrupts are gone. Wait
  24.275 +		 * for bottom half handlers unless we're
  24.276 +		 * already executing in one..
  24.277 +		 */
  24.278 +		if (!irqs_running())
  24.279 +			if (local_bh_count(cpu) || !spin_is_locked(&global_bh_lock))
  24.280 +				break;
  24.281 +
  24.282 +		/* Duh, we have to loop. Release the lock to avoid deadlocks */
  24.283 +		clear_bit(0,&global_irq_lock);
  24.284 +
  24.285 +		for (;;) {
  24.286 +			if (!--count) {
  24.287 +				show("wait_on_irq");
  24.288 +				count = ~0;
  24.289 +			}
  24.290 +			__sti();
  24.291 +			SYNC_OTHER_CORES(cpu);
  24.292 +			__cli();
  24.293 +			if (irqs_running())
  24.294 +				continue;
  24.295 +			if (global_irq_lock)
  24.296 +				continue;
  24.297 +			if (!local_bh_count(cpu) && spin_is_locked(&global_bh_lock))
  24.298 +				continue;
  24.299 +			if (!test_and_set_bit(0,&global_irq_lock))
  24.300 +				break;
  24.301 +		}
  24.302 +	}
  24.303 +}
  24.304 +
  24.305 +/*
  24.306 + * This is called when we want to synchronize with
  24.307 + * interrupts. We may for example tell a device to
  24.308 + * stop sending interrupts: but to make sure there
  24.309 + * are no interrupts that are executing on another
  24.310 + * CPU we need to call this function.
  24.311 + */
  24.312 +void synchronize_irq(void)
  24.313 +{
  24.314 +	if (irqs_running()) {
  24.315 +		/* Stupid approach */
  24.316 +		cli();
  24.317 +		sti();
  24.318 +	}
  24.319 +}
  24.320 +
  24.321 +static inline void get_irqlock(int cpu)
  24.322 +{
  24.323 +	if (test_and_set_bit(0,&global_irq_lock)) {
  24.324 +		/* do we already hold the lock? */
  24.325 +		if ((unsigned char) cpu == global_irq_holder)
  24.326 +			return;
  24.327 +		/* Uhhuh.. Somebody else got it. Wait.. */
  24.328 +		do {
  24.329 +			do {
  24.330 +				rep_nop();
  24.331 +			} while (test_bit(0,&global_irq_lock));
  24.332 +		} while (test_and_set_bit(0,&global_irq_lock));		
  24.333 +	}
  24.334 +	/* 
  24.335 +	 * We also to make sure that nobody else is running
  24.336 +	 * in an interrupt context. 
  24.337 +	 */
  24.338 +	wait_on_irq(cpu);
  24.339 +
  24.340 +	/*
  24.341 +	 * Ok, finally..
  24.342 +	 */
  24.343 +	global_irq_holder = cpu;
  24.344 +}
  24.345 +
  24.346 +/*
  24.347 + * A global "cli()" while in an interrupt context
  24.348 + * turns into just a local cli(). Interrupts
  24.349 + * should use spinlocks for the (very unlikely)
  24.350 + * case that they ever want to protect against
  24.351 + * each other.
  24.352 + *
  24.353 + * If we already have local interrupts disabled,
  24.354 + * this will not turn a local disable into a
  24.355 + * global one (problems with spinlocks: this makes
  24.356 + * save_flags+cli+sti usable inside a spinlock).
  24.357 + */
  24.358 +void __global_cli(void)
  24.359 +{
  24.360 +	unsigned int flags;
  24.361 +
  24.362 +	__save_flags(flags);
  24.363 +	if (!flags) {
  24.364 +		int cpu = smp_processor_id();
  24.365 +		__cli();
  24.366 +		if (!local_irq_count(cpu))
  24.367 +			get_irqlock(cpu);
  24.368 +	}
  24.369 +}
  24.370 +
  24.371 +void __global_sti(void)
  24.372 +{
  24.373 +	int cpu = smp_processor_id();
  24.374 +
  24.375 +	if (!local_irq_count(cpu))
  24.376 +		release_irqlock(cpu);
  24.377 +	__sti();
  24.378 +}
  24.379 +
  24.380 +/*
  24.381 + * SMP flags value to restore to:
  24.382 + * 0 - global cli
  24.383 + * 1 - global sti
  24.384 + * 2 - local cli
  24.385 + * 3 - local sti
  24.386 + */
  24.387 +unsigned long __global_save_flags(void)
  24.388 +{
  24.389 +	int retval;
  24.390 +	int local_enabled;
  24.391 +	unsigned long flags;
  24.392 +	int cpu = smp_processor_id();
  24.393 +
  24.394 +	__save_flags(flags);
  24.395 +	local_enabled = !flags;
  24.396 +	/* default to local */
  24.397 +	retval = 2 + local_enabled;
  24.398 +
  24.399 +	/* check for global flags if we're not in an interrupt */
  24.400 +	if (!local_irq_count(cpu)) {
  24.401 +		if (local_enabled)
  24.402 +			retval = 1;
  24.403 +		if (global_irq_holder == cpu)
  24.404 +			retval = 0;
  24.405 +	}
  24.406 +	return retval;
  24.407 +}
  24.408 +
  24.409 +void __global_restore_flags(unsigned long flags)
  24.410 +{
  24.411 +	switch (flags) {
  24.412 +	case 0:
  24.413 +		__global_cli();
  24.414 +		break;
  24.415 +	case 1:
  24.416 +		__global_sti();
  24.417 +		break;
  24.418 +	case 2:
  24.419 +		__cli();
  24.420 +		break;
  24.421 +	case 3:
  24.422 +		__sti();
  24.423 +		break;
  24.424 +	default:
  24.425 +		printk("global_restore_flags: %08lx (%08lx)\n",
  24.426 +			flags, (&flags)[-1]);
  24.427 +	}
  24.428 +}
  24.429 +
  24.430 +#endif
  24.431 +
  24.432 +/*
  24.433 + * This should really return information about whether
  24.434 + * we should do bottom half handling etc. Right now we
  24.435 + * end up _always_ checking the bottom half, which is a
  24.436 + * waste of time and is not what some drivers would
  24.437 + * prefer.
  24.438 + */
  24.439 +int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, struct irqaction * action)
  24.440 +{
  24.441 +	int status;
  24.442 +	int cpu = smp_processor_id();
  24.443 +
  24.444 +	irq_enter(cpu, irq);
  24.445 +
  24.446 +	status = 1;	/* Force the "do bottom halves" bit */
  24.447 +
  24.448 +	if (!(action->flags & SA_INTERRUPT))
  24.449 +		__sti();
  24.450 +
  24.451 +	do {
  24.452 +		status |= action->flags;
  24.453 +		action->handler(irq, action->dev_id, regs);
  24.454 +		action = action->next;
  24.455 +	} while (action);
  24.456 +	if (status & SA_SAMPLE_RANDOM)
  24.457 +		add_interrupt_randomness(irq);
  24.458 +	__cli();
  24.459 +
  24.460 +	irq_exit(cpu, irq);
  24.461 +
  24.462 +	return status;
  24.463 +}
  24.464 +
  24.465 +/*
  24.466 + * Generic enable/disable code: this just calls
  24.467 + * down into the PIC-specific version for the actual
  24.468 + * hardware disable after having gotten the irq
  24.469 + * controller lock. 
  24.470 + */
  24.471 + 
  24.472 +/**
  24.473 + *	disable_irq_nosync - disable an irq without waiting
  24.474 + *	@irq: Interrupt to disable
  24.475 + *
  24.476 + *	Disable the selected interrupt line.  Disables and Enables are
  24.477 + *	nested.
  24.478 + *	Unlike disable_irq(), this function does not ensure existing
  24.479 + *	instances of the IRQ handler have completed before returning.
  24.480 + *
  24.481 + *	This function may be called from IRQ context.
  24.482 + */
  24.483 + 
  24.484 +inline void disable_irq_nosync(unsigned int irq)
  24.485 +{
  24.486 +	irq_desc_t *desc = irq_desc + irq;
  24.487 +	unsigned long flags;
  24.488 +
  24.489 +	spin_lock_irqsave(&desc->lock, flags);
  24.490 +	if (!desc->depth++) {
  24.491 +		desc->status |= IRQ_DISABLED;
  24.492 +		desc->handler->disable(irq);
  24.493 +	}
  24.494 +	spin_unlock_irqrestore(&desc->lock, flags);
  24.495 +}
  24.496 +
  24.497 +/**
  24.498 + *	disable_irq - disable an irq and wait for completion
  24.499 + *	@irq: Interrupt to disable
  24.500 + *
  24.501 + *	Disable the selected interrupt line.  Enables and Disables are
  24.502 + *	nested.
  24.503 + *	This function waits for any pending IRQ handlers for this interrupt
  24.504 + *	to complete before returning. If you use this function while
  24.505 + *	holding a resource the IRQ handler may need you will deadlock.
  24.506 + *
  24.507 + *	This function may be called - with care - from IRQ context.
  24.508 + */
  24.509 + 
  24.510 +void disable_irq(unsigned int irq)
  24.511 +{
  24.512 +	disable_irq_nosync(irq);
  24.513 +
  24.514 +	if (!local_irq_count(smp_processor_id())) {
  24.515 +		do {
  24.516 +			barrier();
  24.517 +			cpu_relax();
  24.518 +		} while (irq_desc[irq].status & IRQ_INPROGRESS);
  24.519 +	}
  24.520 +}
  24.521 +
  24.522 +/**
  24.523 + *	enable_irq - enable handling of an irq
  24.524 + *	@irq: Interrupt to enable
  24.525 + *
  24.526 + *	Undoes the effect of one call to disable_irq().  If this
  24.527 + *	matches the last disable, processing of interrupts on this
  24.528 + *	IRQ line is re-enabled.
  24.529 + *
  24.530 + *	This function may be called from IRQ context.
  24.531 + */
  24.532 + 
  24.533 +void enable_irq(unsigned int irq)
  24.534 +{
  24.535 +	irq_desc_t *desc = irq_desc + irq;
  24.536 +	unsigned long flags;
  24.537 +
  24.538 +	spin_lock_irqsave(&desc->lock, flags);
  24.539 +	switch (desc->depth) {
  24.540 +	case 1: {
  24.541 +		unsigned int status = desc->status & ~IRQ_DISABLED;
  24.542 +		desc->status = status;
  24.543 +		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
  24.544 +			desc->status = status | IRQ_REPLAY;
  24.545 +			hw_resend_irq(desc->handler,irq);
  24.546 +		}
  24.547 +		desc->handler->enable(irq);
  24.548 +		/* fall-through */
  24.549 +	}
  24.550 +	default:
  24.551 +		desc->depth--;
  24.552 +		break;
  24.553 +	case 0:
  24.554 +		printk("enable_irq(%u) unbalanced from %p\n", irq,
  24.555 +		       __builtin_return_address(0));
  24.556 +	}
  24.557 +	spin_unlock_irqrestore(&desc->lock, flags);
  24.558 +}
  24.559 +
  24.560 +/*
  24.561 + * do_IRQ handles all normal device IRQ's (the special
  24.562 + * SMP cross-CPU interrupts have their own specific
  24.563 + * handlers).
  24.564 + */
  24.565 +asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
  24.566 +{	
  24.567 +	/* 
  24.568 +	 * We ack quickly, we don't want the irq controller
  24.569 +	 * thinking we're snobs just because some other CPU has
  24.570 +	 * disabled global interrupts (we have already done the
  24.571 +	 * INT_ACK cycles, it's too late to try to pretend to the
  24.572 +	 * controller that we aren't taking the interrupt).
  24.573 +	 *
  24.574 +	 * 0 return value means that this irq is already being
  24.575 +	 * handled by some other CPU. (or is disabled)
  24.576 +	 */
  24.577 +	int irq = regs->orig_eax & 0xff; /* high bits used in ret_from_ code */
  24.578 +	int cpu = smp_processor_id();
  24.579 +	irq_desc_t *desc = irq_desc + irq;
  24.580 +	struct irqaction * action;
  24.581 +	unsigned int status;
  24.582 +#ifdef CONFIG_DEBUG_STACKOVERFLOW
  24.583 +	long esp;
  24.584 +
  24.585 +	/* Debugging check for stack overflow: is there less than 1KB free? */
  24.586 +	__asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
  24.587 +	if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
  24.588 +		extern void show_stack(unsigned long *);
  24.589 +
  24.590 +		printk("do_IRQ: stack overflow: %ld\n",
  24.591 +			esp - sizeof(struct task_struct));
  24.592 +		__asm__ __volatile__("movl %%esp,%0" : "=r" (esp));
  24.593 +		show_stack((void *)esp);
  24.594 +	}
  24.595 +#endif
  24.596 +
  24.597 +	kstat.irqs[cpu][irq]++;
  24.598 +	spin_lock(&desc->lock);
  24.599 +	desc->handler->ack(irq);
  24.600 +	/*
  24.601 +	   REPLAY is when Linux resends an IRQ that was dropped earlier
  24.602 +	   WAITING is used by probe to mark irqs that are being tested
  24.603 +	   */
  24.604 +	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
  24.605 +	status |= IRQ_PENDING; /* we _want_ to handle it */
  24.606 +
  24.607 +	/*
  24.608 +	 * If the IRQ is disabled for whatever reason, we cannot
  24.609 +	 * use the action we have.
  24.610 +	 */
  24.611 +	action = NULL;
  24.612 +	if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
  24.613 +		action = desc->action;
  24.614 +		status &= ~IRQ_PENDING; /* we commit to handling */
  24.615 +		status |= IRQ_INPROGRESS; /* we are handling it */
  24.616 +	}
  24.617 +	desc->status = status;
  24.618 +
  24.619 +	/*
  24.620 +	 * If there is no IRQ handler or it was disabled, exit early.
  24.621 +	   Since we set PENDING, if another processor is handling
  24.622 +	   a different instance of this same irq, the other processor
  24.623 +	   will take care of it.
  24.624 +	 */
  24.625 +	if (!action)
  24.626 +		goto out;
  24.627 +
  24.628 +	/*
  24.629 +	 * Edge triggered interrupts need to remember
  24.630 +	 * pending events.
  24.631 +	 * This applies to any hw interrupts that allow a second
  24.632 +	 * instance of the same irq to arrive while we are in do_IRQ
  24.633 +	 * or in the handler. But the code here only handles the _second_
  24.634 +	 * instance of the irq, not the third or fourth. So it is mostly
  24.635 +	 * useful for irq hardware that does not mask cleanly in an
  24.636 +	 * SMP environment.
  24.637 +	 */
  24.638 +	for (;;) {
  24.639 +		spin_unlock(&desc->lock);
  24.640 +		handle_IRQ_event(irq, regs, action);
  24.641 +		spin_lock(&desc->lock);
  24.642 +		
  24.643 +		if (!(desc->status & IRQ_PENDING))
  24.644 +			break;
  24.645 +		desc->status &= ~IRQ_PENDING;
  24.646 +	}
  24.647 +	desc->status &= ~IRQ_INPROGRESS;
  24.648 +out:
  24.649 +	/*
  24.650 +	 * The ->end() handler has to deal with interrupts which got
  24.651 +	 * disabled while the handler was running.
  24.652 +	 */
  24.653 +	desc->handler->end(irq);
  24.654 +	spin_unlock(&desc->lock);
  24.655 +
  24.656 +	if (softirq_pending(cpu))
  24.657 +		do_softirq();
  24.658 +	return 1;
  24.659 +}
  24.660 +
  24.661 +/**
  24.662 + *	request_irq - allocate an interrupt line
  24.663 + *	@irq: Interrupt line to allocate
  24.664 + *	@handler: Function to be called when the IRQ occurs
  24.665 + *	@irqflags: Interrupt type flags
  24.666 + *	@devname: An ascii name for the claiming device
  24.667 + *	@dev_id: A cookie passed back to the handler function
  24.668 + *
  24.669 + *	This call allocates interrupt resources and enables the
  24.670 + *	interrupt line and IRQ handling. From the point this
  24.671 + *	call is made your handler function may be invoked. Since
  24.672 + *	your handler function must clear any interrupt the board 
  24.673 + *	raises, you must take care both to initialise your hardware
  24.674 + *	and to set up the interrupt handler in the right order.
  24.675 + *
  24.676 + *	Dev_id must be globally unique. Normally the address of the
  24.677 + *	device data structure is used as the cookie. Since the handler
  24.678 + *	receives this value it makes sense to use it.
  24.679 + *
  24.680 + *	If your interrupt is shared you must pass a non NULL dev_id
  24.681 + *	as this is required when freeing the interrupt.
  24.682 + *
  24.683 + *	Flags:
  24.684 + *
  24.685 + *	SA_SHIRQ		Interrupt is shared
  24.686 + *
  24.687 + *	SA_INTERRUPT		Disable local interrupts while processing
  24.688 + *
  24.689 + *	SA_SAMPLE_RANDOM	The interrupt can be used for entropy
  24.690 + *
  24.691 + */
  24.692 + 
  24.693 +int request_irq(unsigned int irq, 
  24.694 +		void (*handler)(int, void *, struct pt_regs *),
  24.695 +		unsigned long irqflags, 
  24.696 +		const char * devname,
  24.697 +		void *dev_id)
  24.698 +{
  24.699 +	int retval;
  24.700 +	struct irqaction * action;
  24.701 +
  24.702 +#if 1
  24.703 +	/*
  24.704 +	 * Sanity-check: shared interrupts should REALLY pass in
  24.705 +	 * a real dev-ID, otherwise we'll have trouble later trying
  24.706 +	 * to figure out which interrupt is which (messes up the
  24.707 +	 * interrupt freeing logic etc).
  24.708 +	 */
  24.709 +	if (irqflags & SA_SHIRQ) {
  24.710 +		if (!dev_id)
  24.711 +			printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
  24.712 +	}
  24.713 +#endif
  24.714 +
  24.715 +	if (irq >= NR_IRQS)
  24.716 +		return -EINVAL;
  24.717 +	if (!handler)
  24.718 +		return -EINVAL;
  24.719 +
  24.720 +	action = (struct irqaction *)
  24.721 +			kmalloc(sizeof(struct irqaction), GFP_KERNEL);
  24.722 +	if (!action)
  24.723 +		return -ENOMEM;
  24.724 +
  24.725 +	action->handler = handler;
  24.726 +	action->flags = irqflags;
  24.727 +	action->mask = 0;
  24.728 +	action->name = devname;
  24.729 +	action->next = NULL;
  24.730 +	action->dev_id = dev_id;
  24.731 +
  24.732 +	retval = setup_irq(irq, action);
  24.733 +	if (retval)
  24.734 +		kfree(action);
  24.735 +	return retval;
  24.736 +}
  24.737 +
  24.738 +/*
  24.739 + * Internal function to unregister an irqaction - typically used to
  24.740 + * deallocate special interrupts that are part of the architecture.
  24.741 + */
  24.742 +int teardown_irq(unsigned int irq, struct irqaction * old)
  24.743 +{
  24.744 +	irq_desc_t *desc;
  24.745 +	struct irqaction **p;
  24.746 +	unsigned long flags;
  24.747 +
  24.748 +	if (irq >= NR_IRQS)
  24.749 +		return -ENOENT;
  24.750 +
  24.751 +	desc = irq_desc + irq;
  24.752 +	spin_lock_irqsave(&desc->lock,flags);
  24.753 +	p = &desc->action;
  24.754 +	for (;;) {
  24.755 +		struct irqaction * action = *p;
  24.756 +		if (action) {
  24.757 +			struct irqaction **pp = p;
  24.758 +			p = &action->next;
  24.759 +			if (action != old)
  24.760 +				continue;
  24.761 +
  24.762 +			/* Found it - now remove it from the list of entries */
  24.763 +			*pp = action->next;
  24.764 +			if (!desc->action) {
  24.765 +				desc->status |= IRQ_DISABLED;
  24.766 +				desc->handler->shutdown(irq);
  24.767 +			}
  24.768 +			spin_unlock_irqrestore(&desc->lock,flags);
  24.769 +
  24.770 +#ifdef CONFIG_SMP
  24.771 +			/* Wait to make sure it's not being used on another CPU */
  24.772 +			while (desc->status & IRQ_INPROGRESS) {
  24.773 +				barrier();
  24.774 +				cpu_relax();
  24.775 +			}
  24.776 +#endif
  24.777 +			return 0;
  24.778 +		}
  24.779 +		printk("Trying to free free IRQ%d\n",irq);
  24.780 +		spin_unlock_irqrestore(&desc->lock,flags);
  24.781 +		return -ENOENT;
  24.782 +	}
  24.783 +}
  24.784 +
  24.785 +/**
  24.786 + *	free_irq - free an interrupt
  24.787 + *	@irq: Interrupt line to free
  24.788 + *	@dev_id: Device identity to free
  24.789 + *
  24.790 + *	Remove an interrupt handler. The handler is removed and if the
  24.791 + *	interrupt line is no longer in use by any driver it is disabled.
  24.792 + *	On a shared IRQ the caller must ensure the interrupt is disabled
  24.793 + *	on the card it drives before calling this function. The function
  24.794 + *	does not return until any executing interrupts for this IRQ
  24.795 + *	have completed.
  24.796 + *
  24.797 + *	This function may be called from interrupt context. 
  24.798 + *
  24.799 + *	Bugs: Attempting to free an irq in a handler for the same irq hangs
  24.800 + *	      the machine.
  24.801 + */
  24.802 + 
  24.803 +void free_irq(unsigned int irq, void *dev_id)
  24.804 +{
  24.805 +	irq_desc_t *desc;
  24.806 +	struct irqaction *action;
  24.807 +	unsigned long flags;
  24.808 +
  24.809 +	if (irq >= NR_IRQS)
  24.810 +		return;
  24.811 +
  24.812 +	desc = irq_desc + irq;
  24.813 +	spin_lock_irqsave(&desc->lock,flags);
  24.814 +	for (action = desc->action; action != NULL; action = action->next) {
  24.815 +		if (action->dev_id != dev_id)
  24.816 +			continue;
  24.817 +
  24.818 +		spin_unlock_irqrestore(&desc->lock,flags);
  24.819 +
  24.820 +		if (teardown_irq(irq, action) == 0)
  24.821 +			kfree(action);
  24.822 +		return;
  24.823 +	}
  24.824 +	printk("Trying to free free IRQ%d\n",irq);
  24.825 +	spin_unlock_irqrestore(&desc->lock,flags);
  24.826 +	return;
  24.827 +}
  24.828 +
  24.829 +/*
  24.830 + * IRQ autodetection code..
  24.831 + *
  24.832 + * This depends on the fact that any interrupt that
  24.833 + * comes in on to an unassigned handler will get stuck
  24.834 + * with "IRQ_WAITING" cleared and the interrupt
  24.835 + * disabled.
  24.836 + */
  24.837 +
  24.838 +static DECLARE_MUTEX(probe_sem);
  24.839 +
  24.840 +/**
  24.841 + *	probe_irq_on	- begin an interrupt autodetect
  24.842 + *
  24.843 + *	Commence probing for an interrupt. The interrupts are scanned
  24.844 + *	and a mask of potential interrupt lines is returned.
  24.845 + *
  24.846 + */
  24.847 + 
  24.848 +unsigned long probe_irq_on(void)
  24.849 +{
  24.850 +	unsigned int i;
  24.851 +	irq_desc_t *desc;
  24.852 +	unsigned long val;
  24.853 +	unsigned long delay;
  24.854 +
  24.855 +	down(&probe_sem);
  24.856 +	/* 
  24.857 +	 * something may have generated an irq long ago and we want to
  24.858 +	 * flush such a longstanding irq before considering it as spurious. 
  24.859 +	 */
  24.860 +	for (i = NR_PIRQS-1; i > 0; i--)  {
  24.861 +		desc = irq_desc + i;
  24.862 +
  24.863 +		spin_lock_irq(&desc->lock);
  24.864 +		if (!irq_desc[i].action) 
  24.865 +			irq_desc[i].handler->startup(i);
  24.866 +		spin_unlock_irq(&desc->lock);
  24.867 +	}
  24.868 +
  24.869 +	/* Wait for longstanding interrupts to trigger. */
  24.870 +	for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
  24.871 +		/* about 20ms delay */ synchronize_irq();
  24.872 +
  24.873 +	/*
  24.874 +	 * enable any unassigned irqs
  24.875 +	 * (we must startup again here because if a longstanding irq
  24.876 +	 * happened in the previous stage, it may have masked itself)
  24.877 +	 */
  24.878 +	for (i = NR_PIRQS-1; i > 0; i--) {
  24.879 +		desc = irq_desc + i;
  24.880 +
  24.881 +		spin_lock_irq(&desc->lock);
  24.882 +		if (!desc->action) {
  24.883 +			desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
  24.884 +			if (desc->handler->startup(i))
  24.885 +				desc->status |= IRQ_PENDING;
  24.886 +		}
  24.887 +		spin_unlock_irq(&desc->lock);
  24.888 +	}
  24.889 +
  24.890 +	/*
  24.891 +	 * Wait for spurious interrupts to trigger
  24.892 +	 */
  24.893 +	for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
  24.894 +		/* about 100ms delay */ synchronize_irq();
  24.895 +
  24.896 +	/*
  24.897 +	 * Now filter out any obviously spurious interrupts
  24.898 +	 */
  24.899 +	val = 0;
  24.900 +	for (i = 0; i < NR_PIRQS; i++) {
  24.901 +		irq_desc_t *desc = irq_desc + i;
  24.902 +		unsigned int status;
  24.903 +
  24.904 +		spin_lock_irq(&desc->lock);
  24.905 +		status = desc->status;
  24.906 +
  24.907 +		if (status & IRQ_AUTODETECT) {
  24.908 +			/* It triggered already - consider it spurious. */
  24.909 +			if (!(status & IRQ_WAITING)) {
  24.910 +				desc->status = status & ~IRQ_AUTODETECT;
  24.911 +				desc->handler->shutdown(i);
  24.912 +			} else
  24.913 +				if (i < 32)
  24.914 +					val |= 1 << i;
  24.915 +		}
  24.916 +		spin_unlock_irq(&desc->lock);
  24.917 +	}
  24.918 +
  24.919 +	return val;
  24.920 +}
  24.921 +
  24.922 +/*
  24.923 + * Return a mask of triggered interrupts (this
  24.924 + * can handle only legacy ISA interrupts).
  24.925 + */
  24.926 + 
  24.927 +/**
  24.928 + *	probe_irq_mask - scan a bitmap of interrupt lines
  24.929 + *	@val:	mask of interrupts to consider
  24.930 + *
  24.931 + *	Scan the ISA bus interrupt lines and return a bitmap of
  24.932 + *	active interrupts. The interrupt probe logic state is then
  24.933 + *	returned to its previous value.
  24.934 + *
  24.935 + *	Note: we need to scan all the irq's even though we will
  24.936 + *	only return ISA irq numbers - just so that we reset them
  24.937 + *	all to a known state.
  24.938 + */
  24.939 +unsigned int probe_irq_mask(unsigned long val)
  24.940 +{
  24.941 +	int i;
  24.942 +	unsigned int mask;
  24.943 +
  24.944 +	mask = 0;
  24.945 +	for (i = 0; i < NR_PIRQS; i++) {
  24.946 +		irq_desc_t *desc = irq_desc + i;
  24.947 +		unsigned int status;
  24.948 +
  24.949 +		spin_lock_irq(&desc->lock);
  24.950 +		status = desc->status;
  24.951 +
  24.952 +		if (status & IRQ_AUTODETECT) {
  24.953 +			if (i < 16 && !(status & IRQ_WAITING))
  24.954 +				mask |= 1 << i;
  24.955 +
  24.956 +			desc->status = status & ~IRQ_AUTODETECT;
  24.957 +			desc->handler->shutdown(i);
  24.958 +		}
  24.959 +		spin_unlock_irq(&desc->lock);
  24.960 +	}
  24.961 +	up(&probe_sem);
  24.962 +
  24.963 +	return mask & val;
  24.964 +}
  24.965 +
  24.966 +/*
  24.967 + * Return the one interrupt that triggered (this can
  24.968 + * handle any interrupt source).
  24.969 + */
  24.970 +
  24.971 +/**
  24.972 + *	probe_irq_off	- end an interrupt autodetect
  24.973 + *	@val: mask of potential interrupts (unused)
  24.974 + *
  24.975 + *	Scans the unused interrupt lines and returns the line which
  24.976 + *	appears to have triggered the interrupt. If no interrupt was
  24.977 + *	found then zero is returned. If more than one interrupt is
  24.978 + *	found then minus the first candidate is returned to indicate
  24.979 + *	their is doubt.
  24.980 + *
  24.981 + *	The interrupt probe logic state is returned to its previous
  24.982 + *	value.
  24.983 + *
  24.984 + *	BUGS: When used in a module (which arguably shouldnt happen)
  24.985 + *	nothing prevents two IRQ probe callers from overlapping. The
  24.986 + *	results of this are non-optimal.
  24.987 + */
  24.988 + 
  24.989 +int probe_irq_off(unsigned long val)
  24.990 +{
  24.991 +	int i, irq_found, nr_irqs;
  24.992 +
  24.993 +	nr_irqs = 0;
  24.994 +	irq_found = 0;
  24.995 +	for (i = 0; i < NR_PIRQS; i++) {
  24.996 +		irq_desc_t *desc = irq_desc + i;
  24.997 +		unsigned int status;
  24.998 +
  24.999 +		spin_lock_irq(&desc->lock);
 24.1000 +		status = desc->status;
 24.1001 +
 24.1002 +		if (status & IRQ_AUTODETECT) {
 24.1003 +			if (!(status & IRQ_WAITING)) {
 24.1004 +				if (!nr_irqs)
 24.1005 +					irq_found = i;
 24.1006 +				nr_irqs++;
 24.1007 +			}
 24.1008 +			desc->status = status & ~IRQ_AUTODETECT;
 24.1009 +			desc->handler->shutdown(i);
 24.1010 +		}
 24.1011 +		spin_unlock_irq(&desc->lock);
 24.1012 +	}
 24.1013 +	up(&probe_sem);
 24.1014 +
 24.1015 +	if (nr_irqs > 1)
 24.1016 +		irq_found = -irq_found;
 24.1017 +	return irq_found;
 24.1018 +}
 24.1019 +
 24.1020 +/* this was setup_x86_irq but it seems pretty generic */
 24.1021 +int setup_irq(unsigned int irq, struct irqaction * new)
 24.1022 +{
 24.1023 +	int shared = 0;
 24.1024 +	unsigned long flags;
 24.1025 +	struct irqaction *old, **p;
 24.1026 +	irq_desc_t *desc = irq_desc + irq;
 24.1027 +
 24.1028 +	/*
 24.1029 +	 * Some drivers like serial.c use request_irq() heavily,
 24.1030 +	 * so we have to be careful not to interfere with a
 24.1031 +	 * running system.
 24.1032 +	 */
 24.1033 +	if (new->flags & SA_SAMPLE_RANDOM) {
 24.1034 +		/*
 24.1035 +		 * This function might sleep, we want to call it first,
 24.1036 +		 * outside of the atomic block.
 24.1037 +		 * Yes, this might clear the entropy pool if the wrong
 24.1038 +		 * driver is attempted to be loaded, without actually
 24.1039 +		 * installing a new handler, but is this really a problem,
 24.1040 +		 * only the sysadmin is able to do this.
 24.1041 +		 */
 24.1042 +		rand_initialize_irq(irq);
 24.1043 +	}
 24.1044 +
 24.1045 +	/*
 24.1046 +	 * The following block of code has to be executed atomically
 24.1047 +	 */
 24.1048 +	spin_lock_irqsave(&desc->lock,flags);
 24.1049 +	p = &desc->action;
 24.1050 +	if ((old = *p) != NULL) {
 24.1051 +		/* Can't share interrupts unless both agree to */
 24.1052 +		if (!(old->flags & new->flags & SA_SHIRQ)) {
 24.1053 +			spin_unlock_irqrestore(&desc->lock,flags);
 24.1054 +			return -EBUSY;
 24.1055 +		}
 24.1056 +
 24.1057 +		/* add new interrupt at end of irq queue */
 24.1058 +		do {
 24.1059 +			p = &old->next;
 24.1060 +			old = *p;
 24.1061 +		} while (old);
 24.1062 +		shared = 1;
 24.1063 +	}
 24.1064 +
 24.1065 +	*p = new;
 24.1066 +
 24.1067 +	if (!shared) {
 24.1068 +		desc->depth = 0;
 24.1069 +		desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
 24.1070 +		desc->handler->startup(irq);
 24.1071 +	}
 24.1072 +	spin_unlock_irqrestore(&desc->lock,flags);
 24.1073 +
 24.1074 +	register_irq_proc(irq);
 24.1075 +	return 0;
 24.1076 +}
 24.1077 +
 24.1078 +static struct proc_dir_entry * root_irq_dir;
 24.1079 +static struct proc_dir_entry * irq_dir [NR_IRQS];
 24.1080 +
 24.1081 +#define HEX_DIGITS 8
 24.1082 +
 24.1083 +static unsigned int parse_hex_value (const char *buffer,
 24.1084 +		unsigned long count, unsigned long *ret)
 24.1085 +{
 24.1086 +	unsigned char hexnum [HEX_DIGITS];
 24.1087 +	unsigned long value;
 24.1088 +	int i;
 24.1089 +
 24.1090 +	if (!count)
 24.1091 +		return -EINVAL;
 24.1092 +	if (count > HEX_DIGITS)
 24.1093 +		count = HEX_DIGITS;
 24.1094 +	if (copy_from_user(hexnum, buffer, count))
 24.1095 +		return -EFAULT;
 24.1096 +
 24.1097 +	/*
 24.1098 +	 * Parse the first 8 characters as a hex string, any non-hex char
 24.1099 +	 * is end-of-string. '00e1', 'e1', '00E1', 'E1' are all the same.
 24.1100 +	 */
 24.1101 +	value = 0;
 24.1102 +
 24.1103 +	for (i = 0; i < count; i++) {
 24.1104 +		unsigned int c = hexnum[i];
 24.1105 +
 24.1106 +		switch (c) {
 24.1107 +			case '0' ... '9': c -= '0'; break;
 24.1108 +			case 'a' ... 'f': c -= 'a'-10; break;
 24.1109 +			case 'A' ... 'F': c -= 'A'-10; break;
 24.1110 +		default:
 24.1111 +			goto out;
 24.1112 +		}
 24.1113 +		value = (value << 4) | c;
 24.1114 +	}
 24.1115 +out:
 24.1116 +	*ret = value;
 24.1117 +	return 0;
 24.1118 +}
 24.1119 +
 24.1120 +#if CONFIG_SMP
 24.1121 +
 24.1122 +static struct proc_dir_entry * smp_affinity_entry [NR_IRQS];
 24.1123 +
 24.1124 +static unsigned long irq_affinity [NR_IRQS] = { [0 ... NR_IRQS-1] = ~0UL };
 24.1125 +static int irq_affinity_read_proc (char *page, char **start, off_t off,
 24.1126 +			int count, int *eof, void *data)
 24.1127 +{
 24.1128 +	if (count < HEX_DIGITS+1)
 24.1129 +		return -EINVAL;
 24.1130 +	return sprintf (page, "%08lx\n", irq_affinity[(long)data]);
 24.1131 +}
 24.1132 +
 24.1133 +static int irq_affinity_write_proc (struct file *file, const char *buffer,
 24.1134 +					unsigned long count, void *data)
 24.1135 +{
 24.1136 +	int irq = (long) data, full_count = count, err;
 24.1137 +	unsigned long new_value;
 24.1138 +
 24.1139 +	if (!irq_desc[irq].handler->set_affinity)
 24.1140 +		return -EIO;
 24.1141 +
 24.1142 +	err = parse_hex_value(buffer, count, &new_value);
 24.1143 +
 24.1144 +	/*
 24.1145 +	 * Do not allow disabling IRQs completely - it's a too easy
 24.1146 +	 * way to make the system unusable accidentally :-) At least
 24.1147 +	 * one online CPU still has to be targeted.
 24.1148 +	 */
 24.1149 +	if (!(new_value & cpu_online_map))
 24.1150 +		return -EINVAL;
 24.1151 +
 24.1152 +	irq_affinity[irq] = new_value;
 24.1153 +	irq_desc[irq].handler->set_affinity(irq, new_value);
 24.1154 +
 24.1155 +	return full_count;
 24.1156 +}
 24.1157 +
 24.1158 +#endif
 24.1159 +
 24.1160 +static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
 24.1161 +			int count, int *eof, void *data)
 24.1162 +{
 24.1163 +	unsigned long *mask = (unsigned long *) data;
 24.1164 +	if (count < HEX_DIGITS+1)
 24.1165 +		return -EINVAL;
 24.1166 +	return sprintf (page, "%08lx\n", *mask);
 24.1167 +}
 24.1168 +
 24.1169 +static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
 24.1170 +					unsigned long count, void *data)
 24.1171 +{
 24.1172 +	unsigned long *mask = (unsigned long *) data, full_count = count, err;
 24.1173 +	unsigned long new_value;
 24.1174 +
 24.1175 +	err = parse_hex_value(buffer, count, &new_value);
 24.1176 +	if (err)
 24.1177 +		return err;
 24.1178 +
 24.1179 +	*mask = new_value;
 24.1180 +	return full_count;
 24.1181 +}
 24.1182 +
 24.1183 +#define MAX_NAMELEN 10
 24.1184 +
 24.1185 +static void register_irq_proc (unsigned int irq)
 24.1186 +{
 24.1187 +	char name [MAX_NAMELEN];
 24.1188 +
 24.1189 +	if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) ||
 24.1190 +			irq_dir[irq])
 24.1191 +		return;
 24.1192 +
 24.1193 +	memset(name, 0, MAX_NAMELEN);
 24.1194 +	sprintf(name, "%d", irq);
 24.1195 +
 24.1196 +	/* create /proc/irq/1234 */
 24.1197 +	irq_dir[irq] = proc_mkdir(name, root_irq_dir);
 24.1198 +
 24.1199 +#if CONFIG_SMP
 24.1200 +	{
 24.1201 +		struct proc_dir_entry *entry;
 24.1202 +
 24.1203 +		/* create /proc/irq/1234/smp_affinity */
 24.1204 +		entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]);
 24.1205 +
 24.1206 +		if (entry) {
 24.1207 +			entry->nlink = 1;
 24.1208 +			entry->data = (void *)(long)irq;
 24.1209 +			entry->read_proc = irq_affinity_read_proc;
 24.1210 +			entry->write_proc = irq_affinity_write_proc;
 24.1211 +		}
 24.1212 +
 24.1213 +		smp_affinity_entry[irq] = entry;
 24.1214 +	}
 24.1215 +#endif
 24.1216 +}
 24.1217 +
 24.1218 +unsigned long prof_cpu_mask = -1;
 24.1219 +
 24.1220 +void init_irq_proc (void)
 24.1221 +{
 24.1222 +	struct proc_dir_entry *entry;
 24.1223 +	int i;
 24.1224 +
 24.1225 +	/* create /proc/irq */
 24.1226 +	root_irq_dir = proc_mkdir("irq", 0);
 24.1227 +
 24.1228 +	/* create /proc/irq/prof_cpu_mask */
 24.1229 +	entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
 24.1230 +
 24.1231 +	if (!entry)
 24.1232 +	    return;
 24.1233 +
 24.1234 +	entry->nlink = 1;
 24.1235 +	entry->data = (void *)&prof_cpu_mask;
 24.1236 +	entry->read_proc = prof_cpu_mask_read_proc;
 24.1237 +	entry->write_proc = prof_cpu_mask_write_proc;
 24.1238 +
 24.1239 +	/*
 24.1240 +	 * Create entries for all existing IRQs.
 24.1241 +	 */
 24.1242 +	for (i = 0; i < NR_IRQS; i++)
 24.1243 +		register_irq_proc(i);
 24.1244 +}
 24.1245 +
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/ldt.c	Mon Jul 11 09:29:56 2005 -0500
    25.3 @@ -0,0 +1,272 @@
    25.4 +/*
    25.5 + * linux/kernel/ldt.c
    25.6 + *
    25.7 + * Copyright (C) 1992 Krishna Balasubramanian and Linus Torvalds
    25.8 + * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
    25.9 + */
   25.10 +
   25.11 +#include <linux/errno.h>
   25.12 +#include <linux/sched.h>
   25.13 +#include <linux/string.h>
   25.14 +#include <linux/mm.h>
   25.15 +#include <linux/smp.h>
   25.16 +#include <linux/smp_lock.h>
   25.17 +#include <linux/vmalloc.h>
   25.18 +#include <linux/slab.h>
   25.19 +
   25.20 +#include <asm/mmu_context.h>
   25.21 +#include <asm/uaccess.h>
   25.22 +#include <asm/system.h>
   25.23 +#include <asm/ldt.h>
   25.24 +#include <asm/desc.h>
   25.25 +
   25.26 +#ifdef CONFIG_SMP /* avoids "defined but not used" warnig */
   25.27 +static void flush_ldt(void *mm)
   25.28 +{
   25.29 +	if (current->active_mm)
   25.30 +		load_LDT(&current->active_mm->context);
   25.31 +}
   25.32 +#endif
   25.33 +
   25.34 +static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
   25.35 +{
   25.36 +	void *oldldt;
   25.37 +	void *newldt;
   25.38 +	int oldsize;
   25.39 +
   25.40 +	if (mincount <= pc->size)
   25.41 +		return 0;
   25.42 +	oldsize = pc->size;
   25.43 +	mincount = (mincount+511)&(~511);
   25.44 +	if (mincount*LDT_ENTRY_SIZE > PAGE_SIZE)
   25.45 +		newldt = vmalloc(mincount*LDT_ENTRY_SIZE);
   25.46 +	else
   25.47 +		newldt = kmalloc(mincount*LDT_ENTRY_SIZE, GFP_KERNEL);
   25.48 +
   25.49 +	if (!newldt)
   25.50 +		return -ENOMEM;
   25.51 +
   25.52 +	if (oldsize)
   25.53 +		memcpy(newldt, pc->ldt, oldsize*LDT_ENTRY_SIZE);
   25.54 +
   25.55 +	oldldt = pc->ldt;
   25.56 +	memset(newldt+oldsize*LDT_ENTRY_SIZE, 0, (mincount-oldsize)*LDT_ENTRY_SIZE);
   25.57 +	wmb();
   25.58 +	pc->ldt = newldt;
   25.59 +	pc->size = mincount;
   25.60 +	if (reload) {
   25.61 +		make_pages_readonly(
   25.62 +			pc->ldt,
   25.63 +			(pc->size*LDT_ENTRY_SIZE)/PAGE_SIZE);
   25.64 +		load_LDT(pc);
   25.65 +#ifdef CONFIG_SMP
   25.66 +		if (current->mm->cpu_vm_mask != (1<<smp_processor_id()))
   25.67 +			smp_call_function(flush_ldt, 0, 1, 1);
   25.68 +#endif
   25.69 +	}
   25.70 +	wmb();
   25.71 +	if (oldsize) {
   25.72 +		make_pages_writable(
   25.73 +			oldldt, (oldsize*LDT_ENTRY_SIZE)/PAGE_SIZE);
   25.74 +		if (oldsize*LDT_ENTRY_SIZE > PAGE_SIZE)
   25.75 +			vfree(oldldt);
   25.76 +		else
   25.77 +			kfree(oldldt);
   25.78 +	}
   25.79 +	return 0;
   25.80 +}
   25.81 +
   25.82 +static inline int copy_ldt(mm_context_t *new, mm_context_t *old)
   25.83 +{
   25.84 +	int err = alloc_ldt(new, old->size, 0);
   25.85 +	if (err < 0) {
   25.86 +		printk(KERN_WARNING "ldt allocation failed\n");
   25.87 +		new->size = 0;
   25.88 +		return err;
   25.89 +	}
   25.90 +	memcpy(new->ldt, old->ldt, old->size*LDT_ENTRY_SIZE);
   25.91 +	make_pages_readonly(new->ldt, (new->size*LDT_ENTRY_SIZE)/PAGE_SIZE);
   25.92 +	return 0;
   25.93 +}
   25.94 +
   25.95 +/*
   25.96 + * we do not have to muck with descriptors here, that is
   25.97 + * done in switch_mm() as needed.
   25.98 + */
   25.99 +int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
  25.100 +{
  25.101 +	struct mm_struct * old_mm;
  25.102 +	int retval = 0;
  25.103 +
  25.104 +	init_MUTEX(&mm->context.sem);
  25.105 +	mm->context.size = 0;
  25.106 +	old_mm = current->mm;
  25.107 +	if (old_mm && old_mm->context.size > 0) {
  25.108 +		down(&old_mm->context.sem);
  25.109 +		retval = copy_ldt(&mm->context, &old_mm->context);
  25.110 +		up(&old_mm->context.sem);
  25.111 +	}
  25.112 +	return retval;
  25.113 +}
  25.114 +
  25.115 +/*
  25.116 + * No need to lock the MM as we are the last user
  25.117 + * Do not touch the ldt register, we are already
  25.118 + * in the next thread.
  25.119 + */
  25.120 +void destroy_context(struct mm_struct *mm)
  25.121 +{
  25.122 +	if (mm->context.size) {
  25.123 +		make_pages_writable(
  25.124 +			mm->context.ldt, 
  25.125 +			(mm->context.size*LDT_ENTRY_SIZE)/PAGE_SIZE);
  25.126 +		if (mm->context.size*LDT_ENTRY_SIZE > PAGE_SIZE)
  25.127 +			vfree(mm->context.ldt);
  25.128 +		else
  25.129 +			kfree(mm->context.ldt);
  25.130 +		mm->context.size = 0;
  25.131 +	}
  25.132 +}
  25.133 +
  25.134 +static int read_ldt(void * ptr, unsigned long bytecount)
  25.135 +{
  25.136 +	int err;
  25.137 +	unsigned long size;
  25.138 +	struct mm_struct * mm = current->mm;
  25.139 +
  25.140 +	if (!mm->context.size)
  25.141 +		return 0;
  25.142 +	if (bytecount > LDT_ENTRY_SIZE*LDT_ENTRIES)
  25.143 +		bytecount = LDT_ENTRY_SIZE*LDT_ENTRIES;
  25.144 +
  25.145 +	down(&mm->context.sem);
  25.146 +	size = mm->context.size*LDT_ENTRY_SIZE;
  25.147 +	if (size > bytecount)
  25.148 +		size = bytecount;
  25.149 +
  25.150 +	err = 0;
  25.151 +	if (copy_to_user(ptr, mm->context.ldt, size))
  25.152 +		err = -EFAULT;
  25.153 +	up(&mm->context.sem);
  25.154 +	if (err < 0)
  25.155 +		return err;
  25.156 +	if (size != bytecount) {
  25.157 +		/* zero-fill the rest */
  25.158 +		clear_user(ptr+size, bytecount-size);
  25.159 +	}
  25.160 +	return bytecount;
  25.161 +}
  25.162 +
  25.163 +static int read_default_ldt(void * ptr, unsigned long bytecount)
  25.164 +{
  25.165 +	int err;
  25.166 +	unsigned long size;
  25.167 +	void *address;
  25.168 +
  25.169 +	err = 0;
  25.170 +	address = &default_ldt[0];
  25.171 +	size = 5*sizeof(struct desc_struct);
  25.172 +	if (size > bytecount)
  25.173 +		size = bytecount;
  25.174 +
  25.175 +	err = size;
  25.176 +	if (copy_to_user(ptr, address, size))
  25.177 +		err = -EFAULT;
  25.178 +
  25.179 +	return err;
  25.180 +}
  25.181 +
  25.182 +static int write_ldt(void * ptr, unsigned long bytecount, int oldmode)
  25.183 +{
  25.184 +	struct mm_struct * mm = current->mm;
  25.185 +	__u32 entry_1, entry_2, *lp;
  25.186 +	unsigned long mach_lp;
  25.187 +	int error;
  25.188 +	struct modify_ldt_ldt_s ldt_info;
  25.189 +
  25.190 +	error = -EINVAL;
  25.191 +	if (bytecount != sizeof(ldt_info))
  25.192 +		goto out;
  25.193 +	error = -EFAULT; 	
  25.194 +	if (copy_from_user(&ldt_info, ptr, sizeof(ldt_info)))
  25.195 +		goto out;
  25.196 +
  25.197 +	error = -EINVAL;
  25.198 +	if (ldt_info.entry_number >= LDT_ENTRIES)
  25.199 +		goto out;
  25.200 +	if (ldt_info.contents == 3) {
  25.201 +		if (oldmode)
  25.202 +			goto out;
  25.203 +		if (ldt_info.seg_not_present == 0)
  25.204 +			goto out;
  25.205 +	}
  25.206 +
  25.207 +	down(&mm->context.sem);
  25.208 +	if (ldt_info.entry_number >= mm->context.size) {
  25.209 +		error = alloc_ldt(&current->mm->context, ldt_info.entry_number+1, 1);
  25.210 +		if (error < 0)
  25.211 +			goto out_unlock;
  25.212 +	}
  25.213 +
  25.214 +	lp = (__u32 *) ((ldt_info.entry_number << 3) + (char *) mm->context.ldt);
  25.215 +	mach_lp = arbitrary_virt_to_machine(lp);
  25.216 +
  25.217 +   	/* Allow LDTs to be cleared by the user. */
  25.218 +   	if (ldt_info.base_addr == 0 && ldt_info.limit == 0) {
  25.219 +		if (oldmode ||
  25.220 +		    (ldt_info.contents == 0		&&
  25.221 +		     ldt_info.read_exec_only == 1	&&
  25.222 +		     ldt_info.seg_32bit == 0		&&
  25.223 +		     ldt_info.limit_in_pages == 0	&&
  25.224 +		     ldt_info.seg_not_present == 1	&&
  25.225 +		     ldt_info.useable == 0 )) {
  25.226 +			entry_1 = 0;
  25.227 +			entry_2 = 0;
  25.228 +			goto install;
  25.229 +		}
  25.230 +	}
  25.231 +
  25.232 +	entry_1 = ((ldt_info.base_addr & 0x0000ffff) << 16) |
  25.233 +		  (ldt_info.limit & 0x0ffff);
  25.234 +	entry_2 = (ldt_info.base_addr & 0xff000000) |
  25.235 +		  ((ldt_info.base_addr & 0x00ff0000) >> 16) |
  25.236 +		  (ldt_info.limit & 0xf0000) |
  25.237 +		  ((ldt_info.read_exec_only ^ 1) << 9) |
  25.238 +		  (ldt_info.contents << 10) |
  25.239 +		  ((ldt_info.seg_not_present ^ 1) << 15) |
  25.240 +		  (ldt_info.seg_32bit << 22) |
  25.241 +		  (ldt_info.limit_in_pages << 23) |
  25.242 +		  0x7000;
  25.243 +	if (!oldmode)
  25.244 +		entry_2 |= (ldt_info.useable << 20);
  25.245 +
  25.246 +	/* Install the new entry ...  */
  25.247 +install:
  25.248 +	error = HYPERVISOR_update_descriptor(mach_lp, entry_1, entry_2);
  25.249 +
  25.250 +out_unlock:
  25.251 +	up(&mm->context.sem);
  25.252 +out:
  25.253 +	return error;
  25.254 +}
  25.255 +
  25.256 +asmlinkage int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
  25.257 +{
  25.258 +	int ret = -ENOSYS;
  25.259 +
  25.260 +	switch (func) {
  25.261 +	case 0:
  25.262 +		ret = read_ldt(ptr, bytecount);
  25.263 +		break;
  25.264 +	case 1:
  25.265 +		ret = write_ldt(ptr, bytecount, 1);
  25.266 +		break;
  25.267 +	case 2:
  25.268 +		ret = read_default_ldt(ptr, bytecount);
  25.269 +		break;
  25.270 +	case 0x11:
  25.271 +		ret = write_ldt(ptr, bytecount, 0);
  25.272 +		break;
  25.273 +	}
  25.274 +	return ret;
  25.275 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/pci-pc.c	Mon Jul 11 09:29:56 2005 -0500
    26.3 @@ -0,0 +1,260 @@
    26.4 +/*
    26.5 + *	Low-Level PCI Support for PC
    26.6 + *
    26.7 + *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
    26.8 + *
    26.9 + * Adjusted to use Xen's interface by Rolf Neugebauer, Intel Research Cambridge
   26.10 + * Further modifications by Keir Fraser, University of Cambridge
   26.11 + */
   26.12 +
   26.13 +#include <linux/config.h>
   26.14 +#include <linux/types.h>
   26.15 +#include <linux/kernel.h>
   26.16 +#include <linux/sched.h>
   26.17 +#include <linux/pci.h>
   26.18 +#include <linux/init.h>
   26.19 +#include <linux/ioport.h>
   26.20 +
   26.21 +#include <asm/segment.h>
   26.22 +#include <asm/io.h>
   26.23 +
   26.24 +#include <asm-xen/xen-public/xen.h>
   26.25 +#include <asm-xen/xen-public/physdev.h>
   26.26 +
   26.27 +#include "pci-i386.h"
   26.28 +
   26.29 +/*
   26.30 + * NB. The following interface functions are not included here:
   26.31 + *  1. void eisa_set_level_irq(unsigned int irq)
   26.32 + *  2. irq_routing_table * __devinit pcibios_get_irq_routing_table(void)
   26.33 + *  3. int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
   26.34 + * All are used by the ACPI driver. This should be ported to Xen if it is
   26.35 + * ever required -- Xen is the ultimate source for IRQ-routing knowledge.
   26.36 + */
   26.37 +
   26.38 +struct pci_ops *pci_root_ops = NULL;
   26.39 +
   26.40 +int (*pci_config_read)(int seg, int bus, int dev, int fn, 
   26.41 +                       int reg, int len, u32 *value) = NULL;
   26.42 +int (*pci_config_write)(int seg, int bus, int dev, int fn,
   26.43 +                        int reg, int len, u32 value) = NULL;
   26.44 +
   26.45 +unsigned int pci_probe = PCI_PROBE_BIOS;
   26.46 +
   26.47 +struct pci_fixup pcibios_fixups[] = { { 0 } };
   26.48 +
   26.49 +static int pci_confx_read(int seg, int bus, int dev, int fn, int reg, 
   26.50 +                          int len, u32 *value)
   26.51 +{
   26.52 +    int ret;
   26.53 +    physdev_op_t op;
   26.54 +
   26.55 +    if (bus > 255 || dev > 31 || fn > 7 || reg > 255)
   26.56 +        return -EINVAL;
   26.57 +
   26.58 +    op.cmd = PHYSDEVOP_PCI_CFGREG_READ;
   26.59 +    op.u.pci_cfgreg_read.bus  = bus;
   26.60 +    op.u.pci_cfgreg_read.dev  = dev;
   26.61 +    op.u.pci_cfgreg_read.func = fn;
   26.62 +    op.u.pci_cfgreg_read.reg  = reg;
   26.63 +    op.u.pci_cfgreg_read.len  = len;
   26.64 +
   26.65 +    if ( (ret = HYPERVISOR_physdev_op(&op)) != 0 )
   26.66 +        return ret;
   26.67 +
   26.68 +    *value = op.u.pci_cfgreg_read.value;
   26.69 +
   26.70 +    return 0;
   26.71 +}
   26.72 +
   26.73 +static int pci_confx_write(int seg, int bus, int dev, int fn, int reg, 
   26.74 +                           int len, u32 value)
   26.75 +{
   26.76 +    int ret;
   26.77 +    physdev_op_t op;
   26.78 +
   26.79 +    if ((bus > 255 || dev > 31 || fn > 7 || reg > 255)) 
   26.80 +        return -EINVAL;
   26.81 +
   26.82 +    op.cmd = PHYSDEVOP_PCI_CFGREG_WRITE;
   26.83 +    op.u.pci_cfgreg_write.bus   = bus;
   26.84 +    op.u.pci_cfgreg_write.dev   = dev;
   26.85 +    op.u.pci_cfgreg_write.func  = fn;
   26.86 +    op.u.pci_cfgreg_write.reg   = reg;
   26.87 +    op.u.pci_cfgreg_write.len   = len;
   26.88 +    op.u.pci_cfgreg_write.value = value;
   26.89 +
   26.90 +    if ( (ret = HYPERVISOR_physdev_op(&op)) != 0 )
   26.91 +        return ret;
   26.92 +    return 0;
   26.93 +}
   26.94 +
   26.95 +
   26.96 +static int pci_confx_read_config_byte(struct pci_dev *dev, 
   26.97 +                                      int where, u8 *value)
   26.98 +{
   26.99 +    int result; 
  26.100 +    u32 data;
  26.101 +
  26.102 +    result = pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.103 +                            PCI_FUNC(dev->devfn), where, 1, &data);
  26.104 +
  26.105 +    *value = (u8)data;
  26.106 +
  26.107 +    return result;
  26.108 +}
  26.109 +
  26.110 +static int pci_confx_read_config_word(struct pci_dev *dev, 
  26.111 +                                      int where, u16 *value)
  26.112 +{
  26.113 +    int result; 
  26.114 +    u32 data;
  26.115 +
  26.116 +    result = pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.117 +                            PCI_FUNC(dev->devfn), where, 2, &data);
  26.118 +
  26.119 +    *value = (u16)data;
  26.120 +
  26.121 +    return result;
  26.122 +}
  26.123 +
  26.124 +static int pci_confx_read_config_dword(struct pci_dev *dev, 
  26.125 +                                       int where, u32 *value)
  26.126 +{
  26.127 +    return pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.128 +                          PCI_FUNC(dev->devfn), where, 4, value);
  26.129 +}
  26.130 +
  26.131 +static int pci_confx_write_config_byte(struct pci_dev *dev, 
  26.132 +                                       int where, u8 value)
  26.133 +{
  26.134 +    return pci_confx_write(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.135 +                           PCI_FUNC(dev->devfn), where, 1, value);
  26.136 +}
  26.137 +
  26.138 +static int pci_confx_write_config_word(struct pci_dev *dev, 
  26.139 +                                       int where, u16 value)
  26.140 +{
  26.141 +    return pci_confx_write(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.142 +                           PCI_FUNC(dev->devfn), where, 2, value);
  26.143 +}
  26.144 +
  26.145 +static int pci_confx_write_config_dword(struct pci_dev *dev, 
  26.146 +                                        int where, u32 value)
  26.147 +{
  26.148 +    return pci_confx_write(0, dev->bus->number, PCI_SLOT(dev->devfn), 
  26.149 +                           PCI_FUNC(dev->devfn), where, 4, value);
  26.150 +}
  26.151 +
  26.152 +static struct pci_ops pci_conf_xen = {
  26.153 +    pci_confx_read_config_byte,
  26.154 +    pci_confx_read_config_word,
  26.155 +    pci_confx_read_config_dword,
  26.156 +    pci_confx_write_config_byte,
  26.157 +    pci_confx_write_config_word,
  26.158 +    pci_confx_write_config_dword
  26.159 +};
  26.160 +
  26.161 +void pcibios_penalize_isa_irq(int irq)
  26.162 +{ 
  26.163 +    /* nothing */
  26.164 +}
  26.165 +
  26.166 +void __devinit pcibios_fixup_bus(struct pci_bus *b)
  26.167 +{
  26.168 +    pci_read_bridge_bases(b);
  26.169 +}
  26.170 +
  26.171 +struct pci_bus * __devinit pcibios_scan_root(int busnum)
  26.172 +{
  26.173 +    struct list_head *list;
  26.174 +    struct pci_bus *bus;
  26.175 +
  26.176 +    list_for_each ( list, &pci_root_buses )
  26.177 +    {
  26.178 +        bus = pci_bus_b(list);
  26.179 +        if ( bus->number == busnum )
  26.180 +            return bus;
  26.181 +    }
  26.182 +
  26.183 +    printk("PCI: Probing PCI hardware (bus %02x)\n", busnum);
  26.184 +    return pci_scan_bus(busnum, pci_root_ops, NULL);
  26.185 +}
  26.186 +
  26.187 +void __init pcibios_init(void)
  26.188 +{
  26.189 +    int bus;
  26.190 +    physdev_op_t op;
  26.191 +
  26.192 +    if ( !pci_probe )
  26.193 +        return;
  26.194 +
  26.195 +    pci_root_ops     = &pci_conf_xen;
  26.196 +    pci_config_read  = pci_confx_read;
  26.197 +    pci_config_write = pci_confx_write;
  26.198 +
  26.199 +    pcibios_set_cacheline_size();
  26.200 +
  26.201 +    op.cmd = PHYSDEVOP_PCI_PROBE_ROOT_BUSES;
  26.202 +    if ( HYPERVISOR_physdev_op(&op) != 0 )
  26.203 +    {
  26.204 +        printk(KERN_WARNING "PCI: System does not support PCI\n");
  26.205 +        return;
  26.206 +    }
  26.207 +
  26.208 +    printk(KERN_INFO "PCI: Probing PCI hardware\n");
  26.209 +    for ( bus = 0; bus < 256; bus++ )
  26.210 +        if ( test_bit(bus, &op.u.pci_probe_root_buses.busmask[0]) )
  26.211 +            (void)pcibios_scan_root(bus);
  26.212 +
  26.213 +    pcibios_resource_survey();
  26.214 +}
  26.215 +
  26.216 +char * __devinit pcibios_setup(char *str)
  26.217 +{
  26.218 +    if ( !strcmp(str, "off") )
  26.219 +        pci_probe = 0;
  26.220 +    return NULL;
  26.221 +}
  26.222 +
  26.223 +unsigned int pcibios_assign_all_busses(void)
  26.224 +{
  26.225 +    return 0;
  26.226 +}
  26.227 +
  26.228 +int pcibios_enable_device(struct pci_dev *dev, int mask)
  26.229 +{
  26.230 +    int err;
  26.231 +    u8  pin;
  26.232 +    physdev_op_t op;
  26.233 +
  26.234 +    /* Inform Xen that we are going to use this device. */
  26.235 +    op.cmd = PHYSDEVOP_PCI_INITIALISE_DEVICE;
  26.236 +    op.u.pci_initialise_device.bus  = dev->bus->number;
  26.237 +    op.u.pci_initialise_device.dev  = PCI_SLOT(dev->devfn);
  26.238 +    op.u.pci_initialise_device.func = PCI_FUNC(dev->devfn);
  26.239 +    if ( (err = HYPERVISOR_physdev_op(&op)) != 0 )
  26.240 +        return err;
  26.241 +
  26.242 +    /* Now we can bind to the very final IRQ line. */
  26.243 +    pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &pin);
  26.244 +    dev->irq = pin;
  26.245 +
  26.246 +    /* Turn on device I/O and memory access as necessary. */
  26.247 +    if ( (err = pcibios_enable_resources(dev, mask)) < 0 )
  26.248 +        return err;
  26.249 +
  26.250 +    /* Sanity-check that an interrupt-producing device is routed to an IRQ. */
  26.251 +    pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
  26.252 +    if ( pin != 0 )
  26.253 +    {
  26.254 +        if ( dev->irq != 0 )
  26.255 +            printk(KERN_INFO "PCI: Obtained IRQ %d for device %s\n",
  26.256 +                   dev->irq, dev->slot_name);
  26.257 +        else
  26.258 +            printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of "
  26.259 +                   "device %s.\n", 'A' + pin - 1, dev->slot_name);
  26.260 +    }
  26.261 +
  26.262 +    return 0;
  26.263 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/process.c	Mon Jul 11 09:29:56 2005 -0500
    27.3 @@ -0,0 +1,448 @@
    27.4 +/*
    27.5 + *  linux/arch/i386/kernel/process.c
    27.6 + *
    27.7 + *  Copyright (C) 1995  Linus Torvalds
    27.8 + *
    27.9 + *  Pentium III FXSR, SSE support
   27.10 + *	Gareth Hughes <gareth@valinux.com>, May 2000
   27.11 + */
   27.12 +
   27.13 +/*
   27.14 + * This file handles the architecture-dependent parts of process handling..
   27.15 + */
   27.16 +
   27.17 +#define __KERNEL_SYSCALLS__
   27.18 +#include <stdarg.h>
   27.19 +
   27.20 +#include <linux/errno.h>
   27.21 +#include <linux/sched.h>
   27.22 +#include <linux/kernel.h>
   27.23 +#include <linux/mm.h>
   27.24 +#include <linux/smp.h>
   27.25 +#include <linux/smp_lock.h>
   27.26 +#include <linux/stddef.h>
   27.27 +#include <linux/unistd.h>
   27.28 +#include <linux/ptrace.h>
   27.29 +#include <linux/slab.h>
   27.30 +#include <linux/vmalloc.h>
   27.31 +#include <linux/user.h>
   27.32 +#include <linux/a.out.h>
   27.33 +#include <linux/interrupt.h>
   27.34 +#include <linux/config.h>
   27.35 +#include <linux/delay.h>
   27.36 +#include <linux/reboot.h>
   27.37 +#include <linux/init.h>
   27.38 +#include <linux/mc146818rtc.h>
   27.39 +
   27.40 +#include <asm/uaccess.h>
   27.41 +#include <asm/pgtable.h>
   27.42 +#include <asm/system.h>
   27.43 +#include <asm/io.h>
   27.44 +#include <asm/ldt.h>
   27.45 +#include <asm/processor.h>
   27.46 +#include <asm/i387.h>
   27.47 +#include <asm/desc.h>
   27.48 +#include <asm/mmu_context.h>
   27.49 +#include <asm-xen/xen-public/physdev.h>
   27.50 +
   27.51 +#include <linux/irq.h>
   27.52 +
   27.53 +asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
   27.54 +
   27.55 +int hlt_counter;
   27.56 +
   27.57 +/*
   27.58 + * Powermanagement idle function, if any..
   27.59 + */
   27.60 +void (*pm_idle)(void);
   27.61 +
   27.62 +/*
   27.63 + * Power off function, if any
   27.64 + */
   27.65 +void (*pm_power_off)(void);
   27.66 +
   27.67 +void disable_hlt(void)
   27.68 +{
   27.69 +    hlt_counter++;
   27.70 +}
   27.71 +
   27.72 +void enable_hlt(void)
   27.73 +{
   27.74 +    hlt_counter--;
   27.75 +}
   27.76 +
   27.77 +/*
   27.78 + * The idle thread. There's no useful work to be
   27.79 + * done, so just try to conserve power and have a
   27.80 + * low exit latency (ie sit in a loop waiting for
   27.81 + * somebody to say that they'd like to reschedule)
   27.82 + */
   27.83 +void cpu_idle (void)
   27.84 +{
   27.85 +    extern int set_timeout_timer(void);
   27.86 +
   27.87 +    /* Endless idle loop with no priority at all. */
   27.88 +    init_idle();
   27.89 +    current->nice = 20;
   27.90 +    current->counter = -100;
   27.91 +
   27.92 +    for ( ; ; )
   27.93 +    {
   27.94 +        while ( !current->need_resched )
   27.95 +        {
   27.96 +            __cli();
   27.97 +            if ( current->need_resched )
   27.98 +            {
   27.99 +                /* The race-free check for events failed. */
  27.100 +                __sti();
  27.101 +                break;
  27.102 +            }
  27.103 +            else if ( set_timeout_timer() == 0 )
  27.104 +            {
  27.105 +                /* NB. Blocking reenable events in a race-free manner. */
  27.106 +                HYPERVISOR_block();
  27.107 +            }
  27.108 +            else
  27.109 +            {
  27.110 +                /* No race here: yielding will get us the CPU again anyway. */
  27.111 +                __sti();
  27.112 +                HYPERVISOR_yield();
  27.113 +            }
  27.114 +        }
  27.115 +        schedule();
  27.116 +        check_pgt_cache();
  27.117 +    }
  27.118 +}
  27.119 +
  27.120 +extern void show_trace(unsigned long* esp);
  27.121 +
  27.122 +void show_regs(struct pt_regs * regs)
  27.123 +{
  27.124 +    printk("\n");
  27.125 +    printk("Pid: %d, comm: %20s\n", current->pid, current->comm);
  27.126 +    printk("EIP: %04x:[<%08lx>] CPU: %d",0xffff & regs->xcs,regs->eip, smp_processor_id());
  27.127 +    if (regs->xcs & 2)
  27.128 +        printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
  27.129 +    printk(" EFLAGS: %08lx    %s\n",regs->eflags, print_tainted());
  27.130 +    printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
  27.131 +           regs->eax,regs->ebx,regs->ecx,regs->edx);
  27.132 +    printk("ESI: %08lx EDI: %08lx EBP: %08lx",
  27.133 +           regs->esi, regs->edi, regs->ebp);
  27.134 +    printk(" DS: %04x ES: %04x\n",
  27.135 +           0xffff & regs->xds,0xffff & regs->xes);
  27.136 +
  27.137 +    show_trace(&regs->esp);
  27.138 +}
  27.139 +
  27.140 +
  27.141 +/*
  27.142 + * Create a kernel thread
  27.143 + */
  27.144 +int arch_kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
  27.145 +{
  27.146 +    long retval, d0;
  27.147 +
  27.148 +    __asm__ __volatile__(
  27.149 +        "movl %%esp,%%esi\n\t"
  27.150 +        "int $0x80\n\t"		/* Linux/i386 system call */
  27.151 +        "cmpl %%esp,%%esi\n\t"	/* child or parent? */
  27.152 +        "je 1f\n\t"		/* parent - jump */
  27.153 +        /* Load the argument into eax, and push it.  That way, it does
  27.154 +         * not matter whether the called function is compiled with
  27.155 +         * -mregparm or not.  */
  27.156 +        "movl %4,%%eax\n\t"
  27.157 +        "pushl %%eax\n\t"		
  27.158 +        "call *%5\n\t"		/* call fn */
  27.159 +        "movl %3,%0\n\t"	/* exit */
  27.160 +        "int $0x80\n"
  27.161 +        "1:\t"
  27.162 +        :"=&a" (retval), "=&S" (d0)
  27.163 +        :"0" (__NR_clone), "i" (__NR_exit),
  27.164 +        "r" (arg), "r" (fn),
  27.165 +        "b" (flags | CLONE_VM)
  27.166 +        : "memory");
  27.167 +
  27.168 +    return retval;
  27.169 +}
  27.170 +
  27.171 +/*
  27.172 + * Free current thread data structures etc..
  27.173 + */
  27.174 +void exit_thread(void)
  27.175 +{
  27.176 +    /* nothing to do ... */
  27.177 +}
  27.178 +
  27.179 +void flush_thread(void)
  27.180 +{
  27.181 +    struct task_struct *tsk = current;
  27.182 +
  27.183 +    memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8);
  27.184 +
  27.185 +    /*
  27.186 +     * Forget coprocessor state..
  27.187 +     */
  27.188 +    clear_fpu(tsk);
  27.189 +    tsk->used_math = 0;
  27.190 +}
  27.191 +
  27.192 +void release_thread(struct task_struct *dead_task)
  27.193 +{
  27.194 +    if (dead_task->mm) {
  27.195 +        // temporary debugging check
  27.196 +        if (dead_task->mm->context.size) {
  27.197 +            printk("WARNING: dead process %8s still has LDT? <%p/%08x>\n",
  27.198 +                   dead_task->comm, 
  27.199 +		   dead_task->mm->context.ldt,
  27.200 +		   dead_task->mm->context.size);
  27.201 +            BUG();
  27.202 +        }
  27.203 +    }
  27.204 +    //release_x86_irqs(dead_task);
  27.205 +}
  27.206 +
  27.207 +
  27.208 +/*
  27.209 + * Save a segment.
  27.210 + */
  27.211 +#define savesegment(seg,value) \
  27.212 +	asm volatile("movl %%" #seg ",%0":"=m" (*(int *)&(value)))
  27.213 +
  27.214 +int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
  27.215 +                unsigned long unused,
  27.216 +                struct task_struct * p, struct pt_regs * regs)
  27.217 +{
  27.218 +    struct pt_regs * childregs;
  27.219 +
  27.220 +    childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p)) - 1;
  27.221 +    struct_cpy(childregs, regs);
  27.222 +    childregs->eax = 0;
  27.223 +    childregs->esp = esp;
  27.224 +
  27.225 +    p->thread.esp = (unsigned long) childregs;
  27.226 +    p->thread.esp0 = (unsigned long) (childregs+1);
  27.227 +
  27.228 +    p->thread.eip = (unsigned long) ret_from_fork;
  27.229 +
  27.230 +    savesegment(fs,p->thread.fs);
  27.231 +    savesegment(gs,p->thread.gs);
  27.232 +
  27.233 +    unlazy_fpu(current);
  27.234 +    struct_cpy(&p->thread.i387, &current->thread.i387);
  27.235 +
  27.236 +    p->thread.io_pl = current->thread.io_pl;
  27.237 +
  27.238 +    return 0;
  27.239 +}
  27.240 +
  27.241 +/*
  27.242 + * fill in the user structure for a core dump..
  27.243 + */
  27.244 +void dump_thread(struct pt_regs * regs, struct user * dump)
  27.245 +{
  27.246 +    int i;
  27.247 +
  27.248 +/* changed the size calculations - should hopefully work better. lbt */
  27.249 +    dump->magic = CMAGIC;
  27.250 +    dump->start_code = 0;
  27.251 +    dump->start_stack = regs->esp & ~(PAGE_SIZE - 1);
  27.252 +    dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
  27.253 +    dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
  27.254 +    dump->u_dsize -= dump->u_tsize;
  27.255 +    dump->u_ssize = 0;
  27.256 +    for (i = 0; i < 8; i++)
  27.257 +        dump->u_debugreg[i] = current->thread.debugreg[i];  
  27.258 +
  27.259 +    if (dump->start_stack < TASK_SIZE)
  27.260 +        dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
  27.261 +
  27.262 +    dump->regs.ebx = regs->ebx;
  27.263 +    dump->regs.ecx = regs->ecx;
  27.264 +    dump->regs.edx = regs->edx;
  27.265 +    dump->regs.esi = regs->esi;
  27.266 +    dump->regs.edi = regs->edi;
  27.267 +    dump->regs.ebp = regs->ebp;
  27.268 +    dump->regs.eax = regs->eax;
  27.269 +    dump->regs.ds = regs->xds;
  27.270 +    dump->regs.es = regs->xes;
  27.271 +    savesegment(fs,dump->regs.fs);
  27.272 +    savesegment(gs,dump->regs.gs);
  27.273 +    dump->regs.orig_eax = regs->orig_eax;
  27.274 +    dump->regs.eip = regs->eip;
  27.275 +    dump->regs.cs = regs->xcs;
  27.276 +    dump->regs.eflags = regs->eflags;
  27.277 +    dump->regs.esp = regs->esp;
  27.278 +    dump->regs.ss = regs->xss;
  27.279 +
  27.280 +    dump->u_fpvalid = dump_fpu (regs, &dump->i387);
  27.281 +}
  27.282 +
  27.283 +/*
  27.284 + *	switch_to(x,yn) should switch tasks from x to y.
  27.285 + *
  27.286 + * We fsave/fwait so that an exception goes off at the right time
  27.287 + * (as a call from the fsave or fwait in effect) rather than to
  27.288 + * the wrong process. Lazy FP saving no longer makes any sense
  27.289 + * with modern CPU's, and this simplifies a lot of things (SMP
  27.290 + * and UP become the same).
  27.291 + *
  27.292 + * NOTE! We used to use the x86 hardware context switching. The
  27.293 + * reason for not using it any more becomes apparent when you
  27.294 + * try to recover gracefully from saved state that is no longer
  27.295 + * valid (stale segment register values in particular). With the
  27.296 + * hardware task-switch, there is no way to fix up bad state in
  27.297 + * a reasonable manner.
  27.298 + *
  27.299 + * The fact that Intel documents the hardware task-switching to
  27.300 + * be slow is a fairly red herring - this code is not noticeably
  27.301 + * faster. However, there _is_ some room for improvement here,
  27.302 + * so the performance issues may eventually be a valid point.
  27.303 + * More important, however, is the fact that this allows us much
  27.304 + * more flexibility.
  27.305 + */
  27.306 +void fastcall __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
  27.307 +{
  27.308 +    struct thread_struct *next = &next_p->thread;
  27.309 +    physdev_op_t op;
  27.310 +    multicall_entry_t _mcl[8], *mcl = _mcl;
  27.311 +
  27.312 +    /*
  27.313 +     * This is basically 'unlazy_fpu', except that we queue a multicall to 
  27.314 +     * indicate FPU task switch, rather than synchronously trapping to Xen.
  27.315 +     */
  27.316 +    if ( prev_p->flags & PF_USEDFPU )
  27.317 +    {
  27.318 +	if ( cpu_has_fxsr )
  27.319 +            asm volatile( "fxsave %0 ; fnclex"
  27.320 +                          : "=m" (prev_p->thread.i387.fxsave) );
  27.321 +	else
  27.322 +            asm volatile( "fnsave %0 ; fwait"
  27.323 +                          : "=m" (prev_p->thread.i387.fsave) );
  27.324 +	prev_p->flags &= ~PF_USEDFPU;
  27.325 +        mcl->op      = __HYPERVISOR_fpu_taskswitch;
  27.326 +        mcl->args[0] = 1;
  27.327 +        mcl++;
  27.328 +    }
  27.329 +
  27.330 +    mcl->op      = __HYPERVISOR_stack_switch;
  27.331 +    mcl->args[0] = __KERNEL_DS;
  27.332 +    mcl->args[1] = next->esp0;
  27.333 +    mcl++;
  27.334 +
  27.335 +    if ( prev_p->thread.io_pl != next->io_pl ) 
  27.336 +    {
  27.337 +        op.cmd             = PHYSDEVOP_SET_IOPL;
  27.338 +	op.u.set_iopl.iopl = next->io_pl;
  27.339 +        mcl->op      = __HYPERVISOR_physdev_op;
  27.340 +        mcl->args[0] = (unsigned long)&op;
  27.341 +        mcl++;
  27.342 +    }
  27.343 +
  27.344 +    (void)HYPERVISOR_multicall(_mcl, mcl - _mcl);
  27.345 +
  27.346 +    /*
  27.347 +     * Restore %fs and %gs.
  27.348 +     */
  27.349 +    loadsegment(fs, next->fs);
  27.350 +    loadsegment(gs, next->gs);
  27.351 +
  27.352 +    /*
  27.353 +     * Now maybe reload the debug registers
  27.354 +     */
  27.355 +    if ( next->debugreg[7] != 0 )
  27.356 +    {
  27.357 +        HYPERVISOR_set_debugreg(0, next->debugreg[0]);
  27.358 +        HYPERVISOR_set_debugreg(1, next->debugreg[1]);
  27.359 +        HYPERVISOR_set_debugreg(2, next->debugreg[2]);
  27.360 +        HYPERVISOR_set_debugreg(3, next->debugreg[3]);
  27.361 +        /* no 4 and 5 */
  27.362 +        HYPERVISOR_set_debugreg(6, next->debugreg[6]);
  27.363 +        HYPERVISOR_set_debugreg(7, next->debugreg[7]);
  27.364 +    }
  27.365 +}
  27.366 +
  27.367 +asmlinkage int sys_fork(struct pt_regs regs)
  27.368 +{
  27.369 +    return do_fork(SIGCHLD, regs.esp, &regs, 0);
  27.370 +}
  27.371 +
  27.372 +asmlinkage int sys_clone(struct pt_regs regs)
  27.373 +{
  27.374 +    unsigned long clone_flags;
  27.375 +    unsigned long newsp;
  27.376 +
  27.377 +    clone_flags = regs.ebx;
  27.378 +    newsp = regs.ecx;
  27.379 +    if (!newsp)
  27.380 +        newsp = regs.esp;
  27.381 +    return do_fork(clone_flags, newsp, &regs, 0);
  27.382 +}
  27.383 +
  27.384 +/*
  27.385 + * This is trivial, and on the face of it looks like it
  27.386 + * could equally well be done in user mode.
  27.387 + *
  27.388 + * Not so, for quite unobvious reasons - register pressure.
  27.389 + * In user mode vfork() cannot have a stack frame, and if
  27.390 + * done by calling the "clone()" system call directly, you
  27.391 + * do not have enough call-clobbered registers to hold all
  27.392 + * the information you need.
  27.393 + */
  27.394 +asmlinkage int sys_vfork(struct pt_regs regs)
  27.395 +{
  27.396 +    return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs.esp, &regs, 0);
  27.397 +}
  27.398 +
  27.399 +/*
  27.400 + * sys_execve() executes a new program.
  27.401 + */
  27.402 +asmlinkage int sys_execve(struct pt_regs regs)
  27.403 +{
  27.404 +    int error;
  27.405 +    char * filename;
  27.406 +
  27.407 +    filename = getname((char *) regs.ebx);
  27.408 +    error = PTR_ERR(filename);
  27.409 +    if (IS_ERR(filename))
  27.410 +        goto out;
  27.411 +    error = do_execve(filename, (char **) regs.ecx, (char **) regs.edx, &regs);
  27.412 +    if (error == 0)
  27.413 +        current->ptrace &= ~PT_DTRACE;
  27.414 +    putname(filename);
  27.415 + out:
  27.416 +    return error;
  27.417 +}
  27.418 +
  27.419 +/*
  27.420 + * These bracket the sleeping functions..
  27.421 + */
  27.422 +extern void scheduling_functions_start_here(void);
  27.423 +extern void scheduling_functions_end_here(void);
  27.424 +#define first_sched	((unsigned long) scheduling_functions_start_here)
  27.425 +#define last_sched	((unsigned long) scheduling_functions_end_here)
  27.426 +
  27.427 +unsigned long get_wchan(struct task_struct *p)
  27.428 +{
  27.429 +    unsigned long ebp, esp, eip;
  27.430 +    unsigned long stack_page;
  27.431 +    int count = 0;
  27.432 +    if (!p || p == current || p->state == TASK_RUNNING)
  27.433 +        return 0;
  27.434 +    stack_page = (unsigned long)p;
  27.435 +    esp = p->thread.esp;
  27.436 +    if (!stack_page || esp < stack_page || esp > 8188+stack_page)
  27.437 +        return 0;
  27.438 +    /* include/asm-i386/system.h:switch_to() pushes ebp last. */
  27.439 +    ebp = *(unsigned long *) esp;
  27.440 +    do {
  27.441 +        if (ebp < stack_page || ebp > 8184+stack_page)
  27.442 +            return 0;
  27.443 +        eip = *(unsigned long *) (ebp+4);
  27.444 +        if (eip < first_sched || eip >= last_sched)
  27.445 +            return eip;
  27.446 +        ebp = *(unsigned long *) ebp;
  27.447 +    } while (count++ < 16);
  27.448 +    return 0;
  27.449 +}
  27.450 +#undef last_sched
  27.451 +#undef first_sched
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/setup.c	Mon Jul 11 09:29:56 2005 -0500
    28.3 @@ -0,0 +1,1213 @@
    28.4 +/*
    28.5 + *  linux/arch/i386/kernel/setup.c
    28.6 + *
    28.7 + *  Copyright (C) 1995  Linus Torvalds
    28.8 + */
    28.9 +
   28.10 +/*
   28.11 + * This file handles the architecture-dependent parts of initialization
   28.12 + */
   28.13 +
   28.14 +#define __KERNEL_SYSCALLS__
   28.15 +static int errno;
   28.16 +#include <linux/errno.h>
   28.17 +#include <linux/sched.h>
   28.18 +#include <linux/kernel.h>
   28.19 +#include <linux/mm.h>
   28.20 +#include <linux/stddef.h>
   28.21 +#include <linux/unistd.h>
   28.22 +#include <linux/ptrace.h>
   28.23 +#include <linux/slab.h>
   28.24 +#include <linux/user.h>
   28.25 +#include <linux/a.out.h>
   28.26 +#include <linux/tty.h>
   28.27 +#include <linux/ioport.h>
   28.28 +#include <linux/delay.h>
   28.29 +#include <linux/config.h>
   28.30 +#include <linux/init.h>
   28.31 +#include <linux/apm_bios.h>
   28.32 +#ifdef CONFIG_BLK_DEV_RAM
   28.33 +#include <linux/blk.h>
   28.34 +#endif
   28.35 +#include <linux/highmem.h>
   28.36 +#include <linux/bootmem.h>
   28.37 +#include <linux/seq_file.h>
   28.38 +#include <linux/reboot.h>
   28.39 +#include <asm/processor.h>
   28.40 +#include <linux/console.h>
   28.41 +#include <linux/module.h>
   28.42 +#include <asm/mtrr.h>
   28.43 +#include <asm/uaccess.h>
   28.44 +#include <asm/system.h>
   28.45 +#include <asm/io.h>
   28.46 +#include <asm/smp.h>
   28.47 +#include <asm/msr.h>
   28.48 +#include <asm/desc.h>
   28.49 +#include <asm/dma.h>
   28.50 +#include <asm/mpspec.h>
   28.51 +#include <asm/mmu_context.h>
   28.52 +#include <asm/ctrl_if.h>
   28.53 +#include <asm/hypervisor.h>
   28.54 +#include <asm-xen/xen-public/physdev.h>
   28.55 +#include <linux/netdevice.h>
   28.56 +#include <linux/rtnetlink.h>
   28.57 +#include <linux/tqueue.h>
   28.58 +#include <net/pkt_sched.h> /* dev_(de)activate */
   28.59 +
   28.60 +/*
   28.61 + * Point at the empty zero page to start with. We map the real shared_info
   28.62 + * page as soon as fixmap is up and running.
   28.63 + */
   28.64 +shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
   28.65 +
   28.66 +unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list;
   28.67 +
   28.68 +/*
   28.69 + * Machine setup..
   28.70 + */
   28.71 +
   28.72 +char ignore_irq13;		/* set if exception 16 works */
   28.73 +struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
   28.74 +
   28.75 +unsigned long mmu_cr4_features;
   28.76 +
   28.77 +unsigned char * vgacon_mmap;
   28.78 +
   28.79 +/*
   28.80 + * Bus types ..
   28.81 + */
   28.82 +#ifdef CONFIG_EISA
   28.83 +int EISA_bus;
   28.84 +#endif
   28.85 +int MCA_bus;
   28.86 +
   28.87 +/* for MCA, but anyone else can use it if they want */
   28.88 +unsigned int machine_id;
   28.89 +unsigned int machine_submodel_id;
   28.90 +unsigned int BIOS_revision;
   28.91 +unsigned int mca_pentium_flag;
   28.92 +
   28.93 +/* For PCI or other memory-mapped resources */
   28.94 +unsigned long pci_mem_start = 0x10000000;
   28.95 +
   28.96 +/*
   28.97 + * Setup options
   28.98 + */
   28.99 +struct drive_info_struct { char dummy[32]; } drive_info;
  28.100 +struct screen_info screen_info;
  28.101 +struct apm_info apm_info;
  28.102 +struct sys_desc_table_struct {
  28.103 +    unsigned short length;
  28.104 +    unsigned char table[0];
  28.105 +};
  28.106 +
  28.107 +unsigned char aux_device_present;
  28.108 +
  28.109 +extern int root_mountflags;
  28.110 +extern char _text, _etext, _edata, _end;
  28.111 +
  28.112 +extern int blk_nohighio;
  28.113 +
  28.114 +int enable_acpi_smp_table;
  28.115 +
  28.116 +/* Raw start-of-day parameters from the hypervisor. */
  28.117 +union xen_start_info_union xen_start_info_union;
  28.118 +
  28.119 +#define COMMAND_LINE_SIZE MAX_GUEST_CMDLINE
  28.120 +static char command_line[COMMAND_LINE_SIZE];
  28.121 +char saved_command_line[COMMAND_LINE_SIZE];
  28.122 +
  28.123 +/* parse_mem_cmdline()
  28.124 + * returns the value of the mem= boot param converted to pages or 0
  28.125 + */ 
  28.126 +static int __init parse_mem_cmdline (char ** cmdline_p)
  28.127 +{
  28.128 +    char c = ' ', *to = command_line, *from = saved_command_line;
  28.129 +    int len = 0;
  28.130 +    unsigned long long bytes;
  28.131 +    int mem_param = 0;
  28.132 +
  28.133 +    /* Save unparsed command line copy for /proc/cmdline */
  28.134 +    memcpy(saved_command_line, xen_start_info.cmd_line, COMMAND_LINE_SIZE);
  28.135 +    saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
  28.136 +
  28.137 +    for (;;) {
  28.138 +        /*
  28.139 +         * "mem=nopentium" disables the 4MB page tables.
  28.140 +         * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
  28.141 +         * to <mem>, overriding the bios size.
  28.142 +         * "mem=XXX[KkmM]@XXX[KkmM]" defines a memory region from
  28.143 +         * <start> to <start>+<mem>, overriding the bios size.
  28.144 +         */
  28.145 +        if (c == ' ' && !memcmp(from, "mem=", 4)) {
  28.146 +            if (to != command_line)
  28.147 +                to--;
  28.148 +            if (!memcmp(from+4, "nopentium", 9)) {
  28.149 +                from += 9+4;
  28.150 +            } else if (!memcmp(from+4, "exactmap", 8)) {
  28.151 +                from += 8+4;
  28.152 +            } else {
  28.153 +                bytes = memparse(from+4, &from);
  28.154 +                mem_param = bytes>>PAGE_SHIFT;
  28.155 +		if (*from == '@')
  28.156 +                    (void)memparse(from+1, &from);
  28.157 +            }
  28.158 +        }
  28.159 +
  28.160 +        c = *(from++);
  28.161 +        if (!c)
  28.162 +            break;
  28.163 +        if (COMMAND_LINE_SIZE <= ++len)
  28.164 +            break;
  28.165 +        *(to++) = c;
  28.166 +    }
  28.167 +    *to = '\0';
  28.168 +    *cmdline_p = command_line;
  28.169 +
  28.170 +    return mem_param;
  28.171 +}
  28.172 +
  28.173 +/*
  28.174 + * Every exception-fixup table is sorted (i.e., kernel main table, and every
  28.175 + * module table. Some elements may be out of order if they reference text.init,
  28.176 + * for example. 
  28.177 + */
  28.178 +static void sort_exception_table(struct exception_table_entry *start,
  28.179 +                                 struct exception_table_entry *end)
  28.180 +{
  28.181 +    struct exception_table_entry *p, *q, tmp;
  28.182 +
  28.183 +    for ( p = start; p < end; p++ )
  28.184 +    {
  28.185 +        for ( q = p-1; q > start; q-- )
  28.186 +            if ( p->insn > q->insn )
  28.187 +                break;
  28.188 +        if ( ++q != p )
  28.189 +        {
  28.190 +            tmp = *p;
  28.191 +            memmove(q+1, q, (p-q)*sizeof(*p));
  28.192 +            *q = tmp;
  28.193 +        }
  28.194 +    }
  28.195 +}
  28.196 +
  28.197 +int xen_module_init(struct module *mod)
  28.198 +{
  28.199 +    sort_exception_table(mod->ex_table_start, mod->ex_table_end);
  28.200 +    return 0;
  28.201 +}
  28.202 +
  28.203 +void __init setup_arch(char **cmdline_p)
  28.204 +{
  28.205 +    int i,j;
  28.206 +    unsigned long bootmap_size, start_pfn, lmax_low_pfn;
  28.207 +    int mem_param;  /* user specified memory size in pages */
  28.208 +    int boot_pfn;   /* low pages available for bootmem */
  28.209 +    physdev_op_t op;
  28.210 +
  28.211 +    extern void hypervisor_callback(void);
  28.212 +    extern void failsafe_callback(void);
  28.213 +
  28.214 +    extern unsigned long cpu0_pte_quicklist[];
  28.215 +    extern unsigned long cpu0_pgd_quicklist[];
  28.216 +
  28.217 +    extern const struct exception_table_entry __start___ex_table[];
  28.218 +    extern const struct exception_table_entry __stop___ex_table[];
  28.219 +
  28.220 +    extern char _stext;
  28.221 +
  28.222 +    /* Force a quick death if the kernel panics. */
  28.223 +    extern int panic_timeout;
  28.224 +    if ( panic_timeout == 0 )
  28.225 +        panic_timeout = 1;
  28.226 +
  28.227 +    /* Ensure that the kernel exception-fixup table is sorted. */
  28.228 +    sort_exception_table(__start___ex_table, __stop___ex_table);
  28.229 +
  28.230 +#ifndef CONFIG_HIGHIO
  28.231 +    blk_nohighio = 1;
  28.232 +#endif
  28.233 +
  28.234 +    HYPERVISOR_vm_assist(
  28.235 +        VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
  28.236 +    HYPERVISOR_vm_assist(
  28.237 +        VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
  28.238 +        
  28.239 +    HYPERVISOR_set_callbacks(
  28.240 +        __KERNEL_CS, (unsigned long)hypervisor_callback,
  28.241 +        __KERNEL_CS, (unsigned long)failsafe_callback);
  28.242 +
  28.243 +    boot_cpu_data.pgd_quick = cpu0_pgd_quicklist;
  28.244 +    boot_cpu_data.pte_quick = cpu0_pte_quicklist;
  28.245 +
  28.246 +    /* This must be initialized to UNNAMED_MAJOR for ipconfig to work
  28.247 +       properly.  Setting ROOT_DEV to default to /dev/ram0 breaks initrd. */
  28.248 +    ROOT_DEV = MKDEV(UNNAMED_MAJOR,0);
  28.249 +    memset(&drive_info, 0, sizeof(drive_info));
  28.250 +    memset(&screen_info, 0, sizeof(screen_info));
  28.251 +    
  28.252 +    /* This is drawn from a dump from vgacon:startup in standard Linux. */
  28.253 +    screen_info.orig_video_mode = 3; 
  28.254 +    screen_info.orig_video_isVGA = 1;
  28.255 +    screen_info.orig_video_lines = 25;
  28.256 +    screen_info.orig_video_cols = 80;
  28.257 +    screen_info.orig_video_ega_bx = 3;
  28.258 +    screen_info.orig_video_points = 16;
  28.259 +
  28.260 +    memset(&apm_info.bios, 0, sizeof(apm_info.bios));
  28.261 +    aux_device_present = 0; 
  28.262 +#ifdef CONFIG_BLK_DEV_RAM
  28.263 +    rd_image_start = 0;
  28.264 +    rd_prompt = 0;
  28.265 +    rd_doload = 0;
  28.266 +#endif
  28.267 +
  28.268 +    root_mountflags &= ~MS_RDONLY;
  28.269 +    init_mm.start_code = (unsigned long) &_text;
  28.270 +    init_mm.end_code = (unsigned long) &_etext;
  28.271 +    init_mm.end_data = (unsigned long) &_edata;
  28.272 +    init_mm.brk = (unsigned long) &_end;
  28.273 +
  28.274 +    /* The mem= kernel command line param overrides the detected amount
  28.275 +     * of memory.   For xenolinux, if this override is larger than detected
  28.276 +     * memory, then boot using only detected memory and make provisions to
  28.277 +     * use all of the override value.   The hypervisor can give this
  28.278 +     * domain more memory later on and it will be added to the free
  28.279 +     * lists at that time.   See claim_new_pages() in
  28.280 +     * arch/xen/drivers/balloon/balloon.c
  28.281 +     */
  28.282 +    mem_param = parse_mem_cmdline(cmdline_p);
  28.283 +    if (mem_param < xen_start_info.nr_pages)
  28.284 +        mem_param = xen_start_info.nr_pages;
  28.285 +
  28.286 +#define PFN_UP(x)	(((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
  28.287 +#define PFN_DOWN(x)	((x) >> PAGE_SHIFT)
  28.288 +#define PFN_PHYS(x)	((x) << PAGE_SHIFT)
  28.289 +
  28.290 +/*
  28.291 + * 128MB for vmalloc(), iomap(), kmap(), and fixaddr mappings.
  28.292 + */
  28.293 +#define VMALLOC_RESERVE	(unsigned long)(128 << 20)
  28.294 +#define MAXMEM		(unsigned long)(HYPERVISOR_VIRT_START-PAGE_OFFSET-VMALLOC_RESERVE)
  28.295 +#define MAXMEM_PFN	PFN_DOWN(MAXMEM)
  28.296 +#define MAX_NONPAE_PFN	(1 << 20)
  28.297 +
  28.298 +    /*
  28.299 +     * Determine low and high memory ranges:
  28.300 +     */
  28.301 +    lmax_low_pfn = max_pfn = mem_param;
  28.302 +    if (lmax_low_pfn > MAXMEM_PFN) {
  28.303 +        lmax_low_pfn = MAXMEM_PFN;
  28.304 +#ifndef CONFIG_HIGHMEM
  28.305 +        /* Maximum memory usable is what is directly addressable */
  28.306 +        printk(KERN_WARNING "Warning only %ldMB will be used.\n",
  28.307 +               MAXMEM>>20);
  28.308 +        if (max_pfn > MAX_NONPAE_PFN)
  28.309 +            printk(KERN_WARNING "Use a PAE enabled kernel.\n");
  28.310 +        else
  28.311 +            printk(KERN_WARNING "Use a HIGHMEM enabled kernel.\n");
  28.312 +        max_pfn = lmax_low_pfn;
  28.313 +#else /* !CONFIG_HIGHMEM */
  28.314 +#ifndef CONFIG_X86_PAE
  28.315 +        if (max_pfn > MAX_NONPAE_PFN) {
  28.316 +            max_pfn = MAX_NONPAE_PFN;
  28.317 +            printk(KERN_WARNING "Warning only 4GB will be used.\n");
  28.318 +            printk(KERN_WARNING "Use a PAE enabled kernel.\n");
  28.319 +        }
  28.320 +#endif /* !CONFIG_X86_PAE */
  28.321 +#endif /* !CONFIG_HIGHMEM */
  28.322 +    }
  28.323 +
  28.324 +#ifdef CONFIG_HIGHMEM
  28.325 +    highstart_pfn = highend_pfn = max_pfn;
  28.326 +    if (max_pfn > MAXMEM_PFN) {
  28.327 +        highstart_pfn = MAXMEM_PFN;
  28.328 +        printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
  28.329 +               pages_to_mb(highend_pfn - highstart_pfn));
  28.330 +    }
  28.331 +#endif
  28.332 +
  28.333 +    phys_to_machine_mapping = (unsigned int *)xen_start_info.mfn_list;
  28.334 +    cur_pgd = init_mm.pgd = (pgd_t *)xen_start_info.pt_base;
  28.335 +
  28.336 +    start_pfn = (__pa(xen_start_info.pt_base) >> PAGE_SHIFT) + 
  28.337 +        xen_start_info.nr_pt_frames;
  28.338 +
  28.339 +    /*
  28.340 +     * Initialize the boot-time allocator, and free up all RAM. Then reserve 
  28.341 +     * space for OS image, initrd, phys->machine table, bootstrap page table,
  28.342 +     * and the bootmem bitmap. 
  28.343 +     * NB. There is definitely enough room for the bootmem bitmap in the
  28.344 +     * bootstrap page table. We are guaranteed to get >=512kB unused 'padding'
  28.345 +     * for our own use after all bootstrap elements 
  28.346 +     * (see asm-xen/xen-public/xen.h).
  28.347 +     */
  28.348 +    boot_pfn = min((int)xen_start_info.nr_pages,lmax_low_pfn);
  28.349 +    bootmap_size = init_bootmem(start_pfn,boot_pfn);
  28.350 +    free_bootmem(0, PFN_PHYS(boot_pfn));
  28.351 +    reserve_bootmem(__pa(&_stext), 
  28.352 +                    PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE-1 - 
  28.353 +                    __pa(&_stext));
  28.354 +
  28.355 +    /* init_bootmem() set the global max_low_pfn to boot_pfn.  Now max_low_pfn 
  28.356 +     * can be set to the override value.
  28.357 +     */
  28.358 +    max_low_pfn = lmax_low_pfn;
  28.359 +
  28.360 +#ifdef CONFIG_BLK_DEV_INITRD
  28.361 +    if ( xen_start_info.mod_start != 0 )
  28.362 +    {
  28.363 +        if ( (__pa(xen_start_info.mod_start) + xen_start_info.mod_len) <= 
  28.364 +             (max_low_pfn << PAGE_SHIFT) )
  28.365 +        {
  28.366 +            initrd_start = xen_start_info.mod_start;
  28.367 +            initrd_end   = initrd_start + xen_start_info.mod_len;
  28.368 +            initrd_below_start_ok = 1;
  28.369 +        }
  28.370 +        else
  28.371 +        {
  28.372 +            printk(KERN_ERR "initrd extends beyond end of memory "
  28.373 +                   "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
  28.374 +                   __pa(xen_start_info.mod_start) + xen_start_info.mod_len,
  28.375 +                   max_low_pfn << PAGE_SHIFT);
  28.376 +            initrd_start = 0;
  28.377 +        }
  28.378 +    }
  28.379 +#endif
  28.380 +
  28.381 +    paging_init();
  28.382 +
  28.383 +    /* Make sure we have a correctly sized P->M table. */
  28.384 +    if ( max_pfn != xen_start_info.nr_pages )
  28.385 +    {
  28.386 +        phys_to_machine_mapping = alloc_bootmem_low_pages(
  28.387 +            max_pfn * sizeof(unsigned long));
  28.388 +        if ( max_pfn > xen_start_info.nr_pages )
  28.389 +        {
  28.390 +            memset(phys_to_machine_mapping, ~0,
  28.391 +                   max_pfn * sizeof(unsigned long));
  28.392 +            memcpy(phys_to_machine_mapping,
  28.393 +                   (unsigned long *)xen_start_info.mfn_list,
  28.394 +                   xen_start_info.nr_pages * sizeof(unsigned long));
  28.395 +        }
  28.396 +        else
  28.397 +        {
  28.398 +            memcpy(phys_to_machine_mapping,
  28.399 +                   (unsigned long *)xen_start_info.mfn_list,
  28.400 +                   max_pfn * sizeof(unsigned long));
  28.401 +            if (HYPERVISOR_dom_mem_op(
  28.402 +                MEMOP_decrease_reservation,
  28.403 +                (unsigned long *)xen_start_info.mfn_list + max_pfn,
  28.404 +                xen_start_info.nr_pages - max_pfn, 0) !=
  28.405 +                (xen_start_info.nr_pages - max_pfn))
  28.406 +                BUG();
  28.407 +        }
  28.408 +        free_bootmem(__pa(xen_start_info.mfn_list), 
  28.409 +                     PFN_PHYS(PFN_UP(xen_start_info.nr_pages *
  28.410 +                                     sizeof(unsigned long))));
  28.411 +    }
  28.412 +
  28.413 +    pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE);
  28.414 +    for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ )
  28.415 +    {	
  28.416 +        pfn_to_mfn_frame_list[j] = 
  28.417 +            virt_to_machine(&phys_to_machine_mapping[i]) >> PAGE_SHIFT;
  28.418 +    }
  28.419 +    HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list =
  28.420 +	virt_to_machine(pfn_to_mfn_frame_list) >> PAGE_SHIFT;
  28.421 +
  28.422 +    op.cmd             = PHYSDEVOP_SET_IOPL;
  28.423 +    op.u.set_iopl.iopl = current->thread.io_pl = 1;
  28.424 +    HYPERVISOR_physdev_op(&op);
  28.425 +
  28.426 +    if (xen_start_info.flags & SIF_INITDOMAIN )
  28.427 +    {
  28.428 +        if( !(xen_start_info.flags & SIF_PRIVILEGED) )
  28.429 +            panic("Xen granted us console access but not privileged status");
  28.430 +
  28.431 +#if defined(CONFIG_VT)
  28.432 +#if defined(CONFIG_VGA_CONSOLE)
  28.433 +        conswitchp = &vga_con;
  28.434 +#elif defined(CONFIG_DUMMY_CONSOLE)
  28.435 +        conswitchp = &dummy_con;
  28.436 +#endif
  28.437 +#endif
  28.438 +    }
  28.439 +}
  28.440 +
  28.441 +static int cachesize_override __initdata = -1;
  28.442 +static int __init cachesize_setup(char *str)
  28.443 +{
  28.444 +    get_option (&str, &cachesize_override);
  28.445 +    return 1;
  28.446 +}
  28.447 +__setup("cachesize=", cachesize_setup);
  28.448 +
  28.449 +static int __init highio_setup(char *str)
  28.450 +{
  28.451 +    printk("i386: disabling HIGHMEM block I/O\n");
  28.452 +    blk_nohighio = 1;
  28.453 +    return 1;
  28.454 +}
  28.455 +__setup("nohighio", highio_setup);
  28.456 +
  28.457 +static int __init get_model_name(struct cpuinfo_x86 *c)
  28.458 +{
  28.459 +    unsigned int *v;
  28.460 +    char *p, *q;
  28.461 +
  28.462 +    if (cpuid_eax(0x80000000) < 0x80000004)
  28.463 +        return 0;
  28.464 +
  28.465 +    v = (unsigned int *) c->x86_model_id;
  28.466 +    cpuid(0x80000002, &v[0], &v[1], &v[2], &v[3]);
  28.467 +    cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]);
  28.468 +    cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]);
  28.469 +    c->x86_model_id[48] = 0;
  28.470 +
  28.471 +    /* Intel chips right-justify this string for some dumb reason;
  28.472 +       undo that brain damage */
  28.473 +    p = q = &c->x86_model_id[0];
  28.474 +    while ( *p == ' ' )
  28.475 +        p++;
  28.476 +    if ( p != q ) {
  28.477 +        while ( *p )
  28.478 +            *q++ = *p++;
  28.479 +        while ( q <= &c->x86_model_id[48] )
  28.480 +            *q++ = '\0';	/* Zero-pad the rest */
  28.481 +    }
  28.482 +
  28.483 +    return 1;
  28.484 +}
  28.485 +
  28.486 +
  28.487 +static void __init display_cacheinfo(struct cpuinfo_x86 *c)
  28.488 +{
  28.489 +    unsigned int n, dummy, ecx, edx, l2size;
  28.490 +
  28.491 +    n = cpuid_eax(0x80000000);
  28.492 +
  28.493 +    if (n >= 0x80000005) {
  28.494 +        cpuid(0x80000005, &dummy, &dummy, &ecx, &edx);
  28.495 +        printk(KERN_INFO "CPU: L1 I Cache: %dK (%d bytes/line), D cache %dK (%d bytes/line)\n",
  28.496 +               edx>>24, edx&0xFF, ecx>>24, ecx&0xFF);
  28.497 +        c->x86_cache_size=(ecx>>24)+(edx>>24);	
  28.498 +    }
  28.499 +
  28.500 +    if (n < 0x80000006)	/* Some chips just has a large L1. */
  28.501 +        return;
  28.502 +
  28.503 +    ecx = cpuid_ecx(0x80000006);
  28.504 +    l2size = ecx >> 16;
  28.505 +
  28.506 +    /* AMD errata T13 (order #21922) */
  28.507 +    if ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 6)) {
  28.508 +        if (c->x86_model == 3 && c->x86_mask == 0)	/* Duron Rev A0 */
  28.509 +            l2size = 64;
  28.510 +        if (c->x86_model == 4 &&
  28.511 +            (c->x86_mask==0 || c->x86_mask==1))	/* Tbird rev A1/A2 */
  28.512 +            l2size = 256;
  28.513 +    }
  28.514 +
  28.515 +    /* Intel PIII Tualatin. This comes in two flavours.
  28.516 +     * One has 256kb of cache, the other 512. We have no way
  28.517 +     * to determine which, so we use a boottime override
  28.518 +     * for the 512kb model, and assume 256 otherwise.
  28.519 +     */
  28.520 +    if ((c->x86_vendor == X86_VENDOR_INTEL) && (c->x86 == 6) &&
  28.521 +        (c->x86_model == 11) && (l2size == 0))
  28.522 +        l2size = 256;
  28.523 +
  28.524 +    if (c->x86_vendor == X86_VENDOR_CENTAUR) {
  28.525 +	/* VIA C3 CPUs (670-68F) need further shifting. */
  28.526 +	if ((c->x86 == 6) &&
  28.527 +	    ((c->x86_model == 7) || (c->x86_model == 8))) {
  28.528 +		l2size >>= 8;
  28.529 +	}
  28.530 +
  28.531 +	/* VIA also screwed up Nehemiah stepping 1, and made
  28.532 +	   it return '65KB' instead of '64KB'
  28.533 +	   - Note, it seems this may only be in engineering samples. */
  28.534 +	if ((c->x86==6) && (c->x86_model==9) &&
  28.535 +	    (c->x86_mask==1) && (l2size==65))
  28.536 +		l2size -= 1;
  28.537 +    }
  28.538 +
  28.539 +    /* Allow user to override all this if necessary. */
  28.540 +    if (cachesize_override != -1)
  28.541 +        l2size = cachesize_override;
  28.542 +
  28.543 +    if ( l2size == 0 )
  28.544 +        return;		/* Again, no L2 cache is possible */
  28.545 +
  28.546 +    c->x86_cache_size = l2size;
  28.547 +
  28.548 +    printk(KERN_INFO "CPU: L2 Cache: %dK (%d bytes/line)\n",
  28.549 +           l2size, ecx & 0xFF);
  28.550 +}
  28.551 +
  28.552 +static void __init init_c3(struct cpuinfo_x86 *c)
  28.553 +{
  28.554 +    /* Test for Centaur Extended Feature Flags presence */
  28.555 +    if (cpuid_eax(0xC0000000) >= 0xC0000001) {
  28.556 +        /* store Centaur Extended Feature Flags as
  28.557 +         * word 5 of the CPU capability bit array
  28.558 +         */
  28.559 +        c->x86_capability[5] = cpuid_edx(0xC0000001);
  28.560 +    }
  28.561 +   
  28.562 +    switch (c->x86_model) {
  28.563 +    case 9:	/* Nehemiah */
  28.564 +    default:
  28.565 +        get_model_name(c);
  28.566 +        display_cacheinfo(c);
  28.567 +        break;
  28.568 +    }
  28.569 +}
  28.570 +
  28.571 +static void __init init_centaur(struct cpuinfo_x86 *c)
  28.572 +{
  28.573 +    /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
  28.574 +       3DNow is IDd by bit 31 in extended CPUID (1*3231) anyway */
  28.575 +    clear_bit(0*32+31, &c->x86_capability);
  28.576 +  
  28.577 +    switch (c->x86) {
  28.578 +    case 6:
  28.579 +        init_c3(c);
  28.580 +        break;
  28.581 +    default:
  28.582 +        panic("Unsupported Centaur CPU (%i)\n", c->x86);
  28.583 +    }
  28.584 +}
  28.585 +
  28.586 +static int __init init_amd(struct cpuinfo_x86 *c)
  28.587 +{
  28.588 +    int r;
  28.589 +
  28.590 +    /* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
  28.591 +       3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
  28.592 +    clear_bit(0*32+31, &c->x86_capability);
  28.593 +	
  28.594 +    r = get_model_name(c);
  28.595 +
  28.596 +    switch(c->x86)
  28.597 +    {
  28.598 +    case 5: /* We don't like AMD K6 */
  28.599 +        panic("Unsupported AMD processor\n");
  28.600 +    case 6:	/* An Athlon/Duron. We can trust the BIOS probably */
  28.601 +        break;
  28.602 +    }
  28.603 +
  28.604 +    display_cacheinfo(c);
  28.605 +    return r;
  28.606 +}
  28.607 +
  28.608 +
  28.609 +static void __init init_intel(struct cpuinfo_x86 *c)
  28.610 +{
  28.611 +    char *p = NULL;
  28.612 +    unsigned int l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
  28.613 +
  28.614 +    if (c->cpuid_level > 1) {
  28.615 +        /* supports eax=2  call */
  28.616 +        int i, j, n;
  28.617 +        int regs[4];
  28.618 +        unsigned char *dp = (unsigned char *)regs;
  28.619 +
  28.620 +        /* Number of times to iterate */
  28.621 +        n = cpuid_eax(2) & 0xFF;
  28.622 +
  28.623 +        for ( i = 0 ; i < n ; i++ ) {
  28.624 +            cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
  28.625 +			
  28.626 +            /* If bit 31 is set, this is an unknown format */
  28.627 +            for ( j = 0 ; j < 3 ; j++ ) {
  28.628 +                if ( regs[j] < 0 ) regs[j] = 0;
  28.629 +            }
  28.630 +
  28.631 +            /* Byte 0 is level count, not a descriptor */
  28.632 +            for ( j = 1 ; j < 16 ; j++ ) {
  28.633 +                unsigned char des = dp[j];
  28.634 +                unsigned char dl, dh;
  28.635 +                unsigned int cs;
  28.636 +
  28.637 +                dh = des >> 4;
  28.638 +                dl = des & 0x0F;
  28.639 +
  28.640 +				/* Black magic... */
  28.641 +
  28.642 +                switch ( dh )
  28.643 +                {
  28.644 +                case 0:
  28.645 +                    switch ( dl ) {
  28.646 +                    case 6:
  28.647 +                        /* L1 I cache */
  28.648 +                        l1i += 8;
  28.649 +                        break;
  28.650 +                    case 8:
  28.651 +                        /* L1 I cache */
  28.652 +                        l1i += 16;
  28.653 +                        break;
  28.654 +                    case 10:
  28.655 +                        /* L1 D cache */
  28.656 +                        l1d += 8;
  28.657 +                        break;
  28.658 +                    case 12:
  28.659 +                        /* L1 D cache */
  28.660 +                        l1d += 16;
  28.661 +                        break;
  28.662 +                    default:;
  28.663 +                        /* TLB, or unknown */
  28.664 +                    }
  28.665 +                    break;
  28.666 +                case 2:
  28.667 +                    if ( dl ) {
  28.668 +                        /* L3 cache */
  28.669 +                        cs = (dl-1) << 9;
  28.670 +                        l3 += cs;
  28.671 +                    }
  28.672 +                    break;
  28.673 +                case 4:
  28.674 +                    if ( c->x86 > 6 && dl ) {
  28.675 +                        /* P4 family */
  28.676 +                        /* L3 cache */
  28.677 +                        cs = 128 << (dl-1);
  28.678 +                        l3 += cs;
  28.679 +                        break;
  28.680 +                    }
  28.681 +                    /* else same as 8 - fall through */
  28.682 +                case 8:
  28.683 +                    if ( dl ) {
  28.684 +                        /* L2 cache */
  28.685 +                        cs = 128 << (dl-1);
  28.686 +                        l2 += cs;
  28.687 +                    }
  28.688 +                    break;
  28.689 +                case 6:
  28.690 +                    if (dl > 5) {
  28.691 +                        /* L1 D cache */
  28.692 +                        cs = 8<<(dl-6);
  28.693 +                        l1d += cs;
  28.694 +                    }
  28.695 +                    break;
  28.696 +                case 7:
  28.697 +                    if ( dl >= 8 ) 
  28.698 +                    {
  28.699 +                        /* L2 cache */
  28.700 +                        cs = 64<<(dl-8);
  28.701 +                        l2 += cs;
  28.702 +                    } else {
  28.703 +                        /* L0 I cache, count as L1 */
  28.704 +                        cs = dl ? (16 << (dl-1)) : 12;
  28.705 +                        l1i += cs;
  28.706 +                    }
  28.707 +                    break;
  28.708 +                default:
  28.709 +                    /* TLB, or something else we don't know about */
  28.710 +                    break;
  28.711 +                }
  28.712 +            }
  28.713 +        }
  28.714 +        if ( l1i || l1d )
  28.715 +            printk(KERN_INFO "CPU: L1 I cache: %dK, L1 D cache: %dK\n",
  28.716 +                   l1i, l1d);
  28.717 +        if ( l2 )
  28.718 +            printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
  28.719 +        if ( l3 )
  28.720 +            printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);
  28.721 +
  28.722 +        /*
  28.723 +         * This assumes the L3 cache is shared; it typically lives in
  28.724 +         * the northbridge.  The L1 caches are included by the L2
  28.725 +         * cache, and so should not be included for the purpose of
  28.726 +         * SMP switching weights.
  28.727 +         */
  28.728 +        c->x86_cache_size = l2 ? l2 : (l1i+l1d);
  28.729 +    }
  28.730 +
  28.731 +    /* SEP CPUID bug: Pentium Pro reports SEP but doesn't have it */
  28.732 +    if ( c->x86 == 6 && c->x86_model < 3 && c->x86_mask < 3 )
  28.733 +        clear_bit(X86_FEATURE_SEP, &c->x86_capability);
  28.734 +	
  28.735 +    /* Names for the Pentium II/Celeron processors 
  28.736 +       detectable only by also checking the cache size.
  28.737 +       Dixon is NOT a Celeron. */
  28.738 +    if (c->x86 == 6) {
  28.739 +        switch (c->x86_model) {
  28.740 +        case 5:
  28.741 +            if (l2 == 0)
  28.742 +                p = "Celeron (Covington)";
  28.743 +            if (l2 == 256)
  28.744 +                p = "Mobile Pentium II (Dixon)";
  28.745 +            break;
  28.746 +			
  28.747 +        case 6:
  28.748 +            if (l2 == 128)
  28.749 +                p = "Celeron (Mendocino)";
  28.750 +            break;
  28.751 +			
  28.752 +        case 8:
  28.753 +            if (l2 == 128)
  28.754 +                p = "Celeron (Coppermine)";
  28.755 +            break;
  28.756 +        }
  28.757 +    }
  28.758 +
  28.759 +    if ( p )
  28.760 +        strcpy(c->x86_model_id, p);
  28.761 +}
  28.762 +
  28.763 +void __init get_cpu_vendor(struct cpuinfo_x86 *c)
  28.764 +{
  28.765 +    char *v = c->x86_vendor_id;
  28.766 +
  28.767 +    if (!strcmp(v, "GenuineIntel"))
  28.768 +        c->x86_vendor = X86_VENDOR_INTEL;
  28.769 +    else if (!strcmp(v, "AuthenticAMD"))
  28.770 +        c->x86_vendor = X86_VENDOR_AMD;
  28.771 +    else if (!strcmp(v, "CentaurHauls"))
  28.772 +        c->x86_vendor = X86_VENDOR_CENTAUR;
  28.773 +    else
  28.774 +        c->x86_vendor = X86_VENDOR_UNKNOWN;
  28.775 +}
  28.776 +
  28.777 +struct cpu_model_info {
  28.778 +    int vendor;
  28.779 +    int family;
  28.780 +    char *model_names[16];
  28.781 +};
  28.782 +
  28.783 +/* Naming convention should be: <Name> [(<Codename>)] */
  28.784 +/* This table only is used unless init_<vendor>() below doesn't set it; */
  28.785 +/* in particular, if CPUID levels 0x80000002..4 are supported, this isn't used */
  28.786 +static struct cpu_model_info cpu_models[] __initdata = {
  28.787 +    { X86_VENDOR_INTEL,	6,
  28.788 +      { "Pentium Pro A-step", "Pentium Pro", NULL, "Pentium II (Klamath)", 
  28.789 +        NULL, "Pentium II (Deschutes)", "Mobile Pentium II",
  28.790 +        "Pentium III (Katmai)", "Pentium III (Coppermine)", NULL,
  28.791 +        "Pentium III (Cascades)", NULL, NULL, NULL, NULL }},
  28.792 +    { X86_VENDOR_AMD,	6, /* Is this this really necessary?? */
  28.793 +      { "Athlon", "Athlon",
  28.794 +        "Athlon", NULL, "Athlon", NULL,
  28.795 +        NULL, NULL, NULL,
  28.796 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL }}
  28.797 +};
  28.798 +
  28.799 +/* Look up CPU names by table lookup. */
  28.800 +static char __init *table_lookup_model(struct cpuinfo_x86 *c)
  28.801 +{
  28.802 +    struct cpu_model_info *info = cpu_models;
  28.803 +    int i;
  28.804 +
  28.805 +    if ( c->x86_model >= 16 )
  28.806 +        return NULL;	/* Range check */
  28.807 +
  28.808 +    for ( i = 0 ; i < sizeof(cpu_models)/sizeof(struct cpu_model_info) ; i++ ) {
  28.809 +        if ( info->vendor == c->x86_vendor &&
  28.810 +             info->family == c->x86 ) {
  28.811 +            return info->model_names[c->x86_model];
  28.812 +        }
  28.813 +        info++;
  28.814 +    }
  28.815 +    return NULL;		/* Not found */
  28.816 +}
  28.817 +
  28.818 +
  28.819 +
  28.820 +/* Standard macro to see if a specific flag is changeable */
  28.821 +static inline int flag_is_changeable_p(u32 flag)
  28.822 +{
  28.823 +    u32 f1, f2;
  28.824 +
  28.825 +    asm("pushfl\n\t"
  28.826 +        "pushfl\n\t"
  28.827 +        "popl %0\n\t"
  28.828 +        "movl %0,%1\n\t"
  28.829 +        "xorl %2,%0\n\t"
  28.830 +        "pushl %0\n\t"
  28.831 +        "popfl\n\t"
  28.832 +        "pushfl\n\t"
  28.833 +        "popl %0\n\t"
  28.834 +        "popfl\n\t"
  28.835 +        : "=&r" (f1), "=&r" (f2)
  28.836 +        : "ir" (flag));
  28.837 +
  28.838 +    return ((f1^f2) & flag) != 0;
  28.839 +}
  28.840 +
  28.841 +
  28.842 +/* Probe for the CPUID instruction */
  28.843 +static int __init have_cpuid_p(void)
  28.844 +{
  28.845 +    return flag_is_changeable_p(X86_EFLAGS_ID);
  28.846 +}
  28.847 +
  28.848 +
  28.849 +
  28.850 +#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
  28.851 +unsigned char eddnr;
  28.852 +struct edd_info edd[EDDMAXNR];
  28.853 +unsigned int edd_disk80_sig;
  28.854 +/**
  28.855 + * copy_edd() - Copy the BIOS EDD information
  28.856 + *              from empty_zero_page into a safe place.
  28.857 + *
  28.858 + */
  28.859 +static inline void copy_edd(void)
  28.860 +{
  28.861 +     eddnr = EDD_NR;
  28.862 +     memcpy(edd, EDD_BUF, sizeof(edd));
  28.863 +     edd_disk80_sig = DISK80_SIGNATURE_BUFFER;
  28.864 +}
  28.865 +#else
  28.866 +static inline void copy_edd(void) {}
  28.867 +#endif
  28.868 +
  28.869 +/*
  28.870 + * This does the hard work of actually picking apart the CPU stuff...
  28.871 + */
  28.872 +void __init identify_cpu(struct cpuinfo_x86 *c)
  28.873 +{
  28.874 +    int junk, i;
  28.875 +    u32 xlvl, tfms;
  28.876 +
  28.877 +    c->loops_per_jiffy = loops_per_jiffy;
  28.878 +    c->x86_cache_size = -1;
  28.879 +    c->x86_vendor = X86_VENDOR_UNKNOWN;
  28.880 +    c->cpuid_level = -1;	/* CPUID not detected */
  28.881 +    c->x86_model = c->x86_mask = 0;	/* So far unknown... */
  28.882 +    c->x86_vendor_id[0] = '\0'; /* Unset */
  28.883 +    c->x86_model_id[0] = '\0';  /* Unset */
  28.884 +    memset(&c->x86_capability, 0, sizeof c->x86_capability);
  28.885 +    c->hard_math = 1;
  28.886 +
  28.887 +    if ( !have_cpuid_p() ) {
  28.888 +        panic("Processor must support CPUID\n");
  28.889 +    } else {
  28.890 +        /* CPU does have CPUID */
  28.891 +
  28.892 +        /* Get vendor name */
  28.893 +        cpuid(0x00000000, &c->cpuid_level,
  28.894 +              (int *)&c->x86_vendor_id[0],
  28.895 +              (int *)&c->x86_vendor_id[8],
  28.896 +              (int *)&c->x86_vendor_id[4]);
  28.897 +		
  28.898 +        get_cpu_vendor(c);
  28.899 +        /* Initialize the standard set of capabilities */
  28.900 +        /* Note that the vendor-specific code below might override */
  28.901 +
  28.902 +        /* Intel-defined flags: level 0x00000001 */
  28.903 +        if ( c->cpuid_level >= 0x00000001 ) {
  28.904 +                        u32 capability, excap;
  28.905 +                        cpuid(0x00000001, &tfms, &junk, &excap, &capability);
  28.906 +                        c->x86_capability[0] = capability;
  28.907 +                        c->x86_capability[4] = excap;
  28.908 +                        c->x86 = (tfms >> 8) & 15;
  28.909 +                        c->x86_model = (tfms >> 4) & 15;
  28.910 +                        if (c->x86 == 0xf) {
  28.911 +                                c->x86 += (tfms >> 20) & 0xff;
  28.912 +                                c->x86_model += ((tfms >> 16) & 0xF) << 4;
  28.913 +                        }
  28.914 +                        c->x86_mask = tfms & 15;
  28.915 +        } else {
  28.916 +            /* Have CPUID level 0 only - unheard of */
  28.917 +            c->x86 = 4;
  28.918 +        }
  28.919 +
  28.920 +        /* AMD-defined flags: level 0x80000001 */
  28.921 +        xlvl = cpuid_eax(0x80000000);
  28.922 +        if ( (xlvl & 0xffff0000) == 0x80000000 ) {
  28.923 +            if ( xlvl >= 0x80000001 )
  28.924 +                c->x86_capability[1] = cpuid_edx(0x80000001);
  28.925 +            if ( xlvl >= 0x80000004 )
  28.926 +                get_model_name(c); /* Default name */
  28.927 +        }
  28.928 +
  28.929 +        /* Transmeta-defined flags: level 0x80860001 */
  28.930 +        xlvl = cpuid_eax(0x80860000);
  28.931 +        if ( (xlvl & 0xffff0000) == 0x80860000 ) {
  28.932 +            if (  xlvl >= 0x80860001 )
  28.933 +                c->x86_capability[2] = cpuid_edx(0x80860001);
  28.934 +        }
  28.935 +    }
  28.936 +
  28.937 +    printk(KERN_DEBUG "CPU: Before vendor init, caps: %08x %08x %08x, vendor = %d\n",
  28.938 +           c->x86_capability[0],
  28.939 +           c->x86_capability[1],
  28.940 +           c->x86_capability[2],
  28.941 +           c->x86_vendor);
  28.942 +
  28.943 +    /*
  28.944 +     * Vendor-specific initialization.  In this section we
  28.945 +     * canonicalize the feature flags, meaning if there are
  28.946 +     * features a certain CPU supports which CPUID doesn't
  28.947 +     * tell us, CPUID claiming incorrect flags, or other bugs,
  28.948 +     * we handle them here.
  28.949 +     *
  28.950 +     * At the end of this section, c->x86_capability better
  28.951 +     * indicate the features this CPU genuinely supports!
  28.952 +     */
  28.953 +    switch ( c->x86_vendor ) {
  28.954 +    case X86_VENDOR_AMD:
  28.955 +        init_amd(c);
  28.956 +        break;
  28.957 +
  28.958 +    case X86_VENDOR_INTEL:
  28.959 +        init_intel(c);
  28.960 +        break;
  28.961 +
  28.962 +    case X86_VENDOR_CENTAUR:
  28.963 +        init_centaur(c);
  28.964 +        break;
  28.965 +        
  28.966 +    default:
  28.967 +        printk("Unsupported CPU vendor (%d) -- please report!\n",
  28.968 +               c->x86_vendor);
  28.969 +    }
  28.970 +	
  28.971 +    printk(KERN_DEBUG "CPU: After vendor init, caps: %08x %08x %08x %08x\n",
  28.972 +           c->x86_capability[0],
  28.973 +           c->x86_capability[1],
  28.974 +           c->x86_capability[2],
  28.975 +           c->x86_capability[3]);
  28.976 +
  28.977 +
  28.978 +    /* If the model name is still unset, do table lookup. */
  28.979 +    if ( !c->x86_model_id[0] ) {
  28.980 +        char *p;
  28.981 +        p = table_lookup_model(c);
  28.982 +        if ( p )
  28.983 +            strcpy(c->x86_model_id, p);
  28.984 +        else
  28.985 +            /* Last resort... */
  28.986 +            sprintf(c->x86_model_id, "%02x/%02x",
  28.987 +                    c->x86_vendor, c->x86_model);
  28.988 +    }
  28.989 +
  28.990 +    /* Now the feature flags better reflect actual CPU features! */
  28.991 +
  28.992 +    printk(KERN_DEBUG "CPU:     After generic, caps: %08x %08x %08x %08x\n",
  28.993 +           c->x86_capability[0],
  28.994 +           c->x86_capability[1],
  28.995 +           c->x86_capability[2],
  28.996 +           c->x86_capability[3]);
  28.997 +
  28.998 +    /*
  28.999 +     * On SMP, boot_cpu_data holds the common feature set between
 28.1000 +     * all CPUs; so make sure that we indicate which features are
 28.1001 +     * common between the CPUs.  The first time this routine gets
 28.1002 +     * executed, c == &boot_cpu_data.
 28.1003 +     */
 28.1004 +    if ( c != &boot_cpu_data ) {
 28.1005 +        /* AND the already accumulated flags with these */
 28.1006 +        for ( i = 0 ; i < NCAPINTS ; i++ )
 28.1007 +            boot_cpu_data.x86_capability[i] &= c->x86_capability[i];
 28.1008 +    }
 28.1009 +
 28.1010 +    printk(KERN_DEBUG "CPU:             Common caps: %08x %08x %08x %08x\n",
 28.1011 +           boot_cpu_data.x86_capability[0],
 28.1012 +           boot_cpu_data.x86_capability[1],
 28.1013 +           boot_cpu_data.x86_capability[2],
 28.1014 +           boot_cpu_data.x86_capability[3]);
 28.1015 +}
 28.1016 +
 28.1017 +
 28.1018 +/* These need to match <asm/processor.h> */
 28.1019 +static char *cpu_vendor_names[] __initdata = {
 28.1020 +    "Intel", "Cyrix", "AMD", "UMC", "NexGen", "Centaur", "Rise", "Transmeta" };
 28.1021 +
 28.1022 +
 28.1023 +void __init print_cpu_info(struct cpuinfo_x86 *c)
 28.1024 +{
 28.1025 +    char *vendor = NULL;
 28.1026 +
 28.1027 +    if (c->x86_vendor < sizeof(cpu_vendor_names)/sizeof(char *))
 28.1028 +        vendor = cpu_vendor_names[c->x86_vendor];
 28.1029 +    else if (c->cpuid_level >= 0)
 28.1030 +        vendor = c->x86_vendor_id;
 28.1031 +
 28.1032 +    if (vendor && strncmp(c->x86_model_id, vendor, strlen(vendor)))
 28.1033 +        printk("%s ", vendor);
 28.1034 +
 28.1035 +    if (!c->x86_model_id[0])
 28.1036 +        printk("%d86", c->x86);
 28.1037 +    else
 28.1038 +        printk("%s", c->x86_model_id);
 28.1039 +
 28.1040 +    if (c->x86_mask || c->cpuid_level >= 0) 
 28.1041 +        printk(" stepping %02x\n", c->x86_mask);
 28.1042 +    else
 28.1043 +        printk("\n");
 28.1044 +}
 28.1045 +
 28.1046 +/*
 28.1047 + *	Get CPU information for use by the procfs.
 28.1048 + */
 28.1049 +static int show_cpuinfo(struct seq_file *m, void *v)
 28.1050 +{
 28.1051 +    /* 
 28.1052 +     * These flag bits must match the definitions in <asm/cpufeature.h>.
 28.1053 +     * NULL means this bit is undefined or reserved; either way it doesn't
 28.1054 +     * have meaning as far as Linux is concerned.  Note that it's important
 28.1055 +     * to realize there is a difference between this table and CPUID -- if
 28.1056 +     * applications want to get the raw CPUID data, they should access
 28.1057 +     * /dev/cpu/<cpu_nr>/cpuid instead.
 28.1058 +	 */
 28.1059 +    static char *x86_cap_flags[] = {
 28.1060 +        /* Intel-defined */
 28.1061 +        "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
 28.1062 +        "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
 28.1063 +        "pat", "pse36", "pn", "clflush", NULL, "dts", "acpi", "mmx",
 28.1064 +        "fxsr", "sse", "sse2", "ss", "ht", "tm", "ia64", "pbe",
 28.1065 +
 28.1066 +        /* AMD-defined */
 28.1067 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1068 +        NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
 28.1069 +        NULL, NULL, NULL, "mp", NULL, NULL, "mmxext", NULL,
 28.1070 +        NULL, NULL, NULL, NULL, NULL, "lm", "3dnowext", "3dnow",
 28.1071 +
 28.1072 +        /* Transmeta-defined */
 28.1073 +        "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
 28.1074 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1075 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1076 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1077 +
 28.1078 +        /* Other (Linux-defined) */
 28.1079 +        "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", 
 28.1080 +	NULL, NULL, NULL, NULL,
 28.1081 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1082 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1083 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1084 +
 28.1085 +        /* Intel-defined (#2) */
 28.1086 +        "pni", NULL, NULL, "monitor", "ds_cpl", NULL, NULL, "tm2",
 28.1087 +        "est", NULL, "cid", NULL, NULL, NULL, NULL, NULL,
 28.1088 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1089 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1090 +
 28.1091 +        /* VIA/Cyrix/Centaur-defined */
 28.1092 +        NULL, NULL, "xstore", NULL, NULL, NULL, NULL, NULL,
 28.1093 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1094 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1095 +        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 28.1096 +
 28.1097 +    };
 28.1098 +    struct cpuinfo_x86 *c = v;
 28.1099 +    int i, n = c - cpu_data;
 28.1100 +    int fpu_exception;
 28.1101 +
 28.1102 +#ifdef CONFIG_SMP
 28.1103 +    if (!(cpu_online_map & (1<<n)))
 28.1104 +        return 0;
 28.1105 +#endif
 28.1106 +    seq_printf(m, "processor\t: %d\n"
 28.1107 +               "vendor_id\t: %s\n"
 28.1108 +               "cpu family\t: %d\n"
 28.1109 +               "model\t\t: %d\n"
 28.1110 +               "model name\t: %s\n",
 28.1111 +               n,
 28.1112 +               c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
 28.1113 +               c->x86,
 28.1114 +               c->x86_model,
 28.1115 +               c->x86_model_id[0] ? c->x86_model_id : "unknown");
 28.1116 +
 28.1117 +    if (c->x86_mask || c->cpuid_level >= 0)
 28.1118 +        seq_printf(m, "stepping\t: %d\n", c->x86_mask);
 28.1119 +    else
 28.1120 +        seq_printf(m, "stepping\t: unknown\n");
 28.1121 +
 28.1122 +    if ( test_bit(X86_FEATURE_TSC, &c->x86_capability) ) {
 28.1123 +        seq_printf(m, "cpu MHz\t\t: %lu.%03lu\n",
 28.1124 +                   cpu_khz / 1000, (cpu_khz % 1000));
 28.1125 +    }
 28.1126 +
 28.1127 +    /* Cache size */
 28.1128 +    if (c->x86_cache_size >= 0)
 28.1129 +        seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
 28.1130 +	
 28.1131 +	/* We use exception 16 if we have hardware math and we've either seen it or the CPU claims it is internal */
 28.1132 +    fpu_exception = c->hard_math && (ignore_irq13 || cpu_has_fpu);
 28.1133 +    seq_printf(m, "fdiv_bug\t: %s\n"
 28.1134 +               "hlt_bug\t\t: %s\n"
 28.1135 +               "f00f_bug\t: %s\n"
 28.1136 +               "coma_bug\t: %s\n"
 28.1137 +               "fpu\t\t: %s\n"
 28.1138 +               "fpu_exception\t: %s\n"
 28.1139 +               "cpuid level\t: %d\n"
 28.1140 +               "wp\t\t: %s\n"
 28.1141 +               "flags\t\t:",
 28.1142 +               c->fdiv_bug ? "yes" : "no",
 28.1143 +               c->hlt_works_ok ? "no" : "yes",
 28.1144 +               c->f00f_bug ? "yes" : "no",
 28.1145 +               c->coma_bug ? "yes" : "no",
 28.1146 +               c->hard_math ? "yes" : "no",
 28.1147 +               fpu_exception ? "yes" : "no",
 28.1148 +               c->cpuid_level,
 28.1149 +               c->wp_works_ok ? "yes" : "no");
 28.1150 +
 28.1151 +    for ( i = 0 ; i < 32*NCAPINTS ; i++ )
 28.1152 +        if ( test_bit(i, &c->x86_capability) &&
 28.1153 +             x86_cap_flags[i] != NULL )
 28.1154 +            seq_printf(m, " %s", x86_cap_flags[i]);
 28.1155 +
 28.1156 +    seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
 28.1157 +               c->loops_per_jiffy/(500000/HZ),
 28.1158 +               (c->loops_per_jiffy/(5000/HZ)) % 100);
 28.1159 +    return 0;
 28.1160 +}
 28.1161 +
 28.1162 +static void *c_start(struct seq_file *m, loff_t *pos)
 28.1163 +{
 28.1164 +    return *pos < NR_CPUS ? cpu_data + *pos : NULL;
 28.1165 +}
 28.1166 +static void *c_next(struct seq_file *m, void *v, loff_t *pos)
 28.1167 +{
 28.1168 +    ++*pos;
 28.1169 +    return c_start(m, pos);
 28.1170 +}
 28.1171 +static void c_stop(struct seq_file *m, void *v)
 28.1172 +{
 28.1173 +}
 28.1174 +struct seq_operations cpuinfo_op = {
 28.1175 +    start:	c_start,
 28.1176 +    next:	c_next,
 28.1177 +    stop:	c_stop,
 28.1178 +    show:	show_cpuinfo,
 28.1179 +};
 28.1180 +
 28.1181 +unsigned long cpu_initialized __initdata = 0;
 28.1182 +
 28.1183 +/*
 28.1184 + * cpu_init() initializes state that is per-CPU. Some data is already
 28.1185 + * initialized (naturally) in the bootstrap process, such as the GDT
 28.1186 + * and IDT. We reload them nevertheless, this function acts as a
 28.1187 + * 'CPU state barrier', nothing should get across.
 28.1188 + */
 28.1189 +void __init cpu_init (void)
 28.1190 +{
 28.1191 +    int nr = smp_processor_id();
 28.1192 +
 28.1193 +    if (test_and_set_bit(nr, &cpu_initialized)) {
 28.1194 +        printk(KERN_WARNING "CPU#%d already initialized!\n", nr);
 28.1195 +        for (;;) __sti();
 28.1196 +    }
 28.1197 +    printk(KERN_INFO "Initializing CPU#%d\n", nr);
 28.1198 +
 28.1199 +    /*
 28.1200 +     * set up and load the per-CPU TSS and LDT
 28.1201 +     */
 28.1202 +    atomic_inc(&init_mm.mm_count);
 28.1203 +    current->active_mm = &init_mm;
 28.1204 +    if(current->mm)
 28.1205 +        BUG();
 28.1206 +    enter_lazy_tlb(&init_mm, current, nr);
 28.1207 +
 28.1208 +    HYPERVISOR_stack_switch(__KERNEL_DS, current->thread.esp0);
 28.1209 +
 28.1210 +    load_LDT(&init_mm.context);
 28.1211 +
 28.1212 +    /* Force FPU initialization. */
 28.1213 +    current->flags &= ~PF_USEDFPU;
 28.1214 +    current->used_math = 0;
 28.1215 +    stts();
 28.1216 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/signal.c	Mon Jul 11 09:29:56 2005 -0500
    29.3 @@ -0,0 +1,717 @@
    29.4 +/*
    29.5 + *  linux/arch/i386/kernel/signal.c
    29.6 + *
    29.7 + *  Copyright (C) 1991, 1992  Linus Torvalds
    29.8 + *
    29.9 + *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
   29.10 + *  2000-06-20  Pentium III FXSR, SSE support by Gareth Hughes
   29.11 + */
   29.12 +
   29.13 +#include <linux/sched.h>
   29.14 +#include <linux/mm.h>
   29.15 +#include <linux/smp.h>
   29.16 +#include <linux/smp_lock.h>
   29.17 +#include <linux/kernel.h>
   29.18 +#include <linux/signal.h>
   29.19 +#include <linux/errno.h>
   29.20 +#include <linux/wait.h>
   29.21 +#include <linux/ptrace.h>
   29.22 +#include <linux/unistd.h>
   29.23 +#include <linux/stddef.h>
   29.24 +#include <linux/tty.h>
   29.25 +#include <linux/personality.h>
   29.26 +#include <asm/ucontext.h>
   29.27 +#include <asm/uaccess.h>
   29.28 +#include <asm/i387.h>
   29.29 +
   29.30 +#define DEBUG_SIG 0
   29.31 +
   29.32 +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
   29.33 +
   29.34 +int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
   29.35 +
   29.36 +int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
   29.37 +{
   29.38 +	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
   29.39 +		return -EFAULT;
   29.40 +	if (from->si_code < 0)
   29.41 +		return __copy_to_user(to, from, sizeof(siginfo_t));
   29.42 +	else {
   29.43 +		int err;
   29.44 +
   29.45 +		/* If you change siginfo_t structure, please be sure
   29.46 +		   this code is fixed accordingly.
   29.47 +		   It should never copy any pad contained in the structure
   29.48 +		   to avoid security leaks, but must copy the generic
   29.49 +		   3 ints plus the relevant union member.  */
   29.50 +		err = __put_user(from->si_signo, &to->si_signo);
   29.51 +		err |= __put_user(from->si_errno, &to->si_errno);
   29.52 +		err |= __put_user((short)from->si_code, &to->si_code);
   29.53 +		/* First 32bits of unions are always present.  */
   29.54 +		err |= __put_user(from->si_pid, &to->si_pid);
   29.55 +		switch (from->si_code >> 16) {
   29.56 +		case __SI_FAULT >> 16:
   29.57 +			break;
   29.58 +		case __SI_CHLD >> 16:
   29.59 +			err |= __put_user(from->si_utime, &to->si_utime);
   29.60 +			err |= __put_user(from->si_stime, &to->si_stime);
   29.61 +			err |= __put_user(from->si_status, &to->si_status);
   29.62 +		default:
   29.63 +			err |= __put_user(from->si_uid, &to->si_uid);
   29.64 +			break;
   29.65 +		/* case __SI_RT: This is not generated by the kernel as of now.  */
   29.66 +		}
   29.67 +		return err;
   29.68 +	}
   29.69 +}
   29.70 +
   29.71 +/*
   29.72 + * Atomically swap in the new signal mask, and wait for a signal.
   29.73 + */
   29.74 +asmlinkage int
   29.75 +sys_sigsuspend(int history0, int history1, old_sigset_t mask)
   29.76 +{
   29.77 +	struct pt_regs * regs = (struct pt_regs *) &history0;
   29.78 +	sigset_t saveset;
   29.79 +
   29.80 +	mask &= _BLOCKABLE;
   29.81 +	spin_lock_irq(&current->sigmask_lock);
   29.82 +	saveset = current->blocked;
   29.83 +	siginitset(&current->blocked, mask);
   29.84 +	recalc_sigpending(current);
   29.85 +	spin_unlock_irq(&current->sigmask_lock);
   29.86 +
   29.87 +	regs->eax = -EINTR;
   29.88 +	while (1) {
   29.89 +		current->state = TASK_INTERRUPTIBLE;
   29.90 +		schedule();
   29.91 +		if (do_signal(regs, &saveset))
   29.92 +			return -EINTR;
   29.93 +	}
   29.94 +}
   29.95 +
   29.96 +asmlinkage int
   29.97 +sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize)
   29.98 +{
   29.99 +	struct pt_regs * regs = (struct pt_regs *) &unewset;
  29.100 +	sigset_t saveset, newset;
  29.101 +
  29.102 +	/* XXX: Don't preclude handling different sized sigset_t's.  */
  29.103 +	if (sigsetsize != sizeof(sigset_t))
  29.104 +		return -EINVAL;
  29.105 +
  29.106 +	if (copy_from_user(&newset, unewset, sizeof(newset)))
  29.107 +		return -EFAULT;
  29.108 +	sigdelsetmask(&newset, ~_BLOCKABLE);
  29.109 +
  29.110 +	spin_lock_irq(&current->sigmask_lock);
  29.111 +	saveset = current->blocked;
  29.112 +	current->blocked = newset;
  29.113 +	recalc_sigpending(current);
  29.114 +	spin_unlock_irq(&current->sigmask_lock);
  29.115 +
  29.116 +	regs->eax = -EINTR;
  29.117 +	while (1) {
  29.118 +		current->state = TASK_INTERRUPTIBLE;
  29.119 +		schedule();
  29.120 +		if (do_signal(regs, &saveset))
  29.121 +			return -EINTR;
  29.122 +	}
  29.123 +}
  29.124 +
  29.125 +asmlinkage int 
  29.126 +sys_sigaction(int sig, const struct old_sigaction *act,
  29.127 +	      struct old_sigaction *oact)
  29.128 +{
  29.129 +	struct k_sigaction new_ka, old_ka;
  29.130 +	int ret;
  29.131 +
  29.132 +	if (act) {
  29.133 +		old_sigset_t mask;
  29.134 +		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
  29.135 +		    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
  29.136 +		    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
  29.137 +			return -EFAULT;
  29.138 +		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
  29.139 +		__get_user(mask, &act->sa_mask);
  29.140 +		siginitset(&new_ka.sa.sa_mask, mask);
  29.141 +	}
  29.142 +
  29.143 +	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
  29.144 +
  29.145 +	if (!ret && oact) {
  29.146 +		if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
  29.147 +		    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
  29.148 +		    __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
  29.149 +			return -EFAULT;
  29.150 +		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
  29.151 +		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
  29.152 +	}
  29.153 +
  29.154 +	return ret;
  29.155 +}
  29.156 +
  29.157 +asmlinkage int
  29.158 +sys_sigaltstack(const stack_t *uss, stack_t *uoss)
  29.159 +{
  29.160 +	struct pt_regs *regs = (struct pt_regs *) &uss;
  29.161 +	return do_sigaltstack(uss, uoss, regs->esp);
  29.162 +}
  29.163 +
  29.164 +
  29.165 +/*
  29.166 + * Do a signal return; undo the signal stack.
  29.167 + */
  29.168 +
  29.169 +struct sigframe
  29.170 +{
  29.171 +	char *pretcode;
  29.172 +	int sig;
  29.173 +	struct sigcontext sc;
  29.174 +	struct _fpstate fpstate;
  29.175 +	unsigned long extramask[_NSIG_WORDS-1];
  29.176 +	char retcode[8];
  29.177 +};
  29.178 +
  29.179 +struct rt_sigframe
  29.180 +{
  29.181 +	char *pretcode;
  29.182 +	int sig;
  29.183 +	struct siginfo *pinfo;
  29.184 +	void *puc;
  29.185 +	struct siginfo info;
  29.186 +	struct ucontext uc;
  29.187 +	struct _fpstate fpstate;
  29.188 +	char retcode[8];
  29.189 +};
  29.190 +
  29.191 +static int
  29.192 +restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc, int *peax)
  29.193 +{
  29.194 +	unsigned int err = 0;
  29.195 +
  29.196 +#define COPY(x)		err |= __get_user(regs->x, &sc->x)
  29.197 +
  29.198 +#define COPY_SEG(seg)							\
  29.199 +	{ unsigned short tmp;						\
  29.200 +	  err |= __get_user(tmp, &sc->seg);				\
  29.201 +	  regs->x##seg = tmp; }
  29.202 +
  29.203 +#define COPY_SEG_STRICT(seg)						\
  29.204 +	{ unsigned short tmp;						\
  29.205 +	  err |= __get_user(tmp, &sc->seg);				\
  29.206 +	  regs->x##seg = tmp|3; }
  29.207 +
  29.208 +#define GET_SEG(seg)							\
  29.209 +	{ unsigned short tmp;						\
  29.210 +	  err |= __get_user(tmp, &sc->seg);				\
  29.211 +	  loadsegment(seg,tmp); }
  29.212 +
  29.213 +	GET_SEG(gs);
  29.214 +	GET_SEG(fs);
  29.215 +	COPY_SEG(es);
  29.216 +	COPY_SEG(ds);
  29.217 +	COPY(edi);
  29.218 +	COPY(esi);
  29.219 +	COPY(ebp);
  29.220 +	COPY(esp);
  29.221 +	COPY(ebx);
  29.222 +	COPY(edx);
  29.223 +	COPY(ecx);
  29.224 +	COPY(eip);
  29.225 +	COPY_SEG_STRICT(cs);
  29.226 +	COPY_SEG_STRICT(ss);
  29.227 +	
  29.228 +	{
  29.229 +		unsigned int tmpflags;
  29.230 +		err |= __get_user(tmpflags, &sc->eflags);
  29.231 +		regs->eflags = (regs->eflags & ~0x40DD5) | (tmpflags & 0x40DD5);
  29.232 +		regs->orig_eax = -1;		/* disable syscall checks */
  29.233 +	}
  29.234 +
  29.235 +	{
  29.236 +		struct _fpstate * buf;
  29.237 +		err |= __get_user(buf, &sc->fpstate);
  29.238 +		if (buf) {
  29.239 +			if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
  29.240 +				goto badframe;
  29.241 +			err |= restore_i387(buf);
  29.242 +		}
  29.243 +	}
  29.244 +
  29.245 +	err |= __get_user(*peax, &sc->eax);
  29.246 +	return err;
  29.247 +
  29.248 +badframe:
  29.249 +	return 1;
  29.250 +}
  29.251 +
  29.252 +asmlinkage int sys_sigreturn(unsigned long __unused)
  29.253 +{
  29.254 +	struct pt_regs *regs = (struct pt_regs *) &__unused;
  29.255 +	struct sigframe *frame = (struct sigframe *)(regs->esp - 8);
  29.256 +	sigset_t set;
  29.257 +	int eax;
  29.258 +
  29.259 +	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
  29.260 +		goto badframe;
  29.261 +	if (__get_user(set.sig[0], &frame->sc.oldmask)
  29.262 +	    || (_NSIG_WORDS > 1
  29.263 +		&& __copy_from_user(&set.sig[1], &frame->extramask,
  29.264 +				    sizeof(frame->extramask))))
  29.265 +		goto badframe;
  29.266 +
  29.267 +	sigdelsetmask(&set, ~_BLOCKABLE);
  29.268 +	spin_lock_irq(&current->sigmask_lock);
  29.269 +	current->blocked = set;
  29.270 +	recalc_sigpending(current);
  29.271 +	spin_unlock_irq(&current->sigmask_lock);
  29.272 +	
  29.273 +	if (restore_sigcontext(regs, &frame->sc, &eax))
  29.274 +		goto badframe;
  29.275 +	return eax;
  29.276 +
  29.277 +badframe:
  29.278 +	force_sig(SIGSEGV, current);
  29.279 +	return 0;
  29.280 +}	
  29.281 +
  29.282 +asmlinkage int sys_rt_sigreturn(unsigned long __unused)
  29.283 +{
  29.284 +	struct pt_regs *regs = (struct pt_regs *) &__unused;
  29.285 +	struct rt_sigframe *frame = (struct rt_sigframe *)(regs->esp - 4);
  29.286 +	sigset_t set;
  29.287 +	stack_t st;
  29.288 +	int eax;
  29.289 +
  29.290 +	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
  29.291 +		goto badframe;
  29.292 +	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
  29.293 +		goto badframe;
  29.294 +
  29.295 +	sigdelsetmask(&set, ~_BLOCKABLE);
  29.296 +	spin_lock_irq(&current->sigmask_lock);
  29.297 +	current->blocked = set;
  29.298 +	recalc_sigpending(current);
  29.299 +	spin_unlock_irq(&current->sigmask_lock);
  29.300 +	
  29.301 +	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &eax))
  29.302 +		goto badframe;
  29.303 +
  29.304 +	if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st)))
  29.305 +		goto badframe;
  29.306 +	/* It is more difficult to avoid calling this function than to
  29.307 +	   call it and ignore errors.  */
  29.308 +	do_sigaltstack(&st, NULL, regs->esp);
  29.309 +
  29.310 +	return eax;
  29.311 +
  29.312 +badframe:
  29.313 +	force_sig(SIGSEGV, current);
  29.314 +	return 0;
  29.315 +}	
  29.316 +
  29.317 +/*
  29.318 + * Set up a signal frame.
  29.319 + */
  29.320 +
  29.321 +static int
  29.322 +setup_sigcontext(struct sigcontext *sc, struct _fpstate *fpstate,
  29.323 +		 struct pt_regs *regs, unsigned long mask)
  29.324 +{
  29.325 +	int tmp, err = 0;
  29.326 +
  29.327 +	tmp = 0;
  29.328 +	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
  29.329 +	err |= __put_user(tmp, (unsigned int *)&sc->gs);
  29.330 +	__asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp));
  29.331 +	err |= __put_user(tmp, (unsigned int *)&sc->fs);
  29.332 +
  29.333 +	err |= __put_user(regs->xes, (unsigned int *)&sc->es);
  29.334 +	err |= __put_user(regs->xds, (unsigned int *)&sc->ds);
  29.335 +	err |= __put_user(regs->edi, &sc->edi);
  29.336 +	err |= __put_user(regs->esi, &sc->esi);
  29.337 +	err |= __put_user(regs->ebp, &sc->ebp);
  29.338 +	err |= __put_user(regs->esp, &sc->esp);
  29.339 +	err |= __put_user(regs->ebx, &sc->ebx);
  29.340 +	err |= __put_user(regs->edx, &sc->edx);
  29.341 +	err |= __put_user(regs->ecx, &sc->ecx);
  29.342 +	err |= __put_user(regs->eax, &sc->eax);
  29.343 +	err |= __put_user(current->thread.trap_no, &sc->trapno);
  29.344 +	err |= __put_user(current->thread.error_code, &sc->err);
  29.345 +	err |= __put_user(regs->eip, &sc->eip);
  29.346 +	err |= __put_user(regs->xcs, (unsigned int *)&sc->cs);
  29.347 +	err |= __put_user(regs->eflags, &sc->eflags);
  29.348 +	err |= __put_user(regs->esp, &sc->esp_at_signal);
  29.349 +	err |= __put_user(regs->xss, (unsigned int *)&sc->ss);
  29.350 +
  29.351 +	tmp = save_i387(fpstate);
  29.352 +	if (tmp < 0)
  29.353 +	  err = 1;
  29.354 +	else
  29.355 +	  err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
  29.356 +
  29.357 +	/* non-iBCS2 extensions.. */
  29.358 +	err |= __put_user(mask, &sc->oldmask);
  29.359 +	err |= __put_user(current->thread.cr2, &sc->cr2);
  29.360 +
  29.361 +	return err;
  29.362 +}
  29.363 +
  29.364 +/*
  29.365 + * Determine which stack to use..
  29.366 + */
  29.367 +static inline void *
  29.368 +get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
  29.369 +{
  29.370 +	unsigned long esp;
  29.371 +
  29.372 +	/* Default to using normal stack */
  29.373 +	esp = regs->esp;
  29.374 +
  29.375 +	/* This is the X/Open sanctioned signal stack switching.  */
  29.376 +	if (ka->sa.sa_flags & SA_ONSTACK) {
  29.377 +		if (sas_ss_flags(esp) == 0)
  29.378 +			esp = current->sas_ss_sp + current->sas_ss_size;
  29.379 +	}
  29.380 +
  29.381 +	/* This is the legacy signal stack switching. */
  29.382 +	else if ((regs->xss & 0xffff) != __USER_DS &&
  29.383 +		 !(ka->sa.sa_flags & SA_RESTORER) &&
  29.384 +		 ka->sa.sa_restorer) {
  29.385 +		esp = (unsigned long) ka->sa.sa_restorer;
  29.386 +	}
  29.387 +
  29.388 +	return (void *)((esp - frame_size) & -8ul);
  29.389 +}
  29.390 +
  29.391 +static void setup_frame(int sig, struct k_sigaction *ka,
  29.392 +			sigset_t *set, struct pt_regs * regs)
  29.393 +{
  29.394 +	struct sigframe *frame;
  29.395 +	int err = 0;
  29.396 +
  29.397 +	frame = get_sigframe(ka, regs, sizeof(*frame));
  29.398 +
  29.399 +	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  29.400 +		goto give_sigsegv;
  29.401 +
  29.402 +	err |= __put_user((current->exec_domain
  29.403 +		           && current->exec_domain->signal_invmap
  29.404 +		           && sig < 32
  29.405 +		           ? current->exec_domain->signal_invmap[sig]
  29.406 +		           : sig),
  29.407 +		          &frame->sig);
  29.408 +	if (err)
  29.409 +		goto give_sigsegv;
  29.410 +
  29.411 +	err |= setup_sigcontext(&frame->sc, &frame->fpstate, regs, set->sig[0]);
  29.412 +	if (err)
  29.413 +		goto give_sigsegv;
  29.414 +
  29.415 +	if (_NSIG_WORDS > 1) {
  29.416 +		err |= __copy_to_user(frame->extramask, &set->sig[1],
  29.417 +				      sizeof(frame->extramask));
  29.418 +	}
  29.419 +	if (err)
  29.420 +		goto give_sigsegv;
  29.421 +
  29.422 +	/* Set up to return from userspace.  If provided, use a stub
  29.423 +	   already in userspace.  */
  29.424 +	if (ka->sa.sa_flags & SA_RESTORER) {
  29.425 +		err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
  29.426 +	} else {
  29.427 +		err |= __put_user(frame->retcode, &frame->pretcode);
  29.428 +		/* This is popl %eax ; movl $,%eax ; int $0x80 */
  29.429 +		err |= __put_user(0xb858, (short *)(frame->retcode+0));
  29.430 +		err |= __put_user(__NR_sigreturn, (int *)(frame->retcode+2));
  29.431 +		err |= __put_user(0x80cd, (short *)(frame->retcode+6));
  29.432 +	}
  29.433 +
  29.434 +	if (err)
  29.435 +		goto give_sigsegv;
  29.436 +
  29.437 +	/* Set up registers for signal handler */
  29.438 +	regs->esp = (unsigned long) frame;
  29.439 +	regs->eip = (unsigned long) ka->sa.sa_handler;
  29.440 +
  29.441 +	set_fs(USER_DS);
  29.442 +	regs->xds = __USER_DS;
  29.443 +	regs->xes = __USER_DS;
  29.444 +	regs->xss = __USER_DS;
  29.445 +	regs->xcs = __USER_CS;
  29.446 +	regs->eflags &= ~TF_MASK;
  29.447 +
  29.448 +#if DEBUG_SIG
  29.449 +	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
  29.450 +		current->comm, current->pid, frame, regs->eip, frame->pretcode);
  29.451 +#endif
  29.452 +
  29.453 +	return;
  29.454 +
  29.455 +give_sigsegv:
  29.456 +	if (sig == SIGSEGV)
  29.457 +		ka->sa.sa_handler = SIG_DFL;
  29.458 +	force_sig(SIGSEGV, current);
  29.459 +}
  29.460 +
  29.461 +static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
  29.462 +			   sigset_t *set, struct pt_regs * regs)
  29.463 +{
  29.464 +	struct rt_sigframe *frame;
  29.465 +	int err = 0;
  29.466 +
  29.467 +	frame = get_sigframe(ka, regs, sizeof(*frame));
  29.468 +
  29.469 +	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
  29.470 +		goto give_sigsegv;
  29.471 +
  29.472 +	err |= __put_user((current->exec_domain
  29.473 +		    	   && current->exec_domain->signal_invmap
  29.474 +		    	   && sig < 32
  29.475 +		    	   ? current->exec_domain->signal_invmap[sig]
  29.476 +			   : sig),
  29.477 +			  &frame->sig);
  29.478 +	err |= __put_user(&frame->info, &frame->pinfo);
  29.479 +	err |= __put_user(&frame->uc, &frame->puc);
  29.480 +	err |= copy_siginfo_to_user(&frame->info, info);
  29.481 +	if (err)
  29.482 +		goto give_sigsegv;
  29.483 +
  29.484 +	/* Create the ucontext.  */
  29.485 +	err |= __put_user(0, &frame->uc.uc_flags);
  29.486 +	err |= __put_user(0, &frame->uc.uc_link);
  29.487 +	err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
  29.488 +	err |= __put_user(sas_ss_flags(regs->esp),
  29.489 +			  &frame->uc.uc_stack.ss_flags);
  29.490 +	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
  29.491 +	err |= setup_sigcontext(&frame->uc.uc_mcontext, &frame->fpstate,
  29.492 +			        regs, set->sig[0]);
  29.493 +	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
  29.494 +	if (err)
  29.495 +		goto give_sigsegv;
  29.496 +
  29.497 +	/* Set up to return from userspace.  If provided, use a stub
  29.498 +	   already in userspace.  */
  29.499 +	if (ka->sa.sa_flags & SA_RESTORER) {
  29.500 +		err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
  29.501 +	} else {
  29.502 +		err |= __put_user(frame->retcode, &frame->pretcode);
  29.503 +		/* This is movl $,%eax ; int $0x80 */
  29.504 +		err |= __put_user(0xb8, (char *)(frame->retcode+0));
  29.505 +		err |= __put_user(__NR_rt_sigreturn, (int *)(frame->retcode+1));
  29.506 +		err |= __put_user(0x80cd, (short *)(frame->retcode+5));
  29.507 +	}
  29.508 +
  29.509 +	if (err)
  29.510 +		goto give_sigsegv;
  29.511 +
  29.512 +	/* Set up registers for signal handler */
  29.513 +	regs->esp = (unsigned long) frame;
  29.514 +	regs->eip = (unsigned long) ka->sa.sa_handler;
  29.515 +
  29.516 +	set_fs(USER_DS);
  29.517 +	regs->xds = __USER_DS;
  29.518 +	regs->xes = __USER_DS;
  29.519 +	regs->xss = __USER_DS;
  29.520 +	regs->xcs = __USER_CS;
  29.521 +	regs->eflags &= ~TF_MASK;
  29.522 +
  29.523 +#if DEBUG_SIG
  29.524 +	printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
  29.525 +		current->comm, current->pid, frame, regs->eip, frame->pretcode);
  29.526 +#endif
  29.527 +
  29.528 +	return;
  29.529 +
  29.530 +give_sigsegv:
  29.531 +	if (sig == SIGSEGV)
  29.532 +		ka->sa.sa_handler = SIG_DFL;
  29.533 +	force_sig(SIGSEGV, current);
  29.534 +}
  29.535 +
  29.536 +/*
  29.537 + * OK, we're invoking a handler
  29.538 + */	
  29.539 +
  29.540 +static void
  29.541 +handle_signal(unsigned long sig, struct k_sigaction *ka,
  29.542 +	      siginfo_t *info, sigset_t *oldset, struct pt_regs * regs)
  29.543 +{
  29.544 +	/* Are we from a system call? */
  29.545 +	if (regs->orig_eax >= 0) {
  29.546 +		/* If so, check system call restarting.. */
  29.547 +		switch (regs->eax) {
  29.548 +			case -ERESTARTNOHAND:
  29.549 +				regs->eax = -EINTR;
  29.550 +				break;
  29.551 +
  29.552 +			case -ERESTARTSYS:
  29.553 +				if (!(ka->sa.sa_flags & SA_RESTART)) {
  29.554 +					regs->eax = -EINTR;
  29.555 +					break;
  29.556 +				}
  29.557 +			/* fallthrough */
  29.558 +			case -ERESTARTNOINTR:
  29.559 +				regs->eax = regs->orig_eax;
  29.560 +				regs->eip -= 2;
  29.561 +		}
  29.562 +	}
  29.563 +
  29.564 +	/* Set up the stack frame */
  29.565 +	if (ka->sa.sa_flags & SA_SIGINFO)
  29.566 +		setup_rt_frame(sig, ka, info, oldset, regs);
  29.567 +	else
  29.568 +		setup_frame(sig, ka, oldset, regs);
  29.569 +
  29.570 +	if (ka->sa.sa_flags & SA_ONESHOT)
  29.571 +		ka->sa.sa_handler = SIG_DFL;
  29.572 +
  29.573 +	if (!(ka->sa.sa_flags & SA_NODEFER)) {
  29.574 +		spin_lock_irq(&current->sigmask_lock);
  29.575 +		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
  29.576 +		sigaddset(&current->blocked,sig);
  29.577 +		recalc_sigpending(current);
  29.578 +		spin_unlock_irq(&current->sigmask_lock);
  29.579 +	}
  29.580 +}
  29.581 +
  29.582 +/*
  29.583 + * Note that 'init' is a special process: it doesn't get signals it doesn't
  29.584 + * want to handle. Thus you cannot kill init even with a SIGKILL even by
  29.585 + * mistake.
  29.586 + */
  29.587 +int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset)
  29.588 +{
  29.589 +	siginfo_t info;
  29.590 +	struct k_sigaction *ka;
  29.591 +
  29.592 +	/*
  29.593 +	 * We want the common case to go fast, which
  29.594 +	 * is why we may in certain cases get here from
  29.595 +	 * kernel mode. Just return without doing anything
  29.596 +	 * if so.
  29.597 +	 */
  29.598 +	if ((regs->xcs & 2) != 2)
  29.599 +		return 1;
  29.600 +
  29.601 +	if (!oldset)
  29.602 +		oldset = &current->blocked;
  29.603 +
  29.604 +	for (;;) {
  29.605 +		unsigned long signr;
  29.606 +
  29.607 +		spin_lock_irq(&current->sigmask_lock);
  29.608 +		signr = dequeue_signal(&current->blocked, &info);
  29.609 +		spin_unlock_irq(&current->sigmask_lock);
  29.610 +
  29.611 +		if (!signr)
  29.612 +			break;
  29.613 +
  29.614 +		if ((current->ptrace & PT_PTRACED) && signr != SIGKILL) {
  29.615 +			/* Let the debugger run.  */
  29.616 +			current->exit_code = signr;
  29.617 +			current->state = TASK_STOPPED;
  29.618 +			notify_parent(current, SIGCHLD);
  29.619 +			schedule();
  29.620 +
  29.621 +			/* We're back.  Did the debugger cancel the sig?  */
  29.622 +			if (!(signr = current->exit_code))
  29.623 +				continue;
  29.624 +			current->exit_code = 0;
  29.625 +
  29.626 +			/* The debugger continued.  Ignore SIGSTOP.  */
  29.627 +			if (signr == SIGSTOP)
  29.628 +				continue;
  29.629 +
  29.630 +			/* Update the siginfo structure.  Is this good?  */
  29.631 +			if (signr != info.si_signo) {
  29.632 +				info.si_signo = signr;
  29.633 +				info.si_errno = 0;
  29.634 +				info.si_code = SI_USER;
  29.635 +				info.si_pid = current->p_pptr->pid;
  29.636 +				info.si_uid = current->p_pptr->uid;
  29.637 +			}
  29.638 +
  29.639 +			/* If the (new) signal is now blocked, requeue it.  */
  29.640 +			if (sigismember(&current->blocked, signr)) {
  29.641 +				send_sig_info(signr, &info, current);
  29.642 +				continue;
  29.643 +			}
  29.644 +		}
  29.645 +
  29.646 +		ka = &current->sig->action[signr-1];
  29.647 +		if (ka->sa.sa_handler == SIG_IGN) {
  29.648 +			if (signr != SIGCHLD)
  29.649 +				continue;
  29.650 +			/* Check for SIGCHLD: it's special.  */
  29.651 +			while (sys_wait4(-1, NULL, WNOHANG, NULL) > 0)
  29.652 +				/* nothing */;
  29.653 +			continue;
  29.654 +		}
  29.655 +
  29.656 +		if (ka->sa.sa_handler == SIG_DFL) {
  29.657 +			int exit_code = signr;
  29.658 +
  29.659 +			/* Init gets no signals it doesn't want.  */
  29.660 +			if (current->pid == 1)
  29.661 +				continue;
  29.662 +
  29.663 +			switch (signr) {
  29.664 +			case SIGCONT: case SIGCHLD: case SIGWINCH: case SIGURG:
  29.665 +				continue;
  29.666 +
  29.667 +			case SIGTSTP: case SIGTTIN: case SIGTTOU:
  29.668 +				if (is_orphaned_pgrp(current->pgrp))
  29.669 +					continue;
  29.670 +				/* FALLTHRU */
  29.671 +
  29.672 +			case SIGSTOP: {
  29.673 +				struct signal_struct *sig;
  29.674 +				current->state = TASK_STOPPED;
  29.675 +				current->exit_code = signr;
  29.676 +				sig = current->p_pptr->sig;
  29.677 +				if (sig && !(sig->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDSTOP))
  29.678 +					notify_parent(current, SIGCHLD);
  29.679 +				schedule();
  29.680 +				continue;
  29.681 +			}
  29.682 +
  29.683 +			case SIGQUIT: case SIGILL: case SIGTRAP:
  29.684 +			case SIGABRT: case SIGFPE: case SIGSEGV:
  29.685 +			case SIGBUS: case SIGSYS: case SIGXCPU: case SIGXFSZ:
  29.686 +				if (do_coredump(signr, regs))
  29.687 +					exit_code |= 0x80;
  29.688 +				/* FALLTHRU */
  29.689 +
  29.690 +			default:
  29.691 +				sig_exit(signr, exit_code, &info);
  29.692 +				/* NOTREACHED */
  29.693 +			}
  29.694 +		}
  29.695 +
  29.696 +		/* Reenable any watchpoints before delivering the
  29.697 +		 * signal to user space. The processor register will
  29.698 +		 * have been cleared if the watchpoint triggered
  29.699 +		 * inside the kernel.
  29.700 +		 */
  29.701 +                if ( current->thread.debugreg[7] != 0 )
  29.702 +                    HYPERVISOR_set_debugreg(7, current->thread.debugreg[7]);
  29.703 +
  29.704 +		/* Whee!  Actually deliver the signal.  */
  29.705 +		handle_signal(signr, ka, &info, oldset, regs);
  29.706 +		return 1;
  29.707 +	}
  29.708 +
  29.709 +	/* Did we come from a system call? */
  29.710 +	if (regs->orig_eax >= 0) {
  29.711 +		/* Restart the system call - no handlers present */
  29.712 +		if (regs->eax == -ERESTARTNOHAND ||
  29.713 +		    regs->eax == -ERESTARTSYS ||
  29.714 +		    regs->eax == -ERESTARTNOINTR) {
  29.715 +			regs->eax = regs->orig_eax;
  29.716 +			regs->eip -= 2;
  29.717 +		}
  29.718 +	}
  29.719 +	return 0;
  29.720 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/time.c	Mon Jul 11 09:29:56 2005 -0500
    30.3 @@ -0,0 +1,721 @@
    30.4 +/* -*-  Mode:C; c-basic-offset:4; tab-width:4 -*-
    30.5 + ****************************************************************************
    30.6 + * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
    30.7 + * (C) 2002-2003 - Keir Fraser - University of Cambridge
    30.8 + ****************************************************************************
    30.9 + *
   30.10 + *        File: arch/xen/kernel/time.c
   30.11 + *      Author: Rolf Neugebauer and Keir Fraser
   30.12 + * 
   30.13 + * Description: Interface with Xen to get correct notion of time
   30.14 + */
   30.15 +
   30.16 +/*
   30.17 + *  linux/arch/i386/kernel/time.c
   30.18 + *
   30.19 + *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
   30.20 + *
   30.21 + * This file contains the PC-specific time handling details:
   30.22 + * reading the RTC at bootup, etc..
   30.23 + * 1994-07-02    Alan Modra
   30.24 + * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
   30.25 + * 1995-03-26    Markus Kuhn
   30.26 + *      fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
   30.27 + *      precision CMOS clock update
   30.28 + * 1996-05-03    Ingo Molnar
   30.29 + *      fixed time warps in do_[slow|fast]_gettimeoffset()
   30.30 + * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
   30.31 + *  "A Kernel Model for Precision Timekeeping" by Dave Mills
   30.32 + * 1998-09-05    (Various)
   30.33 + * More robust do_fast_gettimeoffset() algorithm implemented
   30.34 + * (works with APM, Cyrix 6x86MX and Centaur C6),
   30.35 + * monotonic gettimeofday() with fast_get_timeoffset(),
   30.36 + * drift-proof precision TSC calibration on boot
   30.37 + * (C. Scott Ananian <cananian@alumni.princeton.edu>, Andrew D.
   30.38 + * Balsa <andrebalsa@altern.org>, Philip Gladstone <philip@raptor.com>;
   30.39 + * ported from 2.0.35 Jumbo-9 by Michael Krause <m.krause@tu-harburg.de>).
   30.40 + * 1998-12-16    Andrea Arcangeli
   30.41 + * Fixed Jumbo-9 code in 2.1.131: do_gettimeofday was missing 1 jiffy
   30.42 + * because was not accounting lost_ticks.
   30.43 + * 1998-12-24 Copyright (C) 1998  Andrea Arcangeli
   30.44 + * Fixed a xtime SMP race (we need the xtime_lock rw spinlock to
   30.45 + * serialize accesses to xtime/lost_ticks).
   30.46 + */
   30.47 +
   30.48 +#include <asm/smp.h>
   30.49 +#include <asm/irq.h>
   30.50 +#include <asm/msr.h>
   30.51 +#include <asm/delay.h>
   30.52 +#include <asm/mpspec.h>
   30.53 +#include <asm/uaccess.h>
   30.54 +#include <asm/processor.h>
   30.55 +
   30.56 +#include <asm/div64.h>
   30.57 +#include <asm/hypervisor.h>
   30.58 +#include <asm-xen/xen-public/dom0_ops.h>
   30.59 +
   30.60 +#include <linux/mc146818rtc.h>
   30.61 +#include <linux/kernel.h>
   30.62 +#include <linux/interrupt.h>
   30.63 +#include <linux/time.h>
   30.64 +#include <linux/init.h>
   30.65 +#include <linux/smp.h>
   30.66 +#include <linux/irq.h>
   30.67 +#include <linux/sysctl.h>
   30.68 +#include <linux/sysrq.h>
   30.69 +
   30.70 +spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
   30.71 +extern rwlock_t xtime_lock;
   30.72 +extern unsigned long wall_jiffies;
   30.73 +
   30.74 +unsigned long cpu_khz; /* get this from Xen, used elsewhere */
   30.75 +
   30.76 +static unsigned int rdtsc_bitshift;
   30.77 +static u32 st_scale_f; /* convert ticks -> usecs */
   30.78 +static u32 st_scale_i; /* convert ticks -> usecs */
   30.79 +
   30.80 +/* These are peridically updated in shared_info, and then copied here. */
   30.81 +static u32 shadow_tsc_stamp;
   30.82 +static u64 shadow_system_time;
   30.83 +static u32 shadow_time_version;
   30.84 +static struct timeval shadow_tv;
   30.85 +
   30.86 +/*
   30.87 + * We use this to ensure that gettimeofday() is monotonically increasing. We
   30.88 + * only break this guarantee if the wall clock jumps backwards "a long way".
   30.89 + */
   30.90 +static struct timeval last_seen_tv = {0,0};
   30.91 +
   30.92 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
   30.93 +/* Periodically propagate synchronised time base to the RTC and to Xen. */
   30.94 +static long last_update_to_rtc, last_update_to_xen;
   30.95 +#endif
   30.96 +
   30.97 +/* Periodically take synchronised time base from Xen, if we need it. */
   30.98 +static long last_update_from_xen;   /* UTC seconds when last read Xen clock. */
   30.99 +
  30.100 +/* Keep track of last time we did processing/updating of jiffies and xtime. */
  30.101 +static u64 processed_system_time;   /* System time (ns) at last processing. */
  30.102 +
  30.103 +#define NS_PER_TICK (1000000000ULL/HZ)
  30.104 +
  30.105 +#ifndef NSEC_PER_SEC
  30.106 +#define NSEC_PER_SEC (1000000000L)
  30.107 +#endif
  30.108 +
  30.109 +#define HANDLE_USEC_UNDERFLOW(_tv)         \
  30.110 +    do {                                   \
  30.111 +        while ( (_tv).tv_usec < 0 )        \
  30.112 +        {                                  \
  30.113 +            (_tv).tv_usec += 1000000;      \
  30.114 +            (_tv).tv_sec--;                \
  30.115 +        }                                  \
  30.116 +    } while ( 0 )
  30.117 +#define HANDLE_USEC_OVERFLOW(_tv)          \
  30.118 +    do {                                   \
  30.119 +        while ( (_tv).tv_usec >= 1000000 ) \
  30.120 +        {                                  \
  30.121 +            (_tv).tv_usec -= 1000000;      \
  30.122 +            (_tv).tv_sec++;                \
  30.123 +        }                                  \
  30.124 +    } while ( 0 )
  30.125 +static inline void __normalize_time(time_t *sec, s64 *nsec)
  30.126 +{
  30.127 +	while (*nsec >= NSEC_PER_SEC) {
  30.128 +		(*nsec) -= NSEC_PER_SEC;
  30.129 +		(*sec)++;
  30.130 +	}
  30.131 +	while (*nsec < 0) {
  30.132 +		(*nsec) += NSEC_PER_SEC;
  30.133 +		(*sec)--;
  30.134 +	}
  30.135 +}
  30.136 +
  30.137 +/* Dynamically-mapped IRQs. */
  30.138 +static int time_irq, debug_irq;
  30.139 +
  30.140 +/* Does this guest OS track Xen time, or set its wall clock independently? */
  30.141 +static int independent_wallclock = 0;
  30.142 +static int __init __independent_wallclock(char *str)
  30.143 +{
  30.144 +    independent_wallclock = 1;
  30.145 +    return 1;
  30.146 +}
  30.147 +__setup("independent_wallclock", __independent_wallclock);
  30.148 +#define INDEPENDENT_WALLCLOCK() \
  30.149 +    (independent_wallclock || (xen_start_info.flags & SIF_INITDOMAIN))
  30.150 +
  30.151 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  30.152 +/*
  30.153 + * In order to set the CMOS clock precisely, set_rtc_mmss has to be
  30.154 + * called 500 ms after the second nowtime has started, because when
  30.155 + * nowtime is written into the registers of the CMOS clock, it will
  30.156 + * jump to the next second precisely 500 ms later. Check the Motorola
  30.157 + * MC146818A or Dallas DS12887 data sheet for details.
  30.158 + *
  30.159 + * BUG: This routine does not handle hour overflow properly; it just
  30.160 + *      sets the minutes. Usually you'll only notice that after reboot!
  30.161 + */
  30.162 +static int set_rtc_mmss(unsigned long nowtime)
  30.163 +{
  30.164 +    int retval = 0;
  30.165 +    int real_seconds, real_minutes, cmos_minutes;
  30.166 +    unsigned char save_control, save_freq_select;
  30.167 +
  30.168 +    /* gets recalled with irq locally disabled */
  30.169 +    spin_lock(&rtc_lock);
  30.170 +    save_control = CMOS_READ(RTC_CONTROL);
  30.171 +    CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
  30.172 +
  30.173 +    save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
  30.174 +    CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
  30.175 +
  30.176 +    cmos_minutes = CMOS_READ(RTC_MINUTES);
  30.177 +    if ( !(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD )
  30.178 +        BCD_TO_BIN(cmos_minutes);
  30.179 +
  30.180 +    /*
  30.181 +     * since we're only adjusting minutes and seconds, don't interfere with
  30.182 +     * hour overflow. This avoids messing with unknown time zones but requires
  30.183 +     * your RTC not to be off by more than 15 minutes
  30.184 +     */
  30.185 +    real_seconds = nowtime % 60;
  30.186 +    real_minutes = nowtime / 60;
  30.187 +    if ( ((abs(real_minutes - cmos_minutes) + 15)/30) & 1 )
  30.188 +        real_minutes += 30;  /* correct for half hour time zone */
  30.189 +    real_minutes %= 60;
  30.190 +
  30.191 +    if ( abs(real_minutes - cmos_minutes) < 30 )
  30.192 +    {
  30.193 +        if ( !(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD )
  30.194 +        {
  30.195 +            BIN_TO_BCD(real_seconds);
  30.196 +            BIN_TO_BCD(real_minutes);
  30.197 +        }
  30.198 +        CMOS_WRITE(real_seconds,RTC_SECONDS);
  30.199 +        CMOS_WRITE(real_minutes,RTC_MINUTES);
  30.200 +    }
  30.201 +    else 
  30.202 +    {
  30.203 +        printk(KERN_WARNING
  30.204 +               "set_rtc_mmss: can't update from %d to %d\n",
  30.205 +               cmos_minutes, real_minutes);
  30.206 +        retval = -1;
  30.207 +    }
  30.208 +
  30.209 +    /* The following flags have to be released exactly in this order,
  30.210 +     * otherwise the DS12887 (popular MC146818A clone with integrated
  30.211 +     * battery and quartz) will not reset the oscillator and will not
  30.212 +     * update precisely 500 ms later. You won't find this mentioned in
  30.213 +     * the Dallas Semiconductor data sheets, but who believes data
  30.214 +     * sheets anyway ...                           -- Markus Kuhn
  30.215 +     */
  30.216 +    CMOS_WRITE(save_control, RTC_CONTROL);
  30.217 +    CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
  30.218 +    spin_unlock(&rtc_lock);
  30.219 +
  30.220 +    return retval;
  30.221 +}
  30.222 +#endif
  30.223 +
  30.224 +
  30.225 +/*
  30.226 + * Reads a consistent set of time-base values from Xen, into a shadow data
  30.227 + * area. Must be called with the xtime_lock held for writing.
  30.228 + */
  30.229 +static void __get_time_values_from_xen(void)
  30.230 +{
  30.231 +    do {
  30.232 +        shadow_time_version = HYPERVISOR_shared_info->time_version2;
  30.233 +        rmb();
  30.234 +        shadow_tv.tv_sec    = HYPERVISOR_shared_info->wc_sec;
  30.235 +        shadow_tv.tv_usec   = HYPERVISOR_shared_info->wc_usec;
  30.236 +        shadow_tsc_stamp    = 
  30.237 +            (u32)(HYPERVISOR_shared_info->tsc_timestamp >> rdtsc_bitshift);
  30.238 +        shadow_system_time  = HYPERVISOR_shared_info->system_time;
  30.239 +        rmb();
  30.240 +    }
  30.241 +    while ( shadow_time_version != HYPERVISOR_shared_info->time_version1 );
  30.242 +}
  30.243 +
  30.244 +#define TIME_VALUES_UP_TO_DATE \
  30.245 + ({ rmb(); (shadow_time_version == HYPERVISOR_shared_info->time_version2); })
  30.246 +
  30.247 +
  30.248 +/*
  30.249 + * Returns the system time elapsed, in ns, since the current shadow_timestamp
  30.250 + * was calculated. Must be called with the xtime_lock held for reading.
  30.251 + */
  30.252 +static inline unsigned long __get_time_delta_usecs(void)
  30.253 +{
  30.254 +    s32      delta_tsc;
  30.255 +    u32      low;
  30.256 +    u64      delta, tsc;
  30.257 +
  30.258 +    rdtscll(tsc);
  30.259 +    low = (u32)(tsc >> rdtsc_bitshift);
  30.260 +    delta_tsc = (s32)(low - shadow_tsc_stamp);
  30.261 +    if ( unlikely(delta_tsc < 0) ) delta_tsc = 0;
  30.262 +    delta = ((u64)delta_tsc * st_scale_f);
  30.263 +    delta >>= 32;
  30.264 +    delta += ((u64)delta_tsc * st_scale_i);
  30.265 +
  30.266 +    return (unsigned long)delta;
  30.267 +}
  30.268 +
  30.269 +
  30.270 +/*
  30.271 + * Returns the current time-of-day in UTC timeval format.
  30.272 + */
  30.273 +void do_gettimeofday(struct timeval *tv)
  30.274 +{
  30.275 +    unsigned long flags, lost;
  30.276 +    struct timeval _tv;
  30.277 +    s64 nsec;
  30.278 +
  30.279 + again:
  30.280 +    read_lock_irqsave(&xtime_lock, flags);
  30.281 +
  30.282 +    _tv.tv_usec = __get_time_delta_usecs();
  30.283 +    if ( (lost = (jiffies - wall_jiffies)) != 0 )
  30.284 +        _tv.tv_usec += lost * (1000000 / HZ);
  30.285 +    _tv.tv_sec   = xtime.tv_sec;
  30.286 +    _tv.tv_usec += xtime.tv_usec;
  30.287 +
  30.288 +    nsec = shadow_system_time - processed_system_time;
  30.289 +    __normalize_time(&_tv.tv_sec, &nsec);
  30.290 +    _tv.tv_usec += (long)nsec / 1000L;
  30.291 +
  30.292 +    if ( unlikely(!TIME_VALUES_UP_TO_DATE) )
  30.293 +    {
  30.294 +        /*
  30.295 +         * We may have blocked for a long time, rendering our calculations
  30.296 +         * invalid (e.g. the time delta may have overflowed). Detect that
  30.297 +         * and recalculate with fresh values.
  30.298 +         */
  30.299 +        read_unlock_irqrestore(&xtime_lock, flags);
  30.300 +        write_lock_irqsave(&xtime_lock, flags);
  30.301 +        __get_time_values_from_xen();
  30.302 +        write_unlock_irqrestore(&xtime_lock, flags);
  30.303 +        goto again;
  30.304 +    }
  30.305 +
  30.306 +    HANDLE_USEC_OVERFLOW(_tv);
  30.307 +
  30.308 +    /* Ensure that time-of-day is monotonically increasing. */
  30.309 +    if ( (_tv.tv_sec < last_seen_tv.tv_sec) ||
  30.310 +         ((_tv.tv_sec == last_seen_tv.tv_sec) &&
  30.311 +          (_tv.tv_usec < last_seen_tv.tv_usec)) )
  30.312 +        _tv = last_seen_tv;
  30.313 +    last_seen_tv = _tv;
  30.314 +
  30.315 +    read_unlock_irqrestore(&xtime_lock, flags);
  30.316 +
  30.317 +    *tv = _tv;
  30.318 +}
  30.319 +
  30.320 +
  30.321 +/*
  30.322 + * Sets the current time-of-day based on passed-in UTC timeval parameter.
  30.323 + */
  30.324 +void do_settimeofday(struct timeval *tv)
  30.325 +{
  30.326 +    struct timeval newtv;
  30.327 +    s64            nsec;
  30.328 +    suseconds_t    usec;
  30.329 +    
  30.330 +    if ( !INDEPENDENT_WALLCLOCK() )
  30.331 +        return;
  30.332 +    
  30.333 +    write_lock_irq(&xtime_lock);
  30.334 +    
  30.335 +    /*
  30.336 +     * Ensure we don't get blocked for a long time so that our time delta
  30.337 +     * overflows. If that were to happen then our shadow time values would
  30.338 +     * be stale, so we can retry with fresh ones.
  30.339 +     */
  30.340 + again:
  30.341 +    usec = tv->tv_usec - __get_time_delta_usecs();
  30.342 +
  30.343 +    nsec = shadow_system_time - processed_system_time;
  30.344 +    __normalize_time(&tv->tv_sec, &nsec);
  30.345 +    usec -= (long)nsec / 1000L;
  30.346 +
  30.347 +    if ( unlikely(!TIME_VALUES_UP_TO_DATE) )
  30.348 +    {
  30.349 +        __get_time_values_from_xen();
  30.350 +        goto again;
  30.351 +    }
  30.352 +    tv->tv_usec = usec;
  30.353 +    
  30.354 +    HANDLE_USEC_UNDERFLOW(*tv);
  30.355 +    
  30.356 +    newtv = *tv;
  30.357 +    
  30.358 +    tv->tv_usec -= (jiffies - wall_jiffies) * (1000000 / HZ);
  30.359 +    HANDLE_USEC_UNDERFLOW(*tv);
  30.360 +
  30.361 +    xtime = *tv;
  30.362 +    time_adjust = 0;  /* stop active adjtime() */
  30.363 +    time_status |= STA_UNSYNC;
  30.364 +    time_maxerror = NTP_PHASE_LIMIT;
  30.365 +    time_esterror = NTP_PHASE_LIMIT;
  30.366 +
  30.367 +    /* Reset all our running time counts. They make no sense now. */
  30.368 +    last_seen_tv.tv_sec = 0;
  30.369 +    last_update_from_xen = 0;
  30.370 +
  30.371 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  30.372 +    if ( xen_start_info.flags & SIF_INITDOMAIN )
  30.373 +    {
  30.374 +        dom0_op_t op;
  30.375 +        last_update_to_rtc = last_update_to_xen = 0;
  30.376 +        op.cmd = DOM0_SETTIME;
  30.377 +        op.u.settime.secs        = newtv.tv_sec;
  30.378 +        op.u.settime.usecs       = newtv.tv_usec;
  30.379 +        op.u.settime.system_time = shadow_system_time;
  30.380 +        write_unlock_irq(&xtime_lock);
  30.381 +        HYPERVISOR_dom0_op(&op);
  30.382 +    }
  30.383 +    else
  30.384 +#endif
  30.385 +    {
  30.386 +        write_unlock_irq(&xtime_lock);
  30.387 +    }
  30.388 +}
  30.389 +
  30.390 +
  30.391 +asmlinkage long sys_stime(int *tptr)
  30.392 +{
  30.393 +    int value;
  30.394 +    struct timeval tv;
  30.395 +
  30.396 +    if ( !capable(CAP_SYS_TIME) )
  30.397 +        return -EPERM;
  30.398 +
  30.399 +    if ( get_user(value, tptr) )
  30.400 +        return -EFAULT;
  30.401 +
  30.402 +    tv.tv_sec  = value;
  30.403 +    tv.tv_usec = 0;
  30.404 +
  30.405 +    do_settimeofday(&tv);
  30.406 +
  30.407 +    return 0;
  30.408 +}
  30.409 +
  30.410 +
  30.411 +/* Convert jiffies to system time. Call with xtime_lock held for reading. */
  30.412 +static inline u64 __jiffies_to_st(unsigned long j) 
  30.413 +{
  30.414 +    return processed_system_time + ((j - jiffies) * NS_PER_TICK);
  30.415 +}
  30.416 +
  30.417 +
  30.418 +static inline void do_timer_interrupt(int irq, void *dev_id,
  30.419 +                                      struct pt_regs *regs)
  30.420 +{
  30.421 +    s64 delta;
  30.422 +    unsigned long ticks = 0;
  30.423 +    long sec_diff;
  30.424 +
  30.425 +    do {
  30.426 +        __get_time_values_from_xen();
  30.427 +        
  30.428 +        delta = (s64)(shadow_system_time + 
  30.429 +                      ((s64)__get_time_delta_usecs() * 1000LL) -
  30.430 +                      processed_system_time);
  30.431 +    }
  30.432 +    while ( !TIME_VALUES_UP_TO_DATE );
  30.433 +
  30.434 +    if ( unlikely(delta < 0) )
  30.435 +    {
  30.436 +        printk("Timer ISR: Time went backwards: %lld\n", delta);
  30.437 +        return;
  30.438 +    }
  30.439 +
  30.440 +    /* Process elapsed jiffies since last call. */
  30.441 +    while ( delta >= NS_PER_TICK )
  30.442 +    {
  30.443 +        ticks++;
  30.444 +        delta -= NS_PER_TICK;
  30.445 +        processed_system_time += NS_PER_TICK;
  30.446 +    }
  30.447 +
  30.448 +    if ( ticks != 0 )
  30.449 +    {
  30.450 +        do_timer_ticks(ticks);
  30.451 +
  30.452 +        if ( user_mode(regs) )
  30.453 +            update_process_times_us(ticks, 0);
  30.454 +        else
  30.455 +            update_process_times_us(0, ticks);
  30.456 +    }
  30.457 +
  30.458 +    /*
  30.459 +     * Take synchronised time from Xen once a minute if we're not
  30.460 +     * synchronised ourselves, and we haven't chosen to keep an independent
  30.461 +     * time base.
  30.462 +     */
  30.463 +    if ( !INDEPENDENT_WALLCLOCK() &&
  30.464 +         ((time_status & STA_UNSYNC) != 0) &&
  30.465 +         (xtime.tv_sec > (last_update_from_xen + 60)) )
  30.466 +    {
  30.467 +        /* Adjust shadow timeval for jiffies that haven't updated xtime yet. */
  30.468 +        shadow_tv.tv_usec -= (jiffies - wall_jiffies) * (1000000/HZ);
  30.469 +        HANDLE_USEC_UNDERFLOW(shadow_tv);
  30.470 +
  30.471 +        /*
  30.472 +         * Reset our running time counts if they are invalidated by a warp
  30.473 +         * backwards of more than 500ms.
  30.474 +         */
  30.475 +        sec_diff = xtime.tv_sec - shadow_tv.tv_sec;
  30.476 +        if ( unlikely(abs(sec_diff) > 1) ||
  30.477 +             unlikely(((sec_diff * 1000000) + 
  30.478 +                       xtime.tv_usec - shadow_tv.tv_usec) > 500000) )
  30.479 +        {
  30.480 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  30.481 +            last_update_to_rtc = last_update_to_xen = 0;
  30.482 +#endif
  30.483 +            last_seen_tv.tv_sec = 0;
  30.484 +        }
  30.485 +
  30.486 +        /* Update our unsynchronised xtime appropriately. */
  30.487 +        xtime = shadow_tv;
  30.488 +
  30.489 +        last_update_from_xen = xtime.tv_sec;
  30.490 +    }
  30.491 +
  30.492 +#ifdef CONFIG_XEN_PRIVILEGED_GUEST
  30.493 +    if ( (xen_start_info.flags & SIF_INITDOMAIN) &&
  30.494 +         ((time_status & STA_UNSYNC) == 0) )
  30.495 +    {
  30.496 +        /* Send synchronised time to Xen approximately every minute. */
  30.497 +        if ( xtime.tv_sec > (last_update_to_xen + 60) )
  30.498 +        {
  30.499 +            dom0_op_t op;
  30.500 +            struct timeval tv = xtime;
  30.501 +
  30.502 +            tv.tv_usec += (jiffies - wall_jiffies) * (1000000/HZ);
  30.503 +            HANDLE_USEC_OVERFLOW(tv);
  30.504 +
  30.505 +            op.cmd = DOM0_SETTIME;
  30.506 +            op.u.settime.secs        = tv.tv_sec;
  30.507 +            op.u.settime.usecs       = tv.tv_usec;
  30.508 +            op.u.settime.system_time = shadow_system_time;
  30.509 +            HYPERVISOR_dom0_op(&op);
  30.510 +
  30.511 +            last_update_to_xen = xtime.tv_sec;
  30.512 +        }
  30.513 +
  30.514 +        /*
  30.515 +         * If we have an externally synchronized Linux clock, then update CMOS
  30.516 +         * clock accordingly every ~11 minutes. Set_rtc_mmss() has to be called
  30.517 +         * as close as possible to 500 ms before the new second starts.
  30.518 +         */
  30.519 +        if ( (xtime.tv_sec > (last_update_to_rtc + 660)) &&
  30.520 +             (xtime.tv_usec >= (500000 - ((unsigned) tick) / 2)) &&
  30.521 +             (xtime.tv_usec <= (500000 + ((unsigned) tick) / 2)) )
  30.522 +        {
  30.523 +            if ( set_rtc_mmss(xtime.tv_sec) == 0 )
  30.524 +                last_update_to_rtc = xtime.tv_sec;
  30.525 +            else
  30.526 +                last_update_to_rtc = xtime.tv_sec - 600;
  30.527 +        }
  30.528 +    }
  30.529 +#endif
  30.530 +}
  30.531 +
  30.532 +
  30.533 +static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  30.534 +{
  30.535 +    write_lock(&xtime_lock);
  30.536 +    do_timer_interrupt(irq, NULL, regs);
  30.537 +    write_unlock(&xtime_lock);
  30.538 +}
  30.539 +
  30.540 +static struct irqaction irq_timer = {
  30.541 +    timer_interrupt, 
  30.542 +    SA_INTERRUPT, 
  30.543 +    0, 
  30.544 +    "timer", 
  30.545 +    NULL, 
  30.546 +    NULL
  30.547 +};
  30.548 +
  30.549 +
  30.550 +/*
  30.551 + * This function works out when the the next timer function has to be
  30.552 + * executed (by looking at the timer list) and sets the Xen one-shot
  30.553 + * domain timer to the appropriate value. This is typically called in
  30.554 + * cpu_idle() before the domain blocks.
  30.555 + * 
  30.556 + * The function returns a non-0 value on error conditions.
  30.557 + * 
  30.558 + * It must be called with interrupts disabled.
  30.559 + */
  30.560 +extern spinlock_t timerlist_lock;
  30.561 +int set_timeout_timer(void)
  30.562 +{
  30.563 +    struct timer_list *timer;
  30.564 +    u64 alarm = 0;
  30.565 +    int ret = 0;
  30.566 +
  30.567 +    spin_lock(&timerlist_lock);
  30.568 +
  30.569 +    /*
  30.570 +     * This is safe against long blocking (since calculations are not based on 
  30.571 +     * TSC deltas). It is also safe against warped system time since
  30.572 +     * suspend-resume is cooperative and we would first get locked out. It is 
  30.573 +     * safe against normal updates of jiffies since interrupts are off.
  30.574 +     */
  30.575 +    if ( (timer = next_timer_event()) != NULL )
  30.576 +        alarm = __jiffies_to_st(timer->expires);
  30.577 +
  30.578 +    /* Tasks on the timer task queue expect to be executed on the next tick. */
  30.579 +    if ( TQ_ACTIVE(tq_timer) )
  30.580 +        alarm = __jiffies_to_st(jiffies + 1);
  30.581 +
  30.582 +    /* Failure is pretty bad, but we'd best soldier on. */
  30.583 +    if ( HYPERVISOR_set_timer_op(alarm) != 0 )
  30.584 +        ret = -1;
  30.585 +    
  30.586 +    spin_unlock(&timerlist_lock);
  30.587 +
  30.588 +    return ret;
  30.589 +}
  30.590 +
  30.591 +
  30.592 +/* Time debugging. */
  30.593 +static void dbg_time_int(int irq, void *dev_id, struct pt_regs *ptregs)
  30.594 +{
  30.595 +    unsigned long flags, j;
  30.596 +    u64 s_now, j_st;
  30.597 +    struct timeval s_tv, tv;
  30.598 +
  30.599 +    struct timer_list *timer;
  30.600 +    u64 t_st;
  30.601 +
  30.602 +    read_lock_irqsave(&xtime_lock, flags);
  30.603 +    s_tv.tv_sec  = shadow_tv.tv_sec;
  30.604 +    s_tv.tv_usec = shadow_tv.tv_usec;
  30.605 +    s_now        = shadow_system_time;
  30.606 +    read_unlock_irqrestore(&xtime_lock, flags);
  30.607 +
  30.608 +    do_gettimeofday(&tv);
  30.609 +
  30.610 +    j = jiffies;
  30.611 +    j_st = __jiffies_to_st(j);
  30.612 +
  30.613 +    timer = next_timer_event();
  30.614 +    t_st = __jiffies_to_st(timer->expires);
  30.615 +
  30.616 +    printk(KERN_ALERT "time: shadow_st=0x%X:%08X\n",
  30.617 +           (u32)(s_now>>32), (u32)s_now);
  30.618 +    printk(KERN_ALERT "time: wct=%lds %ldus shadow_wct=%lds %ldus\n",
  30.619 +           tv.tv_sec, tv.tv_usec, s_tv.tv_sec, s_tv.tv_usec);
  30.620 +    printk(KERN_ALERT "time: jiffies=%lu(0x%X:%08X) timeout=%lu(0x%X:%08X)\n",
  30.621 +           jiffies,(u32)(j_st>>32), (u32)j_st,
  30.622 +           timer->expires,(u32)(t_st>>32), (u32)t_st);
  30.623 +    printk(KERN_ALERT "time: processed_system_time=0x%X:%08X\n",
  30.624 +           (u32)(processed_system_time>>32), (u32)processed_system_time);
  30.625 +
  30.626 +#ifdef CONFIG_MAGIC_SYSRQ
  30.627 +    handle_sysrq('t',NULL,NULL,NULL);
  30.628 +#endif
  30.629 +}
  30.630 +
  30.631 +static struct irqaction dbg_time = {
  30.632 +    dbg_time_int, 
  30.633 +    SA_SHIRQ, 
  30.634 +    0, 
  30.635 +    "timer_dbg", 
  30.636 +    &dbg_time_int,
  30.637 +    NULL
  30.638 +};
  30.639 +
  30.640 +void __init time_init(void)
  30.641 +{
  30.642 +    unsigned long long alarm;
  30.643 +    u64 __cpu_khz, __cpu_ghz, cpu_freq, scale, scale2;
  30.644 +    unsigned int cpu_ghz;
  30.645 +
  30.646 +    __cpu_khz = __cpu_ghz = cpu_freq = HYPERVISOR_shared_info->cpu_freq;
  30.647 +    do_div(__cpu_khz, 1000UL);
  30.648 +    cpu_khz = (u32)__cpu_khz;
  30.649 +    do_div(__cpu_ghz, 1000000000UL);
  30.650 +    cpu_ghz = (unsigned int)__cpu_ghz;
  30.651 +
  30.652 +    printk("Xen reported: %lu.%03lu MHz processor.\n", 
  30.653 +           cpu_khz / 1000, cpu_khz % 1000);
  30.654 +
  30.655 +    xtime.tv_sec = HYPERVISOR_shared_info->wc_sec;
  30.656 +    xtime.tv_usec = HYPERVISOR_shared_info->wc_usec;
  30.657 +    processed_system_time = shadow_system_time;
  30.658 +
  30.659 +    for ( rdtsc_bitshift = 0; cpu_ghz != 0; rdtsc_bitshift++, cpu_ghz >>= 1 )
  30.660 +        continue;
  30.661 +
  30.662 +    scale = 1000000LL << (32 + rdtsc_bitshift);
  30.663 +    do_div(scale, (u32)cpu_freq);
  30.664 +
  30.665 +    if ( (cpu_freq >> 32) != 0 )
  30.666 +    {
  30.667 +        scale2 = 1000000LL << rdtsc_bitshift;
  30.668 +        do_div(scale2, (u32)(cpu_freq>>32));
  30.669 +        scale += scale2;
  30.670 +    }
  30.671 +
  30.672 +    st_scale_f = scale & 0xffffffff;
  30.673 +    st_scale_i = scale >> 32;
  30.674 +
  30.675 +    __get_time_values_from_xen();
  30.676 +    processed_system_time = shadow_system_time;
  30.677 +
  30.678 +    time_irq  = bind_virq_to_irq(VIRQ_TIMER);
  30.679 +    debug_irq = bind_virq_to_irq(VIRQ_DEBUG);
  30.680 +
  30.681 +    (void)setup_irq(time_irq, &irq_timer);
  30.682 +    (void)setup_irq(debug_irq, &dbg_time);
  30.683 +
  30.684 +    rdtscll(alarm);
  30.685 +}
  30.686 +
  30.687 +void time_suspend(void)
  30.688 +{
  30.689 +}
  30.690 +
  30.691 +void time_resume(void)
  30.692 +{
  30.693 +    unsigned long flags;
  30.694 +    write_lock_irqsave(&xtime_lock, flags);
  30.695 +    /* Get timebases for new environment. */ 
  30.696 +    __get_time_values_from_xen();
  30.697 +    /* Reset our own concept of passage of system time. */
  30.698 +    processed_system_time = shadow_system_time;
  30.699 +    /* Accept a warp in UTC (wall-clock) time. */
  30.700 +    last_seen_tv.tv_sec = 0;
  30.701 +    /* Make sure we resync UTC time with Xen on next timer interrupt. */
  30.702 +    last_update_from_xen = 0;
  30.703 +    write_unlock_irqrestore(&xtime_lock, flags);
  30.704 +}
  30.705 +
  30.706 +/*
  30.707 + * /proc/sys/xen: This really belongs in another file. It can stay here for
  30.708 + * now however.
  30.709 + */
  30.710 +static ctl_table xen_subtable[] = {
  30.711 +    {1, "independent_wallclock", &independent_wallclock,
  30.712 +     sizeof(independent_wallclock), 0644, NULL, proc_dointvec},
  30.713 +    {0}
  30.714 +};
  30.715 +static ctl_table xen_table[] = {
  30.716 +    {123, "xen", NULL, 0, 0555, xen_subtable},
  30.717 +    {0}
  30.718 +};
  30.719 +static int __init xen_sysctl_init(void)
  30.720 +{
  30.721 +    (void)register_sysctl_table(xen_table, 0);
  30.722 +    return 0;
  30.723 +}
  30.724 +__initcall(xen_sysctl_init);
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/linux-2.4-xen-sparse/arch/xen/kernel/traps.c	Mon Jul 11 09:29:56 2005 -0500
    31.3 @@ -0,0 +1,619 @@
    31.4 +/*
    31.5 + *  linux/arch/i386/traps.c
    31.6 + *
    31.7 + *  Copyright (C) 1991, 1992  Linus Torvalds
    31.8 + *
    31.9 + *  Pentium III FXSR, SSE support
   31.10 + *	Gareth Hughes <gareth@valinux.com>, May 2000
   31.11 + */
   31.12 +
   31.13 +/*
   31.14 + * 'Traps.c' handles hardware traps and faults after we have saved some
   31.15 + * state in 'asm.s'.
   31.16 + */
   31.17 +#include <linux/config.h>
   31.18 +#include <linux/sched.h>
   31.19 +#include <linux/kernel.h>
   31.20 +#include <linux/string.h>
   31.21 +#include <linux/errno.h>
   31.22 +#include <linux/ptrace.h>
   31.23 +#include <linux/timer.h>
   31.24 +#include <linux/mm.h>
   31.25 +#include <linux/init.h>
   31.26 +#include <linux/delay.h>
   31.27 +#include <linux/spinlock.h>
   31.28 +#include <linux/interrupt.h>
   31.29 +#include <linux/highmem.h>
   31.30 +
   31.31 +#include <asm/system.h>
   31.32 +#include <asm/uaccess.h>
   31.33 +#include <asm/io.h>
   31.34 +#include <asm/atomic.h>
   31.35 +#include <asm/debugreg.h>
   31.36 +#include <asm/desc.h>
   31.37 +#include <asm/i387.h>
   31.38 +
   31.39 +#include <asm/smp.h>
   31.40 +#include <asm/pgalloc.h>
   31.41 +
   31.42 +#include <asm/hypervisor.h>
   31.43 +
   31.44 +#include <linux/irq.h>
   31.45 +#include <linux/module.h>
   31.46 +
   31.47 +asmlinkage int system_call(void);
   31.48 +asmlinkage void lcall7(void);
   31.49 +asmlinkage void lcall27(void);
   31.50 +
   31.51 +asmlinkage void divide_error(void);
   31.52 +asmlinkage void debug(void);
   31.53 +asmlinkage void int3(void);
   31.54 +asmlinkage void overflow(void);
   31.55 +asmlinkage void bounds(void);
   31.56 +asmlinkage void invalid_op(void);
   31.57 +asmlinkage void device_not_available(void);
   31.58 +asmlinkage void double_fault(void);
   31.59 +asmlinkage void coprocessor_segment_overrun(void);
   31.60 +asmlinkage void invalid_TSS(void);
   31.61 +asmlinkage void segment_not_present(void);
   31.62 +asmlinkage void stack_segment(void);
   31.63 +asmlinkage void general_protection(void);
   31.64 +asmlinkage void page_fault(void);
   31.65 +asmlinkage void coprocessor_error(void);
   31.66 +asmlinkage void simd_coprocessor_error(void);
   31.67 +asmlinkage void alignment_check(void);
   31.68 +asmlinkage void fixup_4gb_segment(void);
   31.69 +asmlinkage void machine_check(void);
   31.70 +
   31.71 +int kstack_depth_to_print = 24;
   31.72 +
   31.73 +
   31.74 +/*
   31.75 + * If the address is either in the .text section of the
   31.76 + * kernel, or in the vmalloc'ed module regions, it *may* 
   31.77 + * be the address of a calling routine
   31.78 + */
   31.79 +
   31.80 +#ifdef CONFIG_MODULES
   31.81 +
   31.82 +extern struct module *module_list;
   31.83 +extern struct module kernel_module;
   31.84 +
   31.85 +static inline int kernel_text_address(unsigned long addr)
   31.86 +{
   31.87 +	int retval = 0;
   31.88 +	struct module *mod;
   31.89 +
   31.90 +	if (addr >= (unsigned long) &_stext &&
   31.91 +	    addr <= (unsigned long) &_etext)
   31.92 +		return 1;
   31.93 +
   31.94 +	for (mod = module_list; mod != &kernel_module; mod = mod->next) {
   31.95 +		/* mod_bound tests for addr being inside the vmalloc'ed
   31.96 +		 * module area. Of course it'd be better to test only
   31.97 +		 * for the .text subset... */
   31.98 +		if (mod_bound(addr, 0, mod)) {
   31.99 +			retval = 1;
  31.100 +			break;
  31.101 +		}
  31.102 +	}
  31.103 +
  31.104 +	return retval;
  31.105 +}
  31.106 +
  31.107 +#else
  31.108 +
  31.109 +static inline int kernel_text_address(unsigned long addr)
  31.110 +{
  31.111 +	return (addr >= (unsigned long) &_stext &&
  31.112 +		addr <= (unsigned long) &_etext);
  31.113 +}
  31.114 +
  31.115 +#endif
  31.116 +
  31.117 +void show_trace(unsigned long * stack)
  31.118 +{
  31.119 +	int i;
  31.120 +	unsigned long addr;
  31.121 +
  31.122 +	if (!stack)
  31.123 +		stack = (unsigned long*)&stack;
  31.124 +
  31.125 +	printk("Call Trace: ");
  31.126 +	i = 1;
  31.127 +	while (((long) stack & (THREAD_SIZE-1)) != 0) {
  31.128 +		addr = *stack++;
  31.129 +		if (kernel_text_address(addr)) {
  31.130 +			if (i && ((i % 6) == 0))
  31.131 +				printk("\n   ");
  31.132 +			printk("[<%08lx>] ", addr);
  31.133 +			i++;
  31.134 +		}
  31.135 +	}
  31.136 +	printk("\n");
  31.137 +}
  31.138 +
  31.139 +void show_trace_task(struct task_struct *tsk)
  31.140 +{
  31.141 +	unsigned long esp = tsk->thread.esp;
  31.142 +
  31.143 +	/* User space on another CPU? */
  31.144 +	if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
  31.145 +		return;
  31.146 +	show_trace((unsigned long *)esp);
  31.147 +}
  31.148 +
  31.149 +void show_stack(unsigned long * esp)
  31.150 +{
  31.151 +	unsigned long *stack;
  31.152 +	int i;
  31.153 +
  31.154 +	// debugging aid: "show_stack(NULL);" prints the
  31.155 +	// back trace for this cpu.
  31.156 +
  31.157 +	if(esp==NULL)
  31.158 +		esp=(unsigned long*)&esp;
  31.159 +
  31.160 +	stack = esp;
  31.161 +	for(i=0; i < kstack_depth_to_print; i++) {
  31.162 +		if (((long) stack & (THREAD_SIZE-1)) == 0)
  31.163 +			break;
  31.164 +		if (i && ((i % 8) == 0))
  31.165 +			printk("\n       ");
  31.166 +		printk("%08lx ", *stack++);
  31.167 +	}
  31.168 +	printk("\n");
  31.169 +	show_trace(esp);
  31.170 +}
  31.171 +
  31.172 +void show_registers(struct pt_regs *regs)
  31.173 +{
  31.174 +	int in_kernel = 1;
  31.175 +	unsigned long esp;
  31.176 +	unsigned short ss;
  31.177 +
  31.178 +	esp = (unsigned long) (&regs->esp);
  31.179 +	ss = __KERNEL_DS;
  31.180 +	if (regs->xcs & 2) {
  31.181 +		in_kernel = 0;
  31.182 +		esp = regs->esp;
  31.183 +		ss = regs->xss & 0xffff;
  31.184 +	}
  31.185 +	printk(KERN_ALERT "CPU:    %d\n", smp_processor_id() );
  31.186 +	printk(KERN_ALERT "EIP:    %04x:[<%08lx>]    %s\n",
  31.187 +	       0xffff & regs->xcs, regs->eip, print_tainted());
  31.188 +	printk(KERN_ALERT "EFLAGS: %08lx\n",regs->eflags);
  31.189 +	printk(KERN_ALERT "eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
  31.190 +		regs->eax, regs->ebx, regs->ecx, regs->edx);
  31.191 +	printk(KERN_ALERT "esi: %08lx   edi: %08lx   ebp: %08lx   esp: %08lx\n",
  31.192 +		regs->esi, regs->edi, regs->ebp, esp);
  31.193 +	printk(KERN_ALERT "ds: %04x   es: %04x   ss: %04x\n",
  31.194 +		regs->xds & 0xffff, regs->xes & 0xffff, ss);
  31.195 +	printk(KERN_ALERT "Process %s (pid: %d, stackpage=%08lx)",
  31.196 +		current->comm, current->pid, 4096+(unsigned long)current);
  31.197 +	/*
  31.198 +	 * When in-kernel, we also print out the stack and code at the
  31.199 +	 * time of the fault..
  31.200 +	 */
  31.201 +	if (in_kernel) {
  31.202 +
  31.203 +		printk(KERN_ALERT "\nStack: ");
  31.204 +		show_stack((unsigned long*)esp);
  31.205 +
  31.206 +#if 0
  31.207 +                {
  31.208 +                        int i;
  31.209 +			printk(KERN_ALERT "\nCode: ");
  31.210 +			if(regs->eip < PAGE_OFFSET)
  31.211 +			        goto bad;
  31.212 +
  31.213 +			for(i=0;i<20;i++)
  31.214 +			{
  31.215 +			        unsigned char c;
  31.216 +			        if(__get_user(c, &((unsigned char*)regs->eip)[i])) {
  31.217 +bad:
  31.218 +				        printk(KERN_ALERT " Bad EIP value.");
  31.219 +					break;
  31.220 +				}
  31.221 +				printk("%02x ", c);
  31.222 +			}
  31.223 +		}
  31.224 +#endif
  31.225 +	}
  31.226 +	printk(KERN_ALERT "\n");
  31.227 +}	
  31.228 +
  31.229 +spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
  31.230 +
  31.231 +void die(const char * str, struct pt_regs * regs, long err)
  31.232 +{
  31.233 +	console_verbose();
  31.234 +	spin_lock_irq(&die_lock);
  31.235 +	bust_spinlocks(1);
  31.236 +	printk("%s: %04lx\n", str, err & 0xffff);
  31.237 +	show_registers(regs);
  31.238 +	bust_spinlocks(0);
  31.239 +	spin_unlock_irq(&die_lock);
  31.240 +	do_exit(SIGSEGV);
  31.241 +}
  31.242 +
  31.243 +static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
  31.244 +{
  31.245 +	if (!(2 & regs->xcs))
  31.246 +		die(str, regs, err);
  31.247 +}
  31.248 +
  31.249 +
  31.250 +static void inline do_trap(int trapnr, int signr, char *str,
  31.251 +			   struct pt_regs * regs, long error_code,
  31.252 +                           siginfo_t *info)
  31.253 +{
  31.254 +	if (!(regs->xcs & 2))
  31.255 +		goto kernel_trap;
  31.256 +
  31.257 +	/*trap_signal:*/ {
  31.258 +		struct task_struct *tsk = current;
  31.259 +		tsk->thread.error_code = error_code;
  31.260 +		tsk->thread.trap_no = trapnr;
  31.261 +		if (info)
  31.262 +			force_sig_info(signr, info, tsk);
  31.263 +		else
  31.264 +			force_sig(signr, tsk);
  31.265 +		return;
  31.266 +	}
  31.267 +
  31.268 +	kernel_trap: {
  31.269 +		unsigned long fixup = search_exception_table(regs->eip);
  31.270 +		if (fixup)
  31.271 +			regs->eip = fixup;
  31.272 +		else	
  31.273 +			die(str, regs, error_code);
  31.274 +		return;
  31.275 +	}
  31.276 +}
  31.277 +
  31.278 +#define DO_ERROR(trapnr, signr, str, name) \
  31.279 +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
  31.280 +{ \
  31.281 +	do_trap(trapnr, signr, str, regs, error_code, NULL); \
  31.282 +}
  31.283 +
  31.284 +#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
  31.285 +asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
  31.286 +{ \
  31.287 +	siginfo_t info; \
  31.288 +	info.si_signo = signr; \
  31.289 +	info.si_errno = 0; \
  31.290 +	info.si_code = sicode; \
  31.291 +	info.si_addr = (void *)siaddr; \
  31.292 +	do_trap(trapnr, signr, str, regs, error_code, &info); \
  31.293 +}
  31.294 +
  31.295 +DO_ERROR_INFO( 0, SIGFPE,  "divide error", divide_error, FPE_INTDIV, regs->eip)
  31.296 +DO_ERROR( 3, SIGTRAP, "int3", int3)
  31.297 +DO_ERROR( 4, SIGSEGV, "overflow", overflow)
  31.298 +DO_ERROR( 5, SIGSEGV, "bounds", bounds)
  31.299 +DO_ERROR_INFO( 6, SIGILL,  "invalid operand", invalid_op, ILL_ILLOPN, regs->eip)
  31.300 +DO_ERROR( 7, SIGSEGV, "device not available", device_not_available)
  31.301 +DO_ERROR( 8, SIGSEGV, "double fault", double_fault)
  31.302 +DO_ERROR( 9, SIGFPE,  "coprocessor segment overrun", coprocessor_segment_overrun)
  31.303 +DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
  31.304 +DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
  31.305 +DO_ERROR(12, SIGBUS,  "stack segment", stack_segment)
  31.306 +DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
  31.307 +DO_ERROR(18, SIGBUS, "machine check", machine_check)
  31.308 +
  31.309 +asmlinkage void do_general_protection(struct pt_regs * regs, long error_code)
  31.310 +{
  31.311 +	/*
  31.312 +	 * If we trapped on an LDT access then ensure that the default_ldt is
  31.313 +	 * loaded, if nothing else. We load default_ldt lazily because LDT
  31.314 +	 * switching costs time and many applications don't need it.
  31.315 +	 */
  31.316 +	if ( unlikely((error_code & 6) == 4) )
  31.317 +	{
  31.318 +		unsigned long ldt;
  31.319 +		__asm__ __volatile__ ( "sldt %0" : "=r" (ldt) );
  31.320 +		if ( ldt == 0 )
  31.321 +		{
  31.322 +                    xen_set_ldt((unsigned long)&default_ldt[0], 5);
  31.323 +		    return;
  31.324 +		}
  31.325 +	}
  31.326 +
  31.327 +	if (!(regs->xcs & 2))
  31.328 +		goto gp_in_kernel;
  31.329 +
  31.330 +	current->thread.error_code = error_code;
  31.331 +	current->thread.trap_no = 13;
  31.332 +	force_sig(SIGSEGV, current);
  31.333 +	return;
  31.334 +
  31.335 +gp_in_kernel:
  31.336 +	{
  31.337 +		unsigned long fixup;
  31.338 +		fixup = search_exception_table(regs->eip);
  31.339 +		if (fixup) {
  31.340 +			regs->eip = fixup;
  31.341 +			return;
  31.342 +		}
  31.343 +		die("general protection fault", regs, error_code);
  31.344 +	}
  31.345 +}
  31.346 +
  31.347 +
  31.348 +asmlinkage void do_debug(struct pt_regs * regs, long error_code)
  31.349 +{
  31.350 +    unsigned int condition;
  31.351 +    struct task_struct *tsk = current;
  31.352 +    siginfo_t info;
  31.353 +
  31.354 +    condition = HYPERVISOR_get_debugreg(6);
  31.355 +
  31.356 +    /* Mask out spurious debug traps due to lazy DR7 setting */
  31.357 +    if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
  31.358 +        if (!tsk->thread.debugreg[7])
  31.359 +            goto clear_dr7;
  31.360 +    }
  31.361 +
  31.362 +    /* Save debug status register where ptrace can see it */
  31.363 +    tsk->thread.debugreg[6] = condition;
  31.364 +
  31.365 +    /* Mask out spurious TF errors due to lazy TF clearing */
  31.366 +    if (condition & DR_STEP) {
  31.367 +        /*
  31.368 +         * The TF error should be masked out only if the current
  31.369 +         * process is not traced and if the TRAP flag has been set
  31.370 +         * previously by a tracing process (condition detected by
  31.371 +         * the PT_DTRACE flag); remember that the i386 TRAP flag
  31.372 +         * can be modified by the process itself in user mode,
  31.373 +         * allowing programs to debug themselves without the ptrace()
  31.374 +         * interface.
  31.375 +         */
  31.376 +        if ((tsk->ptrace & (PT_DTRACE|PT_PTRACED)) == PT_DTRACE)
  31.377 +            goto clear_TF;
  31.378 +    }
  31.379 +
  31.380 +    /* Ok, finally something we can handle */
  31.381 +    tsk->thread.trap_no = 1;
  31.382 +    tsk->thread.error_code = error_code;
  31.383 +    info.si_signo = SIGTRAP;
  31.384 +    info.si_errno = 0;
  31.385 +    info.si_code = TRAP_BRKPT;
  31.386 +        
  31.387 +    /* If this is a kernel mode trap, save the user PC on entry to 
  31.388 +     * the kernel, that's what the debugger can make sense of.
  31.389 +     */
  31.390 +    info.si_addr = ((regs->xcs & 2) == 0) ? (void *)tsk->thread.eip : 
  31.391 +                                            (void *)regs->eip;
  31.392 +    force_sig_info(SIGTRAP, &info, tsk);
  31.393 +
  31.394 +    /* Disable additional traps. They'll be re-enabled when
  31.395 +     * the signal is delivered.
  31.396 +     */
  31.397 + clear_dr7:
  31.398 +    HYPERVISOR_set_debugreg(7, 0);
  31.399 +    return;
  31.400 +
  31.401 + clear_TF:
  31.402 +    regs->eflags &= ~TF_MASK;
  31.403 +    return;
  31.404 +}
  31.405 +
  31.406 +
  31.407 +/*
  31.408 + * Note that we play around with the 'TS' bit in an attempt to get
  31.409 + * the correct behaviour even in the presence of the asynchronous
  31.410 + * IRQ13 behaviour
  31.411 + */
  31.412 +void math_error(void *eip)
  31.413 +{
  31.414 +	struct task_struct * task;
  31.415 +	siginfo_t info;
  31.416 +	unsigned short cwd, swd;
  31.417 +
  31.418 +	/*
  31.419 +	 * Save the info for the exception handler and clear the error.
  31.420 +	 */
  31.421 +	task = current;
  31.422 +	save_init_fpu(task);
  31.423 +	task->thread.trap_no = 16;
  31.424 +	task->thread.error_code = 0;
  31.425 +	info.si_signo = SIGFPE;
  31.426 +	info.si_errno = 0;
  31.427 +	info.si_code = __SI_FAULT;
  31.428 +	info.si_addr = eip;
  31.429 +	/*
  31.430 +	 * (~cwd & swd) will mask out exceptions that are not set to unmasked
  31.431 +	 * status.  0x3f is the exception bits in these regs, 0x200 is the
  31.432 +	 * C1 reg you need in case of a stack fault, 0x040 is the stack
  31.433 +	 * fault bit.  We should only be taking one exception at a time,
  31.434 +	 * so if this combination doesn't produce any single exception,
  31.435 +	 * then we have a bad program that isn't syncronizing its FPU usage
  31.436 +	 * and it will suffer the consequences since we won't be able to
  31.437 +	 * fully reproduce the context of the exception
  31.438 +	 */
  31.439 +	cwd = get_fpu_cwd(task);
  31.440 +	swd = get_fpu_swd(task);
  31.441 +	switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) {
  31.442 +		case 0x000:
  31.443 +		default:
  31.444 +			break;
  31.445 +		case 0x001: /* Invalid Op */
  31.446 +		case 0x041: /* Stack Fault */
  31.447 +		case 0x241: /* Stack Fault | Direction */
  31.448 +			info.si_code = FPE_FLTINV;
  31.449 +			break;
  31.450 +		case 0x002: /* Denormalize */
  31.451 +		case 0x010: /* Underflow */
  31.452 +			info.si_code = FPE_FLTUND;
  31.453 +			break;
  31.454 +		case 0x004: /* Zero Divide */
  31.455 +			info.si_code = FPE_FLTDIV;
  31.456 +			break;
  31.457 +		case 0x008: /* Overflow */
  31.458 +			info.si_code = FPE_FLTOVF;
  31.459 +			break;
  31.460 +		case 0x020: /* Precision */
  31.461 +			info.si_code = FPE_FLTRES;
  31.462 +			break;
  31.463 +	}
  31.464 +	force_sig_info(SIGFPE, &info, task);
  31.465 +}
  31.466 +
  31.467 +asmlinkage void do_coprocessor_error(struct pt_regs * regs, long error_code)
  31.468 +{
  31.469 +	ignore_irq13 = 1;
  31.470 +	math_error((void *)regs->eip);
  31.471 +}
  31.472 +
  31.473 +void simd_math_error(void *eip)
  31.474 +{
  31.475 +	struct task_struct * task;
  31.476 +	siginfo_t info;
  31.477 +	unsigned short mxcsr;
  31.478 +
  31.479 +	/*
  31.480 +	 * Save the info for the exception handler and clear the error.
  31.481 +	 */
  31.482 +	task = current;
  31.483 +	save_init_fpu(task);
  31.484 +	task->thread.trap_no = 19;
  31.485 +	task->thread.error_code = 0;
  31.486 +	info.si_signo = SIGFPE;
  31.487 +	info.si_errno = 0;
  31.488 +	info.si_code = __SI_FAULT;
  31.489 +	info.si_addr = eip;
  31.490 +	/*
  31.491 +	 * The SIMD FPU exceptions are handled a little differently, as there
  31.492 +	 * is only a single status/control register.  Thus, to determine which
  31.493 +	 * unmasked exception was caught we must mask the exception mask bits
  31.494 +	 * at 0x1f80, and then use these to mask the exception bits at 0x3f.
  31.495 +	 */
  31.496 +	mxcsr = get_fpu_mxcsr(task);
  31.497 +	switch (~((mxcsr & 0x1f80) >> 7) & (mxcsr & 0x3f)) {
  31.498 +		case 0x000:
  31.499 +		default:
  31.500 +			break;
  31.501 +		case 0x001: /* Invalid Op */
  31.502 +			info.si_code = FPE_FLTINV;
  31.503 +			break;
  31.504 +		case 0x002: /* Denormalize */
  31.505 +		case 0x010: /* Underflow */
  31.506 +			info.si_code = FPE_FLTUND;
  31.507 +			break;
  31.508 +		case 0x004: /* Zero Divide */
  31.509 +			info.si_code = FPE_FLTDIV;
  31.510 +			break;
  31.511 +		case 0x008: /* Overflow */
  31.512 +			info.si_code = FPE_FLTOVF;
  31.513 +			break;
  31.514 +		case 0x020: /* Precision */
  31.515 +			info.si_code = FPE_FLTRES;
  31.516 +			break;
  31.517 +	}
  31.518 +	force_sig_info(SIGFPE, &info, task);
  31.519 +}
  31.520 +
  31.521 +asmlinkage void do_simd_coprocessor_error(struct pt_regs * regs,
  31.522 +					  long error_code)
  31.523 +{
  31.524 +	if (cpu_has_xmm) {
  31.525 +		/* Handle SIMD FPU exceptions on PIII+ processors. */
  31.526 +		ignore_irq13 = 1;
  31.527 +		simd_math_error((void *)regs->eip);
  31.528 +	} else {
  31.529 +		die_if_kernel("cache flush denied", regs, error_code);
  31.530 +		current->thread.trap_no = 19;
  31.531 +		current->thread.error_code = error_code;
  31.532 +		force_sig(SIGSEGV, current);
  31.533 +	}
  31.534 +}
  31.535 +
  31.536 +/*
  31.537 + *  'math_state_restore()' saves the current math information in the
  31.538 + * old math state array, and gets the new ones from the current task
  31.539 + *
  31.540 + * Careful.. There are problems with IBM-designed IRQ13 behaviour.
  31.541 + * Don't touch unless you *really* know how it works.
  31.542 + */
  31.543 +asmlinkage void math_state_restore(struct pt_regs regs)
  31.544 +{
  31.545 +	/*
  31.546 +	 * A trap in kernel mode can be ignored. It'll be the fast XOR or
  31.547 +	 * copying libraries, which will correctly save/restore state and
  31.548 +	 * reset the TS bit in CR0.
  31.549 +	 */
  31.550 +	if ( (regs.xcs & 2) == 0 )
  31.551 +		return;
  31.552 +
  31.553 +	if (current->used_math) {
  31.554 +		restore_fpu(current);
  31.555 +	} else {
  31.556 +		init_fpu();
  31.557 +	}
  31.558 +	current->flags |= PF_USEDFPU;	/* So we fnsave on switch_to() */
  31.559 +}
  31.560 +
  31.561 +
  31.562 +#define _set_gate(gate_addr,type,dpl,addr) \
  31.563 +do { \
  31.564 +  int __d0, __d1; \
  31.565 +  __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \
  31.566 +	"movw %4,%%dx\n\t" \
  31.567 +	"movl %%eax,%0\n\t" \
  31.568 +	"movl %%edx,%1" \
  31.569 +	:"=m" (*((long *) (gate_addr))), \
  31.570 +	 "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \
  31.571 +	:"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
  31.572 +	 "3" ((char *) (addr)),"2" (__KERNEL_CS << 16)); \
  31.573 +} while (0)
  31.574 +
  31.575 +static void __init set_call_gate(void *a, void *addr)
  31.576 +{
  31.577 +	_set_gate(a,12,3,addr);
  31.578 +}
  31.579 +
  31.580 +
  31.581 +/* NB. All these are "trap gates" (i.e. events_mask isn't cleared). */
  31.582 +static trap_info_t trap_table[] = {
  31.583 +    {  0, 0, __KERNEL_CS, (unsigned long)divide_error                },
  31.584 +    {  1, 0, __KERNEL_CS, (unsigned long)debug                       },
  31.585 +    {  3, 3, __KERNEL_CS, (unsigned long)int3                        },
  31.586 +    {  4, 3, __KERNEL_CS, (unsigned long)overflow                    },
  31.587 +    {  5, 3, __KERNEL_CS, (unsigned long)bounds                      },
  31.588 +    {  6, 0, __KERNEL_CS, (unsigned long)invalid_op                  },
  31.589 +    {  7, 0, __KERNEL_CS, (unsigned long)device_not_available        },
  31.590 +    {  8, 0, __KERNEL_CS, (unsigned long)double_fault                },
  31.591 +    {  9, 0, __KERNEL_CS, (unsigned long)coprocessor_segment_overrun },
  31.592 +    { 10, 0, __KERNEL_CS, (unsigned long)invalid_TSS                 },
  31.593 +    { 11, 0, __KERNEL_CS, (unsigned long)segment_not_present         },
  31.594 +    { 12, 0, __KERNEL_CS, (unsigned long)stack_segment               },
  31.595 +    { 13, 0, __KERNEL_CS, (unsigned long)general_protection          },
  31.596 +    { 14, 0, __KERNEL_CS, (unsigned long)page_fault                  },
  31.597 +    { 15, 0, __KERNEL_CS, (unsigned long)fixup_4gb_segment           },
  31.598 +    { 16, 0, __KERNEL_CS, (unsigned long)coprocessor_error           },
  31.599 +    { 17, 0, __KERNEL_CS, (unsigned long)alignment_check             },
  31.600 +    { 18, 0, __KERNEL_CS, (unsigned long)machine_check               },
  31.601 +    { 19, 0, __KERNEL_CS, (unsigned long)simd_coprocessor_error      },
  31.602 +    { SYSCALL_VECTOR, 
  31.603 +          3, __KERNEL_CS, (unsigned long)system_call                 },
  31.604 +    {  0, 0,           0, 0                           }
  31.605 +};
  31.606 +
  31.607 +
  31.608 +void __init trap_init(void)
  31.609 +{
  31.610 +    HYPERVISOR_set_trap_table(trap_table);    
  31.611 +
  31.612 +    /*
  31.613 +     * The default LDT is a single-entry callgate to lcall7 for iBCS and a
  31.614 +     * callgate to lcall27 for Solaris/x86 binaries.
  31.615 +     */
  31.616 +    clear_page(&default_ldt[0]);
  31.617 +    set_call_gate(&default_ldt[0],lcall7);
  31.618 +    set_call_gate(&default_ldt[4],lcall27);
  31.619 +    __make_page_readonly(&default_ldt[0]);
  31.620 +
  31.621 +    cpu_init();
  31.622 +}
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/linux-2.4-xen-sparse/arch/xen/lib/Makefile	Mon Jul 11 09:29:56 2005 -0500
    32.3 @@ -0,0 +1,15 @@
    32.4 +
    32.5 +.S.o:
    32.6 +	$(CC) $(AFLAGS) -c $< -o $*.o
    32.7 +
    32.8 +L_TARGET = lib.a
    32.9 +
   32.10 +obj-y = checksum.o old-checksum.o delay.o \
   32.11 +	usercopy.o getuser.o \
   32.12 +	memcpy.o strstr.o xen_proc.o
   32.13 +
   32.14 +obj-$(CONFIG_X86_USE_3DNOW) += mmx.o
   32.15 +obj-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
   32.16 +obj-$(CONFIG_DEBUG_IOVIRT)  += iodebug.o
   32.17 +
   32.18 +include $(TOPDIR)/Rules.make
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/linux-2.4-xen-sparse/arch/xen/lib/delay.c	Mon Jul 11 09:29:56 2005 -0500
    33.3 @@ -0,0 +1,52 @@
    33.4 +/*
    33.5 + *	Precise Delay Loops for i386
    33.6 + *
    33.7 + *	Copyright (C) 1993 Linus Torvalds
    33.8 + *	Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
    33.9 + *
   33.10 + *	The __delay function must _NOT_ be inlined as its execution time
   33.11 + *	depends wildly on alignment on many x86 processors. The additional
   33.12 + *	jump magic is needed to get the timing stable on all the CPU's
   33.13 + *	we have to worry about.
   33.14 + */
   33.15 +
   33.16 +#include <linux/config.h>
   33.17 +#include <linux/sched.h>
   33.18 +#include <linux/delay.h>
   33.19 +#include <asm/processor.h>
   33.20 +#include <asm/delay.h>
   33.21