I have a Windows Mobile 6 ARMV4I project where I would like to get the value of the program counter.
The function is declared like this:
extern "C" unsigned __int32 GetPC();
My assembly code looks like this:
GetPC FUNCTION
EXPORT GetPC
ldr r0, [r15] ; load the PC value in to r0
mov pc, lr ; return the value of r0
ENDFUNC
But, when I call the GetPC()
function, I get the same number every time. So, I'm assuming my assembly isn't doing what I think it's doing. Can anybody point out what I may be doing wrong?
Thanks, PaulH