2 ms·
There was no way in 80386, except by pushing EIP on the stack within a CALL. In 64-bit Intel/AMD CPUs, the instruction LEA (load effective address), with an ad
by adrian_b 3y ago
There was no way in 80386, except by pushing EIP on the stack within a CALL.
In 64-bit Intel/AMD CPUs, the instruction LEA (load effective address), with an address relative to RIP, can be used to save the instruction pointer in a register, then a jump to any address will arrive there providing the old instruction pointer in the register, ready to be used without popping it from the stack.
In all modern pipelined CPUs there are multiple copies of the instruction pointer, one that runs ahead providing the instruction fetch addresses, and an older value that provides base addresses for relative jumps and for relative loads or stores.