Hi,
ITchimp wrote:
I got a simple procedure to get the instruction pointer value
unsigned long long getRIP(){
unsigned long long l1=0LL;
asm("movq %%rip, %0":"=r"(l1));
return l1;
//return -1ULL;
}
gcc gives me the error message
testRIP.c: Assembler messages:
testRIP.c:5: Error: operand type mismatch for `movq'
my thought is that rip is s 64 bit value... define unsigned long long should be a 64 bit value...
so where ishte operand type mismatch from?
The "MOV" instruction only works with general purpose registers, and RIP isn't considered a general purpose register. To do what you want you'd need to use RIP relative addressing and LEA.
I don't know what the syntax is for AT&T/GAS, but maybe something like "lea $0(%%rip), %0" might work.
Cheers,
Brendan