Loader: Make the load address mask be a parameter of the system rather than a constant.
authorAli Saidi <Ali.Saidi@arm.com>
Mon, 23 Aug 2010 16:18:39 +0000 (11:18 -0500)
committerAli Saidi <Ali.Saidi@arm.com>
Mon, 23 Aug 2010 16:18:39 +0000 (11:18 -0500)
This allows one two different OS requirements for the same ISA to be handled.
Some OSes are compiled for a virtual address and need to be loaded into physical
memory that starts at address 0, while other bare metal tools generate
images that start at address 0.

15 files changed:
src/arch/alpha/AlphaSystem.py
src/arch/alpha/isa_traits.hh
src/arch/alpha/system.cc
src/arch/arm/ArmSystem.py
src/arch/arm/isa_traits.hh
src/arch/mips/MipsSystem.py
src/arch/mips/isa_traits.hh
src/arch/mips/system.cc
src/arch/sparc/SparcSystem.py
src/arch/sparc/isa_traits.hh
src/arch/x86/X86System.py
src/arch/x86/isa_traits.hh
src/sim/System.py
src/sim/system.cc
src/sim/system.hh

index a19aeb76310bc32c3c77699c89a9038a4359b00d..f6d9eb4c6e484a631b24695972fb7f136494c54a 100644 (file)
@@ -35,6 +35,7 @@ class AlphaSystem(System):
     pal = Param.String("file that contains palcode")
     system_type = Param.UInt64("Type of system we are emulating")
     system_rev = Param.UInt64("Revision of system we are emulating")
+    load_addr_mask = 0xffffffffff
 
 class LinuxAlphaSystem(AlphaSystem):
     type = 'LinuxAlphaSystem'
index a5a8bf5a080f171cc737a09a459e71d27f471a3d..349332170fc8a82dd87f7fae30e5d76d734fdfec 100644 (file)
@@ -76,9 +76,6 @@ const Addr K0SegEnd = ULL(0xfffffdffffffffff);
 const Addr K1SegBase = ULL(0xfffffe0000000000);
 const Addr K1SegEnd = ULL(0xffffffffffffffff);
 
-// For loading... XXX This maybe could be USegEnd?? --ali
-const Addr LoadAddrMask = ULL(0xffffffffff);
-
 ////////////////////////////////////////////////////////////////////////
 //
 //  Interrupt levels
index 33db98b9b4dfaf0b6e758a4f5b5946dff73d170b..2c5570d46522170b28fbc7803d80b3e7a228dcd6 100644 (file)
@@ -65,8 +65,8 @@ AlphaSystem::AlphaSystem(Params *p)
 
 
     // Load program sections into memory
-    pal->loadSections(&functionalPort, LoadAddrMask);
-    console->loadSections(&functionalPort, LoadAddrMask);
+    pal->loadSections(&functionalPort, loadAddrMask);
+    console->loadSections(&functionalPort, loadAddrMask);
 
     // load symbols
     if (!console->loadGlobalSymbols(consoleSymtab))
index 872776c694d6a63d3e9788aabd49b3f32cbaad6b..a93730867b55da227909bcce16758089f3c1ebbd 100644 (file)
@@ -32,4 +32,5 @@ from System import System
 
 class ArmSystem(System):
     type = 'ArmSystem'
+    load_addr_mask = 0xffffffff
 
index d81981ff7ef1b3e6aca0e87b78118a62e3360c21..2744ec7530adf4e78378bae2b099897806cb2b78 100644 (file)
@@ -91,9 +91,6 @@ namespace ArmISA
     const Addr KSeg0Base =  ULL(0x80000000);
     const Addr KSeg0Mask = ULL(0x1FFFFFFF);
 
-    // For loading... XXX This maybe could be USegEnd?? --ali
-    const Addr LoadAddrMask = ULL(0xffffffffff);
-
     const unsigned VABits = 32;
     const unsigned PABits = 32; // Is this correct?
     const Addr VAddrImplMask = (ULL(1) << VABits) - 1;
index d271bd3872eab50cedcd155f8709da7693642e52..fc4f1efa351f2b8ac94a3ecdb8ffc82edd79f377 100644 (file)
@@ -41,6 +41,7 @@ class MipsSystem(System):
     hex_file_name = Param.String("test.hex","hex file that contains [address,data] pairs")
     system_type = Param.UInt64("Type of system we are emulating")
     system_rev = Param.UInt64("Revision of system we are emulating")
+    load_addr_mask = 0xffffffffff
 
 if buildEnv['FULL_SYSTEM']:
     class LinuxMipsSystem(MipsSystem):
index aa64be71d7bad1917b4514af5a8094e0ff2c08d9..efb1fb5944583c93ac7ef98bad4acde6aa2c8747 100644 (file)
@@ -95,9 +95,6 @@ const Addr KSeg3End = ULL(0xFFFFFFFF);
 const Addr KSeg3Base = ULL(0xE0000000);
 
 
