標籤:page_offset
Linux記憶體管理 - PAGE_OFFSET理解
PAGE_OFFSET 代表的是核心空間和使用者空間對虛擬位址空間的劃分,對不同的體繫結構不同。比如在32位系統中3G-4G 屬於核心使用的記憶體空間,所以 PAGE_OFFSET = 0xC0000000。在X86-64架構下是ffff880000000000。可以看到核心程式可以可以訪問從PAGE_OFFSET 之後的記憶體,訪問所有的資訊(注意頁的防寫保護)。
參考:https://www.kernel.org/doc/Documentation/x86/x86_64/mm.txt
Virtual memory map with 4 level page tables:0000000000000000 - 00007fffffffffff (=47 bits) user space, different per mmhole caused by [48:63] sign extensionffff800000000000 - ffff87ffffffffff (=43 bits) guard hole, reserved for hypervisorffff880000000000 - ffffc7ffffffffff (=64 TB) direct mapping of all phys. memoryffffc80000000000 - ffffc8ffffffffff (=40 bits) holeffffc90000000000 - ffffe8ffffffffff (=45 bits) vmalloc/ioremap spaceffffe90000000000 - ffffe9ffffffffff (=40 bits) holeffffea0000000000 - ffffeaffffffffff (=40 bits) virtual memory map (1TB)... unused hole ...ffffff0000000000 - ffffff7fffffffff (=39 bits) %esp fixup stacks... unused hole ...ffffffff80000000 - ffffffffa0000000 (=512 MB) kernel text mapping, from phys 0ffffffffa0000000 - ffffffffff5fffff (=1525 MB) module mapping spaceffffffffff600000 - ffffffffffdfffff (=8 MB) vsyscallsffffffffffe00000 - ffffffffffffffff (=2 MB) unused holeThe direct mapping covers all memory in the system up to the highestmemory address (this means in some cases it can also include PCI memoryholes).vmalloc space is lazily synchronized into the different PML4 pages ofthe processes using the page fault handler, with init_level4_pgt asreference.Current X86-64 implementations only support 40 bits of address space,but we support up to 46 bits. This expands into MBZ space in the page tables.->trampoline_pgd:We map EFI runtime services in the aforementioned PGD in the virtualrange of 64Gb (arbitrarily set, can be raised if needed)0xffffffef00000000 - 0xffffffff00000000-Andi Kleen, Jul 2004
Linux記憶體管理 - PAGE_OFFSET理解