From f85286b3debf4a4a94d3b959e5bb880be81bd692 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 17 Jan 2012 12:55:08 -0600 Subject: MEM: Add port proxies instead of non-structural ports Port proxies are used to replace non-structural ports, and thus enable all ports in the system to correspond to a structural entity. This has the advantage of accessing memory through the normal memory subsystem and thus allowing any constellation of distributed memories, address maps, etc. Most accesses are done through the "system port" that is used for loading binaries, debugging etc. For the entities that belong to the CPU, e.g. threads and thread contexts, they wrap the CPU data port in a port proxy. The following replacements are made: FunctionalPort > PortProxy TranslatingPort > SETranslatingPortProxy VirtualPort > FSTranslatingPortProxy --HG-- rename : src/mem/vport.cc => src/mem/fs_translating_port_proxy.cc rename : src/mem/vport.hh => src/mem/fs_translating_port_proxy.hh rename : src/mem/translating_port.cc => src/mem/se_translating_port_proxy.cc rename : src/mem/translating_port.hh => src/mem/se_translating_port_proxy.hh --- src/base/loader/elf_object.cc | 6 +++--- src/base/loader/elf_object.hh | 2 +- src/base/loader/hex_file.cc | 6 +++--- src/base/loader/hex_file.hh | 4 ++-- src/base/loader/object_file.cc | 16 ++++++++-------- src/base/loader/object_file.hh | 6 +++--- src/base/remote_gdb.cc | 12 ++++++------ 7 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/base') diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc index 1b1841a45..80800e862 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -414,15 +414,15 @@ ElfObject::loadLocalSymbols(SymbolTable *symtab, Addr addrMask) } bool -ElfObject::loadSections(Port *memPort, Addr addrMask) +ElfObject::loadSections(PortProxy* memProxy, Addr addrMask) { - if (!ObjectFile::loadSections(memPort, addrMask)) + if (!ObjectFile::loadSections(memProxy, addrMask)) return false; vector::iterator extraIt; for (extraIt = extraSegments.begin(); extraIt != extraSegments.end(); extraIt++) { - if (!loadSection(&(*extraIt), memPort, addrMask)) { + if (!loadSection(&(*extraIt), memProxy, addrMask)) { return false; } } diff --git a/src/base/loader/elf_object.hh b/src/base/loader/elf_object.hh index fe75927c5..afb61c21d 100644 --- a/src/base/loader/elf_object.hh +++ b/src/base/loader/elf_object.hh @@ -65,7 +65,7 @@ class ElfObject : public ObjectFile public: virtual ~ElfObject() {} - bool loadSections(Port *memPort, + bool loadSections(PortProxy *memProxy, Addr addrMask = std::numeric_limits::max()); virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr addrMask = std::numeric_limits::max()); diff --git a/src/base/loader/hex_file.cc b/src/base/loader/hex_file.cc index 854834b2b..d38c0fb62 100755 --- a/src/base/loader/hex_file.cc +++ b/src/base/loader/hex_file.cc @@ -36,7 +36,7 @@ #include "base/loader/hex_file.hh" #include "base/loader/symtab.hh" #include "base/cprintf.hh" -#include "mem/translating_port.hh" +#include "mem/port_proxy.hh" using namespace std; /* @@ -59,7 +59,7 @@ HexFile::~HexFile() } bool -HexFile::loadSections(Port *memPort) +HexFile::loadSections(PortProxy* memProxy) { char Line[64]; Addr MemAddr; @@ -71,7 +71,7 @@ HexFile::loadSections(Port *memPort) parseLine(Line, &MemAddr, &Data); if (MemAddr != 0) { // Now, write to memory - memPort->writeBlob(MemAddr << 2, (uint8_t *)&Data, sizeof(Data)); + memProxy->writeBlob(MemAddr << 2, (uint8_t *)&Data, sizeof(Data)); } } return true; diff --git a/src/base/loader/hex_file.hh b/src/base/loader/hex_file.hh index 87a7eb0f3..514a02a1e 100755 --- a/src/base/loader/hex_file.hh +++ b/src/base/loader/hex_file.hh @@ -37,7 +37,7 @@ #include "base/types.hh" -class Port; +class PortProxy; class HexFile { @@ -52,7 +52,7 @@ class HexFile virtual ~HexFile(); void close(); - bool loadSections(Port *memPort); + bool loadSections(PortProxy* memProxy); }; #endif // __BASE_LOADER_HEX_FILE_HH__ diff --git a/src/base/loader/object_file.cc b/src/base/loader/object_file.cc index 9dcbd7936..eaf0443bf 100644 --- a/src/base/loader/object_file.cc +++ b/src/base/loader/object_file.cc @@ -45,7 +45,7 @@ #include "base/loader/raw_object.hh" #include "base/loader/symtab.hh" #include "base/cprintf.hh" -#include "mem/translating_port.hh" +#include "mem/port_proxy.hh" using namespace std; @@ -65,16 +65,16 @@ ObjectFile::~ObjectFile() bool -ObjectFile::loadSection(Section *sec, Port *memPort, Addr addrMask) +ObjectFile::loadSection(Section *sec, PortProxy* memProxy, Addr addrMask) { if (sec->size != 0) { Addr addr = sec->baseAddr & addrMask; if (sec->fileImage) { - memPort->writeBlob(addr, sec->fileImage, sec->size); + memProxy->writeBlob(addr, sec->fileImage, sec->size); } else { // no image: must be bss - memPort->memsetBlob(addr, 0, sec->size); + memProxy->memsetBlob(addr, 0, sec->size); } } return true; @@ -82,11 +82,11 @@ ObjectFile::loadSection(Section *sec, Port *memPort, Addr addrMask) bool -ObjectFile::loadSections(Port *memPort, Addr addrMask) +ObjectFile::loadSections(PortProxy* memProxy, Addr addrMask) { - return (loadSection(&text, memPort, addrMask) - && loadSection(&data, memPort, addrMask) - && loadSection(&bss, memPort, addrMask)); + return (loadSection(&text, memProxy, addrMask) + && loadSection(&data, memProxy, addrMask) + && loadSection(&bss, memProxy, addrMask)); } diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh index bffab0cc5..ce58a2c4f 100644 --- a/src/base/loader/object_file.hh +++ b/src/base/loader/object_file.hh @@ -37,7 +37,7 @@ #include "base/types.hh" -class Port; +class PortProxy; class SymbolTable; class ObjectFile @@ -83,7 +83,7 @@ class ObjectFile void close(); - virtual bool loadSections(Port *memPort, Addr addrMask = + virtual bool loadSections(PortProxy *memProxy, Addr addrMask = std::numeric_limits::max()); virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr addrMask = std::numeric_limits::max()) = 0; @@ -111,7 +111,7 @@ class ObjectFile Section data; Section bss; - bool loadSection(Section *sec, Port *memPort, Addr addrMask); + bool loadSection(Section *sec, PortProxy* memProxy, Addr addrMask); void setGlobalPointer(Addr global_ptr) { globalPtr = global_ptr; } public: diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index e0b707f43..1d8256b42 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -126,7 +126,7 @@ #if FULL_SYSTEM #include "arch/vtophys.hh" -#include "mem/vport.hh" +#include "mem/fs_translating_port_proxy.hh" #endif #include "base/intmath.hh" @@ -138,7 +138,7 @@ #include "cpu/thread_context.hh" #include "debug/GDBAll.hh" #include "mem/port.hh" -#include "mem/translating_port.hh" +#include "mem/se_translating_port_proxy.hh" #include "sim/system.hh" using namespace std; @@ -465,9 +465,9 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data) DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size); #if FULL_SYSTEM - VirtualPort *port = context->getVirtPort(); + FSTranslatingPortProxy *port = context->getVirtProxy(); #else - TranslatingPort *port = context->getMemPort(); + SETranslatingPortProxy *port = context->getMemProxy(); #endif port->readBlob(vaddr, (uint8_t*)data, size); @@ -507,9 +507,9 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data) DPRINTFNR("\n"); } #if FULL_SYSTEM - VirtualPort *port = context->getVirtPort(); + FSTranslatingPortProxy *port = context->getVirtProxy(); #else - TranslatingPort *port = context->getMemPort(); + SETranslatingPortProxy *port = context->getMemProxy(); #endif port->writeBlob(vaddr, (uint8_t*)data, size); #if !FULL_SYSTEM -- cgit v1.2.3