mirror of
https://github.com/FEX-Emu/FEX.git
synced 2024-11-23 14:40:14 +00:00
Minor cleanup in BlockCache
This commit is contained in:
parent
47d91e05f0
commit
c2e8c8d430
@ -21,7 +21,7 @@ BlockCache::BlockCache(FEXCore::Context::Context *CTX)
|
||||
// At 64GB of virtual memory this will allocate 128MB of virtual memory space
|
||||
PagePointer = reinterpret_cast<uintptr_t>(mmap(nullptr, ctx->Config.VirtualMemSize / 4096 * 8, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
|
||||
|
||||
// Allocate our memory backing our pageso
|
||||
// Allocate our memory backing our pages
|
||||
// We need 32KB per guest page (One pointer per byte)
|
||||
// XXX: We can drop down to 16KB if we store 4byte offsets from the code base
|
||||
// We currently limit to 128MB of real memory for caching for the total cache size.
|
||||
|
@ -21,14 +21,14 @@ public:
|
||||
Address >>= 12;
|
||||
|
||||
uintptr_t *Pointers = reinterpret_cast<uintptr_t*>(PagePointer);
|
||||
uint64_t PagePointer = Pointers[Address];
|
||||
if (!PagePointer) {
|
||||
uint64_t LocalPagePointer = Pointers[Address];
|
||||
if (!LocalPagePointer) {
|
||||
// Page for this code didn't even exist, nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
// Page exists, just set the offset to zero
|
||||
uintptr_t *BlockPointers = reinterpret_cast<uintptr_t*>(PagePointer);
|
||||
uintptr_t *BlockPointers = reinterpret_cast<uintptr_t*>(LocalPagePointer);
|
||||
BlockPointers[PageOffset] = 0;
|
||||
}
|
||||
|
||||
@ -61,6 +61,8 @@ public:
|
||||
|
||||
void HintUsedRange(uint64_t Address, uint64_t Size);
|
||||
|
||||
uintptr_t GetPagePointer() { return PagePointer; }
|
||||
|
||||
private:
|
||||
uintptr_t AllocateBackingForPage() {
|
||||
uintptr_t NewBase = AllocateOffset;
|
||||
|
Loading…
Reference in New Issue
Block a user