32-bit truncation of 64-bit values
Marcel Moolenaar
xcllnt at mac.com
Tue Feb 17 12:07:13 PST 2009
On Feb 17, 2009, at 11:01 AM, Peter Jeremy wrote:
> Having just tracked down an issue caused by a pointer-to-int
> truncation, it occurs to me that it might be "instructive" to change
> the amd64 memory map so that the botton 4GB of address-space was
> unmapped by default (ie code, data, bss, stack and mmap all default to
> above 4GB). I notice that the process space layout has already
> changed since 7.x was branched (at least the same executable runs on
> 7.x and SEGVs on -current due to a truncated pointer) and making
> this change might reveal more broken code.
Use ia64 :-)
On ia64 the upper 3 bits of the 64-bit pointer are used for
the region (there are 8 obviously). Region 0 is reserved for
32-bit processes, so all native processes have pointers that
can't fit in an int. This used to be a *very* big problem,
but it has improved significantly.
If you cannot run on ia64, at least try compiling on ia64.
The compiler for ia64 is more sensitive about these things
so you may be able to spot potential problems at compile
time.
FYI,
--
Marcel Moolenaar
xcllnt at mac.com
More information about the freebsd-amd64
mailing list