Jump to content

X86

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 67.180.42.109 (talk) at 09:17, 6 November 2004. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

x86 or Intel 80x86 is the generic name of an architecture of microprocessors first developed and manufactured by Intel.

The architecture is called x86 because Intel used to give the earliest processors in this family numeric brand names ending in the sequence "86", the 8086, the 80186, the 80286, the 386, and the 486. Because one cannot trademark numbers, Intel and most of its competitors stopped using numeric brand names after the 486, and started using proper word brand names, such as Pentium, but the earlier brand naming scheme stuck on to become the name of the entire family. Intel now refers to x86 as IA-32, an abbreviation for Intel Architecture, 32-bit.

History

The x86 architecture first appeared inside the Intel 8086 CPU in 1978 as a follow on to the 8008 processor (which itself followed the 4004). It was adopted (in the simpler 8088 version) three years later as the standard CPU of the IBM PC. The PC's enormous success during the last 20 years has guaranteed that the x86 architecture has become the most popular CPU architecture ever. See also Intel.

Other companies also manufacture or have manufactured CPUs conforming to the x86 architecture, for example Cyrix, NEC Corporation, IBM, IDT, and Transmeta. However, the biggest manufacturer of these processors, next to Intel is AMD. AMD is also the next most influential driver of the evolving x86 standards after Intel.

Intel created this architecture in 1978 in the 16-bit era. By 1985, it had been developed into a 32-bit architecture, when Intel created the IA-32 standards; IA-32 is the 32-bit portion of the x86 standards. The 32-bit era was by far its longest and most lucrative period of history, where Intel continued to develop further development of the IA-32 framework. By 2003, the architecture has evolved into the 64-bit era. However, this time the development was introduced not by Intel but by AMD, and the 64-bit x86 standard is called AMD64.

Note that Intel also introduced a separate 64-bit architecture used in its Itanium processors which it calls IA-64. IA-64 bears no resemblance whatsoever to the x86 architecture, not even minor evolutionary traits. IA-64 should not be confused with x86.

Design

It can be generalized that the x86 architecture is CISC with variable instruction length. Word sized memory access are allowed to unaligned memory addresses. Words are stored in the little-endian order. Backwards compatibility was a driving force behind the development of the x86 architecture, causing numerous sub-optimal and otherwise unjustifiable design decisions in the early architectures. Modern x86 processors translate the x86 instruction set to more RISC-like micro-instructions upon which modern micro-architectural techniques can be applied.

Note that the names for instructions and registers (mnemonics) that appear in this brief review are the ones specified in Intel documentation and used by some of the assemblers. An instruction that is specified in TASM syntax by mov al, 30h is equivalent to AT&T-syntax movb $0x30, %al, and both translate to the two bytes of machine code B0 30 (hexadecimal). You can see that there is no trace left in this code of either "mov" or "al", which are the original Intel mnemonics. If we wanted, we could write an assembler that would produce the same machine code from the command "move immediate byte hexadecimally encoded 30 into low half of the first register". However, the convention is to stick to Intel's original mnemonics.

The x86 assembly language is discussed in more detail in the x86 assembly language article.

Real mode

