Hi,
I want to get the current value of the EIP register with assembly language. Is that possible?
Thanks.
Hi,
I want to get the current value of the EIP register with assembly language. Is that possible?
Thanks.
Since EIP
is the program counter, there's no way to access it directly (i.e. it can't be used as the source of a MOV instruction).
There are two ways to access it indirectly:
EIP
from the stack,EIP
) from the stack.See http://www.programmersheaven.com/mb/x86_asm/357735/357735/get-the-value-of-eip/#357740.
Assuming 32-bit x86, use the following function:
get_eip: mov eax, [esp]
ret
Then, to get the value of EIP in EAX, simply:
call get_eip