I tried to use the following code to get a virtual address within 4GB memory space
int size = 4 * 1024;
int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT;
void* addr = mmap(NULL,
size,
PROT_READ | PROT_WRITE,
flags,
-1,
0);
I also tried MAP_FIXED and pass an address for the first argument of mmap. However neither of them can get what I want.
Is there a way to get a virtual memory address within 4GB on arm64 on MacOS?
Selecting any option will automatically load the page