User:Madanra/Tasks before leaving Real Mode
Before switching to Protected Mode or Long Mode, there's a number of tasks you'll want your bootloader to perform that are hard or impossible afterwards.
- Get a map of the physical address space
- The only safe and reliable way of getting a memory map is BIOS function INT 0x15, EAX=0xE820. See Detecting Memory (x86) and Memory Map (x86).
- Video tasks
- If you don't have a video driver for every graphics card in existence, you're going to need to use the BIOS. You may want to:
- Get a list of video modes
- Get the monitor's EDID
- Set the video mode
- Get a list of disk drives present and their "virtual cylinders, heads, and sectors" information
- The CHS information is useful for correctly setting the CHS values in partition tables without guesswork, and it's useful to know the mapping from "BIOS device number" to disk.
- If you booted from disk, find out what disk you booted from
- todo
- If you booted from network, get network information
- todo
- BIOS only
- Determinte PCI access mechanism
- Enable A20 line
- Tell the BIOS what mode you're going to use
- UEFI only
- Get addresses of ACPI, SMBIOS etc. tables
- Load your kernel/initrd/whatever