diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/kernel_stats.cc | 311 | ||||
-rw-r--r-- | kern/kernel_stats.hh | 158 | ||||
-rw-r--r-- | kern/linux/linux_system.cc | 266 | ||||
-rw-r--r-- | kern/linux/linux_system.hh | 103 | ||||
-rw-r--r-- | kern/system_events.cc | 54 | ||||
-rw-r--r-- | kern/system_events.hh | 15 | ||||
-rw-r--r-- | kern/tru64/tru64_events.cc | 2 | ||||
-rw-r--r-- | kern/tru64/tru64_system.cc | 213 | ||||
-rw-r--r-- | kern/tru64/tru64_system.hh | 56 |
9 files changed, 417 insertions, 761 deletions
diff --git a/kern/kernel_stats.cc b/kern/kernel_stats.cc index e6bcb4d29..c8c04e6d1 100644 --- a/kern/kernel_stats.cc +++ b/kern/kernel_stats.cc @@ -30,134 +30,82 @@ #include <stack> #include <string> -#include "base/statistics.hh" +#include "arch/alpha/osfpal.hh" #include "base/trace.hh" +#include "base/statistics.hh" +#include "base/stats/bin.hh" #include "cpu/exec_context.hh" +#include "cpu/pc_event.hh" +#include "cpu/static_inst.hh" #include "kern/kernel_stats.hh" -#include "sim/stats.hh" -#include "sim/sw_context.hh" -#include "targetarch/isa_traits.hh" -#include "targetarch/osfpal.hh" -#include "targetarch/syscalls.hh" +#include "kern/linux/linux_syscalls.hh" using namespace std; using namespace Stats; -class KSData -{ - private: - string _name; - ExecContext *xc; - BaseCPU *cpu; - - public: - KSData(ExecContext *_xc, BaseCPU *_cpu) - : xc(_xc), cpu(_cpu), iplLast(0), iplLastTick(0), lastUser(false), - lastModeTick(0) - {} - - const string &name() { return _name; } - void regStats(const string &name); - - public: - Scalar<> _arm; - Scalar<> _quiesce; - Scalar<> _ivlb; - Scalar<> _ivle; - Scalar<> _hwrei; - - Vector<> _iplCount; - Vector<> _iplGood; - Vector<> _iplTicks; - Formula _iplUsed; - - Vector<> _callpal; - Vector<> _syscall; - Vector<> _faults; - - Vector<> _mode; - Vector<> _modeGood; - Formula _modeFraction; - Vector<> _modeTicks; - - Scalar<> _swap_context; - - private: - int iplLast; - Tick iplLastTick; - - bool lastUser; - Tick lastModeTick; - - public: - void swpipl(int ipl); - void mode(bool user); - void callpal(int code); -}; - -KernelStats::KernelStats(ExecContext *xc, BaseCPU *cpu) -{ data = new KSData(xc, cpu); } - -KernelStats::~KernelStats() -{ delete data; } +namespace Kernel { -void -KernelStats::regStats(const string &name) -{ data->regStats(name); } +const char *modestr[] = { "kernel", "user", "idle" }; + +Statistics::Statistics(ExecContext *context) + : xc(context), idleProcess((Addr)-1), themode(kernel), lastModeTick(0), + iplLast(0), iplLastTick(0) +{ +} void -KSData::regStats(const string &name) +Statistics::regStats(const string &_name) { - _name = name; + myname = _name; _arm - .name(name + ".inst.arm") + .name(name() + ".inst.arm") .desc("number of arm instructions executed") ; _quiesce - .name(name + ".inst.quiesce") + .name(name() + ".inst.quiesce") .desc("number of quiesce instructions executed") ; _ivlb - .name(name + ".inst.ivlb") + .name(name() + ".inst.ivlb") .desc("number of ivlb instructions executed") ; _ivle - .name(name + ".inst.ivle") + .name(name() + ".inst.ivle") .desc("number of ivle instructions executed") ; _hwrei - .name(name + ".inst.hwrei") + .name(name() + ".inst.hwrei") .desc("number of hwrei instructions executed") ; _iplCount .init(32) - .name(name + ".ipl_count") + .name(name() + ".ipl_count") .desc("number of times we switched to this ipl") .flags(total | pdf | nozero | nonan) ; _iplGood .init(32) - .name(name + ".ipl_good") + .name(name() + ".ipl_good") .desc("number of times we switched to this ipl from a different ipl") .flags(total | pdf | nozero | nonan) ; _iplTicks .init(32) - .name(name + ".ipl_ticks") + .name(name() + ".ipl_ticks") .desc("number of cycles we spent at this ipl") .flags(total | pdf | nozero | nonan) ; _iplUsed - .name(name + ".ipl_used") + .name(name() + ".ipl_used") .desc("fraction of swpipl calls that actually changed the ipl") .flags(total | nozero | nonan) ; @@ -166,7 +114,7 @@ KSData::regStats(const string &name) _callpal .init(256) - .name(name + ".callpal") + .name(name() + ".callpal") .desc("number of callpals executed") .flags(total | pdf | nozero | nonan) ; @@ -179,7 +127,7 @@ KSData::regStats(const string &name) _syscall .init(SystemCalls<Tru64>::Number) - .name(name + ".syscall") + .name(name() + ".syscall") .desc("number of syscalls executed") .flags(total | pdf | nozero | nonan) ; @@ -193,7 +141,7 @@ KSData::regStats(const string &name) _faults .init(Num_Faults) - .name(name + ".faults") + .name(name() + ".faults") .desc("number of faults") .flags(total | pdf | nozero | nonan) ; @@ -205,85 +153,79 @@ KSData::regStats(const string &name) } _mode - .init(2) - .name(name + ".mode_switch") - .subname(0, "kernel") - .subname(1, "user") + .init(3) + .name(name() + ".mode_switch") .desc("number of protection mode switches") ; + for (int i = 0; i < 3; ++i) + _mode.subname(i, modestr[i]); + _modeGood - .init(2) - .name(name + ".mode_good") + .init(3) + .name(name() + ".mode_good") ; + for (int i = 0; i < 3; ++i) + _modeGood.subname(i, modestr[i]); + _modeFraction - .name(name + ".mode_switch_good") - .subname(0, "kernel") - .subname(1, "user") + .name(name() + ".mode_switch_good") .desc("fraction of useful protection mode switches") .flags(total) ; + + for (int i = 0; i < 3; ++i) + _modeFraction.subname(i, modestr[i]); + _modeFraction = _modeGood / _mode; _modeTicks - .init(2) - .name(name + ".mode_ticks") - .subname(0, "kernel") - .subname(1, "user") + .init(3) + .name(name() + ".mode_ticks") .desc("number of ticks spent at the given mode") .flags(pdf) ; + for (int i = 0; i < 3; ++i) + _modeTicks.subname(i, modestr[i]); _swap_context - .name(name + ".swap_context") + .name(name() + ".swap_context") .desc("number of times the context was actually changed") ; } void -KernelStats::arm() -{ data->_arm++; } - -void -KernelStats::quiesce() -{ data->_quiesce++; } - -void -KernelStats::ivlb() -{ data->_ivlb++; } - -void -KernelStats::ivle() -{ data->_ivle++; } +Statistics::setIdleProcess(Addr idlepcbb) +{ + assert(themode == kernel); + idleProcess = idlepcbb; + themode = idle; + changeMode(themode); +} void -KernelStats::hwrei() -{ data->_hwrei++; } +Statistics::changeMode(cpu_mode newmode) +{ + _mode[newmode]++; -void -KernelStats::fault(Fault fault) -{ data->_faults[fault]++; } + if (newmode == themode) + return; -void -KernelStats::swpipl(int ipl) -{ data->swpipl(ipl); } + DPRINTF(Context, "old mode=%-8s new mode=%-8s\n", + modestr[themode], modestr[newmode]); -void -KernelStats::mode(bool user) -{ data->mode(user); } + _modeGood[newmode]++; + _modeTicks[themode] += curTick - lastModeTick; -void -KernelStats::context(Addr old_pcbb, Addr new_pcbb) -{ data->_swap_context++; } - -void -KernelStats::callpal(int code) -{ data->callpal(code); } + xc->system->kernelBinning->changeMode(newmode); + lastModeTick = curTick; + themode = newmode; +} void -KSData::swpipl(int ipl) +Statistics::swpipl(int ipl) { assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n"); @@ -299,30 +241,28 @@ KSData::swpipl(int ipl) } void -KSData::mode(bool user) +Statistics::mode(bool usermode) { - _mode[user]++; - if (user == lastUser) - return; + Addr pcbb = xc->regs.ipr[AlphaISA::IPR_PALtemp23]; - _modeGood[user]++; - _modeTicks[lastUser] += curTick - lastModeTick; + cpu_mode newmode = usermode ? user : kernel; + if (newmode == kernel && pcbb == idleProcess) + newmode = idle; - lastModeTick = curTick; - lastUser = user; - - if (xc->system->bin) { - if (!xc->swCtx || xc->swCtx->callStack.empty()) { - if (user) - xc->system->User->activate(); - else - xc->system->Kernel->activate(); - } - } + changeMode(newmode); +} + +void +Statistics::context(Addr oldpcbb, Addr newpcbb) +{ + assert(themode != user); + + _swap_context++; + changeMode(newpcbb == idleProcess ? idle : kernel); } void -KSData::callpal(int code) +Statistics::callpal(int code) { if (!PAL::name(code)) return; @@ -330,63 +270,34 @@ KSData::callpal(int code) _callpal[code]++; switch (code) { - case PAL::callsys: - { - int number = xc->regs.intRegFile[0]; - if (SystemCalls<Tru64>::validSyscallNumber(number)) { - int cvtnum = SystemCalls<Tru64>::convert(number); - _syscall[cvtnum]++; - } - } + case PAL::callsys: { + int number = xc->regs.intRegFile[0]; + if (SystemCalls<Tru64>::validSyscallNumber(number)) { + int cvtnum = SystemCalls<Tru64>::convert(number); + _syscall[cvtnum]++; + } + } break; + + case PAL::swpctx: + if (xc->system->kernelBinning) + xc->system->kernelBinning->palSwapContext(xc); break; } +} - if (code == PAL::swpctx) { - SWContext *out = xc->swCtx; - System *sys = xc->system; - if (!sys->bin) - return; - DPRINTF(TCPIP, "swpctx event\n"); - if (out) { - DPRINTF(TCPIP, "swapping context out with this stack!\n"); - xc->system->dumpState(xc); - Addr oldPCB = xc->regs.ipr[TheISA::IPR_PALtemp23]; - - if (out->callStack.empty()) { - DPRINTF(TCPIP, "but removing it, cuz empty!\n"); - SWContext *find = sys->findContext(oldPCB); - if (find) { - assert(sys->findContext(oldPCB) == out); - sys->remContext(oldPCB); - } - delete out; - } else { - DPRINTF(TCPIP, "switching out context with pcb %#x, top fn %s\n", - oldPCB, out->callStack.top()->name); - if (!sys->findContext(oldPCB)) { - if (!sys->addContext(oldPCB, out)) - panic("could not add context"); - } - } - } +void +Statistics::serialize(ostream &os) +{ + int exemode = themode; + SERIALIZE_SCALAR(exemode); +} - Addr newPCB = xc->regs.intRegFile[16]; - SWContext *in = sys->findContext(newPCB); - xc->swCtx = in; - - if (in) { - assert(!in->callStack.empty() && - "should not be switching in empty context"); - DPRINTF(TCPIP, "swapping context in with this callstack!\n"); - xc->system->dumpState(xc); - sys->remContext(newPCB); - fnCall *top = in->callStack.top(); - DPRINTF(TCPIP, "switching in to pcb %#x, %s\n", newPCB, top->name); - assert(top->myBin && "should not switch to context with no Bin"); - top->myBin->activate(); - } else { - sys->Kernel->activate(); - } - DPRINTF(TCPIP, "end swpctx\n"); - } +void +Statistics::unserialize(Checkpoint *cp, const string §ion) +{ + int exemode; + UNSERIALIZE_SCALAR(exemode); + themode = (cpu_mode)exemode; } + +/* end namespace Kernel */ } diff --git a/kern/kernel_stats.hh b/kern/kernel_stats.hh index 497403762..8339c578c 100644 --- a/kern/kernel_stats.hh +++ b/kern/kernel_stats.hh @@ -29,35 +29,165 @@ #ifndef __KERNEL_STATS_HH__ #define __KERNEL_STATS_HH__ +#include <map> +#include <stack> #include <string> +#include <vector> + +#include "base/statistics.hh" +#include "sim/serialize.hh" +#include "targetarch/isa_traits.hh" -class KSData; -class ExecContext; class BaseCPU; +class ExecContext; +class FnEvent; enum Fault; -class KernelStats +namespace Kernel { + +enum cpu_mode { kernel, user, idle, cpu_mode_num }; +extern const char *modestr[]; + +class Binning { private: - KSData *data; + std::string myname; + System *system; + + private: + // lisa's binning stuff + struct fnCall + { + Stats::MainBin *myBin; + std::string name; + }; + + struct SWContext + { + Counter calls; + std::stack<fnCall *> callStack; + }; + + std::map<const std::string, Stats::MainBin *> fnBins; + std::map<const Addr, SWContext *> swCtxMap; + + std::multimap<const std::string, std::string> callerMap; + void populateMap(std::string caller, std::string callee); + + std::vector<FnEvent *> fnEvents; + + Stats::Scalar<> fnCalls; + + Stats::MainBin *getBin(const std::string &name); + bool findCaller(std::string, std::string) const; + + SWContext *findContext(Addr pcb); + bool addContext(Addr pcb, SWContext *ctx) + { + return (swCtxMap.insert(std::make_pair(pcb, ctx))).second; + } + + void remContext(Addr pcb) + { + swCtxMap.erase(pcb); + } + + void dumpState() const; + + SWContext *swctx; + std::vector<std::string> binned_fns; + + private: + Stats::MainBin *modeBin[3]; + + public: + const bool bin; + const bool fnbin; + + cpu_mode themode; + void palSwapContext(ExecContext *xc); + void execute(ExecContext *xc, const StaticInstBase *inst); + void call(ExecContext *xc, Stats::MainBin *myBin); + void changeMode(cpu_mode mode); public: - KernelStats(ExecContext *_xc, BaseCPU *_cpu); - ~KernelStats(); + Binning(System *sys); + virtual ~Binning(); + const std::string name() const { return myname; } void regStats(const std::string &name); - void arm(); - void quiesce(); - void ivlb(); - void ivle(); - void hwrei(); + public: + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); +}; - void fault(Fault fault); +class Statistics : public Serializable +{ + friend class Binning; + + private: + std::string myname; + ExecContext *xc; + + Addr idleProcess; + cpu_mode themode; + Tick lastModeTick; + + void changeMode(cpu_mode newmode); + + private: + Stats::Scalar<> _arm; + Stats::Scalar<> _quiesce; + Stats::Scalar<> _ivlb; + Stats::Scalar<> _ivle; + Stats::Scalar<> _hwrei; + + Stats::Vector<> _iplCount; + Stats::Vector<> _iplGood; + Stats::Vector<> _iplTicks; + Stats::Formula _iplUsed; + + Stats::Vector<> _callpal; + Stats::Vector<> _syscall; + Stats::Vector<> _faults; + + Stats::Vector<> _mode; + Stats::Vector<> _modeGood; + Stats::Formula _modeFraction; + Stats::Vector<> _modeTicks; + + Stats::Scalar<> _swap_context; + + private: + int iplLast; + Tick iplLastTick; + + public: + Statistics(ExecContext *context); + + const std::string name() const { return myname; } + void regStats(const std::string &name); + + public: + void arm() { _arm++; } + void quiesce() { _quiesce++; } + void ivlb() { _ivlb++; } + void ivle() { _ivle++; } + void hwrei() { _hwrei++; } + void fault(Fault fault) { _faults[fault]++; } void swpipl(int ipl); - void mode(bool user); - void context(Addr old_pcbb, Addr new_pcbb); + void mode(bool usermode); + void context(Addr oldpcbb, Addr newpcbb); void callpal(int code); + + void setIdleProcess(Addr idle); + + public: + virtual void serialize(std::ostream &os); + virtual void unserialize(Checkpoint *cp, const std::string §ion); }; +/* end namespace Kernel */ } + #endif // __KERNEL_STATS_HH__ diff --git a/kern/linux/linux_system.cc b/kern/linux/linux_system.cc index dd188ffe0..10641de87 100644 --- a/kern/linux/linux_system.cc +++ b/kern/linux/linux_system.cc @@ -35,11 +35,6 @@ * up boot time. */ -#include "base/loader/aout_object.hh" -#include "base/loader/elf_object.hh" -#include "base/loader/object_file.hh" -#include "base/loader/symtab.hh" -#include "base/remote_gdb.hh" #include "base/trace.hh" #include "cpu/exec_context.hh" #include "cpu/base_cpu.hh" @@ -58,88 +53,15 @@ extern SymbolTable *debugSymbolTable; using namespace std; -LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param, - MemoryController *_memCtrl, PhysicalMemory *_physmem, - const string &kernel_path, const string &console_path, - const string &palcode, const string &boot_osflags, - const bool _bin, const vector<string> &_binned_fns) - : System(_name, _init_param, _memCtrl, _physmem, _bin, _binned_fns), - bin(_bin), binned_fns(_binned_fns) +LinuxSystem::LinuxSystem(Params *p) + : System(p) { - kernelSymtab = new SymbolTable; - consoleSymtab = new SymbolTable; - - /** - * Load the kernel, pal, and console code into memory - */ - // Load kernel code - ObjectFile *kernel = createObjectFile(kernel_path); - if (kernel == NULL) - fatal("Could not load kernel file %s", kernel_path); - - // Load Console Code - ObjectFile *console = createObjectFile(console_path); - if (console == NULL) - fatal("Could not load console file %s", console_path); - - // Load pal file - ObjectFile *pal = createObjectFile(palcode); - if (pal == NULL) - fatal("Could not load PALcode file %s", palcode); - pal->loadSections(physmem, true); - - // Load console file - console->loadSections(physmem, true); - - // Load kernel file - kernel->loadSections(physmem, true); - kernelStart = kernel->textBase(); - kernelEnd = kernel->bssBase() + kernel->bssSize(); - kernelEntry = kernel->entryPoint(); - - // load symbols - if (!kernel->loadGlobalSymbols(kernelSymtab)) - panic("could not load kernel symbols\n"); - debugSymbolTable = kernelSymtab; - - if (!kernel->loadLocalSymbols(kernelSymtab)) - panic("could not load kernel local symbols\n"); - - if (!console->loadGlobalSymbols(consoleSymtab)) - panic("could not load console symbols\n"); - - DPRINTF(Loader, "Kernel start = %#x\n" - "Kernel end = %#x\n" - "Kernel entry = %#x\n", - kernelStart, kernelEnd, kernelEntry); - - DPRINTF(Loader, "Kernel loaded...\n"); - - -#ifdef DEBUG - kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic"); - consolePanicEvent = new BreakPCEvent(&pcEventQueue, "console panic"); -#endif - - skipIdeDelay50msEvent = new SkipFuncEvent(&pcEventQueue, - "ide_delay_50ms"); - - skipDelayLoopEvent = new LinuxSkipDelayLoopEvent(&pcEventQueue, - "calibrate_delay"); - - skipCacheProbeEvent = new SkipFuncEvent(&pcEventQueue, - "determine_cpu_caches"); - - debugPrintkEvent = new DebugPrintkEvent(&pcEventQueue, "dprintk"); - - printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo"); - Addr addr = 0; /** - * find the address of the est_cycle_freq variable and insert it so we don't - * through the lengthly process of trying to calculated it by using the PIT, - * RTC, etc. + * find the address of the est_cycle_freq variable and insert it + * so we don't through the lengthly process of trying to + * calculated it by using the PIT, RTC, etc. */ if (kernelSymtab->findAddress("est_cycle_freq", addr)) { Addr paddr = vtophys(physmem, addr); @@ -152,19 +74,6 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param, /** - * Copy the osflags (kernel arguments) into the consoles memory. Presently - * Linux does use the console service routine to get these command line - * arguments, but we might as well make them available just in case. - */ - if (consoleSymtab->findAddress("env_booted_osflags", addr)) { - Addr paddr = vtophys(physmem, addr); - char *osflags = (char *)physmem->dma_addr(paddr, sizeof(uint32_t)); - - if (osflags) - strcpy(osflags, boot_osflags.c_str()); - } - - /** * Since we aren't using a bootloader, we have to copy the kernel arguments * directly into the kernels memory. */ @@ -172,32 +81,11 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param, Addr paddr = vtophys(physmem, PARAM_ADDR); char *commandline = (char*)physmem->dma_addr(paddr, sizeof(uint64_t)); if (commandline) - strcpy(commandline, boot_osflags.c_str()); + strcpy(commandline, params->boot_osflags.c_str()); } /** - * Set the hardware reset parameter block system type and revision - * information to Tsunami. - */ - if (consoleSymtab->findAddress("xxm_rpb", addr)) { - Addr paddr = vtophys(physmem, addr); - char *hwprb = (char *)physmem->dma_addr(paddr, sizeof(uint64_t)); - - if (hwprb) { - // Tsunami - *(uint64_t*)(hwprb + 0x50) = htoa(ULL(34)); - - // Plain DP264 - *(uint64_t*)(hwprb + 0x58) = htoa(ULL(1) << 10); - } - else - panic("could not translate hwprb addr to set system type/variation\n"); - - } else - panic("could not find hwprb to set system type/variation\n"); - - /** * EV5 only supports 127 ASNs so we are going to tell the kernel that the * paritiuclar EV6 we have only supports 127 asns. * @todo At some point we should change ev5.hh and the palcode to support @@ -210,59 +98,63 @@ LinuxSystem::LinuxSystem(const string _name, const uint64_t _init_param, if (dp264_mv) { *(uint32_t*)(dp264_mv+0x18) = htoa((uint32_t)127); } else - panic("could not translate dp264_mv addr to set the MAX_ASN to 127\n"); + panic("could not translate dp264_mv addr\n"); } else - panic("could not find dp264_mv to set the MAX_ASN to 127\n"); - - + panic("could not find dp264_mv\n"); #ifdef DEBUG + kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic"); if (kernelSymtab->findAddress("panic", addr)) kernelPanicEvent->schedule(addr); else panic("could not find kernel symbol \'panic\'"); - - if (consoleSymtab->findAddress("panic", addr)) - consolePanicEvent->schedule(addr); #endif /** - * Any time ide_delay_50ms, calibarte_delay or determine_cpu_caches is called - * just skip the function. Currently determine_cpu_caches only is used put - * information in proc, however if that changes in the future we will have to - * fill in the cache size variables appropriately. + * Any time ide_delay_50ms, calibarte_delay or + * determine_cpu_caches is called just skip the + * function. Currently determine_cpu_caches only is used put + * information in proc, however if that changes in the future we + * will have to fill in the cache size variables appropriately. */ + skipIdeDelay50msEvent = new SkipFuncEvent(&pcEventQueue, "ide_delay_50ms"); if (kernelSymtab->findAddress("ide_delay_50ms", addr)) skipIdeDelay50msEvent->schedule(addr+sizeof(MachInst)); + skipDelayLoopEvent = new LinuxSkipDelayLoopEvent(&pcEventQueue, + "calibrate_delay"); if (kernelSymtab->findAddress("calibrate_delay", addr)) skipDelayLoopEvent->schedule(addr+sizeof(MachInst)); + skipCacheProbeEvent = new SkipFuncEvent(&pcEventQueue, + "determine_cpu_caches"); if (kernelSymtab->findAddress("determine_cpu_caches", addr)) skipCacheProbeEvent->schedule(addr+sizeof(MachInst)); + debugPrintkEvent = new DebugPrintkEvent(&pcEventQueue, "dprintk"); if (kernelSymtab->findAddress("dprintk", addr)) - debugPrintkEvent->schedule(addr+sizeof(MachInst)*2); + debugPrintkEvent->schedule(addr+8); + + idleStartEvent = new IdleStartEvent(&pcEventQueue, "cpu_idle", this); + if (kernelSymtab->findAddress("cpu_idle", addr)) + idleStartEvent->schedule(addr); - if (kernelSymtab->findAddress("alpha_switch_to", addr) && - DTRACE(Thread)) - printThreadEvent->schedule(addr+sizeof(MachInst)*6); + printThreadEvent = new PrintThreadInfo(&pcEventQueue, "threadinfo"); + if (kernelSymtab->findAddress("alpha_switch_to", addr) && DTRACE(Thread)) + printThreadEvent->schedule(addr + sizeof(MachInst) * 6); } LinuxSystem::~LinuxSystem() { - delete kernel; - delete console; - - delete kernelSymtab; - delete consoleSymtab; - +#ifdef DEBUG delete kernelPanicEvent; - delete consolePanicEvent; +#endif delete skipIdeDelay50msEvent; delete skipDelayLoopEvent; delete skipCacheProbeEvent; + delete debugPrintkEvent; + delete idleStartEvent; } @@ -283,92 +175,64 @@ LinuxSystem::setDelayLoop(ExecContext *xc) } } -int -LinuxSystem::registerExecContext(ExecContext *xc) -{ - int xcIndex = System::registerExecContext(xc); - - if (xcIndex == 0) { - // activate with zero delay so that we start ticking right - // away on cycle 0 - xc->activate(0); - } - - RemoteGDB *rgdb = new RemoteGDB(this, xc); - GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex); - gdbl->listen(); - /** - * Uncommenting this line waits for a remote debugger to connect - * to the simulator before continuing. - */ - //gdbl->accept(); - - if (remoteGDB.size() <= xcIndex) { - remoteGDB.resize(xcIndex+1); - } - - remoteGDB[xcIndex] = rgdb; - - return xcIndex; -} - - -void -LinuxSystem::replaceExecContext(ExecContext *xc, int xcIndex) -{ - System::replaceExecContext(xcIndex, xc); - remoteGDB[xcIndex]->replaceExecContext(xc); -} - -bool -LinuxSystem::breakpoint() -{ - return remoteGDB[0]->trap(ALPHA_KENTRY_IF); -} - BEGIN_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem) - Param<bool> bin; SimObjectParam<MemoryController *> mem_ctl; SimObjectParam<PhysicalMemory *> physmem; - Param<uint64_t> init_param; Param<string> kernel_code; Param<string> console_code; Param<string> pal_code; - Param<string> boot_osflags; - VectorParam<string> binned_fns; + Param<string> boot_osflags; Param<string> readfile; + Param<unsigned int> init_param; + + Param<uint64_t> system_type; + Param<uint64_t> system_rev; + + Param<bool> bin; + VectorParam<string> binned_fns; END_DECLARE_SIM_OBJECT_PARAMS(LinuxSystem) BEGIN_INIT_SIM_OBJECT_PARAMS(LinuxSystem) - - INIT_PARAM_DFLT(bin, "is this system to be binned", false), INIT_PARAM(mem_ctl, "memory controller"), INIT_PARAM(physmem, "phsyical memory"), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), - INIT_PARAM(kernel_code, "file that contains the code"), + INIT_PARAM(kernel_code, "file that contains the kernel code"), INIT_PARAM(console_code, "file that contains the console code"), INIT_PARAM(pal_code, "file that contains palcode"), INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", - "a"), - INIT_PARAM(binned_fns, "functions to be broken down and binned"), - INIT_PARAM_DFLT(readfile, "file to read startup script from", "") - + "a"), + INIT_PARAM_DFLT(readfile, "file to read startup script 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), + INIT_PARAM_DFLT(bin, "is this system to be binned", false), + INIT_PARAM(binned_fns, "functions to be broken down and binned") END_INIT_SIM_OBJECT_PARAMS(LinuxSystem) CREATE_SIM_OBJECT(LinuxSystem) { - LinuxSystem *sys = new LinuxSystem(getInstanceName(), init_param, mem_ctl, - physmem, kernel_code, console_code, - pal_code, boot_osflags, bin, binned_fns); - - sys->readfile = readfile; - return sys; + System::Params *p = new System::Params; + p->name = getInstanceName(); + p->memctrl = mem_ctl; + p->physmem = physmem; + p->kernel_path = kernel_code; + p->console_path = console_code; + p->palcode = pal_code; + p->boot_osflags = boot_osflags; + p->init_param = init_param; + p->readfile = readfile; + p->system_type = system_type; + p->system_rev = system_rev; + p->bin = bin; + p->binned_fns = binned_fns; + + return new LinuxSystem(p); } REGISTER_SIM_OBJECT("LinuxSystem", LinuxSystem) + diff --git a/kern/linux/linux_system.hh b/kern/linux/linux_system.hh index fbfcb788f..707204607 100644 --- a/kern/linux/linux_system.hh +++ b/kern/linux/linux_system.hh @@ -26,32 +26,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __LINUX_SYSTEM_HH__ -#define __LINUX_SYSTEM_HH__ +#ifndef __KERN_LINUX_LINUX_SYSTEM_HH__ +#define __KERN_LINUX_LINUX_SYSTEM_HH__ -#include <vector> - -#include "sim/system.hh" #include "sim/host.hh" +#include "sim/system.hh" #include "targetarch/isa_traits.hh" -#include <map> - /** * MAGIC address where the kernel arguments should go. Defined as * PARAM in linux kernel alpha-asm. */ -const Addr PARAM_ADDR = ULL(0xfffffc000030a000); +const Addr PARAM_ADDR = ULL(0xfffffc000030a000); class ExecContext; -class ElfObject; -class SymbolTable; + +class BreakPCEvent; class DebugPrintkEvent; class BreakPCEvent; class LinuxSkipDelayLoopEvent; class SkipFuncEvent; -class FnEvent; -class AlphaArguments; +class IdleStartEvent; class PrintThreadInfo; /** @@ -62,96 +57,42 @@ class PrintThreadInfo; class LinuxSystem : public System { private: - /** Object pointer for the kernel code */ - ElfObject *kernel; - - /** Object pointer for the console code */ - ElfObject *console; - - /** kernel Symbol table */ - SymbolTable *kernelSymtab; - - /** console symbol table */ - SymbolTable *consoleSymtab; - +#ifdef DEBUG /** Event to halt the simulator if the kernel calls panic() */ BreakPCEvent *kernelPanicEvent; +#endif - /** Event to halt the simulator if the console calls panic() */ - BreakPCEvent *consolePanicEvent; - - /** Event to skip determine_cpu_caches() because we don't support the - * IPRs that the code can access to figure out cache sizes + /** + * Event to skip determine_cpu_caches() because we don't support + * the IPRs that the code can access to figure out cache sizes */ SkipFuncEvent *skipCacheProbeEvent; /** PC based event to skip the ide_delay_50ms() call */ SkipFuncEvent *skipIdeDelay50msEvent; - /** PC based event to skip the dprink() call and emulate its functionality */ + /** + * PC based event to skip the dprink() call and emulate its + * functionality + */ DebugPrintkEvent *debugPrintkEvent; - /** Skip calculate_delay_loop() rather than waiting for this to be + /** + * Skip calculate_delay_loop() rather than waiting for this to be * calculated */ LinuxSkipDelayLoopEvent *skipDelayLoopEvent; PrintThreadInfo *printThreadEvent; - /** Begining of kernel code */ - Addr kernelStart; - - /** End of kernel code */ - Addr kernelEnd; - - /** Entry point in the kernel to start at */ - Addr kernelEntry; - - bool bin; - std::vector<string> binned_fns; + /** Grab the PCBB of the idle process when it starts */ + IdleStartEvent *idleStartEvent; public: - std::vector<RemoteGDB *> remoteGDB; - std::vector<GDBListener *> gdbListen; - - LinuxSystem(const std::string _name, - const uint64_t _init_param, - MemoryController *_memCtrl, - PhysicalMemory *_physmem, - const std::string &kernel_path, - const std::string &console_path, - const std::string &palcode, - const std::string &boot_osflags, - const bool _bin, - const std::vector<std::string> &_binned_fns); - + LinuxSystem(Params *p); ~LinuxSystem(); void setDelayLoop(ExecContext *xc); - - int registerExecContext(ExecContext *xc); - void replaceExecContext(ExecContext *xc, int xcIndex); - - /** - * Returns the addess the kernel starts at. - * @return address the kernel starts at - */ - Addr getKernelStart() const { return kernelStart; } - - /** - * Returns the addess the kernel ends at. - * @return address the kernel ends at - */ - Addr getKernelEnd() const { return kernelEnd; } - - /** - * Returns the addess the entry point to the kernel code. - * @return entry point of the kernel code - */ - Addr getKernelEntry() const { return kernelEntry; } - - - bool breakpoint(); }; -#endif // __LINUX_SYSTEM_HH__ +#endif // __KERN_LINUX_LINUX_SYSTEM_HH__ diff --git a/kern/system_events.cc b/kern/system_events.cc index 351c3ddb2..91daf53ca 100644 --- a/kern/system_events.cc +++ b/kern/system_events.cc @@ -30,9 +30,9 @@ #include "cpu/base_cpu.hh" #include "cpu/full_cpu/bpred.hh" #include "cpu/full_cpu/full_cpu.hh" +#include "kern/kernel_stats.hh" #include "kern/system_events.hh" #include "sim/system.hh" -#include "sim/sw_context.hh" void SkipFuncEvent::process(ExecContext *xc) @@ -52,11 +52,9 @@ SkipFuncEvent::process(ExecContext *xc) } -FnEvent::FnEvent(PCEventQueue *q, const std::string & desc, System *system) - : PCEvent(q, desc), _name(desc) +FnEvent::FnEvent(PCEventQueue *q, const std::string &desc, Stats::MainBin *bin) + : PCEvent(q, desc), _name(desc), mybin(bin) { - myBin = system->getBin(desc); - assert(myBin); } void @@ -64,46 +62,12 @@ FnEvent::process(ExecContext *xc) { if (xc->misspeculating()) return; - assert(xc->system->bin && "FnEvent must be in a binned system"); - SWContext *ctx = xc->swCtx; - DPRINTF(TCPIP, "%s: %s Event!!!\n", xc->system->name(), description); - if (ctx && !ctx->callStack.empty()) { - DPRINTF(TCPIP, "already a callstack!\n"); - fnCall *last = ctx->callStack.top(); - - if (last->name == "idle_thread") - ctx->calls++; - - if (!xc->system->findCaller(myname(), "" ) && - !xc->system->findCaller(myname(), last->name)) { - - DPRINTF(TCPIP, "but can't find parent %s\n", last->name); - return; - } - ctx->calls--; + xc->system->kernelBinning->call(xc, mybin); +} - //assert(!ctx->calls && "on a binned fn, calls should == 0 (but can happen in boot)"); - } else { - DPRINTF(TCPIP, "no callstack yet\n"); - if (!xc->system->findCaller(myname(), "")) { - DPRINTF(TCPIP, "not the right function, returning\n"); - return; - } - if (!ctx) { - DPRINTF(TCPIP, "creating new context for %s\n", myname()); - ctx = new SWContext; - xc->swCtx = ctx; - } - } - DPRINTF(TCPIP, "adding fn %s to context\n", myname()); - fnCall *call = new fnCall; - call->myBin = myBin; - call->name = myname(); - ctx->callStack.push(call); - myBin->activate(); - xc->system->fnCalls++; - DPRINTF(TCPIP, "fnCalls for %s is %d\n", description, - xc->system->fnCalls.value()); - xc->system->dumpState(xc); +void +IdleStartEvent::process(ExecContext *xc) +{ + xc->kernelStats->setIdleProcess(xc->regs.ipr[AlphaISA::IPR_PALtemp23]); } diff --git a/kern/system_events.hh b/kern/system_events.hh index 7f658bde9..95027572f 100644 --- a/kern/system_events.hh +++ b/kern/system_events.hh @@ -44,13 +44,24 @@ class SkipFuncEvent : public PCEvent class FnEvent : public PCEvent { public: - FnEvent(PCEventQueue *q, const std::string &desc, System *system); + FnEvent(PCEventQueue *q, const std::string &desc, Stats::MainBin *bin); virtual void process(ExecContext *xc); std::string myname() const { return _name; } private: std::string _name; - Stats::MainBin *myBin; + Stats::MainBin *mybin; }; +class IdleStartEvent : public PCEvent +{ + private: + System *system; + + public: + IdleStartEvent(PCEventQueue *q, const std::string &desc, System *sys) + : PCEvent(q, desc), system(sys) + {} + virtual void process(ExecContext *xc); +}; #endif // __SYSTEM_EVENTS_HH__ diff --git a/kern/tru64/tru64_events.cc b/kern/tru64/tru64_events.cc index e96cc9c5d..fb9d43a0e 100644 --- a/kern/tru64/tru64_events.cc +++ b/kern/tru64/tru64_events.cc @@ -47,7 +47,7 @@ BadAddrEvent::process(ExecContext *xc) uint64_t a0 = xc->regs.intRegFile[ArgumentReg0]; if (a0 < ALPHA_K0SEG_BASE || a0 >= ALPHA_K1SEG_BASE || - xc->memCtrl->badaddr(ALPHA_K0SEG_TO_PHYS(a0) & PA_IMPL_MASK)) { + xc->memctrl->badaddr(ALPHA_K0SEG_TO_PHYS(a0) & PA_IMPL_MASK)) { DPRINTF(BADADDR, "badaddr arg=%#x bad\n", a0); xc->regs.intRegFile[ReturnValueReg] = 0x1; diff --git a/kern/tru64/tru64_system.cc b/kern/tru64/tru64_system.cc index 4395162e4..5493139ee 100644 --- a/kern/tru64/tru64_system.cc +++ b/kern/tru64/tru64_system.cc @@ -26,11 +26,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "base/loader/aout_object.hh" -#include "base/loader/ecoff_object.hh" -#include "base/loader/object_file.hh" -#include "base/loader/symtab.hh" -#include "base/remote_gdb.hh" #include "base/trace.hh" #include "cpu/exec_context.hh" #include "kern/tru64/tru64_events.hh" @@ -42,75 +37,11 @@ #include "targetarch/isa_traits.hh" #include "targetarch/vtophys.hh" -extern SymbolTable *debugSymbolTable; - using namespace std; -Tru64System::Tru64System(const string _name, const uint64_t _init_param, - MemoryController *_memCtrl, PhysicalMemory *_physmem, - const string &kernel_path, const string &console_path, - const string &palcode, const string &boot_osflags, - const bool _bin, const vector<string> &_binned_fns, - const uint64_t system_type, const uint64_t system_rev) - : System(_name, _init_param, _memCtrl, _physmem, _bin,_binned_fns), - bin(_bin), binned_fns(_binned_fns) +Tru64System::Tru64System(Tru64System::Params *p) + : System(p) { - kernelSymtab = new SymbolTable; - consoleSymtab = new SymbolTable; - debugSymbolTable = kernelSymtab; - - ObjectFile *kernel = createObjectFile(kernel_path); - if (kernel == NULL) - fatal("Could not load kernel file %s", kernel_path); - - ObjectFile *console = createObjectFile(console_path); - if (console == NULL) - fatal("Could not load console file %s", console_path); - - if (!kernel->loadGlobalSymbols(kernelSymtab)) - panic("could not load kernel symbols\n"); - - if (!console->loadGlobalSymbols(consoleSymtab)) - panic("could not load console symbols\n"); - - // Load pal file - ObjectFile *pal = createObjectFile(palcode); - if (pal == NULL) - fatal("Could not load PALcode file %s", palcode); - pal->loadSections(physmem, true); - - // Load console file - console->loadSections(physmem, true); - - // Load kernel file - kernel->loadSections(physmem, true); - kernelStart = kernel->textBase(); - kernelEnd = kernel->bssBase() + kernel->bssSize(); - kernelEntry = kernel->entryPoint(); - - DPRINTF(Loader, "Kernel start = %#x\n" - "Kernel end = %#x\n" - "Kernel entry = %#x\n", - kernelStart, kernelEnd, kernelEntry); - - DPRINTF(Loader, "Kernel loaded...\n"); - -#ifdef DEBUG - kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic"); - consolePanicEvent = new BreakPCEvent(&pcEventQueue, "console panic"); -#endif - badaddrEvent = new BadAddrEvent(&pcEventQueue, "badaddr"); - skipPowerStateEvent = new SkipFuncEvent(&pcEventQueue, - "tl_v48_capture_power_state"); - skipScavengeBootEvent = new SkipFuncEvent(&pcEventQueue, - "pmap_scavenge_boot"); - printfEvent = new PrintfEvent(&pcEventQueue, "printf"); - debugPrintfEvent = new DebugPrintfEvent(&pcEventQueue, - "debug_printf", false); - debugPrintfrEvent = new DebugPrintfEvent(&pcEventQueue, - "debug_printfr", true); - dumpMbufEvent = new DumpMbufEvent(&pcEventQueue, "dump_mbuf"); - Addr addr = 0; if (kernelSymtab->findAddress("enable_async_printf", addr)) { Addr paddr = vtophys(physmem, addr); @@ -121,180 +52,124 @@ Tru64System::Tru64System(const string _name, const uint64_t _init_param, *(uint32_t *)enable_async_printf = 0; } - if (consoleSymtab->findAddress("env_booted_osflags", addr)) { - Addr paddr = vtophys(physmem, addr); - char *osflags = (char *)physmem->dma_addr(paddr, sizeof(uint32_t)); - - if (osflags) - strcpy(osflags, boot_osflags.c_str()); - } - - if (consoleSymtab->findAddress("xxm_rpb", addr)) { - Addr paddr = vtophys(physmem, addr); - char *hwprb = (char *)physmem->dma_addr(paddr, sizeof(uint64_t)); - - if (hwprb) { - *(uint64_t*)(hwprb+0x50) = system_type; - *(uint64_t*)(hwprb+0x58) = system_rev; - } - else - panic("could not translate hwprb addr to set system type/variation\n"); - } else - panic("could not find hwprb to set system type/variation\n"); - - #ifdef DEBUG + kernelPanicEvent = new BreakPCEvent(&pcEventQueue, "kernel panic"); if (kernelSymtab->findAddress("panic", addr)) kernelPanicEvent->schedule(addr); else panic("could not find kernel symbol \'panic\'"); - - if (consoleSymtab->findAddress("panic", addr)) - consolePanicEvent->schedule(addr); #endif + badaddrEvent = new BadAddrEvent(&pcEventQueue, "badaddr"); if (kernelSymtab->findAddress("badaddr", addr)) badaddrEvent->schedule(addr); else panic("could not find kernel symbol \'badaddr\'"); + skipPowerStateEvent = new SkipFuncEvent(&pcEventQueue, + "tl_v48_capture_power_state"); if (kernelSymtab->findAddress("tl_v48_capture_power_state", addr)) skipPowerStateEvent->schedule(addr); + skipScavengeBootEvent = new SkipFuncEvent(&pcEventQueue, + "pmap_scavenge_boot"); if (kernelSymtab->findAddress("pmap_scavenge_boot", addr)) skipScavengeBootEvent->schedule(addr); #if TRACING_ON + printfEvent = new PrintfEvent(&pcEventQueue, "printf"); if (kernelSymtab->findAddress("printf", addr)) printfEvent->schedule(addr); + debugPrintfEvent = new DebugPrintfEvent(&pcEventQueue, "debug_printf", + false); if (kernelSymtab->findAddress("m5printf", addr)) debugPrintfEvent->schedule(addr); + debugPrintfrEvent = new DebugPrintfEvent(&pcEventQueue, "debug_printfr", + true); if (kernelSymtab->findAddress("m5printfr", addr)) debugPrintfrEvent->schedule(addr); + dumpMbufEvent = new DumpMbufEvent(&pcEventQueue, "dump_mbuf"); if (kernelSymtab->findAddress("m5_dump_mbuf", addr)) dumpMbufEvent->schedule(addr); #endif - - // BINNING STUFF - if (bin == true) { - int end = binned_fns.size(); - Addr address = 0; - - for (int i = 0; i < end; i +=2) { - if (kernelSymtab->findAddress(binned_fns[i], address)) - fnEvents[(i>>1)]->schedule(address); - else - panic("could not find kernel symbol %s\n", binned_fns[i]); - } - } - // } Tru64System::~Tru64System() { - delete kernel; - delete console; - - delete kernelSymtab; - delete consoleSymtab; - #ifdef DEBUG delete kernelPanicEvent; - delete consolePanicEvent; #endif delete badaddrEvent; delete skipPowerStateEvent; delete skipScavengeBootEvent; +#if TRACING_ON delete printfEvent; delete debugPrintfEvent; delete debugPrintfrEvent; delete dumpMbufEvent; -} - -int -Tru64System::registerExecContext(ExecContext *xc) -{ - int xcIndex = System::registerExecContext(xc); - - if (xcIndex == 0) { - // activate with zero delay so that we start ticking right - // away on cycle 0 - xc->activate(0); - } - - RemoteGDB *rgdb = new RemoteGDB(this, xc); - GDBListener *gdbl = new GDBListener(rgdb, 7000 + xcIndex); - gdbl->listen(); - - if (remoteGDB.size() <= xcIndex) { - remoteGDB.resize(xcIndex+1); - } - - remoteGDB[xcIndex] = rgdb; - - return xcIndex; -} - - -void -Tru64System::replaceExecContext(ExecContext *xc, int xcIndex) -{ - System::replaceExecContext(xcIndex, xc); - remoteGDB[xcIndex]->replaceExecContext(xc); -} - -bool -Tru64System::breakpoint() -{ - return remoteGDB[0]->trap(ALPHA_KENTRY_INT); +#endif } BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System) - Param<bool> bin; SimObjectParam<MemoryController *> mem_ctl; SimObjectParam<PhysicalMemory *> physmem; - Param<unsigned int> init_param; Param<string> kernel_code; Param<string> console_code; Param<string> pal_code; + Param<string> boot_osflags; - VectorParam<string> binned_fns; + Param<string> readfile; + Param<unsigned int> init_param; + Param<uint64_t> system_type; Param<uint64_t> system_rev; + Param<bool> bin; + VectorParam<string> binned_fns; + END_DECLARE_SIM_OBJECT_PARAMS(Tru64System) BEGIN_INIT_SIM_OBJECT_PARAMS(Tru64System) - INIT_PARAM_DFLT(bin, "is this system to be binned", false), INIT_PARAM(mem_ctl, "memory controller"), INIT_PARAM(physmem, "phsyical memory"), - INIT_PARAM_DFLT(init_param, "numerical value to pass into simulator", 0), INIT_PARAM(kernel_code, "file that contains the kernel code"), INIT_PARAM(console_code, "file that contains the console code"), INIT_PARAM(pal_code, "file that contains palcode"), INIT_PARAM_DFLT(boot_osflags, "flags to pass to the kernel during boot", "a"), - INIT_PARAM(binned_fns, "functions to be broken down and binned"), + INIT_PARAM_DFLT(readfile, "file to read startup script 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) - + INIT_PARAM_DFLT(system_rev, "Revision of system we are emulating", 2<<1), + INIT_PARAM_DFLT(bin, "is this system to be binned", false), + INIT_PARAM(binned_fns, "functions to be broken down and binned") END_INIT_SIM_OBJECT_PARAMS(Tru64System) CREATE_SIM_OBJECT(Tru64System) { - Tru64System *sys = new Tru64System(getInstanceName(), init_param, mem_ctl, - physmem, kernel_code, console_code, - pal_code, boot_osflags, bin, - binned_fns, system_type, system_rev); - - return sys; + System::Params *p = new System::Params; + p->name = getInstanceName(); + p->memctrl = mem_ctl; + p->physmem = physmem; + p->kernel_path = kernel_code; + p->console_path = console_code; + p->palcode = pal_code; + p->boot_osflags = boot_osflags; + p->init_param = init_param; + p->readfile = readfile; + p->system_type = system_type; + p->system_rev = system_rev; + p->bin = bin; + p->binned_fns = binned_fns; + + return new Tru64System(p); } REGISTER_SIM_OBJECT("Tru64System", Tru64System) diff --git a/kern/tru64/tru64_system.hh b/kern/tru64/tru64_system.hh index 8dd696b79..13d283fb3 100644 --- a/kern/tru64/tru64_system.hh +++ b/kern/tru64/tru64_system.hh @@ -26,18 +26,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __TRU64_SYSTEM_HH__ -#define __TRU64_SYSTEM_HH__ - -#include <map> -#include <vector> +#ifndef __KERN_TRU64_TRU64_SYSTEM_HH__ +#define __KERN_TRU64_TRU64_SYSTEM_HH__ #include "sim/system.hh" #include "targetarch/isa_traits.hh" class ExecContext; -class EcoffObject; -class SymbolTable; class BreakPCEvent; class BadAddrEvent; @@ -45,20 +40,16 @@ class SkipFuncEvent; class PrintfEvent; class DebugPrintfEvent; class DumpMbufEvent; -class FnEvent; class AlphaArguments; class Tru64System : public System { private: - EcoffObject *kernel; - EcoffObject *console; - - SymbolTable *kernelSymtab; - SymbolTable *consoleSymtab; - +#ifdef DEBUG + /** Event to halt the simulator if the kernel calls panic() */ BreakPCEvent *kernelPanicEvent; - BreakPCEvent *consolePanicEvent; +#endif + BadAddrEvent *badaddrEvent; SkipFuncEvent *skipPowerStateEvent; SkipFuncEvent *skipScavengeBootEvent; @@ -67,43 +58,12 @@ class Tru64System : public System DebugPrintfEvent *debugPrintfrEvent; DumpMbufEvent *dumpMbufEvent; - private: - - Addr kernelStart; - Addr kernelEnd; - Addr kernelEntry; - bool bin; - std::vector<string> binned_fns; - - public: - std::vector<RemoteGDB *> remoteGDB; - std::vector<GDBListener *> gdbListen; - public: - Tru64System(const std::string _name, - const uint64_t _init_param, - MemoryController *_memCtrl, - PhysicalMemory *_physmem, - const std::string &kernel_path, - const std::string &console_path, - const std::string &palcode, - const std::string &boot_osflags, - const bool _bin, - const std::vector<string> &binned_fns, - const uint64_t system_type, - const uint64_t system_rev); + Tru64System(Params *p); ~Tru64System(); - int registerExecContext(ExecContext *xc); - void replaceExecContext(ExecContext *xc, int xcIndex); - - Addr getKernelStart() const { return kernelStart; } - Addr getKernelEnd() const { return kernelEnd; } - Addr getKernelEntry() const { return kernelEntry; } - bool breakpoint(); - static void Printf(AlphaArguments args); static void DumpMbuf(AlphaArguments args); }; -#endif // __TRU64_SYSTEM_HH__ +#endif // __KERN_TRU64_TRU64_SYSTEM_HH__ |