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