strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "alpha");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
- fpcr.copyOut(tc->getMemProxy());
+ fpcr.copyOut(tc->getVirtProxy());
return 0;
}
case 14: { // SSI_IEEE_FP_CONTROL
TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
- fpcr.copyIn(tc->getMemProxy());
+ fpcr.copyIn(tc->getVirtProxy());
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
return 0;
BufferArg buf3(oldlenp, sizeof(size_t));
BufferArg buf4(newp, sizeof(size_t));
- buf.copyIn(tc->getMemProxy());
- buf2.copyIn(tc->getMemProxy());
- buf3.copyIn(tc->getMemProxy());
+ buf.copyIn(tc->getVirtProxy());
+ buf2.copyIn(tc->getVirtProxy());
+ buf3.copyIn(tc->getVirtProxy());
void *hnewp = NULL;
if (newp) {
- buf4.copyIn(tc->getMemProxy());
+ buf4.copyIn(tc->getVirtProxy());
hnewp = (void *)buf4.bufferPtr();
}
ret = sysctl((int *)hnamep, namelen, holdp, holdlenp, hnewp, newlen);
- buf.copyOut(tc->getMemProxy());
- buf2.copyOut(tc->getMemProxy());
- buf3.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
+ buf2.copyOut(tc->getVirtProxy());
+ buf3.copyOut(tc->getVirtProxy());
if (newp)
- buf4.copyOut(tc->getMemProxy());
+ buf4.copyOut(tc->getVirtProxy());
return (ret);
}
strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012");
strcpy(name->machine, "armv7l");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
strcpy(name->version, "#1 SMP Sat Dec 1 00:00:00 GMT 2012");
strcpy(name->machine, "armv8l");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
auto process = tc->getProcessPtr();
uint32_t tlsPtr = process->getSyscallArg(tc, index);
- tc->getMemProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0,
+ tc->getVirtProxy().writeBlob(ArmLinuxProcess32::commPage + 0x0ff0,
&tlsPtr, sizeof(tlsPtr));
tc->setMiscReg(MISCREG_TPIDRURO,tlsPtr);
return 0;
// 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->getMemProxy().writeBlob(commPage + addr,
- swiNeg1, sizeof(swiNeg1));
+ tc->getVirtProxy().writeBlob(commPage + addr,
+ swiNeg1, sizeof(swiNeg1));
}
uint8_t memory_barrier[] =
0x5f, 0xf0, 0x7f, 0xf5, // dmb
0x0e, 0xf0, 0xa0, 0xe1 // return
};
- tc->getMemProxy().writeBlob(commPage + 0x0fa0, memory_barrier,
- sizeof(memory_barrier));
+ tc->getVirtProxy().writeBlob(commPage + 0x0fa0, memory_barrier,
+ sizeof(memory_barrier));
uint8_t cmpxchg[] =
{
0x5f, 0xf0, 0x7f, 0xf5, // dmb
0x0e, 0xf0, 0xa0, 0xe1 // return
};
- tc->getMemProxy().writeBlob(commPage + 0x0fc0, cmpxchg, sizeof(cmpxchg));
+ tc->getVirtProxy().writeBlob(commPage + 0x0fc0, cmpxchg, sizeof(cmpxchg));
uint8_t get_tls[] =
{
0x70, 0x0f, 0x1d, 0xee, // mrc p15, 0, r0, c13, c0, 3
0x0e, 0xf0, 0xa0, 0xe1 // return
};
- tc->getMemProxy().writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
+ tc->getVirtProxy().writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls));
}
void
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "mips");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
- fpcr.copyOut(tc->getMemProxy());
+ fpcr.copyOut(tc->getVirtProxy());
return 0;
}
default:
// SSI_IEEE_FP_CONTROL
TypedBufferArg<uint64_t> fpcr(bufPtr);
// I don't think this exactly matches the HW FPCR
- fpcr.copyIn(tc->getMemProxy());
+ fpcr.copyIn(tc->getVirtProxy());
DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
return 0;
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "power");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "riscv64");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "riscv32");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "sparc");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
if (ruid) {
BufferArg ruidBuff(ruid, sizeof(uint64_t));
memcpy(ruidBuff.bufferPtr(), &id, sizeof(uint64_t));
- ruidBuff.copyOut(tc->getMemProxy());
+ ruidBuff.copyOut(tc->getVirtProxy());
}
// Set the euid
if (euid) {
BufferArg euidBuff(euid, sizeof(uint64_t));
memcpy(euidBuff.bufferPtr(), &id, sizeof(uint64_t));
- euidBuff.copyOut(tc->getMemProxy());
+ euidBuff.copyOut(tc->getVirtProxy());
}
// Set the suid
if (suid) {
BufferArg suidBuff(suid, sizeof(uint64_t));
memcpy(suidBuff.bufferPtr(), &id, sizeof(uint64_t));
- suidBuff.copyOut(tc->getMemProxy());
+ suidBuff.copyOut(tc->getVirtProxy());
}
return 0;
}
for (int index = 16; index < 32; index++) {
uint32_t regVal = tc->readIntReg(index);
regVal = htog(regVal);
- if (!tc->getMemProxy().tryWriteBlob(
+ if (!tc->getVirtProxy().tryWriteBlob(
sp + (index - 16) * 4, (uint8_t *)®Val, 4)) {
warn("Failed to save register to the stack when "
"flushing windows.\n");
for (int index = 16; index < 32; index++) {
RegVal regVal = tc->readIntReg(index);
regVal = htog(regVal);
- if (!tc->getMemProxy().tryWriteBlob(
+ if (!tc->getVirtProxy().tryWriteBlob(
sp + 2047 + (index - 16) * 8, (uint8_t *)®Val, 8)) {
warn("Failed to save register to the stack when "
"flushing windows.\n");
strcpy(name->version, "Generic_118558-21");
strcpy(name->machine, "sun4u");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "x86_64");
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
int code = process->getSyscallArg(tc, index);
uint64_t addr = process->getSyscallArg(tc, index);
uint64_t fsBase, gsBase;
- PortProxy &p = tc->getMemProxy();
+ PortProxy &p = tc->getVirtProxy();
switch(code)
{
// Each of these valid options should actually check addr.
gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t),
numTLSEntries * sizeof(uint64_t));
- if (!userDesc.copyIn(tc->getMemProxy()))
+ if (!userDesc.copyIn(tc->getVirtProxy()))
return -EFAULT;
- if (!gdt.copyIn(tc->getMemProxy()))
+ if (!gdt.copyIn(tc->getVirtProxy()))
panic("Failed to copy in GDT for %s.\n", desc->name());
if (userDesc->entry_number == (uint32_t)(-1)) {
gdt[index] = (uint64_t)segDesc;
- if (!userDesc.copyOut(tc->getMemProxy()))
+ if (!userDesc.copyOut(tc->getVirtProxy()))
return -EFAULT;
- if (!gdt.copyOut(tc->getMemProxy()))
+ if (!gdt.copyOut(tc->getVirtProxy()))
panic("Failed to copy out GDT for %s.\n", desc->name());
return 0;
Process *p = tc->getProcessPtr();
if (!p->fixupStackFault(tc->readMiscReg(MISCREG_CR2))) {
- PortProxy &proxy = tc->getMemProxy();
+ PortProxy &proxy = tc->getVirtProxy();
// at this point we should have 6 values on the interrupt stack
int size = 6;
uint64_t is[size];
DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size);
- if (FullSystem) {
- PortProxy &proxy = tc->getVirtProxy();
- proxy.readBlob(vaddr, data, size);
- } else {
- PortProxy &proxy = tc->getMemProxy();
- proxy.readBlob(vaddr, data, size);
- }
+ PortProxy &proxy = tc->getVirtProxy();
+ proxy.readBlob(vaddr, data, size);
#if TRACING_ON
if (DTRACE(GDBRead)) {
} else
DPRINTFNR("\n");
}
- if (FullSystem) {
- PortProxy &proxy = tc->getVirtProxy();
- proxy.writeBlob(vaddr, data, size);
- } else {
- PortProxy &proxy = tc->getMemProxy();
- proxy.writeBlob(vaddr, data, size);
- }
+ PortProxy &proxy = tc->getVirtProxy();
+ proxy.writeBlob(vaddr, data, size);
return true;
}
actualTC->connectMemPorts(tc);
}
- PortProxy &
- getMemProxy() override
- {
- return actualTC->getMemProxy();
- }
-
/** Executes a syscall in SE mode. */
void
syscall(int64_t callnum, Fault *fault) override
thread->initMemProxies(tc);
}
- PortProxy &
- getMemProxy() override
- {
- return thread->getMemProxy();
- }
-
/** Returns this thread's status. */
Status status() const override { return thread->status(); }
ThreadState::initMemProxies(tc);
}
- PortProxy &
- getMemProxy() override
- {
- return ThreadState::getMemProxy();
- }
-
Process *getProcessPtr() override { return ThreadState::getProcessPtr(); }
void setProcessPtr(Process *p) override { ThreadState::setProcessPtr(p); }
*/
virtual void initMemProxies(ThreadContext *tc) = 0;
- virtual PortProxy &getMemProxy() = 0;
-
virtual Process *getProcessPtr() = 0;
virtual void setProcessPtr(Process *p) = 0;
PortProxy &
ThreadState::getVirtProxy()
{
- assert(FullSystem);
- assert(virtProxy != NULL);
- return *virtProxy;
-}
-
-PortProxy &
-ThreadState::getMemProxy()
-{
- assert(!FullSystem);
assert(virtProxy != NULL);
return *virtProxy;
}
}
}
- PortProxy &getMemProxy();
-
/** Reads the number of instructions functionally executed and
* committed.
*/
k->numInsts() * sizeof(TheGpuISA::RawMachInst);
}
- sizes.copyOut(tc->getMemProxy());
+ sizes.copyOut(tc->getVirtProxy());
}
break;
ki->spill_mem_size = kernelInfo[i].spill_mem_size;
}
- kinfo.copyOut(tc->getMemProxy());
+ kinfo.copyOut(tc->getVirtProxy());
}
break;
assert(bufp - (char *)buf.bufferPtr() == string_table_size);
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
}
break;
memcpy(datap,
kernels.back()->readonly_data,
size);
- data.copyOut(tc->getMemProxy());
+ data.copyOut(tc->getVirtProxy());
}
break;
}
}
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
}
break;
{
BufferArg buf(buf_addr, sizeof(uint32_t));
*((uint32_t*)buf.bufferPtr()) = dispatcher->getNumCUs();
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
}
break;
{
BufferArg buf(buf_addr, sizeof(uint32_t));
*((uint32_t*)buf.bufferPtr()) = dispatcher->wfSize();
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
}
break;
case HSA_GET_HW_STATIC_CONTEXT_SIZE:
{
BufferArg buf(buf_addr, sizeof(uint32_t));
*((uint32_t*)buf.bufferPtr()) = dispatcher->getStaticContextSize();
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
}
break;
delete np->pTable;
np->pTable = pTable;
auto &proxy = dynamic_cast<SETranslatingPortProxy &>(
- ntc->getMemProxy());
+ ntc->getVirtProxy());
proxy.setPageTable(np->pTable);
np->memState = memState;
// 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;
}
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.
// 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);
// 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;
}
strncpy((char *)name.bufferPtr(), hostname, name_len);
- name.copyOut(tc->getMemProxy());
+ name.copyOut(tc->getVirtProxy());
return 0;
}
}
}
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
return (result == -1) ? -errno : result;
}
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
(char*)buf.bufferPtr());
}
- buf.copyOut(tc->getMemProxy());
+ buf.copyOut(tc->getVirtProxy());
return (result == -1) ? -errno : result;
}
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);
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)))
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)))
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);
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);
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);
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);
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 */
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;
}
{
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
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);
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;
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);
traversed += host_reclen;
}
- buf_arg.copyOut(tc->getMemProxy());
+ buf_arg.copyOut(tc->getVirtProxy());
return status;
}
#endif
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)
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)
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;
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;
// 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;
}
* 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();
/**
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();
}
/*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();
}
/*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();
}
return -errno;
if (msgHdr->msg_name) {
- nameBuf->copyOut(tc->getMemProxy());
+ nameBuf->copyOut(tc->getVirtProxy());
delete(nameBuf);
msgHdr->msg_name = (void *)msg_name_phold;
}
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;
}
* Reserve buffer space.
*/
BufferArg msgBuf(msgPtr, sizeof(struct msghdr));
- msgBuf.copyIn(tc->getMemProxy());
+ msgBuf.copyIn(tc->getVirtProxy());
struct msghdr msgHdr = *((struct msghdr *)msgBuf.bufferPtr());
/**
*/
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;
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();
}
// 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;
}
// 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;
// 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;
}
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,
(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;
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)
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();
/*
// 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
*/
// 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
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;
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;
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;
}
}
* 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__
std::string old_name;
- if (!tc->getMemProxy().tryReadString(old_name,
+ if (!tc->getVirtProxy().tryReadString(old_name,
process->getSyscallArg(tc, index)))
return -EFAULT;
std::string new_name;
- if (!tc->getMemProxy().tryReadString(new_name,
+ if (!tc->getVirtProxy().tryReadString(new_name,
process->getSyscallArg(tc, index)))
return -EFAULT;
sysinfo->totalram = process->system->memSize();
sysinfo->mem_unit = 1;
- sysinfo.copyOut(tc->getMemProxy());
+ sysinfo.copyOut(tc->getVirtProxy());
return 0;
}
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
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
* 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;
}
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
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);
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
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);
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
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;
}
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
if (result < 0)
return -errno;
- copyOutStatBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
if (result < 0)
return -errno;
- copyOutStat64Buf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStat64Buf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
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;
}
auto process = tc->getProcessPtr();
int index = 0;
- if (!tc->getMemProxy().tryReadString(path,
+ if (!tc->getVirtProxy().tryReadString(path,
process->getSyscallArg(tc, index))) {
return -EFAULT;
}
if (result < 0)
return -errno;
- copyOutStatfsBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatfsBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
#else
warnUnsupportedOS("statfs");
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) {
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)
if (result < 0)
return -errno;
- copyOutStatfsBuf<OS>(tc->getMemProxy(), bufPtr, &hostBuf);
+ copyOutStatfsBuf<OS>(tc->getVirtProxy(), bufPtr, &hostBuf);
return 0;
}
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];
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];
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:
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);
break;
}
- rlp.copyOut(tc->getMemProxy());
+ rlp.copyOut(tc->getVirtProxy());
return 0;
}
return -EINVAL;
break;
}
- rlp.copyOut(tc->getMemProxy());
+ rlp.copyOut(tc->getVirtProxy());
}
return 0;
}
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;
}
tp->tv_sec = 0;
tp->tv_nsec = 1;
- tp.copyOut(tc->getMemProxy());
+ tp.copyOut(tc->getVirtProxy());
return 0;
}
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;
}
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) {
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;
who);
}
- rup.copyOut(tc->getMemProxy());
+ rup.copyOut(tc->getVirtProxy());
return 0;
}
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;
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;
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;
}
* 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
}
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;
}
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;
}
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;
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();
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));
}
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);
}