aligned memory allocation using VirtualAlloc2

This commit is contained in:
georgemoralis 2023-08-07 18:16:26 +03:00
parent 3cb89c4b5c
commit c412a5cb0b
3 changed files with 29 additions and 1 deletions

View file

@ -3,6 +3,10 @@
constexpr u64 SYSTEM_RESERVED = 0x800000000u;
constexpr u64 CODE_BASE_OFFSET = 0x100000000u;
constexpr u64 SYSTEM_MANAGED_MIN = 0x0000040000u;
constexpr u64 SYSTEM_MANAGED_MAX = 0x07FFFFBFFFu;
constexpr u64 USER_MIN = 0x1000000000u;
constexpr u64 USER_MAX = 0xFBFFFFFFFFu;
namespace VirtualMemory {
enum class MemoryMode : u32 {
@ -16,6 +20,7 @@ enum class MemoryMode : u32 {
ExecuteReadWrite = 7,
};
u64 memory_alloc(u64 address, u64 size, MemoryMode mode);
u64 memory_alloc_aligned(u64 address, u64 size, MemoryMode mode, u64 alignment);
bool memory_protect(u64 address, u64 size, MemoryMode mode, MemoryMode* old_mode);
bool memory_flush(u64 address, u64 size);
bool memory_patch(u64 vaddr, u64 value);