Substitutes for x86 assembly 'call' instruction?

rick picture rick · Aug 15, 2011 · Viewed 23.7k times · Source

What are some alternatives to the x86 call instruction? Maybe something like a push of the return address then a jump?

Also is their a command for obtaining the current position in memory?

Answer

Jesus Ramos picture Jesus Ramos · Aug 15, 2011

The call instruction actually does this for you. For example call my_func would do something like:

push ret_address
jmp my_func

A subsequent ret call would just use the address you just pushed to jmp back in a sense. Is there a specific reason that you don't want to use call or is it not available for you? For current position in memory you can try to read the eip register (can't write to it).