| 197 | } |
| 198 | |
| 199 | size_t |
| 200 | ExecBlockManager::preWriteBasicBlock(const std::vector<Patch> &basicBlock) { |
| 201 | // prereserve the region in the cache and return the instruction that are |
| 202 | // already in the cache for this basicBlock |
| 203 | |
| 204 | // Locating an approriate cache region |
| 205 | const Range<rword> bbRange{basicBlock.front().metadata.address, |
| 206 | basicBlock.back().metadata.endAddress(), |
| 207 | real_addr_t()}; |
| 208 | size_t r = findRegion(bbRange); |
| 209 | ExecRegion ®ion = regions[r]; |
| 210 | |
| 211 | // detect cached instruction |
| 212 | size_t patchEnd = basicBlock.size(); |
| 213 | |
| 214 | while (patchEnd > 0 && region.instCache.count(getExecRegionKey( |
| 215 | basicBlock[patchEnd - 1].metadata.address, |
| 216 | basicBlock[patchEnd - 1].metadata.cpuMode)) != 0) { |
| 217 | patchEnd--; |
| 218 | } |
| 219 | |
| 220 | return patchEnd; |
| 221 | } |
| 222 | |
| 223 | void ExecBlockManager::writeBasicBlock(std::vector<Patch> &&basicBlock, |
| 224 | size_t patchEnd) { |
no test coverage detected