cpu: Fix some style problems in the base CPU class.
Change-Id: I5c714245237056eebeaf5de1278e8d13557ac131 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52083 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -97,10 +97,10 @@ CPUProgressEvent::process()
|
||||
Counter temp = cpu->totalOps();
|
||||
|
||||
if (_repeatEvent)
|
||||
cpu->schedule(this, curTick() + _interval);
|
||||
cpu->schedule(this, curTick() + _interval);
|
||||
|
||||
if (cpu->switchedOut()) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -150,7 +150,7 @@ BaseCPU::BaseCPU(const Params &p, bool is_checker)
|
||||
cpuList.push_back(this);
|
||||
|
||||
DPRINTF(SyscallVerbose, "Constructing CPU with id %d, socket id %d\n",
|
||||
_cpuId, _socketId);
|
||||
_cpuId, _socketId);
|
||||
|
||||
if (numThreads > maxThreadsPerCPU)
|
||||
maxThreadsPerCPU = numThreads;
|
||||
@@ -196,7 +196,7 @@ BaseCPU::postInterrupt(ThreadID tid, int int_num, int index)
|
||||
interrupts[tid]->post(int_num, index);
|
||||
// Only wake up syscall emulation if it is not waiting on a futex.
|
||||
// This is to model the fact that instructions such as ARM SEV
|
||||
// should wake up a WFE sleep, but not a futex syscall WAIT. */
|
||||
// should wake up a WFE sleep, but not a futex syscall WAIT.
|
||||
if (FullSystem || !system->futexMap.is_waiting(threadContexts[tid]))
|
||||
wakeup(tid);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ BaseCPU::armMonitor(ThreadID tid, Addr address)
|
||||
monitor.armed = true;
|
||||
monitor.vAddr = address;
|
||||
monitor.pAddr = 0x0;
|
||||
DPRINTF(Mwait,"[tid:%d] Armed monitor (vAddr=0x%lx)\n", tid, address);
|
||||
DPRINTF(Mwait, "[tid:%d] Armed monitor (vAddr=0x%lx)\n", tid, address);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -227,7 +227,7 @@ BaseCPU::mwait(ThreadID tid, PacketPtr pkt)
|
||||
monitor.pAddr = pkt->getAddr() & mask;
|
||||
monitor.waiting = true;
|
||||
|
||||
DPRINTF(Mwait,"[tid:%d] mwait called (vAddr=0x%lx, "
|
||||
DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, "
|
||||
"line's paddr=0x%lx)\n", tid, monitor.vAddr, monitor.pAddr);
|
||||
return true;
|
||||
} else {
|
||||
@@ -264,7 +264,7 @@ BaseCPU::mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu)
|
||||
monitor.pAddr = req->getPaddr() & mask;
|
||||
monitor.waiting = true;
|
||||
|
||||
DPRINTF(Mwait,"[tid:%d] mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
|
||||
DPRINTF(Mwait, "[tid:%d] mwait called (vAddr=0x%lx, line's paddr=0x%lx)\n",
|
||||
tid, monitor.vAddr, monitor.pAddr);
|
||||
}
|
||||
|
||||
@@ -679,17 +679,20 @@ BaseCPU::getCurrentInstCount(ThreadID tid)
|
||||
return threadContexts[tid]->getCurrentInstCount();
|
||||
}
|
||||
|
||||
AddressMonitor::AddressMonitor() {
|
||||
AddressMonitor::AddressMonitor()
|
||||
{
|
||||
armed = false;
|
||||
waiting = false;
|
||||
gotWakeup = false;
|
||||
}
|
||||
|
||||
bool AddressMonitor::doMonitor(PacketPtr pkt) {
|
||||
bool
|
||||
AddressMonitor::doMonitor(PacketPtr pkt)
|
||||
{
|
||||
assert(pkt->req->hasPaddr());
|
||||
if (armed && waiting) {
|
||||
if (pAddr == pkt->getAddr()) {
|
||||
DPRINTF(Mwait,"pAddr=0x%lx invalidated: waking up core\n",
|
||||
DPRINTF(Mwait, "pAddr=0x%lx invalidated: waking up core\n",
|
||||
pkt->getAddr());
|
||||
waiting = false;
|
||||
return true;
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#else
|
||||
#include "arch/generic/interrupts.hh"
|
||||
#include "base/statistics.hh"
|
||||
#include "debug/Mwait.hh"
|
||||
#include "mem/port_proxy.hh"
|
||||
#include "sim/clocked_object.hh"
|
||||
#include "sim/eventq.hh"
|
||||
@@ -60,7 +61,6 @@
|
||||
#include "sim/probe/pmu.hh"
|
||||
#include "sim/probe/probe.hh"
|
||||
#include "sim/system.hh"
|
||||
#include "debug/Mwait.hh"
|
||||
|
||||
namespace gem5
|
||||
{
|
||||
@@ -237,8 +237,7 @@ class BaseCPU : public ClockedObject
|
||||
|
||||
virtual void wakeup(ThreadID tid) = 0;
|
||||
|
||||
void
|
||||
postInterrupt(ThreadID tid, int int_num, int index);
|
||||
void postInterrupt(ThreadID tid, int int_num, int index);
|
||||
|
||||
void
|
||||
clearInterrupt(ThreadID tid, int int_num, int index)
|
||||
@@ -283,20 +282,25 @@ class BaseCPU : public ClockedObject
|
||||
/// Notify the CPU that the indicated context is now halted.
|
||||
virtual void haltContext(ThreadID thread_num);
|
||||
|
||||
/// Given a Thread Context pointer return the thread num
|
||||
int findContext(ThreadContext *tc);
|
||||
/// Given a Thread Context pointer return the thread num
|
||||
int findContext(ThreadContext *tc);
|
||||
|
||||
/// Given a thread num get tho thread context for it
|
||||
virtual ThreadContext *getContext(int tn) { return threadContexts[tn]; }
|
||||
/// Given a thread num get tho thread context for it
|
||||
virtual ThreadContext *getContext(int tn) { return threadContexts[tn]; }
|
||||
|
||||
/// Get the number of thread contexts available
|
||||
unsigned numContexts() {
|
||||
return static_cast<unsigned>(threadContexts.size());
|
||||
}
|
||||
/// Get the number of thread contexts available
|
||||
unsigned
|
||||
numContexts()
|
||||
{
|
||||
return static_cast<unsigned>(threadContexts.size());
|
||||
}
|
||||
|
||||
/// Convert ContextID to threadID
|
||||
ThreadID contextToThread(ContextID cid)
|
||||
{ return static_cast<ThreadID>(cid - threadContexts[0]->contextId()); }
|
||||
ThreadID
|
||||
contextToThread(ContextID cid)
|
||||
{
|
||||
return static_cast<ThreadID>(cid - threadContexts[0]->contextId());
|
||||
}
|
||||
|
||||
public:
|
||||
PARAMS(BaseCPU);
|
||||
@@ -520,7 +524,8 @@ class BaseCPU : public ClockedObject
|
||||
CPUState previousState;
|
||||
|
||||
/** base method keeping track of cycle progression **/
|
||||
inline void updateCycleCounters(CPUState state)
|
||||
inline void
|
||||
updateCycleCounters(CPUState state)
|
||||
{
|
||||
uint32_t delta = curCycle() - previousCycle;
|
||||
|
||||
@@ -528,8 +533,7 @@ class BaseCPU : public ClockedObject
|
||||
ppActiveCycles->notify(delta);
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
switch (state) {
|
||||
case CPU_STATE_WAKEUP:
|
||||
ppSleeping->notify(false);
|
||||
break;
|
||||
@@ -560,14 +564,16 @@ class BaseCPU : public ClockedObject
|
||||
static std::vector<BaseCPU *> cpuList; //!< Static global cpu list
|
||||
|
||||
public:
|
||||
void traceFunctions(Addr pc)
|
||||
void
|
||||
traceFunctions(Addr pc)
|
||||
{
|
||||
if (functionTracingEnabled)
|
||||
traceFunctionsInternal(pc);
|
||||
}
|
||||
|
||||
static int numSimulatedCPUs() { return cpuList.size(); }
|
||||
static Counter numSimulatedInsts()
|
||||
static Counter
|
||||
numSimulatedInsts()
|
||||
{
|
||||
Counter total = 0;
|
||||
|
||||
@@ -578,7 +584,8 @@ class BaseCPU : public ClockedObject
|
||||
return total;
|
||||
}
|
||||
|
||||
static Counter numSimulatedOps()
|
||||
static Counter
|
||||
numSimulatedOps()
|
||||
{
|
||||
Counter total = 0;
|
||||
|
||||
@@ -606,7 +613,8 @@ class BaseCPU : public ClockedObject
|
||||
void armMonitor(ThreadID tid, Addr address);
|
||||
bool mwait(ThreadID tid, PacketPtr pkt);
|
||||
void mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu);
|
||||
AddressMonitor *getCpuAddrMonitor(ThreadID tid)
|
||||
AddressMonitor *
|
||||
getCpuAddrMonitor(ThreadID tid)
|
||||
{
|
||||
assert(tid < numThreads);
|
||||
return &addressMonitor[tid];
|
||||
|
||||
Reference in New Issue
Block a user