access instruction pointer


Hello,

I wish to access the instruction pointer (mainly to confirm alignment in a release build)
.

I am using masm 64.

I have tried:

mov r11, rip

However, the assembler doesn't recognize "rip".

Thanks.

P.S.


If I modify a compiler generated .asm file, can I simply replace any npad directives with the following line?:

align 16

Wouldn't that accomplish the same thing?












Comments

  • from the procedure you want to know the RIP from call a subroutine. That subroutine reads the return address from stack WITHOUT modifying the stackpointer, mov rax, [rsp - 8] (thats where the return address is on stack) and return to the caller with RIP from return address in RAX.
    A warning though is: if you are using assembly language in higher level languages (c++, ...) you must create a stackframe.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion