Why the memory address of the master boot record is 0x7C00

Why is the memory address of the master boot record 0x7C00?

The "Computer Principles" textbook says that at startup, the master boot record will be stored at memory address 0x7C00.

The textbook does not explain how this strange address came from. I have always wondered, why not store at the head, tail, or other locations of memory, but store in this place that is 1024 bytes smaller than 32KB?

Yesterday, I read an article that finally solved the mystery.

First of all, if you don't know what the Master Boot Record (MBR) is, you can read How does the computer start? " .

Simply put, computer startup is such a process.

  1. power ups
  2. Read the BIOS in the ROM to check the hardware
  3. Hardware check passed
  4. The BIOS checks the first sector of the boot device (ie, the master boot record) according to the specified order, and loads it at memory address 0x7C00
  5. The master boot record gives the control to the operating system

Therefore, the Master Boot Record is a small program that guides the "operating system" into memory, and the size does not exceed 1 sector (512 bytes).

The address of 0x7C00 comes from Intel's first-generation personal computer chip 8088. In order to maintain compatibility, subsequent CPUs have always used this address.

In August 1981, IBM's earliest personal computer, the IBM PC 5150, was launched, and this chip was used.

At the time, the operating system was 86-DOS . This operating system requires a minimum of 32KB of memory. We know that memory addresses are numbered from 0x0000, which is 32KB of memory 0x0000~0x7FFF.

8088芯片本身需要占用0x0000~0x03FF,用来保存各种中断处理程序的储存位置。(主引导记录本身就是中断信号INT 19h的处理程序。)所以,内存只剩下0x0400~0x7FFF可以使用。

为了把尽量多的连续内存留给操作系统,主引导记录就被放到了内存地址的尾部。由于一个扇区是512字节,主引导记录本身也会产生数据,需要另外留出512字节保存。所以,它的预留位置就变成了:


  0x7FFF - 512 - 512 + 1 = 0x7C00 

0x7C00就是这样来的。

计算机启动后,32KB内存的使用情况如下。


+--------------------- 0x0
| Interrupts vectors
+--------------------- 0x400
| BIOS data area
+--------------------- 0x5??
| OS load area
+--------------------- 0x7C00
| Boot sector
+--------------------- 0x7E00
| Boot data/stack
+--------------------- 0x7FFF
| (not used)
+--------------------- (...)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324458798&siteId=291194637