Merge pull request #5539 from Sonicadvance1/162

arm64ec: Fixes some FEX allocations that were missing TOP_DOWN
This commit is contained in:
Ryan Houdek authored and GitHub committed 2026-05-29 16:49:14 -07:00
commit 7ff2069e60
3 files changed
+6 -5

No files matched your search

+3 -2
View File
@@ -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;
+2 -2
View File
@@ -22,8 +22,8 @@ CallRetStackInfo GetInfoThread(FEXCore::Core::InternalThreadState* Thread) {
void InitializeThread(FEXCore::Core::InternalThreadState* Thread) {
// Allocate the call-ret stack with guard pages on both sides
const void* CallRetStackAlloc = ::VirtualAlloc(
nullptr, FEXCore::Core::InternalThreadState::CALLRET_STACK_SIZE + 2 * FEXCore::Utils::FEX_PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
const void* CallRetStackAlloc = ::VirtualAlloc(nullptr, FEXCore::Core::InternalThreadState::CALLRET_STACK_SIZE + 2 * FEXCore::Utils::FEX_PAGE_SIZE,
MEM_RESERVE | MEM_TOP_DOWN, PAGE_NOACCESS);
FEXCore::Allocator::VirtualName("FEXMem_CallRetStacks", CallRetStackAlloc,
FEXCore::Core::InternalThreadState::CALLRET_STACK_SIZE + 2 * FEXCore::Utils::FEX_PAGE_SIZE);