Considering Linux and 32 bit x86 arch there is 3:1 divide of the accessible 4GB address space. The user space is allocated 0-3 Gb while 3-4 Gb is allocated to kernel. How does a virtual address that is greater than 3Gb and hence lies into the kernel address space is transformed to the physical address? Does page tables would come into picture?
It is given that virtual address is 16 bit long. Hence, there are 2^16 addresses in the virtual address space. Page Size is given to be 4 KB ( there are 4K (4 * (2 ^ 10) )addresses in a page), so the number of pages will be ( 2^16 ) / ( 2 ^ 12 ) = 2 ^ 4.
Virtual address - A virtual address is an address that is mapped by the memory management unit (MMU) to a physical hardware address. All addresses directly accessible by the driver are kernel virtual addresses; they refer to the kernel address space.
Whenever we work with virtual memory we work with two types of addresses: virtual address and physical address. All CPU access (including from kernel space) uses virtual addresses that are translated by the MMU into physical addresses with the help of page tables.
The kernel virtual memory contains the code and data structures in the kernel. Some regions of the kernel virtual memory are mapped to physical pages that are shared by all processes. For example, each process shares the kernel's code and global data structures.
There is some information in Mel Gorman's book Understanding the Linux Virtual Memory Manager.
The short answer: Yes, the kernel sets up page tables to translate physical address 0 to virtual address 3 GiB. (Section 3.7.1). This includes the physical location the kernel was loaded to (usually 1MB on x86).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With