如何不同的是,大会的32位Intel处理器的64位版本? [英] How different is the Assembly for 32bit Intel processors to the 64bit version?

查看:115
本文介绍了如何不同的是,大会的32位Intel处理器的64位版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始学习大会却得到了这本书的第一个句子中的一个担心:

I have started learning Assembly but got worried with one of the first sentences of this book:

在这本书中,我们侧重于像奔腾英特尔32位处理器的汇编语言。

如何不同的是,大会的32位到64位呢?
是否值得学习双方或学习的32位我会被罚款64位的?

How different is the Assembly for 32-bit to the 64-bit one? Is it worth to learn both or by learning 32-bit I will be fine with 64-bit one?

推荐答案

64位模式引入了一些结构变化。结果
一个不完整的名单可以对<一章3.2.1中找到href=\"https://www-ssl.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-vol-1-manual.html\"相对=nofollow>英特尔手册1

64 bit mode introduced some architectural changes.
An incomplete list can be found on chapter 3.2.1 of Manual 1 from Intel

•地址空间 - 在一个IA-32处理器中的任务或程序在64位模式下运行可以解决线性地址
  达2 ^ 64字节(受节3.3.7.1中所述的典型寻址要求)和空间
  达2 ^ 46字节的物理地址空间。软件可以查询CPUID为所支持的物理地址大小
  由处理器。

• Address space — A task or program running in 64-bit mode on an IA-32 processor can address linear address space of up to 2^64 bytes (subject to the canonical addressing requirement described in Section 3.3.7.1) and physical address space of up to 2^46 bytes. Software can query CPUID for the physical address size supported by a processor.

[previously这是唯一可能解决多达4吉布(不是所有可用于当然RAM),而不是当前限制为64的TiB]

•基本程序执行寄存器 - 通用寄存器的数量(GPRS)可为16。
  GPR是64位宽,他们支持字节,字,双字和四字整数操作。
  访问字节寄存器被均匀地完成到最低8位。指令指针寄存器变为64位。
  的,EFLAGS寄存器扩展到64位宽,并作为RFLAGS寄存器提及。的高32位
  RFLAGS的被保留。 RFLAGS的低32位是一样的EFLAGS。参见图3-2。

•Basic program execution registers — The number of general-purpose registers (GPRs) available is 16. GPRs are 64-bits wide and they support operations on byte, word, doubleword and quadword integers. Accessing byte registers is done uniformly to the lowest 8 bits. The instruction pointer register becomes 64 bits. The EFLAGS register is extended to 64 bits wide, and is referred to as the RFLAGS register. The upper 32 bits of RFLAGS is reserved. The lower 32 bits of RFLAGS is the same as EFLAGS. See Figure 3-2.

[86有8个通用寄存器:EAX,EBX,EBX,EDX,ESI,EDI,EBP,EDI。每32位。现在有16个GP寄存器的64位,:RAX,RBX,RCX,RDX,RSI,RDI,RBP,RSP,R8-R15。这些寄存器的低32位是旧的32位寄存器。其他寄存器和扩展作了寻址,如BPL]

•XMM寄存器 - 有对SIMD运算16 XMM数据寄存器。见10.2节,上交所编程
  环境,有关这些寄存器的更多信息。

• XMM registers — There are 16 XMM data registers for SIMD operations. See Section 10.2, "SSE Programming Environment," for more information about these registers.

[previously当时只有8 XMM0-128 XMM7位SIMD寄存器。同样与AVX青运]

•堆栈 - 堆栈指针大小为64位。堆栈大小不受的SS描述符位(因为它是在
  非64位模式下),也可以将指针大小由指令preFIX覆盖。

• Stack — The stack pointer size is 64 bits. Stack size is not controlled by a bit in the SS descriptor (as it is in non-64-bit modes) nor can the pointer size be overridden by an instruction prefix.

[正如预期的那样,堆栈指针RSP]

•控制寄存器 - 控制寄存器扩展到64位。一个新的控制寄存器(任务优先级寄存器:CR8
  或TPR)已被加入。参见第2章,英特尔®64和IA-32架构,在这本书。结果
  •调试寄存器 - 调试寄存器扩展到64位。参见第17章,调试,分公司简介,TSC海洋集团,
  优质的服务,英特尔®64和IA-32架构软件开发手册,卷3A。

• Control registers — Control registers expand to 64 bits. A new control register (the task priority register: CR8 or TPR) has been added. See Chapter 2, "Intel® 64 and IA-32 Architectures," in this volume.
• Debug registers — Debug registers expand to 64 bits. See Chapter 17, "Debug, Branch Profile, TSC, and Quality of Service," in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A.

[这是用于容纳64位指针]

这是大多是入门清单,还有其他的变化:

This is mostly an introductory list, there are other changes:


  • 持有的地址是64位,现在,随着经验法则的一切。

  • 分割是在64位模式(也称为长模式)禁用,只的 FS 的和的 GS 选择的描述符基地和限制非常荣幸。

  • 某些指令,如 INC AX 的一个字节形式没有更多的可编码(即使用)由于引进的 REX 的$ P $的PFIX。

  • 在32位算术运算寄存器清晰完整的64位的高32位寄存器(即 MOV EAX,1 清除中的 RAX <上DWORD / EM>)。

  • 在运code级,最直接的操作数仍然是32位,但符号扩展。这就像添加指令EBX,0123456789ABCDEFH 不是可编码的。

  • 物理地址必须是规范的,以避免混淆,即符号扩展到64位。

  • 一个新的寻址模式是可用的:相对RIP,即,从当前指令地址偏移可以被用来访问数据。这有助于位置无关code。

  • Everything that hold an address is 64 bits now, as rule of thumb.
  • Segmentation is disabled in 64 bit mode (a.k.a. long mode), only FS and GS selected descriptor bases and limits are honored.
  • Some instruction, like one byte form of inc ax are no more encodable (i.e. usable) due the introduction of the REX prefix.
  • Arithmetic operations on the 32 bits registers clear the upper 32 bits of the full 64 bits register (i.e. mov eax, 1 clears the upper DWORD of RAX).
  • At opcode level, most immediate operands are still 32 bits but sign extended. This instructions like add ebx, 0123456789abcdefh are not encodable.
  • Physical addresses must be canonical to avoid aliasing, i.e. be sign extended to 64 bits.
  • A new addressing mode is available: RIP relative, i.e. an offset from the current instruction address can be used to access data. This helps with Position Independent Code.

这一切仍然是preliminary,你可以谷歌,如果有兴趣的相关条款或看看的<一个href=\"https://www-ssl.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html\"相对=nofollow>英特尔手册的。

All this is still preliminary, you can google for related terms if interested or take a look at the Intel manuals.

不过究竟会打你最当从32位到64位开关是在 ABI <更改/ A>使用,你需要到运行时库过程的调用相适应。

However what will strike you the most when switching from 32 to 64 bits is the change in the ABI used, you'll need to adapt the calls to the runtime library procedures.

作为变化的例子:搜索
现在的参数在寄存器(第一个四肢着地),堆栈必须对准传递,向量寄存​​器用于浮点,红色区域/转储区可在堆栈中。

As an example of changes:
Parameters are now passed on the registers (the first fours), the stack must be aligned, vector registers are used for floating point, a red zone/dump zone is available on the stack.

每个平台都有自己的ABI,你可以检查,例如,的 SysV的ABI 的一个完整的清单。

Each platform has its own ABI, you can check, for example, the SysV ABI for a full list.

这篇关于如何不同的是,大会的32位Intel处理器的64位版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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