English 中文(简体)
What is significance of memory at 0000:7c00 to booting sequence?
原标题:

Why does bios read at partition s boot record at 0000:7c00 ? What is special about that address ? what : doing in referencing an address ?

最佳回答

The ":" is a holdover from segmented memory days, when PCs ran in real mode and could only do 64K at a time. The number to the left of the ":" is your segment, the number to the right is your address.

The windows debug command accepts this notation if you want to poke around in memory yourself:

C:UsersSeth> debug
-d0000:7c00
0000:7C00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C10  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C20  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C50  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C60  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................
0000:7C70  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00   ................

With regard to this particular address, it s just an address that was picked to load the MBR, See: https://web.archive.org/web/20140701052540/http://www.ata-atapi.com/hiwmbr.html

"If an MBR is found it is read into memory at location 0000:7c00 and INT 19 jumps to memory location 0000:7c00"

问题回答

The simple answer is that 7C00h is 1k (512 bytes for the boot sector plus an additional 512 bytes for possible boot sector use) from the bottom of the original 32k installed memory.

The happy answer is that org 7C00h has become synonymous with boot sector - boot loader programming.

In the original IBM PC it was thought inconceivable to have more than 32K RAM. In segmented addressing terms this is 0000:8000 where 8000 hex is 32768 decimal. The fashion of the time was for the BIOS POST conclude by loading the Boot Sector of the floppy in A: or the Master Boot Record of the hard drive in C: at the location 512 bytes below the top of memory which means subtract 0200 hex from 8000 hex to get 7C00. So the boot sequence loaded the first valid 512 byte first sector into, and then set the Instruction Pointer to 0000:7C00 to execute it. I used to write the code for these first sectors to load the operating system.

Read this article:

http://en.wikibooks.org/wiki/X86_Assembly/Bootloaders

From the above URL, BIOS (which is effectively PC hardware) will make the jump to memory at 0000:7c00 to continue execution in 16-bit mode.

And to quote from above:

A bootloader runs under certain conditions that the programmer must appreciate in order to make a successful bootloader. The following pertains to bootloaders initiated by the PC BIOS:

  • The first sector of a drive contains its boot loader.
  • One sector is 512 bytes — the last two bytes of which must be 0xAA55 (i.e. 0x55 followed by 0xAA), or else the BIOS will treat the drive as unbootable.
  • If everything is in order, said first sector will be placed at RAM address 0000:7C00, and the BIOS s role is over as it transfers control to 0000:7C00. (I.e. it JMPs to that address)

So from bootup, if u want the CPU to start executing your code, it has to be located in memory at 0000:7c00. And this part of the code is loaded from the first sector the harddisk - also done by hardware. And it is only the first sector which is loaded, the remaining of other parts of the code then have to be loaded by this initial "bootloader".

More information on harddisk s first sector and the 7c00 design:

http://www.ata-atapi.com/hiwdos.html

http://www.ata-atapi.com/hiwmbr.html

Please don t confuse with the starting up mode of the CPU - the first instruction it will fetch and execute is at physical address 0xfffffff0 (see page 9-5):

http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-3a-part-1-manual.pdf

and at this stage it is executing non-volatile (meaning you cannot reprogram it easily, and thus not part of bootloader s responsibility) BIOS code.





相关问题
Displaying Graphics in BIOS

Using MASM32 is it possible to display bitmaps stored in a binary file embedded with the executable to the console? Can anyone show me how? Addendum: I m not talking about a full fledge GUI here. ...

How To Print ASCII Extended Characters Using a Const Char*?

I have a function to print characters on the screen that is like this: void print(int colour, int y, int x, const char *string) { volatile char *video=(volatile char*)0xB8000 + y*160 + x*2; ...

Stack size required for bios interrupt call

I am working on a small bootloader for learning purposes. Is there any specification/information available about the (free) stack size required for a bios interrupt call?

Basic OS boot question

I have some kinda basic question to the boot process of a computer and the part where the bootloader calls the OS. So I know that the BIOS copies the first 512 bytes from a bootable drive into memory ...

c# how to determine bios date change

Hello how can i determine with a program (c#) if the Bios Date has Change ? UPDATED i m looking for the machine date, because I want write program that check if some body change that value, figure ...

BIOS build number and Identification number?

I want to get the BIOS Build number and Identification number. I am already using WMI class Win32_Bios dataclass but I it is not returing the value for Build number and Identification number on any of ...

BIOS INT 0x15 Function 0x88 always returns same memory size

I m using BIOS int 0x15 on my Bochs emulator, however this always returns the same memory size (34440) no matter what I have configured: mov ax, 0x88 int 0x15 I know that there are better methods of ...

热门标签