On 2023-02-15 14:40, w6b7rk5yu4mt25v3 via Cygwin wrote: > You misunderstood what I said. > > It's really just a naming conflict and a coincident. On the context of the source code (it's an interpreter), PAGE_SIZE is indeed JIT_PAGE_SIZE (not the system page size, but the page size defined internally by the interpreter). On Linux, the name doesn't conflict. On Cygwin, I found on limits.h and cygwin/limits.h already defined PAGE_SIZE so it caused a naming conflict: > > #define __PAGESIZE 65536 > #define PAGESIZE __PAGESIZE > #define PAGE_SIZE PAGESIZE > > But the problem not related to the naming conflict. If I renamed PAGE_SIZE to JIT_PAGE_SIZE, the problem is still there. The problem is Cygwin will not work with JIT_PAGE_SIZE = 4096. Please have a look at the code I posted. It will always error with "Unable to mprotect". The Linux man page for mprotect says that the address MUST be aligned (with the systems PAGE_SIZE). Your call to posix_memalign is NOT aligning the allocation with the systems PAGE_SIZE (65536), but with your PAGE_SIZE (4096). You need to allocate memory that is aligned with the systems PAGE_SIZE. Eg. if(posix_memalign((void**)&buffer, (PAGE_SIZE>JIT_PAGE_SIZE) ? PAGE_SIZE : JIT_PAGE_SIZE, available)) { ... }