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] [xen-unstable] rombios: move the stack to 0x9e000 and pr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] rombios: move the stack to 0x9e000 and protect it with an e820 entry
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 08 Jul 2010 02:10:51 -0700
Delivery-date: Thu, 08 Jul 2010 02:16:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278579100 -3600
# Node ID 3e1272f3aa71fb6110b0e2940ce50f2299ab75ba
# Parent  3073d3d61a6b688caed5aca41b2346180a4271ce
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>
---
 tools/firmware/hvmloader/hvmloader.c |   57 +++++++++++++++++++++++++++++++++--
 tools/firmware/rombios/rombios.c     |   16 ++++-----
 2 files changed, 62 insertions(+), 11 deletions(-)

diff -r 3073d3d61a6b -r 3e1272f3aa71 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Thu Jul 08 09:46:09 2010 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Thu Jul 08 09:51:40 2010 +0100
@@ -576,16 +576,66 @@ static void init_vm86_tss(void)
     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-0x9E000: 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 +789,7 @@ int main(void)
                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 3073d3d61a6b -r 3e1272f3aa71 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Thu Jul 08 09:46:09 2010 +0100
+++ b/tools/firmware/rombios/rombios.c  Thu Jul 08 09:51:40 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.
 //
@@ -8862,13 +8862,14 @@ int18_handler: ;; Boot Failure recovery:
 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
@@ -8902,9 +8903,9 @@ int19_relocated: ;; Boot function, reloc
   ;; 
   ;; 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
@@ -10839,10 +10840,9 @@ normal_post:
   ; 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] rombios: move the stack to 0x9e000 and protect it with an e820 entry, Xen patchbot-unstable <=