ia64/xen-unstable

changeset 3248:e9ae5958b2be

bitkeeper revision 1.1159.170.56 (41b4b01dWSU8yr3EZRTsBs0QnHMwxQ)

sync w/ head
author cl349@arcadians.cl.cam.ac.uk
date Mon Dec 06 19:16:45 2004 +0000 (2004-12-06)
parents f65b65977b19
children 2dfba7f4548c
files .rootkeys linux-2.4.27-xen-sparse/include/linux/irq.h linux-2.4.28-xen-sparse/include/linux/irq.h linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/entry.S linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c
line diff
     1.1 --- a/.rootkeys	Mon Nov 29 17:28:03 2004 +0000
     1.2 +++ b/.rootkeys	Mon Dec 06 19:16:45 2004 +0000
     1.3 @@ -44,7 +44,6 @@ 3f815145CB8XdPUqsmhAjSDFuwOoqA extras/mi
     1.4  3f815145vGYx1WY79voKkZB9yKwJKQ extras/mini-os/time.c
     1.5  3f815145xlKBAQmal9oces3G_Mvxqw extras/mini-os/traps.c
     1.6  4187ca95_eQN62ugV1zliQcfzXrHnw install.sh
     1.7 -419e0488SBzS3mdUhwgsES5a5e3abA linux-2.4.27-xen-sparse/include/linux/irq.h
     1.8  3e5a4e6589G-U42lFKs43plskXoFxQ linux-2.4.28-xen-sparse/Makefile
     1.9  3e5a4e65IEPjnWPZ5w3TxS5scV8Ewg linux-2.4.28-xen-sparse/arch/xen/Makefile
    1.10  3e5a4e65n-KhsEAs-A4ULiStBp-r6w linux-2.4.28-xen-sparse/arch/xen/boot/Makefile
    1.11 @@ -113,6 +112,7 @@ 3e5a4e68mTr0zcp9SXDbnd-XLrrfxw linux-2.4
    1.12  3f1056a9L_kqHcFheV00KbKBzv9j5w linux-2.4.28-xen-sparse/include/asm-xen/vga.h
    1.13  40659defgWA92arexpMGn8X3QMDj3w linux-2.4.28-xen-sparse/include/asm-xen/xor.h
    1.14  3f056927gMHl7mWB89rb73JahbhQIA linux-2.4.28-xen-sparse/include/linux/blk.h
    1.15 +419e0488SBzS3mdUhwgsES5a5e3abA linux-2.4.28-xen-sparse/include/linux/irq.h
    1.16  4124f66fPHG6yvB_vXmesjvzrJ3yMg linux-2.4.28-xen-sparse/include/linux/mm.h
    1.17  401c0590D_kwJDU59X8NyvqSv_Cl2A linux-2.4.28-xen-sparse/include/linux/sched.h
    1.18  40a248afgI0_JKthdYAe8beVfXSTpQ linux-2.4.28-xen-sparse/include/linux/skbuff.h
    1.19 @@ -139,6 +139,8 @@ 40f56238u2CJdXNpjsZgHBxeVyY-2g linux-2.6
    1.20  40f56238eczveJ86k_4hNxCLRQIF-g linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/Makefile
    1.21  40f56238rXVTJQKbBuXXLH52qEArcg linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/Makefile
    1.22  40f562385s4lr6Zg92gExe7UQ4A76Q linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/common.c
    1.23 +41ab440bnpxZdWShZrGgM9pPaz5rmA linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile
    1.24 +41ab440bBKWz-aEOEojU4PAMXe3Ppg linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c
    1.25  40f56238XDtHSijkAFlbv1PT8Bhw_Q linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/entry.S
    1.26  40f56238bnvciAuyzAiMkdzGErYt1A linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/head.S
    1.27  40f58a0d31M2EkuPbG94ns_nOi0PVA linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/i386_ksyms.c
    1.28 @@ -251,8 +253,6 @@ 412f46c0LJuKAgSPGoC0Z1DEkLfuLA linux-2.6
    1.29  410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.10-rc2-xen-sparse/mm/page_alloc.c
    1.30  41505c572m-s9ATiO1LiD1GPznTTIg linux-2.6.10-rc2-xen-sparse/net/core/skbuff.c
    1.31  4149ec79wMpIHdvbntxqVGLRZZjPxw linux-2.6.10-rc2-xen-sparse/net/ipv4/raw.c
    1.32 -41ab440bnpxZdWShZrGgM9pPaz5rmA linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile
    1.33 -41ab440bBKWz-aEOEojU4PAMXe3Ppg linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c
    1.34  413cb1e4zst25MDYjg63Y-NGC5_pLg netbsd-2.0-xen-sparse/Makefile
    1.35  413cb1e5c_Mkxf_X0zimEhTKI_l4DA netbsd-2.0-xen-sparse/mkbuildtree
    1.36  413cb1e5kY_Zil7-b0kI6hvCIxBEYg netbsd-2.0-xen-sparse/nbconfig-xen
     2.1 --- a/linux-2.4.27-xen-sparse/include/linux/irq.h	Mon Nov 29 17:28:03 2004 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,80 +0,0 @@
     2.4 -#ifndef __irq_h
     2.5 -#define __irq_h
     2.6 -
     2.7 -/*
     2.8 - * Please do not include this file in generic code.  There is currently
     2.9 - * no requirement for any architecture to implement anything held
    2.10 - * within this file.
    2.11 - *
    2.12 - * Thanks. --rmk
    2.13 - */
    2.14 -
    2.15 -#include <linux/config.h>
    2.16 -
    2.17 -#if !defined(CONFIG_ARCH_S390)
    2.18 -
    2.19 -#include <linux/cache.h>
    2.20 -#include <linux/spinlock.h>
    2.21 -
    2.22 -#include <asm/irq.h>
    2.23 -#include <asm/ptrace.h>
    2.24 -
    2.25 -/*
    2.26 - * IRQ line status.
    2.27 - */
    2.28 -#define IRQ_INPROGRESS	1	/* IRQ handler active - do not enter! */
    2.29 -#define IRQ_DISABLED	2	/* IRQ disabled - do not enter! */
    2.30 -#define IRQ_PENDING	4	/* IRQ pending - replay on enable */
    2.31 -#define IRQ_REPLAY	8	/* IRQ has been replayed but not acked yet */
    2.32 -#define IRQ_AUTODETECT	16	/* IRQ is being autodetected */
    2.33 -#define IRQ_WAITING	32	/* IRQ not yet seen - for autodetection */
    2.34 -#define IRQ_LEVEL	64	/* IRQ level triggered */
    2.35 -#define IRQ_MASKED	128	/* IRQ masked - shouldn't be seen again */
    2.36 -#define IRQ_PER_CPU	256	/* IRQ is per CPU */
    2.37 -
    2.38 -/*
    2.39 - * Interrupt controller descriptor. This is all we need
    2.40 - * to describe about the low-level hardware. 
    2.41 - */
    2.42 -struct hw_interrupt_type {
    2.43 -	const char * typename;
    2.44 -	unsigned int (*startup)(unsigned int irq);
    2.45 -	void (*shutdown)(unsigned int irq);
    2.46 -	void (*enable)(unsigned int irq);
    2.47 -	void (*disable)(unsigned int irq);
    2.48 -	void (*ack)(unsigned int irq);
    2.49 -	void (*end)(unsigned int irq);
    2.50 -	void (*set_affinity)(unsigned int irq, unsigned long mask);
    2.51 -};
    2.52 -
    2.53 -typedef struct hw_interrupt_type  hw_irq_controller;
    2.54 -
    2.55 -/*
    2.56 - * This is the "IRQ descriptor", which contains various information
    2.57 - * about the irq, including what kind of hardware handling it has,
    2.58 - * whether it is disabled etc etc.
    2.59 - *
    2.60 - * Pad this out to 32 bytes for cache and indexing reasons.
    2.61 - */
    2.62 -typedef struct {
    2.63 -	unsigned int status;		/* IRQ status */
    2.64 -	hw_irq_controller *handler;
    2.65 -	struct irqaction *action;	/* IRQ action list */
    2.66 -	unsigned int depth;		/* nested irq disables */
    2.67 -	spinlock_t lock;
    2.68 -} ____cacheline_aligned irq_desc_t;
    2.69 -
    2.70 -extern irq_desc_t irq_desc [NR_IRQS];
    2.71 -
    2.72 -#include <asm/hw_irq.h> /* the arch dependent stuff */
    2.73 -
    2.74 -extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
    2.75 -extern int setup_irq(unsigned int , struct irqaction * );
    2.76 -extern int teardown_irq(unsigned int , struct irqaction * );
    2.77 -
    2.78 -extern hw_irq_controller no_irq_type;  /* needed in every arch ? */
    2.79 -extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
    2.80 -
    2.81 -#endif
    2.82 -
    2.83 -#endif /* __irq_h */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/linux-2.4.28-xen-sparse/include/linux/irq.h	Mon Dec 06 19:16:45 2004 +0000
     3.3 @@ -0,0 +1,80 @@
     3.4 +#ifndef __irq_h
     3.5 +#define __irq_h
     3.6 +
     3.7 +/*
     3.8 + * Please do not include this file in generic code.  There is currently
     3.9 + * no requirement for any architecture to implement anything held
    3.10 + * within this file.
    3.11 + *
    3.12 + * Thanks. --rmk
    3.13 + */
    3.14 +
    3.15 +#include <linux/config.h>
    3.16 +
    3.17 +#if !defined(CONFIG_ARCH_S390)
    3.18 +
    3.19 +#include <linux/cache.h>
    3.20 +#include <linux/spinlock.h>
    3.21 +
    3.22 +#include <asm/irq.h>
    3.23 +#include <asm/ptrace.h>
    3.24 +
    3.25 +/*
    3.26 + * IRQ line status.
    3.27 + */
    3.28 +#define IRQ_INPROGRESS	1	/* IRQ handler active - do not enter! */
    3.29 +#define IRQ_DISABLED	2	/* IRQ disabled - do not enter! */
    3.30 +#define IRQ_PENDING	4	/* IRQ pending - replay on enable */
    3.31 +#define IRQ_REPLAY	8	/* IRQ has been replayed but not acked yet */
    3.32 +#define IRQ_AUTODETECT	16	/* IRQ is being autodetected */
    3.33 +#define IRQ_WAITING	32	/* IRQ not yet seen - for autodetection */
    3.34 +#define IRQ_LEVEL	64	/* IRQ level triggered */
    3.35 +#define IRQ_MASKED	128	/* IRQ masked - shouldn't be seen again */
    3.36 +#define IRQ_PER_CPU	256	/* IRQ is per CPU */
    3.37 +
    3.38 +/*
    3.39 + * Interrupt controller descriptor. This is all we need
    3.40 + * to describe about the low-level hardware. 
    3.41 + */
    3.42 +struct hw_interrupt_type {
    3.43 +	const char * typename;
    3.44 +	unsigned int (*startup)(unsigned int irq);
    3.45 +	void (*shutdown)(unsigned int irq);
    3.46 +	void (*enable)(unsigned int irq);
    3.47 +	void (*disable)(unsigned int irq);
    3.48 +	void (*ack)(unsigned int irq);
    3.49 +	void (*end)(unsigned int irq);
    3.50 +	void (*set_affinity)(unsigned int irq, unsigned long mask);
    3.51 +};
    3.52 +
    3.53 +typedef struct hw_interrupt_type  hw_irq_controller;
    3.54 +
    3.55 +/*
    3.56 + * This is the "IRQ descriptor", which contains various information
    3.57 + * about the irq, including what kind of hardware handling it has,
    3.58 + * whether it is disabled etc etc.
    3.59 + *
    3.60 + * Pad this out to 32 bytes for cache and indexing reasons.
    3.61 + */
    3.62 +typedef struct {
    3.63 +	unsigned int status;		/* IRQ status */
    3.64 +	hw_irq_controller *handler;
    3.65 +	struct irqaction *action;	/* IRQ action list */
    3.66 +	unsigned int depth;		/* nested irq disables */
    3.67 +	spinlock_t lock;
    3.68 +} ____cacheline_aligned irq_desc_t;
    3.69 +
    3.70 +extern irq_desc_t irq_desc [NR_IRQS];
    3.71 +
    3.72 +#include <asm/hw_irq.h> /* the arch dependent stuff */
    3.73 +
    3.74 +extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
    3.75 +extern int setup_irq(unsigned int , struct irqaction * );
    3.76 +extern int teardown_irq(unsigned int , struct irqaction * );
    3.77 +
    3.78 +extern hw_irq_controller no_irq_type;  /* needed in every arch ? */
    3.79 +extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
    3.80 +
    3.81 +#endif
    3.82 +
    3.83 +#endif /* __irq_h */
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile	Mon Dec 06 19:16:45 2004 +0000
     4.3 @@ -0,0 +1,16 @@
     4.4 +obj-y	:= main.o
     4.5 +c-obj-y	:= if.o
     4.6 +
     4.7 +c-link	:=
     4.8 +
     4.9 +$(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)): $(obj)/mtrr.h
    4.10 +	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/$(notdir $@) $@
    4.11 +
    4.12 +$(patsubst %.o,$(obj)/%.c,$(obj-y)): $(obj)/mtrr.h
    4.13 +
    4.14 +$(obj)/mtrr.h:
    4.15 +	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/mtrr.h $@
    4.16 +
    4.17 +obj-y	+= $(c-obj-y)
    4.18 +
    4.19 +clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c	Mon Dec 06 19:16:45 2004 +0000
     5.3 @@ -0,0 +1,165 @@
     5.4 +#include <linux/init.h>
     5.5 +#include <linux/proc_fs.h>
     5.6 +#include <linux/ctype.h>
     5.7 +#include <linux/module.h>
     5.8 +#include <linux/seq_file.h>
     5.9 +#include <asm/uaccess.h>
    5.10 +
    5.11 +#include <asm/mtrr.h>
    5.12 +#include "mtrr.h"
    5.13 +
    5.14 +void generic_get_mtrr(unsigned int reg, unsigned long *base,
    5.15 +		      unsigned int *size, mtrr_type * type)
    5.16 +{
    5.17 +	dom0_op_t op;
    5.18 +
    5.19 +	op.cmd = DOM0_READ_MEMTYPE;
    5.20 +	op.u.read_memtype.reg = reg;
    5.21 +	(void)HYPERVISOR_dom0_op(&op);
    5.22 +
    5.23 +	*size = op.u.read_memtype.nr_pfns;
    5.24 +	*base = op.u.read_memtype.pfn;
    5.25 +	*type = op.u.read_memtype.type;
    5.26 +}
    5.27 +
    5.28 +struct mtrr_ops generic_mtrr_ops = {
    5.29 +	.use_intel_if      = 1,
    5.30 +	.get               = generic_get_mtrr,
    5.31 +};
    5.32 +
    5.33 +struct mtrr_ops *mtrr_if = &generic_mtrr_ops;
    5.34 +unsigned int num_var_ranges;
    5.35 +unsigned int *usage_table;
    5.36 +
    5.37 +void __init set_num_var_ranges(void)
    5.38 +{
    5.39 +	dom0_op_t op;
    5.40 +
    5.41 +	for (num_var_ranges = 0; ; num_var_ranges++) {
    5.42 +		op.cmd = DOM0_READ_MEMTYPE;
    5.43 +		op.u.read_memtype.reg = num_var_ranges;
    5.44 +		if (HYPERVISOR_dom0_op(&op) != 0)
    5.45 +			break;
    5.46 +	}
    5.47 +}
    5.48 +
    5.49 +static void __init init_table(void)
    5.50 +{
    5.51 +	int i, max;
    5.52 +
    5.53 +	max = num_var_ranges;
    5.54 +	if ((usage_table = kmalloc(max * sizeof *usage_table, GFP_KERNEL))
    5.55 +	    == NULL) {
    5.56 +		printk(KERN_ERR "mtrr: could not allocate\n");
    5.57 +		return;
    5.58 +	}
    5.59 +	for (i = 0; i < max; i++)
    5.60 +		usage_table[i] = 0;
    5.61 +}
    5.62 +
    5.63 +int mtrr_add_page(unsigned long base, unsigned long size, 
    5.64 +		  unsigned int type, char increment)
    5.65 +{
    5.66 +	int error;
    5.67 +	dom0_op_t op;
    5.68 +
    5.69 +	op.cmd = DOM0_ADD_MEMTYPE;
    5.70 +	op.u.add_memtype.pfn     = base;
    5.71 +	op.u.add_memtype.nr_pfns = size;
    5.72 +	op.u.add_memtype.type    = type;
    5.73 +	if ((error = HYPERVISOR_dom0_op(&op)))
    5.74 +		return error;
    5.75 +
    5.76 +	if (increment)
    5.77 +		++usage_table[op.u.add_memtype.reg];
    5.78 +
    5.79 +	return op.u.add_memtype.reg;
    5.80 +}
    5.81 +
    5.82 +int
    5.83 +mtrr_add(unsigned long base, unsigned long size, unsigned int type,
    5.84 +	 char increment)
    5.85 +{
    5.86 +	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
    5.87 +		printk(KERN_WARNING "mtrr: size and base must be multiples of 4 kiB\n");
    5.88 +		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
    5.89 +		return -EINVAL;
    5.90 +	}
    5.91 +	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
    5.92 +			     increment);
    5.93 +}
    5.94 +
    5.95 +int mtrr_del_page(int reg, unsigned long base, unsigned long size)
    5.96 +{
    5.97 +	int i, max;
    5.98 +	mtrr_type ltype;
    5.99 +	unsigned long lbase;
   5.100 +	unsigned int lsize;
   5.101 +	int error = -EINVAL;
   5.102 +	dom0_op_t op;
   5.103 +
   5.104 +	max = num_var_ranges;
   5.105 +	if (reg < 0) {
   5.106 +		/*  Search for existing MTRR  */
   5.107 +		for (i = 0; i < max; ++i) {
   5.108 +			mtrr_if->get(i, &lbase, &lsize, &ltype);
   5.109 +			if (lbase == base && lsize == size) {
   5.110 +				reg = i;
   5.111 +				break;
   5.112 +			}
   5.113 +		}
   5.114 +		if (reg < 0) {
   5.115 +			printk(KERN_DEBUG "mtrr: no MTRR for %lx000,%lx000 found\n", base,
   5.116 +			       size);
   5.117 +			goto out;
   5.118 +		}
   5.119 +	}
   5.120 +	if (usage_table[reg] < 1) {
   5.121 +		printk(KERN_WARNING "mtrr: reg: %d has count=0\n", reg);
   5.122 +		goto out;
   5.123 +	}
   5.124 +	if (--usage_table[reg] < 1) {
   5.125 +		op.cmd = DOM0_DEL_MEMTYPE;
   5.126 +		op.u.del_memtype.handle = 0;
   5.127 +		op.u.add_memtype.reg    = reg;
   5.128 +		(void)HYPERVISOR_dom0_op(&op);
   5.129 +	}
   5.130 +	error = reg;
   5.131 + out:
   5.132 +	return error;
   5.133 +}
   5.134 +
   5.135 +int
   5.136 +mtrr_del(int reg, unsigned long base, unsigned long size)
   5.137 +{
   5.138 +	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
   5.139 +		printk(KERN_INFO "mtrr: size and base must be multiples of 4 kiB\n");
   5.140 +		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
   5.141 +		return -EINVAL;
   5.142 +	}
   5.143 +	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
   5.144 +}
   5.145 +
   5.146 +EXPORT_SYMBOL(mtrr_add);
   5.147 +EXPORT_SYMBOL(mtrr_del);
   5.148 +
   5.149 +static int __init mtrr_init(void)
   5.150 +{
   5.151 +	struct cpuinfo_x86 *c = &boot_cpu_data;
   5.152 +
   5.153 +	if (!(xen_start_info.flags & SIF_PRIVILEGED))
   5.154 +		return -ENODEV;
   5.155 +
   5.156 +	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
   5.157 +	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
   5.158 +	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
   5.159 +	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
   5.160 +		return -ENODEV;
   5.161 +
   5.162 +	set_num_var_ranges();
   5.163 +	init_table();
   5.164 +
   5.165 +	return 0;
   5.166 +}
   5.167 +
   5.168 +subsys_initcall(mtrr_init);
     6.1 --- a/linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/entry.S	Mon Nov 29 17:28:03 2004 +0000
     6.2 +++ b/linux-2.6.10-rc2-xen-sparse/arch/xen/i386/kernel/entry.S	Mon Dec 06 19:16:45 2004 +0000
     6.3 @@ -93,7 +93,7 @@ VM_MASK		= 0x00020000
     6.4  #define preempt_stop		XEN_BLOCK_EVENTS(%esi)
     6.5  #else
     6.6  #define preempt_stop
     6.7 -#define resume_kernel		restore_all_enable_events
     6.8 +#define resume_kernel		restore_all
     6.9  #endif
    6.10  
    6.11  #define SAVE_ALL_NO_EVENTMASK \
    6.12 @@ -109,7 +109,7 @@ VM_MASK		= 0x00020000
    6.13  	pushl %ebx; \
    6.14  	movl $(__USER_DS), %edx; \
    6.15  	movl %edx, %ds; \
    6.16 -	movl %edx, %es
    6.17 +	movl %edx, %es;
    6.18  
    6.19  #define SAVE_ALL \
    6.20  	SAVE_ALL_NO_EVENTMASK; \
    6.21 @@ -397,6 +397,7 @@ vector=vector+1
    6.22  	ALIGN
    6.23  common_interrupt:
    6.24  	SAVE_ALL
    6.25 +	movl %esp,%eax
    6.26  	call do_IRQ
    6.27  	jmp ret_from_intr
    6.28  
    6.29 @@ -404,7 +405,8 @@ common_interrupt:
    6.30  ENTRY(name)				\
    6.31  	pushl $nr-256;			\
    6.32  	SAVE_ALL			\
    6.33 -	call smp_/**/name;	\
    6.34 +	movl %esp,%eax;			\
    6.35 +	call smp_/**/name;		\
    6.36  	jmp ret_from_intr;
    6.37  
    6.38  /* The include is where all of the SMP etc. interrupts come from */
    6.39 @@ -437,7 +439,7 @@ error_code:
    6.40  	movl %ecx, %es
    6.41  	movl %esp,%eax			# pt_regs pointer
    6.42  	XEN_GET_VCPU_INFO(%esi)
    6.43 -	XEN_SAVE_UPCALL_MASK(%esi,%dl,EVENT_MASK+8)
    6.44 +	XEN_SAVE_UPCALL_MASK(%esi,%bl,EVENT_MASK)
    6.45  	call *%edi
    6.46  	jmp ret_from_exception
    6.47  
    6.48 @@ -596,7 +598,7 @@ debug_stack_correct:
    6.49  	movl %esp,%eax			# pt_regs pointer
    6.50  	call do_debug
    6.51  	testl %eax,%eax
    6.52 -	jnz restore
    6.53 +	jnz restore_all
    6.54  	jmp ret_from_exception
    6.55  
    6.56  #if 0 /* XEN */
    6.57 @@ -721,7 +723,7 @@ ENTRY(page_fault)
    6.58  	movl %eax, %es
    6.59  	movl %esp,%eax			/* pt_regs pointer */
    6.60  	XEN_GET_VCPU_INFO(%esi)
    6.61 -	XEN_SAVE_UPCALL_MASK(%esi,%bl,EVENT_MASK+12)
    6.62 +	XEN_SAVE_UPCALL_MASK(%esi,%bl,EVENT_MASK)
    6.63  	call do_page_fault
    6.64  	jmp ret_from_exception
    6.65  
     7.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/Makefile	Mon Nov 29 17:28:03 2004 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,16 +0,0 @@
     7.4 -obj-y	:= main.o
     7.5 -c-obj-y	:= if.o
     7.6 -
     7.7 -c-link	:=
     7.8 -
     7.9 -$(patsubst %.o,$(obj)/%.c,$(c-obj-y) $(c-link)): $(obj)/mtrr.h
    7.10 -	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/$(notdir $@) $@
    7.11 -
    7.12 -$(patsubst %.o,$(obj)/%.c,$(obj-y)): $(obj)/mtrr.h
    7.13 -
    7.14 -$(obj)/mtrr.h:
    7.15 -	@ln -fsn $(srctree)/arch/i386/kernel/cpu/mtrr/mtrr.h $@
    7.16 -
    7.17 -obj-y	+= $(c-obj-y)
    7.18 -
    7.19 -clean-files += $(patsubst %.o,%.c,$(c-obj-y) $(c-obj-) $(c-link))
     8.1 --- a/linux-2.6.9-xen-sparse/arch/xen/i386/kernel/cpu/mtrr/main.c	Mon Nov 29 17:28:03 2004 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,165 +0,0 @@
     8.4 -#include <linux/init.h>
     8.5 -#include <linux/proc_fs.h>
     8.6 -#include <linux/ctype.h>
     8.7 -#include <linux/module.h>
     8.8 -#include <linux/seq_file.h>
     8.9 -#include <asm/uaccess.h>
    8.10 -
    8.11 -#include <asm/mtrr.h>
    8.12 -#include "mtrr.h"
    8.13 -
    8.14 -void generic_get_mtrr(unsigned int reg, unsigned long *base,
    8.15 -		      unsigned int *size, mtrr_type * type)
    8.16 -{
    8.17 -	dom0_op_t op;
    8.18 -
    8.19 -	op.cmd = DOM0_READ_MEMTYPE;
    8.20 -	op.u.read_memtype.reg = reg;
    8.21 -	(void)HYPERVISOR_dom0_op(&op);
    8.22 -
    8.23 -	*size = op.u.read_memtype.nr_pfns;
    8.24 -	*base = op.u.read_memtype.pfn;
    8.25 -	*type = op.u.read_memtype.type;
    8.26 -}
    8.27 -
    8.28 -struct mtrr_ops generic_mtrr_ops = {
    8.29 -	.use_intel_if      = 1,
    8.30 -	.get               = generic_get_mtrr,
    8.31 -};
    8.32 -
    8.33 -struct mtrr_ops *mtrr_if = &generic_mtrr_ops;
    8.34 -unsigned int num_var_ranges;
    8.35 -unsigned int *usage_table;
    8.36 -
    8.37 -void __init set_num_var_ranges(void)
    8.38 -{
    8.39 -	dom0_op_t op;
    8.40 -
    8.41 -	for (num_var_ranges = 0; ; num_var_ranges++) {
    8.42 -		op.cmd = DOM0_READ_MEMTYPE;
    8.43 -		op.u.read_memtype.reg = num_var_ranges;
    8.44 -		if (HYPERVISOR_dom0_op(&op) != 0)
    8.45 -			break;
    8.46 -	}
    8.47 -}
    8.48 -
    8.49 -static void __init init_table(void)
    8.50 -{
    8.51 -	int i, max;
    8.52 -
    8.53 -	max = num_var_ranges;
    8.54 -	if ((usage_table = kmalloc(max * sizeof *usage_table, GFP_KERNEL))
    8.55 -	    == NULL) {
    8.56 -		printk(KERN_ERR "mtrr: could not allocate\n");
    8.57 -		return;
    8.58 -	}
    8.59 -	for (i = 0; i < max; i++)
    8.60 -		usage_table[i] = 0;
    8.61 -}
    8.62 -
    8.63 -int mtrr_add_page(unsigned long base, unsigned long size, 
    8.64 -		  unsigned int type, char increment)
    8.65 -{
    8.66 -	int error;
    8.67 -	dom0_op_t op;
    8.68 -
    8.69 -	op.cmd = DOM0_ADD_MEMTYPE;
    8.70 -	op.u.add_memtype.pfn     = base;
    8.71 -	op.u.add_memtype.nr_pfns = size;
    8.72 -	op.u.add_memtype.type    = type;
    8.73 -	if ((error = HYPERVISOR_dom0_op(&op)))
    8.74 -		return error;
    8.75 -
    8.76 -	if (increment)
    8.77 -		++usage_table[op.u.add_memtype.reg];
    8.78 -
    8.79 -	return op.u.add_memtype.reg;
    8.80 -}
    8.81 -
    8.82 -int
    8.83 -mtrr_add(unsigned long base, unsigned long size, unsigned int type,
    8.84 -	 char increment)
    8.85 -{
    8.86 -	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
    8.87 -		printk(KERN_WARNING "mtrr: size and base must be multiples of 4 kiB\n");
    8.88 -		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
    8.89 -		return -EINVAL;
    8.90 -	}
    8.91 -	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
    8.92 -			     increment);
    8.93 -}
    8.94 -
    8.95 -int mtrr_del_page(int reg, unsigned long base, unsigned long size)
    8.96 -{
    8.97 -	int i, max;
    8.98 -	mtrr_type ltype;
    8.99 -	unsigned long lbase;
   8.100 -	unsigned int lsize;
   8.101 -	int error = -EINVAL;
   8.102 -	dom0_op_t op;
   8.103 -
   8.104 -	max = num_var_ranges;
   8.105 -	if (reg < 0) {
   8.106 -		/*  Search for existing MTRR  */
   8.107 -		for (i = 0; i < max; ++i) {
   8.108 -			mtrr_if->get(i, &lbase, &lsize, &ltype);
   8.109 -			if (lbase == base && lsize == size) {
   8.110 -				reg = i;
   8.111 -				break;
   8.112 -			}
   8.113 -		}
   8.114 -		if (reg < 0) {
   8.115 -			printk(KERN_DEBUG "mtrr: no MTRR for %lx000,%lx000 found\n", base,
   8.116 -			       size);
   8.117 -			goto out;
   8.118 -		}
   8.119 -	}
   8.120 -	if (usage_table[reg] < 1) {
   8.121 -		printk(KERN_WARNING "mtrr: reg: %d has count=0\n", reg);
   8.122 -		goto out;
   8.123 -	}
   8.124 -	if (--usage_table[reg] < 1) {
   8.125 -		op.cmd = DOM0_DEL_MEMTYPE;
   8.126 -		op.u.del_memtype.handle = 0;
   8.127 -		op.u.add_memtype.reg    = reg;
   8.128 -		(void)HYPERVISOR_dom0_op(&op);
   8.129 -	}
   8.130 -	error = reg;
   8.131 - out:
   8.132 -	return error;
   8.133 -}
   8.134 -
   8.135 -int
   8.136 -mtrr_del(int reg, unsigned long base, unsigned long size)
   8.137 -{
   8.138 -	if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) {
   8.139 -		printk(KERN_INFO "mtrr: size and base must be multiples of 4 kiB\n");
   8.140 -		printk(KERN_DEBUG "mtrr: size: 0x%lx  base: 0x%lx\n", size, base);
   8.141 -		return -EINVAL;
   8.142 -	}
   8.143 -	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
   8.144 -}
   8.145 -
   8.146 -EXPORT_SYMBOL(mtrr_add);
   8.147 -EXPORT_SYMBOL(mtrr_del);
   8.148 -
   8.149 -static int __init mtrr_init(void)
   8.150 -{
   8.151 -	struct cpuinfo_x86 *c = &boot_cpu_data;
   8.152 -
   8.153 -	if (!(xen_start_info.flags & SIF_PRIVILEGED))
   8.154 -		return -ENODEV;
   8.155 -
   8.156 -	if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
   8.157 -	    (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
   8.158 -	    (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
   8.159 -	    (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
   8.160 -		return -ENODEV;
   8.161 -
   8.162 -	set_num_var_ranges();
   8.163 -	init_table();
   8.164 -
   8.165 -	return 0;
   8.166 -}
   8.167 -
   8.168 -subsys_initcall(mtrr_init);