Linus Torvalds writes: (Summary) It does not
follow page tables at all.
follow page tables at all.
And on 32-bit, it literally ends up doing (see __phys_addr_nodebug()) a simple And on 32-bit, it literally ends up doing (see __phys_addr_nodebug()) a simple #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) However, on x86-64, we have *two* cases of direct mappings: we have the one at __START_KERNEL_map, and we have the one at PAGE_OFFSET. And I entirely forget why we needed it on x86-64.
forget why we needed it on x86-64.
[ Goes around and rummages ]
[ Goes around and rummages ]
Oh, never mind, looking around reminded me why: we want to map the kernel text in the top 31 bits, so that we can use the faster -mcmodel=kernel because all symbols fit in sign-extended 32 bits.
follow page tables at all.
And on 32-bit, it literally ends up doing (see __phys_addr_nodebug()) a simple And on 32-bit, it literally ends up doing (see __phys_addr_nodebug()) a simple #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) #define __phys_addr_nodebug(x) ((x) - PAGE_OFFSET) However, on x86-64, we have *two* cases of direct mappings: we have the one at __START_KERNEL_map, and we have the one at PAGE_OFFSET. And I entirely forget why we needed it on x86-64.
forget why we needed it on x86-64.
[ Goes around and rummages ]
[ Goes around and rummages ]
Oh, never mind, looking around reminded me why: we want to map the kernel text in the top 31 bits, so that we can use the faster -mcmodel=kernel because all symbols fit in sign-extended 32 bits.