欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

[英特尔 IA-32 架构软件开发人员手册第 3 卷:系统编程指南]译自 2001 年版,1-9

最编程 2024-10-19 07:21:08
...

文件下载与邀请翻译者

学习英特尔开发手册,最好手里这个手册文件。原版是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 是大家必须要去学习的一门汇编语言。

上一篇: VIII.随机名称功能

下一篇: 建立*