diff options
author | Ron Dreslinski <rdreslin@umich.edu> | 2006-02-15 22:05:23 -0500 |
---|---|---|
committer | Ron Dreslinski <rdreslin@umich.edu> | 2006-02-15 22:05:23 -0500 |
commit | d142788172ee79e6e67fc8510940c884807305ad (patch) | |
tree | d1c665421357acae6f17cedc4168789f1913f6b1 /sim | |
parent | b8a2d1e5c78eac41125a0be0bc2b5d5fe4714684 (diff) | |
download | gem5-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')
-rw-r--r-- | sim/syscall_emul.cc | 16 | ||||
-rw-r--r-- | sim/syscall_emul.hh | 68 |
2 files changed, 51 insertions, 33 deletions
diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc index 4b6388a41..78b4201d4 100644 --- a/sim/syscall_emul.cc +++ b/sim/syscall_emul.cc @@ -128,7 +128,7 @@ readFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) int bytes_read = read(fd, bufArg.bufferPtr(), nbytes); if (bytes_read != -1) - bufArg.copyOut(xc->mem); + bufArg.copyOut(xc->cpu->memPort); return bytes_read; } @@ -140,7 +140,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) 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); @@ -181,7 +181,7 @@ gethostnameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) strncpy((char *)name.bufferPtr(), hostname, name_len); - name.copyOut(xc->mem); + name.copyOut(xc->cpu->memPort); return 0; } @@ -191,7 +191,7 @@ unlinkFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) { 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()); @@ -203,12 +203,12 @@ renameFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) { 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()); @@ -220,7 +220,7 @@ truncateFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) { 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); @@ -248,7 +248,7 @@ chownFunc(SyscallDesc *desc, int num, Process *p, ExecContext *xc) { 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 */ 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; } |