John Reiser jreiser@BitWagon.com writes:
I call mmap(0,,,MAP_FIXED,,) often, and I get what I expect [*], namely a ["new"] mapping at 0, replacing any previous mapping at 0, regardless of the state of existing mappings. See testcase below.
Yes, the replacing existing mappings is precisely the problem. That's why we reserve the memory, and that's why if it wasn't reserved we can't blindly replace it, because we don't know what's in there. MAP_FIXED is used a few lines below once we know we have the area we want.
_I_ don't care about those features of DOS and BIOS interface which require fixed addresses. What I want is that (* NULL) and (NULL->member) always give SIGSEGV (at least for structures <= 64KB in size.) This is a property that helps to make general apps more portable between Win32 and wine+Linux.
That's already the case, NULL pointer accesses are always caught, until you run some DOS code. There's nothing to fix in there, the only thing to do is to let the preloader do its job.