引用 32 位和 64 位版本程序的最正确方法 [英] The most correct way to refer to 32-bit and 64-bit versions of programs

查看:43
本文介绍了引用 32 位和 64 位版本程序的最正确方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是关于 32 位和 64 位 x86 的术语.

如果我有 2 个包含相同程序源代码的目录 - 一个用于 32 位 Windows,另一个用于 64 位 Windows,那么这些文件夹的更正确名称是什么:

  • x86-64x64?
  • 还是IA-32x64?

我已经阅读了一些网络资源,但无法理解.仅供参考:

解决方案

x86 可以是一个广义的术语,涵盖所有向后兼容 8086 的 CPU,以及对架构的所有扩展,包括 x86-64.

请注意,IA-64 根本不是 x86,而是安腾(具有显式推测/并行性的 64 位 VLIW 架构).它也是由 Intel 设计的,但在兼容性或设计方面与 x86 完全无关.(早期的 IA-64 CPU 也集成了 x86 内核,以实现兼容性.Intel 正在推动 IA-64,而 AMD 则在推动 AMD64/x86-64)

英特尔有时会说他们的 CPU 具有 IA 内核 + 集成 GPU 以及每个 IA 内核之外的其他逻辑.(IA = 英特尔架构 = x86).

<小时>

32位x86专用(不包括16位或64位)可以调用

  • IA-32(有时由英特尔使用)
  • i386 或 i686(Linux 上常见)
  • (仅限 Windows):x86.是的:在 Windows 世界中,x86"特指 32 位.这就是为什么您有一个具有该名称的 Program Files (x86) 目录.这种选择可能会给每个人带来潜在的术语混淆,因为与 ARM 或 MIPS 相比,x86"仍然是迄今为止一般指代架构的最佳方式.
  • 很少:x86-32.我所知道的任何硬件或软件供应商都没有正式使用它,但这是一个明确的有用术语.

永远不要称它为 x32.x32 是 x86-64 System V ABI 的 ILP32 变体:64 位模式下的 32 位指针.https://en.wikipedia.org/wiki/X32_ABI

<小时>

64 位 x86 更容易具体指代(不包括 32 位和 16 位):

  • x86-64 或 x86_64(破折号与下划线根本不重要.在文本中,大多数人使用破折号,但只有 _ 可以成为大多数语言中函数/变量名称的一部分.)
  • AMD64 或 amd64
  • (仅限 Windows)x64
  • (主要仅在 Intel CPU 架构文档中,这些并不流行,我还没有在软件目录名称或配置选项中看到它们)IA-32e 或 Intel64.显然,e"代表扩展".https://en.wikipedia.org/wiki/X86-64#Intel_64 有一个提到命名的历史部分.

不是 IA-64,这是一个单独的架构.

当然,如果你想学究,x86-64 CPU需要支持legacy模式,所以你可以在x86-64 CPU上运行纯32位操作系统,而且仍然64 位 CPU.

对于运行 32 位用户空间的 64 位内核,CPU 处于兼容"模式,这与 32 位保护模式很多相似,除了页表格式具有52 位物理地址.(超过来自 PAE 页表的 36 位物理地址宽度,x86-64 页表格式基于它.)用户空间将很难区分在 32 位内核下运行与在 32 位内核下运行之间的区别.一个 64 位内核,除了特定于操作系统的东西,比如通过系统调用询问内核.

<小时>

软件目录名称

许多项目使用 i386x86-64amd64.这将是我的建议,因为这是最不明确的.(或者,如果您并不真正关心与比 PPro 旧的 CPU 的兼容性,也可以使用 i686.)

有些,例如 GMP(GNU MultiPrecision 库),它为许多架构手写了 asm,使用x86"和x86_64".https://gmplib.org/repo/gmp/file/tip/mpn.

