Reputation: 51
I have question.When I know that
call <address>
is equivalent to
push rip
jmp <address>
and I also know that
ret
is equivalent to
pop rip
jmp <rip>
But if we jump to rip why don’t we start this loop again because we push rip before jump and rip specify on jump? Can you explain how do we pass this jump in code
Upvotes: 1
Views: 1417
Reputation: 41170
Various processors have different ways of handling this. On some, the call
pushes the address of the instruction after the call. On others, the ret
adds the length of the call instruction to the return address before jumping.
The first method is more flexible because it makes it possible to use various addressing modes with different instruction lengths in the call
. It's also likely that the instruction decoder already knows the location of the next instruction as the call
is being processed.
Upvotes: 4