diff options
author | Gabe Black <gabeblack@google.com> | 2019-05-01 21:43:09 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-05-30 06:07:33 +0000 |
commit | 096598c05a6c352bfd4b93adf06143a43a8f4e11 (patch) | |
tree | 1dcbf980d846035fed6554ae00ca1d2669072b51 /src/sim | |
parent | da7e63d088cd1710ee4f55f7c5481df4fa95e531 (diff) | |
download | gem5-096598c05a6c352bfd4b93adf06143a43a8f4e11.tar.xz |
arch, base, sim: Replace Copy(String)?(In|Out) with equivalent code.
This expands those functions into code which extracts the virt proxy
and then uses the appropriate method on it. This has two benefits.
First, the Copy* functions where mostly redundant wrappers around the
methods the proxy port already had. Second, using them forced a
particular port which might not actually be what the user wanted.
Change-Id: I62084631dd080061e3c74997125164f40da2d77c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18575
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/arguments.hh | 7 | ||||
-rw-r--r-- | src/sim/pseudo_inst.cc | 13 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/sim/arguments.hh b/src/sim/arguments.hh index 498527ca2..977e3ffc0 100644 --- a/src/sim/arguments.hh +++ b/src/sim/arguments.hh @@ -34,10 +34,9 @@ #include <cassert> #include <memory> +#include "cpu/thread_context.hh" #include "mem/fs_translating_port_proxy.hh" -class ThreadContext; - class Arguments { protected: @@ -137,13 +136,13 @@ class Arguments template <class T> operator T *() { T *buf = (T *)data->alloc(sizeof(T)); - CopyOut(tc, buf, getArg(sizeof(T)), sizeof(T)); + tc->getVirtProxy().readBlob(getArg(sizeof(T)), buf, sizeof(T)); return buf; } operator char *() { char *buf = data->alloc(2048); - CopyStringOut(tc, buf, getArg(), 2048); + tc->getVirtProxy().readString(buf, getArg(), 2048); return buf; } }; diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc index 8ffb13e3b..92886dacb 100644 --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -377,9 +377,8 @@ addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr) if (!FullSystem) panicFsOnlyPseudoInst("addSymbol"); - char symb[100]; - CopyStringOut(tc, symb, symbolAddr, 100); - std::string symbol(symb); + std::string symbol; + tc->getVirtProxy().readString(symbol, symbolAddr); DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr); @@ -525,7 +524,7 @@ readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset) } close(fd); - CopyIn(tc, vaddr, buf, result); + tc->getVirtProxy().writeBlob(vaddr, buf, result); delete [] buf; return result; } @@ -538,10 +537,8 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, vaddr, len, offset, filename_addr); // copy out target filename - char fn[100]; std::string filename; - CopyStringOut(tc, fn, filename_addr, 100); - filename = std::string(fn); + tc->getVirtProxy().readString(filename, filename_addr); OutputStream *out; if (offset == 0) { @@ -563,7 +560,7 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset, // copy out data and write to file char *buf = new char[len]; - CopyOut(tc, buf, vaddr, len); + tc->getVirtProxy().readBlob(vaddr, buf, len); os->write(buf, len); if (os->fail() || os->bad()) panic("Error while doing writefile!\n"); |