5 ms·
I wonder if we’ll ever have to make today’s software “64-bit clean”.
by saagarjha 7y ago
I wonder if we’ll ever have to make today’s software “64-bit clean”.
- jjtheblunt 7y agoIs that what Apple developers were given a several-year advanced notice of, and Catalina now requires such? I recall many people running non 64-bit clean apps complaining about Catalina, which I found curious.
- wtallis 7y agoApple dropped support for 32-bit applications. That's different from requiring 64-bit applications to stop abusing unused address bits—something that hasn't ever been commonplace for x86-64.
- zozbot234 7y agox86-64 actually requires that every memory access occur with a "canonical" address, specifically to ensure that everything will be "64-bit clean". That is, even though virtual address space in some cases may be limited to 48 or 56 bits the actual address has to be sign-extended to 64 bits, so everything is "clean". "Abusing" unused address bits is then just a matter of ensuring that any virtual addresses you use are restricted to the appropriate range. "x32" binaries do this in order to ensure that any pointers will fit within 32 bits even on x86-64, for example.
- wtallis 7y agoIt's also possible to use a few low address bits for non-address information if you're willing to accept coarser alignment on all pointers. It's not as easy since you have to mask off those lower bits before dereferencing, as opposed to simply relying on the MMU to ignore high bits you're using for tags or whatever.
- wvenable 7y agoThe address space of AMD64 was designed so that both the upper and lower spaces of the address are used when using less than 64 bus lines specifically to address this problem.
- saagarjha 7y agoRight, but a lot of high-performance code will tag the high bits of pointers anyways and apply a mask before using it for memory accesses.
- that_jojo 7y ago> and apply a mask before using it for memory accesses So it never goes onto the address bus. So it never causes an addressing issue. The 24-bit issue of the 68000 is fundamentally different. Those tagged 32-bit pointers were used directly, but truncated by the width of the actual physical interface so they never touched the outside world. ...until Motorola released CPUs with full 32-bit address pins on the package. Oops.
- saagarjha 7y agoIt's still going to break software, though. But if you're looking for a platform that lets you do this, look no further than ARMv8's TBI.
- jdsully 7y agoThat only ensures the programmer fixes the pointer before dereference. Tagged pointers that don’t make it to the bus are still a compatibility problem. It means malloc() can’t return an address overlapping the tagged bits.
- saagarjha 7y agomalloc usually gets more aligned with time, not less. The tagging we're talking about goes in the high bits of a pointer.