misc: Stop using getVirtProxy.
The proxies are not used on the critical path, and it's usually implicit whether they should be the FS or SE version. Ideally in the future we won't need to worry about which version we need to use, but the differences haven't quite been abstracted away, and occasionally we need to decide between the two. Change-Id: Idb363d6ddc681f7c1ad5e7aba69865f40aa30dc8 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45907 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -38,6 +38,9 @@
|
||||
#include "base/intmath.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/guest_abi.hh"
|
||||
#include "sim/proxy_ptr.hh"
|
||||
|
||||
@@ -343,7 +346,9 @@ struct Argument<Aapcs32, Composite, typename std::enable_if_t<
|
||||
}
|
||||
|
||||
if (bytes) {
|
||||
tc->getVirtProxy().readBlob(state.nsaa, buf, bytes);
|
||||
(FullSystem ? TranslatingPortProxy(tc) :
|
||||
SETranslatingPortProxy(tc)).readBlob(
|
||||
state.nsaa, buf, bytes);
|
||||
|
||||
state.stackUsed = true;
|
||||
state.nsaa += roundUp(bytes, 4);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "base/loader/object_file.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
|
||||
namespace gem5
|
||||
@@ -94,18 +95,20 @@ sysctlFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> namep, size_t nameLen,
|
||||
{
|
||||
uint64_t ret;
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
BufferArg buf(namep, sizeof(size_t));
|
||||
BufferArg buf2(oldp, sizeof(size_t));
|
||||
BufferArg buf3(oldlenp, sizeof(size_t));
|
||||
BufferArg buf4(newp, sizeof(size_t));
|
||||
|
||||
buf.copyIn(tc->getVirtProxy());
|
||||
buf2.copyIn(tc->getVirtProxy());
|
||||
buf3.copyIn(tc->getVirtProxy());
|
||||
buf.copyIn(proxy);
|
||||
buf2.copyIn(proxy);
|
||||
buf3.copyIn(proxy);
|
||||
|
||||
void *hnewp = NULL;
|
||||
if (newp) {
|
||||
buf4.copyIn(tc->getVirtProxy());
|
||||
buf4.copyIn(proxy);
|
||||
hnewp = (void *)buf4.bufferPtr();
|
||||
}
|
||||
|
||||
@@ -115,11 +118,11 @@ sysctlFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> namep, size_t nameLen,
|
||||
|
||||
ret = sysctl((int *)hnamep, nameLen, holdp, holdlenp, hnewp, newlen);
|
||||
|
||||
buf.copyOut(tc->getVirtProxy());
|
||||
buf2.copyOut(tc->getVirtProxy());
|
||||
buf3.copyOut(tc->getVirtProxy());
|
||||
buf.copyOut(proxy);
|
||||
buf2.copyOut(proxy);
|
||||
buf3.copyOut(proxy);
|
||||
if (newp)
|
||||
buf4.copyOut(tc->getVirtProxy());
|
||||
buf4.copyOut(proxy);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/syscall_desc.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
@@ -72,10 +73,10 @@ ArmLinuxProcess32::initState()
|
||||
0xff, 0xff, 0xff, 0xef // swi -1
|
||||
};
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
// Fill this page with swi -1 so we'll no if we land in it somewhere.
|
||||
for (Addr addr = 0; addr < PageBytes; addr += sizeof(swiNeg1)) {
|
||||
tc->getVirtProxy().writeBlob(commPage + addr,
|
||||
swiNeg1, sizeof(swiNeg1));
|
||||
proxy.writeBlob(commPage + addr, swiNeg1, sizeof(swiNeg1));
|
||||
}
|
||||
|
||||
uint8_t memory_barrier[] =
|
||||
@@ -83,8 +84,7 @@ ArmLinuxProcess32::initState()
|
||||
0x5f, 0xf0, 0x7f, 0xf5, // dmb
|
||||
0x0e, 0xf0, 0xa0, 0xe1 // return
|
||||
};
|
||||
tc->getVirtProxy().writeBlob(commPage + 0x0fa0, memory_barrier,
|
||||
sizeof(memory_barrier));
|
||||
proxy.writeBlob(commPage + 0x0fa0, memory_barrier, sizeof(memory_barrier));
|
||||
|
||||
uint8_t cmpxchg[] =
|
||||
{
|
||||
@@ -97,7 +97,7 @@ ArmLinuxProcess32::initState()
|
||||
0x5f, 0xf0, 0x7f, 0xf5, // dmb
|
||||
0x0e, 0xf0, 0xa0, 0xe1 // return
|
||||
};
|
||||
tc->getVirtProxy().writeBlob(commPage + 0x0fc0, cmpxchg, sizeof(cmpxchg));
|
||||
proxy.writeBlob(commPage + 0x0fc0, cmpxchg, sizeof(cmpxchg));
|
||||
|
||||
uint8_t get_tls[] =
|
||||
{
|
||||
@@ -105,7 +105,7 @@ ArmLinuxProcess32::initState()
|
||||
0x70, 0x0f, 0x1d, 0xee, // mrc p15, 0, r0, c13, c0, 3
|
||||
0x0e, 0xf0, 0xa0, 0xe1 // return
|
||||
};
|
||||
tc->getVirtProxy().writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
|
||||
proxy.writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "base/loader/object_file.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
|
||||
namespace gem5
|
||||
@@ -129,8 +130,8 @@ unameFunc64(SyscallDesc *desc, ThreadContext *tc, VPtr<Linux::utsname> name)
|
||||
static SyscallReturn
|
||||
setTLSFunc32(SyscallDesc *desc, ThreadContext *tc, uint32_t tlsPtr)
|
||||
{
|
||||
tc->getVirtProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0,
|
||||
&tlsPtr, sizeof(tlsPtr));
|
||||
SETranslatingPortProxy(tc).writeBlob(
|
||||
ArmLinuxProcess32::commPage + 0x0ff0, &tlsPtr, sizeof(tlsPtr));
|
||||
tc->setMiscReg(MISCREG_TPIDRURO, tlsPtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ PortProxy &
|
||||
ArmSemihosting::portProxy(ThreadContext *tc)
|
||||
{
|
||||
static std::unique_ptr<PortProxy> port_proxy_s;
|
||||
static std::unique_ptr<PortProxy> port_proxy_ns;
|
||||
static System *secure_sys = nullptr;
|
||||
|
||||
if (ArmISA::isSecure(tc)) {
|
||||
@@ -267,7 +268,15 @@ ArmSemihosting::portProxy(ThreadContext *tc)
|
||||
secure_sys = sys;
|
||||
return *port_proxy_s;
|
||||
} else {
|
||||
return tc->getVirtProxy();
|
||||
if (!port_proxy_ns) {
|
||||
if (FullSystem) {
|
||||
port_proxy_ns.reset(new TranslatingPortProxy(tc));
|
||||
} else {
|
||||
port_proxy_ns.reset(new SETranslatingPortProxy(tc));
|
||||
}
|
||||
}
|
||||
|
||||
return *port_proxy_ns;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,12 @@
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/packet.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "sim/core.hh"
|
||||
#include "sim/cur_tick.hh"
|
||||
#include "sim/faults.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/sim_exit.hh"
|
||||
|
||||
namespace gem5
|
||||
@@ -1310,7 +1314,8 @@ TarmacParserRecord::readMemNoEffect(Addr addr, uint8_t *data, unsigned size,
|
||||
return false;
|
||||
// the translating proxy will perform the virtual to physical
|
||||
// translation again
|
||||
thread->getVirtProxy().readBlob(addr, data, size);
|
||||
(FullSystem ? TranslatingPortProxy(thread) :
|
||||
SETranslatingPortProxy(thread)).readBlob(addr, data, size);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define __ARCH_GENERIC_LINUX_THREADINFO_HH__
|
||||
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
namespace gem5
|
||||
@@ -60,7 +61,7 @@ class ThreadInfo
|
||||
return false;
|
||||
}
|
||||
|
||||
data = tc->getVirtProxy().read<T>(it->address, byteOrder);
|
||||
data = TranslatingPortProxy(tc).read<T>(it->address, byteOrder);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -94,7 +95,7 @@ class ThreadInfo
|
||||
if (!thread_info)
|
||||
thread_info = curThreadInfo();
|
||||
|
||||
return tc->getVirtProxy().read<Addr>(thread_info + offset);
|
||||
return TranslatingPortProxy(tc).read<Addr>(thread_info + offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
@@ -104,7 +105,7 @@ class ThreadInfo
|
||||
if (!get_data("task_struct_pid", offset))
|
||||
return -1;
|
||||
|
||||
return tc->getVirtProxy().read<int32_t>(task_struct + offset);
|
||||
return TranslatingPortProxy(tc).read<int32_t>(task_struct + offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
@@ -120,7 +121,7 @@ class ThreadInfo
|
||||
if (!get_data("task_struct_tgid", offset))
|
||||
return -1;
|
||||
|
||||
return tc->getVirtProxy().read<int32_t>(task_struct + offset);
|
||||
return TranslatingPortProxy(tc).read<int32_t>(task_struct + offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
@@ -138,7 +139,7 @@ class ThreadInfo
|
||||
|
||||
// start_time is actually of type timespec, but if we just
|
||||
// grab the first long, we'll get the seconds out of it
|
||||
return tc->getVirtProxy().read<int64_t>(task_struct + offset);
|
||||
return TranslatingPortProxy(tc).read<int64_t>(task_struct + offset);
|
||||
}
|
||||
|
||||
int64_t
|
||||
@@ -160,7 +161,8 @@ class ThreadInfo
|
||||
return "FailureIn_curTaskName";
|
||||
|
||||
char buffer[size + 1];
|
||||
tc->getVirtProxy().readString(buffer, task_struct + offset, size);
|
||||
TranslatingPortProxy(tc).readString(
|
||||
buffer, task_struct + offset, size);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@@ -178,7 +180,7 @@ class ThreadInfo
|
||||
if (!get_data("task_struct_mm", offset))
|
||||
return -1;
|
||||
|
||||
return tc->getVirtProxy().read<int32_t>(task_struct + offset);
|
||||
return TranslatingPortProxy(tc).read<int32_t>(task_struct + offset);
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "arch/sparc/linux/se_workload.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/syscall_desc.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
|
||||
@@ -59,25 +60,26 @@ static SyscallReturn
|
||||
getresuidFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
VPtr<> ruid, VPtr<> euid, VPtr<> suid)
|
||||
{
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
const uint64_t id = htobe(100);
|
||||
// Handle the EFAULT case
|
||||
// Set the ruid
|
||||
if (ruid) {
|
||||
BufferArg ruidBuff(ruid, sizeof(uint64_t));
|
||||
memcpy(ruidBuff.bufferPtr(), &id, sizeof(uint64_t));
|
||||
ruidBuff.copyOut(tc->getVirtProxy());
|
||||
ruidBuff.copyOut(proxy);
|
||||
}
|
||||
// Set the euid
|
||||
if (euid) {
|
||||
BufferArg euidBuff(euid, sizeof(uint64_t));
|
||||
memcpy(euidBuff.bufferPtr(), &id, sizeof(uint64_t));
|
||||
euidBuff.copyOut(tc->getVirtProxy());
|
||||
euidBuff.copyOut(proxy);
|
||||
}
|
||||
// Set the suid
|
||||
if (suid) {
|
||||
BufferArg suidBuff(suid, sizeof(uint64_t));
|
||||
memcpy(suidBuff.bufferPtr(), &id, sizeof(uint64_t));
|
||||
suidBuff.copyOut(tc->getVirtProxy());
|
||||
suidBuff.copyOut(proxy);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "arch/sparc/types.hh"
|
||||
#include "base/logging.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -105,6 +106,8 @@ SEWorkload::flushWindows(ThreadContext *tc)
|
||||
const size_t reg_bytes = is_64 ? 8 : 4;
|
||||
uint8_t bytes[8];
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
CWP = (CWP + Cansave + 2) % NWindows;
|
||||
while (NWindows - 2 - Cansave != 0) {
|
||||
panic_if(Otherwin, "Otherwin non-zero.");
|
||||
@@ -122,7 +125,7 @@ SEWorkload::flushWindows(ThreadContext *tc)
|
||||
uint32_t regVal = htobe<uint32_t>(tc->readIntReg(index));
|
||||
memcpy(bytes, ®Val, reg_bytes);
|
||||
}
|
||||
if (!tc->getVirtProxy().tryWriteBlob(addr, bytes, reg_bytes)) {
|
||||
if (!proxy.tryWriteBlob(addr, bytes, reg_bytes)) {
|
||||
warn("Failed to save register to the stack when "
|
||||
"flushing windows.");
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/syscall_desc.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
@@ -152,7 +153,7 @@ EmuLinux::pageFault(ThreadContext *tc)
|
||||
{
|
||||
Process *p = tc->getProcessPtr();
|
||||
if (!p->fixupFault(tc->readMiscReg(MISCREG_CR2))) {
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
// at this point we should have 6 values on the interrupt stack
|
||||
int size = 6;
|
||||
uint64_t is[size];
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "base/trace.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/syscall_desc.hh"
|
||||
#include "sim/syscall_emul.hh"
|
||||
@@ -70,7 +71,7 @@ archPrctlFunc(SyscallDesc *desc, ThreadContext *tc, int code, uint64_t addr)
|
||||
};
|
||||
|
||||
uint64_t fsBase, gsBase;
|
||||
PortProxy &p = tc->getVirtProxy();
|
||||
SETranslatingPortProxy p(tc);
|
||||
switch(code)
|
||||
{
|
||||
// Each of these valid options should actually check addr.
|
||||
@@ -104,6 +105,7 @@ setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
const int maxTLSEntry = minTLSEntry + numTLSEntries - 1;
|
||||
|
||||
auto process = tc->getProcessPtr();
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
X86Process *x86p = dynamic_cast<X86Process *>(process);
|
||||
assert(x86p);
|
||||
@@ -114,7 +116,7 @@ setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t),
|
||||
numTLSEntries * sizeof(uint64_t));
|
||||
|
||||
if (!gdt.copyIn(tc->getVirtProxy()))
|
||||
if (!gdt.copyIn(proxy))
|
||||
panic("Failed to copy in GDT for %s.\n", desc->name());
|
||||
|
||||
if (userDesc->entry_number == (uint32_t)(-1)) {
|
||||
@@ -166,7 +168,7 @@ setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
gdt[index] = (uint64_t)segDesc;
|
||||
|
||||
if (!gdt.copyOut(tc->getVirtProxy()))
|
||||
if (!gdt.copyOut(proxy))
|
||||
panic("Failed to copy out GDT for %s.\n", desc->name());
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -152,6 +152,8 @@
|
||||
#include "debug/GDBAll.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/system.hh"
|
||||
@@ -687,8 +689,8 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data)
|
||||
{
|
||||
DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size);
|
||||
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
proxy.readBlob(vaddr, data, size);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
readBlob(vaddr, data, size);
|
||||
|
||||
#if TRACING_ON
|
||||
if (debug::GDBRead) {
|
||||
@@ -717,8 +719,8 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data)
|
||||
} else
|
||||
DPRINTFNR("\n");
|
||||
}
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
proxy.writeBlob(vaddr, data, size);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
writeBlob(vaddr, data, size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
#include "debug/GPUCommandProc.hh"
|
||||
#include "debug/GPUKernelInfo.hh"
|
||||
#include "gpu-compute/dispatcher.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "params/GPUCommandProcessor.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/proxy_ptr.hh"
|
||||
#include "sim/syscall_emul_buf.hh"
|
||||
@@ -106,7 +109,10 @@ GPUCommandProcessor::submitDispatchPkt(void *raw_pkt, uint32_t queue_id,
|
||||
* space to pull out the kernel code descriptor.
|
||||
*/
|
||||
auto *tc = sys->threads[0];
|
||||
auto &virt_proxy = tc->getVirtProxy();
|
||||
|
||||
TranslatingPortProxy fs_proxy(tc);
|
||||
SETranslatingPortProxy se_proxy(tc);
|
||||
PortProxy &virt_proxy = FullSystem ? fs_proxy : se_proxy;
|
||||
|
||||
/**
|
||||
* The kernel_object is a pointer to the machine code, whose entry
|
||||
|
||||
@@ -47,7 +47,10 @@
|
||||
#include "gpu-compute/gpu_command_processor.hh"
|
||||
#include "gpu-compute/shader.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "params/GPUComputeDriver.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/syscall_emul_buf.hh"
|
||||
|
||||
@@ -221,7 +224,9 @@ GPUComputeDriver::DriverWakeupEvent::process()
|
||||
int
|
||||
GPUComputeDriver::ioctl(ThreadContext *tc, unsigned req, Addr ioc_buf)
|
||||
{
|
||||
auto &virt_proxy = tc->getVirtProxy();
|
||||
TranslatingPortProxy fs_proxy(tc);
|
||||
SETranslatingPortProxy se_proxy(tc);
|
||||
PortProxy &virt_proxy = FullSystem ? fs_proxy : se_proxy;
|
||||
auto process = tc->getProcessPtr();
|
||||
auto mem_state = process->memState;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "base/compiler.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
@@ -97,7 +98,7 @@ linux::dumpDmesg(ThreadContext *tc, std::ostream &os)
|
||||
System *system = tc->getSystemPtr();
|
||||
const ByteOrder bo = system->getGuestByteOrder();
|
||||
const auto &symtab = system->workload->symtab(tc);
|
||||
PortProxy &proxy = tc->getVirtProxy();
|
||||
TranslatingPortProxy proxy(tc);
|
||||
|
||||
auto lb = symtab.find("__log_buf");
|
||||
auto lb_len = symtab.find("log_buf_len");
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "base/compiler.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -51,7 +52,8 @@ printk(std::string &str, ThreadContext *tc, Addr format_ptr,
|
||||
{
|
||||
std::string format;
|
||||
std::ostringstream out;
|
||||
tc->getVirtProxy().readString(format, format_ptr);
|
||||
TranslatingPortProxy proxy(tc);
|
||||
proxy.readString(format, format_ptr);
|
||||
|
||||
const char *p = format.c_str();
|
||||
|
||||
@@ -181,7 +183,7 @@ printk(std::string &str, ThreadContext *tc, Addr format_ptr,
|
||||
Addr s_ptr = args.get<Addr>();
|
||||
std::string s;
|
||||
if (s_ptr)
|
||||
tc->getVirtProxy().readString(s, s_ptr);
|
||||
proxy.readString(s, s_ptr);
|
||||
else
|
||||
s = "<NULL>";
|
||||
|
||||
@@ -219,7 +221,7 @@ printk(std::string &str, ThreadContext *tc, Addr format_ptr,
|
||||
uint64_t n = args.get<uint64_t>();
|
||||
Addr s_ptr = args.get<Addr>();
|
||||
std::string s;
|
||||
tc->getVirtProxy().readString(s, s_ptr);
|
||||
proxy.readString(s, s_ptr);
|
||||
out << s << ": " << n;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -339,13 +339,13 @@ Process::replicatePage(Addr vaddr, Addr new_paddr, ThreadContext *old_tc,
|
||||
|
||||
// Read from old physical page.
|
||||
uint8_t buf_p[pTable->pageSize()];
|
||||
old_tc->getVirtProxy().readBlob(vaddr, buf_p, sizeof(buf_p));
|
||||
SETranslatingPortProxy(old_tc).readBlob(vaddr, buf_p, sizeof(buf_p));
|
||||
|
||||
// Create new mapping in process address space by clobbering existing
|
||||
// mapping (if any existed) and then write to the new physical page.
|
||||
bool clobber = true;
|
||||
pTable->map(vaddr, new_paddr, sizeof(buf_p), clobber);
|
||||
new_tc->getVirtProxy().writeBlob(vaddr, buf_p, sizeof(buf_p));
|
||||
SETranslatingPortProxy(new_tc).writeBlob(vaddr, buf_p, sizeof(buf_p));
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -59,7 +59,10 @@
|
||||
#include "debug/Quiesce.hh"
|
||||
#include "debug/WorkItems.hh"
|
||||
#include "dev/net/dist_iface.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "mem/translating_port_proxy.hh"
|
||||
#include "params/BaseCPU.hh"
|
||||
#include "sim/full_system.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/serialize.hh"
|
||||
#include "sim/sim_events.hh"
|
||||
@@ -259,7 +262,8 @@ addsymbol(ThreadContext *tc, Addr addr, Addr symbolAddr)
|
||||
addr, symbolAddr);
|
||||
|
||||
std::string symbol;
|
||||
tc->getVirtProxy().readString(symbol, symbolAddr);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
readString(symbol, symbolAddr);
|
||||
|
||||
DPRINTF(Loader, "Loaded symbol: %s @ %#llx\n", symbol, addr);
|
||||
|
||||
@@ -389,7 +393,8 @@ readfile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset)
|
||||
}
|
||||
|
||||
close(fd);
|
||||
tc->getVirtProxy().writeBlob(vaddr, buf, result);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
writeBlob(vaddr, buf, result);
|
||||
delete [] buf;
|
||||
return result;
|
||||
}
|
||||
@@ -403,7 +408,8 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset,
|
||||
|
||||
// copy out target filename
|
||||
std::string filename;
|
||||
tc->getVirtProxy().readString(filename, filename_addr);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
readString(filename, filename_addr);
|
||||
|
||||
OutputStream *out;
|
||||
if (offset == 0) {
|
||||
@@ -428,7 +434,8 @@ writefile(ThreadContext *tc, Addr vaddr, uint64_t len, uint64_t offset,
|
||||
|
||||
// copy out data and write to file
|
||||
char *buf = new char[len];
|
||||
tc->getVirtProxy().readBlob(vaddr, buf, len);
|
||||
(FullSystem ? TranslatingPortProxy(tc) : SETranslatingPortProxy(tc)).
|
||||
readBlob(vaddr, buf, len);
|
||||
os->write(buf, len);
|
||||
if (os->fail() || os->bad())
|
||||
panic("Error while doing writefile!\n");
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "dev/net/dist_iface.hh"
|
||||
#include "mem/page_table.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
#include "sim/process.hh"
|
||||
#include "sim/proxy_ptr.hh"
|
||||
@@ -96,7 +97,7 @@ exitFutexWake(ThreadContext *tc, VPtr<> addr, uint64_t tgid)
|
||||
BufferArg ctidBuf(addr, sizeof(long));
|
||||
long *ctid = (long *)ctidBuf.bufferPtr();
|
||||
*ctid = 0;
|
||||
ctidBuf.copyOut(tc->getVirtProxy());
|
||||
ctidBuf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
FutexMap &futex_map = tc->getSystemPtr()->futexMap;
|
||||
// Wake one of the waiting threads.
|
||||
@@ -320,7 +321,7 @@ _llseekFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
// Assuming that the size of loff_t is 64 bits on the target platform
|
||||
BufferArg result_buf(result_ptr, sizeof(result));
|
||||
std::memcpy(result_buf.bufferPtr(), &result, sizeof(result));
|
||||
result_buf.copyOut(tc->getVirtProxy());
|
||||
result_buf.copyOut(SETranslatingPortProxy(tc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -353,7 +354,7 @@ gethostnameFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
{
|
||||
BufferArg name(buf_ptr, name_len);
|
||||
strncpy((char *)name.bufferPtr(), hostname, name_len);
|
||||
name.copyOut(tc->getVirtProxy());
|
||||
name.copyOut(SETranslatingPortProxy(tc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -382,7 +383,7 @@ getcwdFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
}
|
||||
}
|
||||
|
||||
buf.copyOut(tc->getVirtProxy());
|
||||
buf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return (result == -1) ? -errno : result;
|
||||
}
|
||||
@@ -394,7 +395,7 @@ readlinkFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -440,7 +441,7 @@ readlinkFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
(char*)buf.bufferPtr());
|
||||
}
|
||||
|
||||
buf.copyOut(tc->getVirtProxy());
|
||||
buf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return (result == -1) ? -errno : result;
|
||||
}
|
||||
@@ -451,7 +452,7 @@ unlinkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
path = p->checkPathRedirect(path);
|
||||
@@ -468,7 +469,7 @@ linkFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string new_path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
auto &virt_mem = tc->getVirtProxy();
|
||||
SETranslatingPortProxy virt_mem(tc);
|
||||
if (!virt_mem.tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
if (!virt_mem.tryReadString(new_path, new_pathname))
|
||||
@@ -489,7 +490,7 @@ symlinkFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string new_path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
auto &virt_mem = tc->getVirtProxy();
|
||||
SETranslatingPortProxy virt_mem(tc);
|
||||
if (!virt_mem.tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
if (!virt_mem.tryReadString(new_path, new_pathname))
|
||||
@@ -507,7 +508,7 @@ mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
path = p->checkPathRedirect(path);
|
||||
@@ -522,12 +523,13 @@ renameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> oldpath,
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
std::string old_name;
|
||||
if (!tc->getVirtProxy().tryReadString(old_name, oldpath))
|
||||
if (!proxy.tryReadString(old_name, oldpath))
|
||||
return -EFAULT;
|
||||
|
||||
std::string new_name;
|
||||
if (!tc->getVirtProxy().tryReadString(new_name, newpath))
|
||||
if (!proxy.tryReadString(new_name, newpath))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -545,7 +547,7 @@ truncateFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname,
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -576,7 +578,7 @@ truncate64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto process = tc->getProcessPtr();
|
||||
std::string path;
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -627,7 +629,7 @@ chownFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
/* XXX endianess */
|
||||
@@ -840,7 +842,7 @@ pipe2Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr, int flags)
|
||||
int *buf_ptr = (int*)tgt_handle.bufferPtr();
|
||||
buf_ptr[0] = tgt_fds[0];
|
||||
buf_ptr[1] = tgt_fds[1];
|
||||
tgt_handle.copyOut(tc->getVirtProxy());
|
||||
tgt_handle.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
if (flags) {
|
||||
// pipe2 only uses O_NONBLOCK, O_CLOEXEC, and (O_NONBLOCK | O_CLOEXEC)
|
||||
@@ -1000,7 +1002,7 @@ accessFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
{
|
||||
std::string path;
|
||||
auto p = tc->getProcessPtr();
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1016,7 +1018,7 @@ mknodFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
path = p->checkPathRedirect(path);
|
||||
@@ -1030,7 +1032,7 @@ chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
std::string tgt_cwd;
|
||||
@@ -1057,7 +1059,7 @@ rmdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
|
||||
{
|
||||
auto p = tc->getProcessPtr();
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
path = p->checkPathRedirect(path);
|
||||
@@ -1104,7 +1106,7 @@ getdentsImpl(SyscallDesc *desc, ThreadContext *tc,
|
||||
traversed += host_reclen;
|
||||
}
|
||||
|
||||
buf_arg.copyOut(tc->getVirtProxy());
|
||||
buf_arg.copyOut(SETranslatingPortProxy(tc));
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
@@ -1167,7 +1169,7 @@ bindFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
BufferArg bufSock(buf_ptr, addrlen);
|
||||
bufSock.copyIn(tc->getVirtProxy());
|
||||
bufSock.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
|
||||
if (!sfdp)
|
||||
@@ -1203,7 +1205,7 @@ connectFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
BufferArg addr(buf_ptr, addrlen);
|
||||
addr.copyIn(tc->getVirtProxy());
|
||||
addr.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
|
||||
if (!sfdp)
|
||||
@@ -1232,19 +1234,21 @@ recvfromFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
// Reserve buffer space.
|
||||
BufferArg bufrBuf(bufrPtr, bufrLen);
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
// Get address length.
|
||||
socklen_t addrLen = 0;
|
||||
if (addrlenPtr != 0) {
|
||||
// Read address length parameter.
|
||||
BufferArg addrlenBuf(addrlenPtr, sizeof(socklen_t));
|
||||
addrlenBuf.copyIn(tc->getVirtProxy());
|
||||
addrlenBuf.copyIn(proxy);
|
||||
addrLen = *((socklen_t *)addrlenBuf.bufferPtr());
|
||||
}
|
||||
|
||||
struct sockaddr sa, *sap = NULL;
|
||||
if (addrLen != 0) {
|
||||
BufferArg addrBuf(addrPtr, addrLen);
|
||||
addrBuf.copyIn(tc->getVirtProxy());
|
||||
addrBuf.copyIn(proxy);
|
||||
memcpy(&sa, (struct sockaddr *)addrBuf.bufferPtr(),
|
||||
sizeof(struct sockaddr));
|
||||
sap = &sa;
|
||||
@@ -1258,20 +1262,20 @@ recvfromFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -errno;
|
||||
|
||||
// Pass the received data out.
|
||||
bufrBuf.copyOut(tc->getVirtProxy());
|
||||
bufrBuf.copyOut(proxy);
|
||||
|
||||
// Copy address to addrPtr and pass it on.
|
||||
if (sap != NULL) {
|
||||
BufferArg addrBuf(addrPtr, addrLen);
|
||||
memcpy(addrBuf.bufferPtr(), sap, sizeof(sa));
|
||||
addrBuf.copyOut(tc->getVirtProxy());
|
||||
addrBuf.copyOut(proxy);
|
||||
}
|
||||
|
||||
// Copy len to addrlenPtr and pass it on.
|
||||
if (addrLen != 0) {
|
||||
BufferArg addrlenBuf(addrlenPtr, sizeof(socklen_t));
|
||||
*(socklen_t *)addrlenBuf.bufferPtr() = addrLen;
|
||||
addrlenBuf.copyOut(tc->getVirtProxy());
|
||||
addrlenBuf.copyOut(proxy);
|
||||
}
|
||||
|
||||
return recvd_size;
|
||||
@@ -1291,13 +1295,13 @@ sendtoFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
// Reserve buffer space.
|
||||
BufferArg bufrBuf(bufrPtr, bufrLen);
|
||||
bufrBuf.copyIn(tc->getVirtProxy());
|
||||
bufrBuf.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
struct sockaddr sa, *sap = nullptr;
|
||||
memset(&sa, 0, sizeof(sockaddr));
|
||||
if (addrLen != 0) {
|
||||
BufferArg addrBuf(addrPtr, addrLen);
|
||||
addrBuf.copyIn(tc->getVirtProxy());
|
||||
addrBuf.copyIn(SETranslatingPortProxy(tc));
|
||||
memcpy(&sa, (sockaddr*)addrBuf.bufferPtr(), addrLen);
|
||||
sap = &sa;
|
||||
}
|
||||
@@ -1338,13 +1342,15 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
* };
|
||||
*/
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
/**
|
||||
* The plan with this system call is to replace all of the pointers in the
|
||||
* structure and the substructure with BufferArg class pointers. We will
|
||||
* copy every field from the structures into our BufferArg classes.
|
||||
*/
|
||||
BufferArg msgBuf(msgPtr, sizeof(struct msghdr));
|
||||
msgBuf.copyIn(tc->getVirtProxy());
|
||||
msgBuf.copyIn(proxy);
|
||||
struct msghdr *msgHdr = (struct msghdr *)msgBuf.bufferPtr();
|
||||
|
||||
/**
|
||||
@@ -1364,7 +1370,7 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
if (msgHdr->msg_name) {
|
||||
/*1*/msg_name_phold = (Addr)msgHdr->msg_name;
|
||||
/*2*/nameBuf = new BufferArg(msg_name_phold, msgHdr->msg_namelen);
|
||||
/*3*/nameBuf->copyIn(tc->getVirtProxy());
|
||||
/*3*/nameBuf->copyIn(proxy);
|
||||
/*4*/msgHdr->msg_name = nameBuf->bufferPtr();
|
||||
}
|
||||
|
||||
@@ -1384,14 +1390,14 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
/*1*/msg_iov_phold = (Addr)msgHdr->msg_iov;
|
||||
/*2*/iovBuf = new BufferArg(msg_iov_phold, msgHdr->msg_iovlen *
|
||||
sizeof(struct iovec));
|
||||
/*3*/iovBuf->copyIn(tc->getVirtProxy());
|
||||
/*3*/iovBuf->copyIn(proxy);
|
||||
for (int i = 0; i < msgHdr->msg_iovlen; i++) {
|
||||
if (((struct iovec *)iovBuf->bufferPtr())[i].iov_base) {
|
||||
/*1*/iovec_base_phold[i] =
|
||||
(Addr)((struct iovec *)iovBuf->bufferPtr())[i].iov_base;
|
||||
/*2*/iovecBuf[i] = new BufferArg(iovec_base_phold[i],
|
||||
((struct iovec *)iovBuf->bufferPtr())[i].iov_len);
|
||||
/*3*/iovecBuf[i]->copyIn(tc->getVirtProxy());
|
||||
/*3*/iovecBuf[i]->copyIn(proxy);
|
||||
/*4*/((struct iovec *)iovBuf->bufferPtr())[i].iov_base =
|
||||
iovecBuf[i]->bufferPtr();
|
||||
}
|
||||
@@ -1407,7 +1413,7 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
/*1*/msg_control_phold = (Addr)msgHdr->msg_control;
|
||||
/*2*/controlBuf = new BufferArg(msg_control_phold,
|
||||
CMSG_ALIGN(msgHdr->msg_controllen));
|
||||
/*3*/controlBuf->copyIn(tc->getVirtProxy());
|
||||
/*3*/controlBuf->copyIn(proxy);
|
||||
/*4*/msgHdr->msg_control = controlBuf->bufferPtr();
|
||||
}
|
||||
|
||||
@@ -1417,7 +1423,7 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -errno;
|
||||
|
||||
if (msgHdr->msg_name) {
|
||||
nameBuf->copyOut(tc->getVirtProxy());
|
||||
nameBuf->copyOut(proxy);
|
||||
delete(nameBuf);
|
||||
msgHdr->msg_name = (void *)msg_name_phold;
|
||||
}
|
||||
@@ -1425,24 +1431,24 @@ recvmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
if (msgHdr->msg_iov) {
|
||||
for (int i = 0; i< msgHdr->msg_iovlen; i++) {
|
||||
if (((struct iovec *)iovBuf->bufferPtr())[i].iov_base) {
|
||||
iovecBuf[i]->copyOut(tc->getVirtProxy());
|
||||
iovecBuf[i]->copyOut(proxy);
|
||||
delete iovecBuf[i];
|
||||
((struct iovec *)iovBuf->bufferPtr())[i].iov_base =
|
||||
(void *)iovec_base_phold[i];
|
||||
}
|
||||
}
|
||||
iovBuf->copyOut(tc->getVirtProxy());
|
||||
iovBuf->copyOut(proxy);
|
||||
delete iovBuf;
|
||||
msgHdr->msg_iov = (struct iovec *)msg_iov_phold;
|
||||
}
|
||||
|
||||
if (msgHdr->msg_control) {
|
||||
controlBuf->copyOut(tc->getVirtProxy());
|
||||
controlBuf->copyOut(proxy);
|
||||
delete(controlBuf);
|
||||
msgHdr->msg_control = (void *)msg_control_phold;
|
||||
}
|
||||
|
||||
msgBuf.copyOut(tc->getVirtProxy());
|
||||
msgBuf.copyOut(proxy);
|
||||
|
||||
return recvd_size;
|
||||
}
|
||||
@@ -1458,11 +1464,13 @@ sendmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -EBADF;
|
||||
int sim_fd = sfdp->getSimFD();
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
/**
|
||||
* Reserve buffer space.
|
||||
*/
|
||||
BufferArg msgBuf(msgPtr, sizeof(struct msghdr));
|
||||
msgBuf.copyIn(tc->getVirtProxy());
|
||||
msgBuf.copyIn(proxy);
|
||||
struct msghdr msgHdr = *((struct msghdr *)msgBuf.bufferPtr());
|
||||
|
||||
/**
|
||||
@@ -1471,7 +1479,7 @@ sendmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
*/
|
||||
struct iovec *iovPtr = msgHdr.msg_iov;
|
||||
BufferArg iovBuf((Addr)iovPtr, sizeof(struct iovec) * msgHdr.msg_iovlen);
|
||||
iovBuf.copyIn(tc->getVirtProxy());
|
||||
iovBuf.copyIn(proxy);
|
||||
struct iovec *iov = (struct iovec *)iovBuf.bufferPtr();
|
||||
msgHdr.msg_iov = iov;
|
||||
|
||||
@@ -1491,7 +1499,7 @@ sendmsgFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
for (int iovIndex = 0 ; iovIndex < msgHdr.msg_iovlen; iovIndex++) {
|
||||
Addr basePtr = (Addr) iov[iovIndex].iov_base;
|
||||
bufferArray[iovIndex] = new BufferArg(basePtr, iov[iovIndex].iov_len);
|
||||
bufferArray[iovIndex]->copyIn(tc->getVirtProxy());
|
||||
bufferArray[iovIndex]->copyIn(proxy);
|
||||
iov[iovIndex].iov_base = bufferArray[iovIndex]->bufferPtr();
|
||||
}
|
||||
|
||||
@@ -1541,15 +1549,17 @@ getsockoptFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
if (status == -1)
|
||||
return -errno;
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
// copy val to valPtr and pass it on
|
||||
BufferArg valBuf(valPtr, sizeof(val));
|
||||
memcpy(valBuf.bufferPtr(), &val, sizeof(val));
|
||||
valBuf.copyOut(tc->getVirtProxy());
|
||||
valBuf.copyOut(proxy);
|
||||
|
||||
// copy len to lenPtr and pass it on
|
||||
BufferArg lenBuf(lenPtr, sizeof(len));
|
||||
memcpy(lenBuf.bufferPtr(), &len, sizeof(len));
|
||||
lenBuf.copyOut(tc->getVirtProxy());
|
||||
lenBuf.copyOut(proxy);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1568,9 +1578,11 @@ getsocknameFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
// lenPtr is an in-out paramenter:
|
||||
// sending the address length in, conveying the final length out
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
// Read in the value of len from the passed pointer.
|
||||
BufferArg lenBuf(lenPtr, sizeof(socklen_t));
|
||||
lenBuf.copyIn(tc->getVirtProxy());
|
||||
lenBuf.copyIn(proxy);
|
||||
socklen_t len = *(socklen_t *)lenBuf.bufferPtr();
|
||||
|
||||
struct sockaddr sa;
|
||||
@@ -1582,11 +1594,11 @@ getsocknameFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
// Copy address to addrPtr and pass it on.
|
||||
BufferArg addrBuf(addrPtr, sizeof(sa));
|
||||
memcpy(addrBuf.bufferPtr(), &sa, sizeof(sa));
|
||||
addrBuf.copyOut(tc->getVirtProxy());
|
||||
addrBuf.copyOut(proxy);
|
||||
|
||||
// Copy len to lenPtr and pass it on.
|
||||
*(socklen_t *)lenBuf.bufferPtr() = len;
|
||||
lenBuf.copyOut(tc->getVirtProxy());
|
||||
lenBuf.copyOut(proxy);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1602,8 +1614,10 @@ getpeernameFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -EBADF;
|
||||
int sim_fd = sfdp->getSimFD();
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
|
||||
BufferArg bufAddrlen(addrlenPtr, sizeof(unsigned));
|
||||
bufAddrlen.copyIn(tc->getVirtProxy());
|
||||
bufAddrlen.copyIn(proxy);
|
||||
BufferArg bufSock(sockAddrPtr, *(unsigned *)bufAddrlen.bufferPtr());
|
||||
|
||||
int retval = getpeername(sim_fd,
|
||||
@@ -1611,8 +1625,8 @@ getpeernameFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
(unsigned *)bufAddrlen.bufferPtr());
|
||||
|
||||
if (retval != -1) {
|
||||
bufSock.copyOut(tc->getVirtProxy());
|
||||
bufAddrlen.copyOut(tc->getVirtProxy());
|
||||
bufSock.copyOut(proxy);
|
||||
bufAddrlen.copyOut(proxy);
|
||||
}
|
||||
|
||||
return (retval == -1) ? -errno : retval;
|
||||
@@ -1626,7 +1640,7 @@ setsockoptFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
BufferArg valBuf(valPtr, len);
|
||||
valBuf.copyIn(tc->getVirtProxy());
|
||||
valBuf.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
|
||||
if (!sfdp)
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "kern/linux/linux.hh"
|
||||
#include "mem/page_table.hh"
|
||||
#include "mem/se_translating_port_proxy.hh"
|
||||
#include "params/Process.hh"
|
||||
#include "sim/emul_driver.hh"
|
||||
#include "sim/futex_map.hh"
|
||||
@@ -393,7 +394,7 @@ futexFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
if (OS::TGT_FUTEX_WAIT == op || OS::TGT_FUTEX_WAIT_BITSET == op) {
|
||||
// Ensure futex system call accessed atomically.
|
||||
BufferArg buf(uaddr, sizeof(int));
|
||||
buf.copyIn(tc->getVirtProxy());
|
||||
buf.copyIn(SETranslatingPortProxy(tc));
|
||||
int mem_val = *(int*)buf.bufferPtr();
|
||||
|
||||
/*
|
||||
@@ -420,7 +421,7 @@ futexFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
// Ensure futex system call accessed atomically.
|
||||
BufferArg buf(uaddr, sizeof(int));
|
||||
buf.copyIn(tc->getVirtProxy());
|
||||
buf.copyIn(SETranslatingPortProxy(tc));
|
||||
int mem_val = *(int*)buf.bufferPtr();
|
||||
/*
|
||||
* For CMP_REQUEUE, the whole operation is only started only if
|
||||
@@ -453,7 +454,7 @@ futexFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
*/
|
||||
// get value from simulated-space
|
||||
BufferArg buf(uaddr2, sizeof(int));
|
||||
buf.copyIn(tc->getVirtProxy());
|
||||
buf.copyIn(SETranslatingPortProxy(tc));
|
||||
int oldval = *(int*)buf.bufferPtr();
|
||||
int newval = oldval;
|
||||
// extract op, oparg, cmp, cmparg from val3
|
||||
@@ -477,7 +478,7 @@ futexFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
newval ^= wake_oparg;
|
||||
// copy updated value back to simulated-space
|
||||
*(int*)buf.bufferPtr() = newval;
|
||||
buf.copyOut(tc->getVirtProxy());
|
||||
buf.copyOut(SETranslatingPortProxy(tc));
|
||||
// perform the first wake-up
|
||||
int woken1 = futex_map.wakeup(uaddr, process->tgid(), val);
|
||||
int woken2 = 0;
|
||||
@@ -702,20 +703,20 @@ ioctlFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
switch (req) {
|
||||
case SIOCGIFCONF: {
|
||||
BufferArg conf_arg(addr, sizeof(ifconf));
|
||||
conf_arg.copyIn(tc->getVirtProxy());
|
||||
conf_arg.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
ifconf *conf = (ifconf*)conf_arg.bufferPtr();
|
||||
Addr ifc_buf_addr = (Addr)conf->ifc_buf;
|
||||
BufferArg ifc_buf_arg(ifc_buf_addr, conf->ifc_len);
|
||||
ifc_buf_arg.copyIn(tc->getVirtProxy());
|
||||
ifc_buf_arg.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
conf->ifc_buf = (char*)ifc_buf_arg.bufferPtr();
|
||||
|
||||
status = ioctl(sfdp->getSimFD(), req, conf_arg.bufferPtr());
|
||||
if (status != -1) {
|
||||
conf->ifc_buf = (char*)ifc_buf_addr;
|
||||
ifc_buf_arg.copyOut(tc->getVirtProxy());
|
||||
conf_arg.copyOut(tc->getVirtProxy());
|
||||
ifc_buf_arg.copyOut(SETranslatingPortProxy(tc));
|
||||
conf_arg.copyOut(SETranslatingPortProxy(tc));
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -731,11 +732,11 @@ ioctlFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
#endif
|
||||
case SIOCGIFMTU: {
|
||||
BufferArg req_arg(addr, sizeof(ifreq));
|
||||
req_arg.copyIn(tc->getVirtProxy());
|
||||
req_arg.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
status = ioctl(sfdp->getSimFD(), req, req_arg.bufferPtr());
|
||||
if (status != -1)
|
||||
req_arg.copyOut(tc->getVirtProxy());
|
||||
req_arg.copyOut(SETranslatingPortProxy(tc));
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -763,7 +764,7 @@ openatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
* string from that memory space into the host's working memory space.
|
||||
*/
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
#ifdef __CYGWIN32__
|
||||
@@ -981,7 +982,7 @@ chmodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
mode_t hostMode = 0;
|
||||
@@ -1008,7 +1009,7 @@ pollFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
BufferArg fdsBuf(fdsPtr, sizeof(struct pollfd) * nfds);
|
||||
fdsBuf.copyIn(tc->getVirtProxy());
|
||||
fdsBuf.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
/**
|
||||
* Record the target file descriptors in a local variable. We need to
|
||||
@@ -1068,7 +1069,7 @@ pollFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
* Copy out the pollfd struct because the host may have updated fields
|
||||
* in the structure.
|
||||
*/
|
||||
fdsBuf.copyOut(tc->getVirtProxy());
|
||||
fdsBuf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -1184,7 +1185,7 @@ statFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1211,7 +1212,7 @@ stat64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1246,7 +1247,7 @@ fstatat64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
warn("fstatat64: first argument not AT_FDCWD; unlikely to work");
|
||||
|
||||
std::string path;
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1308,7 +1309,7 @@ lstatFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1334,7 +1335,7 @@ lstat64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1392,7 +1393,7 @@ statfsFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
// Adjust path for cwd and redirection
|
||||
@@ -1480,7 +1481,7 @@ cloneFunc(SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack,
|
||||
BufferArg ptidBuf(ptidPtr, sizeof(long));
|
||||
long *ptid = (long *)ptidBuf.bufferPtr();
|
||||
*ptid = cp->pid();
|
||||
ptidBuf.copyOut(tc->getVirtProxy());
|
||||
ptidBuf.copyOut(SETranslatingPortProxy(tc));
|
||||
}
|
||||
|
||||
if (flags & OS::TGT_CLONE_THREAD) {
|
||||
@@ -1503,7 +1504,7 @@ cloneFunc(SyscallDesc *desc, ThreadContext *tc, RegVal flags, RegVal newStack,
|
||||
BufferArg ctidBuf(ctidPtr, sizeof(long));
|
||||
long *ctid = (long *)ctidBuf.bufferPtr();
|
||||
*ctid = cp->pid();
|
||||
ctidBuf.copyOut(ctc->getVirtProxy());
|
||||
ctidBuf.copyOut(SETranslatingPortProxy(ctc));
|
||||
}
|
||||
|
||||
if (flags & OS::TGT_CLONE_CHILD_CLEARTID)
|
||||
@@ -1569,7 +1570,7 @@ readvFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -EBADF;
|
||||
int sim_fd = ffdp->getSimFD();
|
||||
|
||||
PortProxy &prox = tc->getVirtProxy();
|
||||
SETranslatingPortProxy prox(tc);
|
||||
typename OS::tgt_iovec tiov[count];
|
||||
struct iovec hiov[count];
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
@@ -1606,7 +1607,7 @@ writevFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
return -EBADF;
|
||||
int sim_fd = hbfdp->getSimFD();
|
||||
|
||||
PortProxy &prox = tc->getVirtProxy();
|
||||
SETranslatingPortProxy prox(tc);
|
||||
struct iovec hiov[count];
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
typename OS::tgt_iovec tiov;
|
||||
@@ -1786,7 +1787,7 @@ pread64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
int bytes_read = pread(sim_fd, bufArg.bufferPtr(), nbytes, offset);
|
||||
|
||||
bufArg.copyOut(tc->getVirtProxy());
|
||||
bufArg.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return (bytes_read == -1) ? -errno : bytes_read;
|
||||
}
|
||||
@@ -1804,7 +1805,7 @@ pwrite64Func(SyscallDesc *desc, ThreadContext *tc,
|
||||
int sim_fd = ffdp->getSimFD();
|
||||
|
||||
BufferArg bufArg(bufPtr, nbytes);
|
||||
bufArg.copyIn(tc->getVirtProxy());
|
||||
bufArg.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
int bytes_written = pwrite(sim_fd, bufArg.bufferPtr(), nbytes, offset);
|
||||
|
||||
@@ -1946,7 +1947,7 @@ utimesFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname,
|
||||
std::string path;
|
||||
auto process = tc->getProcessPtr();
|
||||
|
||||
if (!tc->getVirtProxy().tryReadString(path, pathname))
|
||||
if (!SETranslatingPortProxy(tc).tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
struct timeval hostTimeval[2];
|
||||
@@ -1974,7 +1975,7 @@ execveFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
auto p = tc->getProcessPtr();
|
||||
|
||||
std::string path;
|
||||
PortProxy & mem_proxy = tc->getVirtProxy();
|
||||
SETranslatingPortProxy mem_proxy(tc);
|
||||
if (!mem_proxy.tryReadString(path, pathname))
|
||||
return -EFAULT;
|
||||
|
||||
@@ -2129,10 +2130,10 @@ timeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> taddr)
|
||||
getElapsedTimeMicro(sec, usec);
|
||||
sec += seconds_since_epoch;
|
||||
|
||||
SETranslatingPortProxy p(tc);
|
||||
if (taddr != 0) {
|
||||
typename OS::time_t t = sec;
|
||||
t = htog(t, OS::byteOrder);
|
||||
PortProxy &p = tc->getVirtProxy();
|
||||
p.writeBlob(taddr, &t, (int)sizeof(typename OS::time_t));
|
||||
}
|
||||
return sec;
|
||||
@@ -2217,7 +2218,7 @@ socketpairFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
fds[0] = p->fds->allocFD(sfdp1);
|
||||
auto sfdp2 = std::make_shared<SocketFDEntry>(fds[1], domain, type, prot);
|
||||
fds[1] = p->fds->allocFD(sfdp2);
|
||||
svBuf.copyOut(tc->getVirtProxy());
|
||||
svBuf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -2418,7 +2419,7 @@ readFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int bytes_read = read(sim_fd, buf_arg.bufferPtr(), nbytes);
|
||||
|
||||
if (bytes_read > 0)
|
||||
buf_arg.copyOut(tc->getVirtProxy());
|
||||
buf_arg.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
return (bytes_read == -1) ? -errno : bytes_read;
|
||||
}
|
||||
@@ -2436,7 +2437,7 @@ writeFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
int sim_fd = hbfdp->getSimFD();
|
||||
|
||||
BufferArg buf_arg(buf_ptr, nbytes);
|
||||
buf_arg.copyIn(tc->getVirtProxy());
|
||||
buf_arg.copyIn(SETranslatingPortProxy(tc));
|
||||
|
||||
struct pollfd pfd;
|
||||
pfd.fd = sim_fd;
|
||||
@@ -2512,7 +2513,7 @@ success:
|
||||
const int EXITED = 0;
|
||||
BufferArg statusBuf(statPtr, sizeof(int));
|
||||
*(int *)statusBuf.bufferPtr() = EXITED;
|
||||
statusBuf.copyOut(tc->getVirtProxy());
|
||||
statusBuf.copyOut(SETranslatingPortProxy(tc));
|
||||
|
||||
// Return the child PID.
|
||||
pid_t retval = iter->sender->pid();
|
||||
@@ -2552,14 +2553,14 @@ acceptFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
if (lenPtr) {
|
||||
lenBufPtr = new BufferArg(lenPtr, sizeof(socklen_t));
|
||||
lenBufPtr->copyIn(tc->getVirtProxy());
|
||||
lenBufPtr->copyIn(SETranslatingPortProxy(tc));
|
||||
memcpy(&addrLen, (socklen_t *)lenBufPtr->bufferPtr(),
|
||||
sizeof(socklen_t));
|
||||
}
|
||||
|
||||
if (addrPtr) {
|
||||
addrBufPtr = new BufferArg(addrPtr, sizeof(struct sockaddr));
|
||||
addrBufPtr->copyIn(tc->getVirtProxy());
|
||||
addrBufPtr->copyIn(SETranslatingPortProxy(tc));
|
||||
memcpy(&sa, (struct sockaddr *)addrBufPtr->bufferPtr(),
|
||||
sizeof(struct sockaddr));
|
||||
}
|
||||
@@ -2571,13 +2572,13 @@ acceptFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
|
||||
if (addrPtr) {
|
||||
memcpy(addrBufPtr->bufferPtr(), &sa, sizeof(sa));
|
||||
addrBufPtr->copyOut(tc->getVirtProxy());
|
||||
addrBufPtr->copyOut(SETranslatingPortProxy(tc));
|
||||
delete(addrBufPtr);
|
||||
}
|
||||
|
||||
if (lenPtr) {
|
||||
*(socklen_t *)lenBufPtr->bufferPtr() = addrLen;
|
||||
lenBufPtr->copyOut(tc->getVirtProxy());
|
||||
lenBufPtr->copyOut(SETranslatingPortProxy(tc));
|
||||
delete(lenBufPtr);
|
||||
}
|
||||
|
||||
@@ -2623,12 +2624,13 @@ schedGetaffinityFunc(SyscallDesc *desc, ThreadContext *tc,
|
||||
if (cpusetsize < CPU_ALLOC_SIZE(tc->getSystemPtr()->threads.size()))
|
||||
return -EINVAL;
|
||||
|
||||
SETranslatingPortProxy proxy(tc);
|
||||
BufferArg maskBuf(cpu_set_mask, cpusetsize);
|
||||
maskBuf.copyIn(tc->getVirtProxy());
|
||||
maskBuf.copyIn(proxy);
|
||||
for (int i = 0; i < tc->getSystemPtr()->threads.size(); i++) {
|
||||
CPU_SET(i, (cpu_set_t *)maskBuf.bufferPtr());
|
||||
}
|
||||
maskBuf.copyOut(tc->getVirtProxy());
|
||||
maskBuf.copyOut(proxy);
|
||||
return CPU_ALLOC_SIZE(tc->getSystemPtr()->threads.size());
|
||||
#else
|
||||
warnUnsupportedOS("sched_getaffinity");
|
||||
|
||||
Reference in New Issue
Block a user