Understanding %rip register in intel assembly

RIP addressing is always relative to RIP (64bit Instruction Pointer) register. So it can be use for global variables only. The 0 offset is equal to address of the following instruction after the RIP-addressed instruction. For example: mov al,[rip+2] al=53 jmp short next (length=2 bytes) db 53 next: mov bl,[rip-7] (length=6 bytes) bl=53 You wouldn’t … Read more

Why does the ARM PC register point to the instruction after the next one to be executed?

It’s a nasty bit of legacy abstraction leakage. The original ARM design had a 3-stage pipeline (fetch-decode-execute). To simplify the design they chose to have the PC read as the value currently on the instruction fetch address lines, rather than that of the currently executing instruction from 2 cycles ago. Since most PC-relative addresses are … Read more