From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6zFv-0005RQ-Ry for qemu-devel@nongnu.org; Wed, 28 Apr 2010 00:52:15 -0400 Received: from [140.186.70.92] (port=48806 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6zFt-0005RG-HQ for qemu-devel@nongnu.org; Wed, 28 Apr 2010 00:52:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6zFr-0003vd-5u for qemu-devel@nongnu.org; Wed, 28 Apr 2010 00:52:13 -0400 Received: from mail-iw0-f196.google.com ([209.85.223.196]:38573) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6zFq-0003vY-T8 for qemu-devel@nongnu.org; Wed, 28 Apr 2010 00:52:11 -0400 Received: by iwn34 with SMTP id 34so10343773iwn.23 for ; Tue, 27 Apr 2010 21:52:10 -0700 (PDT) MIME-Version: 1.0 From: Jun Koi Date: Wed, 28 Apr 2010 13:51:49 +0900 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] Question on implementatio of GETPC() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 .... When we call GETPC, we get the address of , 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