physical.hh (3091:dba513d68c16) | physical.hh (3170:37fd1e73f836) |
---|---|
1/* 2 * Copyright (c) 2001-2005 The Regents of The University of Michigan 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; --- 64 unchanged lines hidden (view full) --- 73 74 75 private: 76 // prevent copying of a MainMemory object 77 PhysicalMemory(const PhysicalMemory &specmem); 78 const PhysicalMemory &operator=(const PhysicalMemory &specmem); 79 80 protected: | 1/* 2 * Copyright (c) 2001-2005 The Regents of The University of Michigan 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; --- 64 unchanged lines hidden (view full) --- 73 74 75 private: 76 // prevent copying of a MainMemory object 77 PhysicalMemory(const PhysicalMemory &specmem); 78 const PhysicalMemory &operator=(const PhysicalMemory &specmem); 79 80 protected: |
81 82 class LockedAddr { 83 public: 84 // on alpha, minimum LL/SC granularity is 16 bytes, so lower 85 // bits need to masked off. 86 static const Addr Addr_Mask = 0xf; 87 88 static Addr mask(Addr paddr) { return (paddr & ~Addr_Mask); } 89 90 Addr addr; // locked address 91 int cpuNum; // locking CPU 92 int threadNum; // locking thread ID within CPU 93 94 // check for matching execution context 95 bool matchesContext(Request *req) 96 { 97 return (cpuNum == req->getCpuNum() && 98 threadNum == req->getThreadNum()); 99 } 100 101 LockedAddr(Request *req) 102 : addr(mask(req->getPaddr())), 103 cpuNum(req->getCpuNum()), 104 threadNum(req->getThreadNum()) 105 { 106 } 107 }; 108 109 std::list<LockedAddr> lockedAddrList; 110 111 // helper function for checkLockedAddrs(): we really want to 112 // inline a quick check for an empty locked addr list (hopefully 113 // the common case), and do the full list search (if necessary) in 114 // this out-of-line function 115 bool checkLockedAddrList(Request *req); 116 117 // Record the address of a load-locked operation so that we can 118 // clear the execution context's lock flag if a matching store is 119 // performed 120 void trackLoadLocked(Request *req); 121 122 // Compare a store address with any locked addresses so we can 123 // clear the lock flag appropriately. Return value set to 'false' 124 // if store operation should be suppressed (because it was a 125 // conditional store and the address was no longer locked by the 126 // requesting execution context), 'true' otherwise. Note that 127 // this method must be called on *all* stores since even 128 // non-conditional stores must clear any matching lock addresses. 129 bool writeOK(Request *req) { 130 if (lockedAddrList.empty()) { 131 // no locked addrs: nothing to check, store_conditional fails 132 bool isLocked = req->isLocked(); 133 if (isLocked) { 134 req->setScResult(0); 135 } 136 return !isLocked; // only do write if not an sc 137 } else { 138 // iterate over list... 139 return checkLockedAddrList(req); 140 } 141 } 142 |
|
81 uint8_t *pmemAddr; 82 MemoryPort *port; 83 int pagePtr; 84 Tick lat; 85 86 public: 87 Addr new_page(); 88 uint64_t size() { return params()->addrRange.size(); } --- 35 unchanged lines hidden --- | 143 uint8_t *pmemAddr; 144 MemoryPort *port; 145 int pagePtr; 146 Tick lat; 147 148 public: 149 Addr new_page(); 150 uint64_t size() { return params()->addrRange.size(); } --- 35 unchanged lines hidden --- |