ia64/xen-unstable

changeset 10831:2d73714911c2

merge with xen-unstable.hg
author awilliam@xenbuild.aw
date Thu Jul 27 10:43:34 2006 -0600 (2006-07-27)
parents 199d53efd029 5848356af8da
children 158db2446071
files tools/ioemu/hw/vga.c tools/ioemu/patches/ioemu-ia64 tools/ioemu/vl.c xen/include/asm-ia64/mm.h
line diff
     1.1 --- a/Config.mk	Thu Jul 27 10:00:00 2006 -0600
     1.2 +++ b/Config.mk	Thu Jul 27 10:43:34 2006 -0600
     1.3 @@ -36,6 +36,8 @@ ifneq ($(debug),y)
     1.4  CFLAGS    ?= -O2 -fomit-frame-pointer
     1.5  CFLAGS    += -DNDEBUG
     1.6  else
     1.7 +# Less than -O1 produces bad code and large stack frames
     1.8 +CFLAGS    ?= -O1 -fno-omit-frame-pointer
     1.9  CFLAGS    += -g
    1.10  endif
    1.11  
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Jul 27 10:00:00 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Thu Jul 27 10:43:34 2006 -0600
     2.3 @@ -99,24 +99,21 @@ static spinlock_t net_schedule_list_lock
     2.4  #define MAX_MFN_ALLOC 64
     2.5  static unsigned long mfn_list[MAX_MFN_ALLOC];
     2.6  static unsigned int alloc_index = 0;
     2.7 -static DEFINE_SPINLOCK(mfn_lock);
     2.8  
     2.9  static unsigned long alloc_mfn(void)
    2.10  {
    2.11 -	unsigned long mfn = 0, flags;
    2.12 +	unsigned long mfn = 0;
    2.13  	struct xen_memory_reservation reservation = {
    2.14  		.nr_extents   = MAX_MFN_ALLOC,
    2.15  		.extent_order = 0,
    2.16  		.domid        = DOMID_SELF
    2.17  	};
    2.18  	set_xen_guest_handle(reservation.extent_start, mfn_list);
    2.19 -	spin_lock_irqsave(&mfn_lock, flags);
    2.20  	if ( unlikely(alloc_index == 0) )
    2.21  		alloc_index = HYPERVISOR_memory_op(
    2.22  			XENMEM_increase_reservation, &reservation);
    2.23  	if ( alloc_index != 0 )
    2.24  		mfn = mfn_list[--alloc_index];
    2.25 -	spin_unlock_irqrestore(&mfn_lock, flags);
    2.26  	return mfn;
    2.27  }
    2.28  
    2.29 @@ -222,9 +219,13 @@ static void net_rx_action(unsigned long 
    2.30  	unsigned long vdata, old_mfn, new_mfn;
    2.31  	struct sk_buff_head rxq;
    2.32  	struct sk_buff *skb;
    2.33 -	u16 notify_list[NET_RX_RING_SIZE];
    2.34  	int notify_nr = 0;
    2.35  	int ret;
    2.36 +	/*
    2.37 +	 * Putting hundreds of bytes on the stack is considered rude.
    2.38 +	 * Static works because a tasklet can only be on one CPU at any time.
    2.39 +	 */
    2.40 +	static u16 notify_list[NET_RX_RING_SIZE];
    2.41  
    2.42  	skb_queue_head_init(&rxq);
    2.43  
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Jul 27 10:00:00 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Thu Jul 27 10:43:34 2006 -0600
     3.3 @@ -788,6 +788,8 @@ static int network_start_xmit(struct sk_
     3.4  
     3.5  		gso->u.gso.size = skb_shinfo(skb)->gso_size;
     3.6  		gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4;
     3.7 +		gso->u.gso.pad = 0;
     3.8 +		gso->u.gso.features = 0;
     3.9  
    3.10  		gso->type = XEN_NETIF_EXTRA_TYPE_GSO;
    3.11  		gso->flags = 0;
     4.1 --- a/tools/ioemu/hw/vga.c	Thu Jul 27 10:00:00 2006 -0600
     4.2 +++ b/tools/ioemu/hw/vga.c	Thu Jul 27 10:43:34 2006 -0600
     4.3 @@ -1953,6 +1953,8 @@ void vga_common_init(VGAState *s, Displa
     4.4                           vga_screen_dump, s);
     4.5      /* XXX: currently needed for display */
     4.6      vga_state = s;
     4.7 +
     4.8 +    vga_bios_init(s);
     4.9  }
    4.10  
    4.11  
     5.1 --- a/tools/ioemu/patches/domain-reset	Thu Jul 27 10:00:00 2006 -0600
     5.2 +++ b/tools/ioemu/patches/domain-reset	Thu Jul 27 10:43:34 2006 -0600
     5.3 @@ -1,7 +1,7 @@
     5.4  Index: ioemu/target-i386-dm/helper2.c
     5.5  ===================================================================
     5.6 ---- ioemu.orig/target-i386-dm/helper2.c	2006-07-12 11:35:00.710827712 +0100
     5.7 -+++ ioemu/target-i386-dm/helper2.c	2006-07-12 11:35:02.419613627 +0100
     5.8 +--- ioemu.orig/target-i386-dm/helper2.c	2006-07-27 11:16:57.527492229 +0100
     5.9 ++++ ioemu/target-i386-dm/helper2.c	2006-07-27 11:16:59.381287013 +0100
    5.10  @@ -123,6 +123,25 @@
    5.11   /* called from main_cpu_reset */
    5.12   void cpu_reset(CPUX86State *env)
    5.13 @@ -41,9 +41,9 @@ Index: ioemu/target-i386-dm/helper2.c
    5.14           /* Wait up to 10 msec. */
    5.15  Index: ioemu/vl.c
    5.16  ===================================================================
    5.17 ---- ioemu.orig/vl.c	2006-07-12 11:35:02.273631916 +0100
    5.18 -+++ ioemu/vl.c	2006-07-12 11:35:02.421613376 +0100
    5.19 -@@ -4411,7 +4411,7 @@
    5.20 +--- ioemu.orig/vl.c	2006-07-27 11:16:59.317294097 +0100
    5.21 ++++ ioemu/vl.c	2006-07-27 11:16:59.384286681 +0100
    5.22 +@@ -4412,7 +4412,7 @@
    5.23   } QEMUResetEntry;
    5.24   
    5.25   static QEMUResetEntry *first_reset_entry;
    5.26 @@ -54,8 +54,8 @@ Index: ioemu/vl.c
    5.27   
    5.28  Index: ioemu/vl.h
    5.29  ===================================================================
    5.30 ---- ioemu.orig/vl.h	2006-07-12 11:35:01.454734511 +0100
    5.31 -+++ ioemu/vl.h	2006-07-12 11:35:02.422613251 +0100
    5.32 +--- ioemu.orig/vl.h	2006-07-27 11:16:58.127425816 +0100
    5.33 ++++ ioemu/vl.h	2006-07-27 11:16:59.384286681 +0100
    5.34  @@ -122,6 +122,7 @@
    5.35   
    5.36   void qemu_register_reset(QEMUResetHandler *func, void *opaque);
     6.1 --- a/tools/ioemu/patches/domain-timeoffset	Thu Jul 27 10:00:00 2006 -0600
     6.2 +++ b/tools/ioemu/patches/domain-timeoffset	Thu Jul 27 10:43:34 2006 -0600
     6.3 @@ -1,7 +1,7 @@
     6.4  Index: ioemu/hw/mc146818rtc.c
     6.5  ===================================================================
     6.6 ---- ioemu.orig/hw/mc146818rtc.c	2006-07-26 15:17:35.110819901 +0100
     6.7 -+++ ioemu/hw/mc146818rtc.c	2006-07-26 15:17:40.292255496 +0100
     6.8 +--- ioemu.orig/hw/mc146818rtc.c	2006-07-27 11:17:18.007225084 +0100
     6.9 ++++ ioemu/hw/mc146818rtc.c	2006-07-27 11:17:48.250876949 +0100
    6.10  @@ -178,10 +178,27 @@
    6.11       }
    6.12   }
    6.13 @@ -46,8 +46,8 @@ Index: ioemu/hw/mc146818rtc.c
    6.14   static void rtc_copy_date(RTCState *s)
    6.15  Index: ioemu/hw/pc.c
    6.16  ===================================================================
    6.17 ---- ioemu.orig/hw/pc.c	2006-07-26 15:17:39.820306906 +0100
    6.18 -+++ ioemu/hw/pc.c	2006-07-26 15:17:40.293255388 +0100
    6.19 +--- ioemu.orig/hw/pc.c	2006-07-27 11:17:47.993905398 +0100
    6.20 ++++ ioemu/hw/pc.c	2006-07-27 11:17:48.251876839 +0100
    6.21  @@ -151,7 +151,7 @@
    6.22   }
    6.23   
    6.24 @@ -117,8 +117,8 @@ Index: ioemu/hw/pc.c
    6.25   QEMUMachine pc_machine = {
    6.26  Index: ioemu/vl.c
    6.27  ===================================================================
    6.28 ---- ioemu.orig/vl.c	2006-07-26 15:17:40.169268893 +0100
    6.29 -+++ ioemu/vl.c	2006-07-26 15:17:40.296255061 +0100
    6.30 +--- ioemu.orig/vl.c	2006-07-27 11:17:48.126890676 +0100
    6.31 ++++ ioemu/vl.c	2006-07-27 11:17:48.254876507 +0100
    6.32  @@ -164,6 +164,8 @@
    6.33   
    6.34   int xc_handle;
    6.35 @@ -128,7 +128,7 @@ Index: ioemu/vl.c
    6.36   char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
    6.37   extern int domid;
    6.38   
    6.39 -@@ -4799,6 +4801,7 @@
    6.40 +@@ -4800,6 +4802,7 @@
    6.41   #endif
    6.42              "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
    6.43   	   "-vnc display    start a VNC server on display\n"
    6.44 @@ -136,7 +136,7 @@ Index: ioemu/vl.c
    6.45              "\n"
    6.46              "During emulation, the following keys are useful:\n"
    6.47              "ctrl-alt-f      toggle full screen\n"
    6.48 -@@ -4889,6 +4892,7 @@
    6.49 +@@ -4890,6 +4893,7 @@
    6.50   
    6.51       QEMU_OPTION_d,
    6.52       QEMU_OPTION_vcpus,
    6.53 @@ -144,7 +144,7 @@ Index: ioemu/vl.c
    6.54   };
    6.55   
    6.56   typedef struct QEMUOption {
    6.57 -@@ -4967,6 +4971,7 @@
    6.58 +@@ -4968,6 +4972,7 @@
    6.59       
    6.60       { "d", HAS_ARG, QEMU_OPTION_d },
    6.61       { "vcpus", 1, QEMU_OPTION_vcpus },
    6.62 @@ -152,7 +152,7 @@ Index: ioemu/vl.c
    6.63       { NULL },
    6.64   };
    6.65   
    6.66 -@@ -5669,6 +5674,9 @@
    6.67 +@@ -5670,6 +5675,9 @@
    6.68                   vcpus = atoi(optarg);
    6.69                   fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus);
    6.70                   break;
    6.71 @@ -162,7 +162,7 @@ Index: ioemu/vl.c
    6.72               }
    6.73           }
    6.74       }
    6.75 -@@ -5992,7 +6000,8 @@
    6.76 +@@ -5993,7 +6001,8 @@
    6.77   
    6.78       machine->init(ram_size, vga_ram_size, boot_device,
    6.79                     ds, fd_filename, snapshot,
    6.80 @@ -174,8 +174,8 @@ Index: ioemu/vl.c
    6.81       qemu_mod_timer(gui_timer, qemu_get_clock(rt_clock));
    6.82  Index: ioemu/vl.h
    6.83  ===================================================================
    6.84 ---- ioemu.orig/vl.h	2006-07-26 15:17:39.825306361 +0100
    6.85 -+++ ioemu/vl.h	2006-07-26 15:17:40.297254952 +0100
    6.86 +--- ioemu.orig/vl.h	2006-07-27 11:17:47.998904845 +0100
    6.87 ++++ ioemu/vl.h	2006-07-27 11:17:48.254876507 +0100
    6.88  @@ -556,7 +556,7 @@
    6.89                                    int boot_device,
    6.90                DisplayState *ds, const char **fd_filename, int snapshot,
     7.1 --- a/tools/ioemu/patches/hypervisor-pit	Thu Jul 27 10:00:00 2006 -0600
     7.2 +++ b/tools/ioemu/patches/hypervisor-pit	Thu Jul 27 10:43:34 2006 -0600
     7.3 @@ -1,7 +1,7 @@
     7.4  Index: ioemu/Makefile.target
     7.5  ===================================================================
     7.6 ---- ioemu.orig/Makefile.target	2006-07-12 11:35:01.899678766 +0100
     7.7 -+++ ioemu/Makefile.target	2006-07-12 11:35:02.711577049 +0100
     7.8 +--- ioemu.orig/Makefile.target	2006-07-27 11:16:58.970332506 +0100
     7.9 ++++ ioemu/Makefile.target	2006-07-27 11:16:59.758245283 +0100
    7.10  @@ -333,7 +333,7 @@
    7.11   ifeq ($(TARGET_BASE_ARCH), i386)
    7.12   # Hardware support
    7.13 @@ -13,8 +13,8 @@ Index: ioemu/Makefile.target
    7.14   endif
    7.15  Index: ioemu/hw/pc.c
    7.16  ===================================================================
    7.17 ---- ioemu.orig/hw/pc.c	2006-07-12 11:35:02.059658723 +0100
    7.18 -+++ ioemu/hw/pc.c	2006-07-12 11:35:02.712576924 +0100
    7.19 +--- ioemu.orig/hw/pc.c	2006-07-27 11:16:59.036325200 +0100
    7.20 ++++ ioemu/hw/pc.c	2006-07-27 11:16:59.759245173 +0100
    7.21  @@ -38,7 +38,9 @@
    7.22   
    7.23   static fdctrl_t *floppy_controller;
    7.24 @@ -38,9 +38,9 @@ Index: ioemu/hw/pc.c
    7.25           pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic);
    7.26  Index: ioemu/vl.c
    7.27  ===================================================================
    7.28 ---- ioemu.orig/vl.c	2006-07-12 11:35:02.649584815 +0100
    7.29 -+++ ioemu/vl.c	2006-07-12 11:35:02.715576548 +0100
    7.30 -@@ -5033,6 +5033,7 @@
    7.31 +--- ioemu.orig/vl.c	2006-07-27 11:16:59.614261222 +0100
    7.32 ++++ ioemu/vl.c	2006-07-27 11:16:59.762244841 +0100
    7.33 +@@ -5034,6 +5034,7 @@
    7.34   
    7.35   #ifdef HAS_AUDIO
    7.36   struct soundhw soundhw[] = {
    7.37 @@ -48,7 +48,7 @@ Index: ioemu/vl.c
    7.38   #ifdef TARGET_I386
    7.39       {
    7.40           "pcspk",
    7.41 -@@ -5042,6 +5043,7 @@
    7.42 +@@ -5043,6 +5044,7 @@
    7.43           { .init_isa = pcspk_audio_init }
    7.44       },
    7.45   #endif
     8.1 --- a/tools/ioemu/patches/ioemu-ia64	Thu Jul 27 10:00:00 2006 -0600
     8.2 +++ b/tools/ioemu/patches/ioemu-ia64	Thu Jul 27 10:43:34 2006 -0600
     8.3 @@ -62,7 +62,7 @@ Index: ioemu/vl.c
     8.4       if (xc_get_pfn_list(xc_handle, domid, page_array, nr_pages) != nr_pages) {
     8.5           fprintf(logfile, "xc_get_pfn_list returned error %d\n", errno);
     8.6           exit(-1);
     8.7 -@@ -5597,6 +5598,34 @@
     8.8 +@@ -5598,6 +5599,34 @@
     8.9       fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", nr_pages - 1,
    8.10               (uint64_t)(page_array[nr_pages - 1]));
    8.11   
     9.1 --- a/tools/ioemu/patches/qemu-bugfixes	Thu Jul 27 10:00:00 2006 -0600
     9.2 +++ b/tools/ioemu/patches/qemu-bugfixes	Thu Jul 27 10:43:34 2006 -0600
     9.3 @@ -1,7 +1,7 @@
     9.4  Index: ioemu/console.c
     9.5  ===================================================================
     9.6 ---- ioemu.orig/console.c	2006-07-26 13:39:11.999009495 +0100
     9.7 -+++ ioemu/console.c	2006-07-26 14:15:19.413719225 +0100
     9.8 +--- ioemu.orig/console.c	2006-07-27 11:16:53.732912290 +0100
     9.9 ++++ ioemu/console.c	2006-07-27 11:16:57.753467214 +0100
    9.10  @@ -449,7 +449,7 @@
    9.11               c++;
    9.12           }
    9.13 @@ -50,8 +50,8 @@ Index: ioemu/console.c
    9.14       s->y_base = 0;
    9.15  Index: ioemu/usb-linux.c
    9.16  ===================================================================
    9.17 ---- ioemu.orig/usb-linux.c	2006-07-26 13:39:11.999009495 +0100
    9.18 -+++ ioemu/usb-linux.c	2006-07-26 13:39:16.622514851 +0100
    9.19 +--- ioemu.orig/usb-linux.c	2006-07-27 11:16:53.732912290 +0100
    9.20 ++++ ioemu/usb-linux.c	2006-07-27 11:16:57.754467103 +0100
    9.21  @@ -26,6 +26,7 @@
    9.22   #if defined(__linux__)
    9.23   #include <dirent.h>
    9.24 @@ -60,3 +60,15 @@ Index: ioemu/usb-linux.c
    9.25   #include <linux/usbdevice_fs.h>
    9.26   #include <linux/version.h>
    9.27   
    9.28 +Index: ioemu/vl.c
    9.29 +===================================================================
    9.30 +--- ioemu.orig/vl.c	2006-07-27 11:16:57.681475183 +0100
    9.31 ++++ ioemu/vl.c	2006-07-27 11:17:33.279534373 +0100
    9.32 +@@ -3201,6 +3201,7 @@
    9.33 +             if (net_tap_fd_init(vlan, fd))
    9.34 +                 ret = 0;
    9.35 +         } else {
    9.36 ++            ifname[0] = '\0';
    9.37 +             get_param_value(ifname, sizeof(ifname), "ifname", p);
    9.38 +             if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
    9.39 +                 pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
    10.1 --- a/tools/ioemu/patches/qemu-init-vgabios	Thu Jul 27 10:00:00 2006 -0600
    10.2 +++ b/tools/ioemu/patches/qemu-init-vgabios	Thu Jul 27 10:43:34 2006 -0600
    10.3 @@ -1,7 +1,7 @@
    10.4  Index: ioemu/hw/vga.c
    10.5  ===================================================================
    10.6 ---- ioemu.orig/hw/vga.c	2006-07-26 15:16:41.955609165 +0100
    10.7 -+++ ioemu/hw/vga.c	2006-07-26 15:17:16.910802283 +0100
    10.8 +--- ioemu.orig/hw/vga.c	2006-07-27 11:10:44.847738090 +0100
    10.9 ++++ ioemu/hw/vga.c	2006-07-27 11:11:02.008839258 +0100
   10.10  @@ -1669,6 +1669,136 @@
   10.11       }
   10.12   }
   10.13 @@ -139,3 +139,12 @@ Index: ioemu/hw/vga.c
   10.14   void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base, 
   10.15                        unsigned long vga_ram_offset, int vga_ram_size)
   10.16   {
   10.17 +@@ -1710,6 +1840,8 @@
   10.18 +                          vga_screen_dump, s);
   10.19 +     /* XXX: currently needed for display */
   10.20 +     vga_state = s;
   10.21 ++
   10.22 ++    vga_bios_init(s);
   10.23 + }
   10.24 + 
   10.25 + 
    11.1 --- a/tools/ioemu/patches/qemu-logging	Thu Jul 27 10:00:00 2006 -0600
    11.2 +++ b/tools/ioemu/patches/qemu-logging	Thu Jul 27 10:43:34 2006 -0600
    11.3 @@ -1,8 +1,8 @@
    11.4  Index: ioemu/vl.c
    11.5  ===================================================================
    11.6 ---- ioemu.orig/vl.c	2006-07-14 15:55:59.491503372 +0100
    11.7 -+++ ioemu/vl.c	2006-07-14 15:55:59.693480386 +0100
    11.8 -@@ -4697,7 +4697,7 @@
    11.9 +--- ioemu.orig/vl.c	2006-07-27 11:16:57.756466882 +0100
   11.10 ++++ ioemu/vl.c	2006-07-27 11:16:57.828458912 +0100
   11.11 +@@ -4698,7 +4698,7 @@
   11.12              "-S              freeze CPU at startup (use 'c' to start execution)\n"
   11.13              "-s              wait gdb connection to port %d\n"
   11.14              "-p port         change gdb connection port\n"
   11.15 @@ -11,7 +11,7 @@ Index: ioemu/vl.c
   11.16              "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the optional BIOS\n"
   11.17              "                translation (t=none or lba) (usually qemu can guess them)\n"
   11.18              "-L path         set the directory for the BIOS and VGA BIOS\n"
   11.19 -@@ -4775,7 +4775,7 @@
   11.20 +@@ -4776,7 +4776,7 @@
   11.21       QEMU_OPTION_S,
   11.22       QEMU_OPTION_s,
   11.23       QEMU_OPTION_p,
   11.24 @@ -20,7 +20,7 @@ Index: ioemu/vl.c
   11.25       QEMU_OPTION_hdachs,
   11.26       QEMU_OPTION_L,
   11.27   #ifdef USE_CODE_COPY
   11.28 -@@ -4844,7 +4844,7 @@
   11.29 +@@ -4845,7 +4845,7 @@
   11.30       { "S", 0, QEMU_OPTION_S },
   11.31       { "s", 0, QEMU_OPTION_s },
   11.32       { "p", HAS_ARG, QEMU_OPTION_p },
   11.33 @@ -29,7 +29,7 @@ Index: ioemu/vl.c
   11.34       { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
   11.35       { "L", HAS_ARG, QEMU_OPTION_L },
   11.36   #ifdef USE_CODE_COPY
   11.37 -@@ -5095,6 +5095,8 @@
   11.38 +@@ -5096,6 +5096,8 @@
   11.39       char usb_devices[MAX_VM_USB_PORTS][128];
   11.40       int usb_devices_index;
   11.41   
   11.42 @@ -38,7 +38,7 @@ Index: ioemu/vl.c
   11.43       LIST_INIT (&vm_change_state_head);
   11.44   #if !defined(CONFIG_SOFTMMU)
   11.45       /* we never want that malloc() uses mmap() */
   11.46 -@@ -5144,6 +5146,11 @@
   11.47 +@@ -5145,6 +5147,11 @@
   11.48       nb_nics = 0;
   11.49       /* default mac address of the first network interface */
   11.50       
   11.51 @@ -50,7 +50,7 @@ Index: ioemu/vl.c
   11.52       optind = 1;
   11.53       for(;;) {
   11.54           if (optind >= argc)
   11.55 -@@ -5329,7 +5336,7 @@
   11.56 +@@ -5330,7 +5337,7 @@
   11.57                       exit(1);
   11.58                   }
   11.59                   break;
   11.60 @@ -59,7 +59,7 @@ Index: ioemu/vl.c
   11.61                   {
   11.62                       int mask;
   11.63                       CPULogItem *item;
   11.64 -@@ -5700,7 +5707,7 @@
   11.65 +@@ -5701,7 +5708,7 @@
   11.66           stk.ss_flags = 0;
   11.67   
   11.68           if (sigaltstack(&stk, NULL) < 0) {
    12.1 --- a/tools/ioemu/patches/qemu-smp	Thu Jul 27 10:00:00 2006 -0600
    12.2 +++ b/tools/ioemu/patches/qemu-smp	Thu Jul 27 10:43:34 2006 -0600
    12.3 @@ -1,7 +1,7 @@
    12.4  Index: ioemu/vl.c
    12.5  ===================================================================
    12.6 ---- ioemu.orig/vl.c	2006-07-12 11:35:01.687705323 +0100
    12.7 -+++ ioemu/vl.c	2006-07-12 11:35:01.753697055 +0100
    12.8 +--- ioemu.orig/vl.c	2006-07-27 11:16:58.619371357 +0100
    12.9 ++++ ioemu/vl.c	2006-07-27 11:16:58.823348777 +0100
   12.10  @@ -159,6 +159,8 @@
   12.11   #define MAX_CPUS 1
   12.12   #endif
   12.13 @@ -11,7 +11,7 @@ Index: ioemu/vl.c
   12.14   int xc_handle;
   12.15   
   12.16   char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
   12.17 -@@ -4635,6 +4637,7 @@
   12.18 +@@ -4636,6 +4638,7 @@
   12.19              "-m megs         set virtual RAM size to megs MB [default=%d]\n"
   12.20              "-smp n          set the number of CPUs to 'n' [default=1]\n"
   12.21              "-nographic      disable graphical output and redirect serial I/Os to console\n"
   12.22 @@ -19,7 +19,7 @@ Index: ioemu/vl.c
   12.23   #ifndef _WIN32
   12.24   	   "-k language     use keyboard layout (for example \"fr\" for French)\n"
   12.25   #endif
   12.26 -@@ -4809,6 +4812,7 @@
   12.27 +@@ -4810,6 +4813,7 @@
   12.28       QEMU_OPTION_vnc,
   12.29   
   12.30       QEMU_OPTION_d,
   12.31 @@ -27,7 +27,7 @@ Index: ioemu/vl.c
   12.32   };
   12.33   
   12.34   typedef struct QEMUOption {
   12.35 -@@ -4886,6 +4890,7 @@
   12.36 +@@ -4887,6 +4891,7 @@
   12.37       { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
   12.38       
   12.39       { "d", HAS_ARG, QEMU_OPTION_d },
   12.40 @@ -35,7 +35,7 @@ Index: ioemu/vl.c
   12.41       { NULL },
   12.42   };
   12.43   
   12.44 -@@ -5508,6 +5513,10 @@
   12.45 +@@ -5509,6 +5514,10 @@
   12.46                   domid = atoi(optarg);
   12.47                   fprintf(logfile, "domid: %d\n", domid);
   12.48                   break;
    13.1 --- a/tools/ioemu/patches/shared-vram	Thu Jul 27 10:00:00 2006 -0600
    13.2 +++ b/tools/ioemu/patches/shared-vram	Thu Jul 27 10:43:34 2006 -0600
    13.3 @@ -1,7 +1,7 @@
    13.4  Index: ioemu/hw/cirrus_vga.c
    13.5  ===================================================================
    13.6 ---- ioemu.orig/hw/cirrus_vga.c	2006-07-26 15:17:35.230806831 +0100
    13.7 -+++ ioemu/hw/cirrus_vga.c	2006-07-26 15:17:39.819307015 +0100
    13.8 +--- ioemu.orig/hw/cirrus_vga.c	2006-07-27 11:16:53.059986783 +0100
    13.9 ++++ ioemu/hw/cirrus_vga.c	2006-07-27 11:16:59.923227020 +0100
   13.10  @@ -28,6 +28,9 @@
   13.11    */
   13.12   #include "vl.h"
   13.13 @@ -176,8 +176,8 @@ Index: ioemu/hw/cirrus_vga.c
   13.14   }
   13.15  Index: ioemu/hw/pc.c
   13.16  ===================================================================
   13.17 ---- ioemu.orig/hw/pc.c	2006-07-26 15:17:39.752314312 +0100
   13.18 -+++ ioemu/hw/pc.c	2006-07-26 15:17:39.820306906 +0100
   13.19 +--- ioemu.orig/hw/pc.c	2006-07-27 11:16:59.759245173 +0100
   13.20 ++++ ioemu/hw/pc.c	2006-07-27 11:16:59.924226909 +0100
   13.21  @@ -783,14 +783,14 @@
   13.22       if (cirrus_vga_enabled) {
   13.23           if (pci_enabled) {
   13.24 @@ -198,8 +198,8 @@ Index: ioemu/hw/pc.c
   13.25   
   13.26  Index: ioemu/hw/vga.c
   13.27  ===================================================================
   13.28 ---- ioemu.orig/hw/vga.c	2006-07-26 15:17:39.352357879 +0100
   13.29 -+++ ioemu/hw/vga.c	2006-07-26 15:17:39.821306797 +0100
   13.30 +--- ioemu.orig/hw/vga.c	2006-07-27 11:16:59.103317784 +0100
   13.31 ++++ ioemu/hw/vga.c	2006-07-27 11:16:59.925226798 +0100
   13.32  @@ -1799,6 +1799,7 @@
   13.33       /* TODO: add vbe support if enabled */
   13.34   }
   13.35 @@ -217,7 +217,7 @@ Index: ioemu/hw/vga.c
   13.36       s->vram_offset = vga_ram_offset;
   13.37       s->vram_size = vga_ram_size;
   13.38       s->ds = ds;
   13.39 -@@ -1941,6 +1942,31 @@
   13.40 +@@ -1943,6 +1944,31 @@
   13.41       return 0;
   13.42   }
   13.43   
   13.44 @@ -251,8 +251,8 @@ Index: ioemu/hw/vga.c
   13.45   
   13.46  Index: ioemu/hw/vga_int.h
   13.47  ===================================================================
   13.48 ---- ioemu.orig/hw/vga_int.h	2006-07-26 15:17:38.201483242 +0100
   13.49 -+++ ioemu/hw/vga_int.h	2006-07-26 15:17:39.822306688 +0100
   13.50 +--- ioemu.orig/hw/vga_int.h	2006-07-27 11:16:57.447501084 +0100
   13.51 ++++ ioemu/hw/vga_int.h	2006-07-27 11:16:59.925226798 +0100
   13.52  @@ -166,5 +166,6 @@
   13.53                                unsigned int color0, unsigned int color1,
   13.54                                unsigned int color_xor);
   13.55 @@ -262,9 +262,9 @@ Index: ioemu/hw/vga_int.h
   13.56   extern const uint8_t gr_mask[16];
   13.57  Index: ioemu/vl.c
   13.58  ===================================================================
   13.59 ---- ioemu.orig/vl.c	2006-07-26 15:17:39.755313985 +0100
   13.60 -+++ ioemu/vl.c	2006-07-26 15:17:39.824306470 +0100
   13.61 -@@ -5148,6 +5148,78 @@
   13.62 +--- ioemu.orig/vl.c	2006-07-27 11:16:59.762244841 +0100
   13.63 ++++ ioemu/vl.c	2006-07-27 11:16:59.928226466 +0100
   13.64 +@@ -5149,6 +5149,78 @@
   13.65   
   13.66   #define MAX_NET_CLIENTS 32
   13.67   
   13.68 @@ -345,8 +345,8 @@ Index: ioemu/vl.c
   13.69   #ifdef CONFIG_GDBSTUB
   13.70  Index: ioemu/vl.h
   13.71  ===================================================================
   13.72 ---- ioemu.orig/vl.h	2006-07-26 15:17:39.621328580 +0100
   13.73 -+++ ioemu/vl.h	2006-07-26 15:17:39.825306361 +0100
   13.74 +--- ioemu.orig/vl.h	2006-07-27 11:16:59.549268417 +0100
   13.75 ++++ ioemu/vl.h	2006-07-27 11:16:59.929226356 +0100
   13.76  @@ -136,6 +136,13 @@
   13.77   
   13.78   void main_loop_wait(int timeout);
    14.1 --- a/tools/ioemu/patches/support-xm-console	Thu Jul 27 10:00:00 2006 -0600
    14.2 +++ b/tools/ioemu/patches/support-xm-console	Thu Jul 27 10:43:34 2006 -0600
    14.3 @@ -1,7 +1,8 @@
    14.4 -diff -r d08c08f8fbf3 vl.c
    14.5 ---- a/vl.c	Mon Jun 26 15:18:25 2006 +0100
    14.6 -+++ b/vl.c	Mon Jun 26 15:18:37 2006 +0100
    14.7 -@@ -1535,26 +1535,65 @@ CharDriverState *qemu_chr_open_stdio(voi
    14.8 +Index: ioemu/vl.c
    14.9 +===================================================================
   14.10 +--- ioemu.orig/vl.c	2006-07-27 11:16:59.384286681 +0100
   14.11 ++++ ioemu/vl.c	2006-07-27 11:16:59.614261222 +0100
   14.12 +@@ -1535,26 +1535,65 @@
   14.13       return chr;
   14.14   }
   14.15   
   14.16 @@ -65,19 +66,18 @@ diff -r d08c08f8fbf3 vl.c
   14.17  -    tty.c_cc[VMIN] = 1;
   14.18  -    tty.c_cc[VTIME] = 0;
   14.19  -    tcsetattr (master_fd, TCSAFLUSH, &tty);
   14.20 --
   14.21 --    fprintf(stderr, "char device redirected to %s\n", slave_name);
   14.22  +    /* Set raw attributes on the pty. */
   14.23  +    cfmakeraw(&tty);
   14.24  +    tcsetattr(slave_fd, TCSAFLUSH, &tty);
   14.25  +    
   14.26  +    fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));
   14.27  +    store_console_dev(domid, ptsname(master_fd));
   14.28 -+
   14.29 + 
   14.30 +-    fprintf(stderr, "char device redirected to %s\n", slave_name);
   14.31       return qemu_chr_open_fd(master_fd, master_fd);
   14.32   }
   14.33   
   14.34 -@@ -5297,7 +5336,9 @@ int main(int argc, char **argv)
   14.35 +@@ -5298,7 +5337,9 @@
   14.36                   break;
   14.37               case QEMU_OPTION_nographic:
   14.38                   pstrcpy(monitor_device, sizeof(monitor_device), "stdio");
    15.1 --- a/tools/ioemu/patches/vnc-cleanup	Thu Jul 27 10:00:00 2006 -0600
    15.2 +++ b/tools/ioemu/patches/vnc-cleanup	Thu Jul 27 10:43:34 2006 -0600
    15.3 @@ -1,7 +1,8 @@
    15.4 -diff -r c84300f3abc2 vnc.c
    15.5 ---- a/vnc.c	Wed Jul 05 18:11:23 2006 +0100
    15.6 -+++ b/vnc.c	Thu Jul 06 14:27:28 2006 +0100
    15.7 -@@ -83,13 +83,16 @@ static void vnc_dpy_update(DisplayState 
    15.8 +Index: ioemu/vnc.c
    15.9 +===================================================================
   15.10 +--- ioemu.orig/vnc.c	2006-07-27 11:16:52.783017443 +0100
   15.11 ++++ ioemu/vnc.c	2006-07-27 11:17:00.722138579 +0100
   15.12 +@@ -83,13 +83,16 @@
   15.13   static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h)
   15.14   {
   15.15       VncState *vs = ds->opaque;
   15.16 @@ -21,7 +22,7 @@ diff -r c84300f3abc2 vnc.c
   15.17   }
   15.18   
   15.19   static void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
   15.20 -@@ -262,6 +265,7 @@ static void vnc_update_client(void *opaq
   15.21 +@@ -262,6 +265,7 @@
   15.22   static void vnc_update_client(void *opaque)
   15.23   {
   15.24       VncState *vs = opaque;
   15.25 @@ -29,7 +30,7 @@ diff -r c84300f3abc2 vnc.c
   15.26   
   15.27       if (vs->need_update && vs->csock != -1) {
   15.28   	int y;
   15.29 -@@ -282,7 +286,7 @@ static void vnc_update_client(void *opaq
   15.30 +@@ -282,7 +286,7 @@
   15.31   	row = vs->ds->data;
   15.32   	old_row = vs->old_data;
   15.33   
   15.34 @@ -38,7 +39,7 @@ diff -r c84300f3abc2 vnc.c
   15.35   	    if (vs->dirty_row[y] & width_mask) {
   15.36   		int x;
   15.37   		char *ptr, *old_ptr;
   15.38 -@@ -307,10 +311,8 @@ static void vnc_update_client(void *opaq
   15.39 +@@ -307,10 +311,8 @@
   15.40   	    old_row += vs->ds->linesize;
   15.41   	}
   15.42   
   15.43 @@ -51,7 +52,7 @@ diff -r c84300f3abc2 vnc.c
   15.44   
   15.45   	/* Count rectangles */
   15.46   	n_rectangles = 0;
   15.47 -@@ -348,7 +350,9 @@ static void vnc_update_client(void *opaq
   15.48 +@@ -348,7 +350,9 @@
   15.49   	vnc_flush(vs);
   15.50   
   15.51       }
   15.52 @@ -62,10 +63,11 @@ diff -r c84300f3abc2 vnc.c
   15.53   }
   15.54   
   15.55   static void vnc_timer_init(VncState *vs)
   15.56 -diff -r c84300f3abc2 vl.c
   15.57 ---- a/vl.c	Wed Jul 05 18:11:23 2006 +0100
   15.58 -+++ b/vl.c	Thu Jul 06 14:27:28 2006 +0100
   15.59 -@@ -4586,10 +4586,10 @@ void main_loop_wait(int timeout)
   15.60 +Index: ioemu/vl.c
   15.61 +===================================================================
   15.62 +--- ioemu.orig/vl.c	2006-07-27 11:17:00.311184072 +0100
   15.63 ++++ ioemu/vl.c	2006-07-27 11:17:00.724138358 +0100
   15.64 +@@ -4587,10 +4587,10 @@
   15.65           /* XXX: better handling of removal */
   15.66           for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
   15.67               ioh_next = ioh->next;
    16.1 --- a/tools/ioemu/patches/vnc-fixes	Thu Jul 27 10:00:00 2006 -0600
    16.2 +++ b/tools/ioemu/patches/vnc-fixes	Thu Jul 27 10:43:34 2006 -0600
    16.3 @@ -1,8 +1,8 @@
    16.4  Index: ioemu/vl.c
    16.5  ===================================================================
    16.6 ---- ioemu.orig/vl.c	2006-07-26 14:29:04.481598583 +0100
    16.7 -+++ ioemu/vl.c	2006-07-26 14:31:22.668325993 +0100
    16.8 -@@ -6003,8 +6003,10 @@
    16.9 +--- ioemu.orig/vl.c	2006-07-27 11:17:00.724138358 +0100
   16.10 ++++ ioemu/vl.c	2006-07-27 11:17:00.874121755 +0100
   16.11 +@@ -6004,8 +6004,10 @@
   16.12                     kernel_filename, kernel_cmdline, initrd_filename,
   16.13                     timeoffset);
   16.14   
   16.15 @@ -17,8 +17,8 @@ Index: ioemu/vl.c
   16.16       if (use_gdbstub) {
   16.17  Index: ioemu/vnc.c
   16.18  ===================================================================
   16.19 ---- ioemu.orig/vnc.c	2006-07-26 14:29:04.479598804 +0100
   16.20 -+++ ioemu/vnc.c	2006-07-26 14:31:22.669325883 +0100
   16.21 +--- ioemu.orig/vnc.c	2006-07-27 11:17:00.722138579 +0100
   16.22 ++++ ioemu/vnc.c	2006-07-27 11:17:00.875121644 +0100
   16.23  @@ -3,6 +3,7 @@
   16.24    * 
   16.25    * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
   16.26 @@ -493,8 +493,8 @@ Index: ioemu/vnc.c
   16.27   }
   16.28  Index: ioemu/vl.h
   16.29  ===================================================================
   16.30 ---- ioemu.orig/vl.h	2006-07-26 14:31:22.669325883 +0100
   16.31 -+++ ioemu/vl.h	2006-07-26 14:32:44.505279724 +0100
   16.32 +--- ioemu.orig/vl.h	2006-07-27 11:17:00.311184072 +0100
   16.33 ++++ ioemu/vl.h	2006-07-27 11:17:00.875121644 +0100
   16.34  @@ -301,6 +301,7 @@
   16.35   int is_graphic_console(void);
   16.36   CharDriverState *text_console_init(DisplayState *ds);
    17.1 --- a/tools/ioemu/patches/vnc-start-vncviewer	Thu Jul 27 10:00:00 2006 -0600
    17.2 +++ b/tools/ioemu/patches/vnc-start-vncviewer	Thu Jul 27 10:43:34 2006 -0600
    17.3 @@ -1,7 +1,7 @@
    17.4  Index: ioemu/vnc.c
    17.5  ===================================================================
    17.6 ---- ioemu.orig/vnc.c	2006-07-26 14:33:08.166663983 +0100
    17.7 -+++ ioemu/vnc.c	2006-07-26 14:33:08.225657462 +0100
    17.8 +--- ioemu.orig/vnc.c	2006-07-27 11:17:00.875121644 +0100
    17.9 ++++ ioemu/vnc.c	2006-07-27 11:17:01.032104266 +0100
   17.10  @@ -1002,3 +1002,25 @@
   17.11   
   17.12       vnc_dpy_resize(vs->ds, 640, 400);
   17.13 @@ -30,8 +30,8 @@ Index: ioemu/vnc.c
   17.14  +}
   17.15  Index: ioemu/vl.c
   17.16  ===================================================================
   17.17 ---- ioemu.orig/vl.c	2006-07-26 14:33:08.165664094 +0100
   17.18 -+++ ioemu/vl.c	2006-07-26 14:33:08.227657240 +0100
   17.19 +--- ioemu.orig/vl.c	2006-07-27 11:17:00.874121755 +0100
   17.20 ++++ ioemu/vl.c	2006-07-27 11:17:01.035103934 +0100
   17.21  @@ -121,6 +121,7 @@
   17.22   int bios_size;
   17.23   static DisplayState display_state;
   17.24 @@ -40,7 +40,7 @@ Index: ioemu/vl.c
   17.25   const char* keyboard_layout = NULL;
   17.26   int64_t ticks_per_sec;
   17.27   int boot_device = 'c';
   17.28 -@@ -4801,6 +4802,7 @@
   17.29 +@@ -4802,6 +4803,7 @@
   17.30   #endif
   17.31              "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
   17.32   	   "-vnc display    start a VNC server on display\n"
   17.33 @@ -48,7 +48,7 @@ Index: ioemu/vl.c
   17.34              "-timeoffset     time offset (in seconds) from local time\n"
   17.35              "\n"
   17.36              "During emulation, the following keys are useful:\n"
   17.37 -@@ -4889,6 +4891,7 @@
   17.38 +@@ -4890,6 +4892,7 @@
   17.39       QEMU_OPTION_usbdevice,
   17.40       QEMU_OPTION_smp,
   17.41       QEMU_OPTION_vnc,
   17.42 @@ -56,7 +56,7 @@ Index: ioemu/vl.c
   17.43   
   17.44       QEMU_OPTION_d,
   17.45       QEMU_OPTION_vcpus,
   17.46 -@@ -4964,6 +4967,7 @@
   17.47 +@@ -4965,6 +4968,7 @@
   17.48       { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
   17.49       { "smp", HAS_ARG, QEMU_OPTION_smp },
   17.50       { "vnc", HAS_ARG, QEMU_OPTION_vnc },
   17.51 @@ -64,7 +64,7 @@ Index: ioemu/vl.c
   17.52       
   17.53       /* temporary options */
   17.54       { "usb", 0, QEMU_OPTION_usb },
   17.55 -@@ -5294,6 +5298,7 @@
   17.56 +@@ -5295,6 +5299,7 @@
   17.57   #endif
   17.58       snapshot = 0;
   17.59       nographic = 0;
   17.60 @@ -72,7 +72,7 @@ Index: ioemu/vl.c
   17.61       kernel_filename = NULL;
   17.62       kernel_cmdline = "";
   17.63   #ifdef TARGET_PPC
   17.64 -@@ -5663,6 +5668,9 @@
   17.65 +@@ -5664,6 +5669,9 @@
   17.66   		    exit(1);
   17.67   		}
   17.68   		break;
   17.69 @@ -82,7 +82,7 @@ Index: ioemu/vl.c
   17.70               case QEMU_OPTION_domainname:
   17.71                   strncat(domain_name, optarg, sizeof(domain_name) - 20);
   17.72                   break;
   17.73 -@@ -5910,6 +5918,8 @@
   17.74 +@@ -5911,6 +5919,8 @@
   17.75           dumb_display_init(ds);
   17.76       } else if (vnc_display != -1) {
   17.77   	vnc_display_init(ds, vnc_display);
   17.78 @@ -93,8 +93,8 @@ Index: ioemu/vl.c
   17.79           sdl_display_init(ds, full_screen);
   17.80  Index: ioemu/vl.h
   17.81  ===================================================================
   17.82 ---- ioemu.orig/vl.h	2006-07-26 14:33:08.167663873 +0100
   17.83 -+++ ioemu/vl.h	2006-07-26 14:33:08.228657130 +0100
   17.84 +--- ioemu.orig/vl.h	2006-07-27 11:17:00.875121644 +0100
   17.85 ++++ ioemu/vl.h	2006-07-27 11:17:01.036103823 +0100
   17.86  @@ -733,6 +733,7 @@
   17.87   
   17.88   /* vnc.c */
    18.1 --- a/tools/ioemu/patches/xen-domain-name	Thu Jul 27 10:00:00 2006 -0600
    18.2 +++ b/tools/ioemu/patches/xen-domain-name	Thu Jul 27 10:43:34 2006 -0600
    18.3 @@ -1,7 +1,7 @@
    18.4  Index: ioemu/sdl.c
    18.5  ===================================================================
    18.6 ---- ioemu.orig/sdl.c	2006-07-12 11:33:54.665109493 +0100
    18.7 -+++ ioemu/sdl.c	2006-07-12 11:35:01.450735012 +0100
    18.8 +--- ioemu.orig/sdl.c	2006-07-27 11:16:53.590928008 +0100
    18.9 ++++ ioemu/sdl.c	2006-07-27 11:16:58.124426148 +0100
   18.10  @@ -268,14 +268,14 @@
   18.11   static void sdl_update_caption(void)
   18.12   {
   18.13 @@ -21,8 +21,8 @@ Index: ioemu/sdl.c
   18.14   static void sdl_hide_cursor(void)
   18.15  Index: ioemu/vl.c
   18.16  ===================================================================
   18.17 ---- ioemu.orig/vl.c	2006-07-12 11:35:01.094779608 +0100
   18.18 -+++ ioemu/vl.c	2006-07-12 11:35:01.453734636 +0100
   18.19 +--- ioemu.orig/vl.c	2006-07-27 11:16:57.828458912 +0100
   18.20 ++++ ioemu/vl.c	2006-07-27 11:16:58.126425927 +0100
   18.21  @@ -159,6 +159,8 @@
   18.22   #define MAX_CPUS 1
   18.23   #endif
   18.24 @@ -32,7 +32,7 @@ Index: ioemu/vl.c
   18.25   /***********************************************************/
   18.26   /* x86 ISA bus support */
   18.27   
   18.28 -@@ -4698,6 +4700,7 @@
   18.29 +@@ -4699,6 +4701,7 @@
   18.30              "-s              wait gdb connection to port %d\n"
   18.31              "-p port         change gdb connection port\n"
   18.32              "-l item1,...    output log to %s (use -d ? for a list of log items)\n"
   18.33 @@ -40,7 +40,7 @@ Index: ioemu/vl.c
   18.34              "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the optional BIOS\n"
   18.35              "                translation (t=none or lba) (usually qemu can guess them)\n"
   18.36              "-L path         set the directory for the BIOS and VGA BIOS\n"
   18.37 -@@ -4787,6 +4790,7 @@
   18.38 +@@ -4788,6 +4791,7 @@
   18.39       QEMU_OPTION_g,
   18.40       QEMU_OPTION_std_vga,
   18.41       QEMU_OPTION_monitor,
   18.42 @@ -48,7 +48,7 @@ Index: ioemu/vl.c
   18.43       QEMU_OPTION_serial,
   18.44       QEMU_OPTION_parallel,
   18.45       QEMU_OPTION_loadvm,
   18.46 -@@ -4860,6 +4864,7 @@
   18.47 +@@ -4861,6 +4865,7 @@
   18.48       { "localtime", 0, QEMU_OPTION_localtime },
   18.49       { "std-vga", 0, QEMU_OPTION_std_vga },
   18.50       { "monitor", 1, QEMU_OPTION_monitor },
   18.51 @@ -56,7 +56,7 @@ Index: ioemu/vl.c
   18.52       { "serial", 1, QEMU_OPTION_serial },
   18.53       { "parallel", 1, QEMU_OPTION_parallel },
   18.54       { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
   18.55 -@@ -5483,6 +5488,9 @@
   18.56 +@@ -5484,6 +5489,9 @@
   18.57   		    exit(1);
   18.58   		}
   18.59   		break;
   18.60 @@ -68,8 +68,8 @@ Index: ioemu/vl.c
   18.61       }
   18.62  Index: ioemu/vl.h
   18.63  ===================================================================
   18.64 ---- ioemu.orig/vl.h	2006-07-12 11:35:00.955797021 +0100
   18.65 -+++ ioemu/vl.h	2006-07-12 11:35:01.454734511 +0100
   18.66 +--- ioemu.orig/vl.h	2006-07-27 11:16:57.682475072 +0100
   18.67 ++++ ioemu/vl.h	2006-07-27 11:16:58.127425816 +0100
   18.68  @@ -1094,4 +1094,5 @@
   18.69   
   18.70   void kqemu_record_dump(void);
    19.1 --- a/tools/ioemu/patches/xen-domid	Thu Jul 27 10:00:00 2006 -0600
    19.2 +++ b/tools/ioemu/patches/xen-domid	Thu Jul 27 10:43:34 2006 -0600
    19.3 @@ -1,7 +1,8 @@
    19.4 -diff -r 03705e837ce8 vl.c
    19.5 ---- a/vl.c	Tue May 30 14:10:44 2006 +0100
    19.6 -+++ b/vl.c	Tue May 30 14:11:16 2006 +0100
    19.7 -@@ -160,6 +160,7 @@ int vnc_display = -1;
    19.8 +Index: ioemu/vl.c
    19.9 +===================================================================
   19.10 +--- ioemu.orig/vl.c	2006-07-27 11:16:58.126425927 +0100
   19.11 ++++ ioemu/vl.c	2006-07-27 11:16:58.296407110 +0100
   19.12 +@@ -160,6 +160,7 @@
   19.13   #endif
   19.14   
   19.15   char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
   19.16 @@ -9,7 +10,7 @@ diff -r 03705e837ce8 vl.c
   19.17   
   19.18   /***********************************************************/
   19.19   /* x86 ISA bus support */
   19.20 -@@ -4700,6 +4701,7 @@ void help(void)
   19.21 +@@ -4701,6 +4702,7 @@
   19.22              "-s              wait gdb connection to port %d\n"
   19.23              "-p port         change gdb connection port\n"
   19.24              "-l item1,...    output log to %s (use -d ? for a list of log items)\n"
   19.25 @@ -17,7 +18,7 @@ diff -r 03705e837ce8 vl.c
   19.26              "-domain-name    domain name that we're serving\n"
   19.27              "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the optional BIOS\n"
   19.28              "                translation (t=none or lba) (usually qemu can guess them)\n"
   19.29 -@@ -4803,6 +4805,8 @@ enum {
   19.30 +@@ -4804,6 +4806,8 @@
   19.31       QEMU_OPTION_usbdevice,
   19.32       QEMU_OPTION_smp,
   19.33       QEMU_OPTION_vnc,
   19.34 @@ -26,7 +27,7 @@ diff -r 03705e837ce8 vl.c
   19.35   };
   19.36   
   19.37   typedef struct QEMUOption {
   19.38 -@@ -4878,6 +4882,8 @@ const QEMUOption qemu_options[] = {
   19.39 +@@ -4879,6 +4883,8 @@
   19.40       /* temporary options */
   19.41       { "usb", 0, QEMU_OPTION_usb },
   19.42       { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
   19.43 @@ -35,7 +36,7 @@ diff -r 03705e837ce8 vl.c
   19.44       { NULL },
   19.45   };
   19.46   
   19.47 -@@ -5491,6 +5497,10 @@ int main(int argc, char **argv)
   19.48 +@@ -5492,6 +5498,10 @@
   19.49               case QEMU_OPTION_domainname:
   19.50                   strncat(domain_name, optarg, sizeof(domain_name) - 20);
   19.51                   break;
    20.1 --- a/tools/ioemu/patches/xen-mm	Thu Jul 27 10:00:00 2006 -0600
    20.2 +++ b/tools/ioemu/patches/xen-mm	Thu Jul 27 10:43:34 2006 -0600
    20.3 @@ -1,7 +1,7 @@
    20.4  Index: ioemu/hw/pc.c
    20.5  ===================================================================
    20.6 ---- ioemu.orig/hw/pc.c	2006-07-14 15:55:59.489503600 +0100
    20.7 -+++ ioemu/hw/pc.c	2006-07-14 15:56:00.354405169 +0100
    20.8 +--- ioemu.orig/hw/pc.c	2006-07-27 11:16:57.678475515 +0100
    20.9 ++++ ioemu/hw/pc.c	2006-07-27 11:16:58.447390396 +0100
   20.10  @@ -639,7 +639,9 @@
   20.11       }
   20.12   
   20.13 @@ -25,8 +25,8 @@ Index: ioemu/hw/pc.c
   20.14       isa_bios_size = bios_size;
   20.15  Index: ioemu/vl.c
   20.16  ===================================================================
   20.17 ---- ioemu.orig/vl.c	2006-07-14 15:56:00.271414614 +0100
   20.18 -+++ ioemu/vl.c	2006-07-14 15:56:00.358404714 +0100
   20.19 +--- ioemu.orig/vl.c	2006-07-27 11:16:58.296407110 +0100
   20.20 ++++ ioemu/vl.c	2006-07-27 11:16:58.450390064 +0100
   20.21  @@ -159,6 +159,8 @@
   20.22   #define MAX_CPUS 1
   20.23   #endif
   20.24 @@ -36,7 +36,7 @@ Index: ioemu/vl.c
   20.25   char domain_name[1024] = { 'H','V', 'M', 'X', 'E', 'N', '-'};
   20.26   extern int domid;
   20.27   
   20.28 -@@ -5105,6 +5107,9 @@
   20.29 +@@ -5106,6 +5108,9 @@
   20.30       QEMUMachine *machine;
   20.31       char usb_devices[MAX_VM_USB_PORTS][128];
   20.32       int usb_devices_index;
   20.33 @@ -46,7 +46,7 @@ Index: ioemu/vl.c
   20.34   
   20.35       char qemu_dm_logfilename[64];
   20.36   
   20.37 -@@ -5341,11 +5346,13 @@
   20.38 +@@ -5342,11 +5347,13 @@
   20.39                   ram_size = atol(optarg) * 1024 * 1024;
   20.40                   if (ram_size <= 0)
   20.41                       help();
   20.42 @@ -60,7 +60,7 @@ Index: ioemu/vl.c
   20.43                   break;
   20.44               case QEMU_OPTION_l:
   20.45                   {
   20.46 -@@ -5559,6 +5566,39 @@
   20.47 +@@ -5560,6 +5567,39 @@
   20.48       /* init the memory */
   20.49       phys_ram_size = ram_size + vga_ram_size + bios_size;
   20.50   
   20.51 @@ -100,7 +100,7 @@ Index: ioemu/vl.c
   20.52   #ifdef CONFIG_SOFTMMU
   20.53       phys_ram_base = qemu_vmalloc(phys_ram_size);
   20.54       if (!phys_ram_base) {
   20.55 -@@ -5599,6 +5639,8 @@
   20.56 +@@ -5600,6 +5640,8 @@
   20.57       }
   20.58   #endif
   20.59   
    21.1 --- a/tools/ioemu/patches/xen-network	Thu Jul 27 10:00:00 2006 -0600
    21.2 +++ b/tools/ioemu/patches/xen-network	Thu Jul 27 10:43:34 2006 -0600
    21.3 @@ -1,7 +1,7 @@
    21.4  Index: ioemu/vl.c
    21.5  ===================================================================
    21.6 ---- ioemu.orig/vl.c	2006-07-12 11:35:01.753697055 +0100
    21.7 -+++ ioemu/vl.c	2006-07-12 11:35:02.126650330 +0100
    21.8 +--- ioemu.orig/vl.c	2006-07-27 11:16:58.823348777 +0100
    21.9 ++++ ioemu/vl.c	2006-07-27 11:16:59.169310479 +0100
   21.10  @@ -89,6 +89,7 @@
   21.11   #include "exec-all.h"
   21.12   
   21.13 @@ -40,7 +40,7 @@ Index: ioemu/vl.c
   21.14           int fd;
   21.15           if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
   21.16               fd = strtol(buf, NULL, 0);
   21.17 -@@ -3212,7 +3215,10 @@
   21.18 +@@ -3213,7 +3216,10 @@
   21.19               if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
   21.20                   pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
   21.21               }
   21.22 @@ -52,7 +52,7 @@ Index: ioemu/vl.c
   21.23           }
   21.24       } else
   21.25   #endif
   21.26 -@@ -4671,7 +4677,7 @@
   21.27 +@@ -4672,7 +4678,7 @@
   21.28              "-net tap[,vlan=n],ifname=name\n"
   21.29              "                connect the host TAP network interface to VLAN 'n'\n"
   21.30   #else
    22.1 --- a/tools/ioemu/vl.c	Thu Jul 27 10:00:00 2006 -0600
    22.2 +++ b/tools/ioemu/vl.c	Thu Jul 27 10:43:34 2006 -0600
    22.3 @@ -3284,6 +3284,7 @@ int net_client_init(const char *str)
    22.4              if (net_tap_fd_init(vlan, fd))
    22.5                  ret = 0;
    22.6          } else {
    22.7 +            ifname[0] = '\0';
    22.8              get_param_value(ifname, sizeof(ifname), "ifname", p);
    22.9              if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) {
   22.10                  pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT);
    23.1 --- a/tools/libxc/xc_hvm_build.c	Thu Jul 27 10:00:00 2006 -0600
    23.2 +++ b/tools/libxc/xc_hvm_build.c	Thu Jul 27 10:43:34 2006 -0600
    23.3 @@ -15,12 +15,6 @@
    23.4  
    23.5  #define HVM_LOADER_ENTR_ADDR  0x00100000
    23.6  
    23.7 -#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
    23.8 -#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
    23.9 -#ifdef __x86_64__
   23.10 -#define L3_PROT (_PAGE_PRESENT)
   23.11 -#endif
   23.12 -
   23.13  #define E820MAX     128
   23.14  
   23.15  #define E820_RAM          1
   23.16 @@ -41,9 +35,6 @@ struct e820entry {
   23.17      uint32_t type;
   23.18  } __attribute__((packed));
   23.19  
   23.20 -#define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
   23.21 -#define round_pgdown(_p)  ((_p)&PAGE_MASK)
   23.22 -
   23.23  static int
   23.24  parseelfimage(
   23.25      char *elfbase, unsigned long elfsize, struct domain_setup_info *dsi);
   23.26 @@ -52,7 +43,7 @@ loadelfimage(
   23.27      char *elfbase, int xch, uint32_t dom, unsigned long *parray,
   23.28      struct domain_setup_info *dsi);
   23.29  
   23.30 -static unsigned char build_e820map(void *e820_page, unsigned long long mem_size)
   23.31 +static void build_e820map(void *e820_page, unsigned long long mem_size)
   23.32  {
   23.33      struct e820entry *e820entry =
   23.34          (struct e820entry *)(((unsigned char *)e820_page) + E820_MAP_OFFSET);
   23.35 @@ -115,7 +106,7 @@ static unsigned char build_e820map(void 
   23.36      e820entry[nr_map].type = E820_IO;
   23.37      nr_map++;
   23.38  
   23.39 -    return (*(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map);
   23.40 +    *(((unsigned char *)e820_page) + E820_MAP_NR_OFFSET) = nr_map;
   23.41  }
   23.42  
   23.43  static void set_hvm_info_checksum(struct hvm_info_table *t)
   23.44 @@ -186,7 +177,6 @@ static int setup_guest(int xc_handle,
   23.45  
   23.46      shared_info_t *shared_info;
   23.47      void *e820_page;
   23.48 -    unsigned char e820_map_nr;
   23.49  
   23.50      struct domain_setup_info dsi;
   23.51      uint64_t v_end;
   23.52 @@ -261,7 +251,7 @@ static int setup_guest(int xc_handle,
   23.53                page_array[E820_MAP_PAGE >> PAGE_SHIFT])) == 0 )
   23.54          goto error_out;
   23.55      memset(e820_page, 0, PAGE_SIZE);
   23.56 -    e820_map_nr = build_e820map(e820_page, v_end);
   23.57 +    build_e820map(e820_page, v_end);
   23.58      munmap(e820_page, PAGE_SIZE);
   23.59  
   23.60      /* shared_info page starts its life empty. */
   23.61 @@ -311,23 +301,7 @@ static int setup_guest(int xc_handle,
   23.62      /*
   23.63       * Initial register values:
   23.64       */
   23.65 -    ctxt->user_regs.ds = 0;
   23.66 -    ctxt->user_regs.es = 0;
   23.67 -    ctxt->user_regs.fs = 0;
   23.68 -    ctxt->user_regs.gs = 0;
   23.69 -    ctxt->user_regs.ss = 0;
   23.70 -    ctxt->user_regs.cs = 0;
   23.71      ctxt->user_regs.eip = dsi.v_kernentry;
   23.72 -    ctxt->user_regs.edx = 0;
   23.73 -    ctxt->user_regs.eax = 0;
   23.74 -    ctxt->user_regs.esp = 0;
   23.75 -    ctxt->user_regs.ebx = 0; /* startup_32 expects this to be 0 to signal boot cpu */
   23.76 -    ctxt->user_regs.ecx = 0;
   23.77 -    ctxt->user_regs.esi = 0;
   23.78 -    ctxt->user_regs.edi = 0;
   23.79 -    ctxt->user_regs.ebp = 0;
   23.80 -
   23.81 -    ctxt->user_regs.eflags = 0;
   23.82  
   23.83      return 0;
   23.84  
    24.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Jul 27 10:00:00 2006 -0600
    24.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Jul 27 10:43:34 2006 -0600
    24.3 @@ -286,7 +286,7 @@ static inline int long_mode_do_msr_write
    24.4          if ( msr_content & ~(EFER_LME | EFER_LMA | EFER_NX | EFER_SCE) )
    24.5          {
    24.6              printk("trying to set reserved bit in EFER\n");
    24.7 -            vmx_inject_exception(v, TRAP_gp_fault, 0);
    24.8 +            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
    24.9              return 0;
   24.10          }
   24.11  
   24.12 @@ -300,7 +300,7 @@ static inline int long_mode_do_msr_write
   24.13              {
   24.14                  printk("trying to set LME bit when "
   24.15                         "in paging mode or PAE bit is not set\n");
   24.16 -                vmx_inject_exception(v, TRAP_gp_fault, 0);
   24.17 +                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   24.18                  return 0;
   24.19              }
   24.20  
   24.21 @@ -318,7 +318,7 @@ static inline int long_mode_do_msr_write
   24.22          if ( !IS_CANO_ADDRESS(msr_content) )
   24.23          {
   24.24              HVM_DBG_LOG(DBG_LEVEL_1, "Not cano address of msr write\n");
   24.25 -            vmx_inject_exception(v, TRAP_gp_fault, 0);
   24.26 +            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   24.27              return 0;
   24.28          }
   24.29  
   24.30 @@ -1438,7 +1438,7 @@ static int vmx_set_cr0(unsigned long val
   24.31                         &v->arch.hvm_vmx.cpu_state) )
   24.32          {
   24.33              HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enabled\n");
   24.34 -            vmx_inject_exception(v, TRAP_gp_fault, 0);
   24.35 +            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   24.36          }
   24.37  
   24.38          if ( test_bit(VMX_CPU_STATE_LME_ENABLED,
   24.39 @@ -1520,7 +1520,7 @@ static int vmx_set_cr0(unsigned long val
   24.40      {
   24.41          if ( value & X86_CR0_PG ) {
   24.42              /* inject GP here */
   24.43 -            vmx_inject_exception(v, TRAP_gp_fault, 0);
   24.44 +            vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   24.45              return 0;
   24.46          } else {
   24.47              /*
   24.48 @@ -1764,7 +1764,7 @@ static int mov_to_cr(int gp, int cr, str
   24.49          else
   24.50          {
   24.51              if ( test_bit(VMX_CPU_STATE_LMA_ENABLED, &v->arch.hvm_vmx.cpu_state) )
   24.52 -                vmx_inject_exception(v, TRAP_gp_fault, 0);
   24.53 +                vmx_inject_hw_exception(v, TRAP_gp_fault, 0);
   24.54  
   24.55              clear_bit(VMX_CPU_STATE_PAE_ENABLED, &v->arch.hvm_vmx.cpu_state);
   24.56          }
   24.57 @@ -2192,7 +2192,7 @@ asmlinkage void vmx_vmexit_handler(struc
   24.58              if ( test_bit(_DOMF_debugging, &v->domain->domain_flags) )
   24.59                  domain_pause_for_debugger();
   24.60              else 
   24.61 -                vmx_inject_exception(v, TRAP_int3, VMX_DELIVER_NO_ERROR_CODE);
   24.62 +                vmx_reflect_exception(v);
   24.63              break;
   24.64          }
   24.65  #endif
   24.66 @@ -2219,7 +2219,7 @@ asmlinkage void vmx_vmexit_handler(struc
   24.67                  /*
   24.68                   * Inject #PG using Interruption-Information Fields
   24.69                   */
   24.70 -                vmx_inject_exception(v, TRAP_page_fault, regs.error_code);
   24.71 +                vmx_inject_hw_exception(v, TRAP_page_fault, regs.error_code);
   24.72                  v->arch.hvm_vmx.cpu_cr2 = va;
   24.73                  TRACE_3D(TRC_VMX_INT, v->domain->domain_id, TRAP_page_fault, va);
   24.74              }
   24.75 @@ -2335,7 +2335,7 @@ asmlinkage void vmx_vmexit_handler(struc
   24.76      case EXIT_REASON_VMON:
   24.77          /* Report invalid opcode exception when a VMX guest tries to execute 
   24.78              any of the VMX instructions */
   24.79 -        vmx_inject_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
   24.80 +        vmx_inject_hw_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
   24.81          break;
   24.82  
   24.83      default:
    25.1 --- a/xen/arch/x86/shadow32.c	Thu Jul 27 10:00:00 2006 -0600
    25.2 +++ b/xen/arch/x86/shadow32.c	Thu Jul 27 10:43:34 2006 -0600
    25.3 @@ -835,12 +835,12 @@ void free_monitor_pagetable(struct vcpu 
    25.4  }
    25.5  
    25.6  static int
    25.7 -map_p2m_entry(l1_pgentry_t *l1tab, unsigned long va,
    25.8 -              unsigned long gpa, unsigned long mfn)
    25.9 +map_p2m_entry(l1_pgentry_t *l1tab, unsigned long gpfn, unsigned long mfn)
   25.10  {
   25.11      unsigned long *l0tab = NULL;
   25.12      l1_pgentry_t l1e = { 0 };
   25.13      struct page_info *page;
   25.14 +    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(mfn));
   25.15  
   25.16      l1e = l1tab[l1_table_offset(va)];
   25.17      if ( !(l1e_get_flags(l1e) & _PAGE_PRESENT) )
   25.18 @@ -858,7 +858,7 @@ map_p2m_entry(l1_pgentry_t *l1tab, unsig
   25.19      else
   25.20          l0tab = map_domain_page(l1e_get_pfn(l1e));
   25.21  
   25.22 -    l0tab[gpa & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
   25.23 +    l0tab[gpfn & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
   25.24  
   25.25      unmap_domain_page(l0tab);
   25.26  
   25.27 @@ -877,15 +877,9 @@ set_p2m_entry(struct domain *d, unsigned
   25.28      unsigned long va = pfn << PAGE_SHIFT;
   25.29  
   25.30      if ( shadow_mode_external(d) )
   25.31 -    {
   25.32          tabpfn = pagetable_get_pfn(d->vcpu[0]->arch.monitor_table);
   25.33 -        va = RO_MPT_VIRT_START + (pfn * sizeof (unsigned long));
   25.34 -    }
   25.35      else
   25.36 -    {
   25.37          tabpfn = pagetable_get_pfn(d->arch.phys_table);
   25.38 -        va = pfn << PAGE_SHIFT;
   25.39 -    }
   25.40  
   25.41      ASSERT(tabpfn != 0);
   25.42      ASSERT(shadow_lock_is_acquired(d));
   25.43 @@ -902,12 +896,12 @@ set_p2m_entry(struct domain *d, unsigned
   25.44          l1_pgentry_t *l1tab = NULL;
   25.45          l2_pgentry_t l2e;
   25.46  
   25.47 -        l2e = l2[l2_table_offset(va)];
   25.48 +        l2e = l2[l2_table_offset(RO_MPT_VIRT_START)];
   25.49  
   25.50          ASSERT( l2e_get_flags(l2e) & _PAGE_PRESENT );
   25.51  
   25.52          l1tab = map_domain_page(l2e_get_pfn(l2e));
   25.53 -        if ( !(error = map_p2m_entry(l1tab, va, pfn, mfn)) )
   25.54 +        if ( !(error = map_p2m_entry(l1tab, pfn, mfn)) )
   25.55              domain_crash(d);
   25.56  
   25.57          unmap_domain_page(l1tab);
   25.58 @@ -952,7 +946,6 @@ static int
   25.59  alloc_p2m_table(struct domain *d)
   25.60  {
   25.61      struct list_head *list_ent;
   25.62 -    unsigned long va = RO_MPT_VIRT_START;   /* phys_to_machine_mapping */
   25.63  
   25.64      l2_pgentry_t *l2tab = NULL;
   25.65      l1_pgentry_t *l1tab = NULL;
   25.66 @@ -965,14 +958,14 @@ alloc_p2m_table(struct domain *d)
   25.67      {
   25.68          l2tab = map_domain_page(
   25.69              pagetable_get_pfn(d->vcpu[0]->arch.monitor_table));
   25.70 -        l2e = l2tab[l2_table_offset(va)];
   25.71 +        l2e = l2tab[l2_table_offset(RO_MPT_VIRT_START)];
   25.72          if ( !(l2e_get_flags(l2e) & _PAGE_PRESENT) )
   25.73          {
   25.74              page = alloc_domheap_page(NULL);
   25.75  
   25.76              l1tab = map_domain_page(page_to_mfn(page));
   25.77              memset(l1tab, 0, PAGE_SIZE);
   25.78 -            l2e = l2tab[l2_table_offset(va)] =
   25.79 +            l2e = l2tab[l2_table_offset(RO_MPT_VIRT_START)] =
   25.80                  l2e_from_page(page, __PAGE_HYPERVISOR);
   25.81          }
   25.82          else
   25.83 @@ -1002,14 +995,13 @@ alloc_p2m_table(struct domain *d)
   25.84          page = list_entry(list_ent, struct page_info, list);
   25.85          mfn = page_to_mfn(page);
   25.86  
   25.87 -        if ( !(error = map_p2m_entry(l1tab, va, gpfn, mfn)) )
   25.88 +        if ( !(error = map_p2m_entry(l1tab, gpfn, mfn)) )
   25.89          {
   25.90              domain_crash(d);
   25.91              break;
   25.92          }
   25.93  
   25.94          list_ent = frame_table[mfn].list.next;
   25.95 -        va += sizeof(mfn);
   25.96      }
   25.97  
   25.98      unmap_domain_page(l1tab);
    26.1 --- a/xen/arch/x86/shadow_public.c	Thu Jul 27 10:00:00 2006 -0600
    26.2 +++ b/xen/arch/x86/shadow_public.c	Thu Jul 27 10:43:34 2006 -0600
    26.3 @@ -438,6 +438,8 @@ static void alloc_monitor_pagetable(stru
    26.4              (l3e_get_flags(mpl3e[i]) & _PAGE_PRESENT) ?
    26.5              l2e_from_pfn(l3e_get_pfn(mpl3e[i]), __PAGE_HYPERVISOR) :
    26.6              l2e_empty();
    26.7 +    for ( i = 0; i < (MACHPHYS_MBYTES >> (L2_PAGETABLE_SHIFT - 20)); i++ )
    26.8 +        mpl2e[l2_table_offset(RO_MPT_VIRT_START) + i] = l2e_empty();
    26.9  
   26.10      if ( v->vcpu_id == 0 )
   26.11      {
   26.12 @@ -1471,8 +1473,7 @@ int _shadow_mode_refcounts(struct domain
   26.13  }
   26.14  
   26.15  static int
   26.16 -map_p2m_entry(pgentry_64_t *top_tab, unsigned long va,
   26.17 -              unsigned long gpfn, unsigned long mfn)
   26.18 +map_p2m_entry(pgentry_64_t *top_tab, unsigned long gpfn, unsigned long mfn)
   26.19  {
   26.20  #if CONFIG_PAGING_LEVELS >= 4
   26.21      pgentry_64_t l4e = { 0 };
   26.22 @@ -1487,6 +1488,7 @@ map_p2m_entry(pgentry_64_t *top_tab, uns
   26.23      l2_pgentry_t l2e = { 0 };
   26.24      l1_pgentry_t l1e = { 0 };
   26.25      struct page_info *page;
   26.26 +    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(mfn));
   26.27  
   26.28  #if CONFIG_PAGING_LEVELS >= 4
   26.29      l4e = top_tab[l4_table_offset(va)];
   26.30 @@ -1568,7 +1570,7 @@ map_p2m_entry(pgentry_64_t *top_tab, uns
   26.31  
   26.32      unmap_domain_page(l1tab);
   26.33  
   26.34 -    l0tab[gpfn & ((PAGE_SIZE / sizeof (mfn)) - 1) ] = mfn;
   26.35 +    l0tab[gpfn & ((PAGE_SIZE / sizeof(mfn)) - 1)] = mfn;
   26.36  
   26.37      unmap_domain_page(l0tab);
   26.38  
   26.39 @@ -1584,7 +1586,6 @@ set_p2m_entry(struct domain *d, unsigned
   26.40                struct domain_mmap_cache *l1cache)
   26.41  {
   26.42      unsigned long tabmfn = pagetable_get_pfn(d->vcpu[0]->arch.monitor_table);
   26.43 -    unsigned long va = RO_MPT_VIRT_START + (gpfn * sizeof(unsigned long));
   26.44      pgentry_64_t *top_tab;
   26.45      int error;
   26.46  
   26.47 @@ -1593,7 +1594,7 @@ set_p2m_entry(struct domain *d, unsigned
   26.48  
   26.49      top_tab = map_domain_page_with_cache(tabmfn, l2cache);
   26.50  
   26.51 -    if ( !(error = map_p2m_entry(top_tab, va, gpfn, mfn)) )
   26.52 +    if ( !(error = map_p2m_entry(top_tab, gpfn, mfn)) )
   26.53          domain_crash(d);
   26.54  
   26.55      unmap_domain_page_with_cache(top_tab, l2cache);
   26.56 @@ -1605,10 +1606,9 @@ static int
   26.57  alloc_p2m_table(struct domain *d)
   26.58  {
   26.59      struct list_head *list_ent;
   26.60 -    unsigned long va = RO_MPT_VIRT_START; /*  phys_to_machine_mapping */
   26.61      pgentry_64_t *top_tab = NULL;
   26.62 -    unsigned long mfn;
   26.63 -    int gpfn, error = 0;
   26.64 +    unsigned long gpfn, mfn;
   26.65 +    int error = 0;
   26.66  
   26.67      ASSERT( pagetable_get_pfn(d->vcpu[0]->arch.monitor_table) );
   26.68  
   26.69 @@ -1624,14 +1624,13 @@ alloc_p2m_table(struct domain *d)
   26.70          page = list_entry(list_ent, struct page_info, list);
   26.71          mfn = page_to_mfn(page);
   26.72  
   26.73 -        if ( !(error = map_p2m_entry(top_tab, va, gpfn, mfn)) )
   26.74 +        if ( !(error = map_p2m_entry(top_tab, gpfn, mfn)) )
   26.75          {
   26.76              domain_crash(d);
   26.77              break;
   26.78          }
   26.79  
   26.80          list_ent = frame_table[mfn].list.next;
   26.81 -        va += sizeof(mfn);
   26.82      }
   26.83  
   26.84      unmap_domain_page(top_tab);
    27.1 --- a/xen/common/memory.c	Thu Jul 27 10:00:00 2006 -0600
    27.2 +++ b/xen/common/memory.c	Thu Jul 27 10:43:34 2006 -0600
    27.3 @@ -170,7 +170,7 @@ guest_remove_page(
    27.4      if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
    27.5          put_page(page);
    27.6  
    27.7 -    if ( unlikely((page->count_info & PGC_count_mask) != 1) )
    27.8 +    if ( unlikely(!page_is_removable(page)) )
    27.9      {
   27.10          /* We'll make this a guest-visible error in future, so take heed! */
   27.11          DPRINTK("Dom%d freeing in-use page %lx (pseudophys %lx):"
    28.1 --- a/xen/include/asm-ia64/mm.h	Thu Jul 27 10:00:00 2006 -0600
    28.2 +++ b/xen/include/asm-ia64/mm.h	Thu Jul 27 10:43:34 2006 -0600
    28.3 @@ -213,6 +213,11 @@ static inline int get_page_and_type(stru
    28.4      return rc;
    28.5  }
    28.6  
    28.7 +static inline int page_is_removable(struct page_info *page)
    28.8 +{
    28.9 +    return ((page->count_info & PGC_count_mask) == 2);
   28.10 +}
   28.11 +
   28.12  #define	set_machinetophys(_mfn, _pfn) do { } while(0);
   28.13  
   28.14  #ifdef MEMORY_GUARD
    29.1 --- a/xen/include/asm-x86/hvm/vmx/vmx.h	Thu Jul 27 10:00:00 2006 -0600
    29.2 +++ b/xen/include/asm-x86/hvm/vmx/vmx.h	Thu Jul 27 10:43:34 2006 -0600
    29.3 @@ -143,11 +143,12 @@ extern unsigned int cpu_rev;
    29.4   */
    29.5  #define INTR_INFO_VECTOR_MASK           0xff            /* 7:0 */
    29.6  #define INTR_INFO_INTR_TYPE_MASK        0x700           /* 10:8 */
    29.7 -#define INTR_INFO_DELIEVER_CODE_MASK    0x800           /* 11 */
    29.8 +#define INTR_INFO_DELIVER_CODE_MASK     0x800           /* 11 */
    29.9  #define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
   29.10  
   29.11  #define INTR_TYPE_EXT_INTR              (0 << 8) /* external interrupt */
   29.12 -#define INTR_TYPE_EXCEPTION             (3 << 8) /* processor exception */
   29.13 +#define INTR_TYPE_HW_EXCEPTION             (3 << 8) /* hardware exception */
   29.14 +#define INTR_TYPE_SW_EXCEPTION             (6 << 8) /* software exception */
   29.15  
   29.16  /*
   29.17   * Exit Qualifications for MOV for Control Register Access
   29.18 @@ -421,7 +422,7 @@ static inline int vmx_pgbit_test(struct 
   29.19  }
   29.20  
   29.21  static inline int __vmx_inject_exception(struct vcpu *v, int trap, int type, 
   29.22 -                                         int error_code)
   29.23 +                                         int error_code, int ilen)
   29.24  {
   29.25      unsigned long intr_fields;
   29.26  
   29.27 @@ -429,22 +430,33 @@ static inline int __vmx_inject_exception
   29.28      intr_fields = (INTR_INFO_VALID_MASK | type | trap);
   29.29      if (error_code != VMX_DELIVER_NO_ERROR_CODE) {
   29.30          __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
   29.31 -        intr_fields |= INTR_INFO_DELIEVER_CODE_MASK;
   29.32 +        intr_fields |= INTR_INFO_DELIVER_CODE_MASK;
   29.33       }
   29.34 -    
   29.35 +
   29.36 +    if(ilen)
   29.37 +      __vmwrite(VM_ENTRY_INSTRUCTION_LEN, ilen);
   29.38 +
   29.39      __vmwrite(VM_ENTRY_INTR_INFO_FIELD, intr_fields);
   29.40      return 0;
   29.41  }
   29.42  
   29.43 -static inline int vmx_inject_exception(struct vcpu *v, int trap, int error_code)
   29.44 +static inline int vmx_inject_hw_exception(struct vcpu *v, int trap, int error_code)
   29.45  {
   29.46      v->arch.hvm_vmx.vector_injected = 1;
   29.47 -    return __vmx_inject_exception(v, trap, INTR_TYPE_EXCEPTION, error_code);
   29.48 +    return __vmx_inject_exception(v, trap, INTR_TYPE_HW_EXCEPTION,
   29.49 +				  error_code, 0);
   29.50 +}
   29.51 +
   29.52 +static inline int vmx_inject_sw_exception(struct vcpu *v, int trap, int instruction_len) {
   29.53 +     v->arch.hvm_vmx.vector_injected=1;
   29.54 +     return __vmx_inject_exception(v, trap, INTR_TYPE_SW_EXCEPTION,
   29.55 +				   VMX_DELIVER_NO_ERROR_CODE,
   29.56 +				   instruction_len);
   29.57  }
   29.58  
   29.59  static inline int vmx_inject_extint(struct vcpu *v, int trap, int error_code)
   29.60  {
   29.61 -    __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR, error_code);
   29.62 +    __vmx_inject_exception(v, trap, INTR_TYPE_EXT_INTR, error_code, 0);
   29.63      __vmwrite(GUEST_INTERRUPTIBILITY_INFO, 0);
   29.64  
   29.65      return 0;
   29.66 @@ -452,14 +464,14 @@ static inline int vmx_inject_extint(stru
   29.67  
   29.68  static inline int vmx_reflect_exception(struct vcpu *v)
   29.69  {
   29.70 -    int error_code, vector;
   29.71 +    int error_code, intr_info, vector;
   29.72  
   29.73 -    __vmread(VM_EXIT_INTR_INFO, &vector);
   29.74 -    if (vector & INTR_INFO_DELIEVER_CODE_MASK)
   29.75 +    __vmread(VM_EXIT_INTR_INFO, &intr_info);
   29.76 +    vector = intr_info & 0xff;
   29.77 +    if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
   29.78          __vmread(VM_EXIT_INTR_ERROR_CODE, &error_code);
   29.79      else
   29.80          error_code = VMX_DELIVER_NO_ERROR_CODE;
   29.81 -    vector &= 0xff;
   29.82  
   29.83  #ifndef NDEBUG
   29.84      {
   29.85 @@ -472,7 +484,19 @@ static inline int vmx_reflect_exception(
   29.86      }
   29.87  #endif /* NDEBUG */
   29.88  
   29.89 -    vmx_inject_exception(v, vector, error_code);
   29.90 +    /* According to Intel Virtualization Technology Specification for
   29.91 +       the IA-32 Intel Architecture (C97063-002 April 2005), section
   29.92 +       2.8.3, SW_EXCEPTION should be used for #BP and #OV, and
   29.93 +       HW_EXCPEPTION used for everything else.  The main difference
   29.94 +       appears to be that for SW_EXCEPTION, the EIP/RIP is incremented
   29.95 +       by VM_ENTER_INSTRUCTION_LEN bytes, whereas for HW_EXCEPTION, 
   29.96 +       it is not.  */
   29.97 +    if((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_SW_EXCEPTION) {
   29.98 +      int ilen;
   29.99 +      __vmread(VM_EXIT_INSTRUCTION_LEN, &ilen);
  29.100 +      vmx_inject_sw_exception(v, vector, ilen);
  29.101 +    } else
  29.102 +      vmx_inject_hw_exception(v, vector, error_code);
  29.103      return 0;
  29.104  }
  29.105  
    30.1 --- a/xen/include/asm-x86/mm.h	Thu Jul 27 10:00:00 2006 -0600
    30.2 +++ b/xen/include/asm-x86/mm.h	Thu Jul 27 10:43:34 2006 -0600
    30.3 @@ -241,6 +241,11 @@ static inline int get_page_and_type(stru
    30.4      return rc;
    30.5  }
    30.6  
    30.7 +static inline int page_is_removable(struct page_info *page)
    30.8 +{
    30.9 +    return ((page->count_info & PGC_count_mask) == 1);
   30.10 +}
   30.11 +
   30.12  #define ASSERT_PAGE_IS_TYPE(_p, _t)                            \
   30.13      ASSERT(((_p)->u.inuse.type_info & PGT_type_mask) == (_t)); \
   30.14      ASSERT(((_p)->u.inuse.type_info & PGT_count_mask) != 0)