mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-13 00:00:45 +02:00
arm64ec: Fixes some FEX allocations that were missing TOP_DOWN
We were accidentally allocating some things without this flag and it was causing us to dump memory in to the lower 32-bits on arm64ec. This was causing the game [Below](https://store.steampowered.com/app/250680/BELOW/) to run out of memory to allocate for its LUA JIT and causes it to crash.
This commit is contained in:
2 files changed
+5
-4
No files matched your search
@@ -619,7 +619,7 @@ NTSTATUS ProcessInit() {
|
||||
|
||||
CPUFeatures.emplace(*CTX);
|
||||
|
||||
X64ReturnInstr = ::VirtualAlloc(nullptr, FEXCore::Utils::FEX_PAGE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||
X64ReturnInstr = ::VirtualAlloc(nullptr, FEXCore::Utils::FEX_PAGE_SIZE, MEM_COMMIT | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE);
|
||||
InvalidationTracker->HandleMemoryProtectionNotification(reinterpret_cast<uint64_t>(X64ReturnInstr), FEXCore::Utils::FEX_PAGE_SIZE,
|
||||
PAGE_EXECUTE_READ);
|
||||
*reinterpret_cast<uint8_t*>(X64ReturnInstr) = 0xc3;
|
||||
@@ -919,7 +919,8 @@ NTSTATUS ThreadInit() {
|
||||
const auto CPUArea = GetCPUArea();
|
||||
|
||||
static constexpr size_t EmulatorStackSize = 0x40000;
|
||||
const uint64_t EmulatorStack = reinterpret_cast<uint64_t>(::VirtualAlloc(nullptr, EmulatorStackSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE));
|
||||
const uint64_t EmulatorStack =
|
||||
reinterpret_cast<uint64_t>(::VirtualAlloc(nullptr, EmulatorStackSize, MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN, PAGE_READWRITE));
|
||||
CPUArea.EmulatorStackLimit() = EmulatorStack;
|
||||
CPUArea.EmulatorStackBase() = EmulatorStack + EmulatorStackSize;
|
||||
|
||||
|
||||
Reference in new issue
Block a user