Reading program counter directly
No, EIP / IP cannot be accessed directly, but in position-dependent code it’s a link-time constant so you can use a nearby (or distant) symbol as an immediate. mov eax, nearby_label ; in position-dependent code nearby_label: To get EIP or IP in position-independent 32-bit code: call _here _here: pop eax ; eax now holds the … Read more