diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2006-04-06 15:00:11 -0400 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2006-04-06 15:00:11 -0400 |
commit | 6a962f8343d0e7f138baa4034633c986eecc9edf (patch) | |
tree | f16fdcc7455b0e7cd14af660ebdeb029db3c669a /cpu | |
parent | 3124c5b7bb0cdcb3b16b52533c6a3e50a5970152 (diff) | |
parent | 6240f8c4bcf12e3367905adfba066bb14f79262a (diff) | |
download | gem5-6a962f8343d0e7f138baa4034633c986eecc9edf.tar.xz |
Merge m5.eecs.umich.edu:/bk/newmem
into ewok.(none):/home/gblack/m5/newmem
--HG--
extra : convert_revision : bd6352647798275a12d52d55a129cdddd8e25423
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/cpu_exec_context.cc | 44 | ||||
-rw-r--r-- | cpu/cpu_exec_context.hh | 32 | ||||
-rw-r--r-- | cpu/exec_context.hh | 14 |
3 files changed, 79 insertions, 11 deletions
diff --git a/cpu/cpu_exec_context.cc b/cpu/cpu_exec_context.cc index 3236bb6d3..62419adcf 100644 --- a/cpu/cpu_exec_context.cc +++ b/cpu/cpu_exec_context.cc @@ -57,8 +57,9 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, AlphaITB *_itb, AlphaDTB *_dtb) : _status(ExecContext::Unallocated), cpu(_cpu), thread_num(_thread_num), cpu_id(-1), lastActivate(0), lastSuspend(0), system(_sys), itb(_itb), - dtb(_dtb), memctrl(_sys->memctrl), profile(NULL), - quiesceEvent(this), func_exe_inst(0), storeCondFailures(0) + dtb(_dtb), profile(NULL), quiesceEvent(this), func_exe_inst(0), + storeCondFailures(0) + { proxy = new ProxyExecContext<CPUExecContext>(this); @@ -77,6 +78,17 @@ CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num, System *_sys, static ProfileNode dummyNode; profileNode = &dummyNode; profilePC = 3; + + Port *mem_port; + physPort = new FunctionalPort(); + mem_port = system->physmem->getPort("functional"); + mem_port->setPeer(physPort); + physPort->setPeer(mem_port); + + virtPort = new VirtualPort(); + mem_port = system->physmem->getPort("functional"); + mem_port->setPeer(virtPort); + virtPort->setPeer(mem_port); } #else CPUExecContext::CPUExecContext(BaseCPU *_cpu, int _thread_num, @@ -278,3 +290,31 @@ CPUExecContext::copyArchRegs(ExecContext *xc) TheISA::copyRegs(xc, proxy); } +#if FULL_SYSTEM +VirtualPort* +CPUExecContext::getVirtPort(ExecContext *xc) +{ + if (!xc) + return virtPort; + + VirtualPort *vp; + Port *mem_port; + + vp = new VirtualPort(xc); + mem_port = system->physmem->getPort("functional"); + mem_port->setPeer(vp); + vp->setPeer(mem_port); + return vp; +} + +void +CPUExecContext::delVirtPort(VirtualPort *vp) +{ + assert(!vp->nullExecContext()); + delete vp->getPeer(); + delete vp; +} + + +#endif + diff --git a/cpu/cpu_exec_context.hh b/cpu/cpu_exec_context.hh index b023fdcf8..feaf29d12 100644 --- a/cpu/cpu_exec_context.hh +++ b/cpu/cpu_exec_context.hh @@ -48,7 +48,9 @@ class BaseCPU; class FunctionProfile; class ProfileNode; -class MemoryController; +class FunctionalPort; +class PhysicalPort; + #else // !FULL_SYSTEM @@ -56,6 +58,7 @@ class MemoryController; #include "mem/page_table.hh" class TranslatingPort; + #endif // FULL_SYSTEM // @@ -126,11 +129,13 @@ class CPUExecContext AlphaITB *itb; AlphaDTB *dtb; - // the following two fields are redundant, since we can always - // look them up through the system pointer, but we'll leave them - // here for now for convenience - MemoryController *memctrl; -// PhysicalMemory *physmem; + /** A functional port outgoing only for functional accesses to physical + * addresses.*/ + FunctionalPort *physPort; + + /** A functional port, outgoing only, for functional accesse to virtual + * addresses. That doen't require execution context information */ + VirtualPort *virtPort; FunctionProfile *profile; ProfileNode *profileNode; @@ -238,19 +243,28 @@ class CPUExecContext Fault translateInstReq(CpuRequestPtr &req) { - return itb->translate(req); + return itb->translate(req, proxy); } Fault translateDataReadReq(CpuRequestPtr &req) { - return dtb->translate(req, false); + return dtb->translate(req, proxy, false); } Fault translateDataWriteReq(CpuRequestPtr &req) { - return dtb->translate(req, true); + return dtb->translate(req, proxy, true); } + FunctionalPort *getPhysPort() { return physPort; } + + /** Return a virtual port. If no exec context is specified then a static + * port is returned. Otherwise a port is created and returned. It must be + * deleted by deleteVirtPort(). */ + VirtualPort *getVirtPort(ExecContext *xc); + + void delVirtPort(VirtualPort *vp); + #else TranslatingPort *getMemPort() { return port; } diff --git a/cpu/exec_context.hh b/cpu/exec_context.hh index 2fd49b166..dd3d2cba1 100644 --- a/cpu/exec_context.hh +++ b/cpu/exec_context.hh @@ -43,6 +43,8 @@ class AlphaITB; class BaseCPU; class Event; class TranslatingPort; +class FunctionalPort; +class VirtualPort; class Process; class System; @@ -93,6 +95,12 @@ class ExecContext virtual AlphaITB *getITBPtr() = 0; virtual AlphaDTB * getDTBPtr() = 0; + + virtual FunctionalPort *getPhysPort() = 0; + + virtual VirtualPort *getVirtPort(ExecContext *xc = NULL) = 0; + + virtual void delVirtPort(VirtualPort *vp) = 0; #else virtual TranslatingPort *getMemPort() = 0; @@ -262,6 +270,12 @@ class ProxyExecContext : public ExecContext AlphaITB *getITBPtr() { return actualXC->getITBPtr(); } AlphaDTB *getDTBPtr() { return actualXC->getDTBPtr(); } + + FunctionalPort *getPhysPort() { return actualXC->getPhysPort(); } + + VirtualPort *getVirtPort(ExecContext *xc = NULL) { return actualXC->getVirtPort(xc); } + + void delVirtPort(VirtualPort *vp) { return actualXC->delVirtPort(vp); } #else TranslatingPort *getMemPort() { return actualXC->getMemPort(); } |