LIDT的操作数是位移/绝对地址
我偶然发现英特尔软件开发人员手册中的一句话: “对于 LGDT、LIDT、LLDT、LTR、SGDT、SIDT、SLDT、STR,退出限定接收指令位移字段的值,如有必要,该值会符号扩展为 64 位(在不支持 Intel 的处理器上为 32 位) 64 架构)。如果指令没有位移(例如,有寄存器操作数),则将零存储到退出限定中“
现在,如果我有指令 LIDT 0xf290,那么“0xf290”是位移吗?我认为答案是肯定的。
那么,我的困惑是什么构成了位移?我的印象是位移是根据当前 eip 值计算的。 例如。 jmp xxx (在段内跳转中,这将是一个位移。但对于段间跳转,它应该是绝对地址。)如果是这种情况,那么为什么 LIDT 加载相对地址?
I stumbled upon a statement in Intel Software developers manual:
"For LGDT, LIDT, LLDT, LTR, SGDT, SIDT, SLDT, STR, the exit qualification receives the value of the instruction’s displacement field, which is sign-extended to 64 bits if necessary (32 bits on processors that do not support Intel 64 architecture). If the instruction has no displacement (for example, has a register operand), zero is stored into the exit qualification. "
Now if I have an instruction LIDT 0xf290, then is "0xf290" a displacement? I think answer is yes.
So, my confusion is what all constitute as displacement? I was under impression that displacement is something which is calculated with respect to current eip value.
For eg. jmp xxx (In intrasegment jumps this will be a displacement. But for intersegment jumps, it should be absolute address.) If that is the case then why LIDT loads a relative address?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
位移只是距某个原点的偏移量,可以是
Base+Index*Scale
,或0。x86 可以容纳大值的另一个操作数是 >immediate,这对于添加常量之类的事情很有用(例如ADD $42,%eax
)。顺便说一句,相对跳转似乎使用了“立即”字段,可能是因为它们通过常量修改了“EIP”。
A displacement is just an offset from some origin, which may be a
Base+Index*Scale
, or 0. The other operand x86 has that can hold large values is immediate, which is useful for things like adding constants (e.g.ADD $42, %eax
).Incidentally, it appears that relative jumps use the immediate field, probably because they modify
EIP
by a constant.