summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-03-30 18:06:00 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-03-30 18:06:00 -0500
commit5936c79ba0f3fd29ef2bbf41fcaddc78fcd9c75c (patch)
tree0497503600b01e23dd60a2802509d6bb48a27e99 /base
parente196d20d9d047a869e1d853fd02077b1d909a576 (diff)
downloadgem5-5936c79ba0f3fd29ef2bbf41fcaddc78fcd9c75c.tar.xz
Add a functional port that is used to load the original binaries in FS
SE mode now has a port that goes to whatever toplevel mem object the CPU sees that does the appropriate translation for syscall emulation SConscript: translating port is a syscall emu only source arch/alpha/system.cc: base/loader/object_file.cc: base/loader/object_file.hh: Use the new functional port to write the binaries into memory cpu/cpu_exec_context.cc: cpu/cpu_exec_context.hh: cpu/simple/cpu.cc: We aren't always going to be writing straight to memory with syscalls support writing to a cache mem/port.hh: Add a simple unidirectional functional port that panics on any incoming requests mem/translating_port.hh: make translating port inherit from the simple port sim/system.cc: sim/system.hh: Add a functional port that is used to load the original binaries --HG-- extra : convert_revision : 9096866d0b23e3aceea68394abb76e63c0f8fd8d
Diffstat (limited to 'base')
-rw-r--r--base/loader/object_file.cc18
-rw-r--r--base/loader/object_file.hh6
2 files changed, 10 insertions, 14 deletions
diff --git a/base/loader/object_file.cc b/base/loader/object_file.cc
index 00c094166..c6dfced1d 100644
--- a/base/loader/object_file.cc
+++ b/base/loader/object_file.cc
@@ -63,16 +63,10 @@ ObjectFile::~ObjectFile()
bool
-ObjectFile::loadSection(Section *sec, Port *memPort, bool loadPhys)
+ObjectFile::loadSection(Section *sec, Port *memPort, Addr addrMask)
{
if (sec->size != 0) {
- Addr addr = sec->baseAddr;
- if (loadPhys) {
- // this is Alpha-specific... going to have to fix this
- // for other architectures
- addr &= (ULL(1) << 40) - 1;
- }
-
+ Addr addr = sec->baseAddr & addrMask;
if (sec->fileImage) {
memPort->writeBlob(addr, sec->fileImage, sec->size);
}
@@ -86,11 +80,11 @@ ObjectFile::loadSection(Section *sec, Port *memPort, bool loadPhys)
bool
-ObjectFile::loadSections(Port *memPort, bool loadPhys)
+ObjectFile::loadSections(Port *memPort, Addr addrMask)
{
- return (loadSection(&text, memPort, loadPhys)
- && loadSection(&data, memPort, loadPhys)
- && loadSection(&bss, memPort, loadPhys));
+ return (loadSection(&text, memPort, addrMask)
+ && loadSection(&data, memPort, addrMask)
+ && loadSection(&bss, memPort, addrMask));
}
diff --git a/base/loader/object_file.hh b/base/loader/object_file.hh
index b47e1981b..b43989cb5 100644
--- a/base/loader/object_file.hh
+++ b/base/loader/object_file.hh
@@ -29,6 +29,7 @@
#ifndef __OBJECT_FILE_HH__
#define __OBJECT_FILE_HH__
+#include <limits>
#include <string>
#include "sim/host.hh" // for Addr
@@ -72,7 +73,8 @@ class ObjectFile
void close();
- virtual bool loadSections(Port *memPort, bool loadPhys = false);
+ virtual bool loadSections(Port *memPort, Addr addrMask =
+ std::numeric_limits<Addr>::max());
virtual bool loadGlobalSymbols(SymbolTable *symtab) = 0;
virtual bool loadLocalSymbols(SymbolTable *symtab) = 0;
@@ -94,7 +96,7 @@ class ObjectFile
Section data;
Section bss;
- bool loadSection(Section *sec, Port *memPort, bool loadPhys);
+ bool loadSection(Section *sec, Port *memPort, Addr addrMask);
void setGlobalPointer(Addr global_ptr) { globalPtr = global_ptr; }
public: