diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/linux/linux.hh | 14 | ||||
-rw-r--r-- | kern/tru64/tru64.hh | 96 | ||||
-rw-r--r-- | kern/tru64/tru64_events.cc | 1 |
3 files changed, 74 insertions, 37 deletions
diff --git a/kern/linux/linux.hh b/kern/linux/linux.hh index 0dbccf546..9237084fc 100644 --- a/kern/linux/linux.hh +++ b/kern/linux/linux.hh @@ -46,6 +46,8 @@ class Linux {}; #include "sim/syscall_emul.hh" +class TranslatingPort; + /// /// This class encapsulates the types, structures, constants, /// functions, and syscall-number mappings specific to the Alpha Linux @@ -240,8 +242,10 @@ class Linux { /// memory space. Used by stat(), fstat(), and lstat(). #if !BSD_HOST static void - copyOutStatBuf(FunctionalMemory *mem, Addr addr, hst_stat *host) + copyOutStatBuf(TranslatingPort *mem, Addr addr, hst_stat *host) { + using namespace TheISA; + TypedBufferArg<Linux::tgt_stat> tgt(addr); tgt->st_dev = htog(host->st_dev); @@ -264,8 +268,10 @@ class Linux { // Third version for bsd systems which no longer have any support for // the old stat() call and stat() is actually a stat64() static void - copyOutStatBuf(FunctionalMemory *mem, Addr addr, hst_stat64 *host) + copyOutStatBuf(TranslatingPort *mem, Addr addr, hst_stat64 *host) { + using namespace TheISA; + TypedBufferArg<Linux::tgt_stat> tgt(addr); tgt->st_dev = htog(host->st_dev); @@ -289,8 +295,10 @@ class Linux { // Same for stat64 static void - copyOutStat64Buf(FunctionalMemory *mem, int fd, Addr addr, hst_stat64 *host) + copyOutStat64Buf(TranslatingPort *mem, int fd, Addr addr, hst_stat64 *host) { + using namespace TheISA; + TypedBufferArg<Linux::tgt_stat64> tgt(addr); // fd == 1 checks are because libc does some checks diff --git a/kern/tru64/tru64.hh b/kern/tru64/tru64.hh index 112f00f31..3f5ef3dea 100644 --- a/kern/tru64/tru64.hh +++ b/kern/tru64/tru64.hh @@ -61,6 +61,8 @@ typedef struct stat global_stat; typedef struct statfs global_statfs; typedef struct dirent global_dirent; +class TranslatingPort; + /// /// This class encapsulates the types, structures, constants, /// functions, and syscall-number mappings specific to the Alpha Tru64 @@ -540,8 +542,10 @@ class Tru64 { /// memory space. Used by stat(), fstat(), and lstat(). template <class T> static void - copyOutStatBuf(FunctionalMemory *mem, Addr addr, global_stat *host) + copyOutStatBuf(TranslatingPort *mem, Addr addr, global_stat *host) { + using namespace TheISA; + TypedBufferArg<T> tgt(addr); tgt->st_dev = htog(host->st_dev); @@ -566,8 +570,10 @@ class Tru64 { /// memory space. Used by statfs() and fstatfs(). template <class T> static void - copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, global_statfs *host) + copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { + using namespace TheISA; + TypedBufferArg<T> tgt(addr); #if defined(__OpenBSD__) || defined(__APPLE__) || defined(__FreeBSD__) @@ -590,13 +596,13 @@ class Tru64 { class F64 { public: - static void copyOutStatBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatBuf(TranslatingPort *mem, Addr addr, global_stat *host) { Tru64::copyOutStatBuf<Tru64::F64_stat>(mem, addr, host); } - static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { Tru64::copyOutStatfsBuf<Tru64::F64_statfs>(mem, addr, host); @@ -605,13 +611,13 @@ class Tru64 { class PreF64 { public: - static void copyOutStatBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatBuf(TranslatingPort *mem, Addr addr, global_stat *host) { Tru64::copyOutStatBuf<Tru64::pre_F64_stat>(mem, addr, host); } - static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { Tru64::copyOutStatfsBuf<Tru64::pre_F64_statfs>(mem, addr, host); @@ -623,8 +629,10 @@ class Tru64 { /// the simulated memory space. Used by pre_F64_stat(), /// pre_F64_fstat(), and pre_F64_lstat(). static void - copyOutPreF64StatBuf(FunctionalMemory *mem, Addr addr, struct stat *host) + copyOutPreF64StatBuf(TranslatingPort *mem, Addr addr, struct stat *host) { + using namespace TheISA; + TypedBufferArg<Tru64::pre_F64_stat> tgt(addr); tgt->st_dev = htog(host->st_dev); @@ -654,6 +662,8 @@ class Tru64 { getdirentriesFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + #ifdef __CYGWIN__ panic("getdirent not implemented on cygwin!"); #else @@ -666,7 +676,7 @@ class Tru64 { // just pass basep through uninterpreted. TypedBufferArg<int64_t> basep(tgt_basep); - basep.copyIn(xc->getMemPtr()); + basep.copyIn(xc->getMemPort()); long host_basep = (off_t)htog((int64_t)*basep); int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep); @@ -693,7 +703,7 @@ class Tru64 { tgt_dp->d_reclen = tgt_bufsize; tgt_dp->d_namlen = namelen; strcpy(tgt_dp->d_name, host_dp->d_name); - tgt_dp.copyOut(xc->getMemPtr()); + tgt_dp.copyOut(xc->getMemPort()); tgt_buf_ptr += tgt_bufsize; host_buf_ptr += host_dp->d_reclen; @@ -702,7 +712,7 @@ class Tru64 { delete [] host_buf; *basep = htog((int64_t)host_basep); - basep.copyOut(xc->getMemPtr()); + basep.copyOut(xc->getMemPort()); return tgt_buf_ptr - tgt_buf; #endif @@ -713,10 +723,12 @@ class Tru64 { sigreturnFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + using TheISA::RegFile; TypedBufferArg<Tru64::sigcontext> sc(xc->getSyscallArg(0)); - sc.copyIn(xc->getMemPtr()); + sc.copyIn(xc->getMemPort()); // Restore state from sigcontext structure. // Note that we'll advance PC <- NPC before the end of the cycle, @@ -726,7 +738,7 @@ class Tru64 { for (int i = 0; i < 31; ++i) { xc->setIntReg(i, htog(sc->sc_regs[i])); - xc->setFloatRegInt(i, htog(sc->sc_fpregs[i])); + xc->setFloatRegBits(i, htog(sc->sc_fpregs[i])); } xc->setMiscReg(TheISA::Fpcr_DepTag, htog(sc->sc_fpcr)); @@ -739,6 +751,8 @@ class Tru64 { tableFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + int id = xc->getSyscallArg(0); // table ID int index = xc->getSyscallArg(1); // index into table // arg 2 is buffer pointer; type depends on table ID @@ -761,7 +775,7 @@ class Tru64 { elp->si_phz = htog(clk_hz); elp->si_boottime = htog(seconds_since_epoch); // seconds since epoch? elp->si_max_procs = htog(process->numCpus()); - elp.copyOut(xc->getMemPtr()); + elp.copyOut(xc->getMemPort()); return 0; } @@ -780,9 +794,11 @@ class Tru64 { stack_createFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + TypedBufferArg<Tru64::vm_stack> argp(xc->getSyscallArg(0)); - argp.copyIn(xc->getMemPtr()); + argp.copyIn(xc->getMemPort()); // if the user chose an address, just let them have it. Otherwise // pick one for them. @@ -791,7 +807,7 @@ class Tru64 { int stack_size = (htog(argp->rsize) + htog(argp->ysize) + htog(argp->gsize)); process->next_thread_stack_base -= stack_size; - argp.copyOut(xc->getMemPtr()); + argp.copyOut(xc->getMemPort()); } return 0; @@ -808,10 +824,12 @@ class Tru64 { nxm_task_initFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + TypedBufferArg<Tru64::nxm_task_attr> attrp(xc->getSyscallArg(0)); TypedBufferArg<Addr> configptr_ptr(xc->getSyscallArg(1)); - attrp.copyIn(xc->getMemPtr()); + attrp.copyIn(xc->getMemPort()); if (gtoh(attrp->nxm_version) != NXM_LIB_VERSION) { cerr << "nxm_task_init: thread library version mismatch! " @@ -852,7 +870,7 @@ class Tru64 { config->nxm_slot_state = htog(slot_state_addr); config->nxm_rad[0] = htog(rad_state_addr); - config.copyOut(xc->getMemPtr()); + config.copyOut(xc->getMemPort()); // initialize the slot_state array and copy it out TypedBufferArg<Tru64::nxm_slot_state_t> slot_state(slot_state_addr, @@ -865,7 +883,7 @@ class Tru64 { (i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL; } - slot_state.copyOut(xc->getMemPtr()); + slot_state.copyOut(xc->getMemPort()); // same for the per-RAD "shared" struct. Note that we need to // allocate extra bytes for the per-VP array which is embedded at @@ -899,13 +917,13 @@ class Tru64 { } } - rad_state.copyOut(xc->getMemPtr()); + rad_state.copyOut(xc->getMemPort()); // // copy pointer to shared config area out to user // *configptr_ptr = htog(config_addr); - configptr_ptr.copyOut(xc->getMemPtr()); + configptr_ptr.copyOut(xc->getMemPort()); // Register this as a valid address range with the process process->nxm_start = base_addr; @@ -919,6 +937,8 @@ class Tru64 { init_exec_context(ExecContext *ec, Tru64::nxm_thread_attr *attrp, uint64_t uniq_val) { + using namespace TheISA; + ec->clearArchRegs(); ec->setIntReg(TheISA::ArgumentReg0, gtoh(attrp->registers.a0)); @@ -937,12 +957,14 @@ class Tru64 { nxm_thread_createFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + TypedBufferArg<Tru64::nxm_thread_attr> attrp(xc->getSyscallArg(0)); TypedBufferArg<uint64_t> kidp(xc->getSyscallArg(1)); int thread_index = xc->getSyscallArg(2); // get attribute args - attrp.copyIn(xc->getMemPtr()); + attrp.copyIn(xc->getMemPort()); if (gtoh(attrp->version) != NXM_LIB_VERSION) { cerr << "nxm_thread_create: thread library version mismatch! " @@ -967,7 +989,7 @@ class Tru64 { TypedBufferArg<Tru64::nxm_shared> rad_state(0x14000, rad_state_size); - rad_state.copyIn(xc->getMemPtr()); + rad_state.copyIn(xc->getMemPort()); uint64_t uniq_val = gtoh(attrp->pthid) - gtoh(rad_state->nxm_uniq_offset); @@ -978,7 +1000,7 @@ class Tru64 { // This is supposed to be a port number. Make something up. *kidp = htog(99); - kidp.copyOut(xc->getMemPtr()); + kidp.copyOut(xc->getMemPort()); return 0; } else if (gtoh(attrp->type) == Tru64::NXM_TYPE_VP) { @@ -992,7 +1014,7 @@ class Tru64 { ssp->nxm_u.pth_id = attrp->pthid; ssp->nxm_u.nxm_active = htog(uniq_val | 1); - rad_state.copyOut(xc->getMemPtr()); + rad_state.copyOut(xc->getMemPort()); Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info); int slot_state_size = @@ -1002,7 +1024,7 @@ class Tru64 { slot_state(slot_state_addr, slot_state_size); - slot_state.copyIn(xc->getMemPtr()); + slot_state.copyIn(xc->getMemPort()); if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) { cerr << "nxm_thread_createFunc: requested VP slot " @@ -1014,7 +1036,7 @@ class Tru64 { // doesn't work anyway slot_state[thread_index] = Tru64::NXM_SLOT_BOUND; - slot_state.copyOut(xc->getMemPtr()); + slot_state.copyOut(xc->getMemPort()); // Find a free simulator execution context. for (int i = 0; i < process->numCpus(); ++i) { @@ -1028,7 +1050,7 @@ class Tru64 { // and get away with just sticking the thread index // here. *kidp = htog(thread_index); - kidp.copyOut(xc->getMemPtr()); + kidp.copyOut(xc->getMemPort()); return 0; } @@ -1155,14 +1177,16 @@ class Tru64 { static void m5_lock_mutex(Addr uaddr, Process *process, ExecContext *xc) { + using namespace TheISA; + TypedBufferArg<uint64_t> lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->getMemPort()); if (gtoh(*lockp) == 0) { // lock is free: grab it *lockp = htog(1); - lockp.copyOut(xc->getMemPtr()); + lockp.copyOut(xc->getMemPort()); } else { // lock is busy: disable until free process->waitList.push_back(Process::WaitRec(uaddr, xc)); @@ -1176,7 +1200,7 @@ class Tru64 { { TypedBufferArg<uint64_t> lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->getMemPort()); assert(*lockp != 0); // Check for a process waiting on the lock. @@ -1185,7 +1209,7 @@ class Tru64 { // clear lock field if no waiting context is taking over the lock if (num_waiting == 0) { *lockp = 0; - lockp.copyOut(xc->getMemPtr()); + lockp.copyOut(xc->getMemPort()); } } @@ -1209,15 +1233,17 @@ class Tru64 { m5_mutex_trylockFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + Addr uaddr = xc->getSyscallArg(0); TypedBufferArg<uint64_t> lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->getMemPort()); if (gtoh(*lockp) == 0) { // lock is free: grab it *lockp = htog(1); - lockp.copyOut(xc->getMemPtr()); + lockp.copyOut(xc->getMemPort()); return 0; } else { return 1; @@ -1266,13 +1292,15 @@ class Tru64 { m5_cond_waitFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace TheISA; + Addr cond_addr = xc->getSyscallArg(0); Addr lock_addr = xc->getSyscallArg(1); TypedBufferArg<uint64_t> condp(cond_addr); TypedBufferArg<uint64_t> lockp(lock_addr); // user is supposed to acquire lock before entering - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->getMemPort()); assert(gtoh(*lockp) != 0); m5_unlock_mutex(lock_addr, process, xc); diff --git a/kern/tru64/tru64_events.cc b/kern/tru64/tru64_events.cc index 8f2be6d9b..855c3cd36 100644 --- a/kern/tru64/tru64_events.cc +++ b/kern/tru64/tru64_events.cc @@ -33,6 +33,7 @@ #include "kern/tru64/dump_mbuf.hh" #include "kern/tru64/printf.hh" #include "mem/functional/memory_control.hh" +#include "arch/alpha/ev5.hh" #include "arch/arguments.hh" #include "arch/isa_traits.hh" #include "sim/system.hh" |