【译】x86程序员手册06 - 2.4指令格式
2.4 Instruction Format?指令格式
?
The information encoded in an 80386 instruction includes a specification of the operation to be performed, the type of the operands to be manipulated, and the location of these operands. If an operand is located in memory, the instruction must also select, explicitly or implicitly, which of the currently addressable segments contains the operand.
80386指令的編碼信息包括操作如何進行的說明,操作數類型,操作數的位置。如果一個操作數在內存中,指令必須明確或隱式地選擇當前包含操作數的可編址段。
80386 instructions are composed of various elements and have various formats. The exact format of instructions is shown in Appendix B; the elements of instructions are described below. Of these instruction elements, only one, the opcode, is always present. The other elements may or may not be present, depending on the particular operation involved and on the location and type of the operands. The elements of an instruction, in order of occurrence are as follows:
80386的指令由可變元素組成,并且有多種格式。準確的指令格式被列在附錄B中;指令的元素在下面說明。在這些指令元素中,只有一個元素,即opcode,就必須存在項。其他的元素可以有也可以沒有,這依賴于特定的操作和操作數類型的位置。這些元素,按出現的順序列在下面:
- Prefixes -- one or more bytes preceding an instruction that modify the operation of the instruction. The following types of prefixes can be used by applications programs:
前綴 —— 一個或多個字節出現在指令中,修改指令操作。下面列出的前綴類型可以在應用程序中使用:
段覆蓋 —— 明確指定該指令使用哪個段寄存器,因此會覆蓋掉80386為這些指令選擇的默認寄存器。
地址大小 —— 32位和16位地址開關
操作數大小 —— 32位和16位操作數開關
重復 —— 在字符串指令中使用,指示指令在字符串的每個元素中使用。
- Opcode -- specifies the operation performed by the instruction. Some operations have several different opcodes, each specifying a different variant of the operation.
操作符 —— 指定指令的操作。一些操作有多個不同的操作符,每一個指定不同的可變的操作。
- Register specifier -- an instruction may specify one or two register operands. Register specifiers may occur either in the same byte as the opcode or in the same byte as the addressing-mode specifier.
寄存器區分符 —— 一條指令可指定一個或兩個寄存器操作數。寄存器區分符即可以放在一個字節中作為操作符,或者放在同一個字節中作為地址模式區分符。
- Addressing-mode specifier -- when present, specifies whether an operand is a register or memory location; if in memory, specifies whether a displacement, a base register, an index register, and scaling are to be used.
地址模式區分符 —— 當出現時,用來區分一個操作數是在寄存器還是內存位置;如果在內存中,區分是一個置位符、基址寄存器、索引寄存器還是比例因子。
- SIB (scale, index, base) byte -- when the addressing-mode specifier indicates that an index register will be used to compute the address of an operand, an SIB byte is included in the instruction to encode the base register, the index register, and a scaling factor.
SIB(比例,索引,基址)字節 —— 當地址模式區分符表明有一個索引寄存器被用來計算一個操作數的地址時,SIB字節也被包含在指令中,用來編碼基址寄存器、索引寄存器和比例因子。
- Displacement -- when the addressing-mode specifier indicates that a displacement will be used to compute the address of an operand, the displacement is encoded in the instruction. A displacement is a signed integer of 32, 16, or eight bits. The eight-bit form is used in the common case when the displacement is sufficiently small. The processor extends an eight-bit displacement to 16 or 32 bits, taking into account the sign.
置位符 —— 當地址模式區分符表明一個置位符被用來計算一個操作數的地址時,置位符也被編碼到指令中。一個置位符是一個32、16或8位的整數。8位通常用來表示置位符相當小。處理器擴展一個8位置位符到16或者32位,包括符號。
- Immediate operand -- when present, directly provides the value of an operand of the instruction. Immediate operands may be 8, 16, or 32 bits wide. In cases where an eight-bit immediate operand is combined in some way with a 16- or 32-bit operand, the processor automatically extends the size of the eight-bit operand, taking into account the sign.
立即數 —— 當存在時,為指令直接提供一個數值。立即數可以是8、16或32位寬度。一旦8位立即數和16位或32位操作數進行組合時,處理器自動擴展8位操作數的大小,包括符號位。
轉載于:https://www.cnblogs.com/mqmelon/p/6692146.html
總結
以上是生活随笔為你收集整理的【译】x86程序员手册06 - 2.4指令格式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: HDU 3938 Portal
- 下一篇: ECMAScript5.1的运算符、类型