x86

x86 is a family of backward-compatible instruction set architectures based on the Intel 8086 CPU and its Intel 8088 variant. The 8086 was introduced in 1978 as a fully 16-bit extension of Intel's 8-bit-based 8080 microprocessor, with memory segmentation as a solution for addressing more memory than can be covered by a plain 16-bit address.
The term "x86" came into being because the names of several successors to Intel's 8086 processor end in "86", including the 80186, 80286, 80386 and 80486 processors.

As of 2017, the majority of personal computers and laptops sold are based on the x86 architecture (despite inroads from Chromebook-style ARM designs, the segment-leading Apple MacBook family remains exclusively x86), while other categories - especially high-volume mobile categories such as smartphones or tablets - are dominated by ARM; at the high end, x86 continues to dominate compute-intensive workstation and cloud computing segments.

Many additions and extensions have been added to the x86 instruction set over the years, almost consistently with full backward compatibility.

Registers and Flags

x86 processors have a collection of registers available to be used as stores for binary data. Collectively the data and address registers are called the general registers. Each register has a special purpose in addition to what they can all do:

  • AX general purpose, multiply/divide, string load & store, return value
  • BX index register for MOVE
  • CX count for string operations & shifts
  • DX port address for IN and OUT
  • BX index register for MOVE
  • SP points to top of stack
  • BP points to base of stack frame
  • SI points to a source in stream operations
  • DI points to a destination in stream operations

Along with the general registers there are additionally the:

  • IP instruction pointer
  • FLAGS
  • segment registers (CS, DS, ES, FS, GS, SS) which determine where a 64k segment starts (no FS & GS in 80286 & earlier)
  • extra extension registers (MMX, 3DNow!, SSE, etc.) (Pentium & later only).

The IP register points to the memory offset of the next instruction in the code segment (it points to the first byte of the instruction). The IP register cannot be accessed by the programmer directly.

The x86 registers can be used by using the MOV instructions. For example, in Intel syntax:

mov ax, 1234h  / copies the value 1234[hex][1-72] (4660d) into register AX
mov bx, ax     / copies the value of the AX register into the BX register

With the advent of the 32-bit 80386 processor, the 16-bit general-purpose registers, base registers, index registers, instruction pointer, and FLAGS register, but not the segment registers, were expanded to 32 bits.
The nomenclature represented this by prefixing an "E" (for "extended") to the register names in x86 assembly language. Thus, the AX register corresponds to the lowest 16 bits of the new 32-bit EAX register, SI corresponds to the lowest 16 bits of ESI, and so on.

Instructions

The x86 instruction set has been extended several times, introducing wider registers and datatypes as well as new functionality.

Mnemonics and opcodes

Each x86 assembly instruction is represented by a mnemonic which, often combined with one or more operands, translates to one or more bytes called an opcode;
the NOP instruction translates to 0x90, for instance and the HLT instruction translates to 0xF4.

Syntax

x86 assembly language has two main syntax branches: Intel syntax, originally used for documentation of the x86 platform, and AT&T syntax. Intel syntax is dominant in the MS-DOS and Windows world, and AT&T syntax is (was) dominant in the Unix world, since Unix was created at AT&T Bell Labs.

Main differences between Intel syntax and AT&T syntax.

x86-64

AMD decided to take another path toward 64-bit memory addressing, making sure backward compatibility would not suffer.

In April 2003, AMD released the first x86 processor with 64-bit general-purpose registers, the Opteron, capable of addressing much more than 4 GB of virtual memory using the new x86-64 extension (also known as AMD64 or x64). The 64-bit extensions to the x86 architecture were enabled only in the newly introduced long mode, therefore 32-bit and 16-bit applications and operating systems could simply continue using an AMD64 processor in protected or other modes, without even the slightest sacrifice of performance and with full compatibility back to the original instructions of the 16-bit Intel 8086.
The market responded positively, adopting the 64-bit AMD processors for both high-performance applications and business or home computers.

x86-64 also introduced the NX bit, which offers some protection against security bugs caused by buffer overruns.


results matching ""

    No results matching ""