[A64] Add thread-safe atomics to A64Function
Also adds some bounds check to LookupFunction. Co-Authored-By: Reality <reality@xenios.jp>
This commit is contained in:
@@ -234,7 +234,15 @@ class CodeCacheBase : public CodeCache {
|
||||
}
|
||||
|
||||
GuestFunction* LookupFunction(uint64_t host_pc) override {
|
||||
uint32_t key = uint32_t(host_pc - kGeneratedCodeExecuteBase);
|
||||
if (generated_code_map_.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
const uint64_t code_base = execute_base_address();
|
||||
const uint64_t code_end = code_base + total_size();
|
||||
if (host_pc < code_base || host_pc >= code_end) {
|
||||
return nullptr;
|
||||
}
|
||||
uint32_t key = uint32_t(host_pc - code_base);
|
||||
void* fn_entry = std::bsearch(
|
||||
&key, generated_code_map_.data(), generated_code_map_.size(),
|
||||
sizeof(std::pair<uint32_t, Function*>),
|
||||
|
||||
Reference in New Issue
Block a user