According to my system’s cpuinfo file, each processor in my system has a 39 bit physical address size and a 48 bit virtual address size.
My system has 16 GB of ram, so the 39 bit physical address size makes sense to me as 39 bits is more than enough to address 16GB of ram.
However, the 48 bit virtual address size confuses me. I always believed that I could write C programs that, from the source code’s perspective, could address 2^64 bytes of virtual memory (as a pointer on my system is 8 bytes long according to size(void *)). However, cpuinfo is telling me that I only have 2^48 bytes of virtual memory. So does that mean my C program can only address 2^48 bytes of virtual memory?
Advertisement
Answer
On your 64-bit system, pointers are indeed 64 bit wide. That means, there’s 264 possible values for a pointer.
However, current x86-64 (AMD64) implementations only use the lower 48 bits. That means only 248 actually potentially valid pointers and quite a lot of pointers which are always invalid.
AMD64 Architecture Programmer’s Manual Volume 2: System Programming states:
Currently, the AMD64 architecture defines a mechanism for translating 48-bit virtual addresses to 52- bit physical addresses. The mechanism used to translate a full 64-bit virtual address is reserved and will be described in a future AMD64 architectural specification.