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

2010-04-28 Thread Jan Kiszka
Jun Koi wrote: > On Wed, Apr 28, 2010 at 5:12 PM, Jan Kiszka wrote: >> Jun Koi wrote: >>> 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, the

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

2010-04-28 Thread Jun Koi
On Wed, Apr 28, 2010 at 5:12 PM, Jan Kiszka wrote: > Jun Koi wrote: >> 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 ba

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

2010-04-28 Thread Jan Kiszka
Jun Koi wrote: > 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 thi