【英特尔IA-32架构软件开发者开发手册第3卷:系统编程指南】2001年版翻译,1-9

文件下载与邀请翻译者

学习英特尔开发手册,最好手里这个手册文件。原版是PDF文件。点击下方链接了解下载方法。

讲解下载英特尔开发手册的文章

翻译英特尔开发手册,会是一件耗时费力的工作。如果有愿意和我一起来做这件事的,那么,欢迎你的加入。

另外,我不仅仅是打算翻译这一种手册,以后,可能还需要去翻译许多的英文技术文档,以支持系统底层的教学,培养系统底层程序员。

我有钱了以后,应该是会出私钱来请人翻译一批英文技术文档。当前,暂时没钱,若是有志愿加入的,欢迎啊。

本节翻译

【原文】1.5.3. Instruction Operands
When instructions are represented symbolically, a subset of the IA-32 assembly language is used. In this subset, an instruction has the following format:
label: mnemonic argument1, argument2, argument3
where:
• A label is an identifier which is followed by a colon.
• A mnemonic is a reserved name for a class of instruction opcodes which have the same function.
• The operands argument1, argument2, and argument3 are optional. There may be from zero to three operands, depending on the opcode. When present, they take the form of either literals or identifiers for data items. Operand identifiers are either reserved names of registers or are assumed to be assigned to data items declared in another part of the program (which may not be shown in the example).

【翻译】1.5.3. 指令操作数

当指令用符号表示时,使用IA-32汇编语言的一个子集。在这个子集中,指令具有以下格式:

标签:助记符 argument1, argument2, argument3

地点:

标签是一个标识符,后面跟一个冒号。

助记符是一组具有相同功能的指令操作码的保留名称。

•操作数argument1、argument2和argument3是可选的。根据操作码的不同,可以有0到3个操作数。当出现时,它们采用数据项的字面量或标识符的形式。操作数标识符要么是寄存器的保留名称,要么被假定分配给在程序的另一部分声明的数据项(在示例中可能没有显示)。

【原文】When two operands are present in an arithmetic or logical instruction, the right operand is the source and the left operand is the destination.

For example:

LOADREG: MOV EAX, SUBTOTAL

In this example LOADREG is a label, MOV is the mnemonic identifier of an opcode, EAX is the destination operand, and SUBTOTAL is the source operand. Some assembly languages put the source and destination in reverse order.

【翻译】当算术或逻辑指令中存在两个操作数时,右操作数是源操作数,左操作数是目的操作数。

例如:

LOADREG: MOV EAX, SUBTOTAL

在这个例子中,LOADREG是一个标签,MOV是操作码的助记符标识符,EAX是目的操作数,SUBTOTAL是源操作数。有些汇编语言将源和目标按相反的顺序排列。

【讲评】一般来讲,C语言,C++这种高级语言,它们的语法比较一致。尤其是像C语言,它的跨平台性很棒。而对于汇编语言,则语法规则会有一定的不同。同样是用来编译英特尔 IA-32 架构的汇编语言,GNU AS 汇编器与 NASM 汇编器就很不同。

手册中说,有的汇编器将源操作数和目的操作数按照相反的方向放置,它所指的,大概就是 GNU AS 汇编器。

比如说,在 NASM 汇编里面,我们将立即数 0x1234 放入寄存器 EAX 里面,汇编指令码如下。

mov eax, 0x1234

而在 GNU AS 汇编器里面,写法如下所示。

movl $0x1234, %eax

关于 NASM 汇编与 GNU AS 汇编的详细语法知识,还请大家在各自的教材与教程里面去学习。这里,我只是略微举个例子。

以后,若是有机会,我会去设置专栏来讲解 GNU AS 汇编语法。因为,当代的开源的 Linux 内核六面,所采用的汇编语法,便是 GNU AS 汇编语法。想要学习系统底层知识,学习操作系统原理,那么, GNU AS 是大家必须要去学习的一门汇编语言。

相关推荐
用户120487221614 小时前
Linux驱动编译与加载
linux·嵌入式
用户8055336980310 小时前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户8055336980310 小时前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房1 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia2 天前
linux curl命令详解_curl详解
linux
扛枪的书生2 天前
Linux 网络管理器用法速查
linux
顺风尿一寸2 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode2 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫3 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao4 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80