From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Eckhardt To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19495.1452037046.1@LUNACY.UGRAD.CS.CMU.EDU> Date: Tue, 5 Jan 2016 18:37:26 -0500 Message-ID: <19496.1452037046@LUNACY.UGRAD.CS.CMU.EDU> Subject: Re: [9fans] subtracting pointers on amd64 6c Topicbox-Message-UUID: 7eacd3c4-ead9-11e9-9d60-3106f5b1d025 > for instance, although the range of subtraction is theoretically > -2^64+1 to 2^64-1, amd64 can only address 48 bits of memory > (currently) despite using 64 bits to represent addresses. as long > as virtual addresses in the system aren't exabytes apart, this > shouldn't result in undefined behavior in practice. Unfortunately AMD64 VM is a hack. The 2^48 addressable bytes aren't contiguous! 2^47 of them go up from 0 and the other 2^47 of them go down from (64-bit) -1. See: https://en.wikipedia.org/wiki/X86-64#Canonical_form_addresses Dave Eckhardt