mt.hh (7720:65d338a8dba4) mt.hh (7823:dac01f14f20f)
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;

--- 67 unchanged lines hidden (view full) ---

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 PCState pc = tc->pcState();
81 tc->setMiscReg(MISCREG_TC_RESTART, pc.npc());
82
83 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x",
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;

--- 67 unchanged lines hidden (view full) ---

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 PCState pc = tc->pcState();
81 tc->setMiscReg(MISCREG_TC_RESTART, pc.npc());
82
83 warn("%i: Halting thread %i in %s @ PC %x, setting restart PC to %x",
84 curTick, tc->threadId(), tc->getCpuPtr()->name(),
84 curTick(), tc->threadId(), tc->getCpuPtr()->name(),
85 pc.pc(), pc.npc());
86 }
87}
88
89template <class TC>
90inline void
91restoreThread(TC *tc)
92{
93 if (tc->status() != TC::Active) {
94 // Restore PC from TCRestart
95 Addr restartPC = tc->readMiscRegNoEffect(MISCREG_TC_RESTART);
96
97 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY
98 tc->pcState(restartPC);
99 tc->activate(0);
100
101 warn("%i: Restoring thread %i in %s @ PC %x",
85 pc.pc(), pc.npc());
86 }
87}
88
89template <class TC>
90inline void
91restoreThread(TC *tc)
92{
93 if (tc->status() != TC::Active) {
94 // Restore PC from TCRestart
95 Addr restartPC = tc->readMiscRegNoEffect(MISCREG_TC_RESTART);
96
97 // TODO: SET PC WITH AN EVENT INSTEAD OF INSTANTANEOUSLY
98 tc->pcState(restartPC);
99 tc->activate(0);
100
101 warn("%i: Restoring thread %i in %s @ PC %x",
102 curTick, tc->threadId(), tc->getCpuPtr()->name(), restartPC);
102 curTick(), tc->threadId(), tc->getCpuPtr()->name(), restartPC);
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);

--- 92 unchanged lines hidden (view full) ---

203 }
204 }
205
206 if (ok == 1) {
207 TCStatusReg tcStatus = tc->readMiscRegNoEffect(MISCREG_TC_STATUS);
208 tcStatus.a = 0;
209 tc->setMiscReg(MISCREG_TC_STATUS, tcStatus);
210 warn("%i: Deactivating Hardware Thread Context #%i",
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);

--- 92 unchanged lines hidden (view full) ---

203 }
204 }
205
206 if (ok == 1) {
207 TCStatusReg tcStatus = tc->readMiscRegNoEffect(MISCREG_TC_STATUS);
208 tcStatus.a = 0;
209 tc->setMiscReg(MISCREG_TC_STATUS, tcStatus);
210 warn("%i: Deactivating Hardware Thread Context #%i",
211 curTick, tc->threadId());
211 curTick(), tc->threadId());
212 }
213 } else if (src_reg > 0) {
214 if (src_reg && !yield_mask != 0) {
215 VPEControlReg vpeControl = tc->readMiscReg(MISCREG_VPE_CONTROL);
216 vpeControl.excpt = 2;
217 tc->setMiscReg(MISCREG_VPE_CONTROL, vpeControl);
218 fault = new ThreadFault();
219 } else {

--- 57 unchanged lines hidden ---
212 }
213 } else if (src_reg > 0) {
214 if (src_reg && !yield_mask != 0) {
215 VPEControlReg vpeControl = tc->readMiscReg(MISCREG_VPE_CONTROL);
216 vpeControl.excpt = 2;
217 tc->setMiscReg(MISCREG_VPE_CONTROL, vpeControl);
218 fault = new ThreadFault();
219 } else {

--- 57 unchanged lines hidden ---