address_space: Fix windows placeholder mapping

This commit is contained in:
IndecisiveTurtle 2024-07-24 22:59:56 +03:00
parent 1d6a42c39a
commit 8bb6c0ddf0
2 changed files with 4 additions and 6 deletions

View File

@ -59,10 +59,10 @@ struct AddressSpace::Impl {
static constexpr size_t MaxReductions = 10;
size_t reduction = 0;
size_t virtual_size = SystemManagedSize + SystemReservedSize + UserSize;
for (u32 i = 0; i < MaxReductions; i++) {
req.LowestStartingAddress = reinterpret_cast<PVOID>(SYSTEM_MANAGED_MIN + reduction);
virtual_base = static_cast<u8*>(VirtualAlloc2(
process, NULL, SystemManagedSize + SystemReservedSize + UserSize - reduction,
process, NULL, virtual_size - reduction,
MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS, &param, 1));
if (virtual_base) {
break;
@ -92,9 +92,7 @@ struct AddressSpace::Impl {
const uintptr_t system_managed_addr = reinterpret_cast<uintptr_t>(system_managed_base);
const uintptr_t system_reserved_addr = reinterpret_cast<uintptr_t>(system_reserved_base);
const uintptr_t user_addr = reinterpret_cast<uintptr_t>(user_base);
placeholders.insert({system_managed_addr, system_managed_addr + system_managed_size});
placeholders.insert({system_reserved_addr, system_reserved_addr + system_reserved_size});
placeholders.insert({user_addr, user_addr + user_size});
placeholders.insert({system_managed_addr, virtual_size - reduction});
// Allocate backing file that represents the total physical memory.
backing_handle =

View File

@ -22,7 +22,7 @@ constexpr VAddr CODE_BASE_OFFSET = 0x100000000ULL;
constexpr VAddr SYSTEM_MANAGED_MIN = 0x00000400000ULL;
constexpr VAddr SYSTEM_MANAGED_MAX = 0x07FFFFBFFFULL;
constexpr VAddr SYSTEM_RESERVED_MIN = 0x800000000ULL;
constexpr VAddr SYSTEM_RESERVED_MIN = 0x07FFFFC000ULL;
#ifdef __APPLE__
// Can only comfortably reserve the first 0x7C0000000 of system reserved space.
constexpr VAddr SYSTEM_RESERVED_MAX = 0xFBFFFFFFFULL;