首页
社区
课程
招聘
[旧帖] Intel指令手册问题 0.00雪花
发表于: 2007-3-23 10:21 4688

[旧帖] Intel指令手册问题 0.00雪花

2007-3-23 10:21
4688
我阅读的是第二卷,Chapter2 Instruction Format.

有些地方实在不明白:

2.4. MODR/M AND SIB BYTES
Most instructions that refer to an operand in memory have an addressing-form specifier byte
(called the ModR/M byte) following the primary opcode. The ModR/M byte contains three
fields of information:
• The mod field combines with the r/m field to form 32 possible values: eight registers and
24 addressing modes.
• The reg/opcode field specifies either a register number or three more bits of opcode information.
The purpose of the reg/opcode field is specified in the primary opcode.
• The r/m field can specify a register as an operand or can be combined with the mod field to
encode an addressing mode.
Certain encodings of the ModR/M byte require a second addressing byte, the SIB byte, to fully
specify the addressing form. The base-plus-index and scale-plus-index forms of 32-bit
addressing require the SIB byte. The SIB byte includes the following fields:
• The scale field specifies the scale factor.
• The index field specifies the register number of the index register.
• The base field specifies the register number of the base register.
See Section 2.6., “Addressing-Mode Encoding of ModR/M and SIB Bytes

如果能列举一个例子也许还能读懂,什么样的汇编指令?哪条用到SIB了,如何fully specify the addressing form?

2.6. ADDRESSING-MODE ENCODING OF MODR/M AND SIB BYTES

第四段:
Across the top of Tables 2-1 and 2-2, the eight possible values of the 3-bit Reg/Opcode field are
listed, in decimal (sixth row from top) and in binary (seventh row from top). The seventh row is
labeled “REG=”, which represents the use of these 3 bits to give the location of a second
operand, which must be a general-purpose, MMX, or XMM register. If the instruction does not
require a second operand to be specified, then the 3 bits of the Reg/Opcode field may be used as
an extension of the opcode, which is represented by the sixth row, labeled “/digit (Opcode)”.

能不能举个例子?指令不需要第二个操作数,3 bits of Reg/Opcode域会成为扩展?太抽象了,能不能给一条汇编指令

我自己可以反汇编来看看。

APPENDIX B
INSTRUCTION FORMATS AND ENCODINGS

B.1. MACHINE INSTRUCTION FORMAT

The primary opcode for an instruction is encoded in one or two bytes of the instruction. Some
instructions also use an opcode extension field encoded in bits 5, 4, and 3 of the ModR/M byte.
Within the primary opcode, smaller encoding fields may be defined. These fields vary according
to the class of operation being performed. The fields define such information as register encoding,
conditional test performed, or sign extension of immediate byte.

这段更令人费解:主要操作码中,什么时smaller encoding fields, conditional test 和sign extension又是指什么,

感觉都没有这样的汇编指令对应一样,能否也给条汇编指令的例子?

[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 295
活跃值: (346)
能力值: ( LV9,RANK:530 )
在线值:
发帖
回帖
粉丝
2
对应 2.4 的一例子:
00471762      03848D 78563412            ADD EAX,DWORD PTR SS:[EBP+ECX*4+12345678]
其中:
    03          ---- primary opcode
    84          ---- ModR/M byte
    8D          ---- SIB
    78564312    ---- Address displacement
2007-3-24 02:15
0
游客
登录 | 注册 方可回帖
返回
//