Kernel Implementation: Printing Usable Memory

We will discuss the memmap and hhdm structure tags provided by the bootloader (see the stivale2 boot protocol documentation). Your task is to use the information in the higher-half direct map and memory map tags to identify the usable memory on the system. You can safely ignore any memory that is not marked as usable at this point.

Once complete, your kernel should print the following information for every region of usable memory:

  1. The starting physical address
  2. The ending physical address
  3. The starting virtual address
  4. The ending virtual address

You may see slightly different address ranges, but your results should look something like this:

Usable Memory:
  0x3c000-0x9f000 mapped at 0xffff80000003c000-0xffff80000009f000
  0x100000-0x7f5d9000 mapped at 0xffff800000100000-0xffff80007f5d9000

We will eventually need to track usable memory so we can allocate and free it as the kernel runs, but for now all you need to do is print the information.