开发者

difficulty understanding different kinds of call statements

Considering the followin开发者_StackOverflowg kinds of CALL statements, I fail to understand the difference clearly.

CALL EAX

and

CALL DWORD PTR[EAX]


CALL EAX

Will call whatever address is in eax. If eax directly stores a function address, this is the right way.

CALL DWORD PTR[EAX]

Will first dereference whatever address is in eax and jump to the result of that. If eax stores a function pointer, this is the right way.


The first form calls the function whose address is stored in eax.

The second calls the function whose address is stored at the memory location whose address in turn is stored in eax (that's simply one more level of indirection).


CALL EAX

will take the value of EAX and jump to that value.

CALL DWORD PTR [EAX]

will take the value of EAX, and then dereference it(look it up in memory) and then call it.

so in C terms..

function_ptr=eax;
//v.s.
function_ptr=*eax;

or

(eax)();
//v.s.
(*eax)();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