x64

from Wikipedia, the free encyclopedia

In computer science is based on the x86 - instruction set (or instruction set architecture , English Instruction Set Architecture , in short: ISA) -based 64-bit architecture as x64 , alternatively as x86-64 (also spelled "x86_64") and AMD64 (also in lower case: “amd64”). The instruction set extension supplements the Intel Architecture 32-bit , IA-32 for short, with a 64-bit operating mode.

Implementations

The instruction set extension is implemented by both AMD and Intel :

The implementations of AMD and Intel show differences in detail, which, however, hardly have any effect in practice. Not only the designation “x64” (as used by Windows, for example), but also “amd64” (as used by Linux, for example, but partly also by Windows) and “x86-64” (the development name of AMD64 ) therefore stand for both implementations equally.

history

The x86-64 architecture was created as a counter-design to the Itanium architecture "IA-64" from Intel and Hewlett Packard - while Intel created a completely new 64-bit architecture , with the IA-32 , which was then and afterwards most used in PCs . Architecture had little in common, AMD chose a far less radical approach: As an extension of the existing instruction set , a 64-bit x86 processor is also a full-fledged 32-bit x86 processor, only with additional commands and modes that are available in the new operating mode make wider registers available. As a result, the instruction set architecture and the compatibility with existing software are retained.

Intel introduced the first IA-64 processors (IA-64 corresponds to Itanium) on October 4, 1999. The next day, AMD announced its alternative and published the “x86-64” specification in August 2000. Intel brought out the first generation of the Itanium in June 2001 and in 2002 pushed the second generation behind. At AMD, it was not until April 2003 that the first Opterons with the 64-bit extension now called “AMD64” became available. They were so well received by the market that in June 2004 Intel began to equip the first Xeon processors (“Nocona”) with the compatible “EM64T” 64-bit extension.

Now AMD has equipped all model series with the AMD64 extension, while Intel still relied on the Itanium series for 64-bit - it was not until July 2006 that the first desktop and mobile processors of the Core 2 series with the now " Intel 64 " baptized architecture sold. All subsequent generations of IA-32-compatible processors from AMD and Intel have since been designed as 64-bit architecture, most recently the Atom processors from Intel from 2008. Other manufacturers followed the market development, the 64-bit VIA-Nano, for example, became available from January 2008 available.

Designations

Historically, the 64-bit instruction set extension for the existing x86 architecture, called IA-32 by Intel, was developed by AMD from 1999 under the name "x86-64". On some systems it was also called x86_64 because a hyphen is interpreted as a separator in some situations . This is e.g. As the Linux - kernel , but u. a. This is also the case with XNU (the Darwin kernel and thus macOS, among others ), which is why unamethe spelling is output with an underscore . When the first Opteron processors from AMD with the 64-bit extension were introduced in 2003, AMD changed the name to "AMD64". Therefore, most Linux distributions use the official name amd64 to identify 64-bit x86, as well as the kernel of FreeBSD at uname. For 32-bit x86, however, not only Linux distinguishes between the instruction set extensions that came after the "i386" (the first 32-bit architecture from Intel, without extensions), such as "i586" (i386 with the extensions of the Pentium ) or “i686” (the extensions of the Pentium Pro or Pentium II , also called P6 generation , i.e. with at least MMX and SSE ) or even “i686-pae” (i686, additionally with the PAE extension). With "amd64" the SSE2 extension of the processor can be used in any case .

The designation x64 (for 64-bit) was introduced by Microsoft and Sun , based on "x86" . In some cases, the 32-bit x86 architecture was then also referred to as “x32” (for 32-bit), since both technically represent x86 instruction sets. Since Intel later named the x86-ISA ("Instruction Set Architecture") IA-32 and developed a new but incompatible 64-bit architecture with IA-64 (Itanium), there is often confusion between the terms "x64" and "IA" -64 ". As an instruction set extension, x64 is part of IA-32 and belongs to the x86 architecture. IA-64 ("Intel Architecture 64-Bit"), however, is also known as the Itanium architecture and has nothing to do with x64.

Operating system support

The first operating system to offer working support for the 64-bit mode of the AMD64 processors was Linux (official introduction to the Linux kernel March 1, 2002). Microsoft's Windows XP Professional x64 Edition for AMD64 has been available since April 2005 , although it was only intended as an interim solution until Windows Vista came onto the market in January 2007.

