Please explain the difference between x86
, x32
and x64
? Its a bit confusing when it comes to x86
and x32
because most of the time 32-bit programs run on x86...
相关问题
- Shared common definitions across C/C++ (unmanaged)
- AMD CPU versus Intel CPU openCL
- OpenCL on Linux with integrated intel graphic chip
- Long-lived RESTful interactions
- Counting number of allocations into the Write Pend
相关文章
- Why does the latency of the sqrtsd instruction cha
- Why doesn't there exists a subi opcode for MIP
- DDD Architecture - Where To Put Common Methods/Hel
- Proper scenekit architecture for multi level/scree
- MySQLi Error Handling?
- GET requests in TOR network without installing TOR
- TIme-based Notification Architecture
- What are fast LEA and slow LEA unit in the microar
Hans and DarkDust answer covered i386/i686 and amd64/x86_64, so there's no sense in revisiting them. This answer will focus on X32, and provide some info learned after a X32 port.
x32 is an ABI for amd64/x86_64 CPUs using 32-bit integers, longs and pointers. The idea is to combine the smaller memory and cache footprint from 32-bit data types with the larger register set of x86_64. (Reference: Debian X32 Port page).
x32 can provide up to about 30% reduction in memory usage and up to about 40% increase in speed. The use cases for the architecture are:
x32 is a somewhat recent addition. It requires kernel support (3.4 and above), distro support (see below), libc support (2.11 or above), and GCC 4.8 and above (improved address size prefix support).
For distros, it was made available in Ubuntu 13.04 or Fedora 17. Kernel support only required pointer to be in the range from 0x00000000 to 0xffffffff. From the System V Application Binary Interface, AMD64 (With LP64 and ILP32 Programming Models), Section 10.4, p. 132 (its the only sentence):
When booting a kernel with the support, you must use
syscall.x32=y
option. When building a kernel, you must include theCONFIG_X86_X32=y
option. (Reference: Debian X32 Port page and X32 System V Application Binary Interface).Here is some of what I have learned through a recent port after the Debian folks reported a few bugs on us after testing:
__x86_64__
(and friends) and__ILP32__
, but not__i386__
/__i686__
(and friends)__ILP32__
alone because it shows up unexpectedly under Clang and Sun Studiopushq
andpopq
adcq
If you are looking for a test platform, then you can use Debian 8 or above. Their wiki page at Debian X32 Port has all the information. The 3-second tour: (1) enable X32 in the kernel at boot; (2) use
debootstrap
to install the X32 chroot environment, and (3)chroot debian-x32
to enter into the environment and test your software.x86 refers to the Intel processor architecture that was used in PCs. Model numbers were 8088 (8 bit bus version of 8086 and used in the first IBM PC), 8086, 286, 386, 486. After which they switched to names instead of numbers to stop AMD from copying the processor names. Pentium etc, never a Hexium :).
x64 is the architecture name for the extensions to the x86 instruction set that enable 64-bit code. Invented by AMD and later copied by Intel when they couldn't get their own 64-bit arch to be competitive, Itanium didn't fare well. Other names for it are x86_64, AMD's original name and commonly used in open source tools. And amd64, AMD's next name and commonly used in Microsoft tools. Intel's own names for it (EM64T and "Intel 64") never caught on.
x32 is a fuzzy term that's not associated with hardware. It tends to be used to mean "32-bit" or "32-bit pointer architecture", Linux has an ABI by that name.
x86
means Intel 80x86 compatible. This used to include the 8086, a 16-bit only processor. Nowadays it roughly means any CPU with a 32-bit Intel compatible instruction set (usually anything from Pentium onwards). Never readx32
being used.x64
means a CPU that isx86
compatible but has a 64-bit mode as well (most often the 64-bit instruction set as introduced by AMD is meant; Intel's idea of a 64-bit mode was totally stupid and luckily Intel admitted that and is now using AMDs variant).So most of the time you can simplify it this way:
x86
is Intel compatible in 32-bit mode,x64
is Intel compatible in 64-bit mode.