Intel 8086 and 8088 had 14 16-bit registers. Four of them (AX, BX, CX, DX) were general purpose (although each had also an additional purpose; for example only CX can be used as a counter with the loop instruction). Each could be accessed as two separate bytes (thus BX's high byte can be accessed as BH and low byte as BL). In addition to them, there are 4 segment registers (CS, DS, SS and ES). They are used to form a memory address. There are 2 pointer registers (SP which points to the bottom of the stack, and BP which can be used to point at some other place in the stack or the memory). There are two index registers (SI and DI) which can be used to point inside an array. Finally, there are the flag register (containing flags such as carry, overflow, zero and so on), and the instruction pointer (IP) which points at the current instruction.

In real mode, memory access is segmented. This is done by shifting the segment address left by 4 bits and adding an offset in order to receive a final 20-bit address. Thus the total address space in real mode is 220 bits, or 1 MB, quite an impressive figure for 1978. There are two addressing modes: near and far. In far mode, both the segment and the offset are specified. In near mode, only the offset is specified, and the segment is taken from the appropriate register. For data the register is DS, for code is CS, and for stack it is SS. For example, if DS is A000h and SI is 5677h, DS:SI will point at the absolute address DS × 16 + SI = A5677h.

In this scheme, two different segment/offset pairs can point at a single absolute location. Thus, if DS is A111h and SI is 4567h, DS:SI will point at the same A5677h as above. In addition to duplicacy, this scheme also makes it impossible to have more than 4 segments at once. Moreover, CS, DS and SS are vital for the correct functioning of the program, so that only ES can be used to point somewhere else. This scheme, which was intended as a compatibility measure with the Intel 8085 has caused no end of grief to programmers.

In addition to the above-said, the 8086 also had 64K of 8-bit (or alternatively 32K of 16-bit) I/O space, and a 64K (one segment) stack in memory supported by hardware. Only words (2 bytes) can be pushed to the stack. The stack grows downwards, its bottom being pointed by SS:SP. There are 256 interrupts, which can be created by both hardware and software. The interrupts can cascade, using the stack to store the return address.

Protected and Enhanced Modes

The Intel 80286 could support 8086 real mode 16-bit software without any changes, however it also supported another mode of work called the protected mode, which expanded addressable memory to 16MB. This was done by using the segment registers only for storing an index to a segment table. The segment table provided a 24-bit base address, which could then be added to the desired offset to create an absolute address. In addition, each segment could be given one of four privilege levels (called the rings). Overall, the introductions were an improvement; however they were not used widely per se because using Protected Mode made software incompatible with the Real Mode of 8086.

The Intel 80386 introduced, perhaps, the greatest leap so far in the x86 architecture. With the notable exception of the Intel 80386SX, which was 32-bit yet only had 24-bit addressing (and a 16-bit data bus), it was all 32-bit - all the registers, instructions, I/O space and memory. To work with the latter, it used Enhanced Mode, a 32-bit extension of Protected Mode. As it was in the 286, segment registers were used to index inside a segment table that described the division of memory. Unlike the 286, however, inside each segment one could use 32-bit offsets, which allowed every application to access up to 4GB of memory. In addition, Enhanced Mode supported paging, a mechanism which made it possible to use virtual memory.

No new general-purpose registers were added. All 16-bit registers except the segment ones were expanded to 32 bits. Intel represented this by adding "E" to the register mnemonics (thus the expanded AX became EAX, SI became ESI and so on). Since there was a greater number of registers, instructions and operands, the machine code format was expanded as well. In order to provide backwards compatibility, the segments which contain executable code can be marked as containing either 16 or 32 bit instructions. In addition, a special byte prefix can be used to include 32-bit instructions in a 16-bit segment and vice versa.

Paging and segmented memory access were both required in order to support a modern multitasking operating system. Linux, 386BSD, Windows NT and Windows 95 were all initially developed for the 386, because it was the first CPU that made it possible to reliably support the separation of programs' memory space (each into its own address space) and the preemption of them in the case of necessity (using rings). The basic architecture of the 386 (which is also called IA-32) became the basis of all further development in the x86 series, and no significant changes have been made to it since, thus exemplifying the elegance and scalability of the 386's design.

The Intel 80387 math co-processor was integrated into the next CPU in the series, the Intel 80486. The new FPU could be used to make floating point calculations, important for scientific calculation and graphic design.

MMX and beyond

1996 saw the appearance of the MMX (Matrix Math Extensions, though sometimes incorrectly referred to as Multi-Media Extensions) technology by Intel. While the new technology has been advertised widely and vaguely, its essence is very simple: MMX defined 8 64-bit SIMD registers overlayed onto the FPU stack to the Intel Pentium CPU design. Unfortunately, these instructions were not easily mappable to the code generated by ordinary C compilers, and Microsoft, the dominant compiler vendor, was slow to support them even as intrinsics. MMX also is limited to integer operations. These technical shortcomings caused MMX to have little impact in its early existence. Nowadays, MMX is typically used for some 2D video applications.

3DNow!

In 1997 AMD introduced the 3DNow! which were SIMD floating point instruction enhancements to MMX (targeting the same MMX registers). While this did not solve the compiler difficulties, the introduction of this technology coincided with the rise of 3D entertainment applications in the PC space. 3D video game developers and 3D graphics hardware vendors used 3DNow! to help enhance their performance on AMD's K6 and Athlon line of processors.

SSE

In 1999 Intel introduced the SSE instruction set which added 8 new 128 bit registers (not overlayed with other registers). These instructions were analogous to AMD's 3DNow! in that they primarily added floating point SIMD.

SSE2

In 2001 Intel introduced the SSE2 instruction set which added 1) a complete complement of integers instructions (analogous to MMX) to the original SSE registers and 2) 64-bit SIMD floating point instructions to the original SSE registers. The first addition made MMX nearly obsolete, and the second allowed the instructions to be realistically targeted by conventional compilers.

SSE3

Introduced in 2004 along with the Prescott revision of the Pentium 4 processor, SSE3 adds specific memory and thread-handling instructions to boost the performance of Intel's HyperThreading technology.

64-bit

As of 2002, the x86 architecture began to reach some design limits due to the 32-bit word length. This makes it more difficult to handle massive information stores larger than 4 GB, such as those found in databases or video editing.

Intel had originally decided to completely drop x86 compatibility with the 64-bit generation, by introducing a new architecture called IA-64. IA-64 technology is the basis for its Itanium line of processors. IA-64 is not software compatible with x86 software natively; it uses various forms of emulation to run x86 software.

AMD took the initiative of extending out the 32-bit x86, aka IA-32 to 64-bit. It came up with an architecture, called AMD64, and the first products based on this technology were the Opteron and Athlon 64 family of processors. Due to the success of the AMD64 line of processors, Intel adopted the AMD64 instruction set and added some new extensions of their own, rebranding it the EM64T architecture (apparently not wishing to acknowledge that the instruction set came from its main rival).

This is the first time that a major upgrade of the x86 architecture was initiated and originated by a manufacturer other than Intel. Perhaps more importantly, it was the first time that Intel actually accepted technology of this nature from an outside source.

Virtualization

x86 virtualization is difficult because the architecture does not meet the Popek and Goldberg virtualization requirements. Nevertheless, there are several commercial x86 virtualization products, such as VMware and Microsoft Virtual PC. Intel and AMD have both announced that future x86 processors will have new enhancements to facilitate more efficient virtualization. Intel's code names for their virtualization features are "Vanderpool" and "Silvervale"; AMD uses the code name "Pacifica".

Manufacturers

x86 and compatibles have been designed, manufactured and sold by a number of companies, including: