cpu/static_inst.cc
cpu/sampler/sampler.cc
- mem/memory.cc
+ mem/mem_object.cc
mem/page_table.cc
mem/physical.cc
mem/port.cc
namespace Kernel { class Statistics; }
class BranchPred;
class ExecContext;
-class Port;
class BaseCPU : public SimObject
{
#else // !FULL_SYSTEM
#include "sim/process.hh"
+#include "mem/page_table.hh"
class TranslatingPort;
#endif // FULL_SYSTEM
#include "arch/stacktrace.hh"
#include "arch/vtophys.hh"
#else // !FULL_SYSTEM
-#include "mem/memory.hh"
+#include "mem/mem_object.hh"
#endif // FULL_SYSTEM
using namespace std;
_status = Idle;
//Create Memory Ports (conect them up)
- p->mem->addPort("DCACHE");
- dcachePort.setPeer(p->mem->getPort("DCACHE"));
- (p->mem->getPort("DCACHE"))->setPeer(&dcachePort);
+ Port *mem_dport = p->mem->getPort();
+ dcachePort.setPeer(mem_dport);
+ mem_dport->setPeer(&dcachePort);
- p->mem->addPort("ICACHE");
- icachePort.setPeer(p->mem->getPort("ICACHE"));
- (p->mem->getPort("ICACHE"))->setPeer(&icachePort);
+ Port *mem_iport = p->mem->getPort();
+ icachePort.setPeer(mem_iport);
+ mem_iport->setPeer(&icachePort);
#if FULL_SYSTEM
cpuXC = new CPUExecContext(this, 0, p->system, p->itb, p->dtb, p->mem);
Param<int> cpu_id;
Param<Tick> profile;
#else
- SimObjectParam<Memory *> mem;
+ SimObjectParam<MemObject *> mem;
SimObjectParam<Process *> workload;
#endif // FULL_SYSTEM
class Processor;
class AlphaITB;
class AlphaDTB;
-class Memory;
+class MemObject;
class RemoteGDB;
class GDBListener;
#endif // FULL_SYSTEM
class ExecContext;
-class MemInterface;
class Checkpoint;
namespace Trace {
AlphaITB *itb;
AlphaDTB *dtb;
#else
- Memory *mem;
+ MemObject *mem;
Process *process;
#endif
};
--- /dev/null
+/*
+ * Copyright (c) 2002-2005 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "mem/mem_object.hh"
+#include "sim/param.hh"
+
+MemObject::MemObject(const std::string &name)
+ : SimObject(name)
+{
+}
+
+DEFINE_SIM_OBJECT_CLASS_NAME("MemObject", MemObject)
}
PhysicalMemory::PhysicalMemory(const string &n)
- : Memory(n), base_addr(0), pmem_addr(NULL)
+ : MemObject(n), base_addr(0), pmem_addr(NULL)
{
// Hardcoded to 128 MB for now.
pmem_size = 1 << 27;
return return_addr;
}
-Port *
-PhysicalMemory::addPort(std::string portName)
-{
- memoryPortList[portName] = new MemoryPort(this);
- return memoryPortList[portName];
-}
-
int
PhysicalMemory::deviceBlockSize()
{
Port *
PhysicalMemory::getPort(const char *if_name)
{
- if (memoryPortList.find(if_name) != memoryPortList.end())
- return memoryPortList[if_name];
- else
- panic("Looking for a port that didn't exist\n");
+ if (if_name == NULL) {
+ return new MemoryPort(this);
+ } else {
+ panic("PhysicalMemory::getPort: unknown port %s requested", if_name);
+ }
}
void
#define __PHYSICAL_MEMORY_HH__
#include "base/range.hh"
-#include "mem/memory.hh"
+#include "mem/mem_object.hh"
#include "mem/packet.hh"
#include "mem/port.hh"
#include "sim/eventq.hh"
#include <map>
#include <string>
+
//
// Functional model for a contiguous block of physical memory. (i.e. RAM)
//
-class PhysicalMemory : public Memory
+class PhysicalMemory : public MemObject
{
class MemoryPort : public Port
{
virtual int deviceBlockSize();
};
- std::map<std::string, MemoryPort*> memoryPortList;
-
virtual Port * getPort(const char *if_name);
- virtual Port * addPort(std::string portName);
-
int numPorts;
int lat;
#ifndef __MEM_TRANSLATING_PROT_HH__
#define __MEM_TRANSLATING_PROT_HH__
-#include "mem/memory.hh"
-
class Port;
class PageTable;
#include "config/full_system.hh"
#include "cpu/exec_context.hh"
#include "mem/page_table.hh"
-#include "mem/memory.hh"
+#include "mem/mem_object.hh"
#include "mem/translating_port.hh"
#include "sim/builder.hh"
#include "sim/process.hh"
if (execContexts.empty())
fatal("Process %s is not associated with any CPUs!\n", name());
- initVirtMem = new TranslatingPort((system->physmem->getPort("DCACHE"))->getPeer(), pTable);
-
// first exec context for this process... initialize & enable
ExecContext *xc = execContexts[0];
// mark this context as active so it will start ticking.
xc->activate(0);
+
+ // Here we are grabbing the memory port of the CPU hosting the
+ // initial execution context for initialization. In the long run
+ // this is not what we want, since it means that all
+ // initialization accesses (e.g., loading object file sections)
+ // will be done a cache block at a time through the CPU's cache.
+ // We really want something more like:
+ //
+ // memport = system->physmem->getPort();
+ // myPort.setPeer(memport);
+ // memport->setPeer(&myPort);
+ // initVirtMem = new TranslatingPort(myPort, pTable);
+ //
+ // but we need our own dummy port "myPort" that doesn't exist.
+ // In the short term it works just fine though.
+ initVirtMem = xc->getMemPort();
}
void
desc->doSyscall(callnum, this, xc);
}
+
LiveProcess *
LiveProcess::create(const string &nm, System *system,
int stdin_fd, int stdout_fd, int stderr_fd,
#include <vector>
-#include "arch/isa_traits.hh"
#include "base/statistics.hh"
-#include "base/trace.hh"
-#include "mem/memory.hh"
-//#include "mem/mem_interface.hh"
-#include "mem/page_table.hh"
#include "sim/sim_object.hh"
-#include "sim/stats.hh"
-#include "arch/isa_traits.hh"
class CPUExecContext;
class ExecContext;
class SyscallDesc;
+class PageTable;
class TranslatingPort;
class System;
class Process : public SimObject
{
- protected:
- typedef TheISA::RegFile RegFile;
- typedef TheISA::MachInst MachInst;
public:
/// Pointer to object representing the system this process is
virtual void syscall(ExecContext *xc);
- virtual SyscallDesc* getDesc(int callnum) { panic("Must be implemented."); }
-
+ virtual SyscallDesc* getDesc(int callnum) = 0;
};
#include "base/intmath.hh" // for RoundUp
#include "mem/translating_port.hh"
#include "arch/isa_traits.hh" // for Addr
-
+#include "base/misc.hh"
#include "base/trace.hh"
#include "cpu/exec_context.hh"
#include "cpu/base.hh"
#include "base/loader/object_file.hh"
#include "base/loader/symtab.hh"
#include "cpu/exec_context.hh"
-#include "mem/memory.hh"
#include "sim/builder.hh"
#include "arch/isa_traits.hh"
#include "sim/byteswap.hh"
#include "sim/system.hh"
#include "base/trace.hh"
+#include "mem/mem_object.hh"
#if FULL_SYSTEM
#include "base/remote_gdb.hh"
#include "kern/kernel_stats.hh"
BEGIN_DECLARE_SIM_OBJECT_PARAMS(System)
- SimObjectParam<Memory *> physmem;
+ SimObjectParam<MemObject *> physmem;
END_DECLARE_SIM_OBJECT_PARAMS(System)
class ExecContext;
class MemoryController;
class ObjectFile;
-class Memory;
+class MemObject;
#if FULL_SYSTEM
class Platform;
class System : public SimObject
{
public:
- Memory *physmem;
+ MemObject *physmem;
PCEventQueue pcEventQueue;
std::vector<ExecContext *> execContexts;
struct Params
{
std::string name;
- Memory *physmem;
+ MemObject *physmem;
#if FULL_SYSTEM
Tick boot_cpu_frequency;