summaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2006-03-12 00:40:29 -0500
committerSteve Reinhardt <stever@eecs.umich.edu>2006-03-12 00:40:29 -0500
commit38dd86ce7297b1ebecc5996c0c158990e14b1f02 (patch)
tree9185434074c988701deb766d93553a535f1c17f4 /sim
parent1f5266e79d86fd6b82982c3f43dc2e5ef83a18ee (diff)
downloadgem5-38dd86ce7297b1ebecc5996c0c158990e14b1f02.tar.xz
Fix TranslatingPort access functions to:
- know nothing about Fault objects (as it should be) - call fatal() by default on accesses to unmapped addrs - provide "try" versions for callers that are prepared to handle failure mem/translating_port.cc: mem/translating_port.hh: Memory system objects should not return Fault objects, just errors. Half the time we don't check the return code anyway, so make default version of the access functions call fatal(). Provide "try*" versions that return a bool for places where we really are going to check the return code. sim/syscall_emul.cc: sim/syscall_emul.hh: Need to use new "tryReadString" here since we actually check the return code. --HG-- extra : convert_revision : 039737398ef183904dc382c05912ab96cd1d4a51
Diffstat (limited to 'sim')
-rw-r--r--sim/syscall_emul.cc10
-rw-r--r--sim/syscall_emul.hh14
2 files changed, 12 insertions, 12 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc
index 8fc8dc0b9..6c24b6dc5 100644
--- a/sim/syscall_emul.cc
+++ b/sim/syscall_emul.cc
@@ -193,7 +193,7 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return (TheISA::IntReg)-EFAULT;
int result = unlink(path.c_str());
@@ -205,12 +205,12 @@ renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
string old_name;
- if (xc->getMemPort()->readStringFunctional(old_name, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(old_name, xc->getSyscallArg(0)))
return -EFAULT;
string new_name;
- if (xc->getMemPort()->readStringFunctional(new_name, xc->getSyscallArg(1)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(new_name, xc->getSyscallArg(1)))
return -EFAULT;
int64_t result = rename(old_name.c_str(), new_name.c_str());
@@ -222,7 +222,7 @@ truncateFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
off_t length = xc->getSyscallArg(1);
@@ -250,7 +250,7 @@ chownFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc)
{
string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
/* XXX endianess */
diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh
index 8eacf9200..60e06b294 100644
--- a/sim/syscall_emul.hh
+++ b/sim/syscall_emul.hh
@@ -370,7 +370,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
if (path == "/dev/sysdev0") {
@@ -417,7 +417,7 @@ chmodFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
uint32_t mode = xc->getSyscallArg(1);
@@ -470,7 +470,7 @@ statFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
struct stat hostBuf;
@@ -522,7 +522,7 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
struct stat hostBuf;
@@ -544,7 +544,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
#if BSD_HOST
@@ -596,7 +596,7 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
struct statfs hostBuf;
@@ -770,7 +770,7 @@ utimesFunc(SyscallDesc *desc, int callnum, Process *process,
{
std::string path;
- if (xc->getMemPort()->readStringFunctional(path, xc->getSyscallArg(0)) != NoFault)
+ if (!xc->getMemPort()->tryReadStringFunctional(path, xc->getSyscallArg(0)))
return -EFAULT;
TypedBufferArg<typename OS::timeval [2]> tp(xc->getSyscallArg(1));