mt.hh (6424:58e3056d918e) | mt.hh (7720:65d338a8dba4) |
---|---|
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; --- 63 unchanged lines hidden (view full) --- 72haltThread(TC *tc) 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, 79 // take previous instruction | 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; --- 63 unchanged lines hidden (view full) --- 72haltThread(TC *tc) 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, 79 // take previous instruction |
80 tc->setMiscReg(MISCREG_TC_RESTART, tc->readNextPC()); | 80 PCState pc = tc->pcState(); 81 tc->setMiscReg(MISCREG_TC_RESTART, pc.npc()); |
81 82 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x", 83 curTick, tc->threadId(), tc->getCpuPtr()->name(), | 82 83 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x", 84 curTick, tc->threadId(), tc->getCpuPtr()->name(), |
84 tc->readPC(), tc->readNextPC()); | 85 pc.pc(), pc.npc()); |
85 } 86} 87 88template <class TC> 89inline void 90restoreThread(TC *tc) 91{ 92 if (tc->status() != TC::Active) { 93 // Restore PC from TCRestart | 86 } 87} 88 89template <class TC> 90inline void 91restoreThread(TC *tc) 92{ 93 if (tc->status() != TC::Active) { 94 // Restore PC from TCRestart |
94 IntReg pc = tc->readMiscRegNoEffect(MISCREG_TC_RESTART); | 95 Addr restartPC = tc->readMiscRegNoEffect(MISCREG_TC_RESTART); |
95 96 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY | 96 97 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY |
97 tc->setPC(pc); 98 tc->setNextPC(pc + 4); 99 tc->setNextNPC(pc + 8); | 98 tc->pcState(restartPC); |
100 tc->activate(0); 101 102 warn("%i: Restoring thread %i in %s @ PC %x", | 99 tc->activate(0); 100 101 warn("%i: Restoring thread %i in %s @ PC %x", |
103 curTick, tc->threadId(), tc->getCpuPtr()->name(), 104 tc->readPC()); | 102 curTick, tc->threadId(), tc->getCpuPtr()->name(), restartPC); |
105 } 106} 107 108template <class TC> 109void 110forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt) 111{ 112 MVPConf0Reg mvpConf = tc->readMiscRegNoEffect(MISCREG_MVP_CONF0); --- 166 unchanged lines hidden --- | 103 } 104} 105 106template <class TC> 107void 108forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt) 109{ 110 MVPConf0Reg mvpConf = tc->readMiscRegNoEffect(MISCREG_MVP_CONF0); --- 166 unchanged lines hidden --- |