From f102365bfe14d25e40fb6d5cbd184138c0593c55 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 9 Mar 2006 19:21:35 -0500 Subject: [PATCH] SimpleCPU compiles with merge. arch/alpha/isa_traits.hh: arch/alpha/linux/process.cc: arch/alpha/process.cc: arch/alpha/process.hh: arch/alpha/tru64/process.cc: base/chunk_generator.hh: base/loader/elf_object.cc: cpu/cpu_exec_context.cc: cpu/cpu_exec_context.hh: cpu/exec_context.hh: cpu/simple/cpu.cc: kern/linux/linux.hh: kern/tru64/tru64.hh: mem/packet.hh: mem/page_table.cc: mem/page_table.hh: mem/physical.cc: mem/request.hh: mem/translating_port.cc: sim/process.hh: sim/system.cc: Fixing merged changes. --HG-- extra : convert_revision : 2e94f21009395db654880fcb94ec806b6f5772c3 --- arch/alpha/isa_traits.hh | 2 ++ arch/alpha/linux/process.cc | 13 +++---- arch/alpha/process.cc | 6 ++-- arch/alpha/process.hh | 2 +- arch/alpha/tru64/process.cc | 21 ++++++------ base/chunk_generator.hh | 2 +- base/loader/elf_object.cc | 2 ++ cpu/cpu_exec_context.cc | 2 +- cpu/cpu_exec_context.hh | 4 +-- cpu/exec_context.hh | 22 ++++++------ cpu/simple/cpu.cc | 14 ++++---- kern/linux/linux.hh | 8 +++-- kern/tru64/tru64.hh | 68 +++++++++++++++++++------------------ mem/packet.hh | 2 +- mem/page_table.cc | 14 ++++---- mem/page_table.hh | 3 +- mem/physical.cc | 3 +- mem/request.hh | 2 +- mem/translating_port.cc | 23 +++++++------ sim/process.hh | 2 +- sim/system.cc | 4 +-- 21 files changed, 115 insertions(+), 104 deletions(-) diff --git a/arch/alpha/isa_traits.hh b/arch/alpha/isa_traits.hh index 0cf31cb50..878193881 100644 --- a/arch/alpha/isa_traits.hh +++ b/arch/alpha/isa_traits.hh @@ -344,6 +344,7 @@ extern const int reg_redir[NumIntRegs]; const Addr MaxAddr = (Addr)-1; +#if !FULL_SYSTEM static inline void setSyscallReturn(SyscallReturn return_value, RegFile *regs) { // check for error condition. Alpha syscall convention is to @@ -359,6 +360,7 @@ extern const int reg_redir[NumIntRegs]; regs->intRegFile[ReturnValueReg] = -return_value.value(); } } +#endif }; static inline AlphaISA::ExtMachInst diff --git a/arch/alpha/linux/process.cc b/arch/alpha/linux/process.cc index 1c911bc50..d40895921 100644 --- a/arch/alpha/linux/process.cc +++ b/arch/alpha/linux/process.cc @@ -32,7 +32,6 @@ #include "base/trace.hh" #include "cpu/exec_context.hh" #include "kern/linux/linux.hh" -#include "mem/functional/functional.hh" #include "sim/process.hh" #include "sim/syscall_emul.hh" @@ -55,7 +54,7 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process, strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); strcpy(name->machine, "alpha"); - name.copyOut(xc->getMemPtr()); + name.copyOut(xc->port); return 0; } @@ -75,7 +74,7 @@ osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, TypedBufferArg fpcr(xc->getSyscallArg(1)); // I don't think this exactly matches the HW FPCR *fpcr = 0; - fpcr.copyOut(xc->getMemPtr()); + fpcr.copyOut(xc->port); return 0; } @@ -101,7 +100,7 @@ osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, case 14: { // SSI_IEEE_FP_CONTROL TypedBufferArg fpcr(xc->getSyscallArg(1)); // I don't think this exactly matches the HW FPCR - fpcr.copyIn(xc->getMemPtr()); + fpcr.copyIn(xc->port); DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): " " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr)); return 0; @@ -567,15 +566,17 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = { AlphaLinuxProcess::AlphaLinuxProcess(const std::string &name, ObjectFile *objFile, + System *system, int stdin_fd, int stdout_fd, int stderr_fd, std::vector &argv, std::vector &envp) - : LiveProcess(name, objFile, stdin_fd, stdout_fd, stderr_fd, argv, envp), + : LiveProcess(name, objFile, system, stdin_fd, stdout_fd, + stderr_fd, argv, envp), Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) { - init_regs->intRegFile[0] = 0; + //init_regs->intRegFile[0] = 0; } diff --git a/arch/alpha/process.cc b/arch/alpha/process.cc index b2dbe7ad1..dc4b92861 100644 --- a/arch/alpha/process.cc +++ b/arch/alpha/process.cc @@ -32,7 +32,7 @@ namespace AlphaISA { LiveProcess * -createProcess(const std::string &nm, ObjectFile * objFile, +createProcess(const std::string &nm, ObjectFile * objFile, System *system, int stdin_fd, int stdout_fd, int stderr_fd, std::vector &argv, std::vector &envp) { @@ -41,13 +41,13 @@ createProcess(const std::string &nm, ObjectFile * objFile, fatal("Object file does not match architecture."); switch (objFile->getOpSys()) { case ObjectFile::Tru64: - process = new AlphaTru64Process(nm, objFile, + process = new AlphaTru64Process(nm, objFile, system, stdin_fd, stdout_fd, stderr_fd, argv, envp); break; case ObjectFile::Linux: - process = new AlphaLinuxProcess(nm, objFile, + process = new AlphaLinuxProcess(nm, objFile, system, stdin_fd, stdout_fd, stderr_fd, argv, envp); break; diff --git a/arch/alpha/process.hh b/arch/alpha/process.hh index 4a2a4212e..a2eb65890 100644 --- a/arch/alpha/process.hh +++ b/arch/alpha/process.hh @@ -39,7 +39,7 @@ namespace AlphaISA { LiveProcess * -createProcess(const std::string &nm, ObjectFile * objFile, +createProcess(const std::string &nm, ObjectFile * objFile, System * system, int stdin_fd, int stdout_fd, int stderr_fd, std::vector &argv, std::vector &envp); diff --git a/arch/alpha/tru64/process.cc b/arch/alpha/tru64/process.cc index c3a203587..55de67ace 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 "mem/functional/functional.hh" #include "sim/fake_syscall.hh" #include "sim/process.hh" #include "sim/syscall_emul.hh" @@ -51,7 +50,7 @@ unameFunc(SyscallDesc *desc, int callnum, Process *process, strcpy(name->version, "732"); strcpy(name->machine, "alpha"); - name.copyOut(xc->getMemPtr()); + name.copyOut(xc->port); return 0; } @@ -68,21 +67,21 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, case Tru64::GSI_MAX_CPU: { TypedBufferArg max_cpu(xc->getSyscallArg(1)); *max_cpu = htog((uint32_t)process->numCpus()); - max_cpu.copyOut(xc->getMemPtr()); + max_cpu.copyOut(xc->port); return 1; } case Tru64::GSI_CPUS_IN_BOX: { TypedBufferArg cpus_in_box(xc->getSyscallArg(1)); *cpus_in_box = htog((uint32_t)process->numCpus()); - cpus_in_box.copyOut(xc->getMemPtr()); + cpus_in_box.copyOut(xc->port); return 1; } case Tru64::GSI_PHYSMEM: { TypedBufferArg physmem(xc->getSyscallArg(1)); *physmem = htog((uint64_t)1024 * 1024); // physical memory in KB - physmem.copyOut(xc->getMemPtr()); + physmem.copyOut(xc->port); return 1; } @@ -99,14 +98,14 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, infop->cpu_ex_binding = htog(0); infop->mhz = htog(667); - infop.copyOut(xc->getMemPtr()); + infop.copyOut(xc->port); return 1; } case Tru64::GSI_PROC_TYPE: { TypedBufferArg proc_type(xc->getSyscallArg(1)); *proc_type = htog((uint64_t)11); - proc_type.copyOut(xc->getMemPtr()); + proc_type.copyOut(xc->port); return 1; } @@ -115,14 +114,14 @@ getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, strncpy((char *)bufArg.bufferPtr(), "COMPAQ Professional Workstation XP1000", nbytes); - bufArg.copyOut(xc->getMemPtr()); + bufArg.copyOut(xc->port); return 1; } case Tru64::GSI_CLK_TCK: { TypedBufferArg clk_hz(xc->getSyscallArg(1)); *clk_hz = htog((uint64_t)1024); - clk_hz.copyOut(xc->getMemPtr()); + clk_hz.copyOut(xc->port); return 1; } @@ -531,12 +530,14 @@ AlphaTru64Process::getDesc(int callnum) AlphaTru64Process::AlphaTru64Process(const std::string &name, ObjectFile *objFile, + System *system, int stdin_fd, int stdout_fd, int stderr_fd, std::vector &argv, std::vector &envp) - : LiveProcess(name, objFile, stdin_fd, stdout_fd, stderr_fd, argv, envp), + : LiveProcess(name, objFile, system, stdin_fd, stdout_fd, + stderr_fd, argv, envp), Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)), Num_Mach_Syscall_Descs(sizeof(machSyscallDescs) / sizeof(SyscallDesc)) { diff --git a/base/chunk_generator.hh b/base/chunk_generator.hh index a584679d0..1dca50db4 100644 --- a/base/chunk_generator.hh +++ b/base/chunk_generator.hh @@ -36,7 +36,7 @@ #include #include "base/intmath.hh" -#include "targetarch/isa_traits.hh" // for Addr +#include "arch/isa_traits.hh" // for Addr /** * This class takes an arbitrary memory region (address/length pair) diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index 1136686f0..9a67f1887 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -47,6 +47,8 @@ #include "base/trace.hh" // for DPRINTF +#include "sim/byteswap.hh" + using namespace std; diff --git a/cpu/cpu_exec_context.cc b/cpu/cpu_exec_context.cc index 6ef42762d..f840c38dc 100644 --- a/cpu/cpu_exec_context.cc +++ b/cpu/cpu_exec_context.cc @@ -92,7 +92,7 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num, } CPUExecContext::CPUExecContext(RegFile *regFile) - : cpu(NULL), thread_num(-1), process(NULL), mem(NULL), asid(-1), + : cpu(NULL), thread_num(-1), process(NULL), asid(-1), func_exe_inst(0), storeCondFailures(0) { regs = *regFile; diff --git a/cpu/cpu_exec_context.hh b/cpu/cpu_exec_context.hh index e17cfbb94..6f725d1e4 100644 --- a/cpu/cpu_exec_context.hh +++ b/cpu/cpu_exec_context.hh @@ -363,15 +363,13 @@ class CPUExecContext { panic("instRead not implemented"); // return funcPhysMem->read(req, inst); - return No_Fault; + return NoFault; } void setCpuId(int id) { cpu_id = id; } int readCpuId() { return cpu_id; } - FunctionalMemory *getMemPtr() { return mem; } - void copyArchRegs(ExecContext *xc); // diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 2b6c41bd7..c917b46e9 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -30,7 +30,7 @@ #define __CPU_EXEC_CONTEXT_HH__ #include "config/full_system.hh" -#include "mem/mem_req.hh" +#include "mem/request.hh" #include "sim/faults.hh" #include "sim/host.hh" #include "sim/serialize.hh" @@ -43,8 +43,8 @@ class AlphaDTB; class AlphaITB; class BaseCPU; class Event; -class FunctionalMemory; class PhysicalMemory; +class TranslatingPort; class Process; class System; @@ -79,6 +79,8 @@ class ExecContext Halted }; + TranslatingPort * port; + virtual ~ExecContext() { }; virtual BaseCPU *getCpuPtr() = 0; @@ -87,8 +89,6 @@ class ExecContext virtual int readCpuId() = 0; - virtual FunctionalMemory *getMemPtr() = 0; - #if FULL_SYSTEM virtual System *getSystemPtr() = 0; @@ -148,11 +148,11 @@ class ExecContext virtual int getInstAsid() = 0; virtual int getDataAsid() = 0; - virtual Fault translateInstReq(MemReqPtr &req) = 0; + virtual Fault translateInstReq(CpuRequestPtr &req) = 0; - virtual Fault translateDataReadReq(MemReqPtr &req) = 0; + virtual Fault translateDataReadReq(CpuRequestPtr &req) = 0; - virtual Fault translateDataWriteReq(MemReqPtr &req) = 0; + virtual Fault translateDataWriteReq(CpuRequestPtr &req) = 0; // Also somewhat obnoxious. Really only used for the TLB fault. // However, may be quite useful in SPARC. @@ -249,8 +249,6 @@ class ProxyExecContext : public ExecContext int readCpuId() { return actualXC->readCpuId(); } - FunctionalMemory *getMemPtr() { return actualXC->getMemPtr(); } - #if FULL_SYSTEM System *getSystemPtr() { return actualXC->getSystemPtr(); } @@ -310,13 +308,13 @@ class ProxyExecContext : public ExecContext int getInstAsid() { return actualXC->getInstAsid(); } int getDataAsid() { return actualXC->getDataAsid(); } - Fault translateInstReq(MemReqPtr &req) + Fault translateInstReq(CpuRequestPtr &req) { return actualXC->translateInstReq(req); } - Fault translateDataReadReq(MemReqPtr &req) + Fault translateDataReadReq(CpuRequestPtr &req) { return actualXC->translateDataReadReq(req); } - Fault translateDataWriteReq(MemReqPtr &req) + Fault translateDataWriteReq(CpuRequestPtr &req) { return actualXC->translateDataWriteReq(req); } // @todo: Do I need this? diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc index fc70df662..4ac8c845c 100644 --- a/cpu/simple/cpu.cc +++ b/cpu/simple/cpu.cc @@ -410,7 +410,7 @@ SimpleCPU::copySrcTranslate(Addr src) } return fault; #else - return No_Fault; + return NoFault; #endif } @@ -462,7 +462,7 @@ SimpleCPU::copy(Addr dest) return fault; #else panic("copy not implemented"); - return No_Fault; + return NoFault; #endif } @@ -483,7 +483,7 @@ SimpleCPU::read(Addr addr, T &data, unsigned flags) } // @todo: Figure out a way to create a Fault from the packet result. - return No_Fault; + return NoFault; } // memReq->reset(addr, sizeof(T), flags); @@ -501,7 +501,7 @@ SimpleCPU::read(Addr addr, T &data, unsigned flags) Fault fault = cpuXC->translateDataReadReq(data_read_req); // Now do the access. - if (fault == No_Fault) { + if (fault == NoFault) { #if SIMPLE_CPU_MEM_TIMING data_read_pkt = new Packet; data_read_pkt->cmd = Read; @@ -525,7 +525,7 @@ SimpleCPU::read(Addr addr, T &data, unsigned flags) } // @todo: Figure out a way to create a Fault from the packet result. - return No_Fault; + return NoFault; #endif } /* @@ -616,7 +616,7 @@ SimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res) // translate to physical address Fault fault = cpuXC->translateDataWriteReq(data_write_req); // Now do the access. - if (fault == No_Fault) { + if (fault == NoFault) { #if SIMPLE_CPU_MEM_TIMING data_write_pkt = new Packet; data_write_pkt->cmd = Write; @@ -974,7 +974,7 @@ SimpleCPU::tick() IFETCH_FLAGS(xc->regs.pc)); */ - fault = xc->translateInstReq(ifetch_req); + fault = cpuXC->translateInstReq(ifetch_req); if (fault == NoFault) { #if SIMPLE_CPU_MEM_TIMING diff --git a/kern/linux/linux.hh b/kern/linux/linux.hh index 0dbccf546..4244eb369 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,7 +242,7 @@ 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) { TypedBufferArg tgt(addr); @@ -264,7 +266,7 @@ 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) { TypedBufferArg tgt(addr); @@ -289,7 +291,7 @@ 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) { TypedBufferArg tgt(addr); diff --git a/kern/tru64/tru64.hh b/kern/tru64/tru64.hh index 112f00f31..11d331765 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,7 +542,7 @@ class Tru64 { /// memory space. Used by stat(), fstat(), and lstat(). template static void - copyOutStatBuf(FunctionalMemory *mem, Addr addr, global_stat *host) + copyOutStatBuf(TranslatingPort *mem, Addr addr, global_stat *host) { TypedBufferArg tgt(addr); @@ -566,7 +568,7 @@ class Tru64 { /// memory space. Used by statfs() and fstatfs(). template static void - copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, global_statfs *host) + copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { TypedBufferArg tgt(addr); @@ -590,13 +592,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(mem, addr, host); } - static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { Tru64::copyOutStatfsBuf(mem, addr, host); @@ -605,13 +607,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(mem, addr, host); } - static void copyOutStatfsBuf(FunctionalMemory *mem, Addr addr, + static void copyOutStatfsBuf(TranslatingPort *mem, Addr addr, global_statfs *host) { Tru64::copyOutStatfsBuf(mem, addr, host); @@ -623,7 +625,7 @@ 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) { TypedBufferArg tgt(addr); @@ -666,7 +668,7 @@ class Tru64 { // just pass basep through uninterpreted. TypedBufferArg basep(tgt_basep); - basep.copyIn(xc->getMemPtr()); + basep.copyIn(xc->port); long host_basep = (off_t)htog((int64_t)*basep); int host_result = getdirentries(fd, host_buf, tgt_nbytes, &host_basep); @@ -693,7 +695,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->port); tgt_buf_ptr += tgt_bufsize; host_buf_ptr += host_dp->d_reclen; @@ -702,7 +704,7 @@ class Tru64 { delete [] host_buf; *basep = htog((int64_t)host_basep); - basep.copyOut(xc->getMemPtr()); + basep.copyOut(xc->port); return tgt_buf_ptr - tgt_buf; #endif @@ -716,7 +718,7 @@ class Tru64 { using TheISA::RegFile; TypedBufferArg sc(xc->getSyscallArg(0)); - sc.copyIn(xc->getMemPtr()); + sc.copyIn(xc->port); // Restore state from sigcontext structure. // Note that we'll advance PC <- NPC before the end of the cycle, @@ -761,7 +763,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->port); return 0; } @@ -782,7 +784,7 @@ class Tru64 { { TypedBufferArg argp(xc->getSyscallArg(0)); - argp.copyIn(xc->getMemPtr()); + argp.copyIn(xc->port); // if the user chose an address, just let them have it. Otherwise // pick one for them. @@ -791,7 +793,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->port); } return 0; @@ -811,7 +813,7 @@ class Tru64 { TypedBufferArg attrp(xc->getSyscallArg(0)); TypedBufferArg configptr_ptr(xc->getSyscallArg(1)); - attrp.copyIn(xc->getMemPtr()); + attrp.copyIn(xc->port); if (gtoh(attrp->nxm_version) != NXM_LIB_VERSION) { cerr << "nxm_task_init: thread library version mismatch! " @@ -852,7 +854,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->port); // initialize the slot_state array and copy it out TypedBufferArg slot_state(slot_state_addr, @@ -865,7 +867,7 @@ class Tru64 { (i == 0) ? Tru64::NXM_SLOT_BOUND : Tru64::NXM_SLOT_AVAIL; } - slot_state.copyOut(xc->getMemPtr()); + slot_state.copyOut(xc->port); // 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 +901,13 @@ class Tru64 { } } - rad_state.copyOut(xc->getMemPtr()); + rad_state.copyOut(xc->port); // // copy pointer to shared config area out to user // *configptr_ptr = htog(config_addr); - configptr_ptr.copyOut(xc->getMemPtr()); + configptr_ptr.copyOut(xc->port); // Register this as a valid address range with the process process->nxm_start = base_addr; @@ -942,7 +944,7 @@ class Tru64 { int thread_index = xc->getSyscallArg(2); // get attribute args - attrp.copyIn(xc->getMemPtr()); + attrp.copyIn(xc->port); if (gtoh(attrp->version) != NXM_LIB_VERSION) { cerr << "nxm_thread_create: thread library version mismatch! " @@ -967,7 +969,7 @@ class Tru64 { TypedBufferArg rad_state(0x14000, rad_state_size); - rad_state.copyIn(xc->getMemPtr()); + rad_state.copyIn(xc->port); uint64_t uniq_val = gtoh(attrp->pthid) - gtoh(rad_state->nxm_uniq_offset); @@ -978,7 +980,7 @@ class Tru64 { // This is supposed to be a port number. Make something up. *kidp = htog(99); - kidp.copyOut(xc->getMemPtr()); + kidp.copyOut(xc->port); return 0; } else if (gtoh(attrp->type) == Tru64::NXM_TYPE_VP) { @@ -992,7 +994,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->port); Addr slot_state_addr = 0x12000 + sizeof(Tru64::nxm_config_info); int slot_state_size = @@ -1002,7 +1004,7 @@ class Tru64 { slot_state(slot_state_addr, slot_state_size); - slot_state.copyIn(xc->getMemPtr()); + slot_state.copyIn(xc->port); if (slot_state[thread_index] != Tru64::NXM_SLOT_AVAIL) { cerr << "nxm_thread_createFunc: requested VP slot " @@ -1014,7 +1016,7 @@ class Tru64 { // doesn't work anyway slot_state[thread_index] = Tru64::NXM_SLOT_BOUND; - slot_state.copyOut(xc->getMemPtr()); + slot_state.copyOut(xc->port); // Find a free simulator execution context. for (int i = 0; i < process->numCpus(); ++i) { @@ -1028,7 +1030,7 @@ class Tru64 { // and get away with just sticking the thread index // here. *kidp = htog(thread_index); - kidp.copyOut(xc->getMemPtr()); + kidp.copyOut(xc->port); return 0; } @@ -1157,12 +1159,12 @@ class Tru64 { { TypedBufferArg lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->port); if (gtoh(*lockp) == 0) { // lock is free: grab it *lockp = htog(1); - lockp.copyOut(xc->getMemPtr()); + lockp.copyOut(xc->port); } else { // lock is busy: disable until free process->waitList.push_back(Process::WaitRec(uaddr, xc)); @@ -1176,7 +1178,7 @@ class Tru64 { { TypedBufferArg lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->port); assert(*lockp != 0); // Check for a process waiting on the lock. @@ -1185,7 +1187,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->port); } } @@ -1212,12 +1214,12 @@ class Tru64 { Addr uaddr = xc->getSyscallArg(0); TypedBufferArg lockp(uaddr); - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->port); if (gtoh(*lockp) == 0) { // lock is free: grab it *lockp = htog(1); - lockp.copyOut(xc->getMemPtr()); + lockp.copyOut(xc->port); return 0; } else { return 1; @@ -1272,7 +1274,7 @@ class Tru64 { TypedBufferArg lockp(lock_addr); // user is supposed to acquire lock before entering - lockp.copyIn(xc->getMemPtr()); + lockp.copyIn(xc->port); assert(gtoh(*lockp) != 0); m5_unlock_mutex(lock_addr, process, xc); diff --git a/mem/packet.hh b/mem/packet.hh index ef4eb85d9..260fc60f7 100644 --- a/mem/packet.hh +++ b/mem/packet.hh @@ -36,7 +36,7 @@ #define __MEM_PACKET_HH__ #include "mem/request.hh" -#include "targetarch/isa_traits.hh" +#include "arch/isa_traits.hh" #include "sim/root.hh" struct Packet; diff --git a/mem/page_table.cc b/mem/page_table.cc index 63b60de24..714ddde35 100644 --- a/mem/page_table.cc +++ b/mem/page_table.cc @@ -34,6 +34,7 @@ #include #include +#include "arch/faults.hh" #include "base/bitfield.hh" #include "base/intmath.hh" #include "base/trace.hh" @@ -43,6 +44,7 @@ #include "sim/system.hh" using namespace std; +using namespace TheISA; PageTable::PageTable(System *_system, Addr _pageSize) : pageSize(_pageSize), offsetMask(mask(floorLog2(_pageSize))), @@ -61,23 +63,23 @@ PageTable::page_check(Addr addr, int size) const if (size < sizeof(uint64_t)) { if (!isPowerOf2(size)) { panic("Invalid request size!\n"); - return Machine_Check_Fault; + return genMachineCheckFault(); } if ((size - 1) & addr) - return Alignment_Fault; + return genAlignmentFault(); } else { if ((addr & (VMPageSize - 1)) + size > VMPageSize) { panic("Invalid request size!\n"); - return Machine_Check_Fault; + return genMachineCheckFault(); } if ((sizeof(uint64_t) - 1) & addr) - return Alignment_Fault; + return genAlignmentFault(); } - return No_Fault; + return NoFault; } @@ -123,7 +125,7 @@ PageTable::translate(CpuRequestPtr &req) { assert(pageAlign(req->vaddr + req->size - 1) == pageAlign(req->vaddr)); if (!translate(req->vaddr, req->paddr)) { - return Machine_Check_Fault; + return genMachineCheckFault(); } return page_check(req->paddr, req->size); } diff --git a/mem/page_table.hh b/mem/page_table.hh index d318783be..8f0842f58 100644 --- a/mem/page_table.hh +++ b/mem/page_table.hh @@ -37,6 +37,7 @@ #include #include +#include "arch/isa_traits.hh" #include "base/trace.hh" #include "mem/request.hh" #include "mem/packet.hh" @@ -59,7 +60,7 @@ class PageTable public: - PageTable(System *_system, Addr _pageSize = VMPageSize); + PageTable(System *_system, Addr _pageSize = TheISA::VMPageSize); ~PageTable(); diff --git a/mem/physical.cc b/mem/physical.cc index 69544c8fe..c69cfd538 100644 --- a/mem/physical.cc +++ b/mem/physical.cc @@ -44,10 +44,11 @@ #include "sim/host.hh" #include "sim/builder.hh" #include "sim/eventq.hh" -#include "targetarch/isa_traits.hh" +#include "arch/isa_traits.hh" using namespace std; +using namespace TheISA; PhysicalMemory::MemResponseEvent::MemResponseEvent(Packet &pkt, MemoryPort* _m) : Event(&mainEventQueue, CPU_Tick_Pri), pkt(pkt), memoryPort(_m) diff --git a/mem/request.hh b/mem/request.hh index c3c1d0fd4..5e2275741 100644 --- a/mem/request.hh +++ b/mem/request.hh @@ -34,7 +34,7 @@ #ifndef __MEM_REQUEST_HH__ #define __MEM_REQUEST_HH__ -#include "targetarch/isa_traits.hh" +#include "arch/isa_traits.hh" class Request; class CpuRequest; diff --git a/mem/translating_port.cc b/mem/translating_port.cc index f4f2ca737..42101dad0 100644 --- a/mem/translating_port.cc +++ b/mem/translating_port.cc @@ -27,11 +27,14 @@ */ #include +#include "arch/faults.hh" #include "base/chunk_generator.hh" #include "mem/port.hh" #include "mem/translating_port.hh" #include "mem/page_table.hh" +using namespace TheISA; + TranslatingPort::TranslatingPort(Port *_port, PageTable *p_table) : port(_port), pTable(p_table) { } @@ -48,13 +51,13 @@ 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 Machine_Check_Fault; + return genMachineCheckFault(); port->readBlobFunctional(paddr, p + prevSize, gen.size()); prevSize += gen.size(); } - return No_Fault; + return NoFault; } Fault @@ -72,7 +75,7 @@ TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, VMPageSize); pTable->translate(gen.addr(), paddr); } else { - return Machine_Check_Fault; + return genMachineCheckFault(); } } @@ -80,7 +83,7 @@ TranslatingPort::writeBlobFunctional(Addr addr, uint8_t *p, int size, prevSize += gen.size(); } - return No_Fault; + return NoFault; } @@ -98,14 +101,14 @@ TranslatingPort::memsetBlobFunctional(Addr addr, uint8_t val, int size, VMPageSize); pTable->translate(gen.addr(), paddr); } else { - return Machine_Check_Fault; + return genMachineCheckFault(); } } port->memsetBlobFunctional(paddr, val, gen.size()); } - return No_Fault; + return NoFault; } @@ -120,12 +123,12 @@ TranslatingPort::writeStringFunctional(Addr addr, const char *str) do { c = *str++; if (!pTable->translate(vaddr++,paddr)) - return Machine_Check_Fault; + return genMachineCheckFault(); port->writeBlobFunctional(paddr, &c, 1); } while (c); - return No_Fault; + return NoFault; } Fault @@ -138,12 +141,12 @@ TranslatingPort::readStringFunctional(std::string &str, Addr addr) do { if (!pTable->translate(vaddr++,paddr)) - return Machine_Check_Fault; + return genMachineCheckFault(); port->readBlobFunctional(paddr, &c, 1); str += c; } while (c); - return No_Fault; + return NoFault; } diff --git a/sim/process.hh b/sim/process.hh index fc600fb06..476cb8ecf 100644 --- a/sim/process.hh +++ b/sim/process.hh @@ -48,7 +48,7 @@ #include "mem/page_table.hh" #include "sim/sim_object.hh" #include "sim/stats.hh" -#include "targetarch/isa_traits.hh" +#include "arch/isa_traits.hh" class CPUExecContext; class ExecContext; diff --git a/sim/system.cc b/sim/system.cc index 3ed7ed590..f1d0579d7 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -1,7 +1,6 @@ #include "base/loader/object_file.hh" #include "base/loader/symtab.hh" #include "cpu/exec_context.hh" -#include "arch/vtophys.hh" #include "mem/memory.hh" #include "sim/builder.hh" #include "arch/isa_traits.hh" @@ -12,7 +11,7 @@ #include "base/remote_gdb.hh" #include "kern/kernel_stats.hh" #include "mem/functional/memory_control.hh" -#include "targetarch/vtophys.hh" +#include "arch/vtophys.hh" #endif using namespace std; @@ -72,7 +71,6 @@ System::System(Params *p) DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry); DPRINTF(Loader, "Kernel loaded...\n"); -#if FULL_SYSTEM kernelBinning = new Kernel::Binning(this); #endif // FULL_SYSTEM