-// For loading... XXX This maybe could be USegEnd?? --ali
-const Addr LoadAddrMask = ULL(0xffffffffff);
-
 inline Addr Phys2K0Seg(Addr addr)
 {
     return addr | KSeg0Base;
index 325d78c83b8e613b460c435696db6d721ac767d4..d11d473e35a891deae582bb505b4e1a27946be2f 100755 (executable)
@@ -70,7 +70,7 @@ MipsSystem::MipsSystem(Params *p) : System(p)
     if (console == NULL)
         fatal("Could not load console file %s", params()->console);
     //Load program sections into memory
-    console->loadSections(&functionalPort, MipsISA::LoadAddrMask);
+    console->loadSections(&functionalPort, loadAddrMask);
 
     //load symbols
     if (!console->loadGlobalSymbols(consoleSymtab))
index 2e65f640de01b89823ef2cabc32ec8d38210a3a0..92845235adcaa0a6f5ccc7b5a725ecb350078f58 100644 (file)
@@ -71,4 +71,4 @@ class SparcSystem(System):
     nvram_bin = Param.String("file that contains the contents of nvram")
     hypervisor_desc_bin = Param.String("file that contains the hypervisor description")
     partition_desc_bin = Param.String("file that contains the partition description")
-
+    load_addr_mask = 0xffffffffff
index a4dc7322d39ff1f1de7760158d021d55b7ce300a..0a568ddbec1a8b7878eabc7f97fefa8ba923638b 100644 (file)
@@ -80,11 +80,6 @@ namespace SparcISA
     const Addr BytesInPageMask = ULL(0x1FFF);
 
 #if FULL_SYSTEM
-    // I don't know what it's for, so I don't
-    // know what SPARC's value should be
-    // For loading... XXX This maybe could be USegEnd?? --ali
-    const Addr LoadAddrMask = ULL(0xffffffffff);
-
     enum InterruptTypes
     {
         IT_TRAP_LEVEL_ZERO,
index 89a64504c8a5aafbb6a44c1dc6af23ffe3a8fee4..8b294fb861745d01d1efc8f4634e62f6b1cee8b0 100644 (file)
@@ -54,6 +54,7 @@ class X86System(System):
             'intel mp spec configuration table')
     acpi_description_table_pointer = Param.X86ACPIRSDP(
             X86ACPIRSDP(), 'ACPI root description pointer structure')
+    load_addr_mask = 0xffffffffffffffff
 
 class LinuxX86System(X86System):
     type = 'LinuxX86System'
index 423313b2a4c2699233585329769570f61522d015..c1036ac0143f2c57e268375e0abe248a26df74ae 100644 (file)
@@ -72,8 +72,6 @@ namespace X86ISA
 
     StaticInstPtr decodeInst(ExtMachInst);
 
-    const Addr LoadAddrMask = ULL(-1);
-
     // Memory accesses can be unaligned
     const bool HasUnalignedMemAcc = true;
 };
index 06a54a78db2b977533c31165882ffbfa3dc97bfe..5cf46ad75526d9f706370a3648f123111bcc24d7 100644 (file)
@@ -50,3 +50,5 @@ class System(SimObject):
         kernel = Param.String("", "file that contains the kernel code")
         readfile = Param.String("", "file to read startup script from")
         symbolfile = Param.String("", "file to get the symbols from")
+        load_addr_mask = Param.UInt64(0xffffffffff,
+                "Address to mask loading binaries with");
index c7f5b2d08f20d4ba7ec24a5d3a0ecbf6bbe484c3..45e06616da83929bfd217a348e6658dfbe2179af 100644 (file)
@@ -66,6 +66,7 @@ System::System(Params *p)
       init_param(p->init_param),
       functionalPort(p->name + "-fport"),
       virtPort(p->name + "-vport"),
+      loadAddrMask(p->load_addr_mask),
 #else
       page_ptr(0),
       next_PID(0),
@@ -109,7 +110,7 @@ System::System(Params *p)
             fatal("Could not load kernel file %s", params()->kernel);
 
         // Load program sections into memory
-        kernel->loadSections(&functionalPort, LoadAddrMask);
+        kernel->loadSections(&functionalPort, loadAddrMask);
 
         // setup entry points
         kernelStart = kernel->textBase();
index eabbc835108e14b3b7a48941c7b79467bcf8e604..cc92bba09c96848c8ed8773ccf7d1dfa7675c6b2 100644 (file)
@@ -126,6 +126,14 @@ class System : public SimObject
     /** Entry point in the kernel to start at */
     Addr kernelEntry;
 
+    /** Mask that should be anded for binary/symbol loading.
+     * This allows one two different OS requirements for the same ISA to be
+     * handled.  Some OSes are compiled for a virtual address and need to be
+     * loaded into physical memory that starts at address 0, while other
+     * bare metal tools generate images that start at address 0.
+     */
+    Addr loadAddrMask;
+
 #else
 
     int page_ptr;