diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/loader/elf_object.cc | 5 | ||||
-rw-r--r-- | base/loader/object_file.cc | 22 | ||||
-rw-r--r-- | base/loader/object_file.hh | 8 | ||||
-rw-r--r-- | base/remote_gdb.cc | 72 | ||||
-rw-r--r-- | base/timebuf.hh | 4 | ||||
-rw-r--r-- | base/traceflags.py | 1 |
6 files changed, 23 insertions, 89 deletions
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index 58029bc3e..a104719af 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -77,11 +77,6 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data) return NULL; } else { //Detect the architecture - //Versioning issues in libelf need to be resolved to get the correct - //SPARC constants. - //If MIPS supports 32 bit executables, this may need to be changed. - //Also, there are other MIPS constants which may be used, like - //EM_MIPS_RS3_LE and EM_MIPS_X //Since we don't know how to check for alpha right now, we'll //just assume if it wasn't something else and it's 64 bit, that's //what it must be. diff --git a/base/loader/object_file.cc b/base/loader/object_file.cc index 7f46ae2fb..c6dfced1d 100644 --- a/base/loader/object_file.cc +++ b/base/loader/object_file.cc @@ -63,22 +63,16 @@ ObjectFile::~ObjectFile() bool -ObjectFile::loadSection(Section *sec, TranslatingPort *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, true); + memPort->writeBlob(addr, sec->fileImage, sec->size); } else { // no image: must be bss - memPort->memsetBlob(addr, 0, sec->size, true); + memPort->memsetBlob(addr, 0, sec->size); } } return true; @@ -86,11 +80,11 @@ ObjectFile::loadSection(Section *sec, TranslatingPort *memPort, bool loadPhys) bool -ObjectFile::loadSections(TranslatingPort *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 309089728..b43989cb5 100644 --- a/base/loader/object_file.hh +++ b/base/loader/object_file.hh @@ -29,11 +29,12 @@ #ifndef __OBJECT_FILE_HH__ #define __OBJECT_FILE_HH__ +#include <limits> #include <string> #include "sim/host.hh" // for Addr -class TranslatingPort; +class Port; class SymbolTable; class ObjectFile @@ -72,7 +73,8 @@ class ObjectFile void close(); - virtual bool loadSections(TranslatingPort *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, TranslatingPort *memPort, bool loadPhys); + bool loadSection(Section *sec, Port *memPort, Addr addrMask); void setGlobalPointer(Addr global_ptr) { globalPtr = global_ptr; } public: diff --git a/base/remote_gdb.cc b/base/remote_gdb.cc index 8a6cbdc33..6b85bc680 100644 --- a/base/remote_gdb.cc +++ b/base/remote_gdb.cc @@ -120,16 +120,18 @@ #include <string> #include <unistd.h> +#include "arch/vtophys.hh" #include "base/intmath.hh" #include "base/kgdb.h" #include "base/remote_gdb.hh" #include "base/socket.hh" #include "base/trace.hh" +#include "config/full_system.hh" #include "cpu/exec_context.hh" #include "cpu/static_inst.hh" -#include "mem/functional/physical.hh" +#include "mem/physical.hh" +#include "mem/port.hh" #include "sim/system.hh" -#include "arch/vtophys.hh" using namespace std; using namespace TheISA; @@ -372,7 +374,7 @@ RemoteGDB::acc(Addr va, size_t len) return true; Addr ptbr = context->readMiscReg(AlphaISA::IPR_PALtemp20); - TheISA::PageTableEntry pte = kernel_pte_lookup(pmem, ptbr, va); + TheISA::PageTableEntry pte = TheISA::kernel_pte_lookup(context->getPhysPort(), ptbr, va); if (!pte.valid()) { DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); return false; @@ -632,51 +634,20 @@ RemoteGDB::read(Addr vaddr, size_t size, char *data) static Addr lastaddr = 0; static size_t lastsize = 0; - uint8_t *maddr; - if (vaddr < 10) { DPRINTF(GDBRead, "read: reading memory location zero!\n"); vaddr = lastaddr + lastsize; } DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size); -#if TRACING_ON - char *d = data; - size_t s = size; -#endif - - lastaddr = vaddr; - lastsize = size; - size_t count = min((Addr)size, - VMPageSize - (vaddr & (VMPageSize - 1))); - - maddr = vtomem(context, vaddr, count); - memcpy(data, maddr, count); - - vaddr += count; - data += count; - size -= count; - - while (size >= VMPageSize) { - maddr = vtomem(context, vaddr, count); - memcpy(data, maddr, VMPageSize); - - vaddr += VMPageSize; - data += VMPageSize; - size -= VMPageSize; - } - - if (size > 0) { - maddr = vtomem(context, vaddr, count); - memcpy(data, maddr, size); - } + context->getVirtPort(context)->readBlob(vaddr, (uint8_t*)data, size); #if TRACING_ON if (DTRACE(GDBRead)) { if (DTRACE(GDBExtra)) { char buf[1024]; - mem2hex(buf, d, s); + mem2hex(buf, data, size); DPRINTFNR(": %s\n", buf); } else DPRINTFNR("\n"); @@ -693,8 +664,6 @@ RemoteGDB::write(Addr vaddr, size_t size, const char *data) static Addr lastaddr = 0; static size_t lastsize = 0; - uint8_t *maddr; - if (vaddr < 10) { DPRINTF(GDBWrite, "write: writing memory location zero!\n"); vaddr = lastaddr + lastsize; @@ -710,32 +679,7 @@ RemoteGDB::write(Addr vaddr, size_t size, const char *data) DPRINTFNR("\n"); } - lastaddr = vaddr; - lastsize = size; - - size_t count = min((Addr)size, - VMPageSize - (vaddr & (VMPageSize - 1))); - - maddr = vtomem(context, vaddr, count); - memcpy(maddr, data, count); - - vaddr += count; - data += count; - size -= count; - - while (size >= VMPageSize) { - maddr = vtomem(context, vaddr, count); - memcpy(maddr, data, VMPageSize); - - vaddr += VMPageSize; - data += VMPageSize; - size -= VMPageSize; - } - - if (size > 0) { - maddr = vtomem(context, vaddr, count); - memcpy(maddr, data, size); - } + context->getVirtPort(context)->writeBlob(vaddr, (uint8_t*)data, size); #ifdef IMB alpha_pal_imb(); diff --git a/base/timebuf.hh b/base/timebuf.hh index 435803fae..f6b5b2781 100644 --- a/base/timebuf.hh +++ b/base/timebuf.hh @@ -31,8 +31,6 @@ #include <vector> -using namespace std; - template <class T> class TimeBuffer { @@ -42,7 +40,7 @@ class TimeBuffer int size; char *data; - vector<char *> index; + std::vector<char *> index; int base; void valid(int idx) diff --git a/base/traceflags.py b/base/traceflags.py index c3b878027..7dbaac60e 100644 --- a/base/traceflags.py +++ b/base/traceflags.py @@ -143,6 +143,7 @@ baseFlags = [ 'HWPrefetch', 'Stack', 'SimpleCPU', + 'Sparc', ] # |