Skip to content

rts/m32: Accept any address within 4GB of rts text

Ben Gamari requested to merge wip/m32-fixes into master

This merge request is part of a series enabling ASLR support on Windows. See !7448 (closed) for an overview.


Previously m32 would assume that the program image was located near the start of the address space and therefore assume that it wanted pages in the bottom 4GB of address space. Instead we now check whether they are within 4GB of whereever the RTS is loaded.

This is necessary on Windows, which now tends to place the image in high memory. The eventual goal is to use m32 to allocate memory for linker sections on Windows.

In addition, I add some long-needed consistency checking logic in m32 so we know when things go sideways. Moreover, I implement logic to free allocations back to the free page pool instead of directly releasing them back to the OS and increase the size of the pool to 1MB (assuming 4kbyte pages).

Closes #20992 (closed).

Edited by Ben Gamari

Merge request reports