summaryrefslogtreecommitdiff
path: root/src/arch/mips
diff options
context:
space:
mode:
authorSean Wilson <spwilson2@wisc.edu>2017-06-16 16:48:36 -0500
committerSean Wilson <spwilson2@wisc.edu>2017-07-12 20:07:05 +0000
commit1b7bf4ed75b55fdfc55d901775c837377268b661 (patch)
treea90aa814054c64598a13a233e93aa373bb4ef442 /src/arch/mips
parent373054232eb5b0dcb3b76c3f6090b08160f10fac (diff)
downloadgem5-1b7bf4ed75b55fdfc55d901775c837377268b661.tar.xz
mips, x86: Refactor some Event subclasses into lambdas
Change-Id: I09570e569efe55f5502bc201e03456738999e714 Signed-off-by: Sean Wilson <spwilson2@wisc.edu> Reviewed-on: https://gem5-review.googlesource.com/3920 Maintainer: Jason Lowe-Power <jason@lowepower.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/mips')
-rw-r--r--src/arch/mips/isa.cc31
-rw-r--r--src/arch/mips/isa.hh30
2 files changed, 7 insertions, 54 deletions
diff --git a/src/arch/mips/isa.cc b/src/arch/mips/isa.cc
index 6310f67e7..df70bacbb 100644
--- a/src/arch/mips/isa.cc
+++ b/src/arch/mips/isa.cc
@@ -523,7 +523,9 @@ ISA::scheduleCP0Update(BaseCPU *cpu, Cycles delay)
cp0Updated = true;
//schedule UPDATE
- CP0Event *cp0_event = new CP0Event(this, cpu, UpdateCP0);
+ auto cp0_event = new EventFunctionWrapper(
+ [this, cpu]{ processCP0Event(cpu, UpdateCP0); },
+ "Coprocessor-0 event", true, Event::CPU_Tick_Pri);
cpu->schedule(cp0_event, cpu->clockEdge(delay));
}
}
@@ -557,40 +559,17 @@ ISA::updateCPU(BaseCPU *cpu)
cp0Updated = false;
}
-ISA::CP0Event::CP0Event(CP0 *_cp0, BaseCPU *_cpu, CP0EventType e_type)
- : Event(CPU_Tick_Pri), cp0(_cp0), cpu(_cpu), cp0EventType(e_type)
-{ }
-
void
-ISA::CP0Event::process()
+ISA::processCP0Event(BaseCPU *cpu, CP0EventType cp0EventType)
{
switch (cp0EventType)
{
case UpdateCP0:
- cp0->updateCPU(cpu);
+ updateCPU(cpu);
break;
}
}
-const char *
-ISA::CP0Event::description() const
-{
- return "Coprocessor-0 event";
-}
-
-void
-ISA::CP0Event::scheduleEvent(Cycles delay)
-{
- cpu->reschedule(this, cpu->clockEdge(delay), true);
-}
-
-void
-ISA::CP0Event::unscheduleEvent()
-{
- if (scheduled())
- squash();
-}
-
}
MipsISA::ISA *
diff --git a/src/arch/mips/isa.hh b/src/arch/mips/isa.hh
index c38b7cec0..885ca2ff7 100644
--- a/src/arch/mips/isa.hh
+++ b/src/arch/mips/isa.hh
@@ -118,31 +118,8 @@ namespace MipsISA
UpdateCP0
};
- // Declare A CP0Event Class for scheduling
- class CP0Event : public Event
- {
- protected:
- ISA::CP0 *cp0;
- BaseCPU *cpu;
- CP0EventType cp0EventType;
- Fault fault;
-
- public:
- /** Constructs a CP0 event. */
- CP0Event(CP0 *_cp0, BaseCPU *_cpu, CP0EventType e_type);
-
- /** Process this event. */
- virtual void process();
-
- /** Returns the description of this event. */
- const char *description() const;
-
- /** Schedule This Event */
- void scheduleEvent(Cycles delay);
-
- /** Unschedule This Event */
- void unscheduleEvent();
- };
+ /** Process a CP0 event */
+ void processCP0Event(BaseCPU *cpu, CP0EventType);
// Schedule a CP0 Update Event
void scheduleCP0Update(BaseCPU *cpu, Cycles delay = Cycles(0));
@@ -151,9 +128,6 @@ namespace MipsISA
// and if necessary alert the CPU
void updateCPU(BaseCPU *cpu);
- // Keep a List of CPU Events that need to be deallocated
- std::queue<CP0Event*> cp0EventRemoveList;
-
static std::string miscRegNames[NumMiscRegs];
public: