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

Method getExecBlock

src/ExecBlock/ExecBlockManager.cpp:175–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175const ExecBlock *ExecBlockManager::getExecBlock(rword address,
176 CPUMode cpumode) const {
177 QBDI_DEBUG("Looking up address {:x} ({})", address, cpumode);
178
179 size_t r = searchRegion(address);
180
181 if (r < regions.size() && regions[r].covered.contains(address)) {
182 const ExecRegion &region = regions[r];
183
184 // Attempting instCache resolution
185 const auto instLoc =
186 region.instCache.find(getExecRegionKey(address, cpumode));
187 if (instLoc != region.instCache.end()) {
188 QBDI_DEBUG("Found address 0x{:x} ({}) in ExecBlock 0x{:x}", address,
189 cpumode,
190 reinterpret_cast<uintptr_t>(
191 region.blocks[instLoc->second.blockIdx].get()));
192 return region.blocks[instLoc->second.blockIdx].get();
193 }
194 }
195 QBDI_DEBUG("Cache miss for address 0x{:x} ({})", address, cpumode);
196 return nullptr;
197}
198
199size_t
200ExecBlockManager::preWriteBasicBlock(const std::vector<Patch> &basicBlock) {

Callers 2

precacheBasicBlockMethod · 0.80
addInstrRuleMethod · 0.80

Calls 5

getExecRegionKeyFunction · 0.85
sizeMethod · 0.45
containsMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected