[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] This patch fix several issue to support >2G 64bit vmx guest in IA-32e



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b92a36713192b0b66c5ca7359e36a9026881d09d
# Parent  3d1c7be170a7b27adc58309961ce7d476984874b
This patch fix several issue to support >2G 64bit vmx guest in IA-32e
platform, it includes:
1) One fix on xc_vmx_build.c
2) Change ram_size/phys_ram_size in qemu from int to uint64_t
3) One fix on pcnet unsigned short to unsigned long conversion.

Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
Signed-off-by: Xin Li           <xin.b.li@xxxxxxxxx>

diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/cpu-all.h
--- a/tools/ioemu/cpu-all.h     Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/cpu-all.h     Tue Dec 20 11:50:09 2005
@@ -668,7 +668,7 @@
 #endif
 /* memory API */
 
-extern int phys_ram_size;
+extern uint64_t phys_ram_size;
 extern int phys_ram_fd;
 extern uint8_t *phys_ram_base;
 extern uint8_t *phys_ram_dirty;
diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/exec.c
--- a/tools/ioemu/exec.c        Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/exec.c        Tue Dec 20 11:50:09 2005
@@ -61,7 +61,7 @@
 uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE];
 uint8_t *code_gen_ptr;
 
-int phys_ram_size;
+uint64_t phys_ram_size;
 int phys_ram_fd;
 uint8_t *phys_ram_base;
 uint8_t *phys_ram_dirty;
diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/hw/pc.c
--- a/tools/ioemu/hw/pc.c       Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/hw/pc.c       Tue Dec 20 11:50:09 2005
@@ -119,7 +119,7 @@
 }
 
 /* hd_table must contain 4 block drivers */
-static void cmos_init(int ram_size, int boot_device, BlockDriverState 
**hd_table)
+static void cmos_init(uint64_t ram_size, int boot_device, BlockDriverState 
**hd_table)
 {
     RTCState *s = rtc_state;
     int val;
@@ -375,7 +375,7 @@
 #define NOBIOS 1
 
 /* PC hardware initialisation */
-void pc_init(int ram_size, int vga_ram_size, int boot_device,
+void pc_init(uint64_t ram_size, int vga_ram_size, int boot_device,
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename)
diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/hw/pcnet.h
--- a/tools/ioemu/hw/pcnet.h    Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/hw/pcnet.h    Tue Dec 20 11:50:09 2005
@@ -92,7 +92,7 @@
 #define CSR_NRBA(S)      ((S)->csr[22] | ((S)->csr[23] << 16))
 #define CSR_BADR(S)      ((S)->csr[24] | ((S)->csr[25] << 16))
 #define CSR_NRDA(S)      ((S)->csr[26] | ((S)->csr[27] << 16))
-#define CSR_CRDA(S)      ((S)->csr[28] | ((S)->csr[29] << 16))
+#define CSR_CRDA(S)      ((S)->csr[28] | (((uint32_t)((S)->csr[29])) << 16))
 #define CSR_BADX(S)      ((S)->csr[30] | ((S)->csr[31] << 16))
 #define CSR_NXDA(S)      ((S)->csr[32] | ((S)->csr[33] << 16))
 #define CSR_CXDA(S)      ((S)->csr[34] | ((S)->csr[35] << 16))
@@ -102,7 +102,7 @@
 #define CSR_NXBA(S)      ((S)->csr[64] | ((S)->csr[65] << 16))
 
 #define PHYSADDR(S,A) \
-  (BCR_SSIZE32(S) ? (A) : (A) | ((0xff00 & (uint32_t)(s)->csr[2])<<16))
+  (BCR_SSIZE32(S) ? (A) : (A) | ((0xff00 & (uint32_t)(S)->csr[2])<<16))
 
 struct pcnet_initblk16 {
     uint16_t mode;
diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/vl.c  Tue Dec 20 11:50:09 2005
@@ -119,7 +119,7 @@
 const char* keyboard_layout = 0;
 int64_t ticks_per_sec;
 int boot_device = 'c';
-int ram_size;
+uint64_t ram_size;
 int domid = -1;
 static char network_script[1024];
 int pit_min_timer_count = 0;
@@ -2906,7 +2906,7 @@
                 help();
                 break;
             case QEMU_OPTION_m:
-                ram_size = atoi(optarg) * 1024 * 1024;
+                ram_size = atol(optarg) * 1024 * 1024;
                 if (ram_size <= 0)
                     help();
                 break;
diff -r 3d1c7be170a7 -r b92a36713192 tools/ioemu/vl.h
--- a/tools/ioemu/vl.h  Tue Dec 20 11:46:56 2005
+++ b/tools/ioemu/vl.h  Tue Dec 20 11:50:09 2005
@@ -116,7 +116,7 @@
 extern int sb16_enabled;
 extern int adlib_enabled;
 extern int gus_enabled;
-extern int ram_size;
+extern uint64_t ram_size;
 extern int bios_size;
 extern int rtc_utc;
 extern int cirrus_vga_enabled;
@@ -649,7 +649,7 @@
 int pit_get_out(PITState *pit, int channel, int64_t current_time);
 
 /* pc.c */
-void pc_init(int ram_size, int vga_ram_size, int boot_device,
+void pc_init(uint64_t ram_size, int vga_ram_size, int boot_device,
              DisplayState *ds, const char **fd_filename, int snapshot,
              const char *kernel_filename, const char *kernel_cmdline,
              const char *initrd_filename);
diff -r 3d1c7be170a7 -r b92a36713192 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Tue Dec 20 11:46:56 2005
+++ b/tools/libxc/xc_vmx_build.c        Tue Dec 20 11:50:09 2005
@@ -288,11 +288,11 @@
     l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
     unsigned long *page_array = NULL;
 #ifdef __x86_64__
-    l3_pgentry_t *vl3tab=NULL, *vl3e=NULL;
+    l3_pgentry_t *vl3tab=NULL;
     unsigned long l3tab;
 #endif
-    unsigned long l2tab;
-    unsigned long l1tab;
+    unsigned long l2tab = 0;
+    unsigned long l1tab = 0;
     unsigned long count, i;
     shared_info_t *shared_info;
     void *e820_page;
@@ -323,7 +323,7 @@
     }
 
     /* memsize is in megabytes */
-    v_end              = memsize << 20;
+    v_end              = (unsigned long)memsize << 20;
 
 #ifdef __i386__
     nr_pt_pages = 1 + ((memsize + 3) >> 2);
@@ -435,15 +435,16 @@
             goto error_out;
         memset(vl2tab, 0, PAGE_SIZE);
         munmap(vl2tab, PAGE_SIZE);
+        vl2tab = NULL;
         vl3tab[i] = l2tab | L3_PROT;
     }
 
-    vl3e = &vl3tab[l3_table_offset(0)];
     for ( count = 0; count < (v_end >> PAGE_SHIFT); count++ )
     {
-        if (!(count & (1 << (L3_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT)))){
+        if ( !(count & ((1 << (L3_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT)) - 1)) 
)
+        {
             l2tab = vl3tab[count >> (L3_PAGETABLE_SHIFT - L1_PAGETABLE_SHIFT)]
-                & PAGE_MASK;
+                    & PAGE_MASK;
 
             if (vl2tab != NULL)
                 munmap(vl2tab, PAGE_SIZE);

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.