31 #ifndef __ARCH_MIPS_MT_HH__ 32 #define __ARCH_MIPS_MT_HH__ 122 return tcbind.curVPE;
130 return vpeCtrl.targTC;
137 if (tc->status() == TC::Active) {
146 warn(
"%i: Halting thread %i in %s @ PC %x, setting restart PC to %x",
147 curTick(), tc->threadId(), tc->getCpuPtr()->name(),
156 if (tc->status() != TC::Active) {
161 tc->pcState(restartPC);
164 warn(
"%i: Restoring thread %i in %s @ PC %x",
165 curTick(), tc->threadId(), tc->getCpuPtr()->name(), restartPC);
174 int num_threads = mvpConf.ptc + 1;
177 for (
ThreadID tid = 0; tid < num_threads && success == 0; tid++) {
178 TCBindReg tidTCBind =
182 if (tidTCBind.curVPE == tcBind.curVPE) {
184 TCStatusReg tidTCStatus =
188 TCHaltReg tidTCHalt =
192 if (tidTCStatus.da == 1 && tidTCHalt.h == 0 &&
193 tidTCStatus.a == 0 && success == 0) {
203 tidTCStatus.rnst = 0;
211 tidTCStatus.tksu = status.ksu;
213 tidTCStatus.asid = tcStatus.asid;
223 std::cerr <<
"Bad VPEs" << std::endl;
228 VPEControlReg vpeControl =
230 vpeControl.excpt = 1;
232 fault = std::make_shared<ThreadFault>();
243 ThreadID num_threads = mvpConf0.ptc + 1;
250 for (
ThreadID tid = 0; tid < num_threads; tid++) {
251 TCStatusReg tidTCStatus =
254 TCHaltReg tidTCHalt =
257 TCBindReg tidTCBind =
261 if (tidTCBind.curVPE == tcBind.curVPE &&
262 tidTCBind.curTC == tcBind.curTC &&
263 tidTCStatus.da == 1 &&
265 tidTCStatus.a == 1) {
274 warn(
"%i: Deactivating Hardware Thread Context #%i",
277 }
else if (src_reg > 0) {
278 if (src_reg && !yield_mask != 0) {
280 vpeControl.excpt = 2;
282 fault = std::make_shared<ThreadFault>();
285 }
else if (src_reg != -2) {
287 VPEControlReg vpeControl =
290 if (vpeControl.ysi == 1 && tcStatus.dt == 1 ) {
291 vpeControl.excpt = 4;
292 fault = std::make_shared<ThreadFault>();
297 return src_reg & yield_mask;
312 status.cu = tcStatus.tcu;
313 status.mx = tcStatus.tmx;
314 status.ksu = tcStatus.tksu;
330 tcStatus.tcu = status.cu;
331 tcStatus.tmx = status.mx;
332 tcStatus.tksu = status.ksu;
#define panic(...)
This implements a cprintf based panic() function.
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal readIntReg(RegIndex reg_idx) const =0
void updateStatusView(TC *tc)
void restoreThread(TC *tc)
virtual BaseCPU * getCpuPtr()=0
virtual void setFloatReg(RegIndex reg_idx, RegVal val)=0
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static RegVal readRegOtherThread(ThreadContext *tc, const RegId ®, ThreadID tid=InvalidThreadID)
void updateTCStatusView(TC *tc)
Tick curTick()
The current simulated tick.
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual RegVal readFloatReg(RegIndex reg_idx) const =0
unsigned getVirtProcNum(TC *tc)
unsigned getTargetThread(TC *tc)
virtual void setIntReg(RegIndex reg_idx, RegVal val)=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int yieldThread(TC *tc, Fault &fault, int src_reg, uint32_t yield_mask)
void forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt)
const ThreadID InvalidThreadID
int16_t ThreadID
Thread index/ID type.
const RegClass & classValue() const
Class accessor.
virtual ThreadContext * getContext(int tn)
Given a thread num get tho thread context for it.
static void setRegOtherThread(ThreadContext *tc, const RegId ®, RegVal val, ThreadID tid=InvalidThreadID)
const RegIndex & index() const
Index accessors.
virtual ThreadContext * tcBase()=0
Returns a pointer to the ThreadContext.
Register ID: describe an architectural register with its class and index.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
std::shared_ptr< FaultBase > Fault
const char * className() const
Return a const char* with the register class name.