<--- Turn the page     (contents page)     Turn the page --->


Assembler

How do I get the contents of the (E)IP register




Shortly ago, the question of how to get the contents of the (E)IP register was asked in alt.lang.asm. I think the best answer was given by Jack Klein:

.model tiny
.code

     call get_ip
     ; ax now = ip (here)
     .exit

get_ip  proc
        pop  ax   ; ax now equals IP (next instruction after the CALL)
        push ax   ;  we need to place it back on the stack for the RET.
        ret
get_ip  endp

.end
If you want the EIP register, simply replace with POP EAX/PUSH EAX.

Jacks' home page: http://jackklein.home.att.net

Thanks Jack, ¥


<--- Turn the page     (contents page)     Turn the page --->

Page 9