From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7hIa-0007NR-R5 for qemu-devel@nongnu.org; Wed, 24 Jun 2015 05:48:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7hIX-0000Do-Dj for qemu-devel@nongnu.org; Wed, 24 Jun 2015 05:48:52 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:33214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7hIX-0000Dj-88 for qemu-devel@nongnu.org; Wed, 24 Jun 2015 05:48:49 -0400 Received: by wiwl6 with SMTP id l6so90067237wiw.0 for ; Wed, 24 Jun 2015 02:48:48 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <558A7CFE.1050102@redhat.com> Date: Wed, 24 Jun 2015 11:48:46 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4b6acf1900df20165fa4c269f071248e4d5f8fec.1433052532.git.crosthwaite.peter@gmail.com> <556C0F16.2010207@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v2 06/34] cpu-common: Define tb_page_addr_t for everyone List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , Peter Crosthwaite , "qemu-devel@nongnu.org Developers" , Peter Crosthwaite , "Edgar E. Iglesias" , =?UTF-8?B?QW5kcmVhcyBGw6Q=?= =?UTF-8?B?cmJlcg==?= , Richard Henderson On 08/06/2015 01:06, Peter Crosthwaite wrote: > > I suspect you can instead make a header that is included by arch-obj > > files, and move a lot of stuff there from include/exec/exec-all.h (for > > example all the prototypes that use tb_page_addr_t). > > So the problem was I needed this from cpu-qom which is a common-obj > which is why I went for super-global on this one. I see. However, include/qom/cpu.h is then shared between softmmu and user emulation and can be used by common-obj-y. But the prototypes are different, which is not a good thing. You would then need something like this before patch 21 (virtualize CPU interfaces completely): diff --git a/Makefile.target b/Makefile.target index 3e7aafd..efe68d9 100644 --- a/Makefile.target +++ b/Makefile.target @@ -107,7 +107,7 @@ ifdef CONFIG_LINUX_USER QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user -obj-y += linux-user/ +obj-y += linux-user/ qom/ obj-y += gdbstub.o thunk.o user-exec.o endif #CONFIG_LINUX_USER @@ -120,7 +120,7 @@ ifdef CONFIG_BSD_USER QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR) -obj-y += bsd-user/ +obj-y += bsd-user/ qom/ obj-y += gdbstub.o user-exec.o endif #CONFIG_BSD_USER diff --git a/qom/Makefile.objs b/qom/Makefile.objs index 985003b..d6dccdb 100644 --- a/qom/Makefile.objs +++ b/qom/Makefile.objs @@ -1,3 +1,5 @@ common-obj-y = object.o container.o qom-qobject.o -common-obj-y += cpu.o common-obj-y += object_interfaces.o + +common-obj-$(CONFIG_SOFTMMU) += cpu.o +obj-$(CONFIG_USER_ONLY) += cpu.o The alternative is to make the virtualized function pointers into their own struct, pointed to by CPUState. Then qom/cpu.h only needs an opaque declaration, and it doesn't need to know tb_page_addr_t at all. The struct can be defined in the same "header that is included by arch-obj files" that I mentioned above. Paolo