From 9bffae0e023b1ae0f3a545dc0ec7f8c6325b3069 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 2 May 2019 00:55:10 -0700 Subject: [PATCH] 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 Reviewed-by: Jason Lowe-Power Reviewed-by: Brandon Potter Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/arch/alpha/linux/system.cc | 2 +- src/arch/alpha/stacktrace.cc | 6 +++--- src/arch/alpha/utility.cc | 2 +- src/arch/arm/stacktrace.cc | 6 +++--- src/arch/arm/utility.cc | 2 +- src/arch/mips/stacktrace.cc | 4 ++-- src/arch/sparc/utility.cc | 2 +- src/arch/x86/linux/process.cc | 2 +- src/arch/x86/pseudo_inst.cc | 2 +- src/arch/x86/stacktrace.cc | 6 +++--- src/base/remote_gdb.cc | 8 ++++---- src/sim/process_impl.hh | 2 +- src/sim/syscall_emul.cc | 2 +- src/sim/syscall_emul.hh | 21 ++++++++++----------- src/sim/syscall_emul_buf.hh | 6 ++++-- src/sim/vptr.hh | 2 +- 16 files changed, 38 insertions(+), 37 deletions(-) diff --git a/src/arch/alpha/linux/system.cc b/src/arch/alpha/linux/system.cc index d963d29ee2..ae9e5ef07d 100644 --- a/src/arch/alpha/linux/system.cc +++ b/src/arch/alpha/linux/system.cc @@ -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); } diff --git a/src/arch/alpha/stacktrace.cc b/src/arch/alpha/stacktrace.cc index f5833b070a..bf2d5b34b8 100644 --- a/src/arch/alpha/stacktrace.cc +++ b/src/arch/alpha/stacktrace.cc @@ -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(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(task + pid_off, GuestByteOrder); return pd; diff --git a/src/arch/alpha/utility.cc b/src/arch/alpha/utility.cc index c644911ba2..8264c94113 100644 --- a/src/arch/alpha/utility.cc +++ b/src/arch/alpha/utility.cc @@ -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(sp + (number-NumArgumentRegs) * sizeof(uint64_t)); diff --git a/src/arch/arm/stacktrace.cc b/src/arch/arm/stacktrace.cc index 837b6ad8b2..8fadb81c34 100644 --- a/src/arch/arm/stacktrace.cc +++ b/src/arch/arm/stacktrace.cc @@ -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(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(task + pid_off, GuestByteOrder); return pd; diff --git a/src/arch/arm/utility.cc b/src/arch/arm/utility.cc index 2888ebbf38..2f7d916d2c 100644 --- a/src/arch/arm/utility.cc +++ b/src/arch/arm/utility.cc @@ -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 diff --git a/src/arch/mips/stacktrace.cc b/src/arch/mips/stacktrace.cc index 7517b9d0ba..fe464e32a2 100644 --- a/src/arch/mips/stacktrace.cc +++ b/src/arch/mips/stacktrace.cc @@ -55,7 +55,7 @@ ProcessInfo::task(Addr ksp) const Addr tsk; - FSTranslatingPortProxy &vp = tc->getVirtProxy(); + PortProxy &vp = tc->getVirtProxy(); tsk = vp.read(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(task + pid_off, GuestByteOrder); return pd; diff --git a/src/arch/sparc/utility.cc b/src/arch/sparc/utility.cc index 6b3e5d2044..5b05eaf71b 100644 --- a/src/arch/sparc/utility.cc +++ b/src/arch/sparc/utility.cc @@ -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(sp + 92 + (number-NumArgumentRegs) * sizeof(uint64_t)); return arg; diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index d38b168fde..1d8bcbf6c9 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -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. diff --git a/src/arch/x86/pseudo_inst.cc b/src/arch/x86/pseudo_inst.cc index fc71af1183..253c91441d 100644 --- a/src/arch/x86/pseudo_inst.cc +++ b/src/arch/x86/pseudo_inst.cc @@ -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]; diff --git a/src/arch/x86/stacktrace.cc b/src/arch/x86/stacktrace.cc index b5fbb5ce55..0141a9e75c 100644 --- a/src/arch/x86/stacktrace.cc +++ b/src/arch/x86/stacktrace.cc @@ -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(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(task + pid_off, GuestByteOrder); return pd; diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index c092620a9a..347345d176 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -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); } diff --git a/src/sim/process_impl.hh b/src/sim/process_impl.hh index ae2a3b5715..75134121bc 100644 --- a/src/sim/process_impl.hh +++ b/src/sim/process_impl.hh @@ -42,7 +42,7 @@ template void copyStringArray(std::vector &strings, AddrType array_ptr, AddrType data_ptr, - SETranslatingPortProxy& memProxy) + PortProxy& memProxy) { AddrType data_ptr_swap; for (std::vector::size_type i = 0; i < strings.size(); ++i) { diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 442a28c415..7e8f9062a1 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -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); diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index dbbdf47345..4cb93c88fa 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -603,7 +603,7 @@ convertStat64Buf(target_stat &tgt, host_stat64 *host, bool fakeTTY = false) // Here are a couple of convenience functions template void -copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr, +copyOutStatBuf(PortProxy &mem, Addr addr, hst_stat *host, bool fakeTTY = false) { typedef TypedBufferArg tgt_stat_buf; @@ -614,7 +614,7 @@ copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr, template void -copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr, +copyOutStat64Buf(PortProxy &mem, Addr addr, hst_stat64 *host, bool fakeTTY = false) { typedef TypedBufferArg tgt_stat_buf; @@ -625,7 +625,7 @@ copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr, template void -copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr, +copyOutStatfsBuf(PortProxy &mem, Addr addr, hst_statfs *host) { TypedBufferArg 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 & vect, - SETranslatingPortProxy & mem_proxy, - Addr mem_loc) + auto read_in = [](std::vector &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; diff --git a/src/sim/syscall_emul_buf.hh b/src/sim/syscall_emul_buf.hh index e930846be3..0b303254ab 100644 --- a/src/sim/syscall_emul_buf.hh +++ b/src/sim/syscall_emul_buf.hh @@ -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 diff --git a/src/sim/vptr.hh b/src/sim/vptr.hh index 6eefd59373..07f00c3db7 100644 --- a/src/sim/vptr.hh +++ b/src/sim/vptr.hh @@ -69,7 +69,7 @@ class VPtr if (!ptr) return; - FSTranslatingPortProxy &proxy = tc->getVirtProxy(); + PortProxy &proxy = tc->getVirtProxy(); proxy.readBlob(ptr, buffer, sizeof(T)); }