summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc6
-rw-r--r--src/sim/syscall_emul.cc112
-rw-r--r--src/sim/syscall_emul.hh128
3 files changed, 126 insertions, 120 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 81f2cd6aa..f974fa5ba 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -162,7 +162,7 @@ Process::clone(ThreadContext *otc, ThreadContext *ntc,
delete np->pTable;
np->pTable = pTable;
auto &proxy = dynamic_cast<SETranslatingPortProxy &>(
- ntc->getMemProxy());
+ ntc->getVirtProxy());
proxy.setPageTable(np->pTable);
np->memState = memState;
@@ -311,13 +311,13 @@ Process::replicatePage(Addr vaddr, Addr new_paddr, ThreadContext *old_tc,
// Read from old physical page.
uint8_t *buf_p = new uint8_t[PageBytes];
- old_tc->getMemProxy().readBlob(vaddr, buf_p, PageBytes);
+ old_tc->getVirtProxy().readBlob(vaddr, buf_p, PageBytes);
// 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, PageBytes, clobber);
- new_tc->getMemProxy().writeBlob(vaddr, buf_p, PageBytes);
+ new_tc->getVirtProxy().writeBlob(vaddr, buf_p, PageBytes);
delete[] buf_p;
}
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 7e8f9062a..eaf90ec76 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -90,7 +90,7 @@ exitFutexWake(ThreadContext *tc, Addr addr, uint64_t tgid)
BufferArg ctidBuf(addr, sizeof(long));
long *ctid = (long *)ctidBuf.bufferPtr();
*ctid = 0;
- ctidBuf.copyOut(tc->getMemProxy());
+ ctidBuf.copyOut(tc->getVirtProxy());
FutexMap &futex_map = tc->getSystemPtr()->futexMap;
// Wake one of the waiting threads.
@@ -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;
- PortProxy &tp = tc->getMemProxy();
+ PortProxy &tp = tc->getVirtProxy();
// split non-page aligned accesses
Addr next_page = roundUp(gen.addr(), PageBytes);
@@ -354,7 +354,7 @@ _llseekFunc(SyscallDesc *desc, int num, ThreadContext *tc)
// Assuming that the size of loff_t is 64 bits on the target platform
BufferArg result_buf(result_ptr, sizeof(result));
memcpy(result_buf.bufferPtr(), &result, sizeof(result));
- result_buf.copyOut(tc->getMemProxy());
+ result_buf.copyOut(tc->getVirtProxy());
return 0;
}
@@ -382,7 +382,7 @@ gethostnameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
strncpy((char *)name.bufferPtr(), hostname, name_len);
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
@@ -414,7 +414,7 @@ getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc)
}
}
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
return (result == -1) ? -errno : result;
}
@@ -431,7 +431,7 @@ readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, int index)
string path;
auto p = tc->getProcessPtr();
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for cwd and redirection
@@ -480,7 +480,7 @@ readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, int index)
(char*)buf.bufferPtr());
}
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
return (result == -1) ? -errno : result;
}
@@ -497,7 +497,7 @@ unlinkHelper(SyscallDesc *desc, int num, ThreadContext *tc, int index)
string path;
auto p = tc->getProcessPtr();
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
path = p->checkPathRedirect(path);
@@ -514,7 +514,7 @@ linkFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
- auto &virt_mem = tc->getMemProxy();
+ auto &virt_mem = tc->getVirtProxy();
if (!virt_mem.tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
if (!virt_mem.tryReadString(new_path, p->getSyscallArg(tc, index)))
@@ -535,7 +535,7 @@ symlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
- auto &virt_mem = tc->getMemProxy();
+ auto &virt_mem = tc->getVirtProxy();
if (!virt_mem.tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
if (!virt_mem.tryReadString(new_path, p->getSyscallArg(tc, index)))
@@ -554,7 +554,7 @@ mkdirFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
std::string path;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
path = p->checkPathRedirect(path);
@@ -571,13 +571,17 @@ renameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(old_name, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(
+ old_name, p->getSyscallArg(tc, index))) {
return -EFAULT;
+ }
string new_name;
- if (!tc->getMemProxy().tryReadString(new_name, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(
+ new_name, p->getSyscallArg(tc, index))) {
return -EFAULT;
+ }
// Adjust path for cwd and redirection
old_name = p->checkPathRedirect(old_name);
@@ -594,7 +598,7 @@ truncateFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
off_t length = p->getSyscallArg(tc, index);
@@ -630,8 +634,10 @@ truncate64Func(SyscallDesc *desc, int num, ThreadContext *tc)
auto process = tc->getProcessPtr();
string path;
- if (!tc->getMemProxy().tryReadString(path, process->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(
+ path, process->getSyscallArg(tc, index))) {
return -EFAULT;
+ }
int64_t length = process->getSyscallArg(tc, index, 64);
@@ -685,7 +691,7 @@ chownFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
/* XXX endianess */
@@ -903,7 +909,7 @@ pipeImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, bool pseudoPipe)
int *buf_ptr = (int*)tgt_handle.bufferPtr();
buf_ptr[0] = tgt_fds[0];
buf_ptr[1] = tgt_fds[1];
- tgt_handle.copyOut(tc->getMemProxy());
+ tgt_handle.copyOut(tc->getVirtProxy());
return 0;
}
@@ -1081,7 +1087,7 @@ accessFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int index)
{
string path;
auto p = tc->getProcessPtr();
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
// Adjust path for cwd and redirection
@@ -1105,7 +1111,7 @@ mknodFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
std::string path;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
path = p->checkPathRedirect(path);
@@ -1122,7 +1128,7 @@ chdirFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
std::string path;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
std::string tgt_cwd;
@@ -1150,7 +1156,7 @@ rmdirFunc(SyscallDesc *desc, int num, ThreadContext *tc)
auto p = tc->getProcessPtr();
int index = 0;
std::string path;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
path = p->checkPathRedirect(path);
@@ -1199,7 +1205,7 @@ getdentsImpl(SyscallDesc *desc, int callnum, ThreadContext *tc)
traversed += host_reclen;
}
- buf_arg.copyOut(tc->getMemProxy());
+ buf_arg.copyOut(tc->getVirtProxy());
return status;
}
#endif
@@ -1262,7 +1268,7 @@ bindFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int addrlen = p->getSyscallArg(tc, index);
BufferArg bufSock(buf_ptr, addrlen);
- bufSock.copyIn(tc->getMemProxy());
+ bufSock.copyIn(tc->getVirtProxy());
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
if (!sfdp)
@@ -1304,7 +1310,7 @@ connectFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int addrlen = p->getSyscallArg(tc, index);
BufferArg addr(buf_ptr, addrlen);
- addr.copyIn(tc->getMemProxy());
+ addr.copyIn(tc->getVirtProxy());
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
if (!sfdp)
@@ -1343,14 +1349,14 @@ recvfromFunc(SyscallDesc *desc, int num, ThreadContext *tc)
if (addrlenPtr != 0) {
// Read address length parameter.
BufferArg addrlenBuf(addrlenPtr, sizeof(socklen_t));
- addrlenBuf.copyIn(tc->getMemProxy());
+ addrlenBuf.copyIn(tc->getVirtProxy());
addrLen = *((socklen_t *)addrlenBuf.bufferPtr());
}
struct sockaddr sa, *sap = NULL;
if (addrLen != 0) {
BufferArg addrBuf(addrPtr, addrLen);
- addrBuf.copyIn(tc->getMemProxy());
+ addrBuf.copyIn(tc->getVirtProxy());
memcpy(&sa, (struct sockaddr *)addrBuf.bufferPtr(),
sizeof(struct sockaddr));
sap = &sa;
@@ -1364,20 +1370,20 @@ recvfromFunc(SyscallDesc *desc, int num, ThreadContext *tc)
return -errno;
// Pass the received data out.
- bufrBuf.copyOut(tc->getMemProxy());
+ bufrBuf.copyOut(tc->getVirtProxy());
// Copy address to addrPtr and pass it on.
if (sap != NULL) {
BufferArg addrBuf(addrPtr, addrLen);
memcpy(addrBuf.bufferPtr(), sap, sizeof(sa));
- addrBuf.copyOut(tc->getMemProxy());
+ addrBuf.copyOut(tc->getVirtProxy());
}
// 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->getMemProxy());
+ addrlenBuf.copyOut(tc->getVirtProxy());
}
return recvd_size;
@@ -1402,13 +1408,13 @@ sendtoFunc(SyscallDesc *desc, int num, ThreadContext *tc)
// Reserve buffer space.
BufferArg bufrBuf(bufrPtr, bufrLen);
- bufrBuf.copyIn(tc->getMemProxy());
+ bufrBuf.copyIn(tc->getVirtProxy());
struct sockaddr sa, *sap = nullptr;
memset(&sa, 0, sizeof(sockaddr));
if (addrLen != 0) {
BufferArg addrBuf(addrPtr, addrLen);
- addrBuf.copyIn(tc->getMemProxy());
+ addrBuf.copyIn(tc->getVirtProxy());
memcpy(&sa, (sockaddr*)addrBuf.bufferPtr(), addrLen);
sap = &sa;
}
@@ -1458,7 +1464,7 @@ recvmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc)
* copy every field from the structures into our BufferArg classes.
*/
BufferArg msgBuf(msgPtr, sizeof(struct msghdr));
- msgBuf.copyIn(tc->getMemProxy());
+ msgBuf.copyIn(tc->getVirtProxy());
struct msghdr *msgHdr = (struct msghdr *)msgBuf.bufferPtr();
/**
@@ -1478,7 +1484,7 @@ recvmsgFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ /*3*/nameBuf->copyIn(tc->getVirtProxy());
/*4*/msgHdr->msg_name = nameBuf->bufferPtr();
}
@@ -1498,14 +1504,14 @@ recvmsgFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ /*3*/iovBuf->copyIn(tc->getVirtProxy());
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->getMemProxy());
+ /*3*/iovecBuf[i]->copyIn(tc->getVirtProxy());
/*4*/((struct iovec *)iovBuf->bufferPtr())[i].iov_base =
iovecBuf[i]->bufferPtr();
}
@@ -1521,7 +1527,7 @@ recvmsgFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ /*3*/controlBuf->copyIn(tc->getVirtProxy());
/*4*/msgHdr->msg_control = controlBuf->bufferPtr();
}
@@ -1531,7 +1537,7 @@ recvmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc)
return -errno;
if (msgHdr->msg_name) {
- nameBuf->copyOut(tc->getMemProxy());
+ nameBuf->copyOut(tc->getVirtProxy());
delete(nameBuf);
msgHdr->msg_name = (void *)msg_name_phold;
}
@@ -1539,24 +1545,24 @@ recvmsgFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ iovecBuf[i]->copyOut(tc->getVirtProxy());
delete iovecBuf[i];
((struct iovec *)iovBuf->bufferPtr())[i].iov_base =
(void *)iovec_base_phold[i];
}
}
- iovBuf->copyOut(tc->getMemProxy());
+ iovBuf->copyOut(tc->getVirtProxy());
delete iovBuf;
msgHdr->msg_iov = (struct iovec *)msg_iov_phold;
}
if (msgHdr->msg_control) {
- controlBuf->copyOut(tc->getMemProxy());
+ controlBuf->copyOut(tc->getVirtProxy());
delete(controlBuf);
msgHdr->msg_control = (void *)msg_control_phold;
}
- msgBuf.copyOut(tc->getMemProxy());
+ msgBuf.copyOut(tc->getVirtProxy());
return recvd_size;
}
@@ -1579,7 +1585,7 @@ sendmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc)
* Reserve buffer space.
*/
BufferArg msgBuf(msgPtr, sizeof(struct msghdr));
- msgBuf.copyIn(tc->getMemProxy());
+ msgBuf.copyIn(tc->getVirtProxy());
struct msghdr msgHdr = *((struct msghdr *)msgBuf.bufferPtr());
/**
@@ -1588,7 +1594,7 @@ sendmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc)
*/
struct iovec *iovPtr = msgHdr.msg_iov;
BufferArg iovBuf((Addr)iovPtr, sizeof(struct iovec) * msgHdr.msg_iovlen);
- iovBuf.copyIn(tc->getMemProxy());
+ iovBuf.copyIn(tc->getVirtProxy());
struct iovec *iov = (struct iovec *)iovBuf.bufferPtr();
msgHdr.msg_iov = iov;
@@ -1608,7 +1614,7 @@ sendmsgFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ bufferArray[iovIndex]->copyIn(tc->getVirtProxy());
iov[iovIndex].iov_base = bufferArray[iovIndex]->bufferPtr();
}
@@ -1664,12 +1670,12 @@ getsockoptFunc(SyscallDesc *desc, int num, ThreadContext *tc)
// copy val to valPtr and pass it on
BufferArg valBuf(valPtr, sizeof(val));
memcpy(valBuf.bufferPtr(), &val, sizeof(val));
- valBuf.copyOut(tc->getMemProxy());
+ valBuf.copyOut(tc->getVirtProxy());
// copy len to lenPtr and pass it on
BufferArg lenBuf(lenPtr, sizeof(len));
memcpy(lenBuf.bufferPtr(), &len, sizeof(len));
- lenBuf.copyOut(tc->getMemProxy());
+ lenBuf.copyOut(tc->getVirtProxy());
return status;
}
@@ -1693,7 +1699,7 @@ getsocknameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
// Read in the value of len from the passed pointer.
BufferArg lenBuf(lenPtr, sizeof(socklen_t));
- lenBuf.copyIn(tc->getMemProxy());
+ lenBuf.copyIn(tc->getVirtProxy());
socklen_t len = *(socklen_t *)lenBuf.bufferPtr();
struct sockaddr sa;
@@ -1705,11 +1711,11 @@ getsocknameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
// Copy address to addrPtr and pass it on.
BufferArg addrBuf(addrPtr, sizeof(sa));
memcpy(addrBuf.bufferPtr(), &sa, sizeof(sa));
- addrBuf.copyOut(tc->getMemProxy());
+ addrBuf.copyOut(tc->getVirtProxy());
// Copy len to lenPtr and pass it on.
*(socklen_t *)lenBuf.bufferPtr() = len;
- lenBuf.copyOut(tc->getMemProxy());
+ lenBuf.copyOut(tc->getVirtProxy());
return status;
}
@@ -1729,7 +1735,7 @@ getpeernameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int sim_fd = sfdp->getSimFD();
BufferArg bufAddrlen(addrlenPtr, sizeof(unsigned));
- bufAddrlen.copyIn(tc->getMemProxy());
+ bufAddrlen.copyIn(tc->getVirtProxy());
BufferArg bufSock(sockAddrPtr, *(unsigned *)bufAddrlen.bufferPtr());
int retval = getpeername(sim_fd,
@@ -1737,8 +1743,8 @@ getpeernameFunc(SyscallDesc *desc, int num, ThreadContext *tc)
(unsigned *)bufAddrlen.bufferPtr());
if (retval != -1) {
- bufSock.copyOut(tc->getMemProxy());
- bufAddrlen.copyOut(tc->getMemProxy());
+ bufSock.copyOut(tc->getVirtProxy());
+ bufAddrlen.copyOut(tc->getVirtProxy());
}
return (retval == -1) ? -errno : retval;
@@ -1756,7 +1762,7 @@ setsockoptFunc(SyscallDesc *desc, int num, ThreadContext *tc)
socklen_t len = p->getSyscallArg(tc, index);
BufferArg valBuf(valPtr, len);
- valBuf.copyIn(tc->getMemProxy());
+ valBuf.copyIn(tc->getVirtProxy());
auto sfdp = std::dynamic_pointer_cast<SocketFDEntry>((*p->fds)[tgt_fd]);
if (!sfdp)
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 4cb93c88f..d8270fb23 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -351,7 +351,7 @@ futexFunc(SyscallDesc *desc, int callnum, 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->getMemProxy());
+ buf.copyIn(tc->getVirtProxy());
int mem_val = *(int*)buf.bufferPtr();
/*
@@ -378,7 +378,7 @@ futexFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
// Ensure futex system call accessed atomically.
BufferArg buf(uaddr, sizeof(int));
- buf.copyIn(tc->getMemProxy());
+ buf.copyIn(tc->getVirtProxy());
int mem_val = *(int*)buf.bufferPtr();
/*
* For CMP_REQUEUE, the whole operation is only started only if
@@ -411,7 +411,7 @@ futexFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
*/
// get value from simulated-space
BufferArg buf(uaddr2, sizeof(int));
- buf.copyIn(tc->getMemProxy());
+ buf.copyIn(tc->getVirtProxy());
int oldval = *(int*)buf.bufferPtr();
int newval = oldval;
// extract op, oparg, cmp, cmparg from val3
@@ -435,7 +435,7 @@ futexFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
newval ^= wake_oparg;
// copy updated value back to simulated-space
*(int*)buf.bufferPtr() = newval;
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
// perform the first wake-up
int woken1 = futex_map.wakeup(uaddr, process->tgid(), val);
int woken2 = 0;
@@ -699,20 +699,20 @@ ioctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
case SIOCGIFCONF: {
Addr conf_addr = p->getSyscallArg(tc, index);
BufferArg conf_arg(conf_addr, sizeof(ifconf));
- conf_arg.copyIn(tc->getMemProxy());
+ conf_arg.copyIn(tc->getVirtProxy());
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->getMemProxy());
+ ifc_buf_arg.copyIn(tc->getVirtProxy());
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->getMemProxy());
- conf_arg.copyOut(tc->getMemProxy());
+ ifc_buf_arg.copyOut(tc->getVirtProxy());
+ conf_arg.copyOut(tc->getVirtProxy());
}
return status;
@@ -729,11 +729,11 @@ ioctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
case SIOCGIFMTU: {
Addr req_addr = p->getSyscallArg(tc, index);
BufferArg req_arg(req_addr, sizeof(ifreq));
- req_arg.copyIn(tc->getMemProxy());
+ req_arg.copyIn(tc->getVirtProxy());
status = ioctl(sfdp->getSimFD(), req, req_arg.bufferPtr());
if (status != -1)
- req_arg.copyOut(tc->getMemProxy());
+ req_arg.copyOut(tc->getVirtProxy());
return status;
}
}
@@ -768,7 +768,7 @@ openImpl(SyscallDesc *desc, int callnum, ThreadContext *tc, bool isopenat)
* string from that memory space into the host's working memory space.
*/
std::string path;
- if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index)))
+ if (!tc->getVirtProxy().tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
#ifdef __CYGWIN32__
@@ -976,7 +976,7 @@ renameatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
std::string old_name;
- if (!tc->getMemProxy().tryReadString(old_name,
+ if (!tc->getVirtProxy().tryReadString(old_name,
process->getSyscallArg(tc, index)))
return -EFAULT;
@@ -986,7 +986,7 @@ renameatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
std::string new_name;
- if (!tc->getMemProxy().tryReadString(new_name,
+ if (!tc->getVirtProxy().tryReadString(new_name,
process->getSyscallArg(tc, index)))
return -EFAULT;
@@ -1013,7 +1013,7 @@ sysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
sysinfo->totalram = process->system->memSize();
sysinfo->mem_unit = 1;
- sysinfo.copyOut(tc->getMemProxy());
+ sysinfo.copyOut(tc->getVirtProxy());
return 0;
}
@@ -1027,7 +1027,7 @@ chmodFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
@@ -1060,7 +1060,7 @@ pollFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int tmout = p->getSyscallArg(tc, index);
BufferArg fdsBuf(fdsPtr, sizeof(struct pollfd) * nfds);
- fdsBuf.copyIn(tc->getMemProxy());
+ fdsBuf.copyIn(tc->getVirtProxy());
/**
* Record the target file descriptors in a local variable. We need to
@@ -1120,7 +1120,7 @@ pollFunc(SyscallDesc *desc, int num, ThreadContext *tc)
* Copy out the pollfd struct because the host may have updated fields
* in the structure.
*/
- fdsBuf.copyOut(tc->getMemProxy());
+ fdsBuf.copyOut(tc->getVirtProxy());
return status;
}
@@ -1236,7 +1236,7 @@ statFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
@@ -1251,7 +1251,7 @@ statFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1266,7 +1266,7 @@ stat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index)))
return -EFAULT;
Addr bufPtr = process->getSyscallArg(tc, index);
@@ -1285,7 +1285,7 @@ stat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1303,7 +1303,7 @@ fstatat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
warn("fstatat64: first argument not AT_FDCWD; unlikely to work");
std::string path;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index)))
return -EFAULT;
Addr bufPtr = process->getSyscallArg(tc, index);
@@ -1322,7 +1322,7 @@ fstatat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1354,7 +1354,7 @@ fstat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf, (sim_fd == 1));
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf, (sim_fd == 1));
return 0;
}
@@ -1369,7 +1369,7 @@ lstatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
@@ -1384,7 +1384,7 @@ lstatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1398,7 +1398,7 @@ lstat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
@@ -1418,7 +1418,7 @@ lstat64Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1446,7 +1446,7 @@ fstatFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf, (sim_fd == 1));
+ copyOutStatBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf, (sim_fd == 1));
return 0;
}
@@ -1461,7 +1461,7 @@ statfsFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
@@ -1476,7 +1476,7 @@ statfsFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStatfsBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatfsBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
#else
warnUnsupportedOS("statfs");
@@ -1567,7 +1567,7 @@ cloneFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
BufferArg ptidBuf(ptidPtr, sizeof(long));
long *ptid = (long *)ptidBuf.bufferPtr();
*ptid = cp->pid();
- ptidBuf.copyOut(tc->getMemProxy());
+ ptidBuf.copyOut(tc->getVirtProxy());
}
if (flags & OS::TGT_CLONE_THREAD) {
@@ -1588,7 +1588,7 @@ cloneFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
BufferArg ctidBuf(ctidPtr, sizeof(long));
long *ctid = (long *)ctidBuf.bufferPtr();
*ctid = cp->pid();
- ctidBuf.copyOut(ctc->getMemProxy());
+ ctidBuf.copyOut(ctc->getVirtProxy());
}
if (flags & OS::TGT_CLONE_CHILD_CLEARTID)
@@ -1644,7 +1644,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (result < 0)
return -errno;
- copyOutStatfsBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatfsBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
@@ -1663,7 +1663,7 @@ readvFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
return -EBADF;
int sim_fd = ffdp->getSimFD();
- PortProxy &prox = tc->getMemProxy();
+ PortProxy &prox = tc->getVirtProxy();
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();
- PortProxy &prox = tc->getMemProxy();
+ PortProxy &prox = tc->getVirtProxy();
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.
- PortProxy &tp = tc->getMemProxy();
+ PortProxy &tp = tc->getVirtProxy();
if (tgt_flags & OS::TGT_MAP_ANONYMOUS) {
// In general, we should zero the mapped area for anonymous mappings,
// with something like:
@@ -1922,7 +1922,7 @@ pwrite64Func(SyscallDesc *desc, int num, ThreadContext *tc)
int sim_fd = ffdp->getSimFD();
BufferArg bufArg(bufPtr, nbytes);
- bufArg.copyIn(tc->getMemProxy());
+ bufArg.copyIn(tc->getVirtProxy());
int bytes_written = pwrite(sim_fd, bufArg.bufferPtr(), nbytes, offset);
@@ -1976,7 +1976,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
break;
}
- rlp.copyOut(tc->getMemProxy());
+ rlp.copyOut(tc->getVirtProxy());
return 0;
}
@@ -2017,7 +2017,7 @@ prlimitFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
return -EINVAL;
break;
}
- rlp.copyOut(tc->getMemProxy());
+ rlp.copyOut(tc->getVirtProxy());
}
return 0;
}
@@ -2037,7 +2037,7 @@ clock_gettimeFunc(SyscallDesc *desc, int num, ThreadContext *tc)
tp->tv_sec = TheISA::htog(tp->tv_sec);
tp->tv_nsec = TheISA::htog(tp->tv_nsec);
- tp.copyOut(tc->getMemProxy());
+ tp.copyOut(tc->getVirtProxy());
return 0;
}
@@ -2055,7 +2055,7 @@ clock_getresFunc(SyscallDesc *desc, int num, ThreadContext *tc)
tp->tv_sec = 0;
tp->tv_nsec = 1;
- tp.copyOut(tc->getMemProxy());
+ tp.copyOut(tc->getVirtProxy());
return 0;
}
@@ -2074,7 +2074,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
tp->tv_sec = TheISA::htog(tp->tv_sec);
tp->tv_usec = TheISA::htog(tp->tv_usec);
- tp.copyOut(tc->getMemProxy());
+ tp.copyOut(tc->getVirtProxy());
return 0;
}
@@ -2089,14 +2089,14 @@ utimesFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
TypedBufferArg<typename OS::timeval [2]>
tp(process->getSyscallArg(tc, index));
- tp.copyIn(tc->getMemProxy());
+ tp.copyIn(tc->getVirtProxy());
struct timeval hostTimeval[2];
for (int i = 0; i < 2; ++i) {
@@ -2124,7 +2124,7 @@ execveFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
int index = 0;
std::string path;
- PortProxy & mem_proxy = tc->getMemProxy();
+ PortProxy & mem_proxy = tc->getVirtProxy();
if (!mem_proxy.tryReadString(path, p->getSyscallArg(tc, index)))
return -EFAULT;
@@ -2254,7 +2254,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
who);
}
- rup.copyOut(tc->getMemProxy());
+ rup.copyOut(tc->getVirtProxy());
return 0;
}
@@ -2279,7 +2279,7 @@ timesFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
bufp->tms_utime = TheISA::htog(bufp->tms_utime);
// Write back
- bufp.copyOut(tc->getMemProxy());
+ bufp.copyOut(tc->getVirtProxy());
// Return clock ticks since system boot
return clocks;
@@ -2300,7 +2300,7 @@ timeFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
if (taddr != 0) {
typename OS::time_t t = sec;
t = TheISA::htog(t);
- PortProxy &p = tc->getMemProxy();
+ PortProxy &p = tc->getVirtProxy();
p.writeBlob(taddr, &t, (int)sizeof(typename OS::time_t));
}
return sec;
@@ -2398,7 +2398,7 @@ socketpairFunc(SyscallDesc *desc, int num, 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->getMemProxy());
+ svBuf.copyOut(tc->getVirtProxy());
return status;
}
@@ -2438,11 +2438,11 @@ selectFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
* Copy in the fd_set from the target.
*/
if (fds_read_ptr)
- rd_t.copyIn(tc->getMemProxy());
+ rd_t.copyIn(tc->getVirtProxy());
if (fds_writ_ptr)
- wr_t.copyIn(tc->getMemProxy());
+ wr_t.copyIn(tc->getVirtProxy());
if (fds_excp_ptr)
- ex_t.copyIn(tc->getMemProxy());
+ ex_t.copyIn(tc->getVirtProxy());
/**
* We need to translate the target file descriptor set into a host file
@@ -2588,13 +2588,13 @@ selectFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
}
if (fds_read_ptr)
- rd_t.copyOut(tc->getMemProxy());
+ rd_t.copyOut(tc->getVirtProxy());
if (fds_writ_ptr)
- wr_t.copyOut(tc->getMemProxy());
+ wr_t.copyOut(tc->getVirtProxy());
if (fds_excp_ptr)
- ex_t.copyOut(tc->getMemProxy());
+ ex_t.copyOut(tc->getVirtProxy());
if (time_val_ptr)
- tp.copyOut(tc->getMemProxy());
+ tp.copyOut(tc->getVirtProxy());
return retval;
}
@@ -2625,7 +2625,7 @@ readFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int bytes_read = read(sim_fd, buf_arg.bufferPtr(), nbytes);
if (bytes_read > 0)
- buf_arg.copyOut(tc->getMemProxy());
+ buf_arg.copyOut(tc->getVirtProxy());
return (bytes_read == -1) ? -errno : bytes_read;
}
@@ -2646,7 +2646,7 @@ writeFunc(SyscallDesc *desc, int num, ThreadContext *tc)
int sim_fd = hbfdp->getSimFD();
BufferArg buf_arg(buf_ptr, nbytes);
- buf_arg.copyIn(tc->getMemProxy());
+ buf_arg.copyIn(tc->getVirtProxy());
struct pollfd pfd;
pfd.fd = sim_fd;
@@ -2726,7 +2726,7 @@ success:
const int EXITED = 0;
BufferArg statusBuf(statPtr, sizeof(int));
*(int *)statusBuf.bufferPtr() = EXITED;
- statusBuf.copyOut(tc->getMemProxy());
+ statusBuf.copyOut(tc->getVirtProxy());
// Return the child PID.
pid_t retval = iter->sender->pid();
@@ -2770,14 +2770,14 @@ acceptFunc(SyscallDesc *desc, int num, ThreadContext *tc)
if (lenPtr) {
lenBufPtr = new BufferArg(lenPtr, sizeof(socklen_t));
- lenBufPtr->copyIn(tc->getMemProxy());
+ lenBufPtr->copyIn(tc->getVirtProxy());
memcpy(&addrLen, (socklen_t *)lenBufPtr->bufferPtr(),
sizeof(socklen_t));
}
if (addrPtr) {
addrBufPtr = new BufferArg(addrPtr, sizeof(struct sockaddr));
- addrBufPtr->copyIn(tc->getMemProxy());
+ addrBufPtr->copyIn(tc->getVirtProxy());
memcpy(&sa, (struct sockaddr *)addrBufPtr->bufferPtr(),
sizeof(struct sockaddr));
}
@@ -2789,13 +2789,13 @@ acceptFunc(SyscallDesc *desc, int num, ThreadContext *tc)
if (addrPtr) {
memcpy(addrBufPtr->bufferPtr(), &sa, sizeof(sa));
- addrBufPtr->copyOut(tc->getMemProxy());
+ addrBufPtr->copyOut(tc->getVirtProxy());
delete(addrBufPtr);
}
if (lenPtr) {
*(socklen_t *)lenBufPtr->bufferPtr() = addrLen;
- lenBufPtr->copyOut(tc->getMemProxy());
+ lenBufPtr->copyOut(tc->getVirtProxy());
delete(lenBufPtr);
}