table_walker.cc (10037:5cac77888310) | table_walker.cc (10109:b58c5c5854de) |
---|---|
1/* 2 * Copyright (c) 2010, 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 146 unchanged lines hidden (view full) --- 155 156Fault 157TableWalker::walk(RequestPtr _req, ThreadContext *_tc, uint16_t _asid, 158 uint8_t _vmid, bool _isHyp, TLB::Mode _mode, 159 TLB::Translation *_trans, bool _timing, bool _functional, 160 bool secure, TLB::ArmTranslationType tranType) 161{ 162 assert(!(_functional && _timing)); | 1/* 2 * Copyright (c) 2010, 2012-2013 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 146 unchanged lines hidden (view full) --- 155 156Fault 157TableWalker::walk(RequestPtr _req, ThreadContext *_tc, uint16_t _asid, 158 uint8_t _vmid, bool _isHyp, TLB::Mode _mode, 159 TLB::Translation *_trans, bool _timing, bool _functional, 160 bool secure, TLB::ArmTranslationType tranType) 161{ 162 assert(!(_functional && _timing)); |
163 WalkerState *savedCurrState = NULL; |
|
163 | 164 |
164 if (!currState) { | 165 if (!currState && !_functional) { |
165 // For atomic mode, a new WalkerState instance should be only created 166 // once per TLB. For timing mode, a new instance is generated for every 167 // TLB miss. 168 DPRINTF(TLBVerbose, "creating new instance of WalkerState\n"); 169 170 currState = new WalkerState(); 171 currState->tableWalker = this; | 166 // For atomic mode, a new WalkerState instance should be only created 167 // once per TLB. For timing mode, a new instance is generated for every 168 // TLB miss. 169 DPRINTF(TLBVerbose, "creating new instance of WalkerState\n"); 170 171 currState = new WalkerState(); 172 currState->tableWalker = this; |
173 } else if (_functional) { 174 // If we are mixing functional mode with timing (or even 175 // atomic), we need to to be careful and clean up after 176 // ourselves to not risk getting into an inconsistent state. 177 DPRINTF(TLBVerbose, "creating functional instance of WalkerState\n"); 178 savedCurrState = currState; 179 currState = new WalkerState(); 180 currState->tableWalker = this; |
|
172 } else if (_timing) { 173 // This is a translation that was completed and then faulted again 174 // because some underlying parameters that affect the translation 175 // changed out from under us (e.g. asid). It will either be a 176 // misprediction, in which case nothing will happen or we'll use 177 // this fault to re-execute the faulting instruction which should clean 178 // up everything. 179 if (currState->vaddr_tainted == _req->getVaddr()) { --- 79 unchanged lines hidden (view full) --- 259 currState->secureLookup = currState->isSecure; 260 currState->rwTable = true; 261 currState->userTable = true; 262 currState->xnTable = false; 263 currState->pxnTable = false; 264 } 265 266 if (!currState->timing) { | 181 } else if (_timing) { 182 // This is a translation that was completed and then faulted again 183 // because some underlying parameters that affect the translation 184 // changed out from under us (e.g. asid). It will either be a 185 // misprediction, in which case nothing will happen or we'll use 186 // this fault to re-execute the faulting instruction which should clean 187 // up everything. 188 if (currState->vaddr_tainted == _req->getVaddr()) { --- 79 unchanged lines hidden (view full) --- 268 currState->secureLookup = currState->isSecure; 269 currState->rwTable = true; 270 currState->userTable = true; 271 currState->xnTable = false; 272 currState->pxnTable = false; 273 } 274 275 if (!currState->timing) { |
276 Fault fault = NoFault; |
|
267 if (currState->aarch64) | 277 if (currState->aarch64) |
268 return processWalkAArch64(); | 278 fault = processWalkAArch64(); |
269 else if (long_desc_format) | 279 else if (long_desc_format) |
270 return processWalkLPAE(); | 280 fault = processWalkLPAE(); |
271 else | 281 else |
272 return processWalk(); | 282 fault = processWalk(); 283 284 // If this was a functional non-timing access restore state to 285 // how we found it. 286 if (currState->functional) { 287 delete currState; 288 currState = savedCurrState; 289 } 290 return fault; |
273 } 274 275 if (pending || pendingQueue.size()) { 276 pendingQueue.push_back(currState); 277 currState = NULL; 278 } else { 279 pending = true; 280 if (currState->aarch64) --- 1665 unchanged lines hidden --- | 291 } 292 293 if (pending || pendingQueue.size()) { 294 pendingQueue.push_back(currState); 295 currState = NULL; 296 } else { 297 pending = true; 298 if (currState->aarch64) --- 1665 unchanged lines hidden --- |