WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Merged.

# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 74fa88cf3dc7cc3132b8532ac65a5d1d6de2b63f
# Parent  b1940475284fb54a25e90868722c887b213c0448
# Parent  92469b92f76889dceadf51733214c0d8afa88fc9
Merged.

diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c  Tue Nov 29 
15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c  Tue Nov 29 
15:00:27 2005
@@ -155,7 +155,7 @@
     unsigned int   l1i, l2i, port;
     irqreturn_t (*handler)(int, void *, struct pt_regs *);
     shared_info_t *s = HYPERVISOR_shared_info;
-    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
+    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
 
     vcpu_info->evtchn_upcall_mask = 1;
     vcpu_info->evtchn_upcall_pending = 0;
@@ -203,7 +203,7 @@
 void __init evtchn_init(void)
 {
     shared_info_t *s = HYPERVISOR_shared_info;
-    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
+    vcpu_info_t   *vcpu_info = &s->vcpu_info[smp_processor_id()];
 
 #if 0
     int ret;
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32
--- a/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32        Tue Nov 
29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/configs/xen_defconfig_x86_32        Tue Nov 
29 15:00:27 2005
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.12.6-xen
-# Wed Nov 23 21:01:11 2005
+# Mon Nov 28 11:04:51 2005
 #
 CONFIG_XEN=y
 CONFIG_ARCH_XEN=y
@@ -1629,7 +1629,7 @@
 CONFIG_KEYBOARD_XTKBD=m
 CONFIG_KEYBOARD_NEWTON=m
 CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=m
+CONFIG_MOUSE_PS2=y
 CONFIG_MOUSE_SERIAL=m
 CONFIG_MOUSE_INPORT=m
 # CONFIG_MOUSE_ATIXL is not set
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/entry.S Tue Nov 29 15:00:27 2005
@@ -81,7 +81,7 @@
 #define evtchn_upcall_pending          /* 0 */
 #define evtchn_upcall_mask             1
 
-#define sizeof_vcpu_shift              4
+#define sizeof_vcpu_shift              6
 
 #ifdef CONFIG_SMP
 #define preempt_disable(reg)   incl TI_preempt_count(reg)
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c  Tue Nov 29 15:00:27 2005
@@ -204,7 +204,8 @@
 void init_cpu_khz(void)
 {
        u64 __cpu_khz = 1000000ULL << 32;
-       struct vcpu_time_info *info = &HYPERVISOR_shared_info->vcpu_time[0];
+       struct vcpu_time_info *info;
+       info = &HYPERVISOR_shared_info->vcpu_info[0].time;
        do_div(__cpu_khz, info->tsc_to_system_mul);
        if ( info->tsc_shift < 0 )
                cpu_khz = __cpu_khz << -info->tsc_shift;
@@ -284,7 +285,7 @@
        struct vcpu_time_info   *src;
        struct shadow_time_info *dst;
 
-       src = &s->vcpu_time[smp_processor_id()];
+       src = &s->vcpu_info[smp_processor_id()].time;
        dst = &per_cpu(shadow_time, smp_processor_id());
 
        do {
@@ -306,7 +307,7 @@
        struct vcpu_time_info   *src;
        struct shadow_time_info *dst;
 
-       src = &HYPERVISOR_shared_info->vcpu_time[cpu]; 
+       src = &HYPERVISOR_shared_info->vcpu_info[cpu].time;
        dst = &per_cpu(shadow_time, cpu); 
 
        return (dst->version == src->version);
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c     Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c     Tue Nov 29 15:00:27 2005
@@ -291,7 +291,7 @@
        int write;
        siginfo_t info;
 
-       address = HYPERVISOR_shared_info->vcpu_data[
+       address = HYPERVISOR_shared_info->vcpu_info[
                smp_processor_id()].arch.cr2;
 
        /* Set the "privileged fault" bit to something sane. */
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Tue Nov 29 15:00:27 2005
@@ -154,7 +154,7 @@
        unsigned int   l1i, l2i, port;
        int            irq, cpu = smp_processor_id();
        shared_info_t *s = HYPERVISOR_shared_info;
-       vcpu_info_t   *vcpu_info = &s->vcpu_data[cpu];
+       vcpu_info_t   *vcpu_info = &s->vcpu_info[cpu];
 
        vcpu_info->evtchn_upcall_pending = 0;
 
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S   Tue Nov 29 
15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/xen_entry.S   Tue Nov 29 
15:00:27 2005
@@ -5,7 +5,7 @@
 #define evtchn_upcall_pending          0
 #define evtchn_upcall_mask             1
 
-#define sizeof_vcpu_shift              5
+#define sizeof_vcpu_shift              6
 
 #ifdef CONFIG_SMP
 //#define preempt_disable(reg) incl threadinfo_preempt_count(reg)
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c   Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/fault.c   Tue Nov 29 15:00:27 2005
@@ -344,7 +344,7 @@
 #endif
 
        /* get the address */
-       address = HYPERVISOR_shared_info->vcpu_data[
+       address = HYPERVISOR_shared_info->vcpu_info[
                smp_processor_id()].arch.cr2;
 
        if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Tue Nov 29 15:00:27 2005
@@ -38,6 +38,8 @@
        struct block_device *bdev;
 }; 
 
+struct backend_info; 
+
 typedef struct blkif_st {
        /* Unique identifier for this interface. */
        domid_t           domid;
@@ -48,8 +50,10 @@
        /* Comms information. */
        blkif_back_ring_t blk_ring;
        struct vm_struct *blk_ring_area;
-       /* VBDs attached to this interface. */
+       /* The VBD attached to this interface. */
        struct vbd        vbd;
+       /* Back pointer to the backend_info. */
+       struct backend_info *be; 
        /* Private fields. */
        enum { DISCONNECTED, CONNECTED } status;
 #ifdef CONFIG_XEN_BLKDEV_TAP_BE
@@ -103,6 +107,8 @@
 
 irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
 
+void update_blkif_status(blkif_t *blkif); 
+
 #endif /* __BLKIF__BACKEND__COMMON_H__ */
 
 /*
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Tue Nov 29 
15:00:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Tue Nov 29 
15:00:27 2005
@@ -112,7 +112,9 @@
 
        blkif->irq = bind_evtchn_to_irqhandler(
                blkif->evtchn, blkif_be_int, 0, "blkif-backend", blkif);
-       blkif->status = CONNECTED;
+
+       /* We're potentially connected now */
+       update_blkif_status(blkif); 
 
        return 0;
 }
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c Tue Nov 29 15:00:27 2005
@@ -50,6 +50,16 @@
                            unsigned int);
 
 
+void update_blkif_status(blkif_t *blkif)
+{ 
+       if(blkif->irq && blkif->vbd.bdev) {
+               blkif->status = CONNECTED; 
+               (void)blkif_be_int(0, blkif, NULL); 
+       }
+       maybe_connect(blkif->be); 
+}
+
+
 static ssize_t show_physical_device(struct device *_dev, char *buf)
 {
        struct xenbus_device *dev = to_xenbus_device(_dev);
@@ -81,6 +91,7 @@
                be->backend_watch.node = NULL;
        }
        if (be->blkif) {
+               be->blkif->status = DISCONNECTED; 
                blkif_put(be->blkif);
                be->blkif = NULL;
        }
@@ -122,6 +133,9 @@
                xenbus_dev_fatal(dev, err, "creating block interface");
                goto fail;
        }
+
+       /* setup back pointer */
+       be->blkif->be = be; 
 
        err = xenbus_watch_path2(dev, dev->nodename, "physical-device",
                                 &be->backend_watch, backend_changed);
@@ -209,7 +223,8 @@
                device_create_file(&dev->dev, &dev_attr_physical_device);
                device_create_file(&dev->dev, &dev_attr_mode);
 
-               maybe_connect(be);
+               /* We're potentially connected now */
+               update_blkif_status(be->blkif); 
        }
 }
 
