mt.hh (5561:eb5664be6075) | mt.hh (5715:e8c1d4e669a7) |
---|---|
1/* 2 * Copyright (c) 2007 MIPS Technologies, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 64 unchanged lines hidden (view full) --- 73{ 74 if (tc->status() == TC::Active) { 75 tc->halt(); 76 77 // Save last known PC in TCRestart 78 // @TODO: Needs to check if this is a branch and if so, take previous instruction 79 tc->setMiscReg(TCRestart, tc->readNextPC()); 80 | 1/* 2 * Copyright (c) 2007 MIPS Technologies, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 64 unchanged lines hidden (view full) --- 73{ 74 if (tc->status() == TC::Active) { 75 tc->halt(); 76 77 // Save last known PC in TCRestart 78 // @TODO: Needs to check if this is a branch and if so, take previous instruction 79 tc->setMiscReg(TCRestart, tc->readNextPC()); 80 |
81 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x", curTick, tc->getThreadNum(), tc->getCpuPtr()->name(), | 81 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x", curTick, tc->threadId(), tc->getCpuPtr()->name(), |
82 tc->readPC(), tc->readNextPC()); 83 } 84} 85 86template <class TC> 87inline void 88restoreThread(TC *tc) 89{ 90 if (tc->status() != TC::Active) { 91 // Restore PC from TCRestart 92 IntReg pc = tc->readMiscRegNoEffect(TCRestart); 93 94 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY 95 // tc->setPCEvent(pc, pc + 4, pc + 8); 96 tc->setPC(pc); 97 tc->setNextPC(pc + 4); 98 tc->setNextNPC(pc + 8); 99 tc->activate(0); 100 | 82 tc->readPC(), tc->readNextPC()); 83 } 84} 85 86template <class TC> 87inline void 88restoreThread(TC *tc) 89{ 90 if (tc->status() != TC::Active) { 91 // Restore PC from TCRestart 92 IntReg pc = tc->readMiscRegNoEffect(TCRestart); 93 94 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY 95 // tc->setPCEvent(pc, pc + 4, pc + 8); 96 tc->setPC(pc); 97 tc->setNextPC(pc + 4); 98 tc->setNextNPC(pc + 8); 99 tc->activate(0); 100 |
101 warn("%i: Restoring thread %i in %s @ PC %x", curTick, tc->getThreadNum(), tc->getCpuPtr()->name(), | 101 warn("%i: Restoring thread %i in %s @ PC %x", curTick, tc->threadId(), tc->getCpuPtr()->name(), |
102 tc->readPC()); 103 } 104} 105 106template <class TC> 107void 108forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt) 109{ --- 102 unchanged lines hidden (view full) --- 212 tid_tcstatus_a == 1) { 213 ok = 1; 214 } 215 } 216 217 if (ok == 1) { 218 unsigned tcstatus = tc->readMiscRegNoEffect(TCStatus); 219 tc->setMiscReg(TCStatus, insertBits(tcstatus, TCS_A, TCS_A, 0)); | 102 tc->readPC()); 103 } 104} 105 106template <class TC> 107void 108forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt) 109{ --- 102 unchanged lines hidden (view full) --- 212 tid_tcstatus_a == 1) { 213 ok = 1; 214 } 215 } 216 217 if (ok == 1) { 218 unsigned tcstatus = tc->readMiscRegNoEffect(TCStatus); 219 tc->setMiscReg(TCStatus, insertBits(tcstatus, TCS_A, TCS_A, 0)); |
220 warn("%i: Deactivating Hardware Thread Context #%i", curTick, tc->getThreadNum()); | 220 warn("%i: Deactivating Hardware Thread Context #%i", curTick, tc->threadId()); |
221 } 222 } else if (src_reg > 0) { 223 if (src_reg && !yield_mask != 0) { 224 unsigned vpe_control = tc->readMiscReg(VPEControl); 225 tc->setMiscReg(VPEControl, insertBits(vpe_control, VPEC_EXCPT_HI, VPEC_EXCPT_LO, 2)); 226 fault = new ThreadFault(); 227 } else { 228 //tc->setThreadRescheduleCondition(src_reg & yield_mask); --- 4 unchanged lines hidden (view full) --- 233 unsigned tcstatus_dt = bits(tcstatus, TCS_DT); 234 unsigned vpe_control_ysi = bits(vpe_control, VPEC_YSI); 235 236 if (vpe_control_ysi == 1 && tcstatus_dt == 1 ) { 237 tc->setMiscReg(VPEControl, insertBits(vpe_control, VPEC_EXCPT_HI, VPEC_EXCPT_LO, 4)); 238 fault = new ThreadFault(); 239 } else { 240 //tc->ScheduleOtherThreads(); | 221 } 222 } else if (src_reg > 0) { 223 if (src_reg && !yield_mask != 0) { 224 unsigned vpe_control = tc->readMiscReg(VPEControl); 225 tc->setMiscReg(VPEControl, insertBits(vpe_control, VPEC_EXCPT_HI, VPEC_EXCPT_LO, 2)); 226 fault = new ThreadFault(); 227 } else { 228 //tc->setThreadRescheduleCondition(src_reg & yield_mask); --- 4 unchanged lines hidden (view full) --- 233 unsigned tcstatus_dt = bits(tcstatus, TCS_DT); 234 unsigned vpe_control_ysi = bits(vpe_control, VPEC_YSI); 235 236 if (vpe_control_ysi == 1 && tcstatus_dt == 1 ) { 237 tc->setMiscReg(VPEControl, insertBits(vpe_control, VPEC_EXCPT_HI, VPEC_EXCPT_LO, 4)); 238 fault = new ThreadFault(); 239 } else { 240 //tc->ScheduleOtherThreads(); |
241 //std::cerr << "T" << tc->getThreadNum() << "YIELD: Schedule Other Threads.\n" << std::endl; | 241 //std::cerr << "T" << tc->threadId() << "YIELD: Schedule Other Threads.\n" << std::endl; |
242 //tc->suspend(); 243 // Save last known PC in TCRestart 244 // @TODO: Needs to check if this is a branch and if so, take previous instruction 245 //tc->setMiscRegWithEffect(TCRestart, tc->readNextPC()); 246 } 247 } 248 249 return src_reg & yield_mask; --- 53 unchanged lines hidden --- | 242 //tc->suspend(); 243 // Save last known PC in TCRestart 244 // @TODO: Needs to check if this is a branch and if so, take previous instruction 245 //tc->setMiscRegWithEffect(TCRestart, tc->readNextPC()); 246 } 247 } 248 249 return src_reg & yield_mask; --- 53 unchanged lines hidden --- |