rombios: move the stack to 0x9e000 and protect it with an e820 entry
so that we don't corrupt E820_RAM memory with stack ops in S3 wakeup.
It has to move up so the lowest contiguous RAM area is >= 512MiB.
This relies on the previous fix to let DS != SS
Signed-off-by: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
diff -r 4160103f98e3 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c Tue Jul 06 16:27:22 2010 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c Tue Jul 06 16:28:09 2010 +0100
@@ -576,16 +576,64 @@
printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
}
+static void dump_e820_table(void)
+{
+ struct e820entry *e820 = E820;
+ unsigned int nr = *E820_NR;
+ unsigned int last_end = 0;
+ int i;
+
+ printf("E820 table:\n");
+
+ for (i = 0; i < nr; i++) {
+ unsigned int start = e820[i].addr;
+ unsigned int end = e820[i].addr + e820[i].size;
+
+ if (start < last_end)
+ printf(" OVERLAP!!\n");
+ else if (start > last_end)
+ printf(" HOLE: %08x - %08x\n", last_end, start);
+
+ printf(" [%02d]: %08x - %08x: ", i, start, end);
+ switch (e820[i].type) {
+ case E820_RAM:
+ printf("RAM\n");
+ break;
+ case E820_RESERVED:
+ printf("RESERVED\n");
+ break;
+ case E820_ACPI:
+ printf("ACPI\n");
+ break;
+ case E820_NVS:
+ printf("NVS\n");
+ break;
+ default:
+ printf("UNKNOWN (%08x)\n", e820[i].type);
+ break;
+ }
+
+ last_end = end;
+ }
+}
+
/* Create an E820 table based on memory parameters provided in hvm_info. */
static void build_e820_table(void)
{
struct e820entry *e820 = E820;
unsigned int nr = 0;
- /* 0x0-0x9FC00: Ordinary RAM. */
- e820[nr].addr = 0x0;
- e820[nr].size = 0x9FC00;
+ /* 0x0-0x9EC00: Ordinary RAM. */
+ /* (Must be at least 512K to keep Windows happy) */
+ e820[nr].addr = 0x00000;
+ e820[nr].size = 0x9E000;
e820[nr].type = E820_RAM;
+ nr++;
+
+ /* 0x9E000-0x9FC00: Reserved for internal use. */
+ e820[nr].addr = 0x9E000;
+ e820[nr].size = 0x01C00;
+ e820[nr].type = E820_RESERVED;
nr++;
/* 0x9FC00-0xA0000: Extended BIOS Data Area (EBDA). */
@@ -739,6 +787,7 @@
ROMBIOS_PHYSICAL_ADDRESS + rombios_sz - 1);
build_e820_table();
+ dump_e820_table();
bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
memset(bios_info, 0, sizeof(*bios_info));
diff -r 4160103f98e3 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c Tue Jul 06 16:27:22 2010 +0100
+++ b/tools/firmware/rombios/rombios.c Tue Jul 06 16:28:09 2010 +0100
@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rombios.c,v 1.221 2008/12/07 17:32:29 sshwarts Exp $
-/////////////////////////////////////////////////////////////////////////
+////////////////////////////#/////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
//
@@ -8871,13 +8871,14 @@
int18_handler: ;; Boot Failure recovery: try the next device.
;; Reset SP and SS
- mov ax, #0xfffe
+ mov ax, #0x0ffe
mov sp, ax
- xor ax, ax
+ mov ax, #0x9e00
mov ss, ax
;; The first time we do this it will have been set to -1 so
;; we will start from device 0.
+ xor ax, ax
mov ds, ax
mov bx, word ptr [0x40E] ;; EBDA segment
mov ds, bx ;; Set segment
@@ -8911,9 +8912,9 @@
;;
;; Reset SP and SS
- mov ax, #0xfffe
+ mov ax, #0x0ffe
mov sp, ax
- xor ax, ax
+ mov ax, #0x9e00
mov ss, ax
call _machine_reset
@@ -10848,10 +10849,9 @@
; case 0: normal startup
cli
- mov ax, #0xfffe
+ mov ax, #0x0ffe
mov sp, ax
- xor ax, ax
- mov ds, ax
+ mov ax, #0x9e00
mov ss, ax
;; Save shutdown status
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|