std::map<Addr, HardBreakpoint *> hardBreakMap;
-EventQueue *
-getComInstEventQueue(ThreadContext *tc)
-{
- return tc->getCpuPtr()->comInstEventQueue[tc->threadId()];
-}
-
}
BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, int _port) :
void
BaseRemoteGDB::scheduleInstCommitEvent(Event *ev, int delta)
{
- EventQueue *eq = getComInstEventQueue(tc);
+ auto *cpu = tc->getCpuPtr();
// Here "ticks" aren't simulator ticks which measure time, they're
// instructions committed by the CPU.
- eq->schedule(ev, eq->getCurTick() + delta);
+ cpu->scheduleInstCountEvent(tc->threadId(), ev,
+ cpu->getCurrentInstCount(tc->threadId()) + delta);
}
void
BaseRemoteGDB::descheduleInstCommitEvent(Event *ev)
{
if (ev->scheduled())
- getComInstEventQueue(tc)->deschedule(ev);
+ tc->getCpuPtr()->descheduleInstCountEvent(tc->threadId(), ev);
}
std::map<char, BaseRemoteGDB::GdbCommand> BaseRemoteGDB::command_map = {
*counter = numThreads;
for (ThreadID tid = 0; tid < numThreads; ++tid) {
Event *event = new CountedExitEvent(cause, *counter);
- comInstEventQueue[tid]->schedule(event, p->max_insts_all_threads);
+ scheduleInstCountEvent(tid, event, p->max_insts_all_threads);
}
}
void
BaseCPU::scheduleInstStop(ThreadID tid, Counter insts, const char *cause)
{
- const Tick now(comInstEventQueue[tid]->getCurTick());
+ const Tick now(getCurrentInstCount(tid));
Event *event(new LocalSimLoopExitEvent(cause, 0));
- comInstEventQueue[tid]->schedule(event, now + insts);
+ scheduleInstCountEvent(tid, event, now + insts);
}
-uint64_t
+Tick
BaseCPU::getCurrentInstCount(ThreadID tid)
{
- return Tick(comInstEventQueue[tid]->getCurTick());
+ return comInstEventQueue[tid]->getCurTick();
}
AddressMonitor::AddressMonitor() {
*/
uint64_t getCurrentInstCount(ThreadID tid);
+ Tick
+ nextInstEventCount(ThreadID tid)
+ {
+ return comInstEventQueue[tid]->empty() ?
+ MaxTick : comInstEventQueue[tid]->nextTick();
+ }
+
+ void
+ serviceInstCountEvents(ThreadID tid, Tick count)
+ {
+ comInstEventQueue[tid]->serviceEvents(count);
+ }
+
+ void
+ scheduleInstCountEvent(ThreadID tid, Event *event, Tick count)
+ {
+ comInstEventQueue[tid]->schedule(event, count);
+ }
+
+ void
+ descheduleInstCountEvent(ThreadID tid, Event *event)
+ {
+ comInstEventQueue[tid]->deschedule(event);
+ }
+
public:
/**
* @{
case RunningServiceCompletion:
case Running: {
- const uint64_t nextInstEvent(
- !comInstEventQueue[0]->empty() ?
- comInstEventQueue[0]->nextTick() : UINT64_MAX);
+ const uint64_t nextInstEvent(nextInstEventCount(0));
// Enter into KVM and complete pending IO instructions if we
// have an instruction event pending.
const Tick ticksToExecute(
// Service any pending instruction events. The vCPU should
// have exited in time for the event using the instruction
// counter configured by setupInstStop().
- comInstEventQueue[0]->serviceEvents(ctrInsts);
+ serviceInstCountEvents(0, ctrInsts);
if (tryDrain())
_status = Idle;
void
BaseKvmCPU::setupInstStop()
{
- if (comInstEventQueue[0]->empty()) {
+ Tick next = nextInstEventCount(0);
+ if (next == MaxTick) {
setupInstCounter(0);
} else {
- const uint64_t next(comInstEventQueue[0]->nextTick());
-
assert(next > ctrInsts);
setupInstCounter(next - ctrInsts);
}
cpu.system->totalNumInsts++;
/* Act on events related to instruction counts */
- cpu.comInstEventQueue[inst->id.threadId]->serviceEvents(thread->numInst);
+ cpu.serviceInstCountEvents(inst->id.threadId, thread->numInst);
}
thread->numOp++;
thread->numOps++;
system->totalNumInsts++;
// Check for instruction-count-based events.
- comInstEventQueue[tid]->serviceEvents(thread[tid]->numInst);
+ serviceInstCountEvents(tid, thread[tid]->numInst);
}
thread[tid]->numOp++;
thread[tid]->numOps++;
} else {
// Schedule an event to register all elastic trace probes when
// specified no. of instructions are committed.
- cpu->comInstEventQueue[(ThreadID)0]->schedule(®EtraceListenersEvent,
- startTraceInst);
+ cpu->scheduleInstCountEvent(
+ 0, ®EtraceListenersEvent, startTraceInst);
}
}
t_info.setMemAccPredicate(true);
// check for instruction-count-based events
- comInstEventQueue[curThread]->serviceEvents(t_info.numInst);
+ serviceInstCountEvents(curThread, t_info.numInst);
// decode the instruction
inst = gtoh(inst);