Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kernel virtual address translation

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?

like image 909
user593575 Avatar asked Jan 28 '11 09:01

user593575


People also ask

How virtual address is translated?

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.

What is kernel virtual address?

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.

Does the kernel use virtual addresses?

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.

Does kernel use virtual memory?

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.


1 Answers

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).

like image 168
Eric Seppanen Avatar answered Oct 01 '22 21:10

Eric Seppanen