diff options
-rw-r--r-- | src/arch/alpha/freebsd/system.hh | 4 | ||||
-rw-r--r-- | src/arch/alpha/idle_event.hh | 4 | ||||
-rw-r--r-- | src/arch/alpha/linux/system.hh | 8 | ||||
-rw-r--r-- | src/arch/arm/linux/system.hh | 8 | ||||
-rw-r--r-- | src/arch/mips/idle_event.hh | 4 | ||||
-rw-r--r-- | src/arch/mips/linux/system.hh | 8 | ||||
-rw-r--r-- | src/arch/riscv/idle_event.hh | 4 | ||||
-rw-r--r-- | src/base/remote_gdb.cc | 4 | ||||
-rw-r--r-- | src/cpu/pc_event.cc | 8 | ||||
-rw-r--r-- | src/cpu/pc_event.hh | 34 | ||||
-rw-r--r-- | src/kern/freebsd/events.hh | 4 | ||||
-rw-r--r-- | src/kern/linux/events.hh | 16 | ||||
-rw-r--r-- | src/kern/system_events.hh | 4 |
13 files changed, 59 insertions, 51 deletions
diff --git a/src/arch/alpha/freebsd/system.hh b/src/arch/alpha/freebsd/system.hh index 48f6238c0..1a8bb9366 100644 --- a/src/arch/alpha/freebsd/system.hh +++ b/src/arch/alpha/freebsd/system.hh @@ -42,9 +42,9 @@ class FreebsdAlphaSystem : public AlphaSystem class SkipCalibrateClocksEvent : public SkipFuncEvent { public: - SkipCalibrateClocksEvent(PCEventQueue *q, const std::string &desc, + SkipCalibrateClocksEvent(PCEventScope *s, const std::string &desc, Addr addr) - : SkipFuncEvent(q, desc, addr) {} + : SkipFuncEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/arch/alpha/idle_event.hh b/src/arch/alpha/idle_event.hh index 97d5bdd6e..b3b53daea 100644 --- a/src/arch/alpha/idle_event.hh +++ b/src/arch/alpha/idle_event.hh @@ -38,8 +38,8 @@ class IdleStartEvent : public PCEvent { public: - IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) + IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/arch/alpha/linux/system.hh b/src/arch/alpha/linux/system.hh index 8ea387e74..2477d426e 100644 --- a/src/arch/alpha/linux/system.hh +++ b/src/arch/alpha/linux/system.hh @@ -53,15 +53,15 @@ class LinuxAlphaSystem : public AlphaSystem private: struct SkipDelayLoopEvent : public SkipFuncEvent { - SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : SkipFuncEvent(q, desc, addr) {} + SkipDelayLoopEvent(PCEventScope *s, const std::string &desc, Addr addr) + : SkipFuncEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; struct PrintThreadInfo : public PCEvent { - PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) {} + PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/arch/arm/linux/system.hh b/src/arch/arm/linux/system.hh index 247ebae13..098ceda2e 100644 --- a/src/arch/arm/linux/system.hh +++ b/src/arch/arm/linux/system.hh @@ -127,8 +127,8 @@ class LinuxArmSystem : public GenericArmSystem class DumpStatsPCEvent : public PCEvent { public: - DumpStatsPCEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) + DumpStatsPCEvent(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext* tc); @@ -140,8 +140,8 @@ class DumpStatsPCEvent : public PCEvent class DumpStatsPCEvent64 : public DumpStatsPCEvent { public: - DumpStatsPCEvent64(PCEventQueue *q, const std::string &desc, Addr addr) - : DumpStatsPCEvent(q, desc, addr) + DumpStatsPCEvent64(PCEventScope *s, const std::string &desc, Addr addr) + : DumpStatsPCEvent(s, desc, addr) {} private: void getTaskDetails(ThreadContext *tc, uint32_t &pid, uint32_t &tgid, diff --git a/src/arch/mips/idle_event.hh b/src/arch/mips/idle_event.hh index 3f96ce3e0..c65be0d0c 100644 --- a/src/arch/mips/idle_event.hh +++ b/src/arch/mips/idle_event.hh @@ -38,8 +38,8 @@ class IdleStartEvent : public PCEvent { public: - IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) + IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/arch/mips/linux/system.hh b/src/arch/mips/linux/system.hh index 55e47bbb2..2b8526b63 100644 --- a/src/arch/mips/linux/system.hh +++ b/src/arch/mips/linux/system.hh @@ -54,16 +54,16 @@ class LinuxMipsSystem : public MipsSystem class SkipDelayLoopEvent : public SkipFuncEvent { public: - SkipDelayLoopEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : SkipFuncEvent(q, desc, addr) {} + SkipDelayLoopEvent(PCEventScope *s, const std::string &desc, Addr addr) + : SkipFuncEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; class PrintThreadInfo : public PCEvent { public: - PrintThreadInfo(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) {} + PrintThreadInfo(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/arch/riscv/idle_event.hh b/src/arch/riscv/idle_event.hh index e77ae59f5..bcba05bf1 100644 --- a/src/arch/riscv/idle_event.hh +++ b/src/arch/riscv/idle_event.hh @@ -38,8 +38,8 @@ class IdleStartEvent : public PCEvent { public: - IdleStartEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) + IdleStartEvent(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index 77b3fbc20..d0ccde566 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -175,8 +175,8 @@ class HardBreakpoint : public PCEvent int refcount; public: - HardBreakpoint(BaseRemoteGDB *_gdb, PCEventQueue *q, Addr pc) - : PCEvent(q, "HardBreakpoint Event", pc), + HardBreakpoint(BaseRemoteGDB *_gdb, PCEventScope *s, Addr pc) + : PCEvent(s, "HardBreakpoint Event", pc), gdb(_gdb), refcount(0) { DPRINTF(GDBMisc, "creating hardware breakpoint at %#x\n", evpc); diff --git a/src/cpu/pc_event.cc b/src/cpu/pc_event.cc index 60e781ba8..65094f0ad 100644 --- a/src/cpu/pc_event.cc +++ b/src/cpu/pc_event.cc @@ -126,9 +126,9 @@ PCEventQueue::equal_range(Addr pc) return std::equal_range(pcMap.begin(), pcMap.end(), pc, MapCompare()); } -BreakPCEvent::BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr, +BreakPCEvent::BreakPCEvent(PCEventScope *s, const std::string &desc, Addr addr, bool del) - : PCEvent(q, desc, addr), remove(del) + : PCEvent(s, desc, addr), remove(del) { } @@ -142,8 +142,8 @@ BreakPCEvent::process(ThreadContext *tc) delete this; } -PanicPCEvent::PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc) - : PCEvent(q, desc, pc) +PanicPCEvent::PanicPCEvent(PCEventScope *s, const std::string &desc, Addr pc) + : PCEvent(s, desc, pc) { } diff --git a/src/cpu/pc_event.hh b/src/cpu/pc_event.hh index 2289c876c..0654ca54e 100644 --- a/src/cpu/pc_event.hh +++ b/src/cpu/pc_event.hh @@ -40,18 +40,19 @@ class ThreadContext; class PCEventQueue; class System; +class PCEventScope; class PCEvent { protected: std::string description; - PCEventQueue *queue; + PCEventScope *scope; Addr evpc; public: - PCEvent(PCEventQueue *q, const std::string &desc, Addr pc); + PCEvent(PCEventScope *q, const std::string &desc, Addr pc); - virtual ~PCEvent() { if (queue) remove(); } + virtual ~PCEvent() { if (scope) remove(); } // for DPRINTF virtual const std::string name() const { return description; } @@ -63,7 +64,14 @@ class PCEvent virtual void process(ThreadContext *tc) = 0; }; -class PCEventQueue +class PCEventScope +{ + public: + virtual bool remove(PCEvent *event) = 0; + virtual bool schedule(PCEvent *event) = 0; +}; + +class PCEventQueue : public PCEventScope { protected: class MapCompare { @@ -103,8 +111,8 @@ class PCEventQueue PCEventQueue(); ~PCEventQueue(); - bool remove(PCEvent *event); - bool schedule(PCEvent *event); + bool remove(PCEvent *event) override; + bool schedule(PCEvent *event) override; bool service(ThreadContext *tc) { if (pcMap.empty()) @@ -121,19 +129,19 @@ class PCEventQueue inline -PCEvent::PCEvent(PCEventQueue *q, const std::string &desc, Addr pc) - : description(desc), queue(q), evpc(pc) +PCEvent::PCEvent(PCEventScope *s, const std::string &desc, Addr pc) + : description(desc), scope(s), evpc(pc) { - queue->schedule(this); + scope->schedule(this); } inline bool PCEvent::remove() { - if (!queue) + if (!scope) panic("cannot remove an uninitialized event;"); - return queue->remove(this); + return scope->remove(this); } class BreakPCEvent : public PCEvent @@ -142,7 +150,7 @@ class BreakPCEvent : public PCEvent bool remove; public: - BreakPCEvent(PCEventQueue *q, const std::string &desc, Addr addr, + BreakPCEvent(PCEventScope *s, const std::string &desc, Addr addr, bool del = false); virtual void process(ThreadContext *tc); }; @@ -150,7 +158,7 @@ class BreakPCEvent : public PCEvent class PanicPCEvent : public PCEvent { public: - PanicPCEvent(PCEventQueue *q, const std::string &desc, Addr pc); + PanicPCEvent(PCEventScope *s, const std::string &desc, Addr pc); virtual void process(ThreadContext *tc); }; diff --git a/src/kern/freebsd/events.hh b/src/kern/freebsd/events.hh index 1d3faa935..ebee3e084 100644 --- a/src/kern/freebsd/events.hh +++ b/src/kern/freebsd/events.hh @@ -57,9 +57,9 @@ class UDelayEvent : public SkipFuncEvent uint64_t argMultToNs; public: - UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr, + UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr, uint64_t mult, uint64_t div) - : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {} + : SkipFuncEvent(s, desc, addr), argDivToNs(div), argMultToNs(mult) {} virtual void process(ThreadContext *xc); }; diff --git a/src/kern/linux/events.hh b/src/kern/linux/events.hh index b8aad9d79..d4c77bf68 100644 --- a/src/kern/linux/events.hh +++ b/src/kern/linux/events.hh @@ -51,8 +51,8 @@ namespace Linux { class DebugPrintkEvent : public SkipFuncEvent { public: - DebugPrintkEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : SkipFuncEvent(q, desc, addr) {} + DebugPrintkEvent(PCEventScope *s, const std::string &desc, Addr addr) + : SkipFuncEvent(s, desc, addr) {} virtual void process(ThreadContext *xc); }; @@ -70,9 +70,9 @@ class DmesgDumpEvent : public PCEvent std::string fname; public: - DmesgDumpEvent(PCEventQueue *q, const std::string &desc, Addr addr, + DmesgDumpEvent(PCEventScope *s, const std::string &desc, Addr addr, const std::string &_fname) - : PCEvent(q, desc, addr), fname(_fname) {} + : PCEvent(s, desc, addr), fname(_fname) {} virtual void process(ThreadContext *xc); }; @@ -90,9 +90,9 @@ class KernelPanicEvent : public PCEvent std::string fname; public: - KernelPanicEvent(PCEventQueue *q, const std::string &desc, Addr addr, + KernelPanicEvent(PCEventScope *s, const std::string &desc, Addr addr, const std::string &_fname) - : PCEvent(q, desc, addr), fname(_fname) {} + : PCEvent(s, desc, addr), fname(_fname) {} virtual void process(ThreadContext *xc); }; @@ -116,9 +116,9 @@ class UDelayEvent : public SkipFuncEvent uint64_t argMultToNs; public: - UDelayEvent(PCEventQueue *q, const std::string &desc, Addr addr, + UDelayEvent(PCEventScope *s, const std::string &desc, Addr addr, uint64_t mult, uint64_t div) - : SkipFuncEvent(q, desc, addr), argDivToNs(div), argMultToNs(mult) {} + : SkipFuncEvent(s, desc, addr), argDivToNs(div), argMultToNs(mult) {} virtual void process(ThreadContext *xc); }; diff --git a/src/kern/system_events.hh b/src/kern/system_events.hh index 58cbc4808..967443937 100644 --- a/src/kern/system_events.hh +++ b/src/kern/system_events.hh @@ -38,8 +38,8 @@ class SkipFuncEvent : public PCEvent { public: - SkipFuncEvent(PCEventQueue *q, const std::string &desc, Addr addr) - : PCEvent(q, desc, addr) + SkipFuncEvent(PCEventScope *s, const std::string &desc, Addr addr) + : PCEvent(s, desc, addr) {} virtual void process(ThreadContext *tc); }; |