From 38dd86ce7297b1ebecc5996c0c158990e14b1f02 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Sun, 12 Mar 2006 00:40:29 -0500 Subject: 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 --- sim/syscall_emul.hh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'sim/syscall_emul.hh') 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 tp(xc->getSyscallArg(1)); -- cgit v1.2.3