@@ -235,7 +250,7 @@
                if (err) {
                        return;
                }
-               maybe_connect(be);
+               update_blkif_status(be->blkif); 
                break;
 
        case XenbusStateClosing:
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h    Tue Nov 29 
15:00:01 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h    Tue Nov 29 
15:00:27 2005
@@ -501,7 +501,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        _vcpu->evtchn_upcall_mask = 1;                                  \
        preempt_enable_no_resched();                                    \
        barrier();                                                      \
@@ -512,7 +512,7 @@
        vcpu_info_t *_vcpu;                                             \
        barrier();                                                      \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        _vcpu->evtchn_upcall_mask = 0;                                  \
        barrier(); /* unmask then check (avoid races) */                \
        if ( unlikely(_vcpu->evtchn_upcall_pending) )                   \
@@ -524,7 +524,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        (x) = _vcpu->evtchn_upcall_mask;                                \
        preempt_enable();                                               \
 } while (0)
@@ -534,7 +534,7 @@
        vcpu_info_t *_vcpu;                                             \
        barrier();                                                      \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {                   \
                barrier(); /* unmask then check (avoid races) */        \
                if ( unlikely(_vcpu->evtchn_upcall_pending) )           \
@@ -550,7 +550,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        (x) = _vcpu->evtchn_upcall_mask;                                \
        _vcpu->evtchn_upcall_mask = 1;                                  \
        preempt_enable_no_resched();                                    \
@@ -568,7 +568,7 @@
 ({     int ___x;                                                       \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        ___x = (_vcpu->evtchn_upcall_mask != 0);                        \
        preempt_enable_no_resched();                                    \
        ___x; })
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h  Tue Nov 29 
15:00:01 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h  Tue Nov 29 
15:00:27 2005
@@ -325,7 +325,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        _vcpu->evtchn_upcall_mask = 1;                                  \
        preempt_enable_no_resched();                                    \
        barrier();                                                      \
@@ -336,7 +336,7 @@
        vcpu_info_t *_vcpu;                                             \
        barrier();                                                      \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        _vcpu->evtchn_upcall_mask = 0;                                  \
        barrier(); /* unmask then check (avoid races) */                \
        if ( unlikely(_vcpu->evtchn_upcall_pending) )                   \
@@ -348,7 +348,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        (x) = _vcpu->evtchn_upcall_mask;                                \
        preempt_enable();                                               \
 } while (0)
