tags:

views:

117

answers:

3

Hello all,

I have a quick question that I can't seem to find the answer to. When a pc first boots up, it starts executing at physical address 0xffff0. This address contains a jmp instruction to the BIOS.

Now for my question, I always assume the physical addresses are mapped to RAM. If RAM initially contains garbage values, what exactly puts the jmp instruction in 0xffff0? Is the jmp instruction always the same or is it different for different BIOS's? Does 0xffff0 map from RAM to BIOS then (meaning it's "hard mapped")?

Thanks!

IM

+11  A: 

The top 64kB or so are mapped to BIOS ROM, not RAM.

Ignacio Vazquez-Abrams
Perfect, thanks!
IM
+1  A: 

Take a look at PC boot sequence. As Ignacio already answered, it's "hard-mapped" to BIOS read-only memory.

Nikolai N Fetissov
A: 

Actually, it's a bit more complex than that. First of all, on any processor since the 386, it actually starts at fffffff0 (i.e., 16 bytes short of the top of the 32-bit address space). Until the processor first executes a far jump instruction, it does some special mapping to make the whole 32-bit address space visible even though it's executing in real mode. After a far jump is executed, it starts "normal" real mode operation.

In any case, on the hardware side you normally have (Flash) ROM mapped to that location, so when it starts executing, it's executing code in ROM. What executes to start with isn't really BIOS though -- it's just code to decompress the real BIOS from the ROM into RAM, then re-map that RAM to the BIOS address range.

Jerry Coffin