MCPcopy Create free account
hub / github.com/QBDI/QBDI / preWriteBasicBlock

Method preWriteBasicBlock

src/ExecBlock/ExecBlockManager.cpp:199–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199size_t
200ExecBlockManager::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 &region = 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
223void ExecBlockManager::writeBasicBlock(std::vector<Patch> &&basicBlock,
224 size_t patchEnd) {

Callers 1

handleNewBasicBlockMethod · 0.80

Calls 4

real_addr_tClass · 0.85
getExecRegionKeyFunction · 0.85
endAddressMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected