Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    Counterquestion: Why should virtual and physical addresses have the same size? The 8-bit computers in the 1980s using more than 48k memory also used "memory banking" which more or less means that there were more physical address bits than virtual ones. Commented Oct 1, 2017 at 5:47
  • 4
    @MartinRosenau I'm sorry you think my question implies that I think virtual and physical addresses should have the same size. My intention was just to ask why the difference in that particular case. I'm finding something like that you wrote in your comment, but related to "the modern PC" and 64-bit addressing. Commented Oct 1, 2017 at 6:10
  • 2
    Fun fact: If you want to use the high 16 for tagged pointers, you could shl rax,16 / sar rax,16 before using to redo the sign extension. (Or better, have your program only allocate tagged pointers in the low half of the canonical range, so you can just use and or BMI2 andn to make addresses canonical.) Or even better, allocate only in the low 4G of virtual address space, so you can use address-size (0x67) prefixes to ignore high garbage, or use 32-bit operand size when manipulating pointers to zero-extend them for free. Commented Oct 1, 2017 at 15:21
  • I guess that if/when hardware support for wider virtual addresses happens, there might be a mmap(MAP_48BIT) flag equivalent to the current mmap(MAP_32BIT) so programs that want to use the high 16 for their own purposes can keep doing so. Using only the high byte might be safer for longer, since extending virtual far beyond physical is less likely, even with memory-mapped non-volatile storage becoming a thing. (e.g. faster-than-flash on DIMMs.) Commented Oct 1, 2017 at 15:31