diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/linux/events.cc | 2 | ||||
-rw-r--r-- | kern/linux/linux.hh | 82 | ||||
-rw-r--r-- | kern/linux/printk.cc | 2 | ||||
-rw-r--r-- | kern/linux/printk.hh | 4 | ||||
-rw-r--r-- | kern/system_events.cc | 8 | ||||
-rw-r--r-- | kern/tru64/dump_mbuf.hh | 4 | ||||
-rw-r--r-- | kern/tru64/printf.cc | 2 | ||||
-rw-r--r-- | kern/tru64/printf.hh | 4 | ||||
-rw-r--r-- | kern/tru64/tru64.hh | 222 | ||||
-rw-r--r-- | kern/tru64/tru64_events.cc | 18 |
10 files changed, 110 insertions, 238 deletions
diff --git a/kern/linux/events.cc b/kern/linux/events.cc index 9f50eef04..b688e9dd0 100644 --- a/kern/linux/events.cc +++ b/kern/linux/events.cc @@ -46,7 +46,7 @@ DebugPrintkEvent::process(ExecContext *xc) DPRINTFN(""); } - AlphaArguments args(xc); + AlphaISA::AlphaArguments args(xc); Printk(args); SkipFuncEvent::process(xc); } diff --git a/kern/linux/linux.hh b/kern/linux/linux.hh index 0dbccf546..63e0dd5ca 100644 --- a/kern/linux/linux.hh +++ b/kern/linux/linux.hh @@ -44,8 +44,11 @@ class Linux {}; #include <sys/types.h> #include <unistd.h> +#include "arch/isa_traits.hh" #include "sim/syscall_emul.hh" +class TranslatingPort; + /// /// This class encapsulates the types, structures, constants, /// functions, and syscall-number mappings specific to the Alpha Linux @@ -72,33 +75,6 @@ class Linux { typedef struct stat64 hst_stat64; #endif - - //@{ - /// open(2) flag values. - static const int TGT_O_RDONLY = 00000000; //!< O_RDONLY - static const int TGT_O_WRONLY = 00000001; //!< O_WRONLY - static const int TGT_O_RDWR = 00000002; //!< O_RDWR - static const int TGT_O_NONBLOCK = 00000004; //!< O_NONBLOCK - static const int TGT_O_APPEND = 00000010; //!< O_APPEND - static const int TGT_O_CREAT = 00001000; //!< O_CREAT - static const int TGT_O_TRUNC = 00002000; //!< O_TRUNC - static const int TGT_O_EXCL = 00004000; //!< O_EXCL - static const int TGT_O_NOCTTY = 00010000; //!< O_NOCTTY - static const int TGT_O_SYNC = 00040000; //!< O_SYNC - static const int TGT_O_DRD = 00100000; //!< O_DRD - static const int TGT_O_DIRECTIO = 00200000; //!< O_DIRECTIO - static const int TGT_O_CACHE = 00400000; //!< O_CACHE - static const int TGT_O_DSYNC = 02000000; //!< O_DSYNC - static const int TGT_O_RSYNC = 04000000; //!< O_RSYNC - //@} - - /// This table maps the target open() flags to the corresponding - /// host open() flags. - static OpenFlagTransTable openFlagTable[]; - - /// Number of entries in openFlagTable[]. - static const int NUM_OPEN_FLAGS; - /// Stat buffer. Note that we can't call it 'stat' since that /// gets #defined to something else on some systems. struct tgt_stat { @@ -156,46 +132,12 @@ class Linux { char machine[_SYS_NMLN]; //!< Machine type. }; - - //@{ - /// ioctl() command codes. - static const unsigned TIOCGETP = 0x40067408; - static const unsigned TIOCSETP = 0x80067409; - static const unsigned TIOCSETN = 0x8006740a; - static const unsigned TIOCSETC = 0x80067411; - static const unsigned TIOCGETC = 0x40067412; - static const unsigned FIONREAD = 0x4004667f; - static const unsigned TIOCISATTY = 0x2000745e; - static const unsigned TIOCGETS = 0x402c7413; - static const unsigned TIOCGETA = 0x40127417; - //@} - - /// Resource enumeration for getrlimit(). - enum rlimit_resources { - TGT_RLIMIT_CPU = 0, - TGT_RLIMIT_FSIZE = 1, - TGT_RLIMIT_DATA = 2, - TGT_RLIMIT_STACK = 3, - TGT_RLIMIT_CORE = 4, - TGT_RLIMIT_RSS = 5, - TGT_RLIMIT_NOFILE = 6, - TGT_RLIMIT_AS = 7, - TGT_RLIMIT_VMEM = 7, - TGT_RLIMIT_NPROC = 8, - TGT_RLIMIT_MEMLOCK = 9, - TGT_RLIMIT_LOCKS = 10 - }; - /// Limit struct for getrlimit/setrlimit. struct rlimit { uint64_t rlim_cur; //!< soft limit uint64_t rlim_max; //!< hard limit }; - - /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x10; - /// For gettimeofday(). struct timeval { int64_t tv_sec; //!< seconds @@ -208,12 +150,6 @@ class Linux { uint64_t iov_len; }; - //@{ - /// For getrusage(). - static const int TGT_RUSAGE_SELF = 0; - static const int TGT_RUSAGE_CHILDREN = -1; - static const int TGT_RUSAGE_BOTH = -2; - //@} /// For getrusage(). struct rusage { @@ -240,8 +176,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 +202,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 +229,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/linux/printk.cc b/kern/linux/printk.cc index f5313759b..918b8dabe 100644 --- a/kern/linux/printk.cc +++ b/kern/linux/printk.cc @@ -36,7 +36,7 @@ using namespace std; void -Printk(AlphaArguments args) +Printk(AlphaISA::AlphaArguments args) { char *p = (char *)args++; diff --git a/kern/linux/printk.hh b/kern/linux/printk.hh index 45eab6b88..b88c40f5e 100644 --- a/kern/linux/printk.hh +++ b/kern/linux/printk.hh @@ -29,8 +29,8 @@ #ifndef __PRINTK_HH__ #define __PRINTK_HH__ -class AlphaArguments; +class AlphaISA::AlphaArguments; -void Printk(AlphaArguments args); +void Printk(AlphaISA::AlphaArguments args); #endif // __PRINTK_HH__ diff --git a/kern/system_events.cc b/kern/system_events.cc index 9b9861497..fd5c12e44 100644 --- a/kern/system_events.cc +++ b/kern/system_events.cc @@ -26,8 +26,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "encumbered/cpu/full/cpu.hh" +#include "cpu/base.hh" +#include "cpu/cpu_exec_context.hh" #include "kern/kernel_stats.hh" +#include "kern/system_events.hh" +#include "sim/system.hh" using namespace TheISA; @@ -41,11 +44,12 @@ SkipFuncEvent::process(ExecContext *xc) xc->setPC(newpc); xc->setNextPC(xc->readPC() + sizeof(TheISA::MachInst)); - +/* BranchPred *bp = xc->getCpuPtr()->getBranchPred(); if (bp != NULL) { bp->popRAS(xc->getThreadNum()); } +*/ } diff --git a/kern/tru64/dump_mbuf.hh b/kern/tru64/dump_mbuf.hh index 0ff5da3d7..9e1698ff1 100644 --- a/kern/tru64/dump_mbuf.hh +++ b/kern/tru64/dump_mbuf.hh @@ -29,10 +29,10 @@ #ifndef __DUMP_MBUF_HH__ #define __DUMP_MBUF_HH__ -class AlphaArguments; +#include "arch/arguments.hh" namespace tru64 { - void DumpMbuf(AlphaArguments args); + void DumpMbuf(AlphaISA::AlphaArguments args); } #endif // __DUMP_MBUF_HH__ diff --git a/kern/tru64/printf.cc b/kern/tru64/printf.cc index 77ac17c3a..319d36673 100644 --- a/kern/tru64/printf.cc +++ b/kern/tru64/printf.cc @@ -40,7 +40,7 @@ using namespace std; namespace tru64 { void -Printf(AlphaArguments args) +Printf(AlphaISA::AlphaArguments args) { char *p = (char *)args++; diff --git a/kern/tru64/printf.hh b/kern/tru64/printf.hh index a48b4482c..61236e83a 100644 --- a/kern/tru64/printf.hh +++ b/kern/tru64/printf.hh @@ -29,10 +29,10 @@ #ifndef __PRINTF_HH__ #define __PRINTF_HH__ -class AlphaArguments; +#include "arch/arguments.hh" namespace tru64 { - void Printf(AlphaArguments args); + void Printf(AlphaISA::AlphaArguments args); } #endif // __PRINTF_HH__ diff --git a/kern/tru64/tru64.hh b/kern/tru64/tru64.hh index 112f00f31..91db5bb84 100644 --- a/kern/tru64/tru64.hh +++ b/kern/tru64/tru64.hh @@ -55,12 +55,12 @@ class Tru64 {}; #include "sim/root.hh" #include "sim/syscall_emul.hh" -using namespace std; - 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 @@ -85,32 +85,6 @@ class Tru64 { typedef quad fsid_t; //@} - //@{ - /// open(2) flag values. - static const int TGT_O_RDONLY = 00000000; - static const int TGT_O_WRONLY = 00000001; - static const int TGT_O_RDWR = 00000002; - static const int TGT_O_NONBLOCK = 00000004; - static const int TGT_O_APPEND = 00000010; - static const int TGT_O_CREAT = 00001000; - static const int TGT_O_TRUNC = 00002000; - static const int TGT_O_EXCL = 00004000; - static const int TGT_O_NOCTTY = 00010000; - static const int TGT_O_SYNC = 00040000; - static const int TGT_O_DRD = 00100000; - static const int TGT_O_DIRECTIO = 00200000; - static const int TGT_O_CACHE = 00400000; - static const int TGT_O_DSYNC = 02000000; - static const int TGT_O_RSYNC = 04000000; - //@} - - /// This table maps the target open() flags to the corresponding - /// host open() flags. - static OpenFlagTransTable openFlagTable[]; - - /// Number of entries in openFlagTable[]. - static const int NUM_OPEN_FLAGS; - /// Stat buffer. Note that Tru64 v5.0+ use a new "F64" stat /// structure, and a new set of syscall numbers for stat calls. /// On some hosts (notably Linux) define st_atime, st_mtime, and @@ -246,33 +220,6 @@ class Tru64 { char machine[_SYS_NMLN]; //!< Machine type. }; - //@{ - /// ioctl() command codes. - static const unsigned TIOCGETP = 0x40067408; - static const unsigned TIOCSETP = 0x80067409; - static const unsigned TIOCSETN = 0x8006740a; - static const unsigned TIOCSETC = 0x80067411; - static const unsigned TIOCGETC = 0x40067412; - static const unsigned FIONREAD = 0x4004667f; - static const unsigned TIOCISATTY = 0x2000745e; - // TIOCGETS not defined in tru64, so I made up a number - static const unsigned TIOCGETS = 0x40000000; - static const unsigned TIOCGETA = 0x402c7413; - //@} - - /// Resource enumeration for getrlimit(). - enum rlimit_resources { - TGT_RLIMIT_CPU = 0, - TGT_RLIMIT_FSIZE = 1, - TGT_RLIMIT_DATA = 2, - TGT_RLIMIT_STACK = 3, - TGT_RLIMIT_CORE = 4, - TGT_RLIMIT_RSS = 5, - TGT_RLIMIT_NOFILE = 6, - TGT_RLIMIT_AS = 7, - TGT_RLIMIT_VMEM = 7 - }; - /// Limit struct for getrlimit/setrlimit. struct rlimit { uint64_t rlim_cur; //!< soft limit @@ -280,21 +227,6 @@ class Tru64 { }; - /// For mmap(). - static const unsigned TGT_MAP_ANONYMOUS = 0x10; - - - //@{ - /// For getsysinfo(). - static const unsigned GSI_PLATFORM_NAME = 103; //!< platform name as string - static const unsigned GSI_CPU_INFO = 59; //!< CPU information - static const unsigned GSI_PROC_TYPE = 60; //!< get proc_type - static const unsigned GSI_MAX_CPU = 30; //!< max # cpu's on this machine - static const unsigned GSI_CPUS_IN_BOX = 55; //!< number of CPUs in system - static const unsigned GSI_PHYSMEM = 19; //!< Physical memory in KB - static const unsigned GSI_CLK_TCK = 42; //!< clock freq in Hz - //@} - /// For getsysinfo() GSI_CPU_INFO option. struct cpu_info { uint32_t current_cpu; //!< current_cpu @@ -309,24 +241,12 @@ class Tru64 { uint32_t unused[3]; //!< future expansion }; - //@{ - /// For setsysinfo(). - static const unsigned SSI_IEEE_FP_CONTROL = 14; //!< ieee_set_fp_control() - //@} - /// For gettimeofday. struct timeval { uint32_t tv_sec; //!< seconds uint32_t tv_usec; //!< microseconds }; - //@{ - /// For getrusage(). - static const int TGT_RUSAGE_THREAD = 1; - static const int TGT_RUSAGE_SELF = 0; - static const int TGT_RUSAGE_CHILDREN = -1; - //@} - /// For getrusage(). struct rusage { struct timeval ru_utime; //!< user time used @@ -372,8 +292,6 @@ class Tru64 { }; - /// For table(). - static const int TBL_SYSINFO = 12; /// For table(). struct tbl_sysinfo { @@ -540,8 +458,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 +486,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 +512,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 +527,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 +545,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 +578,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 +592,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 +619,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 +628,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 +639,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 +654,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)); @@ -734,42 +662,6 @@ class Tru64 { return 0; } - /// Target table() handler. - static SyscallReturn - tableFunc(SyscallDesc *desc, int callnum, Process *process, - ExecContext *xc) - { - 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 - int nel = xc->getSyscallArg(3); // number of elements - int lel = xc->getSyscallArg(4); // expected element size - - switch (id) { - case Tru64::TBL_SYSINFO: { - if (index != 0 || nel != 1 || lel != sizeof(Tru64::tbl_sysinfo)) - return -EINVAL; - TypedBufferArg<Tru64::tbl_sysinfo> elp(xc->getSyscallArg(2)); - - const int clk_hz = one_million; - elp->si_user = htog(curTick / (Clock::Frequency / clk_hz)); - elp->si_nice = htog(0); - elp->si_sys = htog(0); - elp->si_idle = htog(0); - elp->wait = htog(0); - elp->si_hz = htog(clk_hz); - 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()); - return 0; - } - - default: - cerr << "table(): id " << id << " unknown." << endl; - return -EINVAL; - } - } // // Mach syscalls -- identified by negated syscall numbers @@ -780,9 +672,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 +685,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 +702,13 @@ class Tru64 { nxm_task_initFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace std; + 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 +749,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 +762,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 +796,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 +816,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 +836,15 @@ class Tru64 { nxm_thread_createFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace std; + 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 +869,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 +880,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 +894,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 +904,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 +916,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 +930,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; } @@ -1059,6 +961,8 @@ class Tru64 { nxm_thread_blockFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace std; + uint64_t tid = xc->getSyscallArg(0); uint64_t secs = xc->getSyscallArg(1); uint64_t flags = xc->getSyscallArg(2); @@ -1076,6 +980,8 @@ class Tru64 { nxm_blockFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace std; + Addr uaddr = xc->getSyscallArg(0); uint64_t val = xc->getSyscallArg(1); uint64_t secs = xc->getSyscallArg(2); @@ -1097,6 +1003,8 @@ class Tru64 { nxm_unblockFunc(SyscallDesc *desc, int callnum, Process *process, ExecContext *xc) { + using namespace std; + Addr uaddr = xc->getSyscallArg(0); cout << xc->getCpuPtr()->name() << ": nxm_unblock " @@ -1127,6 +1035,8 @@ class Tru64 { activate_waiting_context(Addr uaddr, Process *process, bool activate_all = false) { + using namespace std; + int num_activated = 0; list<Process::WaitRec>::iterator i = process->waitList.begin(); @@ -1155,14 +1065,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 +1088,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 +1097,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 +1121,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 +1180,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..69fc5c55d 100644 --- a/kern/tru64/tru64_events.cc +++ b/kern/tru64/tru64_events.cc @@ -32,7 +32,7 @@ #include "kern/tru64/tru64_events.hh" #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" @@ -50,9 +50,19 @@ BadAddrEvent::process(ExecContext *xc) uint64_t a0 = xc->readIntReg(ArgumentReg0); - if (!TheISA::IsK0Seg(a0) || - xc->getSystemPtr()->memctrl->badaddr( - TheISA::K0Seg2Phys(a0) & EV5::PAddrImplMask)) { + AddrRangeList resp; + AddrRangeList snoop; + AddrRangeIter iter; + bool found = false; + + xc->getPhysPort()->getPeerAddressRanges(resp, snoop); + for(iter = resp.begin(); iter != resp.end(); iter++) + { + if (*iter == (TheISA::K0Seg2Phys(a0) & EV5::PAddrImplMask)) + found = true; + } + + if (!TheISA::IsK0Seg(a0) || found ) { DPRINTF(BADADDR, "badaddr arg=%#x bad\n", a0); xc->setIntReg(ReturnValueReg, 0x1); |