Memory map

ukoOS is a higher-half kernel (i.e., all the kernel's data is mapped to an address whose MSB is 1). Depending on how many bits of virtual address space the hardware supports, the kernel memory map is somewhat different.

Sv39 memory map

In Sv39, virtual addresses are 39 bits, and sign-extended to 64 bits.

Start AddressEnd AddressSizeDescription
0x00000000000000000x0000003fffffffff256GiBUserspace virtual memory
0x00000040000000000xffffffbfffffffff16EiB - 512GiBIllegal addresses in Sv39
0xffffffc0000000000xffffffdfffffffff128GiBPhysical memory
0xffffffe0000000000xffffffffbfffffff127GiBRAM
0xffffffffc00000000xffffffffffffffff1GiBKernel
  • The userspace memory map can be controlled from userspace, and does not have a fixed structure.

  • A large range of 64-bit addresses are illegal in Sv39, because there are not enough bits to represent them.

  • 128GiB of physical memory is directly mapped. This should be enough to access any memory-mapped devices; devices that use more physical memory than this tend to support Sv48 or Sv57.

  • Up to 127GiB of RAM can be mapped. Past this point, no more memory can be used by the kernel. Machines with anywhere near this much memory support Sv48 or Sv57, so this isn't a limitation in practice.

    Memory gets mapped here by the allocator as needed.

  • The kernel itself is mapped into a large contiguous region. There are a lot of smaller regions within this region, but they're outside the scope of this page.