Page 1 of 1

Linux kernel boot protocol memory layout

Posted: Wed Oct 06, 2021 4:06 pm
by slammar
This might be a silly question, but why is the memory layout documented in this document from the linux documentation different from the article about the memory map from the osdev wiki in the address 0x00000500?

According to the linux kernel documentation the memory is something like this:

Code: Select all

010000  +------------------------+
        |  Boot loader           |      <- Boot sector entry point 0000:7C00
001000  +------------------------+
        |  Reserved for MBR/BIOS |
000800  +------------------------+
        |  Typically used by MBR |
000600  +------------------------+
        |  BIOS use only         |
000000  +------------------------+
But in the osdev wiki, it is something like this:

Code: Select all

007E00  +------------------------+
        |  Your OS BootSector    | 
007C00  +------------------------+
        |  Conventional memory   |
000500  +------------------------+
        |  BDA (BIOS data area)  |
000400  +------------------------+
        |  Real Mode IVT         |
000000  +------------------------+
The "Real Mode IVT" and "BDA" are things that are meant for BIOS use only, so it makes sense. I don't undestand however why linux says memory from 0x000500 to 0x000600 is also "BIOS use only" but that piece of memory is part of the "Conventional memory" according to the osdev wiki.

Re: Linux kernel boot protocol memory layout

Posted: Wed Oct 06, 2021 6:01 pm
by nexos
0x500 - 0x600 used to be BIOS reserved on some ancient machines. Nowadays, no modern machine's BIOS uses this

Re: Linux kernel boot protocol memory layout

Posted: Wed Oct 06, 2021 8:21 pm
by Octocontrabass
IBM printed several manuals for their PCs and PC-compatibles that state 0x500 is the first byte of usable memory, even though it isn't. That's probably where the incorrect information in the wiki came from.

The original IBM PC BIOS used the byte at 0x500 as a status flag for the print screen handler. (As in printing the text on the screen to a sheet of paper. That kind of print screen.) Recent BIOSes probably don't support this function anymore, but it's definitely there in mid-90s BIOSes.

Several versions of MS-DOS overwrite that whole area as part of the boot process...