x86_64
Boards
Memory management
During the early boot sequence, we identity map the first gigabyte of our kernel with 512 2MiB pages. When kmain() is called, paging_init() updates the mapping:
- Memory from 0x00000000 to 0x000A0000 is identity mapped (present)
- Memory from 0x000A0000 to 0x00100000 is identity mapped (present + writable)
- The VBE framebuffer might be identity mapped as well (present + writable, and only if ENABLE_FRAMEBUFFER=1 is passed to make; only applicable to pc)
- The kernel sections are identity mapped with the correct flags for each section
- The board's boot information is identity mapped (the multiboot information on pc, the PVH hvm_start_info structure on microvm)
- The board's boot modules are identity mapped with the correct flags (in our case, it is the init ramdisk)
- The memory allocated for the frame allocator is then identity mapped
In addition, paging_init() will:
- enable write protection
- enable the no-execute feature
- create a guard page
Memory map
Virtual address space
- 0x00000000 to 0x00100000: the first 1MiB area is reserved
- 0x00100000: the kernel code and data and boot modules
- 0x0020xxxx: after the end of the previous area (which is computed at runtime using the board's boot information), we allocate some space for the frame allocator
- 0x10000000: kernel heap area (we currently have a fixed heap size)
- 0x40000000: user space