Sean Wilson has uploaded this change for review. (
https://gem5-review.googlesource.com/3929
Change subject: arm: Refactor some Event subclasses to lambdas
......................................................................
arm: Refactor some Event subclasses to lambdas
Change-Id: Ic59add8afee1d49633634272d9687a4b1558537e
Signed-off-by: Sean Wilson <spwils...@wisc.edu>
---
M src/dev/arm/gic_pl390.cc
M src/dev/arm/gic_pl390.hh
M src/dev/arm/vgic.cc
M src/dev/arm/vgic.hh
4 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/src/dev/arm/gic_pl390.cc b/src/dev/arm/gic_pl390.cc
index 7b63306..22dc90e 100644
--- a/src/dev/arm/gic_pl390.cc
+++ b/src/dev/arm/gic_pl390.cc
@@ -87,7 +87,9 @@
cpuBpr[x] = GICC_BPR_MINIMUM;
// Initialize cpu highest int
cpuHighestInt[x] = SPURIOUS_INT;
- postIntEvent[x] = new PostIntEvent(*this, x);
+ postIntEvent[x] =
+ new EventFunctionWrapper([this, x]{ postDelayedInt(x); },
+ "Post Interrupt to CPU");
}
DPRINTF(Interrupt, "cpuEnabled[0]=%d cpuEnabled[1]=%d\n",
cpuEnabled[0],
cpuEnabled[1]);
diff --git a/src/dev/arm/gic_pl390.hh b/src/dev/arm/gic_pl390.hh
index 5c8a712..d11e0f0 100644
--- a/src/dev/arm/gic_pl390.hh
+++ b/src/dev/arm/gic_pl390.hh
@@ -340,21 +340,7 @@
*/
void postDelayedInt(uint32_t cpu);
- /** Event definition to post interrupt to CPU after a delay
- */
- class PostIntEvent : public Event
- {
- private:
- Pl390 &parent;
- uint32_t cpu;
- public:
- PostIntEvent(Pl390 &_parent, uint32_t _cpu)
- : parent(_parent), cpu(_cpu)
- { }
- void process() { parent.postDelayedInt(cpu); }
- const char *description() const { return "Post Interrupt to CPU"; }
- };
- PostIntEvent *postIntEvent[CPU_MAX];
+ EventFunctionWrapper *postIntEvent[CPU_MAX];
int pendingDelayedInterrupts;
public:
diff --git a/src/dev/arm/vgic.cc b/src/dev/arm/vgic.cc
index 6744ad5..a641545 100644
--- a/src/dev/arm/vgic.cc
+++ b/src/dev/arm/vgic.cc
@@ -53,7 +53,10 @@
maintInt(p->ppint)
{
for (int x = 0; x < VGIC_CPU_MAX; x++) {
- postVIntEvent[x] = new PostVIntEvent(x, p->platform);
+ auto tempPlatform = p->platform;
+ postVIntEvent[x] = new EventFunctionWrapper(
+ [x, tempPlatform]{ processPostVIntEvent(x, tempPlatform); },
+ "Post VInterrupt to CPU");
maintIntPosted[x] = false;
vIntPosted[x] = false;
}
@@ -369,6 +372,13 @@
}
void
+VGic::processPostVIntEvent(uint32_t cpu, Platform *platform)
+{
+ platform->intrctrl->post(cpu, ArmISA::INT_VIRT_IRQ, 0);
+}
+
+
+void
VGic::postMaintInt(uint32_t cpu)
{
DPRINTF(VGIC, "Posting maintenance PPI to GIC/cpu%d\n", cpu);
diff --git a/src/dev/arm/vgic.hh b/src/dev/arm/vgic.hh
index e9bc29c..4973fdd 100644
--- a/src/dev/arm/vgic.hh
+++ b/src/dev/arm/vgic.hh
@@ -104,22 +104,10 @@
static const uint32_t LR_PENDING = 1;
static const uint32_t LR_ACTIVE = 2;
- /** Event definition to post interrupt to CPU after a delay
- */
- class PostVIntEvent : public Event
- {
- private:
- uint32_t cpu;
- Platform *platform;
- public:
- PostVIntEvent( uint32_t c, Platform* p)
- : cpu(c), platform(p)
- { }
- void process() { platform->intrctrl->post(cpu,
ArmISA::INT_VIRT_IRQ, 0);}
- const char *description() const { return "Post VInterrupt to CPU";
}
- };
+ /** Post interrupt to CPU */
+ static void processPostVIntEvent(uint32_t cpu, Platform *platform);
- PostVIntEvent *postVIntEvent[VGIC_CPU_MAX];
+ EventFunctionWrapper *postVIntEvent[VGIC_CPU_MAX];
bool maintIntPosted[VGIC_CPU_MAX];
bool vIntPosted[VGIC_CPU_MAX];
--
To view, visit https://gem5-review.googlesource.com/3929
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic59add8afee1d49633634272d9687a4b1558537e
Gerrit-Change-Number: 3929
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Wilson <spwils...@wisc.edu>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev