Virtual memory is used by modern computer to map hardware i/o and physical memory.

This is done by the memory management unit (MMU)

MMU

MMU sits between the memory controller and the CPU. MMU is also connected to TLB.

TLB (Translation Lookaside Buffer)

TLB is used by the MMU to translate virtual address to physical address. It’s not needed but it is used as a cache for virtual address to physical address mapping.

If the virtual address mapping doesn’t exist in the TLB page fault occurs. It is retrieved from the memory.

Kernel Virtual Memory

In linux, kernel uses virtual address space as user spaces do. And This is not true for all OSs.

Virtual address is split. In 32-bit system, top 1GB is used by the kernel and each process has lower 3GB max limit on virtual memory.

LDD3 also talks about bus addresses which are architecture specific.

LDD3 is Linux device driver, 3rd edition.

Kernel Logical Addresses

Normal address space of the kernel

kernel logical addresses can be converted to and from physical addresses using the macros: