diff options
author | Andreas Färber <afaerber@suse.de> | 2012-03-04 21:32:36 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-03-13 13:23:18 -0500 |
commit | ce008c1f10e9a7bfb0806432b899ac4390b199c3 (patch) | |
tree | fd586eab308fd87df7360575ac6511858c03f170 | |
parent | 1b71f7c14fab6f00c2680d4489fbee7baf796e4f (diff) | |
download | qemu-ce008c1f10e9a7bfb0806432b899ac4390b199c3.zip qemu-ce008c1f10e9a7bfb0806432b899ac4390b199c3.tar.gz qemu-ce008c1f10e9a7bfb0806432b899ac4390b199c3.tar.bz2 |
qom: Add QOM support to user emulators
Link the Object base class and the module infrastructure for class
registration. Introduce $(universal-obj-y) for objects that are more
common than $(common-obj-y), so that those only get built once.
Call QOM module init for type registration.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | Makefile.objs | 23 | ||||
-rw-r--r-- | Makefile.target | 4 | ||||
-rw-r--r-- | Makefile.user | 1 | ||||
-rw-r--r-- | bsd-user/main.c | 2 | ||||
-rw-r--r-- | darwin-user/main.c | 3 | ||||
-rw-r--r-- | linux-user/main.c | 2 | ||||
-rw-r--r-- | qemu-user.c | 37 |
8 files changed, 70 insertions, 8 deletions
@@ -98,12 +98,12 @@ ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/Makefile.objs endif -$(common-obj-y): $(GENERATED_HEADERS) +$(universal-obj-y) $(common-obj-y): $(GENERATED_HEADERS) subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o -$(filter %-softmmu,$(SUBDIR_RULES)): $(trace-obj-y) $(common-obj-y) subdir-libdis +$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $(common-obj-y) subdir-libdis -$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(trace-obj-y) subdir-libdis-user subdir-libuser +$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(universal-obj-y) $(trace-obj-y) subdir-libdis-user subdir-libuser ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) romsubdir-%: diff --git a/Makefile.objs b/Makefile.objs index 5f0b3f7..48bbc94 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -1,9 +1,22 @@ ####################################################################### +# Target-independent parts used in system and user emulation +universal-obj-y = + +####################################################################### # QObject qobject-obj-y = qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o qobject-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o qobject-obj-y += qerror.o error.o qemu-error.o +universal-obj-y += $(qobject-obj-y) + +####################################################################### +# QOM +include $(SRC_PATH)/qom/Makefile +qom-obj-y = $(addprefix qom/, $(qom-y)) + +universal-obj-y += $(qom-obj-y) + ####################################################################### # oslib-obj-y is code depending on the OS (win32 vs posix) oslib-obj-y = osdep.o @@ -80,7 +93,6 @@ fsdev-obj-$(CONFIG_VIRTFS) += $(addprefix fsdev/, $(fsdev-nested-y)) common-obj-y = $(block-obj-y) blockdev.o common-obj-y += $(net-obj-y) -common-obj-y += $(qobject-obj-y) common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX)) common-obj-y += readline.o console.o cursor.o common-obj-y += $(oslib-obj-y) @@ -128,9 +140,6 @@ common-obj-$(CONFIG_WIN32) += version.o common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.o spice-qemu-char.o -include $(SRC_PATH)/qom/Makefile -common-obj-y += $(addprefix qom/, $(qom-y)) - audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o audio-obj-$(CONFIG_SDL) += sdlaudio.o audio-obj-$(CONFIG_OSS) += ossaudio.o @@ -186,6 +195,8 @@ user-obj-y = user-obj-y += envlist.o path.o user-obj-y += tcg-runtime.o host-utils.o user-obj-y += cutils.o cache-utils.o +user-obj-y += module.o +user-obj-y += qemu-user.o user-obj-y += $(trace-obj-y) ###################################################################### @@ -422,9 +433,11 @@ qapi-nested-y += qmp-output-visitor.o qmp-registry.o qmp-dispatch.o qapi-nested-y += string-input-visitor.o string-output-visitor.o qapi-obj-y = $(addprefix qapi/, $(qapi-nested-y)) -common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o $(qapi-obj-y) +common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o common-obj-y += qmp.o hmp.o +universal-obj-y += $(qapi-obj-y) + ###################################################################### # guest agent diff --git a/Makefile.target b/Makefile.target index 1bd25a89..cb1532a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -136,6 +136,7 @@ obj-m68k-y += m68k-sim.o m68k-semi.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) +obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) @@ -163,6 +164,7 @@ obj-i386-y += ioport-user.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) +obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) @@ -185,6 +187,7 @@ obj-i386-y += ioport-user.o $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) +obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) obj-y += $(addprefix ../libdis-user/, $(libdis-y)) obj-y += $(libobj-y) @@ -406,6 +409,7 @@ monitor.o: hmp-commands.h qmp-commands-old.h $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) +obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../, $(common-obj-y)) obj-y += $(addprefix ../libdis/, $(libdis-y)) obj-y += $(libobj-y) diff --git a/Makefile.user b/Makefile.user index 2b1e4d1..b717820 100644 --- a/Makefile.user +++ b/Makefile.user @@ -9,6 +9,7 @@ include $(SRC_PATH)/rules.mak $(call set-vpath, $(SRC_PATH)) QEMU_CFLAGS+=-I.. +QEMU_CFLAGS += -I$(SRC_PATH)/include include $(SRC_PATH)/Makefile.objs diff --git a/bsd-user/main.c b/bsd-user/main.c index cc7d4a3..cdb0d0a 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -748,6 +748,8 @@ int main(int argc, char **argv) if (argc <= 1) usage(); + module_call_init(MODULE_INIT_QOM); + if ((envlist = envlist_create()) == NULL) { (void) fprintf(stderr, "Unable to allocate envlist\n"); exit(1); diff --git a/darwin-user/main.c b/darwin-user/main.c index 9b57c20..e1519c7 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -28,6 +28,7 @@ #include <sys/mman.h> #include "qemu.h" +#include "qemu-common.h" #define DEBUG_LOGFILE "/tmp/qemu.log" @@ -749,6 +750,8 @@ int main(int argc, char **argv) if (argc <= 1) usage(); + module_call_init(MODULE_INIT_QOM); + optind = 1; for(;;) { if (optind >= argc) diff --git a/linux-user/main.c b/linux-user/main.c index 14bf5f0..bd47489 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3285,6 +3285,8 @@ int main(int argc, char **argv, char **envp) int i; int ret; + module_call_init(MODULE_INIT_QOM); + qemu_cache_utils_init(envp); if ((envlist = envlist_create()) == NULL) { diff --git a/qemu-user.c b/qemu-user.c new file mode 100644 index 0000000..08ccb0f --- /dev/null +++ b/qemu-user.c @@ -0,0 +1,37 @@ +/* + * Stubs for QEMU user emulation + * + * Copyright (c) 2012 SUSE LINUX Products GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * <http://www.gnu.org/licenses/gpl-2.0.html> + */ + +#include "qemu-common.h" +#include "monitor.h" + +Monitor *cur_mon; + +int monitor_cur_is_qmp(void) +{ + return 0; +} + +void monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) +{ +} + +void monitor_set_error(Monitor *mon, QError *qerror) +{ +} |