I know that, on booting, BIOS loads the first sector (512 bytes) of a pre-defined device drive on memory 0x7c00 and then jump to that address.
So, memory from 0x7c00 to 0x7dff is occupied. Is there any other section of RAM that is occupied?
If I'm programming an Operating System, could I use all the RAM except 0x7c00 to ox7dff for my own purposes?, or, is there any other section filled with "precious" information at boot time that I must not overwrite?
I know that at a given moment, I can overwrite MBR loaded on memory (chainloading), my question is focused on… what part of the memory is available for an Operating System?
Sorry for my bad english. Thanks for your answers!!
Best Answer
The x86 Real Mode Memory Map is as follows:
In my real mode programming I usually stick from 0x00007E00 - 0x0009FFFF (Not all of it).. I use segment:offset addressing to use the memory.. To go from a 1 Stage bootloader to a Kernel or a Bootloader 2nd Stage, I use:
--
If you are going into Protected mode, you will still need a stub as shown above.. In Something.s you can program in your protected mode routines (GDT, A20, Set video mode, etc..)
To explain about the memory location at 0x7C00 (Bootloader Entry Point), 0x7C00 - 0x7DFF is where you place your bootloader (the bootloader.s above). You place it there because the BIOS jumps to that location after doing its routines. The bootloader must be exactly 512 bytes in size (notice the TIMES directive). From there, your code can be any size (as long as it fits in the memory map), and you will be able to work on the OS fully.
If you DO go into 32Bit Protected Mode, you will be able to use ANYTHING about the 1MiB mark.