]> xenbits.xensource.com Git - qemu-xen-3.3-testing.git/commitdiff
xend does not pass us -m option, so direct HVM Linux loading
authorKeir Fraser <kfraser@endor.localdomain>
Tue, 5 Aug 2008 12:24:47 +0000 (13:24 +0100)
committerKeir Fraser <kfraser@endor.localdomain>
Tue, 5 Aug 2008 12:24:47 +0000 (13:24 +0100)
approximates end of low memory via a different method.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
hw/pc.c

diff --git a/hw/pc.c b/hw/pc.c
index f6a5d46b59cff0438a5dc5f02a62f02580357a37..c13e45375747c2591ca2eeaa8ddf935c12259107 100644 (file)
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -45,9 +45,6 @@
 
 #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
 
-/* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
-#define ACPI_DATA_SIZE       0x10000
-
 #define MAX_IDE_BUS 2
 
 static fdctrl_t *floppy_controller;
@@ -536,6 +533,7 @@ static void load_linux(const char *kernel_filename,
     uint16_t seg[6];
     uint16_t real_seg;
     int setup_size, kernel_size, initrd_size, cmdline_size;
+    unsigned long end_low_ram;
     uint32_t initrd_max;
     uint8_t header[1024];
     target_phys_addr_t real_addr, prot_addr, cmdline_addr, initrd_addr;
@@ -589,14 +587,14 @@ static void load_linux(const char *kernel_filename,
            (size_t)prot_addr);
 #endif
 
-    /* highest address for loading the initrd */
-    if (protocol >= 0x203)
-       initrd_max = ldl_p(header+0x22c);
-    else
-       initrd_max = 0x37ffffff;
+    /* Special pages are placed at end of low RAM: pick an arbitrary one and
+     * subtract a suitably large amount of padding (64kB) to skip BIOS data. */
+    xc_get_hvm_param(xc_handle, domid, HVM_PARAM_BUFIOREQ_PFN, &end_low_ram);
+    end_low_ram = (end_low_ram << 12) - (64*1024);
 
-    if (initrd_max >= ram_size-ACPI_DATA_SIZE)
-       initrd_max = ram_size-ACPI_DATA_SIZE-1;
+    /* highest address for loading the initrd */
+    initrd_max = (protocol >= 0x203) ? ldl_p(header+0x22c) : 0x37ffffff;
+    initrd_max = MIN(initrd_max, (uint32_t)end_low_ram);
 
     /* kernel command line */
     pstrcpy_targphys(cmdline_addr, 4096, kernel_cmdline);