Deleted Added
sdiff udiff text old ( 10474:799c8ee4ecba ) new ( 12104:edd63f9c6184 )
full compact
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;

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

108forkThread(TC *tc, Fault &fault, int Rd_bits, int Rs, int Rt)
109{
110 MVPConf0Reg mvpConf = tc->readMiscRegNoEffect(MISCREG_MVP_CONF0);
111 int num_threads = mvpConf.ptc + 1;
112
113 int success = 0;
114 for (ThreadID tid = 0; tid < num_threads && success == 0; tid++) {
115 TCBindReg tidTCBind =
116 tc->readRegOtherThread(MISCREG_TC_BIND + Misc_Reg_Base, tid);
117 TCBindReg tcBind = tc->readMiscRegNoEffect(MISCREG_TC_BIND);
118
119 if (tidTCBind.curVPE == tcBind.curVPE) {
120
121 TCStatusReg tidTCStatus =
122 tc->readRegOtherThread(MISCREG_TC_STATUS +
123 Misc_Reg_Base,tid);
124
125 TCHaltReg tidTCHalt =
126 tc->readRegOtherThread(MISCREG_TC_HALT + Misc_Reg_Base,tid);
127
128 if (tidTCStatus.da == 1 && tidTCHalt.h == 0 &&
129 tidTCStatus.a == 0 && success == 0) {
130
131 tc->setRegOtherThread(MISCREG_TC_RESTART +
132 Misc_Reg_Base, Rs, tid);
133 tc->setRegOtherThread(Rd_bits, Rt, tid);
134
135 StatusReg status = tc->readMiscReg(MISCREG_STATUS);
136 TCStatusReg tcStatus = tc->readMiscReg(MISCREG_TC_STATUS);
137
138 // Set Run-State to Running
139 tidTCStatus.rnst = 0;
140 // Set Delay-Slot to 0
141 tidTCStatus.tds = 0;
142 // Set Dirty TC to 1
143 tidTCStatus.dt = 1;
144 // Set Activated to 1
145 tidTCStatus.a = 1;
146 // Set status to previous thread's status
147 tidTCStatus.tksu = status.ksu;
148 // Set ASID to previous thread's state
149 tidTCStatus.asid = tcStatus.asid;
150
151 // Write Status Register
152 tc->setRegOtherThread(MISCREG_TC_STATUS + Misc_Reg_Base,
153 tidTCStatus, tid);
154
155 // Mark As Successful Fork
156 success = 1;
157 }
158 } else {
159 std::cerr << "Bad VPEs" << std::endl;
160 }

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

180
181 int ok = 0;
182
183 // Get Current VPE & TC numbers from calling thread
184 TCBindReg tcBind = tc->readMiscRegNoEffect(MISCREG_TC_BIND);
185
186 for (ThreadID tid = 0; tid < num_threads; tid++) {
187 TCStatusReg tidTCStatus =
188 tc->readRegOtherThread(MISCREG_TC_STATUS + Misc_Reg_Base,
189 tid);
190 TCHaltReg tidTCHalt =
191 tc->readRegOtherThread(MISCREG_TC_HALT + Misc_Reg_Base,
192 tid);
193 TCBindReg tidTCBind =
194 tc->readRegOtherThread(MISCREG_TC_BIND + Misc_Reg_Base,
195 tid);
196
197 if (tidTCBind.curVPE == tcBind.curVPE &&
198 tidTCBind.curTC == tcBind.curTC &&
199 tidTCStatus.da == 1 &&
200 tidTCHalt.h == 0 &&
201 tidTCStatus.a == 1) {
202 ok = 1;

--- 74 unchanged lines hidden ---