From 94e5fdc8eebb0be1fcaa821360230daa6f57af91 Mon Sep 17 00:00:00 2001 From: Exverge Date: Wed, 7 Aug 2024 18:19:22 -0400 Subject: [PATCH] MMU: Support alternative pagesizes --- src/util/MemMapper/MemMapperUnix.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/MemMapper/MemMapperUnix.cpp b/src/util/MemMapper/MemMapperUnix.cpp index 0ade291d43..6ac4a4b402 100644 --- a/src/util/MemMapper/MemMapperUnix.cpp +++ b/src/util/MemMapper/MemMapperUnix.cpp @@ -42,6 +42,12 @@ namespace MemMapper void* AllocateMemory(void* baseAddr, size_t size, PAGE_PERMISSION permissionFlags, bool fromReservation) { + uint64 page_size = sysconf(_SC_PAGESIZE); + if ((uint64) baseAddr % page_size != 0) + { + baseAddr = (void*) ((uint64)baseAddr & ~(page_size - 1)); + } + void* r; if(fromReservation) {