summaryrefslogtreecommitdiff
path: root/src/arch/x86/linux/system.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2008-06-12 00:58:36 -0400
committerGabe Black <gblack@eecs.umich.edu>2008-06-12 00:58:36 -0400
commitbceaa257a38d62c91317cecc78f4dba46654eb93 (patch)
tree2db79f7f87f798e4d28553c72e8dd9d1185f3026 /src/arch/x86/linux/system.cc
parent4f4ff17578846018e06b0b9b047df96a8346efd9 (diff)
downloadgem5-bceaa257a38d62c91317cecc78f4dba46654eb93.tar.xz
X86: Make the e820 table manually or automatically configurable from python.
Diffstat (limited to 'src/arch/x86/linux/system.cc')
-rw-r--r--src/arch/x86/linux/system.cc61
1 files changed, 3 insertions, 58 deletions
diff --git a/src/arch/x86/linux/system.cc b/src/arch/x86/linux/system.cc
index 944bb2930..c2d9cb35c 100644
--- a/src/arch/x86/linux/system.cc
+++ b/src/arch/x86/linux/system.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 The Hewlett-Packard Development Company
+ * Copyright (c) 2007-2008 The Hewlett-Packard Development Company
* All rights reserved.
*
* Redistribution and use of this software in source and binary forms,
@@ -68,7 +68,7 @@ using namespace LittleEndianGuest;
using namespace X86ISA;
LinuxX86System::LinuxX86System(Params *p)
- : X86System(p), commandLine(p->boot_osflags)
+ : X86System(p), commandLine(p->boot_osflags), e820Table(p->e820_table)
{
}
@@ -144,62 +144,7 @@ LinuxX86System::startup()
// A pointer to the buffer for E820 entries.
const Addr e820MapPointer = realModeData + 0x2d0;
- struct e820Entry
- {
- Addr addr;
- Addr size;
- uint32_t type;
- };
-
- // The size is computed this way to ensure no padding sneaks in.
- int e820EntrySize =
- sizeof(e820Entry().addr) +
- sizeof(e820Entry().size) +
- sizeof(e820Entry().type);
-
- // I'm not sure what these should actually be. On a real machine they
- // would be generated by the BIOS, and they need to reflect the regions
- // which are actually available/reserved. These values are copied from
- // my development machine.
- e820Entry e820Map[] = {
- {ULL(0x0), ULL(0x9d400), 1},
- {ULL(0x9d400), ULL(0xa0000) - ULL(0x9d400), 2},
- {ULL(0xe8000), ULL(0x100000) - ULL(0xe8000), 2},
- {ULL(0x100000), ULL(0xcfff9300) - ULL(0x100000), 1},
- {ULL(0xcfff9300), ULL(0xd0000000) - ULL(0xcfff9300), 2},
- {ULL(0xfec00000), ULL(0x100000000) - ULL(0xfec00000), 2}
- };
-
- uint8_t e820Nr = sizeof(e820Map) / sizeof(e820Entry);
-
- // Make sure the number of entries isn't bigger than what the kernel
- // would be capable of providing.
- assert(e820Nr <= 128);
-
- uint8_t guestE820Nr = X86ISA::htog(e820Nr);
- physPort->writeBlob(e820MapNrPointer,
- (uint8_t *)&guestE820Nr, sizeof(guestE820Nr));
-
- for (int i = 0; i < e820Nr; i++) {
- e820Entry guestE820Entry;
- guestE820Entry.addr = X86ISA::htog(e820Map[i].addr);
- guestE820Entry.size = X86ISA::htog(e820Map[i].size);
- guestE820Entry.type = X86ISA::htog(e820Map[i].type);
- physPort->writeBlob(e820MapPointer + e820EntrySize * i,
- (uint8_t *)&guestE820Entry.addr,
- sizeof(guestE820Entry.addr));
- physPort->writeBlob(
- e820MapPointer + e820EntrySize * i +
- sizeof(guestE820Entry.addr),
- (uint8_t *)&guestE820Entry.size,
- sizeof(guestE820Entry.size));
- physPort->writeBlob(
- e820MapPointer + e820EntrySize * i +
- sizeof(guestE820Entry.addr) +
- sizeof(guestE820Entry.size),
- (uint8_t *)&guestE820Entry.type,
- sizeof(guestE820Entry.type));
- }
+ e820Table->writeTo(physPort, e820MapNrPointer, e820MapPointer);
/*
* Pass the location of the real mode data structure to the kernel