The x64 edition of Windows XP was only marketed very cautiously by Microsoft as an OEM and system builder version in order to keep the “support” costs within limits and not to endanger future Vista sales. There is no home version, no box version for retail, and no full localization for languages ​​other than English. However, it is possible to “translate” this version with MUI (Multi User Interface) packs.

Mac OS X (since 2016 "macOS") has supported the x64 architecture since the conversion of its platform from PowerPC to Intel processors in 2006, but the XNU kernel also ran on 64-bit Intel CPUs initially in 32-bit -Compatibility mode of Long Mode . The first 64-bit kernel was made available in Snow Leopard at the end of 2009 and was automatically used on some Macs if the conditions were met: in addition to a 64-bit processor, this is also firmware implemented in 64-bit ( EFI was initially partially implemented as a 32-bit variant) and that all required drivers are available in 64-bit. Since the Mountain Lion released in mid-2012, there is only a 64-bit kernel available.

The three most important BSD derivatives also support the AMD64 architecture: FreeBSD , NetBSD and OpenBSD (from version 3.5).

architecture

With AMD64, all registers have a width of 64 bits. When the processor is running in 32-bit compatibility mode , the top 32 bits of each register are set to zero. In 64-bit mode, the processor also offers 8 additional integer and SSE registers, which are not available in 32-bit mode for reasons of compatibility.

The AMD64 architecture has the following application registers that are available in normal application programs:

General registers (each 64 bit)
Surname (original) meaning
RAX accumulator
RBX Base register
RCX Counter
RDX Data register
RBP Base pointer
RSI Source index
RDI Destination index
RSP Stack pointer
R8… R15 Register 8 to 15
64-bit media / 80-bit floating point registers
Surname meaning Note
FPR0… FPR7 FPU register 0… 7 are
shared
MMX0… MMX7 MMX register 0… 7
64-bit media / 80-bit floating point registers
Surname meaning
XMM0… XMM7 SSE register 0… 7
XMM8… XMM15 SSE register 8… 15
Other registers
Surname meaning
RIP 64-bit instruction pointer
RFLAGS 64-bit flag register (status register)
FSW FPU state word
FCW FPU control word
FTW FPU tag word

The registers R8 – R15 and XMM8 – XMM15 with a yellow background are only available in 64-bit mode. The registers RAX – RSP as well as RFLAGS and RIP are only 32 bits in size in 32-bit mode and are called EAX – ESP, EFLAGS and EIP, as with the 80386 . Access to the 64-bit registers is via newly introduced instruction prefixes. For this purpose, opcodes used which are in 32-bit mode already for other commands. For this reason, the 64-bit registers - unlike the 32-bit prefixes, which are also available in 16-bit mode - are only available in 64-bit mode.

While one is for compatibility reasons for floating point operations x87 - FPU available on the processor. However, the manufacturer recommends that you generally only use the higher-performance and less problematic SSE unit for floating-point calculations . The problem here, however, is that the SSE unit has not yet mastered any transcendent functions ( sine , cosine, arctangent , logarithm ); these still have to be calculated via the x87-FPU or emulated via software. In addition, the SSE unit can only handle 64-bit floating point arithmetic, while the x87 FPU unit works with up to 80-bit floating point arithmetic, depending on the setting of the FPU control word.

Since memory segmentation is no longer supported in 64-bit mode , system calls can be greatly accelerated since segmentation information no longer needs to be saved and restored. AMD took this into account by introducing a new SYSCALL machine instruction . Although you could theoretically make a system call in 64-bit mode as before using interrupts or the SYSENTER command, SYSCALL is faster.

Maximum memory

One of the main reasons to choose AMD64 over x86 architecture is the ability to use more memory . If the installed main memory exceeds the maximum address space of a CPU, then the main memory that lies beyond the address space remains unused. The memory size limits of the corresponding processors are ...

CPU physical address space linear logical or
virtual address space
8086 1 MiB ( byte) 64 KiB ( bytes)
80286 16 MiB ( bytes) 64 KiB ( bytes)
80386SX 16 MiB ( bytes) 4 GiB ( bytes)
from 80386DX 4 GiB ( bytes) 4 GiB ( bytes)
Pentium Pro / AMD Athlon 64 GiB ( bytes) 4 GiB ( bytes)
CPUs with AMD64 1 TiB ( byte) or 256 TiB ( byte)
256 TiB ( bytes)

