diff options
-rw-r--r-- | SConscript | 5 | ||||
-rw-r--r-- | arch/alpha/tru64/process.cc | 1 | ||||
-rw-r--r-- | cpu/simple/cpu.cc | 2 | ||||
-rw-r--r-- | mem/translating_port.cc | 84 | ||||
-rw-r--r-- | mem/translating_port.hh | 21 | ||||
-rw-r--r-- | sim/process.cc | 1 | ||||
-rw-r--r-- | sim/syscall_emul.cc | 12 | ||||
-rw-r--r-- | sim/syscall_emul.hh | 14 | ||||
-rwxr-xr-x | util/qdo | 4 |
9 files changed, 92 insertions, 52 deletions
diff --git a/SConscript b/SConscript index 3a141a7d2..ae7602c9d 100644 --- a/SConscript +++ b/SConscript @@ -251,16 +251,13 @@ syscall_emulation_sources = Split(''' encumbered/eio/exolex.cc encumbered/eio/libexo.cc + encumbered/eio/eio.cc kern/linux/linux.cc kern/tru64/tru64.cc sim/process.cc sim/syscall_emul.cc ''') -eio_sources = Split(''' - encumbered/eio/eio.cc - ''') - memtest_sources = Split(''' cpu/memtest/memtest.cc ''') diff --git a/arch/alpha/tru64/process.cc b/arch/alpha/tru64/process.cc index d77e7f9e9..be78cb96e 100644 --- a/arch/alpha/tru64/process.cc +++ b/arch/alpha/tru64/process.cc @@ -30,7 +30,6 @@ #include "arch/alpha/tru64/process.hh" #include "cpu/exec_context.hh" #include "kern/tru64/tru64.hh" -#include "sim/fake_syscall.hh" #include "sim/process.hh" #include "sim/syscall_emul.hh" diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc index 4da18474e..44521a542 100644 --- a/cpu/simple/cpu.cc +++ b/cpu/simple/cpu.cc @@ -1081,7 +1081,7 @@ SimpleCPU::tick() #if FULL_SYSTEM fault->invoke(xcProxy); #else // !FULL_SYSTEM - fatal("fault (%d) detected @ PC 0x%08p", fault, cpuXC->readPC()); + fatal("fault (%d) detected @ PC %08p", fault, cpuXC->readPC()); #endif // FULL_SYSTEM } else { diff --git a/mem/translating_port.cc b/mem/translating_port.cc index 42101dad0..a3bf1baa7 100644 --- a/mem/translating_port.cc +++ b/mem/translating_port.cc @@ -27,7 +27,6 @@ */ #include <string> -#include "arch/faults.hh" #include "base/chunk_generator.hh" #include "mem/port.hh" #include "mem/translating_port.hh" @@ -42,8 +41,8 @@ TranslatingPort::TranslatingPort(Port *_port, PageTable *p_table) TranslatingPort::~TranslatingPort() { } -Fault -TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size) +bool +TranslatingPort::tryReadBlobFunctional(Addr addr, uint8_t *p, int size) { Addr paddr; int prevSize = 0; @@ -51,19 +50,28 @@ TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size) for (ChunkGenerator gen(addr, size, VMPageSize); !gen.done(); gen.next()) { if (!pTable->translate(gen.addr(),paddr)) - return genMachineCheckFault(); + return false; port->readBlobFunctional(paddr, p + prevSize, gen.size()); prevSize += gen.size(); } - return NoFault; + return true; } -Fault -TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, - bool alloc) +void +TranslatingPort::readBlobFunctional(Addr addr, uint8_t *p, int size) +{ + if (!tryReadBlobFunctional(addr, p, size)) + fatal("readBlobFunctional(0x%x, ...) failed", addr); +} + + +bool +TranslatingPort::tryWriteBlobFunctional(Addr addr, uint8_t *p, int size, + bool alloc) { + Addr paddr; int prevSize = 0; @@ -75,7 +83,7 @@ TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, VMPageSize); pTable->translate(gen.addr(), paddr); } else { - return genMachineCheckFault(); + return false; } } @@ -83,13 +91,21 @@ TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, prevSize += gen.size(); } - return NoFault; + return true; } -Fault -TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size, - bool alloc) +void +TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, + bool alloc) +{ + if (!tryWriteBlobFunctional(addr, p, size, alloc)) + fatal("writeBlobFunctional(0x%x, ...) failed", addr); +} + +bool +TranslatingPort::tryMemsetBlobFunctional(Addr addr, uint8_t val, int size, + bool alloc) { Addr paddr; @@ -101,19 +117,27 @@ TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size, VMPageSize); pTable->translate(gen.addr(), paddr); } else { - return genMachineCheckFault(); + return false; } } port->memsetBlobFunctional(paddr, val, gen.size()); } - return NoFault; + return true; } +void +TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size, + bool alloc) +{ + if (!tryMemsetBlobFunctional(addr, val, size, alloc)) + fatal("memsetBlobFunctional(0x%x, ...) failed", addr); +} -Fault -TranslatingPort::writeStringFunctional(Addr addr, const char *str) + +bool +TranslatingPort::tryWriteStringFunctional(Addr addr, const char *str) { Addr paddr,vaddr; uint8_t c; @@ -123,16 +147,23 @@ TranslatingPort::writeStringFunctional(Addr addr, const char *str) do { c = *str++; if (!pTable->translate(vaddr++,paddr)) - return genMachineCheckFault(); + return false; port->writeBlobFunctional(paddr, &c, 1); } while (c); - return NoFault; + return true; } -Fault -TranslatingPort::readStringFunctional(std::string &str, Addr addr) +void +TranslatingPort::writeStringFunctional(Addr addr, const char *str) +{ + if (!tryWriteStringFunctional(addr, str)) + fatal("writeStringFunctional(0x%x, ...) failed", addr); +} + +bool +TranslatingPort::tryReadStringFunctional(std::string &str, Addr addr) { Addr paddr,vaddr; uint8_t c; @@ -141,12 +172,19 @@ TranslatingPort::readStringFunctional(std::string &str, Addr addr) do { if (!pTable->translate(vaddr++,paddr)) - return genMachineCheckFault(); + return false; port->readBlobFunctional(paddr, &c, 1); str += c; } while (c); - return NoFault; + return true; +} + +void +TranslatingPort::readStringFunctional(std::string &str, Addr addr) +{ + if (!tryReadStringFunctional(str, addr)) + fatal("readStringFunctional(0x%x, ...) failed", addr); } diff --git a/mem/translating_port.hh b/mem/translating_port.hh index 1a334c103..eaecff35a 100644 --- a/mem/translating_port.hh +++ b/mem/translating_port.hh @@ -48,14 +48,21 @@ class TranslatingPort virtual ~TranslatingPort(); public: - Fault readBlobFunctional(Addr addr, uint8_t *p, int size); - Fault writeBlobFunctional(Addr addr, uint8_t *p, int size, - bool alloc = false); - Fault memsetBlobFunctional(Addr addr, uint8_t val, int size, - bool alloc = false); - Fault writeStringFunctional(Addr addr, const char *str); - Fault readStringFunctional(std::string &str, Addr addr); + bool tryReadBlobFunctional(Addr addr, uint8_t *p, int size); + bool tryWriteBlobFunctional(Addr addr, uint8_t *p, int size, + bool alloc = false); + bool tryMemsetBlobFunctional(Addr addr, uint8_t val, int size, + bool alloc = false); + bool tryWriteStringFunctional(Addr addr, const char *str); + bool tryReadStringFunctional(std::string &str, Addr addr); + void readBlobFunctional(Addr addr, uint8_t *p, int size); + void writeBlobFunctional(Addr addr, uint8_t *p, int size, + bool alloc = false); + void memsetBlobFunctional(Addr addr, uint8_t val, int size, + bool alloc = false); + void writeStringFunctional(Addr addr, const char *str); + void readStringFunctional(std::string &str, Addr addr); }; #endif diff --git a/sim/process.cc b/sim/process.cc index 70a92a604..d5f97ee5f 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -46,7 +46,6 @@ #include "mem/memory.hh" #include "mem/translating_port.hh" #include "sim/builder.hh" -#include "sim/fake_syscall.hh" #include "sim/process.hh" #include "sim/stats.hh" #include "sim/syscall_emul.hh" diff --git a/sim/syscall_emul.cc b/sim/syscall_emul.cc index faad733a8..6c24b6dc5 100644 --- a/sim/syscall_emul.cc +++ b/sim/syscall_emul.cc @@ -82,7 +82,7 @@ SyscallReturn exitFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { - new SimExitEvent("syscall caused exit", xc->getSyscallArg(0) & 0xff); + new SimExitEvent("target called exit()", xc->getSyscallArg(0) & 0xff); return 1; } @@ -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)); @@ -179,10 +179,10 @@ try: if output_dir: secs_waited = 0 - while not shell.dir_exists(output_dir) and secs_waited < 45: + while not shell.dir_exists(output_dir) and secs_waited < 90: time.sleep(5) secs_waited += 5 - if secs_waited > 10: + if secs_waited > 30: print "waited", secs_waited, "seconds for", output_dir # run command |