(GMP 有针对不同 x86 CPU 的相同功能的多个手动调整版本.在x86"中,有针对 Pentum、Core 2、Haswell 和/或利用指令调整的不同版本功能的子目录-设置像 BMI2 这样的扩展名.这很不寻常;大多数项目都没有具体说明.例如,有些项目可能会有一些东西可以利用 AVX 或 AVX512 或 SSE4.1,但这通常只是在源文件中.)

This question is about terminology for 32-bit vs. 64-bit x86.

If I have 2 directories with source code of the same program - one for 32-bit Windows and another for 64-bit Windows, what will be the more correct names for these folders:

  • x86-64 and x64?
  • or IA-32 and x64?

I already have read some web resources, but can't understand. Just for the record:

解决方案

x86 can be a broad term that covers all CPUs that are backwards-compatible with 8086, and all extensions to the architecture including x86-64.

Note that IA-64 is not x86 at all, it's Itanium (a 64-bit VLIW architecture with explicit speculation / parallelism). It was also designed by Intel, but is totally unrelated to x86 in terms of compatibility or design. (Early IA-64 CPUs also had an x86 core integrated, for compatibility. Intel was pushing IA-64 while AMD was pushing AMD64/x86-64)

Intel sometimes talks about their CPUs as having IA cores + the integrated GPU and the other logic outside of each IA core. (IA = Intel Architecture = x86).


32-bit x86 specifically (excluding 16-bit or 64-bit) can be called

  • IA-32 (used sometimes by Intel)
  • i386 or i686 (common on Linux)
  • (Windows only): x86. Yes really: in the Windows world, "x86" specifically means 32-bit. That's why you have a Program Files (x86) directory with that name. This choice causes potential terminology confusion for everyone, because "x86" is still by far the best way to refer to the architecture in general, as opposed to ARM or MIPS.
  • rarely: x86-32. This is not used officially by any hardware or software vendors I'm aware of, but it is a useful term that's unambiguous.

Never call it x32. x32 is an ILP32 variant of the x86-64 System V ABI: 32-bit pointers in 64-bit mode. https://en.wikipedia.org/wiki/X32_ABI


64-bit x86 is easier to refer to specifically (excluding 32 and 16-bit):

  • x86-64 or x86_64 (the dash vs. underscore is not at all significant. In text most people use a dash, but only _ can be part of function/variable names in most languages.)
  • AMD64 or amd64
  • (Windows only) x64
  • (Mostly only in Intel CPU-architecture documentation, these aren't popular and I haven't seen them in software directory names or config options) IA-32e or Intel64. The "e" stands for "extensions", apparently. https://en.wikipedia.org/wiki/X86-64#Intel_64 has a History section that mentions naming.

Not IA-64, that's a separate architecture.

Of course if you want to be pedantic, x86-64 CPUs are required to support legacy mode, so you can run a pure 32-bit OS on an x86-64 CPU, and it's still a 64-bit CPU.

With a 64-bit kernel running 32-bit user-space, the CPU is in "compatibility" mode, which is a lot like 32-bit protected mode except the page-table format has 52-bit physical addresses. (More than the 36-bit physical address width from PAE page tables, which the x86-64 page-table format is based on.) User-space would be hard pressed to tell the difference between running under a 32-bit kernel vs. a 64-bit kernel, except for OS-specific stuff like asking the kernel with a system call.


Software directory names

Many projects go with i386 vs. x86-64 or amd64. That would be my recommendation as the least ambiguous. (Or maybe i686 if you don't really care about compat with CPUs older than PPro.)

Some, like GMP (the GNU MultiPrecision library) which has hand-written asm for many architectures, uses "x86" and "x86_64". https://gmplib.org/repo/gmp/file/tip/mpn.

(GMP has multiple hand-tuned versions of the same function for different x86 CPUs. Within "x86", there are subdirectories with different versions of functions tuned for Pentum, Core 2, Haswell, and/or taking advantage of instruction-set extensions like BMI2. This is unusual; most projects don't get that specific. Some will maybe have some stuff to take advantage of AVX or AVX512, or SSE4.1 for example, but that's often just within source files.)

这篇关于引用 32 位和 64 位版本程序的最正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