
You appear to be assuming that the OS guarantees that it uses the lowest available virtual addresses. Would you please provide a link to the documentation? I was under the impression that the 8TB limit is merely a practical one since this was the maximum hardware specification available for testing.
The OS isn't floating around in virtual memory space! The layout is strict and doesn't change and of it's precisely and correctly documented in the driver developer's manual. There is some randomness added for security, but the whole user space process is very strictly bounded. That's true for all OSes I've programmed drivers for, which is, I agree far from being exhaustive. For Windows x86 anything between 0x0 and 0x7fffffff is for user mode, with the first pages made inaccessible to help debug null pointers errors. I also remember that there's some clutter near the 2GB boundary (not sure about it, look it up if you're interested). Of course that goes up a bit if you extend the user space to 3GB. For Windows 64 running on IA64 anything between 0 and 0x6fbfffeffff is for user mode. It goes up to 0x7fffffeffff for AMD64. Again the first pages are inaccessible for the same reasons. Must something like a 32 kb locked range.
I prefer using the least-significant bits when the alignment allows such an optimisation. This seems less error-prone and better documented as a safe idiom.
I believe in freedom. -- EA __________ Information from ESET NOD32 Antivirus, version of virus signature database 4403 (20090907) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com