0

According to my current understanding:

  1. there's kernel code that access or manipulate page table
  2. In kernel code, it's also virtual address used to access any struct or object, including page table
  3. page table is needed to translate virtual address to physical address

If all above are correct? Then how could kernel access page table with virtual memory? There seems to be a cycle for me:

  1. kernel needs to access page table with virtual address
  2. there should be another page table to translate the virtual address
  3. then how to access the second page table with virtual address?

1 Answer 1

2

The kernel sets up its own static page tables during boot using physical addresses. After this kernel mapping is created the kernel can use the kernel virtual addresses to access and modify the kernel page tables themselves, as well as set up page tables for user processes. The first kernel page table mapping bootstraps the kernel's ability to manage virtual memory for itself and processes that start in user space.

1
  • when "set up page tables for user processes", the CPU paging has been enabled, right? and the physical address is needed to setup the page table? If so, how could kernel get the physical address? By __pa(), ie x-PAGE_OFFSET? if so, the page table of user space must be in the kernel linear mapping region, am I right? Commented May 22 at 16:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .