Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What address does the x86 begin executing at?

Tags:

x86

assembly

When an 8086 or 8088 first powers up, what address does the processor begin executing at? I know the Z80 starts at 0, and the 6809 looks to FFFF for an address to start at, but I have often wondered how the x86 starts off.

EDIT:

This is assuming no BIOS intervention. I.E. if I had my own EEPROM to boot from, where should it be located in RAM to start the machine running?

like image 516
Chris D. Avatar asked Oct 23 '10 14:10

Chris D.


People also ask

What is an x86 server?

Today, the term x86 is used generally to refer to any 32-bit processor compatible with the x86 instruction set. x86 microprocessor is capable of running almost any type of computer from laptops, servers, desktops, notebooks to supercomputers.

When did the first x86 CPU come out?

The x86 architectures were based on the Intel 8086 microprocessor chip, initially released in 1978.

What kind of processor is x86?

x86 is a type of ISA for computer processors originally developed by Intel in 1978. The x86 architecture is based on Intel's 8086 (hence the name) microprocessor and its 8088 variant. At first, it was a 16-bit instruction set for 16-bit processors, and later it grew to 32-bit instruction sets.

What is the size of register reference instruction x86?

The x86 architecture contains eight 32-bit General Purpose Registers (GPRs). These registers are mainly used to perform address calculations, arithmetic and logical calculations. Four of the GPRs can be treated as a 32-bit quantity, a 16-bit quantity or as two 8-bit quantities.


2 Answers

This is really a much more complex question than you probably realized. On the 8086, it's pretty simple -- it starts up at FFFF:0000 (16-bytes before the end of memory).

The tricky part is on the 286 or above (i.e., anything remotely modern). In these cases, it still starts up 16 bytes before the end of memory, but of course with 24-bit addressing (286) or 32-bit addressing (386+) the physical address is different. That many not seem complex, but it really is. The complexity arises from the fact that the processor starts out executing in real mode, but that address (and all those nearby) aren't visible to the processor in real mode. Therefore, it initially executes in a rather strange mode where it's in real mode from most perspectives, but some of the high bits of the address you appear to execute are ignored and instead basically hard-wired to 1's, so the top of the physical address space is visible to the processor. Then, when you execute a far jump, the processor silently switches to "normal" real mode.

The BIOS starts off in real mode, but usually executes that way for only a short time before setting up a (minimal) protected mode environment, and switching to protected mode. From there, the BIOS executes the normal power-on self test, decompresses the BIOS and copies it into the RAM that's actually located at FFFF:0000, switches back to real mode and executes code in add-on peripheral ROMs if they're marked to execute automatically (typically switching back to protected mode in the process, but back to real mode when finished). One of those will normally be the hard-disk controller that will have code to automatically read in a boot block from a disk, and execute it to start loading the OS and such.

like image 159
Jerry Coffin Avatar answered Sep 30 '22 07:09

Jerry Coffin


8086 reset sets the program counter to FFFF0h.

like image 27
Schedler Avatar answered Sep 30 '22 05:09

Schedler