About Memory

The following picture illustrates physical memory usage and layout of Shaun os.

  • the first page of ram is reserved, kernel never touches it,for where stores the default interrupt vector table and bios data.
  • the second page stores some asm trampoline codes, which is used by kernel to switch cpu context from protecting mode to real mode,and execute some bios calls. That always used by vesa driver to set video modes.
  • the third and fourth page are used by vesa driver to store some video information, such as video mode list.
  • the next following pages are used by ahci controller driver,to store port base address,fis address .etc
  • the lower available memories starts right after ahci controller data and ends to 0x9FFFF.
  • 0xA0000-0xFFFFF,reserved, mainly used for text mode video buf.
  • 0x100000 is where kernel starts from, grub loads kernel here.
  • kend includes kernel bss plus a page called pg0 which is used for temporary page mapping and kernel stack.
  • right behind the pg0, i reserved 2M memory for kernel heap, 1M is used by e1000 driver’s ring buffer and another 1M is used by kernel drivers and file system driver. BTW, these memories are managed by BGET.
  • lower memory bitmap area starts right after the kernel heap.
  • and finally we comes to the system page pool,every page struct stands for a 4K page in system memory. and the pool size vary according to the total upper memory size. the pool is managed by buddy algorithm.
  • end.

Leave a Reply

Your email address will not be published.