4

When an x86 PC boots, it starts executing a program called the BIOS, which is stored in non-volatile memory on the motherboard. The BIOS’s job is to prepare the hardware and then transfer control to the operating system. source Appendix B. From a lab session here in the section The PC's Physical Address Space following mapping is shown.
+------------------+ <- 0x00100000 (1MB)
| BIOS ROM |
+------------------+ <- 0x000F0000 (960KB)

Why do the BIOS need to use it, if not what is its use? How is it related to the BIOS program which is stored in non-volatile memory on the motherboard as I mentioned in the beginning? Although in the lab resource it is mentioned that the design is for qemu(x86 emulator) but osdev [http://wiki.osdev.org/Memory_Map_%28x86%29#ROM_Area] also says the same about the memory layout. I am just a little confused.

2 Answers 2

4

DOS and other real-mode operating systems used BIOS services heavily. Since real-mode of x86 processors is bound into 2^20 = 1Mb address space, vendors of i8086 systems decided that BIOS must be mapped to the high end of the address space (just like nowadays higher-half kernels are mapping their virtual memory at the end of the range): from 0xA0000 and higher.

Protected mode made this reserved memory a gap in the address space: protected mode programs can't call functions from BIOS without significant hacks, rendering it unusable in protected and long mode (which every modern OS runs in), but transfering software from RM to PM was not rapid, so Intel engineers left an escape hatch, v8086 mode, which allowed to run old real-mode programs in a sandbox inside protected-mode environment (for example, OS/2 used v8086 mode intensely and DOS emulation in Windows system also relies on this feature), still requiring BIOS services for compatibility.

This memory is still used in protected mode for some tasks, like VGA terminal/graphics output (terminal's memory is located at 0xB8000, console fonts may also be adjusted there, VGA graphics framebuffer is at 0xA8000, iirc). Sometimes this memory is even used for APIs like VBE 3, but yes, BIOS mapping at 0xA0000 is mostly the matter of backward compatibility. There are efforts to replace it: a modern rethinking of BIOS, UEFI is now steadily gaining popularity.

Conclusion: BIOS mapping at 0xA0000 is mostly the matter of backward compatibility and there are efforts to replace it with more modern boot environments like UEFI.

4

AFAIK, this has mostly historical reasons. The program is stored on chip, but to run it, the code is loaded into RAM (BIOS shadow), where the CPU can directly fetch the instructions. This is especially required for compressed BIOS images on less expensive chips with minimal capacity.

Disabling the 'BIOS shadow' option could slowdown the boot process or rarely cause worse problems. Furthermore, operating systems such as MS DOS did additionally use the BIOS routines for IO, which was kind of a HAL. This would be terribly slow and unsafe to use in todays multithreaded OSes, so after handing over control to the OS, that piece of RAM remains inactive.

Other systems even had their kernel on that chip, e.g. Commodore Amiga Kickstart, wich was alternatively available as Floppy.

1
  • You're welcome. Glad that it helped, EarlGray's answer provides more details though.
    – Sam
    Commented Jan 8, 2013 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .