Thursday, October 20, 2005

Detecting physical memory

Hi all,
Now, I have come up to explain how to determine the physical memory in the system. You should detect the physical memory map and pass this info to the kernel, which will be used by the physical memory manager. BIOS interrupt 15h, functions E820h, E801h and 88h are there to help you out in this. You should try using these functions in the order mentioned, if one of the function failed. It would be better, if your bootloader supports all these functions. If you use GRUB, instead of your own bootloader, the multiboot structure will be passed to your kernel, which will hold the memory map.
Memory map is a table that holds the information about your physical memory. Each entry in the table holds base address (8 bytes), length (8 bytes) and the type of the memory (8 bytes). You can look into more details about all these BIOS interrupts at http://www.uruk.org/orig-grub/mem64mb.html
When you enable paging in your kernel, READ_ONLY permission can be given to the memory blocks, which are not available for Operating System use.

No comments: