Linux kernel boot protocol memory layout

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
slammar
Posts: 24
Joined: Fri Feb 07, 2020 7:35 pm
Libera.chat IRC: slammar

Linux kernel boot protocol memory layout

Post 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.
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Linux kernel boot protocol memory layout

Post by nexos »

0x500 - 0x600 used to be BIOS reserved on some ancient machines. Nowadays, no modern machine's BIOS uses this
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Octocontrabass
Member
Member
Posts: 5567
Joined: Mon Mar 25, 2013 7:01 pm

Re: Linux kernel boot protocol memory layout

Post 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...
Post Reply