#include "cpu/base.hh"
#include "cpu/exec_context.hh"
-#include "mem/functional/functional.hh"
+#include "mem/port.hh"
#include "sim/fake_syscall.hh"
#include "sim/host.hh"
#include "sim/process.hh"
/// buffer. Also copies the target buffer out to the simulated
/// memory space. Used by stat(), fstat(), and lstat().
static void
- copyOutStatBuf(FunctionalMemory *mem, Addr addr, struct stat *host)
+ copyOutStatBuf(Port *memPort, Addr addr, struct stat *host)
{
TypedBufferArg<Linux::tgt_stat> tgt(addr);
tgt->st_blksize = host->st_blksize;
tgt->st_blocks = host->st_blocks;
- tgt.copyOut(mem);
+ tgt.copyOut(memPort);
}
// Same for stat64
static void
- copyOutStat64Buf(FunctionalMemory *mem, Addr addr, struct stat64 *host)
+ copyOutStat64Buf(Port *memPort, Addr addr, struct stat64 *host)
{
TypedBufferArg<Linux::tgt_stat64> tgt(addr);
tgt->st_mtime_nsec = 0;
tgt->st_ctime_nsec = 0;
#endif
- tgt.copyOut(mem);
+ tgt.copyOut(memPort);
}
/// The target system's hostname.
strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
strcpy(name->machine, "alpha");
- name.copyOut(xc->mem);
+ name.copyOut(xc->cpu->memPort);
return 0;
}
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
// I don't think this exactly matches the HW FPCR
*fpcr = 0;
- fpcr.copyOut(xc->mem);
+ fpcr.copyOut(xc->cpu->memPort);
return 0;
}
case 14: { // SSI_IEEE_FP_CONTROL
TypedBufferArg<uint64_t> fpcr(xc->getSyscallArg(1));
// I don't think this exactly matches the HW FPCR
- fpcr.copyIn(xc->mem);
+ fpcr.copyIn(xc->cpu->memPort);
DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
" setting FPCR to 0x%x\n", *(uint64_t*)fpcr);
return 0;
int bytes_read = read(fd, bufArg.bufferPtr(), nbytes);
if (bytes_read != -1)
- bufArg.copyOut(xc->mem);
+ bufArg.copyOut(xc->cpu->memPort);
return bytes_read;
}
int nbytes = xc->getSyscallArg(2);
BufferArg bufArg(xc->getSyscallArg(1), nbytes);
- bufArg.copyIn(xc->mem);
+ bufArg.copyIn(xc->cpu->memPort);
int bytes_written = write(fd, bufArg.bufferPtr(), nbytes);
strncpy((char *)name.bufferPtr(), hostname, name_len);
- name.copyOut(xc->mem);
+ name.copyOut(xc->cpu->memPort);
return 0;
}
{
string path;
- if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
{
string old_name;
- if (xc->mem->readString(old_name, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->cpu->memPort->readStringFunctional(old_name, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
string new_name;
- if (xc->mem->readString(new_name, xc->getSyscallArg(1)) != No_Fault)
+ if (xc->cpu->memPort->readStringFunctional(new_name, xc->getSyscallArg(1)) != No_Fault)
return -EFAULT;
int64_t result = rename(old_name.c_str(), new_name.c_str());
{
string path;
- if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
off_t length = xc->getSyscallArg(1);
{
string path;
- if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault)
+ if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
/* XXX endianess */
#include "base/trace.hh"
#include "cpu/exec_context.hh"
+#include "cpu/base.hh"
#include "sim/process.hh"
///
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
+*/
+ //@todo Fix fault condition
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
if (path == "/dev/sysdev0") {
// This is a memory-mapped high-resolution timer device on Alpha.
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+/*
+ if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
return -EFAULT;
+*/
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
uint32_t mode = xc->getSyscallArg(1);
mode_t hostMode = 0;
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;
+/*
+ if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT; */
+
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
struct stat hostBuf;
int result = stat(path.c_str(), &hostBuf);
if (result < 0)
return errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return errno;
- OS::copyOutStat64Buf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;
+/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;*/
+
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
struct stat hostBuf;
int result = lstat(path.c_str(), &hostBuf);
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;
+/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT; */
+
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
struct stat64 hostBuf;
int result = lstat64(path.c_str(), &hostBuf);
if (result < 0)
return -errno;
- OS::copyOutStat64Buf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;
+/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;*/
+
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
struct statfs hostBuf;
int result = statfs(path.c_str(), &hostBuf);
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
for (int i = 0; i < count; ++i)
{
typename OS::tgt_iovec tiov;
- xc->mem->access(Read, tiov_base + i*sizeof(typename OS::tgt_iovec),
+ xc->cpu->memPort->readBlobFunctional(tiov_base + i*sizeof(typename OS::tgt_iovec),
&tiov, sizeof(typename OS::tgt_iovec));
hiov[i].iov_len = tiov.iov_len;
hiov[i].iov_base = new char [hiov[i].iov_len];
- xc->mem->access(Read, tiov.iov_base,
+ xc->cpu->memPort->readBlobFunctional(tiov.iov_base,
hiov[i].iov_base, hiov[i].iov_len);
}
break;
}
- rlp.copyOut(xc->mem);
+ rlp.copyOut(xc->cpu->memPort);
return 0;
}
getElapsedTime(tp->tv_sec, tp->tv_usec);
tp->tv_sec += seconds_since_epoch;
- tp.copyOut(xc->mem);
+ tp.copyOut(xc->cpu->memPort);
return 0;
}
{
std::string path;
- if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
- return -EFAULT;
+/* if (xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault)
+ return -EFAULT;*/
+
+ xc->cpu->memPort->readStringFunctional(path, xc->getSyscallArg(0));
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));
- tp.copyIn(xc->mem);
+ tp.copyIn(xc->cpu->memPort);
struct timeval hostTimeval[2];
for (int i = 0; i < 2; ++i)
rup->ru_nvcsw = 0;
rup->ru_nivcsw = 0;
- rup.copyOut(xc->mem);
+ rup.copyOut(xc->cpu->memPort);
return 0;
}