changeset 6f77f379a594 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=6f77f379a594
description:
        Loader: Make the load address mask be a parameter of the system rather 
than a constant.

        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.

diffstat:

 src/arch/alpha/AlphaSystem.py |  1 +
 src/arch/alpha/isa_traits.hh  |  3 ---
 src/arch/alpha/system.cc      |  4 ++--
 src/arch/arm/ArmSystem.py     |  1 +
 src/arch/arm/isa_traits.hh    |  3 ---
 src/arch/mips/MipsSystem.py   |  1 +
 src/arch/mips/isa_traits.hh   |  3 ---
 src/arch/mips/system.cc       |  2 +-
 src/arch/sparc/SparcSystem.py |  2 +-
 src/arch/sparc/isa_traits.hh  |  5 -----
 src/arch/x86/X86System.py     |  1 +
 src/arch/x86/isa_traits.hh    |  2 --
 src/sim/System.py             |  2 ++
 src/sim/system.cc             |  3 ++-
 src/sim/system.hh             |  8 ++++++++
 15 files changed, 20 insertions(+), 21 deletions(-)

diffs (190 lines):

diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/alpha/AlphaSystem.py
--- a/src/arch/alpha/AlphaSystem.py     Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/alpha/AlphaSystem.py     Mon Aug 23 11:18:39 2010 -0500
@@ -35,6 +35,7 @@
     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'
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/alpha/isa_traits.hh
--- a/src/arch/alpha/isa_traits.hh      Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/alpha/isa_traits.hh      Mon Aug 23 11:18:39 2010 -0500
@@ -76,9 +76,6 @@
 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
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/alpha/system.cc
--- a/src/arch/alpha/system.cc  Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/alpha/system.cc  Mon Aug 23 11:18:39 2010 -0500
@@ -65,8 +65,8 @@
 
 
     // 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))
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/arm/ArmSystem.py
--- a/src/arch/arm/ArmSystem.py Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/arm/ArmSystem.py Mon Aug 23 11:18:39 2010 -0500
@@ -32,4 +32,5 @@
 
 class ArmSystem(System):
     type = 'ArmSystem'
+    load_addr_mask = 0xffffffff
 
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/arm/isa_traits.hh
--- a/src/arch/arm/isa_traits.hh        Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/arm/isa_traits.hh        Mon Aug 23 11:18:39 2010 -0500
@@ -91,9 +91,6 @@
     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;
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/mips/MipsSystem.py
--- a/src/arch/mips/MipsSystem.py       Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/mips/MipsSystem.py       Mon Aug 23 11:18:39 2010 -0500
@@ -41,6 +41,7 @@
     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):
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/mips/isa_traits.hh
--- a/src/arch/mips/isa_traits.hh       Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/mips/isa_traits.hh       Mon Aug 23 11:18:39 2010 -0500
@@ -95,9 +95,6 @@
 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;
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/mips/system.cc
--- a/src/arch/mips/system.cc   Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/mips/system.cc   Mon Aug 23 11:18:39 2010 -0500
@@ -70,7 +70,7 @@
     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))
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/sparc/SparcSystem.py
--- a/src/arch/sparc/SparcSystem.py     Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/sparc/SparcSystem.py     Mon Aug 23 11:18:39 2010 -0500
@@ -71,4 +71,4 @@
     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
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/sparc/isa_traits.hh
--- a/src/arch/sparc/isa_traits.hh      Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/sparc/isa_traits.hh      Mon Aug 23 11:18:39 2010 -0500
@@ -80,11 +80,6 @@
     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,
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/x86/X86System.py
--- a/src/arch/x86/X86System.py Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/x86/X86System.py Mon Aug 23 11:18:39 2010 -0500
@@ -54,6 +54,7 @@
             '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'
diff -r 06fe5d901fe8 -r 6f77f379a594 src/arch/x86/isa_traits.hh
--- a/src/arch/x86/isa_traits.hh        Mon Aug 23 11:18:39 2010 -0500
+++ b/src/arch/x86/isa_traits.hh        Mon Aug 23 11:18:39 2010 -0500
@@ -72,8 +72,6 @@
 
     StaticInstPtr decodeInst(ExtMachInst);
 
-    const Addr LoadAddrMask = ULL(-1);
-
     // Memory accesses can be unaligned
     const bool HasUnalignedMemAcc = true;
 };
diff -r 06fe5d901fe8 -r 6f77f379a594 src/sim/System.py
--- a/src/sim/System.py Mon Aug 23 11:18:39 2010 -0500
+++ b/src/sim/System.py Mon Aug 23 11:18:39 2010 -0500
@@ -50,3 +50,5 @@
         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");
diff -r 06fe5d901fe8 -r 6f77f379a594 src/sim/system.cc
--- a/src/sim/system.cc Mon Aug 23 11:18:39 2010 -0500
+++ b/src/sim/system.cc Mon Aug 23 11:18:39 2010 -0500
@@ -66,6 +66,7 @@
       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 @@
             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();
diff -r 06fe5d901fe8 -r 6f77f379a594 src/sim/system.hh
--- a/src/sim/system.hh Mon Aug 23 11:18:39 2010 -0500
+++ b/src/sim/system.hh Mon Aug 23 11:18:39 2010 -0500
@@ -126,6 +126,14 @@
     /** 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;
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to