diff --git a/SConscript b/SConscript index 987eccceb..b4f57ddbc 100644 --- a/SConscript +++ b/SConscript @@ -45,9 +45,6 @@ Import('env') # Base sources used by all configurations. base_sources = Split(''' arch/alpha/decoder.cc - arch/alpha/alpha_o3_exec.cc - arch/alpha/fast_cpu_exec.cc - arch/alpha/simple_cpu_exec.cc arch/alpha/faults.cc arch/alpha/isa_traits.cc @@ -87,44 +84,11 @@ base_sources = Split(''' base/stats/text.cc cpu/base.cc - cpu/base_dyn_inst.cc cpu/exec_context.cc cpu/exetrace.cc cpu/pc_event.cc cpu/static_inst.cc - cpu/o3/2bit_local_pred.cc - cpu/o3/alpha_dyn_inst.cc - cpu/o3/alpha_cpu.cc - cpu/o3/alpha_cpu_builder.cc - cpu/o3/bpred_unit.cc - cpu/o3/btb.cc - cpu/o3/commit.cc - cpu/o3/decode.cc - cpu/o3/fetch.cc - cpu/o3/free_list.cc - cpu/o3/cpu.cc - cpu/o3/iew.cc - cpu/o3/inst_queue.cc - cpu/o3/ldstq.cc - cpu/o3/mem_dep_unit.cc - cpu/o3/ras.cc - cpu/o3/rename.cc - cpu/o3/rename_map.cc - cpu/o3/rob.cc - cpu/o3/sat_counter.cc - cpu/o3/store_set.cc - cpu/o3/tournament_pred.cc - cpu/fast/cpu.cc cpu/sampler/sampler.cc - cpu/simple/cpu.cc - cpu/trace/reader/mem_trace_reader.cc - cpu/trace/reader/ibm_reader.cc - cpu/trace/reader/itx_reader.cc - cpu/trace/reader/m5_reader.cc - cpu/trace/opt_cpu.cc - cpu/trace/trace_cpu.cc - - encumbered/mem/functional/main.cc mem/memory.cc mem/page_table.cc @@ -153,8 +117,28 @@ base_sources = Split(''' sim/trace_context.cc ''') +fast_cpu_sources = Split(''' + arch/alpha/fast_cpu_exec.cc + cpu/fast/cpu.cc + ''') + +simple_cpu_sources = Split(''' + arch/alpha/simple_cpu_exec.cc + cpu/simple/cpu.cc + ''') + +trace_reader_sources = Split(''' + cpu/trace/reader/mem_trace_reader.cc + cpu/trace/reader/ibm_reader.cc + cpu/trace/reader/itx_reader.cc + cpu/trace/reader/m5_reader.cc + cpu/trace/opt_cpu.cc + cpu/trace/trace_cpu.cc + ''') + full_cpu_sources = Split(''' arch/alpha/full_cpu_exec.cc + cpu/base_dyn_inst.cc encumbered/cpu/full/bpred.cc encumbered/cpu/full/commit.cc encumbered/cpu/full/cpu.cc @@ -191,6 +175,32 @@ full_cpu_sources = Split(''' encumbered/cpu/full/iq/standard/iq_standard.cc ''') +o3_cpu_sources = Split(''' + arch/alpha/alpha_o3_exec.cc + cpu/o3/2bit_local_pred.cc + cpu/o3/alpha_dyn_inst.cc + cpu/o3/alpha_cpu.cc + cpu/o3/alpha_cpu_builder.cc + cpu/o3/bpred_unit.cc + cpu/o3/btb.cc + cpu/o3/commit.cc + cpu/o3/decode.cc + cpu/o3/fetch.cc + cpu/o3/free_list.cc + cpu/o3/cpu.cc + cpu/o3/iew.cc + cpu/o3/inst_queue.cc + cpu/o3/ldstq.cc + cpu/o3/mem_dep_unit.cc + cpu/o3/ras.cc + cpu/o3/rename.cc + cpu/o3/rename_map.cc + cpu/o3/rob.cc + cpu/o3/sat_counter.cc + cpu/o3/store_set.cc + cpu/o3/tournament_pred.cc + ''') + # MySql sources mysql_sources = Split(''' base/mysql.cc diff --git a/base/loader/aout_object.cc b/base/loader/aout_object.cc index c81f7123f..18a0eaa5e 100644 --- a/base/loader/aout_object.cc +++ b/base/loader/aout_object.cc @@ -30,7 +30,7 @@ #include "base/loader/aout_object.hh" -#include "mem/functional/functional.hh" +#include "mem/memory.hh" #include "base/loader/symtab.hh" #include "base/trace.hh" // for DPRINTF @@ -78,7 +78,7 @@ AoutObject::AoutObject(const string &_filename, int _fd, bool -AoutObject::loadSections(FunctionalMemory *mem, bool loadPhys) +AoutObject::loadSections(Memory *mem, bool loadPhys) { Addr textAddr = text.baseAddr; Addr dataAddr = data.baseAddr; diff --git a/base/loader/aout_object.hh b/base/loader/aout_object.hh index 1868192b2..44061c660 100644 --- a/base/loader/aout_object.hh +++ b/base/loader/aout_object.hh @@ -46,8 +46,7 @@ class AoutObject : public ObjectFile public: virtual ~AoutObject() {} - virtual bool loadSections(FunctionalMemory *mem, - bool loadPhys = false); + virtual bool loadSections(Memory *mem, bool loadPhys = false); virtual bool loadGlobalSymbols(SymbolTable *symtab); virtual bool loadLocalSymbols(SymbolTable *symtab); diff --git a/base/loader/ecoff_object.cc b/base/loader/ecoff_object.cc index 353a5f333..7df2cfa97 100644 --- a/base/loader/ecoff_object.cc +++ b/base/loader/ecoff_object.cc @@ -30,7 +30,7 @@ #include "base/loader/ecoff_object.hh" -#include "mem/functional/functional.hh" +#include "mem/memory.hh" #include "base/loader/symtab.hh" #include "base/trace.hh" // for DPRINTF @@ -82,7 +82,7 @@ EcoffObject::EcoffObject(const string &_filename, int _fd, bool -EcoffObject::loadSections(FunctionalMemory *mem, bool loadPhys) +EcoffObject::loadSections(Memory *mem, bool loadPhys) { Addr textAddr = text.baseAddr; Addr dataAddr = data.baseAddr; diff --git a/base/loader/ecoff_object.hh b/base/loader/ecoff_object.hh index 78aa7f3f7..c39aa9a3a 100644 --- a/base/loader/ecoff_object.hh +++ b/base/loader/ecoff_object.hh @@ -50,8 +50,7 @@ class EcoffObject : public ObjectFile public: virtual ~EcoffObject() {} - virtual bool loadSections(FunctionalMemory *mem, - bool loadPhys = false); + virtual bool loadSections(Memory *mem, bool loadPhys = false); virtual bool loadGlobalSymbols(SymbolTable *symtab); virtual bool loadLocalSymbols(SymbolTable *symtab); diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index b74d537af..fcac6c7f8 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -43,7 +43,7 @@ #include "base/loader/elf_object.hh" -#include "mem/functional/functional.hh" +#include "mem/memory.hh" #include "base/loader/symtab.hh" #include "base/trace.hh" // for DPRINTF @@ -170,7 +170,7 @@ ElfObject::ElfObject(const string &_filename, int _fd, bool -ElfObject::loadSections(FunctionalMemory *mem, bool loadPhys) +ElfObject::loadSections(Memory *mem, bool loadPhys) { Addr textAddr = text.baseAddr; Addr dataAddr = data.baseAddr; diff --git a/base/loader/elf_object.hh b/base/loader/elf_object.hh index 66d8b3e63..324fe9535 100644 --- a/base/loader/elf_object.hh +++ b/base/loader/elf_object.hh @@ -48,8 +48,7 @@ class ElfObject : public ObjectFile public: virtual ~ElfObject() {} - virtual bool loadSections(FunctionalMemory *mem, - bool loadPhys = false); + virtual bool loadSections(Memory *mem, bool loadPhys = false); virtual bool loadGlobalSymbols(SymbolTable *symtab); virtual bool loadLocalSymbols(SymbolTable *symtab); diff --git a/base/loader/object_file.hh b/base/loader/object_file.hh index 26d3ef3b0..091e5493c 100644 --- a/base/loader/object_file.hh +++ b/base/loader/object_file.hh @@ -31,7 +31,7 @@ #include "targetarch/isa_traits.hh" // for Addr -class FunctionalMemory; +class Memory; class SymbolTable; class ObjectFile @@ -67,8 +67,7 @@ class ObjectFile void close(); - virtual bool loadSections(FunctionalMemory *mem, - bool loadPhys = false) = 0; + virtual bool loadSections(Memory *mem, bool loadPhys = false) = 0; virtual bool loadGlobalSymbols(SymbolTable *symtab) = 0; virtual bool loadLocalSymbols(SymbolTable *symtab) = 0; diff --git a/cpu/exec_context.cc b/cpu/exec_context.cc index 037319a8f..edab25d0b 100644 --- a/cpu/exec_context.cc +++ b/cpu/exec_context.cc @@ -51,7 +51,7 @@ using namespace std; #if FULL_SYSTEM ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, AlphaITB *_itb, AlphaDTB *_dtb, - FunctionalMemory *_mem) + Memory *_mem) : _status(ExecContext::Unallocated), cpu(_cpu), thread_num(_thread_num), cpu_id(-1), mem(_mem), itb(_itb), dtb(_dtb), system(_sys), memctrl(_sys->memctrl), physmem(_sys->physmem), @@ -77,7 +77,7 @@ ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, } #else ExecContext::ExecContext(BaseCPU *_cpu, int _thread_num, System *_system, - FunctionalMemory *_mem, Process *_process, int _asid) + Memory *_mem, Process *_process, int _asid) : _status(ExecContext::Unallocated), cpu(_cpu), thread_num(_thread_num), cpu_id(-1), system(_system), mem(_mem), diff --git a/cpu/pc_event.hh b/cpu/pc_event.hh index 7fa3902cc..585aba0f1 100644 --- a/cpu/pc_event.hh +++ b/cpu/pc_event.hh @@ -31,16 +31,11 @@ #include -#include "mem/mem_req.hh" - class ExecContext; class PCEventQueue; class PCEvent { - protected: - static const Addr badpc = MemReq::inval_addr; - protected: std::string description; PCEventQueue *queue; diff --git a/cpu/simple/cpu.cc b/cpu/simple/cpu.cc index 0760f978c..b6823fb63 100644 --- a/cpu/simple/cpu.cc +++ b/cpu/simple/cpu.cc @@ -102,17 +102,42 @@ SimpleCPU::CacheCompletionEvent::CacheCompletionEvent(SimpleCPU *_cpu) { } -void SimpleCPU::CacheCompletionEvent::process() + +bool +SimpleCPU::CpuPort::recvTiming(Packet &pkt) { - cpu->processCacheCompletion(); + cpu->processResponse(pkt); + return true; } -const char * -SimpleCPU::CacheCompletionEvent::description() +Tick +SimpleCPU::CpuPort::recvAtomic(Packet &pkt) { - return "SimpleCPU cache completion event"; + panic("CPU doesn't expect callback!"); + return curTick; } +void +SimpleCPU::CpuPort::recvFunctional(Packet &pkt) +{ + panic("CPU doesn't expect callback!"); +} + +void +SimpleCPU::CpuPort::recvStatusChange(Status status) +{ + cpu->recvStatusChange(status); +} + +Packet * +SimpleCPU::CpuPort::recvRetry() +{ + return cpu->processRetry(); +} + + + + SimpleCPU::SimpleCPU(Params *p) : BaseCPU(p), tickEvent(this, p->width), xc(NULL), cacheCompletionEvent(this), dcachePort(this), icachePort(this) @@ -697,9 +722,9 @@ SimpleCPU::sendDcacheRequest() void SimpleCPU::processResponse(Packet *response) { - // For what things is the CPU the consumer of the packet it sent out? - // This may create a memory leak if that's the case and it's expected of the - // SimpleCPU to delete its own packet. + // For what things is the CPU the consumer of the packet it sent + // out? This may create a memory leak if that's the case and it's + // expected of the SimpleCPU to delete its own packet. pkt = response; switch (status()) { diff --git a/cpu/simple/cpu.hh b/cpu/simple/cpu.hh index 42fec55f1..3d445b001 100644 --- a/cpu/simple/cpu.hh +++ b/cpu/simple/cpu.hh @@ -79,19 +79,15 @@ class SimpleCPU : public BaseCPU protected: - virtual bool recvTiming(Packet &pkt) - { cpu->processCacheCompletion(pkt); return true; } + virtual bool recvTiming(Packet &pkt); - virtual Tick recvAtomic(Packet &pkt) - { panic("CPU doesn't expect callback!"); return curTick; } + virtual Tick recvAtomic(Packet &pkt); - virtual void recvFunctional(Packet &pkt) - { panic("CPU doesn't expect callback!"); } + virtual void recvFunctional(Packet &pkt); - virtual void recvStatusChange(Status status) - { cpu->recvStatusChange(status); } + virtual void recvStatusChange(Status status); - virtual Packet *recvRetry() { return cpu->processRetry(); } + virtual Packet *recvRetry(); }; CpuPort icachePort; diff --git a/mem/port.hh b/mem/port.hh index 6b32adb57..4e335e17c 100644 --- a/mem/port.hh +++ b/mem/port.hh @@ -121,7 +121,7 @@ class Port need to use two different ports. */ virtual void recvAddressRangesQuery(std::list > &range_list, - bool &owner) = 0; + bool &owner) { panic("??"); } public: diff --git a/mem/request.hh b/mem/request.hh index 24296f1df..c3c1d0fd4 100644 --- a/mem/request.hh +++ b/mem/request.hh @@ -54,6 +54,10 @@ const unsigned ALTMODE = 0x008; const unsigned UNCACHEABLE = 0x010; /** The request should not cause a page fault. */ const unsigned NO_FAULT = 0x020; +/** The request should be prefetched into the exclusive state. */ +const unsigned PF_EXCLUSIVE = 0x100; +/** The request should be marked as LRU. */ +const unsigned EVICT_NEXT = 0x200; class Request { diff --git a/sim/process.cc b/sim/process.cc index ad8cb2e96..26d6bf708 100644 --- a/sim/process.cc +++ b/sim/process.cc @@ -42,8 +42,8 @@ #include "encumbered/cpu/full/thread.hh" #include "encumbered/eio/eio.hh" #include "mem/page_table.hh" -#include "mem/functional/physical.hh" -#include "mem/functional/proxy.hh" +#include "mem/memory.hh" +#include "mem/proxy.hh" #include "sim/builder.hh" #include "sim/fake_syscall.hh" #include "sim/process.hh" @@ -154,7 +154,7 @@ Process::startup() if (execContexts.empty()) fatal("Process %s is not associated with any CPUs!\n", name()); - initVirtMem = new ProxyMemory(system->physmem, pTable); + initVirtMem = new ProxyMemory(system->physmem, pTable); // first exec context for this process... initialize & enable ExecContext *xc = execContexts[0]; @@ -245,7 +245,7 @@ DEFINE_SIM_OBJECT_CLASS_NAME("Process", Process) static void copyStringArray(vector &strings, Addr array_ptr, Addr data_ptr, - FunctionalMemory *func) + Memory *func) { for (int i = 0; i < strings.size(); ++i) { func->prot_write(array_ptr, (uint8_t*)&data_ptr, sizeof(Addr)); diff --git a/sim/syscall_emul.hh b/sim/syscall_emul.hh index 185ada2c5..bdaae9015 100644 --- a/sim/syscall_emul.hh +++ b/sim/syscall_emul.hh @@ -43,7 +43,7 @@ #include #include "base/intmath.hh" // for RoundUp -#include "mem/functional/functional.hh" +#include "mem/port.hh" #include "targetarch/isa_traits.hh" // for Addr #include "base/trace.hh" @@ -103,18 +103,18 @@ class BaseBufferArg { // // copy data into simulator space (read from target memory) // - virtual bool copyIn(FunctionalMemory *mem) + virtual bool copyIn(Port *memport) { - mem->access(Read, addr, bufPtr, size); + memport->readBlobFunctional(addr, bufPtr, size); return true; // no EFAULT detection for now } // // copy data out of simulator space (write to target memory) // - virtual bool copyOut(FunctionalMemory *mem) + virtual bool copyOut(Port *memport) { - mem->access(Write, addr, bufPtr, size); + memport->writeBlobFunctional(addr, bufPtr, size); return true; // no EFAULT detection for now } @@ -314,7 +314,7 @@ openFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; if (path == "/dev/sysdev0") { @@ -361,7 +361,7 @@ chmodFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; uint32_t mode = xc->getSyscallArg(1); @@ -414,7 +414,7 @@ statFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; struct stat hostBuf; @@ -461,7 +461,7 @@ lstatFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; struct stat hostBuf; @@ -483,7 +483,7 @@ lstat64Func(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; struct stat64 hostBuf; @@ -530,7 +530,7 @@ statfsFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; struct statfs hostBuf; @@ -700,7 +700,7 @@ utimesFunc(SyscallDesc *desc, int callnum, Process *process, { std::string path; - if (xc->mem->readString(path, xc->getSyscallArg(0)) != No_Fault) + if (xc->mem->readStringFunctional(path, xc->getSyscallArg(0)) != No_Fault) return -EFAULT; TypedBufferArg tp(xc->getSyscallArg(1)); diff --git a/sim/system.cc b/sim/system.cc index a79038308..07eb81c71 100644 --- a/sim/system.cc +++ b/sim/system.cc @@ -29,7 +29,7 @@ #include "base/loader/object_file.hh" #include "base/loader/symtab.hh" #include "cpu/exec_context.hh" -#include "mem/functional/physical.hh" +#include "mem/memory.hh" #include "sim/builder.hh" #include "sim/system.hh" #include "base/trace.hh" @@ -410,7 +410,7 @@ printSystems() BEGIN_DECLARE_SIM_OBJECT_PARAMS(System) - SimObjectParam physmem; + SimObjectParam physmem; #if FULL_SYSTEM Param boot_cpu_frequency; diff --git a/sim/system.hh b/sim/system.hh index 6602f8582..8922373cc 100644 --- a/sim/system.hh +++ b/sim/system.hh @@ -44,7 +44,7 @@ class BaseCPU; class ExecContext; class MemoryController; class ObjectFile; -class PhysicalMemory; +class Memory; #if FULL_SYSTEM class Platform; @@ -56,7 +56,7 @@ namespace Kernel { class Binning; } class System : public SimObject { public: - PhysicalMemory *physmem; + Memory *physmem; PCEventQueue pcEventQueue; std::vector execContexts; @@ -176,7 +176,7 @@ class System : public SimObject struct Params { std::string name; - PhysicalMemory *physmem; + Memory *physmem; #if FULL_SYSTEM Tick boot_cpu_frequency;