[HVM] Sync the base memory reported by ROMBIOS with the e820 map.
authorTim Deegan <Tim.Deegan@xensource.com>
Fri, 5 Jan 2007 16:28:42 +0000 (16:28 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Fri, 5 Jan 2007 16:28:42 +0000 (16:28 +0000)
This stops Etherboot relocating itself onto the SMBIOS tables.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
tools/firmware/rombios/rombios.c

index 7a14b46ac4666b52a7a2aeed8a3b4123407a5f0f..edbc0cc5287a162f0693161c25aa426825f656d7 100644 (file)
@@ -1435,10 +1435,17 @@ void
 copy_e820_table()
 {
   Bit8u nr_entries = read_byte(0x9000, 0x1e8);
+  Bit32u base_mem;
   if (nr_entries > 32)
        nr_entries = 32;
   write_word(0xe000, 0x8, nr_entries);
   memcpyb(0xe000, 0x10, 0x9000, 0x2d0, nr_entries * 0x14);
+  /* Report the proper base memory size at address 0x0413: otherwise
+   * non-e820 code will clobber things if BASE_MEM_IN_K is bigger than
+   * the first e820 entry.  Get the size by reading the second 64bit 
+   * field of the first e820 slot. */ 
+  base_mem = read_dword(0x9000, 0x2d0 + 8);
+  write_word(0x40, 0x13, base_mem >> 10);
 }
 #endif /* HVMASSIST */