From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLFdN-00024u-Jc for qemu-devel@nongnu.org; Tue, 01 Nov 2011 10:48:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLFdJ-00016u-8H for qemu-devel@nongnu.org; Tue, 01 Nov 2011 10:48:13 -0400 Received: from mail-bw0-f45.google.com ([209.85.214.45]:38254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLFdJ-00016h-2u for qemu-devel@nongnu.org; Tue, 01 Nov 2011 10:48:09 -0400 Received: by bkbzu5 with SMTP id zu5so1925743bkb.4 for ; Tue, 01 Nov 2011 07:48:07 -0700 (PDT) From: Max Filippov Date: Tue, 1 Nov 2011 18:47:59 +0400 References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201111011848.00009.jcmvbkbc@gmail.com> Subject: Re: [Qemu-devel] cpu_x86() ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi Cc: qemu-devel@nongnu.org > > cpu_exec definition in cpu-exec.c takes place after #include "cpu.h" > > which contains #define cpu_exec whatever. > > In case of x86 cpu_x86_exec is actually defined by the cpu-exec.c. > > > > ok, so which means cpu_exec is redefined accordingly to each architecture. > > why do we need to do this weird thing? as there is no namespace > collision it seems between architectures, why dont we just let > cpu_exec() be cpu_exec()? > > is this a trick? i cannot figure out why. One theory about it is the following (quoted from http://lists.nongnu.org/archive/html/qemu-devel/2011-05/msg02921.html): One of the long standing goals for QEMU has been to be able to use a single executable to emulate multiple architectures. I think for example the lines like #define cpu_init cpu_sparc_init #define cpu_exec cpu_sparc_exec etc. stand for this purpose, so there has been some consideration for this. Thanks. -- Max