ia64/xen-unstable

changeset 8125:74fa88cf3dc7

Merged.
author emellor@leeni.uk.xensource.com
date Tue Nov 29 15:00:27 2005 +0000 (2005-11-29)
parents b1940475284f 92469b92f768
children 8a00d9af3291
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Tue Nov 29 15:00:01 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Tue Nov 29 15:00:27 2005 +0000
     1.3 @@ -155,7 +155,7 @@ irqreturn_t evtchn_interrupt(int irq, vo
     1.4      unsigned int   l1i, l2i, port;
     1.5      irqreturn_t (*handler)(int, void *, struct pt_regs *);
     1.6      shared_info_t *s = HYPERVISOR_shared_info;
     1.7 -    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
     1.8 +    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
     1.9  
    1.10      vcpu_info->evtchn_upcall_mask = 1;
    1.11      vcpu_info->evtchn_upcall_pending = 0;
    1.12 @@ -203,7 +203,7 @@ int evtchn_irq = 0xe9;
    1.13  void __init evtchn_init(void)
    1.14  {
    1.15      shared_info_t *s = HYPERVISOR_shared_info;
    1.16 -    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
    1.17 +    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
    1.18  
    1.19  #if 0
    1.20      int ret;
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Tue Nov 29 15:00:01 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32	Tue Nov 29 15:00:27 2005 +0000
     2.3 @@ -1,7 +1,7 @@
     2.4  #
     2.5  # Automatically generated make config: don't edit
     2.6  # Linux kernel version: 2.6.12.6-xen
     2.7 -# Wed Nov 23 21:01:11 2005
     2.8 +# Mon Nov 28 11:04:51 2005
     2.9  #
    2.10  CONFIG_XEN=y
    2.11  CONFIG_ARCH_XEN=y
    2.12 @@ -1629,7 +1629,7 @@ CONFIG_KEYBOARD_LKKBD=m
    2.13  CONFIG_KEYBOARD_XTKBD=m
    2.14  CONFIG_KEYBOARD_NEWTON=m
    2.15  CONFIG_INPUT_MOUSE=y
    2.16 -CONFIG_MOUSE_PS2=m
    2.17 +CONFIG_MOUSE_PS2=y
    2.18  CONFIG_MOUSE_SERIAL=m
    2.19  CONFIG_MOUSE_INPORT=m
    2.20  # CONFIG_MOUSE_ATIXL is not set
     3.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Tue Nov 29 15:00:01 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S	Tue Nov 29 15:00:27 2005 +0000
     3.3 @@ -81,7 +81,7 @@ VM_MASK		= 0x00020000
     3.4  #define evtchn_upcall_pending		/* 0 */
     3.5  #define evtchn_upcall_mask		1
     3.6  
     3.7 -#define sizeof_vcpu_shift		4
     3.8 +#define sizeof_vcpu_shift		6
     3.9  
    3.10  #ifdef CONFIG_SMP
    3.11  #define preempt_disable(reg)	incl TI_preempt_count(reg)
     4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Tue Nov 29 15:00:01 2005 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c	Tue Nov 29 15:00:27 2005 +0000
     4.3 @@ -204,7 +204,8 @@ static inline u64 scale_delta(u64 delta,
     4.4  void init_cpu_khz(void)
     4.5  {
     4.6  	u64 __cpu_khz = 1000000ULL << 32;
     4.7 -	struct vcpu_time_info *info = &HYPERVISOR_shared_info->vcpu_time[0];
     4.8 +	struct vcpu_time_info *info;
     4.9 +	info = &HYPERVISOR_shared_info->vcpu_info[0].time;
    4.10  	do_div(__cpu_khz, info->tsc_to_system_mul);
    4.11  	if ( info->tsc_shift < 0 )
    4.12  		cpu_khz = __cpu_khz << -info->tsc_shift;
    4.13 @@ -284,7 +285,7 @@ static void get_time_values_from_xen(voi
    4.14  	struct vcpu_time_info   *src;
    4.15  	struct shadow_time_info *dst;
    4.16  
    4.17 -	src = &s->vcpu_time[smp_processor_id()];
    4.18 +	src = &s->vcpu_info[smp_processor_id()].time;
    4.19  	dst = &per_cpu(shadow_time, smp_processor_id());
    4.20  
    4.21  	do {
    4.22 @@ -306,7 +307,7 @@ static inline int time_values_up_to_date
    4.23  	struct vcpu_time_info   *src;
    4.24  	struct shadow_time_info *dst;
    4.25  
    4.26 -	src = &HYPERVISOR_shared_info->vcpu_time[cpu]; 
    4.27 +	src = &HYPERVISOR_shared_info->vcpu_info[cpu].time;
    4.28  	dst = &per_cpu(shadow_time, cpu); 
    4.29  
    4.30  	return (dst->version == src->version);
     5.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Nov 29 15:00:01 2005 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c	Tue Nov 29 15:00:27 2005 +0000
     5.3 @@ -291,7 +291,7 @@ fastcall void do_page_fault(struct pt_re
     5.4  	int write;
     5.5  	siginfo_t info;
     5.6  
     5.7 -	address = HYPERVISOR_shared_info->vcpu_data[
     5.8 +	address = HYPERVISOR_shared_info->vcpu_info[
     5.9  		smp_processor_id()].arch.cr2;
    5.10  
    5.11  	/* Set the "privileged fault" bit to something sane. */
     6.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Tue Nov 29 15:00:01 2005 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Tue Nov 29 15:00:27 2005 +0000
     6.3 @@ -154,7 +154,7 @@ asmlinkage void evtchn_do_upcall(struct 
     6.4  	unsigned int   l1i, l2i, port;
     6.5  	int            irq, cpu = smp_processor_id();
     6.6  	shared_info_t *s = HYPERVISOR_shared_info;
     6.7 -	vcpu_info_t   *vcpu_info = &s->vcpu_data[cpu];
     6.8 +	vcpu_info_t   *vcpu_info = &s->vcpu_info[cpu];
     6.9  
    6.10  	vcpu_info->evtchn_upcall_pending = 0;
    6.11  
     7.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Tue Nov 29 15:00:01 2005 +0000
     7.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S	Tue Nov 29 15:00:27 2005 +0000
     7.3 @@ -5,7 +5,7 @@
     7.4  #define evtchn_upcall_pending		0
     7.5  #define evtchn_upcall_mask		1
     7.6  
     7.7 -#define sizeof_vcpu_shift		5
     7.8 +#define sizeof_vcpu_shift		6
     7.9  
    7.10  #ifdef CONFIG_SMP
    7.11  //#define preempt_disable(reg)	incl threadinfo_preempt_count(reg)
     8.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Tue Nov 29 15:00:01 2005 +0000
     8.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c	Tue Nov 29 15:00:27 2005 +0000
     8.3 @@ -344,7 +344,7 @@ asmlinkage void do_page_fault(struct pt_
     8.4  #endif
     8.5  
     8.6  	/* get the address */
     8.7 -	address = HYPERVISOR_shared_info->vcpu_data[
     8.8 +	address = HYPERVISOR_shared_info->vcpu_info[
     8.9  		smp_processor_id()].arch.cr2;
    8.10  
    8.11  	if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Nov 29 15:00:01 2005 +0000
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h	Tue Nov 29 15:00:27 2005 +0000
     9.3 @@ -38,6 +38,8 @@ struct vbd {
     9.4  	struct block_device *bdev;
     9.5  }; 
     9.6  
     9.7 +struct backend_info; 
     9.8 +
     9.9  typedef struct blkif_st {
    9.10  	/* Unique identifier for this interface. */
    9.11  	domid_t           domid;
    9.12 @@ -48,8 +50,10 @@ typedef struct blkif_st {
    9.13  	/* Comms information. */
    9.14  	blkif_back_ring_t blk_ring;
    9.15  	struct vm_struct *blk_ring_area;
    9.16 -	/* VBDs attached to this interface. */
    9.17 +	/* The VBD attached to this interface. */
    9.18  	struct vbd        vbd;
    9.19 +	/* Back pointer to the backend_info. */
    9.20 +	struct backend_info *be; 
    9.21  	/* Private fields. */
    9.22  	enum { DISCONNECTED, CONNECTED } status;
    9.23  #ifdef CONFIG_XEN_BLKDEV_TAP_BE
    9.24 @@ -103,6 +107,8 @@ void blkif_xenbus_init(void);
    9.25  
    9.26  irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
    9.27  
    9.28 +void update_blkif_status(blkif_t *blkif); 
    9.29 +
    9.30  #endif /* __BLKIF__BACKEND__COMMON_H__ */
    9.31  
    9.32  /*
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Nov 29 15:00:01 2005 +0000
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c	Tue Nov 29 15:00:27 2005 +0000
    10.3 @@ -112,7 +112,9 @@ int blkif_map(blkif_t *blkif, unsigned l
    10.4  
    10.5  	blkif->irq = bind_evtchn_to_irqhandler(
    10.6  		blkif->evtchn, blkif_be_int, 0, "blkif-backend", blkif);
    10.7 -	blkif->status = CONNECTED;
    10.8 +
    10.9 +	/* We're potentially connected now */
   10.10 +	update_blkif_status(blkif); 
   10.11  
   10.12  	return 0;
   10.13  }
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Nov 29 15:00:01 2005 +0000
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c	Tue Nov 29 15:00:27 2005 +0000
    11.3 @@ -50,6 +50,16 @@ static void backend_changed(struct xenbu
    11.4  			    unsigned int);
    11.5  
    11.6  
    11.7 +void update_blkif_status(blkif_t *blkif)
    11.8 +{ 
    11.9 +	if(blkif->irq && blkif->vbd.bdev) {
   11.10 +		blkif->status = CONNECTED; 
   11.11 +		(void)blkif_be_int(0, blkif, NULL); 
   11.12 +	}
   11.13 +	maybe_connect(blkif->be); 
   11.14 +}
   11.15 +
   11.16 +
   11.17  static ssize_t show_physical_device(struct device *_dev, char *buf)
   11.18  {
   11.19  	struct xenbus_device *dev = to_xenbus_device(_dev);
   11.20 @@ -81,6 +91,7 @@ static int blkback_remove(struct xenbus_
   11.21  		be->backend_watch.node = NULL;
   11.22  	}
   11.23  	if (be->blkif) {
   11.24 +		be->blkif->status = DISCONNECTED; 
   11.25  		blkif_put(be->blkif);
   11.26  		be->blkif = NULL;
   11.27  	}
   11.28 @@ -123,6 +134,9 @@ static int blkback_probe(struct xenbus_d
   11.29  		goto fail;
   11.30  	}
   11.31  
   11.32 +	/* setup back pointer */
   11.33 +	be->blkif->be = be; 
   11.34 +
   11.35  	err = xenbus_watch_path2(dev, dev->nodename, "physical-device",
   11.36  				 &be->backend_watch, backend_changed);
   11.37  	if (err)
   11.38 @@ -209,7 +223,8 @@ static void backend_changed(struct xenbu
   11.39  		device_create_file(&dev->dev, &dev_attr_physical_device);
   11.40  		device_create_file(&dev->dev, &dev_attr_mode);
   11.41  
   11.42 -		maybe_connect(be);
   11.43 +		/* We're potentially connected now */
   11.44 +		update_blkif_status(be->blkif); 
   11.45  	}
   11.46  }
   11.47  
   11.48 @@ -235,7 +250,7 @@ static void frontend_changed(struct xenb
   11.49  		if (err) {
   11.50  			return;
   11.51  		}
   11.52 -		maybe_connect(be);
   11.53 +		update_blkif_status(be->blkif); 
   11.54  		break;
   11.55  
   11.56  	case XenbusStateClosing:
    12.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h	Tue Nov 29 15:00:01 2005 +0000
    12.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h	Tue Nov 29 15:00:27 2005 +0000
    12.3 @@ -501,7 +501,7 @@ unsigned long __set_mb_temp;            
    12.4  do {									\
    12.5  	vcpu_info_t *_vcpu;						\
    12.6  	preempt_disable();						\
    12.7 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
    12.8 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
    12.9  	_vcpu->evtchn_upcall_mask = 1;					\
   12.10  	preempt_enable_no_resched();					\
   12.11  	barrier();							\
   12.12 @@ -512,7 +512,7 @@ do {									\
   12.13  	vcpu_info_t *_vcpu;						\
   12.14  	barrier();							\
   12.15  	preempt_disable();						\
   12.16 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   12.17 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   12.18  	_vcpu->evtchn_upcall_mask = 0;					\
   12.19  	barrier(); /* unmask then check (avoid races) */		\
   12.20  	if ( unlikely(_vcpu->evtchn_upcall_pending) )			\
   12.21 @@ -524,7 +524,7 @@ do {									\
   12.22  do {									\
   12.23  	vcpu_info_t *_vcpu;						\
   12.24  	preempt_disable();						\
   12.25 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   12.26 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   12.27  	(x) = _vcpu->evtchn_upcall_mask;				\
   12.28  	preempt_enable();						\
   12.29  } while (0)
   12.30 @@ -534,7 +534,7 @@ do {									\
   12.31  	vcpu_info_t *_vcpu;						\
   12.32  	barrier();							\
   12.33  	preempt_disable();						\
   12.34 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   12.35 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   12.36  	if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {			\
   12.37  		barrier(); /* unmask then check (avoid races) */	\
   12.38  		if ( unlikely(_vcpu->evtchn_upcall_pending) )		\
   12.39 @@ -550,7 +550,7 @@ do {									\
   12.40  do {									\
   12.41  	vcpu_info_t *_vcpu;						\
   12.42  	preempt_disable();						\
   12.43 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   12.44 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   12.45  	(x) = _vcpu->evtchn_upcall_mask;				\
   12.46  	_vcpu->evtchn_upcall_mask = 1;					\
   12.47  	preempt_enable_no_resched();					\
   12.48 @@ -568,7 +568,7 @@ do {									\
   12.49  ({	int ___x;							\
   12.50  	vcpu_info_t *_vcpu;						\
   12.51  	preempt_disable();						\
   12.52 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   12.53 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   12.54  	___x = (_vcpu->evtchn_upcall_mask != 0);			\
   12.55  	preempt_enable_no_resched();					\
   12.56  	___x; })
    13.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h	Tue Nov 29 15:00:01 2005 +0000
    13.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h	Tue Nov 29 15:00:27 2005 +0000
    13.3 @@ -325,7 +325,7 @@ static inline unsigned long __cmpxchg(vo
    13.4  do {									\
    13.5  	vcpu_info_t *_vcpu;						\
    13.6  	preempt_disable();						\
    13.7 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
    13.8 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
    13.9  	_vcpu->evtchn_upcall_mask = 1;					\
   13.10  	preempt_enable_no_resched();					\
   13.11  	barrier();							\
   13.12 @@ -336,7 +336,7 @@ do {									\
   13.13  	vcpu_info_t *_vcpu;						\
   13.14  	barrier();							\
   13.15  	preempt_disable();						\
   13.16 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   13.17 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   13.18  	_vcpu->evtchn_upcall_mask = 0;					\
   13.19  	barrier(); /* unmask then check (avoid races) */		\
   13.20  	if ( unlikely(_vcpu->evtchn_upcall_pending) )			\
   13.21 @@ -348,7 +348,7 @@ do {									\
   13.22  do {									\
   13.23  	vcpu_info_t *_vcpu;						\
   13.24  	preempt_disable();						\
   13.25 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   13.26 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   13.27  	(x) = _vcpu->evtchn_upcall_mask;				\
   13.28  	preempt_enable();						\
   13.29  } while (0)
   13.30 @@ -358,7 +358,7 @@ do {									\
   13.31  	vcpu_info_t *_vcpu;						\
   13.32  	barrier();							\
   13.33  	preempt_disable();						\
   13.34 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   13.35 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   13.36  	if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {			\
   13.37  		barrier(); /* unmask then check (avoid races) */	\
   13.38  		if ( unlikely(_vcpu->evtchn_upcall_pending) )		\
   13.39 @@ -374,7 +374,7 @@ do {									\
   13.40  do {									\
   13.41  	vcpu_info_t *_vcpu;						\
   13.42  	preempt_disable();						\
   13.43 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   13.44 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   13.45  	(x) = _vcpu->evtchn_upcall_mask;				\
   13.46  	_vcpu->evtchn_upcall_mask = 1;					\
   13.47  	preempt_enable_no_resched();					\
   13.48 @@ -394,7 +394,7 @@ void cpu_idle_wait(void);
   13.49  ({	int ___x;							\
   13.50  	vcpu_info_t *_vcpu;						\
   13.51  	preempt_disable();						\
   13.52 -	_vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()];	\
   13.53 +	_vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()];	\
   13.54  	___x = (_vcpu->evtchn_upcall_mask != 0);			\
   13.55  	preempt_enable_no_resched();					\
   13.56  	___x; })
    14.1 --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h	Tue Nov 29 15:00:01 2005 +0000
    14.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h	Tue Nov 29 15:00:27 2005 +0000
    14.3 @@ -102,7 +102,7 @@ static inline void mask_evtchn(int port)
    14.4  static inline void unmask_evtchn(int port)
    14.5  {
    14.6  	shared_info_t *s = HYPERVISOR_shared_info;
    14.7 -	vcpu_info_t *vcpu_info = &s->vcpu_data[smp_processor_id()];
    14.8 +	vcpu_info_t *vcpu_info = &s->vcpu_info[smp_processor_id()];
    14.9  
   14.10  	synch_clear_bit(port, &s->evtchn_mask[0]);
   14.11  
    15.1 --- a/tools/examples/block	Tue Nov 29 15:00:01 2005 +0000
    15.2 +++ b/tools/examples/block	Tue Nov 29 15:00:27 2005 +0000
    15.3 @@ -202,59 +202,61 @@ case "$command" in
    15.4  mount it read-write in a guest domain."
    15.5          fi
    15.6  
    15.7 -        loopdev=''
    15.8  
    15.9 -	for dev in /dev/loop*
   15.10 -        do
   15.11 -          if [ ! -b "$dev" ]
   15.12 -          then
   15.13 -            continue
   15.14 -          fi
   15.15 -
   15.16 -          f=$(losetup "$dev" 2>/dev/null) || f='()'
   15.17 -          f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
   15.18 -
   15.19 -          log err "$file $f $dev"
   15.20 -
   15.21 -          if [ "$f" ]
   15.22 -          then
   15.23 -            # $dev is in use.  Check sharing.
   15.24 -
   15.25 -            if [ "$mode" == 'no' ]
   15.26 +	while true
   15.27 +        do 
   15.28 +          loopdev=''
   15.29 +          for dev in /dev/loop*
   15.30 +          do
   15.31 +            if [ ! -b "$dev" ]
   15.32              then
   15.33                continue
   15.34              fi
   15.35  
   15.36 -            f=$(readlink -f "$f")
   15.37 +            f=$(losetup "$dev" 2>/dev/null) || f='()'
   15.38 +            f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
   15.39 +
   15.40 +            log err "$file $f $dev"
   15.41 +
   15.42 +            if [ "$f" ]
   15.43 +            then
   15.44 +              # $dev is in use.  Check sharing.
   15.45 +              if [ "$mode" == 'no' ]
   15.46 +              then
   15.47 +                continue
   15.48 +              fi
   15.49  
   15.50 -            if [ "$f" == "$file" ]
   15.51 -            then
   15.52 -              check_file_sharing "$file" "$dev" "$mode"
   15.53 +              f=$(readlink -f "$f")
   15.54 +
   15.55 +              if [ "$f" == "$file" ]
   15.56 +              then
   15.57 +                check_file_sharing "$file" "$dev" "$mode"
   15.58 +              fi
   15.59 +            else
   15.60 +              # $dev is not in use, so we'll remember it for use later; we want
   15.61 +              # to finish the sharing check first.
   15.62 +              
   15.63 +              if [ "$loopdev" == '' ]
   15.64 +              then
   15.65 +                loopdev="$dev"
   15.66 +              fi
   15.67              fi
   15.68 -          else
   15.69 -            # $dev is not in use, so we'll remember it for use later; we want
   15.70 -            # to finish the sharing check first.
   15.71 -            
   15.72 -            if [ "$loopdev" == '' ]
   15.73 -            then
   15.74 -              loopdev="$dev"
   15.75 -            fi
   15.76 +          done
   15.77 +
   15.78 +          if [ "$loopdev" == '' ]
   15.79 +          then
   15.80 +            fatal 'Failed to find an unused loop device'
   15.81            fi
   15.82 -        done
   15.83 -
   15.84 -        if [ "$loopdev" == '' ]
   15.85 -        then
   15.86 -          fatal 'Failed to find an unused loop device'
   15.87 -        fi
   15.88 -
   15.89 -        if losetup "$loopdev" "$file"
   15.90 -        then
   15.91 -          xenstore_write "$XENBUS_PATH/node" "$loopdev"
   15.92 -          write_dev "$loopdev"
   15.93 -          exit 0
   15.94 -        else
   15.95 -          fatal "losetup $loopdev $file failed"
   15.96 -        fi
   15.97 +          if losetup "$loopdev" "$file"
   15.98 +          then
   15.99 +	    log err "mapped $file using $loopdev"
  15.100 +            xenstore_write "$XENBUS_PATH/node" "$loopdev"
  15.101 +            write_dev "$loopdev"
  15.102 +            exit 0
  15.103 +          else
  15.104 +            log err "losetup $loopdev $file failed, retry"
  15.105 +          fi
  15.106 +	done
  15.107  	;;
  15.108      esac
  15.109      ;;
    16.1 --- a/tools/ioemu/hw/ide.c	Tue Nov 29 15:00:01 2005 +0000
    16.2 +++ b/tools/ioemu/hw/ide.c	Tue Nov 29 15:00:27 2005 +0000
    16.3 @@ -669,6 +669,8 @@ static int ide_read_dma_cb(IDEState *s,
    16.4      }
    16.5      if (s->io_buffer_index >= s->io_buffer_size && s->nsector == 0) {
    16.6          s->status = READY_STAT | SEEK_STAT;
    16.7 +        s->bmdma->status &= ~BM_STATUS_DMAING;
    16.8 +        s->bmdma->status |= BM_STATUS_INT;
    16.9          ide_set_irq(s);
   16.10  #ifdef DEBUG_IDE_ATAPI
   16.11          printf("dma status=0x%x\n", s->status);
   16.12 @@ -736,6 +738,8 @@ static int ide_write_dma_cb(IDEState *s,
   16.13              if (n == 0) {
   16.14                  /* end of transfer */
   16.15                  s->status = READY_STAT | SEEK_STAT;
   16.16 +                s->bmdma->status &= ~BM_STATUS_DMAING;
   16.17 +                s->bmdma->status |= BM_STATUS_INT;
   16.18                  ide_set_irq(s);
   16.19                  return 0;
   16.20              }
   16.21 @@ -983,6 +987,8 @@ static int ide_atapi_cmd_read_dma_cb(IDE
   16.22      if (s->packet_transfer_size <= 0) {
   16.23          s->status = READY_STAT;
   16.24          s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
   16.25 +        s->bmdma->status &= ~BM_STATUS_DMAING;
   16.26 +        s->bmdma->status |= BM_STATUS_INT;
   16.27          ide_set_irq(s);
   16.28  #ifdef DEBUG_IDE_ATAPI
   16.29          printf("dma status=0x%x\n", s->status);
   16.30 @@ -2065,8 +2071,6 @@ static void ide_dma_loop(BMDMAState *bm)
   16.31      }
   16.32      /* end of transfer */
   16.33   the_end:
   16.34 -    bm->status &= ~BM_STATUS_DMAING;
   16.35 -    bm->status |= BM_STATUS_INT;
   16.36      bm->dma_cb = NULL;
   16.37      bm->ide_if = NULL;
   16.38  }
    17.1 --- a/tools/ioemu/hw/vga.c	Tue Nov 29 15:00:01 2005 +0000
    17.2 +++ b/tools/ioemu/hw/vga.c	Tue Nov 29 15:00:27 2005 +0000
    17.3 @@ -1834,16 +1834,6 @@ void vga_bios_init(VGAState *s)
    17.4  
    17.5      /* TODO:add vbe support if enable it */
    17.6  
    17.7 -    FILE *qemuf = fopen("/etc/xen/qemu-vgaram-bin", "rb");
    17.8 -    if (!qemuf) {
    17.9 -        fprintf(logfile, "open qemu vgaram binary failed!\n");
   17.10 -    } else {
   17.11 -        /*load vram contents, else vga console can't boot */
   17.12 -        qemu_get_buffer(qemuf, s->vram_ptr, 256*1024);
   17.13 -
   17.14 -        fclose(qemuf);
   17.15 -    }
   17.16 -
   17.17  }
   17.18  
   17.19  void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
    18.1 --- a/tools/libxc/xc_linux_build.c	Tue Nov 29 15:00:01 2005 +0000
    18.2 +++ b/tools/libxc/xc_linux_build.c	Tue Nov 29 15:00:27 2005 +0000
    18.3 @@ -657,7 +657,7 @@ static int setup_guest(int xc_handle,
    18.4      memset(shared_info, 0, sizeof(shared_info_t));
    18.5      /* Mask all upcalls... */
    18.6      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    18.7 -        shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    18.8 +        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
    18.9  
   18.10      munmap(shared_info, PAGE_SIZE);
   18.11  
    19.1 --- a/tools/libxc/xc_linux_restore.c	Tue Nov 29 15:00:01 2005 +0000
    19.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Nov 29 15:00:27 2005 +0000
    19.3 @@ -671,7 +671,7 @@ int xc_linux_restore(int xc_handle, int 
    19.4      memset(&(shared_info->evtchn_pending[0]), 0,
    19.5             sizeof (shared_info->evtchn_pending));
    19.6      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    19.7 -        shared_info->vcpu_data[i].evtchn_pending_sel = 0;
    19.8 +        shared_info->vcpu_info[i].evtchn_pending_sel = 0;
    19.9  
   19.10      /* Copy saved contents of shared-info page. No checking needed. */
   19.11      page = xc_map_foreign_range(
    20.1 --- a/tools/libxc/xc_vmx_build.c	Tue Nov 29 15:00:01 2005 +0000
    20.2 +++ b/tools/libxc/xc_vmx_build.c	Tue Nov 29 15:00:27 2005 +0000
    20.3 @@ -524,7 +524,7 @@ static int setup_guest(int xc_handle,
    20.4      memset(shared_info, 0, sizeof(shared_info_t));
    20.5      /* Mask all upcalls... */
    20.6      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    20.7 -        shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    20.8 +        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
    20.9  
   20.10      munmap(shared_info, PAGE_SIZE);
   20.11  
    21.1 --- a/tools/python/xen/util/bugtool.py	Tue Nov 29 15:00:01 2005 +0000
    21.2 +++ b/tools/python/xen/util/bugtool.py	Tue Nov 29 15:00:27 2005 +0000
    21.3 @@ -162,7 +162,7 @@ def send(bug, conn, fd, filename, userna
    21.4              print >>sys.stderr, (
    21.5                  'Attach failed: %s %s.' % (response.status, response.reason))
    21.6          elif not m or m.group(1) != 'Changes Submitted':
    21.7 -            print >>sys.syderr, (
    21.8 +            print >>sys.stderr, (
    21.9                  'Attach failed: got a page titled %s.' % m.group(1))
   21.10          else:
   21.11              print "Attaching %s to bug %d succeeded." % (filename, bug)
    22.1 --- a/xen/arch/ia64/vmx/vmx_hypercall.c	Tue Nov 29 15:00:01 2005 +0000
    22.2 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c	Tue Nov 29 15:00:27 2005 +0000
    22.3 @@ -198,7 +198,7 @@ static int do_set_shared_page(VCPU *vcpu
    22.4      if (o_info) {
    22.5      	memcpy((void*)d->shared_info, (void*)o_info, PAGE_SIZE);
    22.6      	for_each_vcpu(d, v) {
    22.7 -	        v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
    22.8 +	        v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
    22.9      	}
   22.10      	/* If original page belongs to xen heap, then relinguish back
   22.11      	 * to xen heap. Or else, leave to domain itself to decide.
    23.1 --- a/xen/arch/ia64/xen/domain.c	Tue Nov 29 15:00:01 2005 +0000
    23.2 +++ b/xen/arch/ia64/xen/domain.c	Tue Nov 29 15:00:27 2005 +0000
    23.3 @@ -205,7 +205,7 @@ void arch_do_createdomain(struct vcpu *v
    23.4  	printf("arch_vcpu_info=%p\n", d->vcpu[0].arch.privregs);
    23.5  	memset(d->vcpu.arch.privregs, 0, PAGE_SIZE);
    23.6  #endif
    23.7 -	v->vcpu_info = &(d->shared_info->vcpu_data[0]);
    23.8 +	v->vcpu_info = &(d->shared_info->vcpu_info[0]);
    23.9  
   23.10  	d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
   23.11  
   23.12 @@ -867,7 +867,7 @@ int construct_dom0(struct domain *d,
   23.13  
   23.14  	/* Mask all upcalls... */
   23.15  	for ( i = 1; i < MAX_VIRT_CPUS; i++ )
   23.16 -	    d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
   23.17 +	    d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
   23.18  
   23.19  #ifdef VALIDATE_VT 
   23.20  	/* Construct a frame-allocation list for the initial domain, since these
   23.21 @@ -997,7 +997,7 @@ int construct_domU(struct domain *d,
   23.22  
   23.23  	/* Mask all upcalls... */
   23.24  	for ( i = 0; i < MAX_VIRT_CPUS; i++ )
   23.25 -		d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
   23.26 +		d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
   23.27  
   23.28  	/* Copy the OS image. */
   23.29  	printk("calling loaddomainelfimage(%p,%p)\n",d,image_start);
    24.1 --- a/xen/arch/x86/audit.c	Tue Nov 29 15:00:01 2005 +0000
    24.2 +++ b/xen/arch/x86/audit.c	Tue Nov 29 15:00:27 2005 +0000
    24.3 @@ -51,7 +51,30 @@ int audit_adjust_pgtables(struct domain 
    24.4      int errors = 0;
    24.5      int shadow_refcounts = !!shadow_mode_refcounts(d);
    24.6      int shadow_enabled = !!shadow_mode_enabled(d);
    24.7 -    int l2limit;
    24.8 +
    24.9 +    int l2limit( unsigned long mfn )
   24.10 +    {
   24.11 +
   24.12 +        if ( shadow_mode_external(d) )
   24.13 +            return L2_PAGETABLE_ENTRIES;
   24.14 +
   24.15 +#ifdef __i386__
   24.16 +#ifdef CONFIG_X86_PAE
   24.17 +        /* 32b PAE */
   24.18 +        if ( (( frame_table[mfn].u.inuse.type_info & PGT_va_mask ) 
   24.19 +	    >> PGT_va_shift) == 3 )
   24.20 +            return l2_table_offset(HYPERVISOR_VIRT_START); 
   24.21 +        else
   24.22 +            return L2_PAGETABLE_ENTRIES;
   24.23 +#else
   24.24 +        /* 32b non-PAE */
   24.25 +        return DOMAIN_ENTRIES_PER_L2_PAGETABLE;
   24.26 +#endif
   24.27 +#else
   24.28 +        /* 64b */
   24.29 +        return 0; /* XXX x86/64 XXX */
   24.30 +#endif
   24.31 +    }
   24.32  
   24.33      void _adjust(struct pfn_info *page, int adjtype ADJUST_EXTRA_ARGS)
   24.34      {
   24.35 @@ -121,15 +144,15 @@ int audit_adjust_pgtables(struct domain 
   24.36  
   24.37      void adjust_l2_page(unsigned long mfn, int shadow)
   24.38      {
   24.39 -        unsigned long *pt = map_domain_page(mfn);
   24.40 +        l2_pgentry_t *pt = map_domain_page(mfn);
   24.41          int i;
   24.42          u32 page_type;
   24.43  
   24.44 -        for ( i = 0; i < l2limit; i++ )
   24.45 +        for ( i = 0; i < l2limit(mfn); i++ )
   24.46          {
   24.47 -            if ( pt[i] & _PAGE_PRESENT )
   24.48 +            if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
   24.49              {
   24.50 -                unsigned long l1mfn = pt[i] >> PAGE_SHIFT;
   24.51 +	        unsigned long l1mfn = l2e_get_pfn(pt[i]);
   24.52                  struct pfn_info *l1page = pfn_to_page(l1mfn);
   24.53  
   24.54                  if ( noisy )
   24.55 @@ -199,7 +222,7 @@ int audit_adjust_pgtables(struct domain 
   24.56          if ( shadow_mode_translate(d) && !shadow_mode_external(d) )
   24.57          {
   24.58              unsigned long hl2mfn =
   24.59 -                pt[l2_table_offset(LINEAR_PT_VIRT_START)] >> PAGE_SHIFT;
   24.60 +                l2e_get_pfn(pt[l2_table_offset(LINEAR_PT_VIRT_START)]);
   24.61              struct pfn_info *hl2page = pfn_to_page(hl2mfn);
   24.62              adjust(hl2page, 0);
   24.63          }
   24.64 @@ -209,14 +232,14 @@ int audit_adjust_pgtables(struct domain 
   24.65  
   24.66      void adjust_hl2_page(unsigned long hl2mfn)
   24.67      {
   24.68 -        unsigned long *pt = map_domain_page(hl2mfn);
   24.69 +        l2_pgentry_t *pt = map_domain_page(hl2mfn);
   24.70          int i;
   24.71  
   24.72 -        for ( i = 0; i < l2limit; i++ )
   24.73 +        for ( i = 0; i < l2limit(hl2mfn); i++ )
   24.74          {
   24.75 -            if ( pt[i] & _PAGE_PRESENT )
   24.76 +            if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
   24.77              {
   24.78 -                unsigned long gmfn = pt[i] >> PAGE_SHIFT;
   24.79 +                unsigned long gmfn = l2e_get_pfn(pt[i]);
   24.80                  struct pfn_info *gpage = pfn_to_page(gmfn);
   24.81  
   24.82                  if ( gmfn < 0x100 )
   24.83 @@ -256,14 +279,14 @@ int audit_adjust_pgtables(struct domain 
   24.84  
   24.85      void adjust_l1_page(unsigned long l1mfn)
   24.86      {
   24.87 -        unsigned long *pt = map_domain_page(l1mfn);
   24.88 +        l1_pgentry_t *pt = map_domain_page(l1mfn);
   24.89          int i;
   24.90  
   24.91          for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
   24.92          {
   24.93 -            if ( pt[i] & _PAGE_PRESENT )
   24.94 +            if ( l1e_get_flags(pt[i]) & _PAGE_PRESENT )
   24.95              {
   24.96 -                unsigned long gmfn = pt[i] >> PAGE_SHIFT;
   24.97 +                unsigned long gmfn = l1e_get_pfn(pt[i]);
   24.98                  struct pfn_info *gpage = pfn_to_page(gmfn);
   24.99  
  24.100                  if ( gmfn < 0x100 )
  24.101 @@ -280,7 +303,7 @@ int audit_adjust_pgtables(struct domain 
  24.102  
  24.103                  if ( noisy )
  24.104                  {
  24.105 -                    if ( pt[i] & _PAGE_RW )
  24.106 +                    if ( l1e_get_flags(pt[i]) & _PAGE_RW )
  24.107                      {
  24.108                          // If it's not a writable page, complain.
  24.109                          //
  24.110 @@ -320,7 +343,7 @@ int audit_adjust_pgtables(struct domain 
  24.111                      }
  24.112                  }
  24.113  
  24.114 -                adjust(gpage, (pt[i] & _PAGE_RW) ? 1 : 0);
  24.115 +                adjust(gpage, (l1e_get_flags(pt[i]) & _PAGE_RW) ? 1 : 0);
  24.116              }
  24.117          }
  24.118  
  24.119 @@ -544,15 +567,6 @@ int audit_adjust_pgtables(struct domain 
  24.120          }
  24.121      }
  24.122  
  24.123 -#ifdef __i386__
  24.124 -    if ( shadow_mode_external(d) )
  24.125 -        l2limit = L2_PAGETABLE_ENTRIES;
  24.126 -    else
  24.127 -        l2limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
  24.128 -#else
  24.129 -    l2limit = 0; /* XXX x86/64 XXX */
  24.130 -#endif
  24.131 -
  24.132      adjust_for_pgtbase();
  24.133  
  24.134      adjust_guest_pages();
  24.135 @@ -604,16 +618,17 @@ void _audit_domain(struct domain *d, int
  24.136                               unsigned long mfn)
  24.137      {
  24.138          struct pfn_info *page = &frame_table[mfn];
  24.139 -        unsigned long *pt = map_domain_page(mfn);
  24.140 +        l1_pgentry_t *pt = map_domain_page(mfn);
  24.141          int i;
  24.142  
  24.143          for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
  24.144          {
  24.145 -            if ( (pt[i] & _PAGE_PRESENT) && ((pt[i] >> PAGE_SHIFT) == xmfn) )
  24.146 +            if ( (l1e_get_flags(pt[i]) & _PAGE_PRESENT) && 
  24.147 +                 (l1e_get_pfn(pt[i]) == xmfn) )
  24.148                  printk("     found dom=%d mfn=%lx t=%" PRtype_info " c=%08x "
  24.149 -                       "pt[i=%x]=%lx\n",
  24.150 +                       "pt[i=%x]=%" PRIpte "\n",
  24.151                         d->domain_id, mfn, page->u.inuse.type_info,
  24.152 -                       page->count_info, i, pt[i]);
  24.153 +                       page->count_info, i, l1e_get_intpte(pt[i]));
  24.154          }
  24.155  
  24.156          unmap_domain_page(pt);           
    25.1 --- a/xen/arch/x86/domain.c	Tue Nov 29 15:00:01 2005 +0000
    25.2 +++ b/xen/arch/x86/domain.c	Tue Nov 29 15:00:27 2005 +0000
    25.3 @@ -266,7 +266,7 @@ void arch_do_createdomain(struct vcpu *v
    25.4  
    25.5      d->shared_info = alloc_xenheap_page();
    25.6      memset(d->shared_info, 0, PAGE_SIZE);
    25.7 -    v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
    25.8 +    v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
    25.9      v->cpumap = CPUMAP_RUNANYWHERE;
   25.10      SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
   25.11  
    26.1 --- a/xen/arch/x86/domain_build.c	Tue Nov 29 15:00:01 2005 +0000
    26.2 +++ b/xen/arch/x86/domain_build.c	Tue Nov 29 15:00:27 2005 +0000
    26.3 @@ -597,7 +597,7 @@ int construct_dom0(struct domain *d,
    26.4  
    26.5      /* Mask all upcalls... */
    26.6      for ( i = 0; i < MAX_VIRT_CPUS; i++ )
    26.7 -        d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
    26.8 +        d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
    26.9  
   26.10      for ( i = 1; i < num_online_cpus(); i++ )
   26.11          (void)alloc_vcpu(d, i, i);
    27.1 --- a/xen/arch/x86/setup.c	Tue Nov 29 15:00:01 2005 +0000
    27.2 +++ b/xen/arch/x86/setup.c	Tue Nov 29 15:00:27 2005 +0000
    27.3 @@ -432,7 +432,7 @@ void __init __start_xen(multiboot_info_t
    27.4  
    27.5      BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
    27.6      BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
    27.7 -    BUG_ON(sizeof(vcpu_info_t) != (sizeof(unsigned long) * 4));
    27.8 +    BUG_ON(sizeof(vcpu_info_t) != 64);
    27.9  
   27.10      init_frametable();
   27.11  
    28.1 --- a/xen/arch/x86/shadow.c	Tue Nov 29 15:00:01 2005 +0000
    28.2 +++ b/xen/arch/x86/shadow.c	Tue Nov 29 15:00:27 2005 +0000
    28.3 @@ -1333,7 +1333,7 @@ static u32 remove_all_write_access_in_pt
    28.4          i = (frame_table[readonly_gmfn].u.inuse.type_info & PGT_va_mask)
    28.5              >> PGT_va_shift;
    28.6  
    28.7 -        if ( (i >= 0 && i <= L1_PAGETABLE_ENTRIES) &&
    28.8 +        if ( (i >= 0 && i < L1_PAGETABLE_ENTRIES) &&
    28.9               !l1e_has_changed(pt[i], match, flags) &&
   28.10               fix_entry(d, &pt[i], &found, is_l1_shadow, max_refs_to_find) &&
   28.11               !prediction )
    29.1 --- a/xen/arch/x86/shadow32.c	Tue Nov 29 15:00:01 2005 +0000
    29.2 +++ b/xen/arch/x86/shadow32.c	Tue Nov 29 15:00:27 2005 +0000
    29.3 @@ -342,14 +342,10 @@ free_shadow_hl2_table(struct domain *d, 
    29.4  
    29.5      SH_VVLOG("%s: smfn=%lx freed", __func__, smfn);
    29.6  
    29.7 -#ifdef __i386__
    29.8      if ( shadow_mode_external(d) )
    29.9          limit = L2_PAGETABLE_ENTRIES;
   29.10      else
   29.11          limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
   29.12 -#else
   29.13 -    limit = 0; /* XXX x86/64 XXX */
   29.14 -#endif
   29.15  
   29.16      for ( i = 0; i < limit; i++ )
   29.17      {
   29.18 @@ -740,11 +736,9 @@ static void alloc_monitor_pagetable(stru
   29.19      mpl2e = (l2_pgentry_t *)map_domain_page(mmfn);
   29.20      memset(mpl2e, 0, PAGE_SIZE);
   29.21  
   29.22 -#ifdef __i386__ /* XXX screws x86/64 build */
   29.23      memcpy(&mpl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE], 
   29.24             &idle_pg_table[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
   29.25             HYPERVISOR_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
   29.26 -#endif
   29.27  
   29.28      mpl2e[l2_table_offset(PERDOMAIN_VIRT_START)] =
   29.29          l2e_from_paddr(__pa(d->arch.mm_perdomain_pt),
   29.30 @@ -1033,36 +1027,40 @@ int __shadow_mode_enable(struct domain *
   29.31      //
   29.32      free_shadow_pages(d);
   29.33  
   29.34 -    /*
   29.35 -     * Tear down it's counts by disassembling its page-table-based ref counts.
   29.36 -     * Also remove CR3's gcount/tcount.
   29.37 -     * That leaves things like GDTs and LDTs and external refs in tact.
   29.38 -     *
   29.39 -     * Most pages will be writable tcount=0.
   29.40 -     * Some will still be L1 tcount=0 or L2 tcount=0.
   29.41 -     * Maybe some pages will be type none tcount=0.
   29.42 -     * Pages granted external writable refs (via grant tables?) will
   29.43 -     * still have a non-zero tcount.  That's OK.
   29.44 -     *
   29.45 -     * gcounts will generally be 1 for PGC_allocated.
   29.46 -     * GDTs and LDTs will have additional gcounts.
   29.47 -     * Any grant-table based refs will still be in the gcount.
   29.48 -     *
   29.49 -     * We attempt to grab writable refs to each page (thus setting its type).
   29.50 -     * Immediately put back those type refs.
   29.51 -     *
   29.52 -     * Assert that no pages are left with L1/L2/L3/L4 type.
   29.53 -     */
   29.54 -    audit_adjust_pgtables(d, -1, 1);
   29.55 -
   29.56      d->arch.shadow_mode = mode;
   29.57  
   29.58      if ( shadow_mode_refcounts(d) )
   29.59      {
   29.60 -        struct list_head *list_ent = d->page_list.next;
   29.61 -        while ( list_ent != &d->page_list )
   29.62 -        {
   29.63 -            struct pfn_info *page = list_entry(list_ent, struct pfn_info, list);
   29.64 +        struct list_head *list_ent; 
   29.65 +
   29.66 +        /*
   29.67 +         * Tear down its counts by disassembling its page-table-based refcounts
   29.68 +         * Also remove CR3's gcount/tcount.
   29.69 +         * That leaves things like GDTs and LDTs and external refs in tact.
   29.70 +         *
   29.71 +         * Most pages will be writable tcount=0.
   29.72 +         * Some will still be L1 tcount=0 or L2 tcount=0.
   29.73 +         * Maybe some pages will be type none tcount=0.
   29.74 +         * Pages granted external writable refs (via grant tables?) will
   29.75 +         * still have a non-zero tcount.  That's OK.
   29.76 +         *
   29.77 +         * gcounts will generally be 1 for PGC_allocated.
   29.78 +         * GDTs and LDTs will have additional gcounts.
   29.79 +         * Any grant-table based refs will still be in the gcount.
   29.80 +         *
   29.81 +         * We attempt to grab writable refs to each page thus setting its type
   29.82 +         * Immediately put back those type refs.
   29.83 +         *
   29.84 +         * Assert that no pages are left with L1/L2/L3/L4 type.
   29.85 +         */
   29.86 +        audit_adjust_pgtables(d, -1, 1);
   29.87 +
   29.88 +
   29.89 +        for (list_ent = d->page_list.next; list_ent != &d->page_list; 
   29.90 +             list_ent = page->list.next) {
   29.91 +            
   29.92 +            struct pfn_info *page = list_entry(list_ent, 
   29.93 +                                               struct pfn_info, list);
   29.94              if ( !get_page_type(page, PGT_writable_page) )
   29.95                  BUG();
   29.96              put_page_type(page);
   29.97 @@ -1070,14 +1068,14 @@ int __shadow_mode_enable(struct domain *
   29.98               * We use tlbflush_timestamp as back pointer to smfn, and need to
   29.99               * clean up it.
  29.100               */
  29.101 -            if ( shadow_mode_external(d) )
  29.102 +            if (shadow_mode_external(d))
  29.103                  page->tlbflush_timestamp = 0;
  29.104 -            list_ent = page->list.next;
  29.105          }
  29.106 +        
  29.107 +        audit_adjust_pgtables(d, 1, 1);
  29.108 +  
  29.109      }
  29.110  
  29.111 -    audit_adjust_pgtables(d, 1, 1);
  29.112 -
  29.113      return 0;
  29.114  
  29.115   nomem:
  29.116 @@ -2146,7 +2144,7 @@ static u32 remove_all_write_access_in_pt
  29.117          i = (frame_table[readonly_gmfn].u.inuse.type_info & PGT_va_mask) 
  29.118              >> PGT_va_shift;
  29.119  
  29.120 -        if ( (i >= 0 && i <= L1_PAGETABLE_ENTRIES) &&
  29.121 +        if ( (i >= 0 && i < L1_PAGETABLE_ENTRIES) &&
  29.122               !l1e_has_changed(pt[i], match, flags) && 
  29.123               fix_entry(d, &pt[i], &found, is_l1_shadow, max_refs_to_find) &&
  29.124               !prediction )
  29.125 @@ -2680,6 +2678,16 @@ int shadow_fault(unsigned long va, struc
  29.126              domain_crash_synchronous();
  29.127          }
  29.128  
  29.129 +        /* User access violation in guest? */
  29.130 +        if ( unlikely((regs->error_code & 4) && 
  29.131 +                      !(l1e_get_flags(gpte) & _PAGE_USER)))
  29.132 +        {
  29.133 +            SH_VVLOG("shadow_fault - EXIT: wr fault on super page (%" PRIpte ")", 
  29.134 +                    l1e_get_intpte(gpte));
  29.135 +            goto fail;
  29.136 +
  29.137 +        }
  29.138 +
  29.139          if ( unlikely(!l1pte_write_fault(v, &gpte, &spte, va)) )
  29.140          {
  29.141              SH_VVLOG("shadow_fault - EXIT: l1pte_write_fault failed");
  29.142 @@ -2693,6 +2701,16 @@ int shadow_fault(unsigned long va, struc
  29.143      }
  29.144      else
  29.145      {
  29.146 +        /* Read-protection violation in guest? */
  29.147 +        if ( unlikely((regs->error_code & 1) ))
  29.148 +        {
  29.149 +            SH_VVLOG("shadow_fault - EXIT: read fault on super page (%" PRIpte ")", 
  29.150 +                    l1e_get_intpte(gpte));
  29.151 +            goto fail;
  29.152 +
  29.153 +        }
  29.154 +
  29.155 +
  29.156          if ( !l1pte_read_fault(d, &gpte, &spte) )
  29.157          {
  29.158              SH_VVLOG("shadow_fault - EXIT: l1pte_read_fault failed");
  29.159 @@ -3254,14 +3272,10 @@ int check_l2_table(
  29.160                 l2e_get_intpte(match));
  29.161      }
  29.162  
  29.163 -#ifdef __i386__
  29.164      if ( shadow_mode_external(d) )
  29.165          limit = L2_PAGETABLE_ENTRIES;
  29.166      else
  29.167          limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
  29.168 -#else
  29.169 -    limit = 0; /* XXX x86/64 XXX */
  29.170 -#endif
  29.171  
  29.172      /* Check the whole L2. */
  29.173      for ( i = 0; i < limit; i++ )
  29.174 @@ -3323,14 +3337,10 @@ int _check_pagetable(struct vcpu *v, cha
  29.175      spl2e = (l2_pgentry_t *) map_domain_page(smfn);
  29.176  
  29.177      /* Go back and recurse. */
  29.178 -#ifdef __i386__
  29.179      if ( shadow_mode_external(d) )
  29.180          limit = L2_PAGETABLE_ENTRIES;
  29.181      else
  29.182          limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
  29.183 -#else
  29.184 -    limit = 0; /* XXX x86/64 XXX */
  29.185 -#endif
  29.186  
  29.187      for ( i = 0; i < limit; i++ )
  29.188      {
  29.189 @@ -3347,11 +3357,6 @@ int _check_pagetable(struct vcpu *v, cha
  29.190      unmap_domain_page(spl2e);
  29.191      unmap_domain_page(gpl2e);
  29.192  
  29.193 -#if 0
  29.194 -    SH_VVLOG("PT verified : l2_present = %d, l1_present = %d",
  29.195 -             sh_l2_present, sh_l1_present);
  29.196 -#endif
  29.197 -
  29.198   out:
  29.199      if ( errors )
  29.200          BUG();
    30.1 --- a/xen/arch/x86/shadow_public.c	Tue Nov 29 15:00:01 2005 +0000
    30.2 +++ b/xen/arch/x86/shadow_public.c	Tue Nov 29 15:00:27 2005 +0000
    30.3 @@ -1077,36 +1077,40 @@ int __shadow_mode_enable(struct domain *
    30.4      //
    30.5      free_shadow_pages(d);
    30.6  
    30.7 -    /*
    30.8 -     * Tear down it's counts by disassembling its page-table-based ref counts.
    30.9 -     * Also remove CR3's gcount/tcount.
   30.10 -     * That leaves things like GDTs and LDTs and external refs in tact.
   30.11 -     *
   30.12 -     * Most pages will be writable tcount=0.
   30.13 -     * Some will still be L1 tcount=0 or L2 tcount=0.
   30.14 -     * Maybe some pages will be type none tcount=0.
   30.15 -     * Pages granted external writable refs (via grant tables?) will
   30.16 -     * still have a non-zero tcount.  That's OK.
   30.17 -     *
   30.18 -     * gcounts will generally be 1 for PGC_allocated.
   30.19 -     * GDTs and LDTs will have additional gcounts.
   30.20 -     * Any grant-table based refs will still be in the gcount.
   30.21 -     *
   30.22 -     * We attempt to grab writable refs to each page (thus setting its type).
   30.23 -     * Immediately put back those type refs.
   30.24 -     *
   30.25 -     * Assert that no pages are left with L1/L2/L3/L4 type.
   30.26 -     */
   30.27 -    audit_adjust_pgtables(d, -1, 1);
   30.28 -
   30.29      d->arch.shadow_mode = mode;
   30.30  
   30.31      if ( shadow_mode_refcounts(d) )
   30.32      {
   30.33 -        struct list_head *list_ent = d->page_list.next;
   30.34 -        while ( list_ent != &d->page_list )
   30.35 -        {
   30.36 -            struct pfn_info *page = list_entry(list_ent, struct pfn_info, list);
   30.37 +        struct list_head *list_ent; 
   30.38 +
   30.39 +        /*
   30.40 +         * Tear down its counts by disassembling its page-table-based refcounts
   30.41 +         * Also remove CR3's gcount/tcount.
   30.42 +         * That leaves things like GDTs and LDTs and external refs in tact.
   30.43 +         *
   30.44 +         * Most pages will be writable tcount=0.
   30.45 +         * Some will still be L1 tcount=0 or L2 tcount=0.
   30.46 +         * Maybe some pages will be type none tcount=0.
   30.47 +         * Pages granted external writable refs (via grant tables?) will
   30.48 +         * still have a non-zero tcount.  That's OK.
   30.49 +         *
   30.50 +         * gcounts will generally be 1 for PGC_allocated.
   30.51 +         * GDTs and LDTs will have additional gcounts.
   30.52 +         * Any grant-table based refs will still be in the gcount.
   30.53 +         *
   30.54 +         * We attempt to grab writable refs to each page thus setting its type
   30.55 +         * Immediately put back those type refs.
   30.56 +         *
   30.57 +         * Assert that no pages are left with L1/L2/L3/L4 type.
   30.58 +         */
   30.59 +        audit_adjust_pgtables(d, -1, 1);
   30.60 +
   30.61 +
   30.62 +        for (list_ent = d->page_list.next; list_ent != &d->page_list; 
   30.63 +             list_ent = page->list.next) {
   30.64 +            
   30.65 +            struct pfn_info *page = list_entry(list_ent, 
   30.66 +                                               struct pfn_info, list);
   30.67              if ( !get_page_type(page, PGT_writable_page) )
   30.68                  BUG();
   30.69              put_page_type(page);
   30.70 @@ -1114,14 +1118,14 @@ int __shadow_mode_enable(struct domain *
   30.71               * We use tlbflush_timestamp as back pointer to smfn, and need to
   30.72               * clean up it.
   30.73               */
   30.74 -            if ( shadow_mode_external(d) )
   30.75 +            if (shadow_mode_external(d))
   30.76                  page->tlbflush_timestamp = 0;
   30.77 -            list_ent = page->list.next;
   30.78          }
   30.79 +        
   30.80 +        audit_adjust_pgtables(d, 1, 1);
   30.81 +  
   30.82      }
   30.83  
   30.84 -    audit_adjust_pgtables(d, 1, 1);
   30.85 -
   30.86      return 0;
   30.87  
   30.88   nomem:
    31.1 --- a/xen/arch/x86/time.c	Tue Nov 29 15:00:01 2005 +0000
    31.2 +++ b/xen/arch/x86/time.c	Tue Nov 29 15:00:27 2005 +0000
    31.3 @@ -683,8 +683,11 @@ static inline void version_update_end(u3
    31.4  
    31.5  static inline void __update_dom_time(struct vcpu *v)
    31.6  {
    31.7 -    struct cpu_time       *t = &cpu_time[smp_processor_id()];
    31.8 -    struct vcpu_time_info *u = &v->domain->shared_info->vcpu_time[v->vcpu_id];
    31.9 +    struct cpu_time       *t;
   31.10 +    struct vcpu_time_info *u;
   31.11 +
   31.12 +    t = &cpu_time[smp_processor_id()];
   31.13 +    u = &v->domain->shared_info->vcpu_info[v->vcpu_id].time;
   31.14  
   31.15      version_update_begin(&u->version);
   31.16  
   31.17 @@ -698,7 +701,7 @@ static inline void __update_dom_time(str
   31.18  
   31.19  void update_dom_time(struct vcpu *v)
   31.20  {
   31.21 -    if ( v->domain->shared_info->vcpu_time[v->vcpu_id].tsc_timestamp != 
   31.22 +    if ( v->domain->shared_info->vcpu_info[v->vcpu_id].time.tsc_timestamp != 
   31.23           cpu_time[smp_processor_id()].local_tsc_stamp )
   31.24          __update_dom_time(v);
   31.25  }
    32.1 --- a/xen/common/schedule.c	Tue Nov 29 15:00:01 2005 +0000
    32.2 +++ b/xen/common/schedule.c	Tue Nov 29 15:00:27 2005 +0000
    32.3 @@ -115,7 +115,7 @@ struct vcpu *alloc_vcpu(
    32.4  
    32.5      if ( vcpu_id != 0 )
    32.6      {
    32.7 -        v->vcpu_info = &d->shared_info->vcpu_data[vcpu_id];
    32.8 +        v->vcpu_info = &d->shared_info->vcpu_info[vcpu_id];
    32.9          d->vcpu[v->vcpu_id-1]->next_in_list = v;
   32.10          set_bit(_VCPUF_down, &v->vcpu_flags);
   32.11      }
    33.1 --- a/xen/include/public/arch-x86_32.h	Tue Nov 29 15:00:01 2005 +0000
    33.2 +++ b/xen/include/public/arch-x86_32.h	Tue Nov 29 15:00:27 2005 +0000
    33.3 @@ -134,7 +134,7 @@ typedef struct arch_shared_info {
    33.4  
    33.5  typedef struct {
    33.6      unsigned long cr2;
    33.7 -    unsigned long pad; /* sizeof(vcpu_info_t) == 16 */
    33.8 +    unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
    33.9  } arch_vcpu_info_t;
   33.10  
   33.11  #endif
    34.1 --- a/xen/include/public/arch-x86_64.h	Tue Nov 29 15:00:01 2005 +0000
    34.2 +++ b/xen/include/public/arch-x86_64.h	Tue Nov 29 15:00:27 2005 +0000
    34.3 @@ -203,7 +203,7 @@ typedef struct arch_shared_info {
    34.4  
    34.5  typedef struct {
    34.6      unsigned long cr2;
    34.7 -    unsigned long pad; /* sizeof(vcpu_info_t) == 32 */
    34.8 +    unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
    34.9  } arch_vcpu_info_t;
   34.10  
   34.11  #endif /* !__ASSEMBLY__ */
    35.1 --- a/xen/include/public/trace.h	Tue Nov 29 15:00:01 2005 +0000
    35.2 +++ b/xen/include/public/trace.h	Tue Nov 29 15:00:27 2005 +0000
    35.3 @@ -72,8 +72,8 @@ struct t_rec {
    35.4   * field, indexes into an array of struct t_rec's.
    35.5   */
    35.6  struct t_buf {
    35.7 -    unsigned int  cons;      /* Next item to be consumed by control tools. */
    35.8 -    unsigned int  prod;      /* Next item to be produced by Xen.           */
    35.9 +    uint32_t cons;      /* Next item to be consumed by control tools. */
   35.10 +    uint32_t prod;      /* Next item to be produced by Xen.           */
   35.11      /* 'nr_recs' records follow immediately after the meta-data header.    */
   35.12  };
   35.13  
    36.1 --- a/xen/include/public/xen.h	Tue Nov 29 15:00:01 2005 +0000
    36.2 +++ b/xen/include/public/xen.h	Tue Nov 29 15:00:27 2005 +0000
    36.3 @@ -266,10 +266,31 @@ typedef struct
    36.4   */
    36.5  #define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
    36.6  
    36.7 -/*
    36.8 - * Per-VCPU information goes here. This will be cleaned up more when Xen 
    36.9 - * actually supports multi-VCPU guests.
   36.10 - */
   36.11 +typedef struct vcpu_time_info {
   36.12 +    /*
   36.13 +     * Updates to the following values are preceded and followed by an
   36.14 +     * increment of 'version'. The guest can therefore detect updates by
   36.15 +     * looking for changes to 'version'. If the least-significant bit of
   36.16 +     * the version number is set then an update is in progress and the guest
   36.17 +     * must wait to read a consistent set of values.
   36.18 +     * The correct way to interact with the version number is similar to
   36.19 +     * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
   36.20 +     */
   36.21 +    uint32_t version;
   36.22 +    uint32_t pad0;
   36.23 +    uint64_t tsc_timestamp;   /* TSC at last update of time vals.  */
   36.24 +    uint64_t system_time;     /* Time, in nanosecs, since boot.    */
   36.25 +    /*
   36.26 +     * Current system time:
   36.27 +     *   system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
   36.28 +     * CPU frequency (Hz):
   36.29 +     *   ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
   36.30 +     */
   36.31 +    uint32_t tsc_to_system_mul;
   36.32 +    int8_t   tsc_shift;
   36.33 +    int8_t   pad1[3];
   36.34 +} vcpu_time_info_t; /* 32 bytes */
   36.35 +
   36.36  typedef struct vcpu_info {
   36.37      /*
   36.38       * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
   36.39 @@ -300,39 +321,15 @@ typedef struct vcpu_info {
   36.40      uint8_t evtchn_upcall_mask;
   36.41      unsigned long evtchn_pending_sel;
   36.42      arch_vcpu_info_t arch;
   36.43 -} vcpu_info_t;
   36.44 -
   36.45 -typedef struct vcpu_time_info {
   36.46 -    /*
   36.47 -     * Updates to the following values are preceded and followed by an
   36.48 -     * increment of 'version'. The guest can therefore detect updates by
   36.49 -     * looking for changes to 'version'. If the least-significant bit of
   36.50 -     * the version number is set then an update is in progress and the guest
   36.51 -     * must wait to read a consistent set of values.
   36.52 -     * The correct way to interact with the version number is similar to
   36.53 -     * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
   36.54 -     */
   36.55 -    uint32_t version;
   36.56 -    uint64_t tsc_timestamp;   /* TSC at last update of time vals.  */
   36.57 -    uint64_t system_time;     /* Time, in nanosecs, since boot.    */
   36.58 -    /*
   36.59 -     * Current system time:
   36.60 -     *   system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
   36.61 -     * CPU frequency (Hz):
   36.62 -     *   ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
   36.63 -     */
   36.64 -    uint32_t tsc_to_system_mul;
   36.65 -    int8_t  tsc_shift;
   36.66 -} vcpu_time_info_t;
   36.67 +    vcpu_time_info_t time;
   36.68 +} vcpu_info_t; /* 64 bytes (x86) */
   36.69  
   36.70  /*
   36.71   * Xen/kernel shared data -- pointer provided in start_info.
   36.72   * NB. We expect that this struct is smaller than a page.
   36.73   */
   36.74  typedef struct shared_info {
   36.75 -    vcpu_info_t vcpu_data[MAX_VIRT_CPUS];
   36.76 -
   36.77 -    vcpu_time_info_t vcpu_time[MAX_VIRT_CPUS];
   36.78 +    vcpu_info_t vcpu_info[MAX_VIRT_CPUS];
   36.79  
   36.80      /*
   36.81       * A domain can create "event channels" on which it can send and receive