Make loaders use translation port instead of proxy memory.
Also start compiling Simple CPU again. SConscript: Start Compiling Simple CPU as well base/loader/aout_object.cc: base/loader/aout_object.hh: base/loader/ecoff_object.cc: base/loader/ecoff_object.hh: base/loader/elf_object.cc: base/loader/elf_object.hh: base/loader/object_file.hh: sim/process.cc: sim/process.hh: Convert loaders to used translation port instead of proxy memory --HG-- extra : convert_revision : 63275071f6a0e0d71935641205b203d94381ee44
This commit is contained in:
parent
d96de69abc
commit
3391354285
10 changed files with 28 additions and 28 deletions
|
@ -335,7 +335,7 @@ for f in targetarch_files:
|
|||
|
||||
|
||||
# Set up complete list of sources based on configuration.
|
||||
sources = base_sources
|
||||
sources = base_sources + simple_cpu_sources
|
||||
|
||||
if env['FULL_SYSTEM']:
|
||||
sources += full_system_sources
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "base/loader/aout_object.hh"
|
||||
|
||||
#include "mem/memory.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "base/loader/symtab.hh"
|
||||
|
||||
#include "base/trace.hh" // for DPRINTF
|
||||
|
@ -78,7 +78,7 @@ AoutObject::AoutObject(const string &_filename, int _fd,
|
|||
|
||||
|
||||
bool
|
||||
AoutObject::loadSections(Memory *mem, bool loadPhys)
|
||||
AoutObject::loadSections(TranslatingPort *memPort, bool loadPhys)
|
||||
{
|
||||
Addr textAddr = text.baseAddr;
|
||||
Addr dataAddr = data.baseAddr;
|
||||
|
@ -91,9 +91,9 @@ AoutObject::loadSections(Memory *mem, bool loadPhys)
|
|||
// Since we don't really have an MMU and all memory is
|
||||
// zero-filled, there's no need to set up the BSS segment.
|
||||
if (text.size != 0)
|
||||
mem->prot_write(textAddr, fileData + N_TXTOFF(*execHdr), text.size);
|
||||
memPort->writeBlobFunctional(textAddr, fileData + N_TXTOFF(*execHdr), text.size);
|
||||
if (data.size != 0)
|
||||
mem->prot_write(dataAddr, fileData + N_DATOFF(*execHdr), data.size);
|
||||
memPort->writeBlobFunctional(dataAddr, fileData + N_DATOFF(*execHdr), data.size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class AoutObject : public ObjectFile
|
|||
public:
|
||||
virtual ~AoutObject() {}
|
||||
|
||||
virtual bool loadSections(Memory *mem, bool loadPhys = false);
|
||||
virtual bool loadSections(TranslatingPort *memPort, bool loadPhys = false);
|
||||
virtual bool loadGlobalSymbols(SymbolTable *symtab);
|
||||
virtual bool loadLocalSymbols(SymbolTable *symtab);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "base/loader/ecoff_object.hh"
|
||||
|
||||
#include "mem/memory.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "base/loader/symtab.hh"
|
||||
|
||||
#include "base/trace.hh" // for DPRINTF
|
||||
|
@ -82,7 +82,7 @@ EcoffObject::EcoffObject(const string &_filename, int _fd,
|
|||
|
||||
|
||||
bool
|
||||
EcoffObject::loadSections(Memory *mem, bool loadPhys)
|
||||
EcoffObject::loadSections(TranslatingPort *memPort, bool loadPhys)
|
||||
{
|
||||
Addr textAddr = text.baseAddr;
|
||||
Addr dataAddr = data.baseAddr;
|
||||
|
@ -94,8 +94,8 @@ EcoffObject::loadSections(Memory *mem, bool loadPhys)
|
|||
|
||||
// Since we don't really have an MMU and all memory is
|
||||
// zero-filled, there's no need to set up the BSS segment.
|
||||
mem->prot_write(textAddr, fileData + ECOFF_TXTOFF(execHdr), text.size);
|
||||
mem->prot_write(dataAddr, fileData + ECOFF_DATOFF(execHdr), data.size);
|
||||
memPort->writeBlobFunctional(textAddr, fileData + ECOFF_TXTOFF(execHdr), text.size);
|
||||
memPort->writeBlobFunctional(dataAddr, fileData + ECOFF_DATOFF(execHdr), data.size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class EcoffObject : public ObjectFile
|
|||
public:
|
||||
virtual ~EcoffObject() {}
|
||||
|
||||
virtual bool loadSections(Memory *mem, bool loadPhys = false);
|
||||
virtual bool loadSections(TranslatingPort *memPort, bool loadPhys = false);
|
||||
virtual bool loadGlobalSymbols(SymbolTable *symtab);
|
||||
virtual bool loadLocalSymbols(SymbolTable *symtab);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#include "base/loader/elf_object.hh"
|
||||
|
||||
#include "mem/memory.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "base/loader/symtab.hh"
|
||||
|
||||
#include "base/trace.hh" // for DPRINTF
|
||||
|
@ -170,7 +170,7 @@ ElfObject::ElfObject(const string &_filename, int _fd,
|
|||
|
||||
|
||||
bool
|
||||
ElfObject::loadSections(Memory *mem, bool loadPhys)
|
||||
ElfObject::loadSections(TranslatingPort *memPort, bool loadPhys)
|
||||
{
|
||||
Addr textAddr = text.baseAddr;
|
||||
Addr dataAddr = data.baseAddr;
|
||||
|
@ -183,9 +183,9 @@ ElfObject::loadSections(Memory *mem, bool loadPhys)
|
|||
// Since we don't really have an MMU and all memory is
|
||||
// zero-filled, there's no need to set up the BSS segment.
|
||||
if (text.size != 0)
|
||||
mem->prot_write(textAddr, fileTextBits, text.size);
|
||||
memPort->writeBlobFunctional(textAddr, fileTextBits, text.size);
|
||||
if (data.size != 0)
|
||||
mem->prot_write(dataAddr, fileDataBits, data.size);
|
||||
memPort->writeBlobFunctional(dataAddr, fileDataBits, data.size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class ElfObject : public ObjectFile
|
|||
public:
|
||||
virtual ~ElfObject() {}
|
||||
|
||||
virtual bool loadSections(Memory *mem, bool loadPhys = false);
|
||||
virtual bool loadSections(TranslatingPort *memPort, bool loadPhys = false);
|
||||
virtual bool loadGlobalSymbols(SymbolTable *symtab);
|
||||
virtual bool loadLocalSymbols(SymbolTable *symtab);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "targetarch/isa_traits.hh" // for Addr
|
||||
|
||||
class Memory;
|
||||
class TranslatingPort;
|
||||
class SymbolTable;
|
||||
|
||||
class ObjectFile
|
||||
|
@ -67,7 +67,7 @@ class ObjectFile
|
|||
|
||||
void close();
|
||||
|
||||
virtual bool loadSections(Memory *mem, bool loadPhys = false) = 0;
|
||||
virtual bool loadSections(TranslatingPort *memPort, bool loadPhys = false) = 0;
|
||||
virtual bool loadGlobalSymbols(SymbolTable *symtab) = 0;
|
||||
virtual bool loadLocalSymbols(SymbolTable *symtab) = 0;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "encumbered/eio/eio.hh"
|
||||
#include "mem/page_table.hh"
|
||||
#include "mem/memory.hh"
|
||||
#include "mem/proxy.hh"
|
||||
#include "mem/translating_port.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/fake_syscall.hh"
|
||||
#include "sim/process.hh"
|
||||
|
@ -154,7 +154,7 @@ Process::startup()
|
|||
if (execContexts.empty())
|
||||
fatal("Process %s is not associated with any CPUs!\n", name());
|
||||
|
||||
initVirtMem = new ProxyMemory(system->physmem, pTable);
|
||||
initVirtMem = new TranslatingPort(system->physmem->getPort("any"), pTable);
|
||||
|
||||
// first exec context for this process... initialize & enable
|
||||
ExecContext *xc = execContexts[0];
|
||||
|
@ -245,18 +245,18 @@ DEFINE_SIM_OBJECT_CLASS_NAME("Process", Process)
|
|||
|
||||
static void
|
||||
copyStringArray(vector<string> &strings, Addr array_ptr, Addr data_ptr,
|
||||
Memory *func)
|
||||
TranslatingPort* memPort)
|
||||
{
|
||||
for (int i = 0; i < strings.size(); ++i) {
|
||||
func->prot_write(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
|
||||
func->writeStringFunctional(data_ptr, strings[i].c_str());
|
||||
memPort->writeBlobFunctional(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
|
||||
memPort->writeStringFunctional(data_ptr, strings[i].c_str());
|
||||
array_ptr += sizeof(Addr);
|
||||
data_ptr += strings[i].size() + 1;
|
||||
}
|
||||
// add NULL terminator
|
||||
data_ptr = 0;
|
||||
|
||||
func->prot_write(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
|
||||
memPort->writeBlobFunctional(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr));
|
||||
}
|
||||
|
||||
LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile,
|
||||
|
@ -273,7 +273,7 @@ LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile,
|
|||
text_size = objFile->textSize();
|
||||
data_base = objFile->dataBase();
|
||||
data_size = objFile->dataSize() + objFile->bssSize();
|
||||
brk_point = = roundUp(data_base + data_size, VMPageSize);
|
||||
brk_point = roundUp(data_base + data_size, VMPageSize);
|
||||
|
||||
// Set up stack. On Alpha, stack goes below text section. This
|
||||
// code should get moved to some architecture-specific spot.
|
||||
|
@ -341,7 +341,7 @@ LiveProcess::startup()
|
|||
|
||||
// write contents to stack
|
||||
uint64_t argc = argv.size();
|
||||
initVirtMem->prot_write(stack_min, (uint8_t*)&argc, sizeof(uint64_t));
|
||||
initVirtMem->writeBlobFunctional(stack_min, (uint8_t*)&argc, sizeof(uint64_t));
|
||||
|
||||
copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
|
||||
copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#include "targetarch/isa_traits.hh"
|
||||
|
||||
class ExecContext;
|
||||
class Memory;
|
||||
class TranslatingPort;
|
||||
class System;
|
||||
|
||||
class Process : public SimObject
|
||||
|
@ -128,7 +128,7 @@ class Process : public SimObject
|
|||
|
||||
protected:
|
||||
/// Memory object for initialization (image loading)
|
||||
Memory *initVirtMem;
|
||||
TranslatingPort *initVirtMem;
|
||||
|
||||
public:
|
||||
PageTable *pTable;
|
||||
|
|
Loading…
Reference in a new issue