You cannot directly touch the instruction pointer, but you can get it if you need with a simple trick:
fetch_eip: mov eax, [esp] ret
Then:
call fetch_eip
Put the value eip , the instruction pointer, in eax (because it will be that the esp stack pointer was referenced when fetch_eip called).
It is not eip that eip was the destination of the mov operation, so you cannot play with eip directly. The only way to influence this is with jump operations, call operations (as used by this trick), and some other limited cases.
source share