With AMD64, the width of a virtual address is 48 bits. That is, a process can address 256  TiB . While the AMD processors of the K8 generation, which were common when the AMD64 was introduced, still had 40 addressing pins and could therefore only physically address 1 TiB of memory, the K10 generation of processors has the full 48 addressing pins, which now also physically 256 TiB of memory are addressable.

Register extension

The doubling of the number of registers in the general arithmetic unit is available in the instruction set regardless of the 64-bit transfer. The implementation of the AMD64 extension in the CPUs always includes this extension. In this way, modern compilers can store intermediate values ​​of calculations in CPU registers more often than they are in main memory. Complex calculations are accelerated, so that computationally intensive programs benefit from them.

At the same time, AMD64 introduced a new calling convention for program functions ( ABI ). With this calling convention, function parameters are no longer predominantly transferred via the program stack, as in the classic x86-32 calling conventions, but are usually transferred in registers. This register-oriented ABI, which has long been common with other processor families (such as PowerPC), has been made possible by the register expansion and can lead to an acceleration of computationally intensive programs.

Operating modes

A distinction can be made between two basic operating modes:

  • Legacy Mode: This includes all "old" operating modes of the x86 architecture, ie Real Mode , Protected Mode and System Management Mode .
  • Long Mode (AMD64) or IA-32e Mode (Intel 64): This operating mode consists of two sub-modes:
    • 64-bit mode: The "real" 64-bit mode for 64-bit applications on a 64-bit operating system.
    • Compatibility Mode: This mode enables 32-bit applications to be run on a 64-bit operating system. The application “sees” an environment that appears to correspond to protected mode . In truth, however, mechanisms of the AMD64 architecture are used, such as a four-level page table hierarchy. 16-bit protected mode programs are also supported in compatibility mode , but not real mode programs that are executed in legacy mode in a virtual 8086 mode environment . The compatibility mode must be explicitly supported by the operating system and can then be activated for a single code segment .

When the system starts, every x86 processor is initially in 16-bit real mode , which is due to the compatibility with the 8086 from Intel. If a PC uses a BIOS , the processor initially remains in real mode until the operating system starts. Therefore, all BIOS bootloaders are 16-bit programs and only the operating system or its kernel switches to 32-bit or 64-bit mode. UEFI, on the other hand, switches to either 32-bit Protected Mode to start a 32-bit EFI program or 64-bit Long Mode to start a 64-bit EFI program. This EFI program is e.g. B. the boot loader for the operating system. This is why a 32-bit UEFI usually cannot start a 64-bit operating system. With some operating system versions, there is therefore a cross-bit depth boot process that can start a 64-bit operating system from a 32-bit EFI; however, both the 32-bit EFI loader and the 64- Bit operating system kernel must be configured appropriately.

Take advantage of the 64-bit extension

Disadvantage - memory consumption
All address values ​​are 64 bits instead of 32 bits. Their storage therefore takes up twice as much space in the RAM and in the caches and twice as many bytes have to be moved when moving between RAM and CPU. This becomes visible in the generated program files, which are around 25 to 30 percent larger than the 32-bit program. However, IP-relative addressing with signed 32-bit offsets was introduced in 64-bit mode . This prevents the command length from increasing.
For Linux was for this reason x32 - ABI created which uses only 32-bit addresses, but still (more registers such as.) Comes in enjoying the other benefits of AMD64.
Neutral - vector operation
The SSE unit takes over the vast majority of the calculations for multimedia and mathematics, both for floating point values ​​and for integer packed numbers with multiple values, including above all vectors and matrices. The extension of the ALU register to 64 bits does not affect this unit at all, since the SSE registers have always been 128 bits wide, so that SSE calculations run unchanged. However, the doubling of the number of registers mentioned below also affects the SSE media registers.
Advantage - more memory per process
The limit of the classic IA-32 architecture of 2 (or 4) GiB addressable main memory per process (“linear address space”) does not apply.
Advantage - number of registers
In addition to the 64-bit expansion, the AMD64 architecture has a double number of general registers. This is advantageous if there are many intermediate values in a procedure that no longer have to be temporarily swapped out to the call stack in main memory. Since the traditional eight registers have always been in short supply, a speed advantage of 25 to 30 percent for 64-bit programs is applied here. In addition, a new function call convention has been introduced that specifies the additional registers for transferring function parameters. This type of parameter transfer is significantly faster than the conventional parameter transfer on the stack.
Advantage - address width
If data volumes in the gigabyte range are processed, there is no need for time-consuming access calculations with 32-bit differences to base addresses. In particular, all modern operating systems are capable of fading files on the hard disk into the main memory (virtual file mapping): Instead of processing in pieces, the entire hard disk can now in principle be faded in for direct access in one piece. Auxiliary functions with file pointers are omitted and degenerate into simple ALU operations.
Advantage - vector units
If 32-bit programs are also to run on older processors, these programs cannot require an SSE unit and are usually compiled without SSE support. All AMD64-capable processors, on the other hand, have at least SSE2, which is therefore always available with 64-bit software.
Advantage - 64-bit register for integer arithmetic
Applications that rely on integer arithmetic benefit greatly from the fact that multiplications with whole numbers larger than 32 bits are processed much faster. For example, processing 64-bit integers on 32-bit systems requires around 2.5 times the computing time. This can concern, for example, cryptography and audio or video coding software.

