Understanding BIOS: Permanently Stored Memory Copied to RAM
The BIOS (Basic Input/Output System) is a firmware that provides low-level control over the computer's hardware. It is responsible for initializing and testing the system's hardware components during the boot process. One key aspect of BIOS is its ability to copy the contents of the permanently stored memory to RAM.
Where is BIOS Stored?
BIOS is permanently stored in a chip on the motherboard called the CMOS (Complementary Metal-Oxide-Semiconductor) chip. This chip is powered by a small battery, allowing the BIOS to retain its settings even when the computer is turned off. The BIOS is loaded into RAM during the boot process so that it can be executed more quickly and efficiently.
Why is BIOS Copied to RAM?
BIOS is copied to RAM during the boot process because RAM is faster than the CMOS chip. By copying the BIOS to RAM, the computer can access and execute the BIOS code more quickly, which in turn speeds up the boot process. Additionally, copying the BIOS to RAM allows for easier modification of the BIOS settings. Since the BIOS is stored in RAM, it can be easily updated or modified without having to replace the CMOS chip.
How is BIOS Copied to RAM?
The BIOS is copied to RAM during the boot process by the BIOS itself. When the computer is turned on, the CPU begins executing code at a specific address, known as the reset vector (0xFFFF0 in x86 architecture). This code is typically located in the BIOS ROM and is responsible for initializing the system's hardware components and copying the BIOS to RAM. Once the BIOS is copied to RAM, it takes control of the boot process and continues initializing the system's hardware components.
Code Example
Here is an example of how the BIOS copies itself to RAM using x86 assembly language:
mov ax, 0x9000 ; Set the destination address to 0x9000:0000
mov es, ax ; Set the extra segment register to the destination address
mov cx, 512 ; Set the number of bytes to copy to 512 (the size of the BIOS)
mov si, 0xFFFF0 ; Set the source address to the reset vector
rep movsw ; Copy the bytes from the source to the destination
In summary, BIOS is a firmware that provides low-level control over the computer's hardware. It is permanently stored in a chip on the motherboard called the CMOS chip and is loaded into RAM during the boot process. This allows for faster execution of the BIOS code and easier modification of the BIOS settings. The BIOS is copied to RAM by the BIOS itself during the boot process using the reset vector and the rep movsw instruction.
References
-
Book: "Operating System Concepts" by Abraham Silberschatz, Peter B. Galvin, and Greg Gagne
-
Article: "What is BIOS and How Does it Work?" by Lifewire
-
Online Resource: "BIOS - Wikipedia"