vcpuID(vm.allocVCPUID()), vcpuFD(-1), vcpuMMapSize(0),
_kvmRun(NULL), mmioRing(NULL),
pageSize(sysconf(_SC_PAGE_SIZE)),
- tickEvent(*this),
+ tickEvent([this]{ tick(); }, "BaseKvmCPU tick",
+ false, Event::CPU_Tick_Pri),
activeInstPeriod(0),
perfControlledByTimer(params->usePerfOverflow),
hostFactor(params->hostFactor),
pthread_t vcpuThread;
private:
- struct TickEvent : public Event
- {
- BaseKvmCPU &cpu;
-
- TickEvent(BaseKvmCPU &c)
- : Event(CPU_Tick_Pri), cpu(c) {}
-
- void process() { cpu.tick(); }
-
- const char *description() const {
- return "BaseKvmCPU tick";
- }
- };
-
/**
* Service MMIO requests in the mmioRing.
*
/** Cached page size of the host */
const long pageSize;
- TickEvent tickEvent;
+ EventFunctionWrapper tickEvent;
/**
* Setup an instruction break if there is one pending.
class StubSlavePort : public ExternalSlave::Port
{
public:
- class ResponseEvent : public Event
- {
- public:
- StubSlavePort &owner;
-
- ResponseEvent(StubSlavePort &owner_) : owner(owner_) { }
-
- void process();
- };
+ void processResponseEvent();
- ResponseEvent responseEvent;
+ EventFunctionWrapper responseEvent;
/** Stub can handle a single request at a time. This will be
* NULL when no packet is in flight */
StubSlavePort(const std::string &name_,
ExternalSlave &owner_) :
ExternalSlave::Port(name_, owner_),
- responseEvent(*this), responsePacket(NULL), mustRetry(false)
+ responseEvent([this]{ processResponseEvent(); }, name()),
+ responsePacket(NULL), mustRetry(false)
{ }
Tick recvAtomic(PacketPtr packet);
}
void
-StubSlavePort::ResponseEvent::process()
+StubSlavePort::processResponseEvent()
{
- owner.responsePacket->makeResponse();
- owner.responsePacket->headerDelay = 0;
- owner.responsePacket->payloadDelay = 0;
+ responsePacket->makeResponse();
+ responsePacket->headerDelay = 0;
+ responsePacket->payloadDelay = 0;
- if (owner.sendTimingResp(owner.responsePacket)) {
- owner.responsePacket = NULL;
+ if (sendTimingResp(responsePacket)) {
+ responsePacket = NULL;
- if (owner.mustRetry)
- owner.sendRetryReq();
- owner.mustRetry = false;
+ if (mustRetry)
+ sendRetryReq();
+ mustRetry = false;
}
}