From: Lisa Hsu Date: Thu, 13 May 2004 15:40:07 +0000 (-0400) Subject: lift some things out of the tru64 directory into common directory so linux can use... X-Git-Tag: m5_1.0_beta2~33^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f28ae6b01b08f166c81adc10139671e6e098780;p=gem5.git lift some things out of the tru64 directory into common directory so linux can use it without replication later. kern/tru64/tru64_events.cc: kern/tru64/tru64_events.hh: lift out SkipFuncEvent and FnEvents since these can be used by any OS. kern/tru64/tru64_system.cc: add system_events (the common OS events file) --HG-- extra : convert_revision : 4d7a843d67459af4d77e433ae3c1b0fbc5f0b56b --- 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 #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 3eed78cdf..7e68dc5a1 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"