abstract_mem.cc (9053:9cad1c26c3b3) | abstract_mem.cc (9080:753fc1c3618c) |
---|---|
1/* 2 * Copyright (c) 2010-2012 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 --- 256 unchanged lines hidden (view full) --- 265{ 266 Request *req = pkt->req; 267 Addr paddr = LockedAddr::mask(req->getPaddr()); 268 bool isLLSC = pkt->isLLSC(); 269 270 // Initialize return value. Non-conditional stores always 271 // succeed. Assume conditional stores will fail until proven 272 // otherwise. | 1/* 2 * Copyright (c) 2010-2012 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 --- 256 unchanged lines hidden (view full) --- 265{ 266 Request *req = pkt->req; 267 Addr paddr = LockedAddr::mask(req->getPaddr()); 268 bool isLLSC = pkt->isLLSC(); 269 270 // Initialize return value. Non-conditional stores always 271 // succeed. Assume conditional stores will fail until proven 272 // otherwise. |
273 bool success = !isLLSC; | 273 bool allowStore = !isLLSC; |
274 | 274 |
275 // Iterate over list. Note that there could be multiple matching 276 // records, as more than one context could have done a load locked 277 // to this location. | 275 // Iterate over list. Note that there could be multiple matching records, 276 // as more than one context could have done a load locked to this location. 277 // Only remove records when we succeed in finding a record for (xc, addr); 278 // then, remove all records with this address. Failed store-conditionals do 279 // not blow unrelated reservations. |
278 list<LockedAddr>::iterator i = lockedAddrList.begin(); 279 | 280 list<LockedAddr>::iterator i = lockedAddrList.begin(); 281 |
280 while (i != lockedAddrList.end()) { 281 282 if (i->addr == paddr) { 283 // we have a matching address 284 285 if (isLLSC && i->matchesContext(req)) { 286 // it's a store conditional, and as far as the memory 287 // system can tell, the requesting context's lock is 288 // still valid. | 282 if (isLLSC) { 283 while (i != lockedAddrList.end()) { 284 if (i->addr == paddr && i->matchesContext(req)) { 285 // it's a store conditional, and as far as the memory system can 286 // tell, the requesting context's lock is still valid. |
289 DPRINTF(LLSC, "StCond success: context %d addr %#x\n", 290 req->contextId(), paddr); | 287 DPRINTF(LLSC, "StCond success: context %d addr %#x\n", 288 req->contextId(), paddr); |
291 success = true; | 289 allowStore = true; 290 break; |
292 } | 291 } |
293 294 // Get rid of our record of this lock and advance to next 295 DPRINTF(LLSC, "Erasing lock record: context %d addr %#x\n", 296 i->contextId, paddr); 297 i = lockedAddrList.erase(i); | 292 // If we didn't find a match, keep searching! Someone else may well 293 // have a reservation on this line here but we may find ours in just 294 // a little while. 295 i++; |
298 } | 296 } |
299 else { 300 // no match: advance to next record 301 ++i; | 297 req->setExtraData(allowStore ? 1 : 0); 298 } 299 // LLSCs that succeeded AND non-LLSC stores both fall into here: 300 if (allowStore) { 301 // We write address paddr. However, there may be several entries with a 302 // reservation on this address (for other contextIds) and they must all 303 // be removed. 304 i = lockedAddrList.begin(); 305 while (i != lockedAddrList.end()) { 306 if (i->addr == paddr) { 307 DPRINTF(LLSC, "Erasing lock record: context %d addr %#x\n", 308 i->contextId, paddr); 309 i = lockedAddrList.erase(i); 310 } else { 311 i++; 312 } |
302 } 303 } 304 | 313 } 314 } 315 |
305 if (isLLSC) { 306 req->setExtraData(success ? 1 : 0); 307 } 308 309 return success; | 316 return allowStore; |
310} 311 312 313#if TRACING_ON 314 315#define CASE(A, T) \ 316 case sizeof(T): \ 317 DPRINTF(MemoryAccess,"%s of size %i on address 0x%x data 0x%x\n", \ --- 272 unchanged lines hidden --- | 317} 318 319 320#if TRACING_ON 321 322#define CASE(A, T) \ 323 case sizeof(T): \ 324 DPRINTF(MemoryAccess,"%s of size %i on address 0x%x data 0x%x\n", \ --- 272 unchanged lines hidden --- |