开发者

operand of LIDT is displacement/absolute address

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开发者_StackOverflow 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