Riscv Linux memory map

Both Rv32 and Rv64 architecture support memory virtualization. Here we aer only discussing RV64 memory map as it is more interesting. There are many variants of memory virtualization possible with RV64.

  • SV39
  • SV48
  • SV57

The selection of the virtual memory is done considering the memory requirement of the application. Here we take SV39 as an example and all the things we discuss will make sense for other variants too.

The virtual address space is basically split in to three

  • User space
  • Unused space
  • Kernel space

User space

User space is dedicated for all the user programs. SV39 supports 256GB of virtual address space for user applications at the lowest end of address space starting from 0x0000…00.

Kernel space

Kernel space contains all the kernel related data/code and are shared between all processes. the kernel space is divided into sections based on what is stored in each memory region.

  • Fixmap
  • PCI IO
  • Vmemmap
  • Vmalloc/ioremap space
  • direct mapping of all physical memory
  • kasan
  • modules.bpf
  • kernel

Leave a Comment