arch, base, sim: Demote (SE|FS)TranslatingPortProxy &s to PortProxy &s.
Al(most) all of the interesting differences between the two classes have been removed. There are some control methods which are still specific to each type which may require treating them as their true type, but most code that consumes them doesn't need to worry about which is which. Change-Id: Ie592676f1e496c7940605b66e55cd7fae18e59d6 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18577 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Brandon Potter <Brandon.Potter@amd.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -176,7 +176,7 @@ LinuxAlphaSystem::setDelayLoop(ThreadContext *tc)
|
||||
if (kernelSymtab->findAddress("loops_per_jiffy", addr)) {
|
||||
Tick cpuFreq = tc->getCpuPtr()->frequency();
|
||||
assert(intrFreq);
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
vp.write(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988),
|
||||
GuestByteOrder);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ ProcessInfo::ProcessInfo(ThreadContext *_tc)
|
||||
: tc(_tc)
|
||||
{
|
||||
Addr addr = 0;
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
SymbolTable *symtab = tc->getSystemPtr()->kernelSymtab;
|
||||
|
||||
if (!symtab->findAddress("thread_info_size", addr))
|
||||
@@ -82,7 +82,7 @@ ProcessInfo::task(Addr ksp) const
|
||||
|
||||
Addr tsk;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
tsk = vp.read<Addr>(base + task_off, GuestByteOrder);
|
||||
|
||||
return tsk;
|
||||
@@ -97,7 +97,7 @@ ProcessInfo::pid(Addr ksp) const
|
||||
|
||||
uint16_t pd;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
pd = vp.read<uint16_t>(task + pid_off, GuestByteOrder);
|
||||
|
||||
return pd;
|
||||
|
||||
@@ -53,7 +53,7 @@ getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp)
|
||||
return tc->readIntReg(16 + number);
|
||||
} else {
|
||||
Addr sp = tc->readIntReg(StackPointerReg);
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
uint64_t arg = vp.read<uint64_t>(sp +
|
||||
(number-NumArgumentRegs) *
|
||||
sizeof(uint64_t));
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ArmISA
|
||||
static int32_t
|
||||
readSymbol(ThreadContext *tc, const std::string name)
|
||||
{
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
SymbolTable *symtab = tc->getSystemPtr()->kernelSymtab;
|
||||
|
||||
Addr addr;
|
||||
@@ -75,7 +75,7 @@ ProcessInfo::task(Addr ksp) const
|
||||
|
||||
Addr tsk;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
tsk = vp.read<Addr>(base + task_off, GuestByteOrder);
|
||||
|
||||
return tsk;
|
||||
@@ -90,7 +90,7 @@ ProcessInfo::pid(Addr ksp) const
|
||||
|
||||
uint16_t pd;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
pd = vp.read<uint16_t>(task + pid_off, GuestByteOrder);
|
||||
|
||||
return pd;
|
||||
|
||||
@@ -107,7 +107,7 @@ getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp)
|
||||
}
|
||||
} else {
|
||||
Addr sp = tc->readIntReg(StackPointerReg);
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
uint64_t arg;
|
||||
if (size == sizeof(uint64_t)) {
|
||||
// If the argument is even it must be aligned
|
||||
|
||||
@@ -55,7 +55,7 @@ ProcessInfo::task(Addr ksp) const
|
||||
|
||||
Addr tsk;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
tsk = vp.read<Addr>(base + task_off, GuestByteOrder);
|
||||
|
||||
return tsk;
|
||||
@@ -70,7 +70,7 @@ ProcessInfo::pid(Addr ksp) const
|
||||
|
||||
uint16_t pd;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
pd = vp.read<uint16_t>(task + pid_off, GuestByteOrder);
|
||||
|
||||
return pd;
|
||||
|
||||
@@ -57,7 +57,7 @@ getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp)
|
||||
return tc->readIntReg(8 + number);
|
||||
} else {
|
||||
Addr sp = tc->readIntReg(StackPointerReg);
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
uint64_t arg = vp.read<uint64_t>(sp + 92 +
|
||||
(number-NumArgumentRegs) * sizeof(uint64_t));
|
||||
return arg;
|
||||
|
||||
@@ -125,7 +125,7 @@ archPrctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
|
||||
int code = process->getSyscallArg(tc, index);
|
||||
uint64_t addr = process->getSyscallArg(tc, index);
|
||||
uint64_t fsBase, gsBase;
|
||||
SETranslatingPortProxy &p = tc->getMemProxy();
|
||||
PortProxy &p = tc->getMemProxy();
|
||||
switch(code)
|
||||
{
|
||||
// Each of these valid options should actually check addr.
|
||||
|
||||
@@ -68,7 +68,7 @@ m5PageFault(ThreadContext *tc)
|
||||
|
||||
Process *p = tc->getProcessPtr();
|
||||
if (!p->fixupStackFault(tc->readMiscReg(MISCREG_CR2))) {
|
||||
SETranslatingPortProxy proxy = tc->getMemProxy();
|
||||
PortProxy &proxy = tc->getMemProxy();
|
||||
// at this point we should have 6 values on the interrupt stack
|
||||
int size = 6;
|
||||
uint64_t is[size];
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace X86ISA
|
||||
static int32_t
|
||||
readSymbol(ThreadContext *tc, const std::string name)
|
||||
{
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
SymbolTable *symtab = tc->getSystemPtr()->kernelSymtab;
|
||||
|
||||
Addr addr;
|
||||
@@ -75,7 +75,7 @@ ProcessInfo::task(Addr ksp) const
|
||||
|
||||
Addr tsk;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
tsk = vp.read<Addr>(base + task_off, GuestByteOrder);
|
||||
|
||||
return tsk;
|
||||
@@ -90,7 +90,7 @@ ProcessInfo::pid(Addr ksp) const
|
||||
|
||||
uint16_t pd;
|
||||
|
||||
FSTranslatingPortProxy &vp = tc->getVirtProxy();
|
||||
PortProxy &vp = tc->getVirtProxy();
|
||||
pd = vp.read<uint16_t>(task + pid_off, GuestByteOrder);
|
||||
|
||||
return pd;
|
||||
|
||||
@@ -625,10 +625,10 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data)
|
||||
DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size);
|
||||
|
||||
if (FullSystem) {
|
||||
FSTranslatingPortProxy &proxy = tc->getVirtProxy();
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
proxy.readBlob(vaddr, data, size);
|
||||
} else {
|
||||
SETranslatingPortProxy &proxy = tc->getMemProxy();
|
||||
PortProxy &proxy = tc->getMemProxy();
|
||||
proxy.readBlob(vaddr, data, size);
|
||||
}
|
||||
|
||||
@@ -668,10 +668,10 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data)
|
||||
DPRINTFNR("\n");
|
||||
}
|
||||
if (FullSystem) {
|
||||
FSTranslatingPortProxy &proxy = tc->getVirtProxy();
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
proxy.writeBlob(vaddr, data, size);
|
||||
} else {
|
||||
SETranslatingPortProxy &proxy = tc->getMemProxy();
|
||||
PortProxy &proxy = tc->getMemProxy();
|
||||
proxy.writeBlob(vaddr, data, size);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ template<class AddrType>
|
||||
void
|
||||
copyStringArray(std::vector<std::string> &strings,
|
||||
AddrType array_ptr, AddrType data_ptr,
|
||||
SETranslatingPortProxy& memProxy)
|
||||
PortProxy& memProxy)
|
||||
{
|
||||
AddrType data_ptr_swap;
|
||||
for (std::vector<std::string>::size_type i = 0; i < strings.size(); ++i) {
|
||||
|
||||
@@ -265,7 +265,7 @@ brkFunc(SyscallDesc *desc, int num, ThreadContext *tc)
|
||||
// if the address is already there, zero it out
|
||||
else {
|
||||
uint8_t zero = 0;
|
||||
SETranslatingPortProxy &tp = tc->getMemProxy();
|
||||
PortProxy &tp = tc->getMemProxy();
|
||||
|
||||
// split non-page aligned accesses
|
||||
Addr next_page = roundUp(gen.addr(), PageBytes);
|
||||
|
||||
@@ -603,7 +603,7 @@ convertStat64Buf(target_stat &tgt, host_stat64 *host, bool fakeTTY = false)
|
||||
// Here are a couple of convenience functions
|
||||
template<class OS>
|
||||
void
|
||||
copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr,
|
||||
copyOutStatBuf(PortProxy &mem, Addr addr,
|
||||
hst_stat *host, bool fakeTTY = false)
|
||||
{
|
||||
typedef TypedBufferArg<typename OS::tgt_stat> tgt_stat_buf;
|
||||
@@ -614,7 +614,7 @@ copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr,
|
||||
|
||||
template<class OS>
|
||||
void
|
||||
copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr,
|
||||
copyOutStat64Buf(PortProxy &mem, Addr addr,
|
||||
hst_stat64 *host, bool fakeTTY = false)
|
||||
{
|
||||
typedef TypedBufferArg<typename OS::tgt_stat64> tgt_stat_buf;
|
||||
@@ -625,7 +625,7 @@ copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr,
|
||||
|
||||
template <class OS>
|
||||
void
|
||||
copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr,
|
||||
copyOutStatfsBuf(PortProxy &mem, Addr addr,
|
||||
hst_statfs *host)
|
||||
{
|
||||
TypedBufferArg<typename OS::tgt_statfs> tgt(addr);
|
||||
@@ -1663,7 +1663,7 @@ readvFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
|
||||
return -EBADF;
|
||||
int sim_fd = ffdp->getSimFD();
|
||||
|
||||
SETranslatingPortProxy &prox = tc->getMemProxy();
|
||||
PortProxy &prox = tc->getMemProxy();
|
||||
uint64_t tiov_base = p->getSyscallArg(tc, index);
|
||||
size_t count = p->getSyscallArg(tc, index);
|
||||
typename OS::tgt_iovec tiov[count];
|
||||
@@ -1703,7 +1703,7 @@ writevFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
|
||||
return -EBADF;
|
||||
int sim_fd = hbfdp->getSimFD();
|
||||
|
||||
SETranslatingPortProxy &prox = tc->getMemProxy();
|
||||
PortProxy &prox = tc->getMemProxy();
|
||||
uint64_t tiov_base = p->getSyscallArg(tc, index);
|
||||
size_t count = p->getSyscallArg(tc, index);
|
||||
struct iovec hiov[count];
|
||||
@@ -1841,7 +1841,7 @@ mmapImpl(SyscallDesc *desc, int num, ThreadContext *tc, bool is_mmap2)
|
||||
p->allocateMem(start, length, clobber);
|
||||
|
||||
// Transfer content into target address space.
|
||||
SETranslatingPortProxy &tp = tc->getMemProxy();
|
||||
PortProxy &tp = tc->getMemProxy();
|
||||
if (tgt_flags & OS::TGT_MAP_ANONYMOUS) {
|
||||
// In general, we should zero the mapped area for anonymous mappings,
|
||||
// with something like:
|
||||
@@ -2124,16 +2124,15 @@ execveFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
|
||||
|
||||
int index = 0;
|
||||
std::string path;
|
||||
SETranslatingPortProxy & mem_proxy = tc->getMemProxy();
|
||||
PortProxy & mem_proxy = tc->getMemProxy();
|
||||
if (!mem_proxy.tryReadString(path, p->getSyscallArg(tc, index)))
|
||||
return -EFAULT;
|
||||
|
||||
if (access(path.c_str(), F_OK) == -1)
|
||||
return -EACCES;
|
||||
|
||||
auto read_in = [](std::vector<std::string> & vect,
|
||||
SETranslatingPortProxy & mem_proxy,
|
||||
Addr mem_loc)
|
||||
auto read_in = [](std::vector<std::string> &vect,
|
||||
PortProxy &mem_proxy, Addr mem_loc)
|
||||
{
|
||||
for (int inc = 0; ; inc++) {
|
||||
BufferArg b((mem_loc + sizeof(Addr) * inc), sizeof(Addr));
|
||||
@@ -2301,7 +2300,7 @@ timeFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
|
||||
if (taddr != 0) {
|
||||
typename OS::time_t t = sec;
|
||||
t = TheISA::htog(t);
|
||||
SETranslatingPortProxy &p = tc->getMemProxy();
|
||||
PortProxy &p = tc->getMemProxy();
|
||||
p.writeBlob(taddr, &t, (int)sizeof(typename OS::time_t));
|
||||
}
|
||||
return sec;
|
||||
|
||||
@@ -75,7 +75,8 @@ class BaseBufferArg {
|
||||
/**
|
||||
* copy data into simulator space (read from target memory)
|
||||
*/
|
||||
bool copyIn(SETranslatingPortProxy &memproxy)
|
||||
bool
|
||||
copyIn(PortProxy &memproxy)
|
||||
{
|
||||
memproxy.readBlob(addr, bufPtr, size);
|
||||
return true; // no EFAULT detection for now
|
||||
@@ -84,7 +85,8 @@ class BaseBufferArg {
|
||||
/**
|
||||
* copy data out of simulator space (write to target memory)
|
||||
*/
|
||||
bool copyOut(SETranslatingPortProxy &memproxy)
|
||||
bool
|
||||
copyOut(PortProxy &memproxy)
|
||||
{
|
||||
memproxy.writeBlob(addr, bufPtr, size);
|
||||
return true; // no EFAULT detection for now
|
||||
|
||||
@@ -69,7 +69,7 @@ class VPtr
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
FSTranslatingPortProxy &proxy = tc->getVirtProxy();
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
proxy.readBlob(ptr, buffer, sizeof(T));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user