x86-64 只使用了48bit的地址。因为使用64bit的地址空间增加复杂性了,并且在可预见的未来并没有完全使用64bit这样大空间的需求。
In addition, the AMD specification requires that bits 48 through 63 of any virtual address must be copies of bit 47 (in a manner akin to sign extension), or the processor will raise an exception.[1](p131) Addresses complying with this rule are referred to as "canonical form."[1](p130) Canonical form addresses run from 0 through 00007FFF'FFFFFFFF, and from FFFF8000'00000000 through FFFFFFFF'FFFFFFFF, for a total of 256 TB of usable virtual address space. This is still approximately 64,000 times the virtual address space on 32-bit machines.
AMD 规范要求bits48~63,必须与bit47 相同。
这样
0x0000,0000,0000,0000 ~ 0x0000,7fff,ffff,ffff 作为user space 128T
0xffff,8000,0000,0000 ~ 0xffff,ffff,ffff,ffff 作为kernel space 128T
但通常内核起始的地址是0xffff,8800,0000,0000
-------------------
/*
* User space process size. 47bits minus one guard page.
*/
#define TASK_SIZE_MAX ((1UL << 47) - PAGE_SIZE)
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
#define IA32_PAGE_OFFSET ((current->personality & ADDR_LIMIT_3GB) ? \
0xc0000000 : 0xFFFFe000)
#define TASK_SIZE (test_thread_flag(TIF_ADDR32) ? \
IA32_PAGE_OFFSET : TASK_SIZE_MAX)
#define STACK_TOP TASK_SIZE
#define STACK_TOP_MAX TASK_SIZE_MAX
------------------
#define __PAGE_OFFSET _AC(0xffff880000000000, UL)
ffff880000000000 ~ ffffc7ffffffffff (=64 TB) is direct mapping of all phys. memory
阅读(1674) | 评论(0) | 转发(0) |