The latter benefit mainly concerns databases and video processing, which benefit significantly from expanding addresses to 64 bits. The SSE unit largely determines the processing of games and mathematical programs - insofar as they contain complex partial calculations on a few memory objects, they benefit more from the advantages. This mainly applies to areas of 3D modeling.

Basically, the benefits are very specific for each application and the algorithms used: Many old programs use algorithms optimized for 32 bits, which can only benefit from the 64-bit extension after being adapted by the programmer. This applies to both mathematical auxiliary functions (including multimedia and games) and memory management. Many programs from the Unix area have a head start here, as 64-bit architectures have long been common there.

See also

Web links

Individual evidence

  1. Chris Lomont: Introduction to x64 Assembly. In: Intel Developer Zone. Intel, March 19, 2012, accessed on November 20, 2016 (English): "x64 is a generic name for the 64-bit extensions to Intel's and AMD's 32-bit x86 instruction set architecture (ISA). AMD introduced the first version of x64, initially called x86-64 and later renamed AMD64. Intel named their implementation IA-32e and then EMT64. There are some slight incompatibilities between the two versions, but most code works fine on both versions;
  2. BeemerBiker: Q: WAIK-Difference of x86, amd64 and ia64? (Forum) In: Microsoft Community. Microsoft, February 25, 2011, accessed on January 6, 2018 (English): "I installed Windows Automated Installation Kit and got three directories named x86, IA64 and AMD64. I expected to see x64. "
  3. a b Christof Windeck: 64-bit names. In: Heise online . April 28, 2008 . Retrieved November 19, 2016 .; Quote: "In terms of x86 processors with 64-bit expansion, x86-64, AMD64, EM64T, Intel 64 and x64 mean practically the same thing."
  4. Michael Kanellos: Intel Names Merced Chip Itanium. In: CNET News.com. October 4, 1999, accessed August 7, 2013 .
  5. AMD Discloses New Technologies at Microprocessor Forum. In: press release. AMD, October 5, 1999, accessed November 9, 2010 .
  6. AMD Releases x86-64 Architectural Specification; Enables Market Driven Migration to 64-Bit Computing. In: press release. AMD, August 10, 2000, accessed November 9, 2010 .
  7. Herbert Schmid: 64-bit Linux for AMD's hammer officially. In: Heise online . March 1, 2002 . Retrieved January 6, 2018.
  8. ^ Prince McLean: Road to Mac OS X Snow Leopard: 64-bit to the Kernel. AppleInsider, October 28, 2008, accessed October 13, 2018 .
  9. Michael Matz, Jan Hubicka, Andreas Jaeger, and Mark Mitchell: System V Application Binary Interface AMD64 Architecture Processor Supplement (PDF; 552 kB) January 13, 2010. Accessed August 7, 2013.
  10. Rod Smith: Boot 32bit UEFI from file. (Q&A) Answer to the question asked. In: superuser.com. Stack Exchange , January 31, 2016, accessed on January 20, 2018 (Roderick W. Smith publishes the rEFInd bootloader ).
  11. x86-64 Machine-Level Programming (PDF; 230 kB) pp. 5–6, 3.2 Assembly Code Example.
  12. Myth and Facts About 64-bit Linux . (PDF; 233 kB; English) - various performance comparisons of AMD64 and IA32, on page 27 integer additions are compared on 32- and 64-bit systems