qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Question on implementatio of GETPC()


From: Jun Koi
Subject: [Qemu-devel] Question on implementatio of GETPC()
Date: Wed, 28 Apr 2010 13:51:49 +0900

Hi,

In x86, GETPC() is implemented as below:

# define GETPC() ((void *)((unsigned long)__builtin_return_address(0) - 1))

As I understand, it gets the returned address on the stack, then
subtract 1 to get back to the above address.

Imagine we have code like this (pseudo asm code):

....
CALL <relative address>
<next-insn>
....

When we call GETPC, we get the address of <next-insn>, and subtract 1.
But the problem is that the CALL insn is more than 1 byte, so how can
GETPC() gives us the address of the CALL insn above?

I guess I must misunderstood something here ....

Many thanks,
Jun




reply via email to

[Prev in Thread] Current Thread [Next in Thread]