From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5eEP-0006zl-Ad for qemu-devel@nongnu.org; Mon, 19 Sep 2011 09:50:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5eEO-0006fd-3a for qemu-devel@nongnu.org; Mon, 19 Sep 2011 09:49:57 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:60716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5eEN-0006fW-V0 for qemu-devel@nongnu.org; Mon, 19 Sep 2011 09:49:56 -0400 Received: by gxk26 with SMTP id 26so6182325gxk.4 for ; Mon, 19 Sep 2011 06:49:55 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 19 Sep 2011 14:49:54 +0100 Message-ID: From: Peter Maydell Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] op-helper.c vs helper.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Xin Tong Utoronto Cc: qemu-devel@nongnu.org On 19 September 2011 13:06, Xin Tong Utoronto wrote: > There are 2 files on helpers in target-ppc and target-i386 (=C2=A0op-help= er.c > =C2=A0helper.c), what are their differences ? also, what kind of function= s are > typically emulated using helpers ? The key difference is that op_helper.c is compiled with compiler flags and includes header files that give it access to a global variable 'CPUState *env' which is kept in a fixed CPU register during execution of translated code. helper.c (and other foo_helper.c files) are built as regular C files, and so if they need access to the CPU state it has to be passed into the helper as an explicit parameter. We're currently trying to cut back on the use of the implicit global, so new helper functions should probably go in helper.c. > also, what kind of functions are typically emulated using helpers ? Anything that seems too hard to do inline :-) tcg/README has a paragraph at the end giving some rules of thumb. -- PMM