29 #ifndef __ARCH_MIPS_MT_HH__
30 #define __ARCH_MIPS_MT_HH__
63 switch (
reg.classValue()) {
73 panic(
"Unexpected reg class! (%s)",
reg.className());
87 switch (
reg.classValue()) {
97 panic(
"Unexpected reg class! (%s)",
reg.className());
120 return tcbind.curVPE;
128 return vpeCtrl.targTC;
135 if (tc->status() == TC::Active) {
144 warn(
"%i: Halting thread %i in %s @ PC %x, setting restart PC to %x",
145 curTick(), tc->threadId(), tc->getCpuPtr()->name(),
154 if (tc->status() != TC::Active) {
159 tc->pcState(restartPC);
162 warn(
"%i: Restoring thread %i in %s @ PC %x",
163 curTick(), tc->threadId(), tc->getCpuPtr()->name(), restartPC);
172 int num_threads = mvpConf.ptc + 1;
175 for (
ThreadID tid = 0; tid < num_threads && success == 0; tid++) {
176 TCBindReg tidTCBind =
180 if (tidTCBind.curVPE == tcBind.curVPE) {
182 TCStatusReg tidTCStatus =
186 TCHaltReg tidTCHalt =
190 if (tidTCStatus.da == 1 && tidTCHalt.h == 0 &&
191 tidTCStatus.a == 0 && success == 0) {
201 tidTCStatus.rnst = 0;
209 tidTCStatus.tksu =
status.ksu;
211 tidTCStatus.asid = tcStatus.asid;
221 std::cerr <<
"Bad VPEs" << std::endl;
226 VPEControlReg vpeControl =
228 vpeControl.excpt = 1;
230 fault = std::make_shared<ThreadFault>();
241 ThreadID num_threads = mvpConf0.ptc + 1;
248 for (
ThreadID tid = 0; tid < num_threads; tid++) {
249 TCStatusReg tidTCStatus =
252 TCHaltReg tidTCHalt =
255 TCBindReg tidTCBind =
259 if (tidTCBind.curVPE == tcBind.curVPE &&
260 tidTCBind.curTC == tcBind.curTC &&
261 tidTCStatus.da == 1 &&
263 tidTCStatus.a == 1) {
272 warn(
"%i: Deactivating Hardware Thread Context #%i",
275 }
else if (src_reg > 0) {
276 if (src_reg && !yield_mask != 0) {
278 vpeControl.excpt = 2;
280 fault = std::make_shared<ThreadFault>();
283 }
else if (src_reg != -2) {
285 VPEControlReg vpeControl =
288 if (vpeControl.ysi == 1 && tcStatus.dt == 1 ) {
289 vpeControl.excpt = 4;
290 fault = std::make_shared<ThreadFault>();
295 return src_reg & yield_mask;
312 status.ksu = tcStatus.tksu;
330 tcStatus.tksu =
status.ksu;