diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2004-05-18 01:40:03 -0400 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2004-05-18 01:40:03 -0400 |
commit | a0ccdf8aba8f71c8d66c03f5c6907d0a3c2e091f (patch) | |
tree | 71de26a0139e7db042c79989ae745377d98c3d23 /kern/tru64 | |
parent | 4d98ab1ca92c2d88d3ee13a7518acc36a6d5bf84 (diff) | |
parent | 02af86f7e813db27b12214ea377948f07f891b69 (diff) | |
download | gem5-a0ccdf8aba8f71c8d66c03f5c6907d0a3c2e091f.tar.xz |
merge m5 with linux for the event and binning lifting
--HG--
extra : convert_revision : 09d3678746c2e9a93a9982dc75d5e1ac309cb2fa
Diffstat (limited to 'kern/tru64')
-rw-r--r-- | kern/tru64/mbuf.hh | 4 | ||||
-rw-r--r-- | kern/tru64/tru64_events.cc | 82 | ||||
-rw-r--r-- | kern/tru64/tru64_events.hh | 22 | ||||
-rw-r--r-- | kern/tru64/tru64_system.cc | 69 | ||||
-rw-r--r-- | kern/tru64/tru64_system.hh | 13 |
5 files changed, 11 insertions, 179 deletions
diff --git a/kern/tru64/mbuf.hh b/kern/tru64/mbuf.hh index bfee0b3fa..a386fa611 100644 --- a/kern/tru64/mbuf.hh +++ b/kern/tru64/mbuf.hh @@ -32,6 +32,8 @@ #include "sim/host.hh" #include "targetarch/isa_traits.hh" +namespace tru64 { + struct m_hdr { Addr mh_next; // 0x00 Addr mh_nextpkt; // 0x08 @@ -91,4 +93,6 @@ struct mbuf { #define m_pktdat M_dat.MH.MH_dat.MH_databuf #define m_dat M_dat.M_databuf +} + #endif // __MBUF_HH__ diff --git a/kern/tru64/tru64_events.cc b/kern/tru64/tru64_events.cc index 17a5e406a..89b808653 100644 --- a/kern/tru64/tru64_events.cc +++ b/kern/tru64/tru64_events.cc @@ -28,32 +28,14 @@ #include "cpu/exec_context.hh" #include "cpu/base_cpu.hh" -#include "cpu/full_cpu/bpred.hh" -#include "cpu/full_cpu/full_cpu.hh" +#include "kern/system_events.hh" +#include "kern/tru64/tru64_events.hh" #include "kern/tru64/dump_mbuf.hh" #include "kern/tru64/printf.hh" -#include "kern/tru64/tru64_events.hh" -#include "mem/functional_mem/memory_control.hh" #include "targetarch/arguments.hh" -#include "sim/system.hh" -#include "sim/sw_context.hh" - -void -SkipFuncEvent::process(ExecContext *xc) -{ - Addr newpc = xc->regs.intRegFile[ReturnAddressReg]; - - DPRINTF(PCEvent, "skipping %s: pc=%x, newpc=%x\n", description, - xc->regs.pc, newpc); - - xc->regs.pc = newpc; - xc->regs.npc = xc->regs.pc + sizeof(MachInst); +#include "mem/functional_mem/memory_control.hh" - BranchPred *bp = xc->cpu->getBranchPred(); - if (bp != NULL) { - bp->popRAS(xc->thread_num); - } -} +//void SkipFuncEvent::process(ExecContext *xc); void BadAddrEvent::process(ExecContext *xc) @@ -106,59 +88,3 @@ DumpMbufEvent::process(ExecContext *xc) tru64::DumpMbuf(args); } } - -FnEvent::FnEvent(PCEventQueue *q, const std::string & desc, System *system) - : PCEvent(q, desc), _name(desc) -{ - myBin = system->getBin(desc); - assert(myBin); -} - -void -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--; - - //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); -} diff --git a/kern/tru64/tru64_events.hh b/kern/tru64/tru64_events.hh index 96e6a8b26..bcf33d686 100644 --- a/kern/tru64/tru64_events.hh +++ b/kern/tru64/tru64_events.hh @@ -32,19 +32,10 @@ #include <string> #include "cpu/pc_event.hh" +#include "kern/system_events.hh" class ExecContext; -class System; - -class SkipFuncEvent : public PCEvent -{ - public: - SkipFuncEvent(PCEventQueue *q, const std::string &desc) - : PCEvent(q, desc) {} - virtual void process(ExecContext *xc); -}; - class BadAddrEvent : public SkipFuncEvent { public: @@ -80,15 +71,4 @@ class DumpMbufEvent : public PCEvent virtual void process(ExecContext *xc); }; -class FnEvent : public PCEvent -{ - public: - FnEvent(PCEventQueue *q, const std::string &desc, System *system); - virtual void process(ExecContext *xc); - std::string myname() const { return _name; } - - private: - std::string _name; - Statistics::MainBin *myBin; -}; #endif // __TRU64_EVENTS_HH__ diff --git a/kern/tru64/tru64_system.cc b/kern/tru64/tru64_system.cc index 905ff5df6..ebd78c58b 100644 --- a/kern/tru64/tru64_system.cc +++ b/kern/tru64/tru64_system.cc @@ -35,6 +35,7 @@ #include "cpu/exec_context.hh" #include "kern/tru64/tru64_events.hh" #include "kern/tru64/tru64_system.hh" +#include "kern/system_events.hh" #include "mem/functional_mem/memory_control.hh" #include "mem/functional_mem/physical_memory.hh" #include "sim/builder.hh" @@ -48,7 +49,7 @@ Tru64System::Tru64System(const string _name, const uint64_t _init_param, 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), + : System(_name, _init_param, _memCtrl, _physmem, _bin, binned_fns), bin(_bin), binned_fns(binned_fns) { kernelSymtab = new SymbolTable; @@ -176,33 +177,14 @@ Tru64System::Tru64System(const string _name, const uint64_t _init_param, // BINNING STUFF if (bin == true) { int end = binned_fns.size(); - assert(!(end & 1)); - - Statistics::MainBin *Bin; Addr address = 0; - fnEvents.resize(end>>1); - for (int i = 0; i < end; i +=2) { - Bin = new Statistics::MainBin(binned_fns[i]); - fnBins.insert(make_pair(binned_fns[i], Bin)); - - fnEvents[(i>>1)] = new FnEvent(&pcEventQueue, binned_fns[i], this); if (kernelSymtab->findAddress(binned_fns[i], address)) fnEvents[(i>>1)]->schedule(address); else panic("could not find kernel symbol %s\n", binned_fns[i]); - - if (binned_fns[i+1] == "null") - populateMap(binned_fns[i], ""); - else - populateMap(binned_fns[i], binned_fns[i+1]); } - - fnCalls - .name(name() + ":fnCalls") - .desc("all fn calls being tracked") - ; } // } @@ -226,14 +208,6 @@ Tru64System::~Tru64System() delete debugPrintfEvent; delete debugPrintfrEvent; delete dumpMbufEvent; - - if (bin == true) { - int end = fnEvents.size(); - for (int i = 0; i < end; ++i) { - delete fnEvents[i]; - } - fnEvents.clear(); - } } int @@ -274,45 +248,6 @@ Tru64System::breakpoint() return remoteGDB[0]->trap(ALPHA_KENTRY_INT); } -void -Tru64System::populateMap(std::string callee, std::string caller) -{ - multimap<const string, string>::const_iterator i; - i = callerMap.insert(make_pair(callee, caller)); - assert(i != callerMap.end() && "should not fail populating callerMap"); -} - -bool -Tru64System::findCaller(std::string callee, std::string caller) const -{ - typedef multimap<const std::string, std::string>::const_iterator iter; - pair<iter, iter> range; - - range = callerMap.equal_range(callee); - for (iter i = range.first; i != range.second; ++i) { - if ((*i).second == caller) - return true; - } - return false; -} - -void -Tru64System::dumpState(ExecContext *xc) const -{ - if (xc->swCtx) { - stack<fnCall *> copy(xc->swCtx->callStack); - if (copy.empty()) - return; - DPRINTF(TCPIP, "xc->swCtx, size: %d:\n", copy.size()); - fnCall *top; - DPRINTF(TCPIP, "|| call : %d\n",xc->swCtx->calls); - for (top = copy.top(); !copy.empty(); copy.pop() ) { - top = copy.top(); - DPRINTF(TCPIP, "|| %13s : %s \n", top->name, top->myBin->name()); - } - } -} - BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tru64System) Param<bool> bin; diff --git a/kern/tru64/tru64_system.hh b/kern/tru64/tru64_system.hh index 34569664d..144febbf9 100644 --- a/kern/tru64/tru64_system.hh +++ b/kern/tru64/tru64_system.hh @@ -67,8 +67,6 @@ class Tru64System : public System DebugPrintfEvent *debugPrintfrEvent; DumpMbufEvent *dumpMbufEvent; - std::vector<FnEvent *> fnEvents; - private: Addr kernelStart; @@ -104,17 +102,6 @@ class Tru64System : public System static void Printf(AlphaArguments args); static void DumpMbuf(AlphaArguments args); - - - // Lisa's binning stuff - private: - std::multimap<const std::string, std::string> callerMap; - void populateMap(std::string caller, std::string callee); - - public: - bool findCaller(std::string callee, std::string caller) const; - void dumpState(ExecContext *xc) const; - // }; #endif // __TRU64_SYSTEM_HH__ |