Major changes to how SimObjects are created and initialized. Almost all
creation and initialization now happens in python. Parameter objects are generated and initialized by python. The .ini file is now solely for debugging purposes and is not used in construction of the objects in any way. --HG-- extra : convert_revision : 7e722873e417cb3d696f2e34c35ff488b7bff4ed
This commit is contained in:
@@ -35,8 +35,14 @@ class AlphaTLB(SimObject):
|
||||
|
||||
class AlphaDTB(AlphaTLB):
|
||||
type = 'AlphaDTB'
|
||||
cxx_namespace = 'AlphaISA'
|
||||
cxx_class = 'DTB'
|
||||
|
||||
size = 64
|
||||
|
||||
class AlphaITB(AlphaTLB):
|
||||
type = 'AlphaITB'
|
||||
cxx_namespace = 'AlphaISA'
|
||||
cxx_class = 'ITB'
|
||||
|
||||
size = 48
|
||||
|
||||
@@ -35,16 +35,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "arch/alpha/system.hh"
|
||||
#include "arch/alpha/freebsd/system.hh"
|
||||
#include "arch/alpha/system.hh"
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "arch/vtophys.hh"
|
||||
#include "base/loader/symtab.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "mem/physical.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
#include "arch/vtophys.hh"
|
||||
|
||||
#define TIMER_FREQUENCY 1193180
|
||||
|
||||
@@ -92,64 +91,8 @@ FreebsdAlphaSystem::SkipCalibrateClocksEvent::process(ThreadContext *tc)
|
||||
((FreebsdAlphaSystem *)tc->getSystemPtr())->doCalibrateClocks(tc);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
|
||||
|
||||
Param<Tick> boot_cpu_frequency;
|
||||
SimObjectParam<PhysicalMemory *> physmem;
|
||||
SimpleEnumParam<System::MemoryMode> mem_mode;
|
||||
|
||||
Param<string> kernel;
|
||||
Param<string> console;
|
||||
Param<string> pal;
|
||||
|
||||
Param<string> boot_osflags;
|
||||
Param<string> readfile;
|
||||
Param<string> symbolfile;
|
||||
Param<unsigned int> init_param;
|
||||
|
||||
Param<uint64_t> system_type;
|
||||
Param<uint64_t> system_rev;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
|
||||
|
||||
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
|
||||
INIT_PARAM(physmem, "phsyical memory"),
|
||||
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
|
||||
System::MemoryModeStrings),
|
||||
INIT_PARAM(kernel, "file that contains the kernel code"),
|
||||
INIT_PARAM(console, "file that contains the console code"),
|
||||
INIT_PARAM(pal, "file that contains palcode"),
|
||||
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
||||
"a"),
|
||||
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
|
||||
INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
|
||||
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
|
||||
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
|
||||
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(FreebsdAlphaSystem)
|
||||
|
||||
CREATE_SIM_OBJECT(FreebsdAlphaSystem)
|
||||
FreebsdAlphaSystem *
|
||||
FreebsdAlphaSystemParams::create()
|
||||
{
|
||||
AlphaSystem::Params *p = new AlphaSystem::Params;
|
||||
p->name = getInstanceName();
|
||||
p->boot_cpu_frequency = boot_cpu_frequency;
|
||||
p->physmem = physmem;
|
||||
p->mem_mode = mem_mode;
|
||||
p->kernel_path = kernel;
|
||||
p->console_path = console;
|
||||
p->palcode = pal;
|
||||
p->boot_osflags = boot_osflags;
|
||||
p->init_param = init_param;
|
||||
p->readfile = readfile;
|
||||
p->symbolfile = symbolfile;
|
||||
p->system_type = system_type;
|
||||
p->system_rev = system_rev;
|
||||
return new FreebsdAlphaSystem(p);
|
||||
return new FreebsdAlphaSystem(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("FreebsdAlphaSystem", FreebsdAlphaSystem)
|
||||
|
||||
|
||||
@@ -28,10 +28,13 @@
|
||||
* Authors: Ben Nash
|
||||
*/
|
||||
|
||||
#ifndef __KERN_FREEBSD_FREEBSD_SYSTEM_HH__
|
||||
#define __KERN_FREEBSD_FREEBSD_SYSTEM_HH__
|
||||
#ifndef __ARCH_ALPHA_FREEBSD_SYSTEM_HH__
|
||||
#define __ARCH_ALPHA_FREEBSD_SYSTEM_HH__
|
||||
|
||||
#include "arch/alpha/system.hh"
|
||||
#include "kern/system_events.hh"
|
||||
#include "params/FreebsdAlphaSystem.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
class FreebsdAlphaSystem : public AlphaSystem
|
||||
{
|
||||
@@ -49,10 +52,12 @@ class FreebsdAlphaSystem : public AlphaSystem
|
||||
SkipCalibrateClocksEvent *skipCalibrateClocks;
|
||||
|
||||
public:
|
||||
typedef FreebsdAlphaSystemParams Params;
|
||||
FreebsdAlphaSystem(Params *p);
|
||||
~FreebsdAlphaSystem();
|
||||
|
||||
void doCalibrateClocks(ThreadContext *tc);
|
||||
|
||||
};
|
||||
|
||||
#endif // __KERN_FREEBSD_FREEBSD_SYSTEM_HH__
|
||||
#endif // __ARCH_ALPHA_FREEBSD_SYSTEM_HH__
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include "kern/linux/events.hh"
|
||||
#include "mem/physical.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
|
||||
using namespace std;
|
||||
@@ -192,64 +191,8 @@ LinuxAlphaSystem::PrintThreadInfo::process(ThreadContext *tc)
|
||||
ti.curTaskName(), ti.curTaskPID(), ti.curTaskStart());
|
||||
}
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
|
||||
|
||||
Param<Tick> boot_cpu_frequency;
|
||||
SimObjectParam<PhysicalMemory *> physmem;
|
||||
SimpleEnumParam<System::MemoryMode> mem_mode;
|
||||
|
||||
Param<string> kernel;
|
||||
Param<string> console;
|
||||
Param<string> pal;
|
||||
|
||||
Param<string> boot_osflags;
|
||||
Param<string> readfile;
|
||||
Param<string> symbolfile;
|
||||
Param<unsigned int> init_param;
|
||||
|
||||
Param<uint64_t> system_type;
|
||||
Param<uint64_t> system_rev;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
|
||||
|
||||
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
|
||||
INIT_PARAM(physmem, "phsyical memory"),
|
||||
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
|
||||
System::MemoryModeStrings),
|
||||
INIT_PARAM(kernel, "file that contains the kernel code"),
|
||||
INIT_PARAM(console, "file that contains the console code"),
|
||||
INIT_PARAM(pal, "file that contains palcode"),
|
||||
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
||||
"a"),
|
||||
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
|
||||
INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
|
||||
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
|
||||
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
|
||||
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(LinuxAlphaSystem)
|
||||
|
||||
CREATE_SIM_OBJECT(LinuxAlphaSystem)
|
||||
LinuxAlphaSystem *
|
||||
LinuxAlphaSystemParams::create()
|
||||
{
|
||||
AlphaSystem::Params *p = new AlphaSystem::Params;
|
||||
p->name = getInstanceName();
|
||||
p->boot_cpu_frequency = boot_cpu_frequency;
|
||||
p->physmem = physmem;
|
||||
p->mem_mode = mem_mode;
|
||||
p->kernel_path = kernel;
|
||||
p->console_path = console;
|
||||
p->palcode = pal;
|
||||
p->boot_osflags = boot_osflags;
|
||||
p->init_param = init_param;
|
||||
p->readfile = readfile;
|
||||
p->symbolfile = symbolfile;
|
||||
p->system_type = system_type;
|
||||
p->system_rev = system_rev;
|
||||
return new LinuxAlphaSystem(p);
|
||||
return new LinuxAlphaSystem(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("LinuxAlphaSystem", LinuxAlphaSystem)
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ class IdleStartEvent;
|
||||
#include "arch/alpha/idle_event.hh"
|
||||
#include "arch/alpha/system.hh"
|
||||
#include "kern/linux/events.hh"
|
||||
#include "params/LinuxAlphaSystem.hh"
|
||||
|
||||
using namespace AlphaISA;
|
||||
using namespace Linux;
|
||||
@@ -129,6 +130,7 @@ class LinuxAlphaSystem : public AlphaSystem
|
||||
IdleStartEvent *idleStartEvent;
|
||||
|
||||
public:
|
||||
typedef LinuxAlphaSystemParams Params;
|
||||
LinuxAlphaSystem(Params *p);
|
||||
~LinuxAlphaSystem();
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#include "base/loader/symtab.hh"
|
||||
#include "base/trace.hh"
|
||||
#include "mem/physical.hh"
|
||||
#include "params/AlphaSystem.hh"
|
||||
#include "sim/byteswap.hh"
|
||||
#include "sim/builder.hh"
|
||||
|
||||
|
||||
using namespace LittleEndianGuest;
|
||||
@@ -56,14 +56,14 @@ AlphaSystem::AlphaSystem(Params *p)
|
||||
* Load the pal, and console code into memory
|
||||
*/
|
||||
// Load Console Code
|
||||
console = createObjectFile(params()->console_path);
|
||||
console = createObjectFile(params()->console);
|
||||
if (console == NULL)
|
||||
fatal("Could not load console file %s", params()->console_path);
|
||||
fatal("Could not load console file %s", params()->console);
|
||||
|
||||
// Load pal file
|
||||
pal = createObjectFile(params()->palcode);
|
||||
pal = createObjectFile(params()->pal);
|
||||
if (pal == NULL)
|
||||
fatal("Could not load PALcode file %s", params()->palcode);
|
||||
fatal("Could not load PALcode file %s", params()->pal);
|
||||
|
||||
|
||||
// Load program sections into memory
|
||||
@@ -212,65 +212,8 @@ AlphaSystem::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
palSymtab->unserialize("pal_symtab", cp, section);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
|
||||
|
||||
Param<Tick> boot_cpu_frequency;
|
||||
SimObjectParam<PhysicalMemory *> physmem;
|
||||
SimpleEnumParam<System::MemoryMode> mem_mode;
|
||||
|
||||
Param<std::string> kernel;
|
||||
Param<std::string> console;
|
||||
Param<std::string> pal;
|
||||
|
||||
Param<std::string> boot_osflags;
|
||||
Param<std::string> readfile;
|
||||
Param<std::string> symbolfile;
|
||||
Param<unsigned int> init_param;
|
||||
|
||||
Param<uint64_t> system_type;
|
||||
Param<uint64_t> system_rev;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(AlphaSystem)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
|
||||
|
||||
INIT_PARAM(boot_cpu_frequency, "Frequency of the boot CPU"),
|
||||
INIT_PARAM(physmem, "phsyical memory"),
|
||||
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
|
||||
System::MemoryModeStrings),
|
||||
INIT_PARAM(kernel, "file that contains the kernel code"),
|
||||
INIT_PARAM(console, "file that contains the console code"),
|
||||
INIT_PARAM(pal, "file that contains palcode"),
|
||||
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
||||
"a"),
|
||||
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
|
||||
INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
|
||||
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
|
||||
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 34),
|
||||
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 1<<10)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(AlphaSystem)
|
||||
|
||||
CREATE_SIM_OBJECT(AlphaSystem)
|
||||
AlphaSystem *
|
||||
AlphaSystemParams::create()
|
||||
{
|
||||
AlphaSystem::Params *p = new AlphaSystem::Params;
|
||||
p->name = getInstanceName();
|
||||
p->boot_cpu_frequency = boot_cpu_frequency;
|
||||
p->physmem = physmem;
|
||||
p->mem_mode = mem_mode;
|
||||
p->kernel_path = kernel;
|
||||
p->console_path = console;
|
||||
p->palcode = pal;
|
||||
p->boot_osflags = boot_osflags;
|
||||
p->init_param = init_param;
|
||||
p->readfile = readfile;
|
||||
p->symbolfile = symbolfile;
|
||||
p->system_type = system_type;
|
||||
p->system_rev = system_rev;
|
||||
return new AlphaSystem(p);
|
||||
return new AlphaSystem(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("AlphaSystem", AlphaSystem)
|
||||
|
||||
|
||||
|
||||
@@ -35,25 +35,18 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "sim/system.hh"
|
||||
#include "base/loader/symtab.hh"
|
||||
#include "cpu/pc_event.hh"
|
||||
#include "kern/system_events.hh"
|
||||
#include "params/AlphaSystem.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
class AlphaSystem : public System
|
||||
{
|
||||
public:
|
||||
struct Params : public System::Params
|
||||
{
|
||||
std::string console_path;
|
||||
std::string palcode;
|
||||
uint64_t system_type;
|
||||
uint64_t system_rev;
|
||||
};
|
||||
|
||||
typedef AlphaSystemParams Params;
|
||||
AlphaSystem(Params *p);
|
||||
|
||||
~AlphaSystem();
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
#include "base/trace.hh"
|
||||
#include "config/alpha_tlaser.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "sim/builder.hh"
|
||||
#include "params/AlphaDTB.hh"
|
||||
#include "params/AlphaITB.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace EV5;
|
||||
@@ -600,44 +601,14 @@ TLB::index(bool advance)
|
||||
|
||||
/* end namespace AlphaISA */ }
|
||||
|
||||
DEFINE_SIM_OBJECT_CLASS_NAME("AlphaTLB", TLB)
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(ITB)
|
||||
|
||||
Param<int> size;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(ITB)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(ITB)
|
||||
|
||||
INIT_PARAM_DFLT(size, "TLB size", 48)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(ITB)
|
||||
|
||||
|
||||
CREATE_SIM_OBJECT(ITB)
|
||||
AlphaISA::ITB *
|
||||
AlphaITBParams::create()
|
||||
{
|
||||
return new ITB(getInstanceName(), size);
|
||||
return new AlphaISA::ITB(name, size);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("AlphaITB", ITB)
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(DTB)
|
||||
|
||||
Param<int> size;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(DTB)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(DTB)
|
||||
|
||||
INIT_PARAM_DFLT(size, "TLB size", 64)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(DTB)
|
||||
|
||||
|
||||
CREATE_SIM_OBJECT(DTB)
|
||||
AlphaISA::DTB *
|
||||
AlphaDTBParams::create()
|
||||
{
|
||||
return new DTB(getInstanceName(), size);
|
||||
return new AlphaISA::DTB(name, size);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("AlphaDTB", DTB)
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "kern/system_events.hh"
|
||||
#include "mem/physical.hh"
|
||||
#include "mem/port.hh"
|
||||
#include "sim/builder.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -91,63 +90,8 @@ Tru64AlphaSystem::~Tru64AlphaSystem()
|
||||
#endif
|
||||
}
|
||||
|
||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
|
||||
|
||||
Param<Tick> boot_cpu_frequency;
|
||||
SimObjectParam<PhysicalMemory *> physmem;
|
||||
SimpleEnumParam<System::MemoryMode> mem_mode;
|
||||
|
||||
Param<string> kernel;
|
||||
Param<string> console;
|
||||
Param<string> pal;
|
||||
|
||||
Param<string> boot_osflags;
|
||||
Param<string> readfile;
|
||||
Param<string> symbolfile;
|
||||
Param<unsigned int> init_param;
|
||||
|
||||
Param<uint64_t> system_type;
|
||||
Param<uint64_t> system_rev;
|
||||
|
||||
END_DECLARE_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
|
||||
|
||||
BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
|
||||
|
||||
INIT_PARAM(boot_cpu_frequency, "frequency of the boot cpu"),
|
||||
INIT_PARAM(physmem, "phsyical memory"),
|
||||
INIT_ENUM_PARAM(mem_mode, "Memory Mode, (1=atomic, 2=timing)",
|
||||
System::MemoryModeStrings),
|
||||
INIT_PARAM(kernel, "file that contains the kernel code"),
|
||||
INIT_PARAM(console, "file that contains the console code"),
|
||||
INIT_PARAM(pal, "file that contains palcode"),
|
||||
INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot",
|
||||
"a"),
|
||||
INIT_PARAM_DFLT(readfile, "file to read startup script from", ""),
|
||||
INIT_PARAM_DFLT(symbolfile, "file to read symbols from", ""),
|
||||
INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0),
|
||||
INIT_PARAM_DFLT(system_type, "Type of system we are emulating", 12),
|
||||
INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1)
|
||||
|
||||
END_INIT_SIM_OBJECT_PARAMS(Tru64AlphaSystem)
|
||||
|
||||
CREATE_SIM_OBJECT(Tru64AlphaSystem)
|
||||
Tru64AlphaSystem *
|
||||
Tru64AlphaSystemParams::create()
|
||||
{
|
||||
AlphaSystem::Params *p = new AlphaSystem::Params;
|
||||
p->name = getInstanceName();
|
||||
p->boot_cpu_frequency = boot_cpu_frequency;
|
||||
p->physmem = physmem;
|
||||
p->mem_mode = mem_mode;
|
||||
p->kernel_path = kernel;
|
||||
p->console_path = console;
|
||||
p->palcode = pal;
|
||||
p->boot_osflags = boot_osflags;
|
||||
p->init_param = init_param;
|
||||
p->readfile = readfile;
|
||||
p->symbolfile = symbolfile;
|
||||
p->system_type = system_type;
|
||||
p->system_rev = system_rev;
|
||||
|
||||
return new Tru64AlphaSystem(p);
|
||||
return new Tru64AlphaSystem(this);
|
||||
}
|
||||
|
||||
REGISTER_SIM_OBJECT("Tru64AlphaSystem", Tru64AlphaSystem)
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "arch/alpha/system.hh"
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "params/Tru64AlphaSystem.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
class ThreadContext;
|
||||
@@ -64,6 +65,7 @@ class Tru64AlphaSystem : public AlphaSystem
|
||||
DumpMbufEvent *dumpMbufEvent;
|
||||
|
||||
public:
|
||||
typedef Tru64AlphaSystemParams Params;
|
||||
Tru64AlphaSystem(Params *p);
|
||||
~Tru64AlphaSystem();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user