@@ -358,7 +358,7 @@
        vcpu_info_t *_vcpu;                                             \
        barrier();                                                      \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {                   \
                barrier(); /* unmask then check (avoid races) */        \
                if ( unlikely(_vcpu->evtchn_upcall_pending) )           \
@@ -374,7 +374,7 @@
 do {                                                                   \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        (x) = _vcpu->evtchn_upcall_mask;                                \
        _vcpu->evtchn_upcall_mask = 1;                                  \
        preempt_enable_no_resched();                                    \
@@ -394,7 +394,7 @@
 ({     int ___x;                                                       \
        vcpu_info_t *_vcpu;                                             \
        preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_data[smp_processor_id()]; \
+       _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \
        ___x = (_vcpu->evtchn_upcall_mask != 0);                        \
        preempt_enable_no_resched();                                    \
        ___x; })
diff -r b1940475284f -r 74fa88cf3dc7 
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
--- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Tue Nov 29 15:00:01 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Tue Nov 29 15:00:27 2005
@@ -102,7 +102,7 @@
 static inline void unmask_evtchn(int port)
 {
        shared_info_t *s = HYPERVISOR_shared_info;
-       vcpu_info_t *vcpu_info = &s->vcpu_data[smp_processor_id()];
+       vcpu_info_t *vcpu_info = &s->vcpu_info[smp_processor_id()];
 
        synch_clear_bit(port, &s->evtchn_mask[0]);
 
diff -r b1940475284f -r 74fa88cf3dc7 tools/examples/block
--- a/tools/examples/block      Tue Nov 29 15:00:01 2005
+++ b/tools/examples/block      Tue Nov 29 15:00:27 2005
@@ -202,59 +202,61 @@
 mount it read-write in a guest domain."
         fi
 
-        loopdev=''
-
-       for dev in /dev/loop*
-        do
-          if [ ! -b "$dev" ]
-          then
-            continue
-          fi
-
-          f=$(losetup "$dev" 2>/dev/null) || f='()'
-          f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
-
-          log err "$file $f $dev"
-
-          if [ "$f" ]
-          then
-            # $dev is in use.  Check sharing.
-
-            if [ "$mode" == 'no' ]
+
+       while true
+        do 
+          loopdev=''
+          for dev in /dev/loop*
+          do
+            if [ ! -b "$dev" ]
             then
               continue
             fi
 
-            f=$(readlink -f "$f")
-
-            if [ "$f" == "$file" ]
+            f=$(losetup "$dev" 2>/dev/null) || f='()'
+            f=$(echo "$f" | sed -e 's/.*(\(.*\)).*/\1/g')
+
+            log err "$file $f $dev"
+
+            if [ "$f" ]
             then
-              check_file_sharing "$file" "$dev" "$mode"
+              # $dev is in use.  Check sharing.
+              if [ "$mode" == 'no' ]
+              then
+                continue
+              fi
+
+              f=$(readlink -f "$f")
+
+              if [ "$f" == "$file" ]
+              then
+                check_file_sharing "$file" "$dev" "$mode"
+              fi
+            else
+              # $dev is not in use, so we'll remember it for use later; we want
+              # to finish the sharing check first.
+              
+              if [ "$loopdev" == '' ]
+              then
+                loopdev="$dev"
+              fi
             fi
+          done
+
+          if [ "$loopdev" == '' ]
+          then
+            fatal 'Failed to find an unused loop device'
+          fi
+          if losetup "$loopdev" "$file"
+          then
+           log err "mapped $file using $loopdev"
+            xenstore_write "$XENBUS_PATH/node" "$loopdev"
+            write_dev "$loopdev"
+            exit 0
           else
-            # $dev is not in use, so we'll remember it for use later; we want
-            # to finish the sharing check first.
-            
-            if [ "$loopdev" == '' ]
-            then
-              loopdev="$dev"
-            fi
+            log err "losetup $loopdev $file failed, retry"
           fi
-        done
-
-        if [ "$loopdev" == '' ]
-        then
-          fatal 'Failed to find an unused loop device'
-        fi
-
-        if losetup "$loopdev" "$file"
-        then
-          xenstore_write "$XENBUS_PATH/node" "$loopdev"
-          write_dev "$loopdev"
-          exit 0
-        else
-          fatal "losetup $loopdev $file failed"
-        fi
+       done
        ;;
     esac
     ;;
diff -r b1940475284f -r 74fa88cf3dc7 tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c      Tue Nov 29 15:00:01 2005
+++ b/tools/ioemu/hw/ide.c      Tue Nov 29 15:00:27 2005
@@ -669,6 +669,8 @@
     }
     if (s->io_buffer_index >= s->io_buffer_size && s->nsector == 0) {
         s->status = READY_STAT | SEEK_STAT;
+        s->bmdma->status &= ~BM_STATUS_DMAING;
+        s->bmdma->status |= BM_STATUS_INT;
         ide_set_irq(s);
 #ifdef DEBUG_IDE_ATAPI
         printf("dma status=0x%x\n", s->status);
@@ -736,6 +738,8 @@
             if (n == 0) {
                 /* end of transfer */
                 s->status = READY_STAT | SEEK_STAT;
+                s->bmdma->status &= ~BM_STATUS_DMAING;
+                s->bmdma->status |= BM_STATUS_INT;
                 ide_set_irq(s);
                 return 0;
             }
@@ -983,6 +987,8 @@
     if (s->packet_transfer_size <= 0) {
         s->status = READY_STAT;
         s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | 
ATAPI_INT_REASON_CD;
+        s->bmdma->status &= ~BM_STATUS_DMAING;
+        s->bmdma->status |= BM_STATUS_INT;
         ide_set_irq(s);
 #ifdef DEBUG_IDE_ATAPI
         printf("dma status=0x%x\n", s->status);
@@ -2065,8 +2071,6 @@
     }
     /* end of transfer */
  the_end:
-    bm->status &= ~BM_STATUS_DMAING;
-    bm->status |= BM_STATUS_INT;
     bm->dma_cb = NULL;
     bm->ide_if = NULL;
 }
diff -r b1940475284f -r 74fa88cf3dc7 tools/ioemu/hw/vga.c
--- a/tools/ioemu/hw/vga.c      Tue Nov 29 15:00:01 2005
+++ b/tools/ioemu/hw/vga.c      Tue Nov 29 15:00:27 2005
@@ -1834,16 +1834,6 @@
 
     /* TODO:add vbe support if enable it */
 
-    FILE *qemuf = fopen("/etc/xen/qemu-vgaram-bin", "rb");
-    if (!qemuf) {
-        fprintf(logfile, "open qemu vgaram binary failed!\n");
-    } else {
-        /*load vram contents, else vga console can't boot */
-        qemu_get_buffer(qemuf, s->vram_ptr, 256*1024);
-
-        fclose(qemuf);
-    }
-
 }
 
 void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
diff -r b1940475284f -r 74fa88cf3dc7 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Tue Nov 29 15:00:01 2005
+++ b/tools/libxc/xc_linux_build.c      Tue Nov 29 15:00:27 2005
@@ -657,7 +657,7 @@
     memset(shared_info, 0, sizeof(shared_info_t));
     /* Mask all upcalls... */
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
-        shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
     munmap(shared_info, PAGE_SIZE);
 
diff -r b1940475284f -r 74fa88cf3dc7 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Tue Nov 29 15:00:01 2005
+++ b/tools/libxc/xc_linux_restore.c    Tue Nov 29 15:00:27 2005
@@ -671,7 +671,7 @@
     memset(&(shared_info->evtchn_pending[0]), 0,
            sizeof (shared_info->evtchn_pending));
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
-        shared_info->vcpu_data[i].evtchn_pending_sel = 0;
+        shared_info->vcpu_info[i].evtchn_pending_sel = 0;
 
     /* Copy saved contents of shared-info page. No checking needed. */
     page = xc_map_foreign_range(
diff -r b1940475284f -r 74fa88cf3dc7 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Tue Nov 29 15:00:01 2005
+++ b/tools/libxc/xc_vmx_build.c        Tue Nov 29 15:00:27 2005
@@ -524,7 +524,7 @@
     memset(shared_info, 0, sizeof(shared_info_t));
     /* Mask all upcalls... */
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
-        shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+        shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
     munmap(shared_info, PAGE_SIZE);
 
diff -r b1940475284f -r 74fa88cf3dc7 tools/python/xen/util/bugtool.py
--- a/tools/python/xen/util/bugtool.py  Tue Nov 29 15:00:01 2005
+++ b/tools/python/xen/util/bugtool.py  Tue Nov 29 15:00:27 2005
@@ -162,7 +162,7 @@
             print >>sys.stderr, (
                 'Attach failed: %s %s.' % (response.status, response.reason))
         elif not m or m.group(1) != 'Changes Submitted':
-            print >>sys.syderr, (
+            print >>sys.stderr, (
                 'Attach failed: got a page titled %s.' % m.group(1))
         else:
             print "Attaching %s to bug %d succeeded." % (filename, bug)
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/ia64/vmx/vmx_hypercall.c
--- a/xen/arch/ia64/vmx/vmx_hypercall.c Tue Nov 29 15:00:01 2005
+++ b/xen/arch/ia64/vmx/vmx_hypercall.c Tue Nov 29 15:00:27 2005
@@ -198,7 +198,7 @@
     if (o_info) {
        memcpy((void*)d->shared_info, (void*)o_info, PAGE_SIZE);
        for_each_vcpu(d, v) {
-               v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
+               v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
        }
        /* If original page belongs to xen heap, then relinguish back
         * to xen heap. Or else, leave to domain itself to decide.
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Nov 29 15:00:01 2005
+++ b/xen/arch/ia64/xen/domain.c        Tue Nov 29 15:00:27 2005
@@ -205,7 +205,7 @@
        printf("arch_vcpu_info=%p\n", d->vcpu[0].arch.privregs);
        memset(d->vcpu.arch.privregs, 0, PAGE_SIZE);
 #endif
-       v->vcpu_info = &(d->shared_info->vcpu_data[0]);
+       v->vcpu_info = &(d->shared_info->vcpu_info[0]);
 
        d->max_pages = (128UL*1024*1024)/PAGE_SIZE; // 128MB default // FIXME
 
@@ -867,7 +867,7 @@
 
        /* Mask all upcalls... */
        for ( i = 1; i < MAX_VIRT_CPUS; i++ )
-           d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+           d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
 #ifdef VALIDATE_VT 
        /* Construct a frame-allocation list for the initial domain, since these
@@ -997,7 +997,7 @@
 
        /* Mask all upcalls... */
        for ( i = 0; i < MAX_VIRT_CPUS; i++ )
-               d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+               d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
        /* Copy the OS image. */
        printk("calling loaddomainelfimage(%p,%p)\n",d,image_start);
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/audit.c
--- a/xen/arch/x86/audit.c      Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/audit.c      Tue Nov 29 15:00:27 2005
@@ -51,7 +51,30 @@
     int errors = 0;
     int shadow_refcounts = !!shadow_mode_refcounts(d);
     int shadow_enabled = !!shadow_mode_enabled(d);
-    int l2limit;
+
+    int l2limit( unsigned long mfn )
+    {
+
+        if ( shadow_mode_external(d) )
+            return L2_PAGETABLE_ENTRIES;
+
+#ifdef __i386__
+#ifdef CONFIG_X86_PAE
+        /* 32b PAE */
+        if ( (( frame_table[mfn].u.inuse.type_info & PGT_va_mask ) 
+           >> PGT_va_shift) == 3 )
+            return l2_table_offset(HYPERVISOR_VIRT_START); 
+        else
+            return L2_PAGETABLE_ENTRIES;
+#else
+        /* 32b non-PAE */
+        return DOMAIN_ENTRIES_PER_L2_PAGETABLE;
+#endif
+#else
+        /* 64b */
+        return 0; /* XXX x86/64 XXX */
+#endif
+    }
 
     void _adjust(struct pfn_info *page, int adjtype ADJUST_EXTRA_ARGS)
     {
@@ -121,15 +144,15 @@
 
     void adjust_l2_page(unsigned long mfn, int shadow)
     {
-        unsigned long *pt = map_domain_page(mfn);
+        l2_pgentry_t *pt = map_domain_page(mfn);
         int i;
         u32 page_type;
 
-        for ( i = 0; i < l2limit; i++ )
-        {
-            if ( pt[i] & _PAGE_PRESENT )
-            {
-                unsigned long l1mfn = pt[i] >> PAGE_SHIFT;
+        for ( i = 0; i < l2limit(mfn); i++ )
+        {
+            if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
+            {
+               unsigned long l1mfn = l2e_get_pfn(pt[i]);
                 struct pfn_info *l1page = pfn_to_page(l1mfn);
 
                 if ( noisy )
@@ -199,7 +222,7 @@
         if ( shadow_mode_translate(d) && !shadow_mode_external(d) )
         {
             unsigned long hl2mfn =
-                pt[l2_table_offset(LINEAR_PT_VIRT_START)] >> PAGE_SHIFT;
+                l2e_get_pfn(pt[l2_table_offset(LINEAR_PT_VIRT_START)]);
             struct pfn_info *hl2page = pfn_to_page(hl2mfn);
             adjust(hl2page, 0);
         }
@@ -209,14 +232,14 @@
 
     void adjust_hl2_page(unsigned long hl2mfn)
     {
-        unsigned long *pt = map_domain_page(hl2mfn);
+        l2_pgentry_t *pt = map_domain_page(hl2mfn);
         int i;
 
-        for ( i = 0; i < l2limit; i++ )
-        {
-            if ( pt[i] & _PAGE_PRESENT )
-            {
-                unsigned long gmfn = pt[i] >> PAGE_SHIFT;
+        for ( i = 0; i < l2limit(hl2mfn); i++ )
+        {
+            if ( l2e_get_flags(pt[i]) & _PAGE_PRESENT )
+            {
+                unsigned long gmfn = l2e_get_pfn(pt[i]);
                 struct pfn_info *gpage = pfn_to_page(gmfn);
 
                 if ( gmfn < 0x100 )
@@ -256,14 +279,14 @@
 
     void adjust_l1_page(unsigned long l1mfn)
     {
-        unsigned long *pt = map_domain_page(l1mfn);
+        l1_pgentry_t *pt = map_domain_page(l1mfn);
         int i;
 
         for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
         {
-            if ( pt[i] & _PAGE_PRESENT )
-            {
-                unsigned long gmfn = pt[i] >> PAGE_SHIFT;
+            if ( l1e_get_flags(pt[i]) & _PAGE_PRESENT )
+            {
+                unsigned long gmfn = l1e_get_pfn(pt[i]);
                 struct pfn_info *gpage = pfn_to_page(gmfn);
 
                 if ( gmfn < 0x100 )
@@ -280,7 +303,7 @@
 
                 if ( noisy )
                 {
-                    if ( pt[i] & _PAGE_RW )
+                    if ( l1e_get_flags(pt[i]) & _PAGE_RW )
                     {
                         // If it's not a writable page, complain.
                         //
@@ -320,7 +343,7 @@
                     }
                 }
 
-                adjust(gpage, (pt[i] & _PAGE_RW) ? 1 : 0);
+                adjust(gpage, (l1e_get_flags(pt[i]) & _PAGE_RW) ? 1 : 0);
             }
         }
 
@@ -544,15 +567,6 @@
         }
     }
 
-#ifdef __i386__
-    if ( shadow_mode_external(d) )
-        l2limit = L2_PAGETABLE_ENTRIES;
-    else
-        l2limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
-#else
-    l2limit = 0; /* XXX x86/64 XXX */
-#endif
-
     adjust_for_pgtbase();
 
     adjust_guest_pages();
@@ -604,16 +618,17 @@
                              unsigned long mfn)
     {
         struct pfn_info *page = &frame_table[mfn];
-        unsigned long *pt = map_domain_page(mfn);
+        l1_pgentry_t *pt = map_domain_page(mfn);
         int i;
 
         for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ )
         {
-            if ( (pt[i] & _PAGE_PRESENT) && ((pt[i] >> PAGE_SHIFT) == xmfn) )
+            if ( (l1e_get_flags(pt[i]) & _PAGE_PRESENT) && 
+                 (l1e_get_pfn(pt[i]) == xmfn) )
                 printk("     found dom=%d mfn=%lx t=%" PRtype_info " c=%08x "
-                       "pt[i=%x]=%lx\n",
+                       "pt[i=%x]=%" PRIpte "\n",
                        d->domain_id, mfn, page->u.inuse.type_info,
-                       page->count_info, i, pt[i]);
+                       page->count_info, i, l1e_get_intpte(pt[i]));
         }
 
         unmap_domain_page(pt);           
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/domain.c     Tue Nov 29 15:00:27 2005
@@ -266,7 +266,7 @@
 
     d->shared_info = alloc_xenheap_page();
     memset(d->shared_info, 0, PAGE_SIZE);
-    v->vcpu_info = &d->shared_info->vcpu_data[v->vcpu_id];
+    v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
     v->cpumap = CPUMAP_RUNANYWHERE;
     SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
 
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/domain_build.c       Tue Nov 29 15:00:27 2005
@@ -597,7 +597,7 @@
 
     /* Mask all upcalls... */
     for ( i = 0; i < MAX_VIRT_CPUS; i++ )
-        d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
+        d->shared_info->vcpu_info[i].evtchn_upcall_mask = 1;
 
     for ( i = 1; i < num_online_cpus(); i++ )
         (void)alloc_vcpu(d, i, i);
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/setup.c      Tue Nov 29 15:00:27 2005
@@ -432,7 +432,7 @@
 
     BUG_ON(sizeof(start_info_t) > PAGE_SIZE);
     BUG_ON(sizeof(shared_info_t) > PAGE_SIZE);
-    BUG_ON(sizeof(vcpu_info_t) != (sizeof(unsigned long) * 4));
+    BUG_ON(sizeof(vcpu_info_t) != 64);
 
     init_frametable();
 
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/shadow.c
--- a/xen/arch/x86/shadow.c     Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/shadow.c     Tue Nov 29 15:00:27 2005
@@ -1333,7 +1333,7 @@
         i = (frame_table[readonly_gmfn].u.inuse.type_info & PGT_va_mask)
             >> PGT_va_shift;
 
-        if ( (i >= 0 && i <= L1_PAGETABLE_ENTRIES) &&
+        if ( (i >= 0 && i < L1_PAGETABLE_ENTRIES) &&
              !l1e_has_changed(pt[i], match, flags) &&
              fix_entry(d, &pt[i], &found, is_l1_shadow, max_refs_to_find) &&
              !prediction )
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/shadow32.c
--- a/xen/arch/x86/shadow32.c   Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/shadow32.c   Tue Nov 29 15:00:27 2005
@@ -342,14 +342,10 @@
 
     SH_VVLOG("%s: smfn=%lx freed", __func__, smfn);
 
-#ifdef __i386__
     if ( shadow_mode_external(d) )
         limit = L2_PAGETABLE_ENTRIES;
     else
         limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
-#else
-    limit = 0; /* XXX x86/64 XXX */
-#endif
 
     for ( i = 0; i < limit; i++ )
     {
@@ -740,11 +736,9 @@
     mpl2e = (l2_pgentry_t *)map_domain_page(mmfn);
     memset(mpl2e, 0, PAGE_SIZE);
 
-#ifdef __i386__ /* XXX screws x86/64 build */
     memcpy(&mpl2e[DOMAIN_ENTRIES_PER_L2_PAGETABLE], 
            &idle_pg_table[DOMAIN_ENTRIES_PER_L2_PAGETABLE],
            HYPERVISOR_ENTRIES_PER_L2_PAGETABLE * sizeof(l2_pgentry_t));
-#endif
 
     mpl2e[l2_table_offset(PERDOMAIN_VIRT_START)] =
         l2e_from_paddr(__pa(d->arch.mm_perdomain_pt),
@@ -1033,36 +1027,40 @@
     //
     free_shadow_pages(d);
 
-    /*
-     * Tear down it's counts by disassembling its page-table-based ref counts.
-     * Also remove CR3's gcount/tcount.
-     * That leaves things like GDTs and LDTs and external refs in tact.
-     *
-     * Most pages will be writable tcount=0.
-     * Some will still be L1 tcount=0 or L2 tcount=0.
-     * Maybe some pages will be type none tcount=0.
-     * Pages granted external writable refs (via grant tables?) will
-     * still have a non-zero tcount.  That's OK.
-     *
-     * gcounts will generally be 1 for PGC_allocated.
-     * GDTs and LDTs will have additional gcounts.
-     * Any grant-table based refs will still be in the gcount.
-     *
-     * We attempt to grab writable refs to each page (thus setting its type).
-     * Immediately put back those type refs.
-     *
-     * Assert that no pages are left with L1/L2/L3/L4 type.
-     */
-    audit_adjust_pgtables(d, -1, 1);
-
     d->arch.shadow_mode = mode;
 
     if ( shadow_mode_refcounts(d) )
     {
-        struct list_head *list_ent = d->page_list.next;
-        while ( list_ent != &d->page_list )
-        {
-            struct pfn_info *page = list_entry(list_ent, struct pfn_info, 
list);
+        struct list_head *list_ent; 
+
+        /*
+         * Tear down its counts by disassembling its page-table-based refcounts
+         * Also remove CR3's gcount/tcount.
+         * That leaves things like GDTs and LDTs and external refs in tact.
+         *
+         * Most pages will be writable tcount=0.
+         * Some will still be L1 tcount=0 or L2 tcount=0.
+         * Maybe some pages will be type none tcount=0.
+         * Pages granted external writable refs (via grant tables?) will
+         * still have a non-zero tcount.  That's OK.
+         *
+         * gcounts will generally be 1 for PGC_allocated.
+         * GDTs and LDTs will have additional gcounts.
+         * Any grant-table based refs will still be in the gcount.
+         *
+         * We attempt to grab writable refs to each page thus setting its type
+         * Immediately put back those type refs.
+         *
+         * Assert that no pages are left with L1/L2/L3/L4 type.
+         */
+        audit_adjust_pgtables(d, -1, 1);
+
+
+        for (list_ent = d->page_list.next; list_ent != &d->page_list; 
+             list_ent = page->list.next) {
+            
+            struct pfn_info *page = list_entry(list_ent, 
+                                               struct pfn_info, list);
             if ( !get_page_type(page, PGT_writable_page) )
                 BUG();
             put_page_type(page);
@@ -1070,13 +1068,13 @@
              * We use tlbflush_timestamp as back pointer to smfn, and need to
              * clean up it.
              */
-            if ( shadow_mode_external(d) )
+            if (shadow_mode_external(d))
                 page->tlbflush_timestamp = 0;
-            list_ent = page->list.next;
-        }
-    }
-
-    audit_adjust_pgtables(d, 1, 1);
+        }
+        
+        audit_adjust_pgtables(d, 1, 1);
+  
+    }
 
     return 0;
 
@@ -2146,7 +2144,7 @@
         i = (frame_table[readonly_gmfn].u.inuse.type_info & PGT_va_mask) 
             >> PGT_va_shift;
 
-        if ( (i >= 0 && i <= L1_PAGETABLE_ENTRIES) &&
+        if ( (i >= 0 && i < L1_PAGETABLE_ENTRIES) &&
              !l1e_has_changed(pt[i], match, flags) && 
              fix_entry(d, &pt[i], &found, is_l1_shadow, max_refs_to_find) &&
              !prediction )
@@ -2680,6 +2678,16 @@
             domain_crash_synchronous();
         }
 
+        /* User access violation in guest? */
+        if ( unlikely((regs->error_code & 4) && 
+                      !(l1e_get_flags(gpte) & _PAGE_USER)))
+        {
+            SH_VVLOG("shadow_fault - EXIT: wr fault on super page (%" PRIpte 
")", 
+                    l1e_get_intpte(gpte));
+            goto fail;
+
+        }
+
         if ( unlikely(!l1pte_write_fault(v, &gpte, &spte, va)) )
         {
             SH_VVLOG("shadow_fault - EXIT: l1pte_write_fault failed");
@@ -2693,6 +2701,16 @@
     }
     else
     {
+        /* Read-protection violation in guest? */
+        if ( unlikely((regs->error_code & 1) ))
+        {
+            SH_VVLOG("shadow_fault - EXIT: read fault on super page (%" PRIpte 
")", 
+                    l1e_get_intpte(gpte));
+            goto fail;
+
+        }
+
+
         if ( !l1pte_read_fault(d, &gpte, &spte) )
         {
             SH_VVLOG("shadow_fault - EXIT: l1pte_read_fault failed");
@@ -3254,14 +3272,10 @@
                l2e_get_intpte(match));
     }
 
-#ifdef __i386__
     if ( shadow_mode_external(d) )
         limit = L2_PAGETABLE_ENTRIES;
     else
         limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
-#else
-    limit = 0; /* XXX x86/64 XXX */
-#endif
 
     /* Check the whole L2. */
     for ( i = 0; i < limit; i++ )
@@ -3323,14 +3337,10 @@
     spl2e = (l2_pgentry_t *) map_domain_page(smfn);
 
     /* Go back and recurse. */
-#ifdef __i386__
     if ( shadow_mode_external(d) )
         limit = L2_PAGETABLE_ENTRIES;
     else
         limit = DOMAIN_ENTRIES_PER_L2_PAGETABLE;
-#else
-    limit = 0; /* XXX x86/64 XXX */
-#endif
 
     for ( i = 0; i < limit; i++ )
     {
@@ -3346,11 +3356,6 @@
 
     unmap_domain_page(spl2e);
     unmap_domain_page(gpl2e);
-
-#if 0
-    SH_VVLOG("PT verified : l2_present = %d, l1_present = %d",
-             sh_l2_present, sh_l1_present);
-#endif
 
  out:
     if ( errors )
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/shadow_public.c
--- a/xen/arch/x86/shadow_public.c      Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/shadow_public.c      Tue Nov 29 15:00:27 2005
@@ -1077,36 +1077,40 @@
     //
     free_shadow_pages(d);
 
-    /*
-     * Tear down it's counts by disassembling its page-table-based ref counts.
-     * Also remove CR3's gcount/tcount.
-     * That leaves things like GDTs and LDTs and external refs in tact.
-     *
-     * Most pages will be writable tcount=0.
-     * Some will still be L1 tcount=0 or L2 tcount=0.
-     * Maybe some pages will be type none tcount=0.
-     * Pages granted external writable refs (via grant tables?) will
-     * still have a non-zero tcount.  That's OK.
-     *
-     * gcounts will generally be 1 for PGC_allocated.
-     * GDTs and LDTs will have additional gcounts.
-     * Any grant-table based refs will still be in the gcount.
-     *
-     * We attempt to grab writable refs to each page (thus setting its type).
-     * Immediately put back those type refs.
-     *
-     * Assert that no pages are left with L1/L2/L3/L4 type.
-     */
-    audit_adjust_pgtables(d, -1, 1);
-
     d->arch.shadow_mode = mode;
 
     if ( shadow_mode_refcounts(d) )
     {
-        struct list_head *list_ent = d->page_list.next;
-        while ( list_ent != &d->page_list )
-        {
-            struct pfn_info *page = list_entry(list_ent, struct pfn_info, 
list);
+        struct list_head *list_ent; 
+
+        /*
+         * Tear down its counts by disassembling its page-table-based refcounts
+         * Also remove CR3's gcount/tcount.
+         * That leaves things like GDTs and LDTs and external refs in tact.
+         *
+         * Most pages will be writable tcount=0.
+         * Some will still be L1 tcount=0 or L2 tcount=0.
+         * Maybe some pages will be type none tcount=0.
+         * Pages granted external writable refs (via grant tables?) will
+         * still have a non-zero tcount.  That's OK.
+         *
+         * gcounts will generally be 1 for PGC_allocated.
+         * GDTs and LDTs will have additional gcounts.
+         * Any grant-table based refs will still be in the gcount.
+         *
+         * We attempt to grab writable refs to each page thus setting its type
+         * Immediately put back those type refs.
+         *
+         * Assert that no pages are left with L1/L2/L3/L4 type.
+         */
+        audit_adjust_pgtables(d, -1, 1);
+
+
+        for (list_ent = d->page_list.next; list_ent != &d->page_list; 
+             list_ent = page->list.next) {
+            
+            struct pfn_info *page = list_entry(list_ent, 
+                                               struct pfn_info, list);
             if ( !get_page_type(page, PGT_writable_page) )
                 BUG();
             put_page_type(page);
@@ -1114,13 +1118,13 @@
              * We use tlbflush_timestamp as back pointer to smfn, and need to
              * clean up it.
              */
-            if ( shadow_mode_external(d) )
+            if (shadow_mode_external(d))
                 page->tlbflush_timestamp = 0;
-            list_ent = page->list.next;
-        }
-    }
-
-    audit_adjust_pgtables(d, 1, 1);
+        }
+        
+        audit_adjust_pgtables(d, 1, 1);
+  
+    }
 
     return 0;
 
diff -r b1940475284f -r 74fa88cf3dc7 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Tue Nov 29 15:00:01 2005
+++ b/xen/arch/x86/time.c       Tue Nov 29 15:00:27 2005
@@ -683,8 +683,11 @@
 
 static inline void __update_dom_time(struct vcpu *v)
 {
-    struct cpu_time       *t = &cpu_time[smp_processor_id()];
-    struct vcpu_time_info *u = &v->domain->shared_info->vcpu_time[v->vcpu_id];
+    struct cpu_time       *t;
+    struct vcpu_time_info *u;
+
+    t = &cpu_time[smp_processor_id()];
+    u = &v->domain->shared_info->vcpu_info[v->vcpu_id].time;
 
     version_update_begin(&u->version);
 
@@ -698,7 +701,7 @@
 
 void update_dom_time(struct vcpu *v)
 {
-    if ( v->domain->shared_info->vcpu_time[v->vcpu_id].tsc_timestamp != 
+    if ( v->domain->shared_info->vcpu_info[v->vcpu_id].time.tsc_timestamp != 
          cpu_time[smp_processor_id()].local_tsc_stamp )
         __update_dom_time(v);
 }
diff -r b1940475284f -r 74fa88cf3dc7 xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Nov 29 15:00:01 2005
+++ b/xen/common/schedule.c     Tue Nov 29 15:00:27 2005
@@ -115,7 +115,7 @@
 
     if ( vcpu_id != 0 )
     {
-        v->vcpu_info = &d->shared_info->vcpu_data[vcpu_id];
+        v->vcpu_info = &d->shared_info->vcpu_info[vcpu_id];
         d->vcpu[v->vcpu_id-1]->next_in_list = v;
         set_bit(_VCPUF_down, &v->vcpu_flags);
     }
diff -r b1940475284f -r 74fa88cf3dc7 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h  Tue Nov 29 15:00:01 2005
+++ b/xen/include/public/arch-x86_32.h  Tue Nov 29 15:00:27 2005
@@ -134,7 +134,7 @@
 
 typedef struct {
     unsigned long cr2;
-    unsigned long pad; /* sizeof(vcpu_info_t) == 16 */
+    unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
 } arch_vcpu_info_t;
 
 #endif
diff -r b1940475284f -r 74fa88cf3dc7 xen/include/public/arch-x86_64.h
--- a/xen/include/public/arch-x86_64.h  Tue Nov 29 15:00:01 2005
+++ b/xen/include/public/arch-x86_64.h  Tue Nov 29 15:00:27 2005
@@ -203,7 +203,7 @@
 
 typedef struct {
     unsigned long cr2;
-    unsigned long pad; /* sizeof(vcpu_info_t) == 32 */
+    unsigned long pad; /* sizeof(vcpu_info_t) == 64 */
 } arch_vcpu_info_t;
 
 #endif /* !__ASSEMBLY__ */
diff -r b1940475284f -r 74fa88cf3dc7 xen/include/public/trace.h
--- a/xen/include/public/trace.h        Tue Nov 29 15:00:01 2005
+++ b/xen/include/public/trace.h        Tue Nov 29 15:00:27 2005
@@ -72,8 +72,8 @@
  * field, indexes into an array of struct t_rec's.
  */
 struct t_buf {
-    unsigned int  cons;      /* Next item to be consumed by control tools. */
-    unsigned int  prod;      /* Next item to be produced by Xen.           */
+    uint32_t cons;      /* Next item to be consumed by control tools. */
+    uint32_t prod;      /* Next item to be produced by Xen.           */
     /* 'nr_recs' records follow immediately after the meta-data header.    */
 };
 
diff -r b1940475284f -r 74fa88cf3dc7 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Tue Nov 29 15:00:01 2005
+++ b/xen/include/public/xen.h  Tue Nov 29 15:00:27 2005
@@ -266,10 +266,31 @@
  */
 #define NR_EVENT_CHANNELS (sizeof(unsigned long) * sizeof(unsigned long) * 64)
 
-/*
- * Per-VCPU information goes here. This will be cleaned up more when Xen 
- * actually supports multi-VCPU guests.
- */
+typedef struct vcpu_time_info {
+    /*
+     * Updates to the following values are preceded and followed by an
+     * increment of 'version'. The guest can therefore detect updates by
+     * looking for changes to 'version'. If the least-significant bit of
+     * the version number is set then an update is in progress and the guest
+     * must wait to read a consistent set of values.
+     * The correct way to interact with the version number is similar to
+     * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
+     */
+    uint32_t version;
+    uint32_t pad0;
+    uint64_t tsc_timestamp;   /* TSC at last update of time vals.  */
+    uint64_t system_time;     /* Time, in nanosecs, since boot.    */
+    /*
+     * Current system time:
+     *   system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
+     * CPU frequency (Hz):
+     *   ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
+     */
+    uint32_t tsc_to_system_mul;
+    int8_t   tsc_shift;
+    int8_t   pad1[3];
+} vcpu_time_info_t; /* 32 bytes */
+
 typedef struct vcpu_info {
     /*
      * 'evtchn_upcall_pending' is written non-zero by Xen to indicate
@@ -300,39 +321,15 @@
     uint8_t evtchn_upcall_mask;
     unsigned long evtchn_pending_sel;
     arch_vcpu_info_t arch;
-} vcpu_info_t;
-
-typedef struct vcpu_time_info {
-    /*
-     * Updates to the following values are preceded and followed by an
-     * increment of 'version'. The guest can therefore detect updates by
-     * looking for changes to 'version'. If the least-significant bit of
-     * the version number is set then an update is in progress and the guest
-     * must wait to read a consistent set of values.
-     * The correct way to interact with the version number is similar to
-     * Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
-     */
-    uint32_t version;
-    uint64_t tsc_timestamp;   /* TSC at last update of time vals.  */
-    uint64_t system_time;     /* Time, in nanosecs, since boot.    */
-    /*
-     * Current system time:
-     *   system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
-     * CPU frequency (Hz):
-     *   ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
-     */
-    uint32_t tsc_to_system_mul;
-    int8_t  tsc_shift;
-} vcpu_time_info_t;
+    vcpu_time_info_t time;
+} vcpu_info_t; /* 64 bytes (x86) */
 
 /*
  * Xen/kernel shared data -- pointer provided in start_info.
  * NB. We expect that this struct is smaller than a page.
  */
 typedef struct shared_info {
-    vcpu_info_t vcpu_data[MAX_VIRT_CPUS];
-
-    vcpu_time_info_t vcpu_time[MAX_VIRT_CPUS];
+    vcpu_info_t vcpu_info[MAX_VIRT_CPUS];
 
     /*
      * A domain can create "event channels" on which it can send and receive

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>