summaryrefslogtreecommitdiff
path: root/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorRon Dreslinski <rdreslin@umich.edu>2006-02-15 22:05:23 -0500
committerRon Dreslinski <rdreslin@umich.edu>2006-02-15 22:05:23 -0500
commitd142788172ee79e6e67fc8510940c884807305ad (patch)
treed1c665421357acae6f17cedc4168789f1913f6b1 /sim/syscall_emul.hh
parentb8a2d1e5c78eac41125a0be0bc2b5d5fe4714684 (diff)
downloadgem5-d142788172ee79e6e67fc8510940c884807305ad.tar.xz
More compilation fixes.
Should we add a proxy_port that does the v->p address translation? Should the proxy port return a fault on translation errors, if we add one? arch/alpha/alpha_linux_process.cc: Syscalls use a memPort through the CPU now instead of a xc functional memory. cpu/base.hh: Add a pointer to the memPort syscalls will use. Should this be a proxy_port that does address translation? cpu/exec_context.cc: cpu/exec_context.hh: Remove functional memory from the exec context cpu/simple/cpu.cc: Set the memPort to be used as the syscall port as the dcache port sim/syscall_emul.cc: sim/syscall_emul.hh: Syscalls use a memPort through the CPU now instead of a xc functional memory. Also, fix the fact that readStringFunctional doesn't return a fault... should proxy_port handle this because it is doing the translation? --HG-- extra : convert_revision : 1f65318c6594301a75dc4dc0c99fdd436b094a7f
Diffstat (limited to 'sim/syscall_emul.hh')
-rw-r--r--sim/syscall_emul.hh68
1 files changed, 43 insertions, 25 deletions
diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh
index bdaae9015..04b7bbe1c 100644
--- a/sim/syscall_emul.hh
+++ b/sim/syscall_emul.hh
@@ -48,6 +48,7 @@
#include "base/trace.hh"
#include "cpu/exec_context.hh"
+#include "cpu/base.hh"
#include "sim/process.hh"
///
@@ -314,8 +315,11 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
{
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.
@@ -361,8 +365,11 @@ chmodFunc(SyscallDesc *desc, int callnum, Process *process,
{
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;
@@ -414,8 +421,11 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
{
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);
@@ -423,7 +433,7 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -447,7 +457,7 @@ fstat64Func(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return errno;
- OS::copyOutStat64Buf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -461,8 +471,10 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
{
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);
@@ -470,7 +482,7 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -483,8 +495,10 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
{
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);
@@ -492,7 +506,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return -errno;
- OS::copyOutStat64Buf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStat64Buf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -516,7 +530,7 @@ fstatFunc(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return -errno;
- OS::copyOutStatBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -530,8 +544,10 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process,
{
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);
@@ -539,7 +555,7 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -562,7 +578,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, Process *process,
if (result < 0)
return errno;
- OS::copyOutStatfsBuf(xc->mem, xc->getSyscallArg(1), &hostBuf);
+ OS::copyOutStatfsBuf(xc->cpu->memPort, xc->getSyscallArg(1), &hostBuf);
return 0;
}
@@ -586,11 +602,11 @@ writevFunc(SyscallDesc *desc, int callnum, Process *process,
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);
}
@@ -671,7 +687,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process,
break;
}
- rlp.copyOut(xc->mem);
+ rlp.copyOut(xc->cpu->memPort);
return 0;
}
@@ -686,7 +702,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process,
getElapsedTime(tp->tv_sec, tp->tv_usec);
tp->tv_sec += seconds_since_epoch;
- tp.copyOut(xc->mem);
+ tp.copyOut(xc->cpu->memPort);
return 0;
}
@@ -700,11 +716,13 @@ utimesFunc(SyscallDesc *desc, int callnum, Process *process,
{
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)
@@ -754,7 +772,7 @@ getrusageFunc(SyscallDesc *desc, int callnum, Process *process,
rup->ru_nvcsw = 0;
rup->ru_nivcsw = 0;
- rup.copyOut(xc->mem);
+ rup.copyOut(xc->cpu->memPort);
return 0;
}