From 046e7c5f934a7a5680a6822eae4dfa80899a1d40 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:50:03 +0200 Subject: build: remove trace-nested-y Signed-off-by: Paolo Bonzini --- Makefile.objs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 70c5c79a6e..1daa92c96b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -425,16 +425,11 @@ ifneq ($(TRACE_BACKEND),dtrace) trace-obj-y = trace.o endif -trace-nested-$(CONFIG_TRACE_DEFAULT) += default.o - -trace-nested-$(CONFIG_TRACE_SIMPLE) += simple.o +trace-obj-$(CONFIG_TRACE_DEFAULT) += trace/default.o +trace-obj-$(CONFIG_TRACE_SIMPLE) += trace/simple.o trace-obj-$(CONFIG_TRACE_SIMPLE) += qemu-timer-common.o - -trace-nested-$(CONFIG_TRACE_STDERR) += stderr.o - -trace-nested-y += control.o - -trace-obj-y += $(addprefix trace/, $(trace-nested-y)) +trace-obj-$(CONFIG_TRACE_STDERR) += trace/stderr.o +trace-obj-y += trace/control.o $(trace-obj-y): $(GENERATED_HEADERS) -- cgit v1.2.1 From 4115852bb0670841ff0e780692bcfcf1ede120b0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 12:41:34 +0200 Subject: build: do not sprinkle around GENERATED_HEADERS dependencies Keeping GENERATED_HEADERS dependencies up-to-date everywhere is complex. We can simply make the Makefile depend on them, and they will be built before all other targets. Signed-off-by: Paolo Bonzini --- Makefile | 18 +++++++++--------- Makefile.target | 14 ++++---------- tests/Makefile | 1 - 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 9b7a85e4d2..c0ab97a9d8 100644 --- a/Makefile +++ b/Makefile @@ -91,19 +91,18 @@ qemu-options.def: $(SRC_PATH)/qemu-options.hx SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) -subdir-%: $(GENERATED_HEADERS) +subdir-%: $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,) ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/Makefile.objs endif -$(universal-obj-y) $(common-obj-y): $(GENERATED_HEADERS) subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o $(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $(common-obj-y) subdir-libdis -$(filter %-user,$(SUBDIR_RULES)): $(GENERATED_HEADERS) $(universal-obj-y) $(trace-obj-y) subdir-libdis-user subdir-libuser +$(filter %-user,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) subdir-libdis-user subdir-libuser ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS)) romsubdir-%: @@ -142,7 +141,7 @@ libcacard.la: install-libcacard: @echo "libtool is missing, please install and rerun configure"; exit 1 else -libcacard.la: $(GENERATED_HEADERS) $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y))) +libcacard.la: $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(trace-obj-y))) $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,) install-libcacard: libcacard.la @@ -151,7 +150,6 @@ endif ###################################################################### qemu-img.o: qemu-img-cmds.h -qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o qemu-ga.o: $(GENERATED_HEADERS) tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \ qemu-timer-common.o main-loop.o notify.o iohandler.o cutils.o async.o @@ -162,7 +160,6 @@ qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y) qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y) qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o -qemu-bridge-helper.o: $(GENERATED_HEADERS) fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o oslib-posix.o $(trace-obj-y) fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap @@ -170,7 +167,6 @@ fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@," GEN $@") -$(qapi-obj-y): $(GENERATED_HEADERS) qapi-dir := $(BUILD_DIR)/qapi-generated qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir) @@ -203,8 +199,8 @@ $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py QGALIB_OBJ=$(addprefix $(qapi-dir)/, qga-qapi-types.o qga-qapi-visit.o qga-qmp-marshal.o) QGALIB_GEN=$(addprefix $(qapi-dir)/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h) -$(QGALIB_OBJ): $(QGALIB_GEN) $(GENERATED_HEADERS) -$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) $(GENERATED_HEADERS) +$(QGALIB_OBJ): $(QGALIB_GEN) +$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y) $(QGALIB_OBJ) @@ -399,5 +395,9 @@ tar: cd /tmp && tar zcvf ~/$(FILE).tar.gz $(FILE) --exclude CVS --exclude .git --exclude .svn rm -rf /tmp/$(FILE) +# Add a dependency on the generated files, so that they are always +# rebuilt before other object files +Makefile: $(GENERATED_HEADERS) + # Include automatically generated dependency files -include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d qapi/*.d qga/*.d) diff --git a/Makefile.target b/Makefile.target index c94abfd3a4..40b774ad68 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,6 +1,5 @@ # -*- Mode: makefile -*- -GENERATED_HEADERS = config-target.h CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) @@ -105,8 +104,6 @@ libobj-$(CONFIG_TCI_DIS) += tci-dis.o tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci -$(libobj-y): $(GENERATED_HEADERS) - # HELPER_CFLAGS is used for all the legacy code compiled with static register # variables ifneq ($(TARGET_BASE_ARCH), sparc) @@ -143,8 +140,6 @@ obj-arm-y += arm-semi.o 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)) @@ -166,8 +161,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ 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)) @@ -392,9 +385,7 @@ obj-xtensa-y += core-fsf.o main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) -monitor.o: hmp-commands.h qmp-commands-old.h - -$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS) +GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../, $(common-obj-y)) @@ -457,5 +448,8 @@ ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DATA) $(QEMU_PROG).stp "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" endif +GENERATED_HEADERS += config-target.h +Makefile: $(GENERATED_HEADERS) + # Include automatically generated dependency files -include $(wildcard *.d */*.d) diff --git a/tests/Makefile b/tests/Makefile index ab7f667009..2e754c381e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -37,7 +37,6 @@ test-qapi-obj-y = $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) test-qapi-obj-y += tests/test-qapi-visit.o tests/test-qapi-types.o test-qapi-obj-y += module.o -$(test-obj-y): $(GENERATED_HEADERS) $(test-obj-y): QEMU_INCLUDES += -Itests tests/check-qint$(EXESUF): tests/check-qint.o qint.o $(tools-obj-y) -- cgit v1.2.1 From e05804eebc6444bc5660ab2770fd9452fd66ec56 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:41:27 +0200 Subject: build: add rules for nesting This adds the 'magic' rules that take care of subdirectories. The subdirectory makefiles in the source tree are not complete; they only define some variables (listed in nested-vars) according to the configuration. The magic rules descend into subdirectory makefiles and gather the evaluated values of those variables. The values from all subdirectories are joined together, each prefixed with the subdirectory name, and used by the "real" makefiles. Signed-off-by: Paolo Bonzini --- rules.mak | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/rules.mak b/rules.mak index efef6f242d..f65283cfbd 100644 --- a/rules.mak +++ b/rules.mak @@ -73,3 +73,42 @@ TRACETOOL=$(PYTHON) $(SRC_PATH)/scripts/tracetool.py # will delete the target of a rule if commands exit with a nonzero exit status .DELETE_ON_ERROR: + +# magic to descend into other directories + +obj := . +old-nested-dirs := + +define push-var +$(eval save-$2-$1 = $(value $1)) +$(eval $1 :=) +endef + +define pop-var +$(eval subdir-$2-$1 := $(if $(filter $2,$(save-$2-$1)),$(addprefix $2,$($1)))) +$(eval $1 = $(value save-$2-$1) $$(subdir-$2-$1)) +$(eval save-$2-$1 :=) +endef + +define unnest-dir +$(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) +$(eval obj := $(obj)/$1) +$(eval include $(SRC_PATH)/$1/Makefile.objs) +$(eval obj := $(patsubst %/$1,%,$(obj))) +$(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) +endef + +define unnest-vars-1 +$(eval nested-dirs := $(filter-out \ + $(old-nested-dirs), \ + $(sort $(foreach var,$(nested-vars), $(filter %/, $($(var))))))) +$(if $(nested-dirs), + $(foreach dir,$(nested-dirs),$(call unnest-dir,$(patsubst %/,%,$(dir)))) + $(eval old-nested-dirs := $(old-nested-dirs) $(nested-dirs)) + $(call unnest-vars-1)) +endef + +define unnest-vars +$(call unnest-vars-1) +$(foreach var,$(nested-vars),$(eval $(var) := $(filter-out %/, $($(var))))) +endef -- cgit v1.2.1 From 7fc5152c6dca17d6061cc399c46716d9e586ad85 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 09:33:59 +0200 Subject: build: move *-user/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.target | 32 ++++++++++---------------------- bsd-user/Makefile.objs | 2 ++ configure | 8 +++++++- linux-user/Makefile.objs | 7 +++++++ linux-user/arm/nwfpe/Makefile.objs | 2 ++ 5 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 bsd-user/Makefile.objs create mode 100644 linux-user/Makefile.objs create mode 100644 linux-user/arm/nwfpe/Makefile.objs diff --git a/Makefile.target b/Makefile.target index 40b774ad68..5cc577b890 100644 --- a/Makefile.target +++ b/Makefile.target @@ -113,32 +113,20 @@ user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) # Note: this is a workaround. The real fix is to avoid compiling # cpu_signal_handler() in user-exec.c. -signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) +%/signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS) ######################################################### # Linux user emulator target ifdef CONFIG_LINUX_USER -$(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)) - QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user -obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \ - elfload.o linuxload.o uaccess.o gdbstub.o cpu-uname.o \ - user-exec.o $(oslib-obj-y) - -obj-$(TARGET_HAS_BFLT) += flatload.o - -obj-$(TARGET_I386) += vm86.o +obj-y += linux-user/ +obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) obj-i386-y += ioport-user.o - -nwfpe-obj-y = fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o -nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o -obj-arm-y += $(addprefix nwfpe/, $(nwfpe-obj-y)) -obj-arm-y += arm-semi.o - -obj-m68k-y += m68k-sim.o m68k-semi.o +obj-$(TARGET_ARM) += arm-semi.o +obj-$(TARGET_M68K) += m68k-semi.o obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) @@ -152,13 +140,10 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_BSD_USER -$(call set-vpath, $(SRC_PATH)/bsd-user) - QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) -obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - gdbstub.o uaccess.o user-exec.o - +obj-y += bsd-user/ +obj-y += gdbstub.o user-exec.o obj-i386-y += ioport-user.o obj-y += $(addprefix ../, $(universal-obj-y)) @@ -408,6 +393,9 @@ endif # CONFIG_LINUX_USER obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o +nested-vars = obj-y +dummy := $(call unnest-vars) + ifdef QEMU_PROGW # The linker builds a windows executable. Make also a console executable. $(QEMU_PROGW): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) diff --git a/bsd-user/Makefile.objs b/bsd-user/Makefile.objs new file mode 100644 index 0000000000..5e77f57782 --- /dev/null +++ b/bsd-user/Makefile.objs @@ -0,0 +1,2 @@ +obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ + uaccess.o diff --git a/configure b/configure index 76dd57fc27..2c44488131 100755 --- a/configure +++ b/configure @@ -3520,8 +3520,14 @@ mkdir -p $target_dir/ide mkdir -p $target_dir/usb mkdir -p $target_dir/9pfs mkdir -p $target_dir/kvm +if test "$target_linux_user" = yes; then + mkdir -p $target_dir/linux-user +fi +if test "$target_bsd_user" = yes; then + mkdir -p $target_dir/bsd-user +fi if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then - mkdir -p $target_dir/nwfpe + mkdir -p $target_dir/linux-user/arm/nwfpe fi symlink "$source_path/Makefile.target" "$target_dir/Makefile" diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs new file mode 100644 index 0000000000..5899d72d3e --- /dev/null +++ b/linux-user/Makefile.objs @@ -0,0 +1,7 @@ +obj-y = main.o syscall.o strace.o mmap.o signal.o \ + elfload.o linuxload.o uaccess.o cpu-uname.o + +obj-$(TARGET_HAS_BFLT) += flatload.o +obj-$(TARGET_I386) += vm86.o +obj-$(TARGET_ARM) += arm/nwfpe/ +obj-$(TARGET_M68K) += m68k-sim.o diff --git a/linux-user/arm/nwfpe/Makefile.objs b/linux-user/arm/nwfpe/Makefile.objs new file mode 100644 index 0000000000..51b0c32c2a --- /dev/null +++ b/linux-user/arm/nwfpe/Makefile.objs @@ -0,0 +1,2 @@ +obj-y = fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o +obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o -- cgit v1.2.1 From 5e8861a0361d8d39ab69fe557294471c28c49c8b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 10:23:15 +0200 Subject: build: move obj-TARGET-y variables to nested Makefile.objs Also drop duplicate occurrence of device-hotplug.o. Signed-off-by: Paolo Bonzini --- Makefile.target | 186 +-------------- arm-semi.c | 509 ---------------------------------------- configure | 48 ++-- hw/alpha/Makefile.objs | 4 + hw/arm/Makefile.objs | 39 +++ hw/cris/Makefile.objs | 13 + hw/i386/Makefile.objs | 13 + hw/lm32/Makefile.objs | 23 ++ hw/m68k/Makefile.objs | 4 + hw/microblaze/Makefile.objs | 13 + hw/mips/Makefile.objs | 6 + hw/ppc/Makefile.objs | 31 +++ hw/s390x/Makefile.objs | 3 + hw/sh4/Makefile.objs | 5 + hw/sparc/Makefile.objs | 8 + hw/sparc64/Makefile.objs | 4 + hw/xtensa/Makefile.objs | 5 + ioport-user.c | 60 ----- m68k-semi.c | 408 -------------------------------- target-alpha/Makefile.objs | 1 + target-arm/Makefile.objs | 1 + target-arm/arm-semi.c | 509 ++++++++++++++++++++++++++++++++++++++++ target-cris/Makefile.objs | 1 + target-i386/Makefile.objs | 3 + target-i386/ioport-user.c | 60 +++++ target-lm32/Makefile.objs | 1 + target-m68k/Makefile.objs | 1 + target-m68k/m68k-semi.c | 408 ++++++++++++++++++++++++++++++++ target-microblaze/Makefile.objs | 1 + target-mips/Makefile.objs | 1 + target-ppc/Makefile.objs | 1 + target-s390x/Makefile.objs | 1 + target-sh4/Makefile.objs | 1 + target-sparc/Makefile.objs | 1 + target-unicore32/Makefile.objs | 1 + target-xtensa/Makefile.objs | 4 + target-xtensa/xtensa-semi.c | 224 ++++++++++++++++++ xtensa-semi.c | 224 ------------------ 38 files changed, 1430 insertions(+), 1396 deletions(-) delete mode 100644 arm-semi.c create mode 100644 hw/alpha/Makefile.objs create mode 100644 hw/arm/Makefile.objs create mode 100644 hw/cris/Makefile.objs create mode 100644 hw/i386/Makefile.objs create mode 100644 hw/lm32/Makefile.objs create mode 100644 hw/m68k/Makefile.objs create mode 100644 hw/microblaze/Makefile.objs create mode 100644 hw/mips/Makefile.objs create mode 100644 hw/ppc/Makefile.objs create mode 100644 hw/s390x/Makefile.objs create mode 100644 hw/sh4/Makefile.objs create mode 100644 hw/sparc/Makefile.objs create mode 100644 hw/sparc64/Makefile.objs create mode 100644 hw/xtensa/Makefile.objs delete mode 100644 ioport-user.c delete mode 100644 m68k-semi.c create mode 100644 target-alpha/Makefile.objs create mode 100644 target-arm/Makefile.objs create mode 100644 target-arm/arm-semi.c create mode 100644 target-cris/Makefile.objs create mode 100644 target-i386/Makefile.objs create mode 100644 target-i386/ioport-user.c create mode 100644 target-lm32/Makefile.objs create mode 100644 target-m68k/Makefile.objs create mode 100644 target-m68k/m68k-semi.c create mode 100644 target-microblaze/Makefile.objs create mode 100644 target-mips/Makefile.objs create mode 100644 target-ppc/Makefile.objs create mode 100644 target-s390x/Makefile.objs create mode 100644 target-sh4/Makefile.objs create mode 100644 target-sparc/Makefile.objs create mode 100644 target-unicore32/Makefile.objs create mode 100644 target-xtensa/Makefile.objs create mode 100644 target-xtensa/xtensa-semi.c delete mode 100644 xtensa-semi.c diff --git a/Makefile.target b/Makefile.target index 5cc577b890..c416ba56fc 100644 --- a/Makefile.target +++ b/Makefile.target @@ -102,6 +102,8 @@ libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o libobj-y += disas.o libobj-$(CONFIG_TCI_DIS) += tci-dis.o +obj-y += target-$(TARGET_BASE_ARCH)/ + tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci # HELPER_CFLAGS is used for all the legacy code compiled with static register @@ -124,9 +126,6 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user obj-y += linux-user/ obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) -obj-i386-y += ioport-user.o -obj-$(TARGET_ARM) += arm-semi.o -obj-$(TARGET_M68K) += m68k-semi.o obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) @@ -144,7 +143,6 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.o -obj-i386-y += ioport-user.o obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) @@ -157,7 +155,7 @@ endif #CONFIG_BSD_USER # System emulator target ifdef CONFIG_SOFTMMU -obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o +obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly obj-$(CONFIG_NO_PCI) += pci-stub.o @@ -175,8 +173,6 @@ obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o LIBS+=-lz -obj-i386-$(CONFIG_KVM) += hyperv.o - QEMU_CFLAGS += $(VNC_TLS_CFLAGS) QEMU_CFLAGS += $(VNC_SASL_CFLAGS) QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) @@ -186,8 +182,6 @@ QEMU_CFLAGS += $(VNC_PNG_CFLAGS) obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o -obj-i386-$(CONFIG_XEN) += xen_platform.o xen_apic.o - # Inter-VM PCI shared memory CONFIG_IVSHMEM = ifeq ($(CONFIG_KVM), y) @@ -201,172 +195,18 @@ obj-$(CONFIG_IVSHMEM) += ivshmem.o obj-y += device-hotplug.o # Hardware support -obj-i386-y += mc146818rtc.o pc.o -obj-i386-y += apic_common.o apic.o kvmvapic.o -obj-i386-y += sga.o ioapic_common.o ioapic.o piix_pci.o -obj-i386-y += vmport.o -obj-i386-y += pci-hotplug.o smbios.o wdt_ib700.o -obj-i386-y += debugcon.o multiboot.o -obj-i386-y += pc_piix.o -obj-i386-y += pc_sysfw.o -obj-i386-$(CONFIG_KVM) += kvm/clock.o kvm/apic.o kvm/i8259.o kvm/ioapic.o kvm/i8254.o -obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o - -# shared objects -obj-ppc-y = ppc.o ppc_booke.o -# PREP target -obj-ppc-y += mc146818rtc.o -obj-ppc-y += ppc_prep.o -# OldWorld PowerMac -obj-ppc-y += ppc_oldworld.o -# NewWorld PowerMac -obj-ppc-y += ppc_newworld.o -# IBM pSeries (sPAPR) -obj-ppc-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o -obj-ppc-$(CONFIG_PSERIES) += xics.o spapr_vty.o spapr_llan.o spapr_vscsi.o -obj-ppc-$(CONFIG_PSERIES) += spapr_pci.o device-hotplug.o pci-hotplug.o -# PowerPC 4xx boards -obj-ppc-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o -obj-ppc-y += ppc440_bamboo.o -# PowerPC E500 boards -obj-ppc-y += ppce500_mpc8544ds.o mpc8544_guts.o ppce500_spin.o -# PowerPC 440 Xilinx ML507 reference board. -obj-ppc-y += virtex_ml507.o -obj-ppc-$(CONFIG_KVM) += kvm_ppc.o -obj-ppc-$(CONFIG_FDT) += device_tree.o -# PowerPC OpenPIC -obj-ppc-y += openpic.o - -# Xilinx PPC peripherals -obj-ppc-y += xilinx_intc.o -obj-ppc-y += xilinx_timer.o -obj-ppc-y += xilinx_uartlite.o -obj-ppc-y += xilinx_ethlite.o - -# LM32 boards -obj-lm32-y += lm32_boards.o -obj-lm32-y += milkymist.o - -# LM32 peripherals -obj-lm32-y += lm32_pic.o -obj-lm32-y += lm32_juart.o -obj-lm32-y += lm32_timer.o -obj-lm32-y += lm32_uart.o -obj-lm32-y += lm32_sys.o -obj-lm32-y += milkymist-ac97.o -obj-lm32-y += milkymist-hpdmc.o -obj-lm32-y += milkymist-memcard.o -obj-lm32-y += milkymist-minimac2.o -obj-lm32-y += milkymist-pfpu.o -obj-lm32-y += milkymist-softusb.o -obj-lm32-y += milkymist-sysctl.o -obj-lm32-$(CONFIG_OPENGL) += milkymist-tmu2.o -obj-lm32-y += milkymist-uart.o -obj-lm32-y += milkymist-vgafb.o -obj-lm32-y += framebuffer.o - -obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o -obj-mips-y += mips_addr.o mips_timer.o mips_int.o -obj-mips-y += gt64xxx.o mc146818rtc.o -obj-mips-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o - -obj-microblaze-y = petalogix_s3adsp1800_mmu.o -obj-microblaze-y += petalogix_ml605_mmu.o -obj-microblaze-y += microblaze_boot.o - -obj-microblaze-y += microblaze_pic_cpu.o -obj-microblaze-y += xilinx_intc.o -obj-microblaze-y += xilinx_timer.o -obj-microblaze-y += xilinx_uartlite.o -obj-microblaze-y += xilinx_ethlite.o -obj-microblaze-y += xilinx_axidma.o -obj-microblaze-y += xilinx_axienet.o - -obj-microblaze-$(CONFIG_FDT) += device_tree.o - -# Boards -obj-cris-y = cris_pic_cpu.o -obj-cris-y += cris-boot.o -obj-cris-y += axis_dev88.o - -# IO blocks -obj-cris-y += etraxfs_dma.o -obj-cris-y += etraxfs_pic.o -obj-cris-y += etraxfs_eth.o -obj-cris-y += etraxfs_timer.o -obj-cris-y += etraxfs_ser.o - ifeq ($(TARGET_ARCH), sparc64) -obj-sparc-y = sun4u.o apb_pci.o -obj-sparc-y += mc146818rtc.o +obj-y += hw/sparc64/ else -obj-sparc-y = sun4m.o lance.o tcx.o sun4m_iommu.o slavio_intctl.o -obj-sparc-y += slavio_timer.o slavio_misc.o sparc32_dma.o -obj-sparc-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o leon3.o - -# GRLIB -obj-sparc-y += grlib_gptimer.o grlib_irqmp.o grlib_apbuart.o +obj-y += hw/$(TARGET_BASE_ARCH)/ endif -obj-arm-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o -obj-arm-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o -obj-arm-y += versatile_pci.o -obj-arm-y += versatile_i2c.o -obj-arm-y += cadence_uart.o -obj-arm-y += cadence_ttc.o -obj-arm-y += cadence_gem.o -obj-arm-y += xilinx_zynq.o zynq_slcr.o -obj-arm-y += arm_gic.o -obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o -obj-arm-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o -obj-arm-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o -obj-arm-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o -obj-arm-y += arm_l2x0.o -obj-arm-y += arm_mptimer.o a15mpcore.o -obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o -obj-arm-y += highbank.o -obj-arm-y += pl061.o -obj-arm-y += xgmac.o -obj-arm-y += arm-semi.o -obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o -obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o -obj-arm-y += gumstix.o -obj-arm-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o -obj-arm-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \ - omap_gpio.o omap_intc.o omap_uart.o -obj-arm-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \ - omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o -obj-arm-y += omap_sx1.o palm.o tsc210x.o -obj-arm-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb/hcd-musb.o -obj-arm-y += mst_fpga.o mainstone.o -obj-arm-y += z2.o -obj-arm-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o -obj-arm-y += framebuffer.o -obj-arm-y += vexpress.o -obj-arm-y += strongarm.o -obj-arm-y += collie.o -obj-arm-y += pl041.o lm4549.o -obj-arm-$(CONFIG_FDT) += device_tree.o - -obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o -obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o -obj-sh4-y += ide/mmio.o - -obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o -obj-m68k-y += m68k-semi.o dummy_m68k.o - -obj-s390x-y = s390-virtio-bus.o s390-virtio.o - -obj-alpha-y = mc146818rtc.o -obj-alpha-y += alpha_pci.o alpha_dp264.o alpha_typhoon.o - -obj-xtensa-y += xtensa_pic.o -obj-xtensa-y += xtensa_sim.o -obj-xtensa-y += xtensa_lx60.o -obj-xtensa-y += xtensa-semi.o -obj-xtensa-y += core-dc232b.o -obj-xtensa-y += core-dc233c.o -obj-xtensa-y += core-fsf.o +# Device tree +ifeq ($(CONFIG_FDT), y) +obj-$(TARGET_ARM) += device_tree.o +obj-$(TARGET_MICROBLAZE) += device_tree.o +obj-$(TARGET_PPC) += device_tree.o +endif main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) @@ -398,12 +238,12 @@ dummy := $(call unnest-vars) ifdef QEMU_PROGW # The linker builds a windows executable. Make also a console executable. -$(QEMU_PROGW): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) +$(QEMU_PROGW): $(obj-y) $(call LINK,$^) $(QEMU_PROG): $(QEMU_PROGW) $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") else -$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) +$(QEMU_PROG): $(obj-y) $(call LINK,$^) endif diff --git a/arm-semi.c b/arm-semi.c deleted file mode 100644 index 88ca9bb1b7..0000000000 --- a/arm-semi.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Arm "Angel" semihosting syscalls - * - * Copyright (c) 2005, 2007 CodeSourcery. - * Written by Paul Brook. - * - * 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 . - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "cpu.h" -#ifdef CONFIG_USER_ONLY -#include "qemu.h" - -#define ARM_ANGEL_HEAP_SIZE (128 * 1024 * 1024) -#else -#include "qemu-common.h" -#include "gdbstub.h" -#include "hw/arm-misc.h" -#endif - -#define TARGET_SYS_OPEN 0x01 -#define TARGET_SYS_CLOSE 0x02 -#define TARGET_SYS_WRITEC 0x03 -#define TARGET_SYS_WRITE0 0x04 -#define TARGET_SYS_WRITE 0x05 -#define TARGET_SYS_READ 0x06 -#define TARGET_SYS_READC 0x07 -#define TARGET_SYS_ISTTY 0x09 -#define TARGET_SYS_SEEK 0x0a -#define TARGET_SYS_FLEN 0x0c -#define TARGET_SYS_TMPNAM 0x0d -#define TARGET_SYS_REMOVE 0x0e -#define TARGET_SYS_RENAME 0x0f -#define TARGET_SYS_CLOCK 0x10 -#define TARGET_SYS_TIME 0x11 -#define TARGET_SYS_SYSTEM 0x12 -#define TARGET_SYS_ERRNO 0x13 -#define TARGET_SYS_GET_CMDLINE 0x15 -#define TARGET_SYS_HEAPINFO 0x16 -#define TARGET_SYS_EXIT 0x18 - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#define GDB_O_RDONLY 0x000 -#define GDB_O_WRONLY 0x001 -#define GDB_O_RDWR 0x002 -#define GDB_O_APPEND 0x008 -#define GDB_O_CREAT 0x200 -#define GDB_O_TRUNC 0x400 -#define GDB_O_BINARY 0 - -static int gdb_open_modeflags[12] = { - GDB_O_RDONLY, - GDB_O_RDONLY | GDB_O_BINARY, - GDB_O_RDWR, - GDB_O_RDWR | GDB_O_BINARY, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND, - GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND, - GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY -}; - -static int open_modeflags[12] = { - O_RDONLY, - O_RDONLY | O_BINARY, - O_RDWR, - O_RDWR | O_BINARY, - O_WRONLY | O_CREAT | O_TRUNC, - O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, - O_RDWR | O_CREAT | O_TRUNC, - O_RDWR | O_CREAT | O_TRUNC | O_BINARY, - O_WRONLY | O_CREAT | O_APPEND, - O_WRONLY | O_CREAT | O_APPEND | O_BINARY, - O_RDWR | O_CREAT | O_APPEND, - O_RDWR | O_CREAT | O_APPEND | O_BINARY -}; - -#ifdef CONFIG_USER_ONLY -static inline uint32_t set_swi_errno(TaskState *ts, uint32_t code) -{ - if (code == (uint32_t)-1) - ts->swi_errno = errno; - return code; -} -#else -static inline uint32_t set_swi_errno(CPUARMState *env, uint32_t code) -{ - return code; -} - -#include "softmmu-semi.h" -#endif - -static target_ulong arm_semi_syscall_len; - -#if !defined(CONFIG_USER_ONLY) -static target_ulong syscall_err; -#endif - -static void arm_semi_cb(CPUARMState *env, target_ulong ret, target_ulong err) -{ -#ifdef CONFIG_USER_ONLY - TaskState *ts = env->opaque; -#endif - - if (ret == (target_ulong)-1) { -#ifdef CONFIG_USER_ONLY - ts->swi_errno = err; -#else - syscall_err = err; -#endif - env->regs[0] = ret; - } else { - /* Fixup syscalls that use nonstardard return conventions. */ - switch (env->regs[0]) { - case TARGET_SYS_WRITE: - case TARGET_SYS_READ: - env->regs[0] = arm_semi_syscall_len - ret; - break; - case TARGET_SYS_SEEK: - env->regs[0] = 0; - break; - default: - env->regs[0] = ret; - break; - } - } -} - -static void arm_semi_flen_cb(CPUARMState *env, target_ulong ret, target_ulong err) -{ - /* The size is always stored in big-endian order, extract - the value. We assume the size always fit in 32 bits. */ - uint32_t size; - cpu_memory_rw_debug(env, env->regs[13]-64+32, (uint8_t *)&size, 4, 0); - env->regs[0] = be32_to_cpu(size); -#ifdef CONFIG_USER_ONLY - ((TaskState *)env->opaque)->swi_errno = err; -#else - syscall_err = err; -#endif -} - -#define ARG(n) \ -({ \ - target_ulong __arg; \ - /* FIXME - handle get_user() failure */ \ - get_user_ual(__arg, args + (n) * 4); \ - __arg; \ -}) -#define SET_ARG(n, val) put_user_ual(val, args + (n) * 4) -uint32_t do_arm_semihosting(CPUARMState *env) -{ - target_ulong args; - char * s; - int nr; - uint32_t ret; - uint32_t len; -#ifdef CONFIG_USER_ONLY - TaskState *ts = env->opaque; -#else - CPUARMState *ts = env; -#endif - - nr = env->regs[0]; - args = env->regs[1]; - switch (nr) { - case TARGET_SYS_OPEN: - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - if (ARG(1) >= 12) - return (uint32_t)-1; - if (strcmp(s, ":tt") == 0) { - if (ARG(1) < 4) - return STDIN_FILENO; - else - return STDOUT_FILENO; - } - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", ARG(0), - (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); - return env->regs[0]; - } else { - ret = set_swi_errno(ts, open(s, open_modeflags[ARG(1)], 0644)); - } - unlock_user(s, ARG(0), 0); - return ret; - case TARGET_SYS_CLOSE: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); - return env->regs[0]; - } else { - return set_swi_errno(ts, close(ARG(0))); - } - case TARGET_SYS_WRITEC: - { - char c; - - if (get_user_u8(c, args)) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - /* Write to debug console. stderr is near enough. */ - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); - return env->regs[0]; - } else { - return write(STDERR_FILENO, &c, 1); - } - } - case TARGET_SYS_WRITE0: - if (!(s = lock_user_string(args))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - len = strlen(s); - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); - ret = env->regs[0]; - } else { - ret = write(STDERR_FILENO, s, len); - } - unlock_user(s, args, 0); - return ret; - case TARGET_SYS_WRITE: - len = ARG(2); - if (use_gdb_syscalls()) { - arm_semi_syscall_len = len; - gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); - return env->regs[0]; - } else { - if (!(s = lock_user(VERIFY_READ, ARG(1), len, 1))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, write(ARG(0), s, len)); - unlock_user(s, ARG(1), 0); - if (ret == (uint32_t)-1) - return -1; - return len - ret; - } - case TARGET_SYS_READ: - len = ARG(2); - if (use_gdb_syscalls()) { - arm_semi_syscall_len = len; - gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); - return env->regs[0]; - } else { - if (!(s = lock_user(VERIFY_WRITE, ARG(1), len, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - do - ret = set_swi_errno(ts, read(ARG(0), s, len)); - while (ret == -1 && errno == EINTR); - unlock_user(s, ARG(1), len); - if (ret == (uint32_t)-1) - return -1; - return len - ret; - } - case TARGET_SYS_READC: - /* XXX: Read from debug cosole. Not implemented. */ - return 0; - case TARGET_SYS_ISTTY: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); - return env->regs[0]; - } else { - return isatty(ARG(0)); - } - case TARGET_SYS_SEEK: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); - return env->regs[0]; - } else { - ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); - if (ret == (uint32_t)-1) - return -1; - return 0; - } - case TARGET_SYS_FLEN: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", - ARG(0), env->regs[13]-64); - return env->regs[0]; - } else { - struct stat buf; - ret = set_swi_errno(ts, fstat(ARG(0), &buf)); - if (ret == (uint32_t)-1) - return -1; - return buf.st_size; - } - case TARGET_SYS_TMPNAM: - /* XXX: Not implemented. */ - return -1; - case TARGET_SYS_REMOVE: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)+1); - ret = env->regs[0]; - } else { - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, remove(s)); - unlock_user(s, ARG(0), 0); - } - return ret; - case TARGET_SYS_RENAME: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "rename,%s,%s", - ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); - return env->regs[0]; - } else { - char *s2; - s = lock_user_string(ARG(0)); - s2 = lock_user_string(ARG(2)); - if (!s || !s2) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - ret = (uint32_t)-1; - else - ret = set_swi_errno(ts, rename(s, s2)); - if (s2) - unlock_user(s2, ARG(2), 0); - if (s) - unlock_user(s, ARG(0), 0); - return ret; - } - case TARGET_SYS_CLOCK: - return clock() / (CLOCKS_PER_SEC / 100); - case TARGET_SYS_TIME: - return set_swi_errno(ts, time(NULL)); - case TARGET_SYS_SYSTEM: - if (use_gdb_syscalls()) { - gdb_do_syscall(arm_semi_cb, "system,%s", ARG(0), (int)ARG(1)+1); - return env->regs[0]; - } else { - if (!(s = lock_user_string(ARG(0)))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ret = set_swi_errno(ts, system(s)); - unlock_user(s, ARG(0), 0); - return ret; - } - case TARGET_SYS_ERRNO: -#ifdef CONFIG_USER_ONLY - return ts->swi_errno; -#else - return syscall_err; -#endif - case TARGET_SYS_GET_CMDLINE: - { - /* Build a command-line from the original argv. - * - * The inputs are: - * * ARG(0), pointer to a buffer of at least the size - * specified in ARG(1). - * * ARG(1), size of the buffer pointed to by ARG(0) in - * bytes. - * - * The outputs are: - * * ARG(0), pointer to null-terminated string of the - * command line. - * * ARG(1), length of the string pointed to by ARG(0). - */ - - char *output_buffer; - size_t input_size = ARG(1); - size_t output_size; - int status = 0; - - /* Compute the size of the output string. */ -#if !defined(CONFIG_USER_ONLY) - output_size = strlen(ts->boot_info->kernel_filename) - + 1 /* Separating space. */ - + strlen(ts->boot_info->kernel_cmdline) - + 1; /* Terminating null byte. */ -#else - unsigned int i; - - output_size = ts->info->arg_end - ts->info->arg_start; - if (!output_size) { - /* We special-case the "empty command line" case (argc==0). - Just provide the terminating 0. */ - output_size = 1; - } -#endif - - if (output_size > input_size) { - /* Not enough space to store command-line arguments. */ - return -1; - } - - /* Adjust the command-line length. */ - SET_ARG(1, output_size - 1); - - /* Lock the buffer on the ARM side. */ - output_buffer = lock_user(VERIFY_WRITE, ARG(0), output_size, 0); - if (!output_buffer) { - return -1; - } - - /* Copy the command-line arguments. */ -#if !defined(CONFIG_USER_ONLY) - pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename); - pstrcat(output_buffer, output_size, " "); - pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline); -#else - if (output_size == 1) { - /* Empty command-line. */ - output_buffer[0] = '\0'; - goto out; - } - - if (copy_from_user(output_buffer, ts->info->arg_start, - output_size)) { - status = -1; - goto out; - } - - /* Separate arguments by white spaces. */ - for (i = 0; i < output_size - 1; i++) { - if (output_buffer[i] == 0) { - output_buffer[i] = ' '; - } - } - out: -#endif - /* Unlock the buffer on the ARM side. */ - unlock_user(output_buffer, ARG(0), output_size); - - return status; - } - case TARGET_SYS_HEAPINFO: - { - uint32_t *ptr; - uint32_t limit; - -#ifdef CONFIG_USER_ONLY - /* Some C libraries assume the heap immediately follows .bss, so - allocate it using sbrk. */ - if (!ts->heap_limit) { - abi_ulong ret; - - ts->heap_base = do_brk(0); - limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; - /* Try a big heap, and reduce the size if that fails. */ - for (;;) { - ret = do_brk(limit); - if (ret >= limit) { - break; - } - limit = (ts->heap_base >> 1) + (limit >> 1); - } - ts->heap_limit = limit; - } - - if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - ptr[0] = tswap32(ts->heap_base); - ptr[1] = tswap32(ts->heap_limit); - ptr[2] = tswap32(ts->stack_base); - ptr[3] = tswap32(0); /* Stack limit. */ - unlock_user(ptr, ARG(0), 16); -#else - limit = ram_size; - if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) - /* FIXME - should this error code be -TARGET_EFAULT ? */ - return (uint32_t)-1; - /* TODO: Make this use the limit of the loaded application. */ - ptr[0] = tswap32(limit / 2); - ptr[1] = tswap32(limit); - ptr[2] = tswap32(limit); /* Stack base */ - ptr[3] = tswap32(0); /* Stack limit. */ - unlock_user(ptr, ARG(0), 16); -#endif - return 0; - } - case TARGET_SYS_EXIT: - gdb_exit(env, 0); - exit(0); - default: - fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); - cpu_dump_state(env, stderr, fprintf, 0); - abort(); - } -} diff --git a/configure b/configure index 2c44488131..a2fca50260 100755 --- a/configure +++ b/configure @@ -3514,24 +3514,6 @@ case "$target" in esac mkdir -p $target_dir -mkdir -p $target_dir/fpu -mkdir -p $target_dir/tcg -mkdir -p $target_dir/ide -mkdir -p $target_dir/usb -mkdir -p $target_dir/9pfs -mkdir -p $target_dir/kvm -if test "$target_linux_user" = yes; then - mkdir -p $target_dir/linux-user -fi -if test "$target_bsd_user" = yes; then - mkdir -p $target_dir/bsd-user -fi -if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then - mkdir -p $target_dir/linux-user/arm/nwfpe -fi -symlink "$source_path/Makefile.target" "$target_dir/Makefile" - - echo "# Automatically generated by configure - do not modify" > $config_target_mak bflt="no" @@ -3682,6 +3664,32 @@ case "$target_arch2" in exit 1 ;; esac +# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH +if [ "$TARGET_BASE_ARCH" = "" ]; then + TARGET_BASE_ARCH=$TARGET_ARCH +fi + +mkdir -p $target_dir/fpu +mkdir -p $target_dir/tcg +mkdir -p $target_dir/9pfs +mkdir -p $target_dir/hw +mkdir -p $target_dir/hw/ide +mkdir -p $target_dir/hw/usb +mkdir -p $target_dir/hw/kvm +mkdir -p $target_dir/hw/$TARGET_ARCH +mkdir -p $target_dir/hw/$TARGET_BASE_ARCH +mkdir -p $target_dir/target-$TARGET_BASE_ARCH +if test "$target_linux_user" = yes; then + mkdir -p $target_dir/linux-user +fi +if test "$target_bsd_user" = yes; then + mkdir -p $target_dir/bsd-user +fi +if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then + mkdir -p $target_dir/linux-user/arm/nwfpe +fi +symlink "$source_path/Makefile.target" "$target_dir/Makefile" + case "$target_arch2" in alpha | sparc*) @@ -3697,10 +3705,6 @@ echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`" echo "TARGET_$target_arch_name=y" >> $config_target_mak echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak -# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH -if [ "$TARGET_BASE_ARCH" = "" ]; then - TARGET_BASE_ARCH=$TARGET_ARCH -fi echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH diff --git a/hw/alpha/Makefile.objs b/hw/alpha/Makefile.objs new file mode 100644 index 0000000000..af1c07fa7c --- /dev/null +++ b/hw/alpha/Makefile.objs @@ -0,0 +1,4 @@ +obj-y = mc146818rtc.o +obj-y += alpha_pci.o alpha_dp264.o alpha_typhoon.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs new file mode 100644 index 0000000000..92b4f1eb7f --- /dev/null +++ b/hw/arm/Makefile.objs @@ -0,0 +1,39 @@ +obj-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o +obj-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o +obj-y += versatile_pci.o +obj-y += versatile_i2c.o +obj-y += cadence_uart.o +obj-y += cadence_ttc.o +obj-y += cadence_gem.o +obj-y += xilinx_zynq.o zynq_slcr.o +obj-y += arm_gic.o +obj-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o +obj-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o +obj-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o +obj-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o +obj-y += arm_l2x0.o +obj-y += arm_mptimer.o a15mpcore.o +obj-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-y += highbank.o +obj-y += pl061.o +obj-y += xgmac.o +obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o +obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o +obj-y += gumstix.o +obj-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o +obj-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \ + omap_gpio.o omap_intc.o omap_uart.o +obj-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \ + omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o +obj-y += omap_sx1.o palm.o tsc210x.o +obj-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb/hcd-musb.o +obj-y += mst_fpga.o mainstone.o +obj-y += z2.o +obj-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o +obj-y += framebuffer.o +obj-y += vexpress.o +obj-y += strongarm.o +obj-y += collie.o +obj-y += pl041.o lm4549.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/cris/Makefile.objs b/hw/cris/Makefile.objs new file mode 100644 index 0000000000..aa9298a0ed --- /dev/null +++ b/hw/cris/Makefile.objs @@ -0,0 +1,13 @@ +# Boards +obj-y = cris_pic_cpu.o +obj-y += cris-boot.o +obj-y += axis_dev88.o + +# IO blocks +obj-y += etraxfs_dma.o +obj-y += etraxfs_pic.o +obj-y += etraxfs_eth.o +obj-y += etraxfs_timer.o +obj-y += etraxfs_ser.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs new file mode 100644 index 0000000000..d43f1df5f0 --- /dev/null +++ b/hw/i386/Makefile.objs @@ -0,0 +1,13 @@ +obj-y += mc146818rtc.o pc.o +obj-y += apic_common.o apic.o kvmvapic.o +obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o +obj-y += vmport.o +obj-y += pci-hotplug.o smbios.o wdt_ib700.o +obj-y += debugcon.o multiboot.o +obj-y += pc_piix.o +obj-y += pc_sysfw.o +obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o +obj-$(CONFIG_KVM) += kvm/clock.o kvm/apic.o kvm/i8259.o kvm/ioapic.o kvm/i8254.o +obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/lm32/Makefile.objs b/hw/lm32/Makefile.objs new file mode 100644 index 0000000000..4e1843c11d --- /dev/null +++ b/hw/lm32/Makefile.objs @@ -0,0 +1,23 @@ +# LM32 boards +obj-y += lm32_boards.o +obj-y += milkymist.o + +# LM32 peripherals +obj-y += lm32_pic.o +obj-y += lm32_juart.o +obj-y += lm32_timer.o +obj-y += lm32_uart.o +obj-y += lm32_sys.o +obj-y += milkymist-ac97.o +obj-y += milkymist-hpdmc.o +obj-y += milkymist-memcard.o +obj-y += milkymist-minimac2.o +obj-y += milkymist-pfpu.o +obj-y += milkymist-softusb.o +obj-y += milkymist-sysctl.o +obj-$(CONFIG_OPENGL) += milkymist-tmu2.o +obj-y += milkymist-uart.o +obj-y += milkymist-vgafb.o +obj-y += framebuffer.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/m68k/Makefile.objs b/hw/m68k/Makefile.objs new file mode 100644 index 0000000000..93b6d25baf --- /dev/null +++ b/hw/m68k/Makefile.objs @@ -0,0 +1,4 @@ +obj-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o +obj-y += dummy_m68k.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/microblaze/Makefile.objs b/hw/microblaze/Makefile.objs new file mode 100644 index 0000000000..41724425cb --- /dev/null +++ b/hw/microblaze/Makefile.objs @@ -0,0 +1,13 @@ +obj-y = petalogix_s3adsp1800_mmu.o +obj-y += petalogix_ml605_mmu.o +obj-y += microblaze_boot.o + +obj-y += microblaze_pic_cpu.o +obj-y += xilinx_intc.o +obj-y += xilinx_timer.o +obj-y += xilinx_uartlite.o +obj-y += xilinx_ethlite.o +obj-y += xilinx_axidma.o +obj-y += xilinx_axienet.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/mips/Makefile.objs b/hw/mips/Makefile.objs new file mode 100644 index 0000000000..29a5d0db04 --- /dev/null +++ b/hw/mips/Makefile.objs @@ -0,0 +1,6 @@ +obj-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o +obj-y += mips_addr.o mips_timer.o mips_int.o +obj-y += gt64xxx.o mc146818rtc.o +obj-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs new file mode 100644 index 0000000000..5b09849bed --- /dev/null +++ b/hw/ppc/Makefile.objs @@ -0,0 +1,31 @@ +# shared objects +obj-y = ppc.o ppc_booke.o +# PREP target +obj-y += mc146818rtc.o +obj-y += ppc_prep.o +# OldWorld PowerMac +obj-y += ppc_oldworld.o +# NewWorld PowerMac +obj-y += ppc_newworld.o +# IBM pSeries (sPAPR) +obj-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o +obj-$(CONFIG_PSERIES) += xics.o spapr_vty.o spapr_llan.o spapr_vscsi.o +obj-$(CONFIG_PSERIES) += spapr_pci.o pci-hotplug.o +# PowerPC 4xx boards +obj-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o +obj-y += ppc440_bamboo.o +# PowerPC E500 boards +obj-y += ppce500_mpc8544ds.o mpc8544_guts.o ppce500_spin.o +# PowerPC 440 Xilinx ML507 reference board. +obj-y += virtex_ml507.o +obj-$(CONFIG_KVM) += kvm_ppc.o +# PowerPC OpenPIC +obj-y += openpic.o + +# Xilinx PPC peripherals +obj-y += xilinx_intc.o +obj-y += xilinx_timer.o +obj-y += xilinx_uartlite.o +obj-y += xilinx_ethlite.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/s390x/Makefile.objs b/hw/s390x/Makefile.objs new file mode 100644 index 0000000000..dcdcac8a81 --- /dev/null +++ b/hw/s390x/Makefile.objs @@ -0,0 +1,3 @@ +obj-y = s390-virtio-bus.o s390-virtio.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/sh4/Makefile.objs b/hw/sh4/Makefile.objs new file mode 100644 index 0000000000..68c5921790 --- /dev/null +++ b/hw/sh4/Makefile.objs @@ -0,0 +1,5 @@ +obj-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o +obj-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o +obj-y += ide/mmio.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/sparc/Makefile.objs b/hw/sparc/Makefile.objs new file mode 100644 index 0000000000..a39a511c52 --- /dev/null +++ b/hw/sparc/Makefile.objs @@ -0,0 +1,8 @@ +obj-y = sun4m.o lance.o tcx.o sun4m_iommu.o slavio_intctl.o +obj-y += slavio_timer.o slavio_misc.o sparc32_dma.o +obj-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o leon3.o + +# GRLIB +obj-y += grlib_gptimer.o grlib_irqmp.o grlib_apbuart.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/sparc64/Makefile.objs b/hw/sparc64/Makefile.objs new file mode 100644 index 0000000000..8c65fc4215 --- /dev/null +++ b/hw/sparc64/Makefile.objs @@ -0,0 +1,4 @@ +obj-y = sun4u.o apb_pci.o +obj-y += mc146818rtc.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/xtensa/Makefile.objs b/hw/xtensa/Makefile.objs new file mode 100644 index 0000000000..79698e903d --- /dev/null +++ b/hw/xtensa/Makefile.objs @@ -0,0 +1,5 @@ +obj-y += xtensa_pic.o +obj-y += xtensa_sim.o +obj-y += xtensa_lx60.o + +obj-y := $(addprefix ../,$(obj-y)) diff --git a/ioport-user.c b/ioport-user.c deleted file mode 100644 index 03fac22d22..0000000000 --- a/ioport-user.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * qemu user ioport functions - * - * Copyright (c) 2003-2008 Fabrice Bellard - * - * 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 . - */ - -#include - -#include "qemu.h" -#include "qemu-common.h" -#include "ioport.h" - -void cpu_outb(pio_addr_t addr, uint8_t val) -{ - fprintf(stderr, "outb: port=0x%04"FMT_pioaddr", data=%02"PRIx8"\n", - addr, val); -} - -void cpu_outw(pio_addr_t addr, uint16_t val) -{ - fprintf(stderr, "outw: port=0x%04"FMT_pioaddr", data=%04"PRIx16"\n", - addr, val); -} - -void cpu_outl(pio_addr_t addr, uint32_t val) -{ - fprintf(stderr, "outl: port=0x%04"FMT_pioaddr", data=%08"PRIx32"\n", - addr, val); -} - -uint8_t cpu_inb(pio_addr_t addr) -{ - fprintf(stderr, "inb: port=0x%04"FMT_pioaddr"\n", addr); - return 0; -} - -uint16_t cpu_inw(pio_addr_t addr) -{ - fprintf(stderr, "inw: port=0x%04"FMT_pioaddr"\n", addr); - return 0; -} - -uint32_t cpu_inl(pio_addr_t addr) -{ - fprintf(stderr, "inl: port=0x%04"FMT_pioaddr"\n", addr); - return 0; -} diff --git a/m68k-semi.c b/m68k-semi.c deleted file mode 100644 index 3bb30cd1f7..0000000000 --- a/m68k-semi.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * m68k/ColdFire Semihosting syscall interface - * - * Copyright (c) 2005-2007 CodeSourcery. - * - * 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 . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cpu.h" -#if defined(CONFIG_USER_ONLY) -#include "qemu.h" -#define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024) -#else -#include "qemu-common.h" -#include "gdbstub.h" -#include "softmmu-semi.h" -#endif -#include "sysemu.h" - -#define HOSTED_EXIT 0 -#define HOSTED_INIT_SIM 1 -#define HOSTED_OPEN 2 -#define HOSTED_CLOSE 3 -#define HOSTED_READ 4 -#define HOSTED_WRITE 5 -#define HOSTED_LSEEK 6 -#define HOSTED_RENAME 7 -#define HOSTED_UNLINK 8 -#define HOSTED_STAT 9 -#define HOSTED_FSTAT 10 -#define HOSTED_GETTIMEOFDAY 11 -#define HOSTED_ISATTY 12 -#define HOSTED_SYSTEM 13 - -typedef uint32_t gdb_mode_t; -typedef uint32_t gdb_time_t; - -struct m68k_gdb_stat { - uint32_t gdb_st_dev; /* device */ - uint32_t gdb_st_ino; /* inode */ - gdb_mode_t gdb_st_mode; /* protection */ - uint32_t gdb_st_nlink; /* number of hard links */ - uint32_t gdb_st_uid; /* user ID of owner */ - uint32_t gdb_st_gid; /* group ID of owner */ - uint32_t gdb_st_rdev; /* device type (if inode device) */ - uint64_t gdb_st_size; /* total size, in bytes */ - uint64_t gdb_st_blksize; /* blocksize for filesystem I/O */ - uint64_t gdb_st_blocks; /* number of blocks allocated */ - gdb_time_t gdb_st_atime; /* time of last access */ - gdb_time_t gdb_st_mtime; /* time of last modification */ - gdb_time_t gdb_st_ctime; /* time of last change */ -} QEMU_PACKED; - -struct gdb_timeval { - gdb_time_t tv_sec; /* second */ - uint64_t tv_usec; /* microsecond */ -} QEMU_PACKED; - -#define GDB_O_RDONLY 0x0 -#define GDB_O_WRONLY 0x1 -#define GDB_O_RDWR 0x2 -#define GDB_O_APPEND 0x8 -#define GDB_O_CREAT 0x200 -#define GDB_O_TRUNC 0x400 -#define GDB_O_EXCL 0x800 - -static int translate_openflags(int flags) -{ - int hf; - - if (flags & GDB_O_WRONLY) - hf = O_WRONLY; - else if (flags & GDB_O_RDWR) - hf = O_RDWR; - else - hf = O_RDONLY; - - if (flags & GDB_O_APPEND) hf |= O_APPEND; - if (flags & GDB_O_CREAT) hf |= O_CREAT; - if (flags & GDB_O_TRUNC) hf |= O_TRUNC; - if (flags & GDB_O_EXCL) hf |= O_EXCL; - - return hf; -} - -static void translate_stat(CPUM68KState *env, target_ulong addr, struct stat *s) -{ - struct m68k_gdb_stat *p; - - if (!(p = lock_user(VERIFY_WRITE, addr, sizeof(struct m68k_gdb_stat), 0))) - /* FIXME - should this return an error code? */ - return; - p->gdb_st_dev = cpu_to_be32(s->st_dev); - p->gdb_st_ino = cpu_to_be32(s->st_ino); - p->gdb_st_mode = cpu_to_be32(s->st_mode); - p->gdb_st_nlink = cpu_to_be32(s->st_nlink); - p->gdb_st_uid = cpu_to_be32(s->st_uid); - p->gdb_st_gid = cpu_to_be32(s->st_gid); - p->gdb_st_rdev = cpu_to_be32(s->st_rdev); - p->gdb_st_size = cpu_to_be64(s->st_size); -#ifdef _WIN32 - /* Windows stat is missing some fields. */ - p->gdb_st_blksize = 0; - p->gdb_st_blocks = 0; -#else - p->gdb_st_blksize = cpu_to_be64(s->st_blksize); - p->gdb_st_blocks = cpu_to_be64(s->st_blocks); -#endif - p->gdb_st_atime = cpu_to_be32(s->st_atime); - p->gdb_st_mtime = cpu_to_be32(s->st_mtime); - p->gdb_st_ctime = cpu_to_be32(s->st_ctime); - unlock_user(p, addr, sizeof(struct m68k_gdb_stat)); -} - -static int m68k_semi_is_fseek; - -static void m68k_semi_cb(CPUM68KState *env, target_ulong ret, target_ulong err) -{ - target_ulong args; - - args = env->dregs[1]; - if (m68k_semi_is_fseek) { - /* FIXME: We've already lost the high bits of the fseek - return value. */ - /* FIXME - handle put_user() failure */ - put_user_u32(0, args); - args += 4; - m68k_semi_is_fseek = 0; - } - /* FIXME - handle put_user() failure */ - put_user_u32(ret, args); - put_user_u32(errno, args + 4); -} - -#define ARG(n) \ -({ \ - target_ulong __arg; \ - /* FIXME - handle get_user() failure */ \ - get_user_ual(__arg, args + (n) * 4); \ - __arg; \ -}) -#define PARG(x) ((unsigned long)ARG(x)) -void do_m68k_semihosting(CPUM68KState *env, int nr) -{ - uint32_t args; - void *p; - void *q; - uint32_t len; - uint32_t result; - - args = env->dregs[1]; - switch (nr) { - case HOSTED_EXIT: - gdb_exit(env, env->dregs[0]); - exit(env->dregs[0]); - case HOSTED_OPEN: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "open,%s,%x,%x", ARG(0), (int)ARG(1), - ARG(2), ARG(3)); - return; - } else { - if (!(p = lock_user_string(ARG(0)))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = open(p, translate_openflags(ARG(2)), ARG(3)); - unlock_user(p, ARG(0), 0); - } - } - break; - case HOSTED_CLOSE: - { - /* Ignore attempts to close stdin/out/err. */ - int fd = ARG(0); - if (fd > 2) { - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); - return; - } else { - result = close(fd); - } - } else { - result = 0; - } - break; - } - case HOSTED_READ: - len = ARG(2); - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", - ARG(0), ARG(1), len); - return; - } else { - if (!(p = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = read(ARG(0), p, len); - unlock_user(p, ARG(1), len); - } - } - break; - case HOSTED_WRITE: - len = ARG(2); - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", - ARG(0), ARG(1), len); - return; - } else { - if (!(p = lock_user(VERIFY_READ, ARG(1), len, 1))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = write(ARG(0), p, len); - unlock_user(p, ARG(0), 0); - } - } - break; - case HOSTED_LSEEK: - { - uint64_t off; - off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); - if (use_gdb_syscalls()) { - m68k_semi_is_fseek = 1; - gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", - ARG(0), off, ARG(3)); - } else { - off = lseek(ARG(0), off, ARG(3)); - /* FIXME - handle put_user() failure */ - put_user_u32(off >> 32, args); - put_user_u32(off, args + 4); - put_user_u32(errno, args + 8); - } - return; - } - case HOSTED_RENAME: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "rename,%s,%s", - ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); - return; - } else { - p = lock_user_string(ARG(0)); - q = lock_user_string(ARG(2)); - if (!p || !q) { - /* FIXME - check error code? */ - result = -1; - } else { - result = rename(p, q); - } - unlock_user(p, ARG(0), 0); - unlock_user(q, ARG(2), 0); - } - break; - case HOSTED_UNLINK: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "unlink,%s", - ARG(0), (int)ARG(1)); - return; - } else { - if (!(p = lock_user_string(ARG(0)))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = unlink(p); - unlock_user(p, ARG(0), 0); - } - } - break; - case HOSTED_STAT: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "stat,%s,%x", - ARG(0), (int)ARG(1), ARG(2)); - return; - } else { - struct stat s; - if (!(p = lock_user_string(ARG(0)))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = stat(p, &s); - unlock_user(p, ARG(0), 0); - } - if (result == 0) { - translate_stat(env, ARG(2), &s); - } - } - break; - case HOSTED_FSTAT: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", - ARG(0), ARG(1)); - return; - } else { - struct stat s; - result = fstat(ARG(0), &s); - if (result == 0) { - translate_stat(env, ARG(1), &s); - } - } - break; - case HOSTED_GETTIMEOFDAY: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", - ARG(0), ARG(1)); - return; - } else { - qemu_timeval tv; - struct gdb_timeval *p; - result = qemu_gettimeofday(&tv); - if (result != 0) { - if (!(p = lock_user(VERIFY_WRITE, - ARG(0), sizeof(struct gdb_timeval), 0))) { - /* FIXME - check error code? */ - result = -1; - } else { - p->tv_sec = cpu_to_be32(tv.tv_sec); - p->tv_usec = cpu_to_be64(tv.tv_usec); - unlock_user(p, ARG(0), sizeof(struct gdb_timeval)); - } - } - } - break; - case HOSTED_ISATTY: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); - return; - } else { - result = isatty(ARG(0)); - } - break; - case HOSTED_SYSTEM: - if (use_gdb_syscalls()) { - gdb_do_syscall(m68k_semi_cb, "system,%s", - ARG(0), (int)ARG(1)); - return; - } else { - if (!(p = lock_user_string(ARG(0)))) { - /* FIXME - check error code? */ - result = -1; - } else { - result = system(p); - unlock_user(p, ARG(0), 0); - } - } - break; - case HOSTED_INIT_SIM: -#if defined(CONFIG_USER_ONLY) - { - TaskState *ts = env->opaque; - /* Allocate the heap using sbrk. */ - if (!ts->heap_limit) { - abi_ulong ret; - uint32_t size; - uint32_t base; - - base = do_brk(0); - size = SEMIHOSTING_HEAP_SIZE; - /* Try a big heap, and reduce the size if that fails. */ - for (;;) { - ret = do_brk(base + size); - if (ret >= (base + size)) { - break; - } - size >>= 1; - } - ts->heap_limit = base + size; - } - /* This call may happen before we have writable memory, so return - values directly in registers. */ - env->dregs[1] = ts->heap_limit; - env->aregs[7] = ts->stack_base; - } -#else - /* FIXME: This is wrong for boards where RAM does not start at - address zero. */ - env->dregs[1] = ram_size; - env->aregs[7] = ram_size; -#endif - return; - default: - cpu_abort(env, "Unsupported semihosting syscall %d\n", nr); - result = 0; - } - /* FIXME - handle put_user() failure */ - put_user_u32(result, args); - put_user_u32(errno, args + 4); -} diff --git a/target-alpha/Makefile.objs b/target-alpha/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-alpha/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs new file mode 100644 index 0000000000..f5bb920266 --- /dev/null +++ b/target-arm/Makefile.objs @@ -0,0 +1 @@ +obj-y += arm-semi.o diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c new file mode 100644 index 0000000000..88ca9bb1b7 --- /dev/null +++ b/target-arm/arm-semi.c @@ -0,0 +1,509 @@ +/* + * Arm "Angel" semihosting syscalls + * + * Copyright (c) 2005, 2007 CodeSourcery. + * Written by Paul Brook. + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "cpu.h" +#ifdef CONFIG_USER_ONLY +#include "qemu.h" + +#define ARM_ANGEL_HEAP_SIZE (128 * 1024 * 1024) +#else +#include "qemu-common.h" +#include "gdbstub.h" +#include "hw/arm-misc.h" +#endif + +#define TARGET_SYS_OPEN 0x01 +#define TARGET_SYS_CLOSE 0x02 +#define TARGET_SYS_WRITEC 0x03 +#define TARGET_SYS_WRITE0 0x04 +#define TARGET_SYS_WRITE 0x05 +#define TARGET_SYS_READ 0x06 +#define TARGET_SYS_READC 0x07 +#define TARGET_SYS_ISTTY 0x09 +#define TARGET_SYS_SEEK 0x0a +#define TARGET_SYS_FLEN 0x0c +#define TARGET_SYS_TMPNAM 0x0d +#define TARGET_SYS_REMOVE 0x0e +#define TARGET_SYS_RENAME 0x0f +#define TARGET_SYS_CLOCK 0x10 +#define TARGET_SYS_TIME 0x11 +#define TARGET_SYS_SYSTEM 0x12 +#define TARGET_SYS_ERRNO 0x13 +#define TARGET_SYS_GET_CMDLINE 0x15 +#define TARGET_SYS_HEAPINFO 0x16 +#define TARGET_SYS_EXIT 0x18 + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +#define GDB_O_RDONLY 0x000 +#define GDB_O_WRONLY 0x001 +#define GDB_O_RDWR 0x002 +#define GDB_O_APPEND 0x008 +#define GDB_O_CREAT 0x200 +#define GDB_O_TRUNC 0x400 +#define GDB_O_BINARY 0 + +static int gdb_open_modeflags[12] = { + GDB_O_RDONLY, + GDB_O_RDONLY | GDB_O_BINARY, + GDB_O_RDWR, + GDB_O_RDWR | GDB_O_BINARY, + GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC, + GDB_O_WRONLY | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, + GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC, + GDB_O_RDWR | GDB_O_CREAT | GDB_O_TRUNC | GDB_O_BINARY, + GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND, + GDB_O_WRONLY | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY, + GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND, + GDB_O_RDWR | GDB_O_CREAT | GDB_O_APPEND | GDB_O_BINARY +}; + +static int open_modeflags[12] = { + O_RDONLY, + O_RDONLY | O_BINARY, + O_RDWR, + O_RDWR | O_BINARY, + O_WRONLY | O_CREAT | O_TRUNC, + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, + O_RDWR | O_CREAT | O_TRUNC, + O_RDWR | O_CREAT | O_TRUNC | O_BINARY, + O_WRONLY | O_CREAT | O_APPEND, + O_WRONLY | O_CREAT | O_APPEND | O_BINARY, + O_RDWR | O_CREAT | O_APPEND, + O_RDWR | O_CREAT | O_APPEND | O_BINARY +}; + +#ifdef CONFIG_USER_ONLY +static inline uint32_t set_swi_errno(TaskState *ts, uint32_t code) +{ + if (code == (uint32_t)-1) + ts->swi_errno = errno; + return code; +} +#else +static inline uint32_t set_swi_errno(CPUARMState *env, uint32_t code) +{ + return code; +} + +#include "softmmu-semi.h" +#endif + +static target_ulong arm_semi_syscall_len; + +#if !defined(CONFIG_USER_ONLY) +static target_ulong syscall_err; +#endif + +static void arm_semi_cb(CPUARMState *env, target_ulong ret, target_ulong err) +{ +#ifdef CONFIG_USER_ONLY + TaskState *ts = env->opaque; +#endif + + if (ret == (target_ulong)-1) { +#ifdef CONFIG_USER_ONLY + ts->swi_errno = err; +#else + syscall_err = err; +#endif + env->regs[0] = ret; + } else { + /* Fixup syscalls that use nonstardard return conventions. */ + switch (env->regs[0]) { + case TARGET_SYS_WRITE: + case TARGET_SYS_READ: + env->regs[0] = arm_semi_syscall_len - ret; + break; + case TARGET_SYS_SEEK: + env->regs[0] = 0; + break; + default: + env->regs[0] = ret; + break; + } + } +} + +static void arm_semi_flen_cb(CPUARMState *env, target_ulong ret, target_ulong err) +{ + /* The size is always stored in big-endian order, extract + the value. We assume the size always fit in 32 bits. */ + uint32_t size; + cpu_memory_rw_debug(env, env->regs[13]-64+32, (uint8_t *)&size, 4, 0); + env->regs[0] = be32_to_cpu(size); +#ifdef CONFIG_USER_ONLY + ((TaskState *)env->opaque)->swi_errno = err; +#else + syscall_err = err; +#endif +} + +#define ARG(n) \ +({ \ + target_ulong __arg; \ + /* FIXME - handle get_user() failure */ \ + get_user_ual(__arg, args + (n) * 4); \ + __arg; \ +}) +#define SET_ARG(n, val) put_user_ual(val, args + (n) * 4) +uint32_t do_arm_semihosting(CPUARMState *env) +{ + target_ulong args; + char * s; + int nr; + uint32_t ret; + uint32_t len; +#ifdef CONFIG_USER_ONLY + TaskState *ts = env->opaque; +#else + CPUARMState *ts = env; +#endif + + nr = env->regs[0]; + args = env->regs[1]; + switch (nr) { + case TARGET_SYS_OPEN: + if (!(s = lock_user_string(ARG(0)))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + if (ARG(1) >= 12) + return (uint32_t)-1; + if (strcmp(s, ":tt") == 0) { + if (ARG(1) < 4) + return STDIN_FILENO; + else + return STDOUT_FILENO; + } + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "open,%s,%x,1a4", ARG(0), + (int)ARG(2)+1, gdb_open_modeflags[ARG(1)]); + return env->regs[0]; + } else { + ret = set_swi_errno(ts, open(s, open_modeflags[ARG(1)], 0644)); + } + unlock_user(s, ARG(0), 0); + return ret; + case TARGET_SYS_CLOSE: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "close,%x", ARG(0)); + return env->regs[0]; + } else { + return set_swi_errno(ts, close(ARG(0))); + } + case TARGET_SYS_WRITEC: + { + char c; + + if (get_user_u8(c, args)) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + /* Write to debug console. stderr is near enough. */ + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "write,2,%x,1", args); + return env->regs[0]; + } else { + return write(STDERR_FILENO, &c, 1); + } + } + case TARGET_SYS_WRITE0: + if (!(s = lock_user_string(args))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + len = strlen(s); + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "write,2,%x,%x\n", args, len); + ret = env->regs[0]; + } else { + ret = write(STDERR_FILENO, s, len); + } + unlock_user(s, args, 0); + return ret; + case TARGET_SYS_WRITE: + len = ARG(2); + if (use_gdb_syscalls()) { + arm_semi_syscall_len = len; + gdb_do_syscall(arm_semi_cb, "write,%x,%x,%x", ARG(0), ARG(1), len); + return env->regs[0]; + } else { + if (!(s = lock_user(VERIFY_READ, ARG(1), len, 1))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + ret = set_swi_errno(ts, write(ARG(0), s, len)); + unlock_user(s, ARG(1), 0); + if (ret == (uint32_t)-1) + return -1; + return len - ret; + } + case TARGET_SYS_READ: + len = ARG(2); + if (use_gdb_syscalls()) { + arm_semi_syscall_len = len; + gdb_do_syscall(arm_semi_cb, "read,%x,%x,%x", ARG(0), ARG(1), len); + return env->regs[0]; + } else { + if (!(s = lock_user(VERIFY_WRITE, ARG(1), len, 0))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + do + ret = set_swi_errno(ts, read(ARG(0), s, len)); + while (ret == -1 && errno == EINTR); + unlock_user(s, ARG(1), len); + if (ret == (uint32_t)-1) + return -1; + return len - ret; + } + case TARGET_SYS_READC: + /* XXX: Read from debug cosole. Not implemented. */ + return 0; + case TARGET_SYS_ISTTY: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "isatty,%x", ARG(0)); + return env->regs[0]; + } else { + return isatty(ARG(0)); + } + case TARGET_SYS_SEEK: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "lseek,%x,%x,0", ARG(0), ARG(1)); + return env->regs[0]; + } else { + ret = set_swi_errno(ts, lseek(ARG(0), ARG(1), SEEK_SET)); + if (ret == (uint32_t)-1) + return -1; + return 0; + } + case TARGET_SYS_FLEN: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_flen_cb, "fstat,%x,%x", + ARG(0), env->regs[13]-64); + return env->regs[0]; + } else { + struct stat buf; + ret = set_swi_errno(ts, fstat(ARG(0), &buf)); + if (ret == (uint32_t)-1) + return -1; + return buf.st_size; + } + case TARGET_SYS_TMPNAM: + /* XXX: Not implemented. */ + return -1; + case TARGET_SYS_REMOVE: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "unlink,%s", ARG(0), (int)ARG(1)+1); + ret = env->regs[0]; + } else { + if (!(s = lock_user_string(ARG(0)))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + ret = set_swi_errno(ts, remove(s)); + unlock_user(s, ARG(0), 0); + } + return ret; + case TARGET_SYS_RENAME: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "rename,%s,%s", + ARG(0), (int)ARG(1)+1, ARG(2), (int)ARG(3)+1); + return env->regs[0]; + } else { + char *s2; + s = lock_user_string(ARG(0)); + s2 = lock_user_string(ARG(2)); + if (!s || !s2) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + ret = (uint32_t)-1; + else + ret = set_swi_errno(ts, rename(s, s2)); + if (s2) + unlock_user(s2, ARG(2), 0); + if (s) + unlock_user(s, ARG(0), 0); + return ret; + } + case TARGET_SYS_CLOCK: + return clock() / (CLOCKS_PER_SEC / 100); + case TARGET_SYS_TIME: + return set_swi_errno(ts, time(NULL)); + case TARGET_SYS_SYSTEM: + if (use_gdb_syscalls()) { + gdb_do_syscall(arm_semi_cb, "system,%s", ARG(0), (int)ARG(1)+1); + return env->regs[0]; + } else { + if (!(s = lock_user_string(ARG(0)))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + ret = set_swi_errno(ts, system(s)); + unlock_user(s, ARG(0), 0); + return ret; + } + case TARGET_SYS_ERRNO: +#ifdef CONFIG_USER_ONLY + return ts->swi_errno; +#else + return syscall_err; +#endif + case TARGET_SYS_GET_CMDLINE: + { + /* Build a command-line from the original argv. + * + * The inputs are: + * * ARG(0), pointer to a buffer of at least the size + * specified in ARG(1). + * * ARG(1), size of the buffer pointed to by ARG(0) in + * bytes. + * + * The outputs are: + * * ARG(0), pointer to null-terminated string of the + * command line. + * * ARG(1), length of the string pointed to by ARG(0). + */ + + char *output_buffer; + size_t input_size = ARG(1); + size_t output_size; + int status = 0; + + /* Compute the size of the output string. */ +#if !defined(CONFIG_USER_ONLY) + output_size = strlen(ts->boot_info->kernel_filename) + + 1 /* Separating space. */ + + strlen(ts->boot_info->kernel_cmdline) + + 1; /* Terminating null byte. */ +#else + unsigned int i; + + output_size = ts->info->arg_end - ts->info->arg_start; + if (!output_size) { + /* We special-case the "empty command line" case (argc==0). + Just provide the terminating 0. */ + output_size = 1; + } +#endif + + if (output_size > input_size) { + /* Not enough space to store command-line arguments. */ + return -1; + } + + /* Adjust the command-line length. */ + SET_ARG(1, output_size - 1); + + /* Lock the buffer on the ARM side. */ + output_buffer = lock_user(VERIFY_WRITE, ARG(0), output_size, 0); + if (!output_buffer) { + return -1; + } + + /* Copy the command-line arguments. */ +#if !defined(CONFIG_USER_ONLY) + pstrcpy(output_buffer, output_size, ts->boot_info->kernel_filename); + pstrcat(output_buffer, output_size, " "); + pstrcat(output_buffer, output_size, ts->boot_info->kernel_cmdline); +#else + if (output_size == 1) { + /* Empty command-line. */ + output_buffer[0] = '\0'; + goto out; + } + + if (copy_from_user(output_buffer, ts->info->arg_start, + output_size)) { + status = -1; + goto out; + } + + /* Separate arguments by white spaces. */ + for (i = 0; i < output_size - 1; i++) { + if (output_buffer[i] == 0) { + output_buffer[i] = ' '; + } + } + out: +#endif + /* Unlock the buffer on the ARM side. */ + unlock_user(output_buffer, ARG(0), output_size); + + return status; + } + case TARGET_SYS_HEAPINFO: + { + uint32_t *ptr; + uint32_t limit; + +#ifdef CONFIG_USER_ONLY + /* Some C libraries assume the heap immediately follows .bss, so + allocate it using sbrk. */ + if (!ts->heap_limit) { + abi_ulong ret; + + ts->heap_base = do_brk(0); + limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE; + /* Try a big heap, and reduce the size if that fails. */ + for (;;) { + ret = do_brk(limit); + if (ret >= limit) { + break; + } + limit = (ts->heap_base >> 1) + (limit >> 1); + } + ts->heap_limit = limit; + } + + if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + ptr[0] = tswap32(ts->heap_base); + ptr[1] = tswap32(ts->heap_limit); + ptr[2] = tswap32(ts->stack_base); + ptr[3] = tswap32(0); /* Stack limit. */ + unlock_user(ptr, ARG(0), 16); +#else + limit = ram_size; + if (!(ptr = lock_user(VERIFY_WRITE, ARG(0), 16, 0))) + /* FIXME - should this error code be -TARGET_EFAULT ? */ + return (uint32_t)-1; + /* TODO: Make this use the limit of the loaded application. */ + ptr[0] = tswap32(limit / 2); + ptr[1] = tswap32(limit); + ptr[2] = tswap32(limit); /* Stack base */ + ptr[3] = tswap32(0); /* Stack limit. */ + unlock_user(ptr, ARG(0), 16); +#endif + return 0; + } + case TARGET_SYS_EXIT: + gdb_exit(env, 0); + exit(0); + default: + fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr); + cpu_dump_state(env, stderr, fprintf, 0); + abort(); + } +} diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-cris/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs new file mode 100644 index 0000000000..93c6f3fce5 --- /dev/null +++ b/target-i386/Makefile.objs @@ -0,0 +1,3 @@ +obj-$(CONFIG_KVM) += hyperv.o +obj-$(CONFIG_LINUX_USER) += ioport-user.o +obj-$(CONFIG_BSD_USER) += ioport-user.o diff --git a/target-i386/ioport-user.c b/target-i386/ioport-user.c new file mode 100644 index 0000000000..03fac22d22 --- /dev/null +++ b/target-i386/ioport-user.c @@ -0,0 +1,60 @@ +/* + * qemu user ioport functions + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * 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 . + */ + +#include + +#include "qemu.h" +#include "qemu-common.h" +#include "ioport.h" + +void cpu_outb(pio_addr_t addr, uint8_t val) +{ + fprintf(stderr, "outb: port=0x%04"FMT_pioaddr", data=%02"PRIx8"\n", + addr, val); +} + +void cpu_outw(pio_addr_t addr, uint16_t val) +{ + fprintf(stderr, "outw: port=0x%04"FMT_pioaddr", data=%04"PRIx16"\n", + addr, val); +} + +void cpu_outl(pio_addr_t addr, uint32_t val) +{ + fprintf(stderr, "outl: port=0x%04"FMT_pioaddr", data=%08"PRIx32"\n", + addr, val); +} + +uint8_t cpu_inb(pio_addr_t addr) +{ + fprintf(stderr, "inb: port=0x%04"FMT_pioaddr"\n", addr); + return 0; +} + +uint16_t cpu_inw(pio_addr_t addr) +{ + fprintf(stderr, "inw: port=0x%04"FMT_pioaddr"\n", addr); + return 0; +} + +uint32_t cpu_inl(pio_addr_t addr) +{ + fprintf(stderr, "inl: port=0x%04"FMT_pioaddr"\n", addr); + return 0; +} diff --git a/target-lm32/Makefile.objs b/target-lm32/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-lm32/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-m68k/Makefile.objs b/target-m68k/Makefile.objs new file mode 100644 index 0000000000..e73a5ba289 --- /dev/null +++ b/target-m68k/Makefile.objs @@ -0,0 +1 @@ +obj-y += m68k-semi.o diff --git a/target-m68k/m68k-semi.c b/target-m68k/m68k-semi.c new file mode 100644 index 0000000000..3bb30cd1f7 --- /dev/null +++ b/target-m68k/m68k-semi.c @@ -0,0 +1,408 @@ +/* + * m68k/ColdFire Semihosting syscall interface + * + * Copyright (c) 2005-2007 CodeSourcery. + * + * 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 . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cpu.h" +#if defined(CONFIG_USER_ONLY) +#include "qemu.h" +#define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024) +#else +#include "qemu-common.h" +#include "gdbstub.h" +#include "softmmu-semi.h" +#endif +#include "sysemu.h" + +#define HOSTED_EXIT 0 +#define HOSTED_INIT_SIM 1 +#define HOSTED_OPEN 2 +#define HOSTED_CLOSE 3 +#define HOSTED_READ 4 +#define HOSTED_WRITE 5 +#define HOSTED_LSEEK 6 +#define HOSTED_RENAME 7 +#define HOSTED_UNLINK 8 +#define HOSTED_STAT 9 +#define HOSTED_FSTAT 10 +#define HOSTED_GETTIMEOFDAY 11 +#define HOSTED_ISATTY 12 +#define HOSTED_SYSTEM 13 + +typedef uint32_t gdb_mode_t; +typedef uint32_t gdb_time_t; + +struct m68k_gdb_stat { + uint32_t gdb_st_dev; /* device */ + uint32_t gdb_st_ino; /* inode */ + gdb_mode_t gdb_st_mode; /* protection */ + uint32_t gdb_st_nlink; /* number of hard links */ + uint32_t gdb_st_uid; /* user ID of owner */ + uint32_t gdb_st_gid; /* group ID of owner */ + uint32_t gdb_st_rdev; /* device type (if inode device) */ + uint64_t gdb_st_size; /* total size, in bytes */ + uint64_t gdb_st_blksize; /* blocksize for filesystem I/O */ + uint64_t gdb_st_blocks; /* number of blocks allocated */ + gdb_time_t gdb_st_atime; /* time of last access */ + gdb_time_t gdb_st_mtime; /* time of last modification */ + gdb_time_t gdb_st_ctime; /* time of last change */ +} QEMU_PACKED; + +struct gdb_timeval { + gdb_time_t tv_sec; /* second */ + uint64_t tv_usec; /* microsecond */ +} QEMU_PACKED; + +#define GDB_O_RDONLY 0x0 +#define GDB_O_WRONLY 0x1 +#define GDB_O_RDWR 0x2 +#define GDB_O_APPEND 0x8 +#define GDB_O_CREAT 0x200 +#define GDB_O_TRUNC 0x400 +#define GDB_O_EXCL 0x800 + +static int translate_openflags(int flags) +{ + int hf; + + if (flags & GDB_O_WRONLY) + hf = O_WRONLY; + else if (flags & GDB_O_RDWR) + hf = O_RDWR; + else + hf = O_RDONLY; + + if (flags & GDB_O_APPEND) hf |= O_APPEND; + if (flags & GDB_O_CREAT) hf |= O_CREAT; + if (flags & GDB_O_TRUNC) hf |= O_TRUNC; + if (flags & GDB_O_EXCL) hf |= O_EXCL; + + return hf; +} + +static void translate_stat(CPUM68KState *env, target_ulong addr, struct stat *s) +{ + struct m68k_gdb_stat *p; + + if (!(p = lock_user(VERIFY_WRITE, addr, sizeof(struct m68k_gdb_stat), 0))) + /* FIXME - should this return an error code? */ + return; + p->gdb_st_dev = cpu_to_be32(s->st_dev); + p->gdb_st_ino = cpu_to_be32(s->st_ino); + p->gdb_st_mode = cpu_to_be32(s->st_mode); + p->gdb_st_nlink = cpu_to_be32(s->st_nlink); + p->gdb_st_uid = cpu_to_be32(s->st_uid); + p->gdb_st_gid = cpu_to_be32(s->st_gid); + p->gdb_st_rdev = cpu_to_be32(s->st_rdev); + p->gdb_st_size = cpu_to_be64(s->st_size); +#ifdef _WIN32 + /* Windows stat is missing some fields. */ + p->gdb_st_blksize = 0; + p->gdb_st_blocks = 0; +#else + p->gdb_st_blksize = cpu_to_be64(s->st_blksize); + p->gdb_st_blocks = cpu_to_be64(s->st_blocks); +#endif + p->gdb_st_atime = cpu_to_be32(s->st_atime); + p->gdb_st_mtime = cpu_to_be32(s->st_mtime); + p->gdb_st_ctime = cpu_to_be32(s->st_ctime); + unlock_user(p, addr, sizeof(struct m68k_gdb_stat)); +} + +static int m68k_semi_is_fseek; + +static void m68k_semi_cb(CPUM68KState *env, target_ulong ret, target_ulong err) +{ + target_ulong args; + + args = env->dregs[1]; + if (m68k_semi_is_fseek) { + /* FIXME: We've already lost the high bits of the fseek + return value. */ + /* FIXME - handle put_user() failure */ + put_user_u32(0, args); + args += 4; + m68k_semi_is_fseek = 0; + } + /* FIXME - handle put_user() failure */ + put_user_u32(ret, args); + put_user_u32(errno, args + 4); +} + +#define ARG(n) \ +({ \ + target_ulong __arg; \ + /* FIXME - handle get_user() failure */ \ + get_user_ual(__arg, args + (n) * 4); \ + __arg; \ +}) +#define PARG(x) ((unsigned long)ARG(x)) +void do_m68k_semihosting(CPUM68KState *env, int nr) +{ + uint32_t args; + void *p; + void *q; + uint32_t len; + uint32_t result; + + args = env->dregs[1]; + switch (nr) { + case HOSTED_EXIT: + gdb_exit(env, env->dregs[0]); + exit(env->dregs[0]); + case HOSTED_OPEN: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "open,%s,%x,%x", ARG(0), (int)ARG(1), + ARG(2), ARG(3)); + return; + } else { + if (!(p = lock_user_string(ARG(0)))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = open(p, translate_openflags(ARG(2)), ARG(3)); + unlock_user(p, ARG(0), 0); + } + } + break; + case HOSTED_CLOSE: + { + /* Ignore attempts to close stdin/out/err. */ + int fd = ARG(0); + if (fd > 2) { + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "close,%x", ARG(0)); + return; + } else { + result = close(fd); + } + } else { + result = 0; + } + break; + } + case HOSTED_READ: + len = ARG(2); + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "read,%x,%x,%x", + ARG(0), ARG(1), len); + return; + } else { + if (!(p = lock_user(VERIFY_WRITE, ARG(1), len, 0))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = read(ARG(0), p, len); + unlock_user(p, ARG(1), len); + } + } + break; + case HOSTED_WRITE: + len = ARG(2); + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "write,%x,%x,%x", + ARG(0), ARG(1), len); + return; + } else { + if (!(p = lock_user(VERIFY_READ, ARG(1), len, 1))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = write(ARG(0), p, len); + unlock_user(p, ARG(0), 0); + } + } + break; + case HOSTED_LSEEK: + { + uint64_t off; + off = (uint32_t)ARG(2) | ((uint64_t)ARG(1) << 32); + if (use_gdb_syscalls()) { + m68k_semi_is_fseek = 1; + gdb_do_syscall(m68k_semi_cb, "fseek,%x,%lx,%x", + ARG(0), off, ARG(3)); + } else { + off = lseek(ARG(0), off, ARG(3)); + /* FIXME - handle put_user() failure */ + put_user_u32(off >> 32, args); + put_user_u32(off, args + 4); + put_user_u32(errno, args + 8); + } + return; + } + case HOSTED_RENAME: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "rename,%s,%s", + ARG(0), (int)ARG(1), ARG(2), (int)ARG(3)); + return; + } else { + p = lock_user_string(ARG(0)); + q = lock_user_string(ARG(2)); + if (!p || !q) { + /* FIXME - check error code? */ + result = -1; + } else { + result = rename(p, q); + } + unlock_user(p, ARG(0), 0); + unlock_user(q, ARG(2), 0); + } + break; + case HOSTED_UNLINK: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "unlink,%s", + ARG(0), (int)ARG(1)); + return; + } else { + if (!(p = lock_user_string(ARG(0)))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = unlink(p); + unlock_user(p, ARG(0), 0); + } + } + break; + case HOSTED_STAT: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "stat,%s,%x", + ARG(0), (int)ARG(1), ARG(2)); + return; + } else { + struct stat s; + if (!(p = lock_user_string(ARG(0)))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = stat(p, &s); + unlock_user(p, ARG(0), 0); + } + if (result == 0) { + translate_stat(env, ARG(2), &s); + } + } + break; + case HOSTED_FSTAT: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "fstat,%x,%x", + ARG(0), ARG(1)); + return; + } else { + struct stat s; + result = fstat(ARG(0), &s); + if (result == 0) { + translate_stat(env, ARG(1), &s); + } + } + break; + case HOSTED_GETTIMEOFDAY: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "gettimeofday,%x,%x", + ARG(0), ARG(1)); + return; + } else { + qemu_timeval tv; + struct gdb_timeval *p; + result = qemu_gettimeofday(&tv); + if (result != 0) { + if (!(p = lock_user(VERIFY_WRITE, + ARG(0), sizeof(struct gdb_timeval), 0))) { + /* FIXME - check error code? */ + result = -1; + } else { + p->tv_sec = cpu_to_be32(tv.tv_sec); + p->tv_usec = cpu_to_be64(tv.tv_usec); + unlock_user(p, ARG(0), sizeof(struct gdb_timeval)); + } + } + } + break; + case HOSTED_ISATTY: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "isatty,%x", ARG(0)); + return; + } else { + result = isatty(ARG(0)); + } + break; + case HOSTED_SYSTEM: + if (use_gdb_syscalls()) { + gdb_do_syscall(m68k_semi_cb, "system,%s", + ARG(0), (int)ARG(1)); + return; + } else { + if (!(p = lock_user_string(ARG(0)))) { + /* FIXME - check error code? */ + result = -1; + } else { + result = system(p); + unlock_user(p, ARG(0), 0); + } + } + break; + case HOSTED_INIT_SIM: +#if defined(CONFIG_USER_ONLY) + { + TaskState *ts = env->opaque; + /* Allocate the heap using sbrk. */ + if (!ts->heap_limit) { + abi_ulong ret; + uint32_t size; + uint32_t base; + + base = do_brk(0); + size = SEMIHOSTING_HEAP_SIZE; + /* Try a big heap, and reduce the size if that fails. */ + for (;;) { + ret = do_brk(base + size); + if (ret >= (base + size)) { + break; + } + size >>= 1; + } + ts->heap_limit = base + size; + } + /* This call may happen before we have writable memory, so return + values directly in registers. */ + env->dregs[1] = ts->heap_limit; + env->aregs[7] = ts->stack_base; + } +#else + /* FIXME: This is wrong for boards where RAM does not start at + address zero. */ + env->dregs[1] = ram_size; + env->aregs[7] = ram_size; +#endif + return; + default: + cpu_abort(env, "Unsupported semihosting syscall %d\n", nr); + result = 0; + } + /* FIXME - handle put_user() failure */ + put_user_u32(result, args); + put_user_u32(errno, args + 4); +} diff --git a/target-microblaze/Makefile.objs b/target-microblaze/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-microblaze/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-mips/Makefile.objs b/target-mips/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-mips/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-ppc/Makefile.objs b/target-ppc/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-ppc/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-s390x/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-sh4/Makefile.objs b/target-sh4/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-sh4/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-sparc/Makefile.objs b/target-sparc/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-sparc/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-unicore32/Makefile.objs b/target-unicore32/Makefile.objs new file mode 100644 index 0000000000..c574c9ea7d --- /dev/null +++ b/target-unicore32/Makefile.objs @@ -0,0 +1 @@ +# still empty diff --git a/target-xtensa/Makefile.objs b/target-xtensa/Makefile.objs new file mode 100644 index 0000000000..a49ca8d09f --- /dev/null +++ b/target-xtensa/Makefile.objs @@ -0,0 +1,4 @@ +obj-y += xtensa-semi.o +obj-y += core-dc232b.o +obj-y += core-dc233c.o +obj-y += core-fsf.o diff --git a/target-xtensa/xtensa-semi.c b/target-xtensa/xtensa-semi.c new file mode 100644 index 0000000000..b7c8c34564 --- /dev/null +++ b/target-xtensa/xtensa-semi.c @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Open Source and Linux Lab nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include "cpu.h" +#include "dyngen-exec.h" +#include "helper.h" +#include "qemu-log.h" + +enum { + TARGET_SYS_exit = 1, + TARGET_SYS_read = 3, + TARGET_SYS_write = 4, + TARGET_SYS_open = 5, + TARGET_SYS_close = 6, + TARGET_SYS_lseek = 19, + TARGET_SYS_select_one = 29, + + TARGET_SYS_argc = 1000, + TARGET_SYS_argv_sz = 1001, + TARGET_SYS_argv = 1002, + TARGET_SYS_memset = 1004, +}; + +enum { + SELECT_ONE_READ = 1, + SELECT_ONE_WRITE = 2, + SELECT_ONE_EXCEPT = 3, +}; + +void HELPER(simcall)(CPUXtensaState *env) +{ + uint32_t *regs = env->regs; + + switch (regs[2]) { + case TARGET_SYS_exit: + qemu_log("exit(%d) simcall\n", regs[3]); + exit(regs[3]); + break; + + case TARGET_SYS_read: + case TARGET_SYS_write: + { + bool is_write = regs[2] == TARGET_SYS_write; + uint32_t fd = regs[3]; + uint32_t vaddr = regs[4]; + uint32_t len = regs[5]; + + while (len > 0) { + target_phys_addr_t paddr = + cpu_get_phys_page_debug(env, vaddr); + uint32_t page_left = + TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1)); + uint32_t io_sz = page_left < len ? page_left : len; + target_phys_addr_t sz = io_sz; + void *buf = cpu_physical_memory_map(paddr, &sz, is_write); + + if (buf) { + vaddr += io_sz; + len -= io_sz; + regs[2] = is_write ? + write(fd, buf, io_sz) : + read(fd, buf, io_sz); + regs[3] = errno; + cpu_physical_memory_unmap(buf, sz, is_write, sz); + if (regs[2] == -1) { + break; + } + } else { + regs[2] = -1; + regs[3] = EINVAL; + break; + } + } + } + break; + + case TARGET_SYS_open: + { + char name[1024]; + int rc; + int i; + + for (i = 0; i < ARRAY_SIZE(name); ++i) { + rc = cpu_memory_rw_debug( + env, regs[3] + i, (uint8_t *)name + i, 1, 0); + if (rc != 0 || name[i] == 0) { + break; + } + } + + if (rc == 0 && i < ARRAY_SIZE(name)) { + regs[2] = open(name, regs[4], regs[5]); + regs[3] = errno; + } else { + regs[2] = -1; + regs[3] = EINVAL; + } + } + break; + + case TARGET_SYS_close: + if (regs[3] < 3) { + regs[2] = regs[3] = 0; + } else { + regs[2] = close(regs[3]); + regs[3] = errno; + } + break; + + case TARGET_SYS_lseek: + regs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]); + regs[3] = errno; + break; + + case TARGET_SYS_select_one: + { + uint32_t fd = regs[3]; + uint32_t rq = regs[4]; + uint32_t target_tv = regs[5]; + uint32_t target_tvv[2]; + + struct timeval tv = {0}; + fd_set fdset; + + FD_ZERO(&fdset); + FD_SET(fd, &fdset); + + if (target_tv) { + cpu_memory_rw_debug(env, target_tv, + (uint8_t *)target_tvv, sizeof(target_tvv), 0); + tv.tv_sec = (int32_t)tswap32(target_tvv[0]); + tv.tv_usec = (int32_t)tswap32(target_tvv[1]); + } + regs[2] = select(fd + 1, + rq == SELECT_ONE_READ ? &fdset : NULL, + rq == SELECT_ONE_WRITE ? &fdset : NULL, + rq == SELECT_ONE_EXCEPT ? &fdset : NULL, + target_tv ? &tv : NULL); + regs[3] = errno; + } + break; + + case TARGET_SYS_argc: + regs[2] = 1; + regs[3] = 0; + break; + + case TARGET_SYS_argv_sz: + regs[2] = 128; + regs[3] = 0; + break; + + case TARGET_SYS_argv: + { + struct Argv { + uint32_t argptr[2]; + char text[120]; + } argv = { + {0, 0}, + "test" + }; + + argv.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text)); + cpu_memory_rw_debug( + env, regs[3], (uint8_t *)&argv, sizeof(argv), 1); + } + break; + + case TARGET_SYS_memset: + { + uint32_t base = regs[3]; + uint32_t sz = regs[5]; + + while (sz) { + target_phys_addr_t len = sz; + void *buf = cpu_physical_memory_map(base, &len, 1); + + if (buf && len) { + memset(buf, regs[4], len); + cpu_physical_memory_unmap(buf, len, 1, len); + } else { + len = 1; + } + base += len; + sz -= len; + } + regs[2] = regs[3]; + regs[3] = 0; + } + break; + + default: + qemu_log("%s(%d): not implemented\n", __func__, regs[2]); + break; + } +} diff --git a/xtensa-semi.c b/xtensa-semi.c deleted file mode 100644 index b7c8c34564..0000000000 --- a/xtensa-semi.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the Open Source and Linux Lab nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include "cpu.h" -#include "dyngen-exec.h" -#include "helper.h" -#include "qemu-log.h" - -enum { - TARGET_SYS_exit = 1, - TARGET_SYS_read = 3, - TARGET_SYS_write = 4, - TARGET_SYS_open = 5, - TARGET_SYS_close = 6, - TARGET_SYS_lseek = 19, - TARGET_SYS_select_one = 29, - - TARGET_SYS_argc = 1000, - TARGET_SYS_argv_sz = 1001, - TARGET_SYS_argv = 1002, - TARGET_SYS_memset = 1004, -}; - -enum { - SELECT_ONE_READ = 1, - SELECT_ONE_WRITE = 2, - SELECT_ONE_EXCEPT = 3, -}; - -void HELPER(simcall)(CPUXtensaState *env) -{ - uint32_t *regs = env->regs; - - switch (regs[2]) { - case TARGET_SYS_exit: - qemu_log("exit(%d) simcall\n", regs[3]); - exit(regs[3]); - break; - - case TARGET_SYS_read: - case TARGET_SYS_write: - { - bool is_write = regs[2] == TARGET_SYS_write; - uint32_t fd = regs[3]; - uint32_t vaddr = regs[4]; - uint32_t len = regs[5]; - - while (len > 0) { - target_phys_addr_t paddr = - cpu_get_phys_page_debug(env, vaddr); - uint32_t page_left = - TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1)); - uint32_t io_sz = page_left < len ? page_left : len; - target_phys_addr_t sz = io_sz; - void *buf = cpu_physical_memory_map(paddr, &sz, is_write); - - if (buf) { - vaddr += io_sz; - len -= io_sz; - regs[2] = is_write ? - write(fd, buf, io_sz) : - read(fd, buf, io_sz); - regs[3] = errno; - cpu_physical_memory_unmap(buf, sz, is_write, sz); - if (regs[2] == -1) { - break; - } - } else { - regs[2] = -1; - regs[3] = EINVAL; - break; - } - } - } - break; - - case TARGET_SYS_open: - { - char name[1024]; - int rc; - int i; - - for (i = 0; i < ARRAY_SIZE(name); ++i) { - rc = cpu_memory_rw_debug( - env, regs[3] + i, (uint8_t *)name + i, 1, 0); - if (rc != 0 || name[i] == 0) { - break; - } - } - - if (rc == 0 && i < ARRAY_SIZE(name)) { - regs[2] = open(name, regs[4], regs[5]); - regs[3] = errno; - } else { - regs[2] = -1; - regs[3] = EINVAL; - } - } - break; - - case TARGET_SYS_close: - if (regs[3] < 3) { - regs[2] = regs[3] = 0; - } else { - regs[2] = close(regs[3]); - regs[3] = errno; - } - break; - - case TARGET_SYS_lseek: - regs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]); - regs[3] = errno; - break; - - case TARGET_SYS_select_one: - { - uint32_t fd = regs[3]; - uint32_t rq = regs[4]; - uint32_t target_tv = regs[5]; - uint32_t target_tvv[2]; - - struct timeval tv = {0}; - fd_set fdset; - - FD_ZERO(&fdset); - FD_SET(fd, &fdset); - - if (target_tv) { - cpu_memory_rw_debug(env, target_tv, - (uint8_t *)target_tvv, sizeof(target_tvv), 0); - tv.tv_sec = (int32_t)tswap32(target_tvv[0]); - tv.tv_usec = (int32_t)tswap32(target_tvv[1]); - } - regs[2] = select(fd + 1, - rq == SELECT_ONE_READ ? &fdset : NULL, - rq == SELECT_ONE_WRITE ? &fdset : NULL, - rq == SELECT_ONE_EXCEPT ? &fdset : NULL, - target_tv ? &tv : NULL); - regs[3] = errno; - } - break; - - case TARGET_SYS_argc: - regs[2] = 1; - regs[3] = 0; - break; - - case TARGET_SYS_argv_sz: - regs[2] = 128; - regs[3] = 0; - break; - - case TARGET_SYS_argv: - { - struct Argv { - uint32_t argptr[2]; - char text[120]; - } argv = { - {0, 0}, - "test" - }; - - argv.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text)); - cpu_memory_rw_debug( - env, regs[3], (uint8_t *)&argv, sizeof(argv), 1); - } - break; - - case TARGET_SYS_memset: - { - uint32_t base = regs[3]; - uint32_t sz = regs[5]; - - while (sz) { - target_phys_addr_t len = sz; - void *buf = cpu_physical_memory_map(base, &len, 1); - - if (buf && len) { - memset(buf, regs[4], len); - cpu_physical_memory_unmap(buf, len, 1, len); - } else { - len = 1; - } - base += len; - sz -= len; - } - regs[2] = regs[3]; - regs[3] = 0; - } - break; - - default: - qemu_log("%s(%d): not implemented\n", __func__, regs[2]); - break; - } -} -- cgit v1.2.1 From 9cdc8df314bddc95125e87039b0f2df3fc5fa866 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 10:55:47 +0200 Subject: build: move libobj-y variable to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.target | 41 +++++++---------------------------------- configure | 6 ------ target-alpha/Makefile.objs | 3 ++- target-arm/Makefile.objs | 4 ++++ target-cris/Makefile.objs | 5 ++++- target-i386/Makefile.objs | 3 +++ target-lm32/Makefile.objs | 4 +++- target-m68k/Makefile.objs | 3 +++ target-microblaze/Makefile.objs | 5 ++++- target-mips/Makefile.objs | 4 +++- target-ppc/Makefile.objs | 4 +++- target-s390x/Makefile.objs | 4 +++- target-sh4/Makefile.objs | 4 +++- target-sparc/Makefile.objs | 8 +++++++- target-unicore32/Makefile.objs | 4 +++- target-xtensa/Makefile.objs | 3 +++ 16 files changed, 55 insertions(+), 50 deletions(-) diff --git a/Makefile.target b/Makefile.target index c416ba56fc..67d5f3ec53 100644 --- a/Makefile.target +++ b/Makefile.target @@ -76,41 +76,19 @@ all: $(PROGS) stap ######################################################### # cpu emulator library -libobj-y = exec.o translate-all.o cpu-exec.o translate.o -libobj-y += tcg/tcg.o tcg/optimize.o -libobj-$(CONFIG_TCG_INTERPRETER) += tci.o -libobj-y += fpu/softfloat.o -ifneq ($(TARGET_BASE_ARCH), sparc) -ifneq ($(TARGET_BASE_ARCH), alpha) -libobj-y += op_helper.o -endif -endif -libobj-y += helper.o -ifneq ($(TARGET_BASE_ARCH), ppc) -libobj-y += cpu.o -endif -libobj-$(TARGET_SPARC64) += vis_helper.o -libobj-$(CONFIG_NEED_MMU) += mmu.o -libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o -ifeq ($(TARGET_BASE_ARCH), sparc) -libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o -endif -libobj-$(TARGET_SPARC) += int32_helper.o -libobj-$(TARGET_SPARC64) += int64_helper.o -libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o - -libobj-y += disas.o -libobj-$(CONFIG_TCI_DIS) += tci-dis.o - +obj-y = exec.o translate-all.o cpu-exec.o translate.o +obj-y += tcg/tcg.o tcg/optimize.o +obj-$(CONFIG_TCG_INTERPRETER) += tci.o +obj-y += fpu/softfloat.o +obj-y += disas.o +obj-$(CONFIG_TCI_DIS) += tci-dis.o obj-y += target-$(TARGET_BASE_ARCH)/ +obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o tci-dis.o: QEMU_CFLAGS += -I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/tci # HELPER_CFLAGS is used for all the legacy code compiled with static register # variables -ifneq ($(TARGET_BASE_ARCH), sparc) -op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) -endif user-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS) # Note: this is a workaround. The real fix is to avoid compiling @@ -130,7 +108,6 @@ obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) obj-y += $(addprefix ../libdis-user/, $(libdis-y)) -obj-y += $(libobj-y) endif #CONFIG_LINUX_USER @@ -147,7 +124,6 @@ obj-y += gdbstub.o user-exec.o obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../libuser/, $(user-obj-y)) obj-y += $(addprefix ../libdis-user/, $(libdis-y)) -obj-y += $(libobj-y) endif #CONFIG_BSD_USER @@ -215,7 +191,6 @@ GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h obj-y += $(addprefix ../, $(universal-obj-y)) obj-y += $(addprefix ../, $(common-obj-y)) obj-y += $(addprefix ../libdis/, $(libdis-y)) -obj-y += $(libobj-y) obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) obj-y += $(addprefix ../, $(trace-obj-y)) @@ -231,8 +206,6 @@ obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) endif # CONFIG_BSD_USER endif # CONFIG_LINUX_USER -obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o - nested-vars = obj-y dummy := $(call unnest-vars) diff --git a/configure b/configure index a2fca50260..cc77700328 100755 --- a/configure +++ b/configure @@ -3911,12 +3911,6 @@ if test "$target_softmmu" = "yes" ; then esac fi -if test "$target_softmmu" = "yes" -a \( \ - "$TARGET_ARCH" = "microblaze" -o \ - "$TARGET_ARCH" = "cris" \) ; then - echo "CONFIG_NEED_MMU=y" >> $config_target_mak -fi - if test "$gprof" = "yes" ; then echo "TARGET_GPROF=yes" >> $config_target_mak if test "$target_linux_user" = "yes" ; then diff --git a/target-alpha/Makefile.objs b/target-alpha/Makefile.objs index c574c9ea7d..9a7287072a 100644 --- a/target-alpha/Makefile.objs +++ b/target-alpha/Makefile.objs @@ -1 +1,2 @@ -# still empty +obj-y += helper.o cpu.o +obj-y += int_helper.o fpu_helper.o sys_helper.o mem_helper.o diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs index f5bb920266..4dcd3c5f5b 100644 --- a/target-arm/Makefile.objs +++ b/target-arm/Makefile.objs @@ -1 +1,5 @@ obj-y += arm-semi.o +obj-y += op_helper.o helper.o cpu.o +obj-y += neon_helper.o iwmmxt_helper.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs index c574c9ea7d..9a50c2846f 100644 --- a/target-cris/Makefile.objs +++ b/target-cris/Makefile.objs @@ -1 +1,4 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += mmu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs index 93c6f3fce5..2538c43e4c 100644 --- a/target-i386/Makefile.objs +++ b/target-i386/Makefile.objs @@ -1,3 +1,6 @@ +obj-y += op_helper.o helper.o cpu.o obj-$(CONFIG_KVM) += hyperv.o obj-$(CONFIG_LINUX_USER) += ioport-user.o obj-$(CONFIG_BSD_USER) += ioport-user.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-lm32/Makefile.objs b/target-lm32/Makefile.objs index c574c9ea7d..8e9be602a5 100644 --- a/target-lm32/Makefile.objs +++ b/target-lm32/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-m68k/Makefile.objs b/target-m68k/Makefile.objs index e73a5ba289..553691dca6 100644 --- a/target-m68k/Makefile.objs +++ b/target-m68k/Makefile.objs @@ -1 +1,4 @@ obj-y += m68k-semi.o +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-microblaze/Makefile.objs b/target-microblaze/Makefile.objs index c574c9ea7d..9a50c2846f 100644 --- a/target-microblaze/Makefile.objs +++ b/target-microblaze/Makefile.objs @@ -1 +1,4 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += mmu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-mips/Makefile.objs b/target-mips/Makefile.objs index c574c9ea7d..8e9be602a5 100644 --- a/target-mips/Makefile.objs +++ b/target-mips/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-ppc/Makefile.objs b/target-ppc/Makefile.objs index c574c9ea7d..bf46331e91 100644 --- a/target-ppc/Makefile.objs +++ b/target-ppc/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs index c574c9ea7d..8e9be602a5 100644 --- a/target-s390x/Makefile.objs +++ b/target-s390x/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-sh4/Makefile.objs b/target-sh4/Makefile.objs index c574c9ea7d..8e9be602a5 100644 --- a/target-sh4/Makefile.objs +++ b/target-sh4/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-sparc/Makefile.objs b/target-sparc/Makefile.objs index c574c9ea7d..3556d13df1 100644 --- a/target-sparc/Makefile.objs +++ b/target-sparc/Makefile.objs @@ -1 +1,7 @@ -# still empty +obj-y += helper.o cpu.o +obj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o +obj-$(TARGET_SPARC) += int32_helper.o +obj-$(TARGET_SPARC64) += int64_helper.o +obj-$(TARGET_SPARC64) += vis_helper.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-unicore32/Makefile.objs b/target-unicore32/Makefile.objs index c574c9ea7d..8e9be602a5 100644 --- a/target-unicore32/Makefile.objs +++ b/target-unicore32/Makefile.objs @@ -1 +1,3 @@ -# still empty +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-xtensa/Makefile.objs b/target-xtensa/Makefile.objs index a49ca8d09f..3cdf604c05 100644 --- a/target-xtensa/Makefile.objs +++ b/target-xtensa/Makefile.objs @@ -2,3 +2,6 @@ obj-y += xtensa-semi.o obj-y += core-dc232b.o obj-y += core-dc233c.o obj-y += core-fsf.o +obj-y += op_helper.o helper.o cpu.o + +$(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) -- cgit v1.2.1 From db2077692ffee1f87a1f4af0cf275c33aba6c867 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jun 2012 07:02:04 +0200 Subject: dump: do not compile dump.o for user-mode emulation It is not needed, because the monitor is not included. Cc: Wen Congyang Signed-off-by: Paolo Bonzini --- Makefile.target | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.target b/Makefile.target index 67d5f3ec53..f1ec554699 100644 --- a/Makefile.target +++ b/Makefile.target @@ -147,6 +147,7 @@ obj-y += memory.o savevm.o cputlb.o obj-y += memory_mapping.o obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o +obj-y += dump.o LIBS+=-lz QEMU_CFLAGS += $(VNC_TLS_CFLAGS) @@ -196,8 +197,6 @@ obj-y += $(addprefix ../, $(trace-obj-y)) endif # CONFIG_SOFTMMU -obj-y += dump.o - ifndef CONFIG_LINUX_USER ifndef CONFIG_BSD_USER # libcacard needs qemu-thread support, and besides is only needed by devices -- cgit v1.2.1 From 4720bd050655a56b4b048d8856a03ae187481a7f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jun 2012 08:48:09 +0200 Subject: dump: change cpu_get_note_size to return ssize_t So that it can use the same prototype in both cases. Signed-off-by: Paolo Bonzini --- cpu-all.h | 4 ++-- dump.c | 9 +++++++-- target-i386/arch_dump.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index e8749de2b9..624030d6cc 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -552,7 +552,7 @@ int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env, int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, void *opaque); int cpu_get_dump_info(ArchDumpInfo *info); -size_t cpu_get_note_size(int class, int machine, int nr_cpus); +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); #else static inline int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, int cpuid, @@ -587,7 +587,7 @@ static inline int cpu_get_dump_info(ArchDumpInfo *info) return -1; } -static inline int cpu_get_note_size(int class, int machine, int nr_cpus) +static inline ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) { return -1; } diff --git a/dump.c b/dump.c index 0ca14f87ed..b24d4be7a6 100644 --- a/dump.c +++ b/dump.c @@ -750,6 +750,13 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, goto cleanup; } + s->note_size = cpu_get_note_size(s->dump_info.d_class, + s->dump_info.d_machine, nr_cpus); + if (ret < 0) { + error_set(errp, QERR_UNSUPPORTED); + goto cleanup; + } + /* get memory mapping */ memory_mapping_list_init(&s->list); if (paging) { @@ -784,8 +791,6 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, } } - s->note_size = cpu_get_note_size(s->dump_info.d_class, - s->dump_info.d_machine, nr_cpus); if (s->dump_info.d_class == ELFCLASS64) { if (s->have_section) { s->memory_offset = sizeof(Elf64_Ehdr) + diff --git a/target-i386/arch_dump.c b/target-i386/arch_dump.c index 135d855c4a..7c2b514383 100644 --- a/target-i386/arch_dump.c +++ b/target-i386/arch_dump.c @@ -415,7 +415,7 @@ int cpu_get_dump_info(ArchDumpInfo *info) return 0; } -size_t cpu_get_note_size(int class, int machine, int nr_cpus) +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) { int name_size = 5; /* "CORE" or "QEMU" */ size_t elf_note_size = 0; -- cgit v1.2.1 From 5f86146fb3ad18ef25036329f48d9ea2b7f4ab70 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jun 2012 08:22:56 +0200 Subject: dump: remove dumping stuff from cpu-all.h This simplifies things, because they will only be included for softmmu targets and because the stubs are taken out-of-line in separate files, which in the future could even be compiled only once. Signed-off-by: Paolo Bonzini --- Makefile.target | 10 +++-- cpu-all.h | 70 ----------------------------------- dump-stub.c | 77 +++++++++++++++++++++++++++++++++++++++ dump.c | 11 ------ dump.h | 12 ++++++ memory_mapping-stub.c | 33 +++++++++++++++++ memory_mapping.c | 3 -- memory_mapping.h | 16 ++------ target-i386/arch_memory_mapping.c | 1 + 9 files changed, 132 insertions(+), 101 deletions(-) create mode 100644 dump-stub.c create mode 100644 memory_mapping-stub.c diff --git a/Makefile.target b/Makefile.target index f1ec554699..4c811713ad 100644 --- a/Makefile.target +++ b/Makefile.target @@ -3,6 +3,8 @@ CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) +CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y) +CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y) include ../config-host.mak include config-devices.mak @@ -144,10 +146,10 @@ obj-$(CONFIG_KVM) += kvm.o kvm-all.o obj-$(CONFIG_NO_KVM) += kvm-stub.o obj-$(CONFIG_VGA) += vga.o obj-y += memory.o savevm.o cputlb.o -obj-y += memory_mapping.o -obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += arch_memory_mapping.o -obj-$(CONFIG_HAVE_CORE_DUMP) += arch_dump.o -obj-y += dump.o +obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o arch_memory_mapping.o +obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o arch_dump.o +obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o +obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o LIBS+=-lz QEMU_CFLAGS += $(VNC_TLS_CFLAGS) diff --git a/cpu-all.h b/cpu-all.h index 624030d6cc..3a93c0c98a 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -22,8 +22,6 @@ #include "qemu-common.h" #include "qemu-tls.h" #include "cpu-common.h" -#include "memory_mapping.h" -#include "dump.h" /* some important defines: * @@ -525,72 +523,4 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf); int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr, uint8_t *buf, int len, int is_write); -#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING) -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); -bool cpu_paging_enabled(CPUArchState *env); -#else -static inline int cpu_get_memory_mapping(MemoryMappingList *list, - CPUArchState *env) -{ - return -1; -} - -static inline bool cpu_paging_enabled(CPUArchState *env) -{ - return true; -} -#endif - -typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque); -#if defined(CONFIG_HAVE_CORE_DUMP) -int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, - int cpuid, void *opaque); -int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env, - int cpuid, void *opaque); -int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env, - void *opaque); -int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, - void *opaque); -int cpu_get_dump_info(ArchDumpInfo *info); -ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); -#else -static inline int cpu_write_elf64_note(write_core_dump_function f, - CPUArchState *env, int cpuid, - void *opaque) -{ - return -1; -} - -static inline int cpu_write_elf32_note(write_core_dump_function f, - CPUArchState *env, int cpuid, - void *opaque) -{ - return -1; -} - -static inline int cpu_write_elf64_qemunote(write_core_dump_function f, - CPUArchState *env, - void *opaque) -{ - return -1; -} - -static inline int cpu_write_elf32_qemunote(write_core_dump_function f, - CPUArchState *env, - void *opaque) -{ - return -1; -} - -static inline int cpu_get_dump_info(ArchDumpInfo *info) -{ - return -1; -} - -static inline ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) -{ - return -1; -} -#endif - #endif /* CPU_ALL_H */ diff --git a/dump-stub.c b/dump-stub.c new file mode 100644 index 0000000000..4c8bedb6ce --- /dev/null +++ b/dump-stub.c @@ -0,0 +1,77 @@ +/* + * QEMU dump + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "qemu-common.h" +#include +#include "elf.h" +#include +#include +#include "cpu.h" +#include "cpu-all.h" +#include "targphys.h" +#include "monitor.h" +#include "kvm.h" +#include "dump.h" +#include "sysemu.h" +#include "bswap.h" +#include "memory_mapping.h" +#include "error.h" +#include "qmp-commands.h" +#include "gdbstub.h" + +/* we need this function in hmp.c */ +void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, + int64_t begin, bool has_length, int64_t length, + Error **errp) +{ + error_set(errp, QERR_UNSUPPORTED); +} + +int cpu_write_elf64_note(write_core_dump_function f, + CPUArchState *env, int cpuid, + void *opaque) +{ + return -1; +} + +int cpu_write_elf32_note(write_core_dump_function f, + CPUArchState *env, int cpuid, + void *opaque) +{ + return -1; +} + +int cpu_write_elf64_qemunote(write_core_dump_function f, + CPUArchState *env, + void *opaque) +{ + return -1; +} + +int cpu_write_elf32_qemunote(write_core_dump_function f, + CPUArchState *env, + void *opaque) +{ + return -1; +} + +int cpu_get_dump_info(ArchDumpInfo *info) +{ + return -1; +} + +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus) +{ + return -1; +} + diff --git a/dump.c b/dump.c index b24d4be7a6..f5c72833a3 100644 --- a/dump.c +++ b/dump.c @@ -29,7 +29,6 @@ #include "qmp-commands.h" #include "gdbstub.h" -#if defined(CONFIG_HAVE_CORE_DUMP) static uint16_t cpu_convert_to_target16(uint16_t val, int endian) { if (endian == ELFDATA2LSB) { @@ -876,13 +875,3 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, g_free(s); } - -#else -/* we need this function in hmp.c */ -void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, - int64_t begin, bool has_length, int64_t length, - Error **errp) -{ - error_set(errp, QERR_UNSUPPORTED); -} -#endif diff --git a/dump.h b/dump.h index 28340cf271..4dea3bb4b2 100644 --- a/dump.h +++ b/dump.h @@ -20,4 +20,16 @@ typedef struct ArchDumpInfo { int d_class; /* ELFCLASS32 or ELFCLASS64 */ } ArchDumpInfo; +typedef int (*write_core_dump_function)(void *buf, size_t size, void *opaque); +int cpu_write_elf64_note(write_core_dump_function f, CPUArchState *env, + int cpuid, void *opaque); +int cpu_write_elf32_note(write_core_dump_function f, CPUArchState *env, + int cpuid, void *opaque); +int cpu_write_elf64_qemunote(write_core_dump_function f, CPUArchState *env, + void *opaque); +int cpu_write_elf32_qemunote(write_core_dump_function f, CPUArchState *env, + void *opaque); +int cpu_get_dump_info(ArchDumpInfo *info); +ssize_t cpu_get_note_size(int class, int machine, int nr_cpus); + #endif diff --git a/memory_mapping-stub.c b/memory_mapping-stub.c new file mode 100644 index 0000000000..104281d78e --- /dev/null +++ b/memory_mapping-stub.c @@ -0,0 +1,33 @@ +/* + * QEMU memory mapping + * + * Copyright Fujitsu, Corp. 2011, 2012 + * + * Authors: + * Wen Congyang + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#include "cpu.h" +#include "cpu-all.h" +#include "memory_mapping.h" + +int qemu_get_guest_memory_mapping(MemoryMappingList *list) +{ + return -2; +} + +int cpu_get_memory_mapping(MemoryMappingList *list, + CPUArchState *env) +{ + return -1; +} + +bool cpu_paging_enabled(CPUArchState *env) +{ + return true; +} + diff --git a/memory_mapping.c b/memory_mapping.c index 8810bb09e3..1125e3fccf 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -165,8 +165,6 @@ void memory_mapping_list_init(MemoryMappingList *list) QTAILQ_INIT(&list->head); } -#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING) - static CPUArchState *find_paging_enabled_cpu(CPUArchState *start_cpu) { CPUArchState *env; @@ -210,7 +208,6 @@ int qemu_get_guest_memory_mapping(MemoryMappingList *list) return 0; } -#endif void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list) { diff --git a/memory_mapping.h b/memory_mapping.h index a1aa64f4ca..3f003586d4 100644 --- a/memory_mapping.h +++ b/memory_mapping.h @@ -16,7 +16,6 @@ #include "qemu-queue.h" -#ifndef CONFIG_USER_ONLY /* The physical and virtual address in the memory mapping are contiguous. */ typedef struct MemoryMapping { target_phys_addr_t phys_addr; @@ -31,6 +30,9 @@ typedef struct MemoryMappingList { QTAILQ_HEAD(, MemoryMapping) head; } MemoryMappingList; +int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); +bool cpu_paging_enabled(CPUArchState *env); + /* * add or merge the memory region [phys_addr, phys_addr + length) into the * memory mapping's list. The region's virtual address starts with virt_addr, @@ -51,14 +53,7 @@ void memory_mapping_list_init(MemoryMappingList *list); * -1: failed * -2: unsupported */ -#if defined(CONFIG_HAVE_GET_MEMORY_MAPPING) int qemu_get_guest_memory_mapping(MemoryMappingList *list); -#else -static inline int qemu_get_guest_memory_mapping(MemoryMappingList *list) -{ - return -2; -} -#endif /* get guest's memory mapping without do paging(virtual address is 0). */ void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); @@ -66,9 +61,4 @@ void qemu_get_guest_simple_memory_mapping(MemoryMappingList *list); void memory_mapping_filter(MemoryMappingList *list, int64_t begin, int64_t length); -#else - -/* We use MemoryMappingList* in cpu-all.h */ -typedef struct MemoryMappingList MemoryMappingList; -#endif #endif diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index bd50e1143a..efb0211fdc 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -13,6 +13,7 @@ #include "cpu.h" #include "cpu-all.h" +#include "memory_mapping.h" /* PAE Paging or IA-32e Paging */ static void walk_pte(MemoryMappingList *list, target_phys_addr_t pte_start_addr, -- cgit v1.2.1 From fbe37ef3e18814f2b98f115a1c855fea7fe71d74 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:48:59 +0200 Subject: build: move other target-*/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.target | 10 +++++----- target-alpha/Makefile.objs | 3 ++- target-arm/Makefile.objs | 3 ++- target-cris/Makefile.objs | 4 ++-- target-i386/Makefile.objs | 5 +++-- target-lm32/Makefile.objs | 3 ++- target-m68k/Makefile.objs | 3 ++- target-microblaze/Makefile.objs | 4 ++-- target-mips/Makefile.objs | 3 ++- target-ppc/Makefile.objs | 3 +++ target-s390x/Makefile.objs | 4 +++- target-sh4/Makefile.objs | 3 ++- target-sparc/Makefile.objs | 3 ++- target-unicore32/Makefile.objs | 3 ++- target-xtensa/Makefile.objs | 3 ++- 15 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Makefile.target b/Makefile.target index 4c811713ad..655908e173 100644 --- a/Makefile.target +++ b/Makefile.target @@ -78,7 +78,7 @@ all: $(PROGS) stap ######################################################### # cpu emulator library -obj-y = exec.o translate-all.o cpu-exec.o translate.o +obj-y = exec.o translate-all.o cpu-exec.o obj-y += tcg/tcg.o tcg/optimize.o obj-$(CONFIG_TCG_INTERPRETER) += tci.o obj-y += fpu/softfloat.o @@ -133,7 +133,7 @@ endif #CONFIG_BSD_USER # System emulator target ifdef CONFIG_SOFTMMU -obj-y += arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o ioport.o +obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o # virtio has to be here due to weird dependency between PCI and virtio-net. # need to fix this properly obj-$(CONFIG_NO_PCI) += pci-stub.o @@ -142,12 +142,12 @@ obj-$(CONFIG_VIRTIO) += virtio-scsi.o obj-y += vhost_net.o obj-$(CONFIG_VHOST_NET) += vhost.o obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o -obj-$(CONFIG_KVM) += kvm.o kvm-all.o +obj-$(CONFIG_KVM) += kvm-all.o obj-$(CONFIG_NO_KVM) += kvm-stub.o obj-$(CONFIG_VGA) += vga.o obj-y += memory.o savevm.o cputlb.o -obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o arch_memory_mapping.o -obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o arch_dump.o +obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o +obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o obj-$(CONFIG_NO_GET_MEMORY_MAPPING) += memory_mapping-stub.o obj-$(CONFIG_NO_CORE_DUMP) += dump-stub.o LIBS+=-lz diff --git a/target-alpha/Makefile.objs b/target-alpha/Makefile.objs index 9a7287072a..590304cc61 100644 --- a/target-alpha/Makefile.objs +++ b/target-alpha/Makefile.objs @@ -1,2 +1,3 @@ -obj-y += helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o +obj-y += translate.o helper.o cpu.o obj-y += int_helper.o fpu_helper.o sys_helper.o mem_helper.o diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs index 4dcd3c5f5b..f447c4fdf2 100644 --- a/target-arm/Makefile.objs +++ b/target-arm/Makefile.objs @@ -1,5 +1,6 @@ obj-y += arm-semi.o -obj-y += op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o +obj-y += translate.o op_helper.o helper.o cpu.o obj-y += neon_helper.o iwmmxt_helper.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-cris/Makefile.objs b/target-cris/Makefile.objs index 9a50c2846f..4b09e8c6b5 100644 --- a/target-cris/Makefile.objs +++ b/target-cris/Makefile.objs @@ -1,4 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o -obj-$(CONFIG_SOFTMMU) += mmu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += mmu.o machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs index 2538c43e4c..f91375578c 100644 --- a/target-i386/Makefile.objs +++ b/target-i386/Makefile.objs @@ -1,5 +1,6 @@ -obj-y += op_helper.o helper.o cpu.o -obj-$(CONFIG_KVM) += hyperv.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o +obj-$(CONFIG_KVM) += kvm.o hyperv.o obj-$(CONFIG_LINUX_USER) += ioport-user.o obj-$(CONFIG_BSD_USER) += ioport-user.o diff --git a/target-lm32/Makefile.objs b/target-lm32/Makefile.objs index 8e9be602a5..2e0e093e1f 100644 --- a/target-lm32/Makefile.objs +++ b/target-lm32/Makefile.objs @@ -1,3 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-m68k/Makefile.objs b/target-m68k/Makefile.objs index 553691dca6..cda60157f5 100644 --- a/target-m68k/Makefile.objs +++ b/target-m68k/Makefile.objs @@ -1,4 +1,5 @@ obj-y += m68k-semi.o -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-microblaze/Makefile.objs b/target-microblaze/Makefile.objs index 9a50c2846f..4b09e8c6b5 100644 --- a/target-microblaze/Makefile.objs +++ b/target-microblaze/Makefile.objs @@ -1,4 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o -obj-$(CONFIG_SOFTMMU) += mmu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += mmu.o machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-mips/Makefile.objs b/target-mips/Makefile.objs index 8e9be602a5..2e0e093e1f 100644 --- a/target-mips/Makefile.objs +++ b/target-mips/Makefile.objs @@ -1,3 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-ppc/Makefile.objs b/target-ppc/Makefile.objs index bf46331e91..95ed340bcc 100644 --- a/target-ppc/Makefile.objs +++ b/target-ppc/Makefile.objs @@ -1,3 +1,6 @@ +obj-y += translate.o op_helper.o helper.o +obj-$(CONFIG_SOFTMMU) += machine.o +obj-$(CONFIG_KVM) += kvm.o obj-y += op_helper.o helper.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs index 8e9be602a5..262747f8a6 100644 --- a/target-s390x/Makefile.objs +++ b/target-s390x/Makefile.objs @@ -1,3 +1,5 @@ -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o +obj-$(CONFIG_KVM) += kvm.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-sh4/Makefile.objs b/target-sh4/Makefile.objs index 8e9be602a5..2e0e093e1f 100644 --- a/target-sh4/Makefile.objs +++ b/target-sh4/Makefile.objs @@ -1,3 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-sparc/Makefile.objs b/target-sparc/Makefile.objs index 3556d13df1..a93e07deb1 100644 --- a/target-sparc/Makefile.objs +++ b/target-sparc/Makefile.objs @@ -1,4 +1,5 @@ -obj-y += helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o +obj-y += translate.o helper.o cpu.o obj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o obj-$(TARGET_SPARC) += int32_helper.o obj-$(TARGET_SPARC64) += int64_helper.o diff --git a/target-unicore32/Makefile.objs b/target-unicore32/Makefile.objs index 8e9be602a5..2e0e093e1f 100644 --- a/target-unicore32/Makefile.objs +++ b/target-unicore32/Makefile.objs @@ -1,3 +1,4 @@ -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) diff --git a/target-xtensa/Makefile.objs b/target-xtensa/Makefile.objs index 3cdf604c05..f8fbf91aa2 100644 --- a/target-xtensa/Makefile.objs +++ b/target-xtensa/Makefile.objs @@ -2,6 +2,7 @@ obj-y += xtensa-semi.o obj-y += core-dc232b.o obj-y += core-dc233c.o obj-y += core-fsf.o -obj-y += op_helper.o helper.o cpu.o +obj-y += translate.o op_helper.o helper.o cpu.o +obj-$(CONFIG_SOFTMMU) += machine.o $(obj)/op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS) -- cgit v1.2.1 From 99100dc3b55126fc60fbbfb854d5aab25ab5dafd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:41:27 +0200 Subject: build: move rules for nesting to Makefile.objs At this point we will start adding nesting behavior to other files than Makefile.target. Because Makefile.objs is included by Makefile.target, it is simpler to move the processing of subdirectories there. To enable this, only add per-target files to obj-y. Use a separate variable for the linker dependencies, all-obj-y. This variable includes obj-y and also all objects that are taken from other directories. Signed-off-by: Paolo Bonzini --- Makefile.objs | 2 ++ Makefile.target | 47 ++++++++++++++++++++++------------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 1daa92c96b..e06db126c2 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -468,3 +468,5 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) +nested-vars += # ... +dummy := $(call unnest-vars) diff --git a/Makefile.target b/Makefile.target index 655908e173..f1d5fe2566 100644 --- a/Makefile.target +++ b/Makefile.target @@ -21,8 +21,6 @@ QEMU_CFLAGS += -I../linux-headers endif QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H -include $(SRC_PATH)/Makefile.objs - QEMU_CFLAGS+=-I$(SRC_PATH)/include ifdef CONFIG_USER_ONLY @@ -107,10 +105,6 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) -I$(SRC_PATH)/linux-user obj-y += linux-user/ obj-y += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) -obj-y += $(addprefix ../, $(universal-obj-y)) -obj-y += $(addprefix ../libuser/, $(user-obj-y)) -obj-y += $(addprefix ../libdis-user/, $(libdis-y)) - endif #CONFIG_LINUX_USER ######################################################### @@ -123,10 +117,6 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.o -obj-y += $(addprefix ../, $(universal-obj-y)) -obj-y += $(addprefix ../libuser/, $(user-obj-y)) -obj-y += $(addprefix ../libdis-user/, $(libdis-y)) - endif #CONFIG_BSD_USER ######################################################### @@ -191,33 +181,40 @@ main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h -obj-y += $(addprefix ../, $(universal-obj-y)) -obj-y += $(addprefix ../, $(common-obj-y)) -obj-y += $(addprefix ../libdis/, $(libdis-y)) -obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) -obj-y += $(addprefix ../, $(trace-obj-y)) - endif # CONFIG_SOFTMMU -ifndef CONFIG_LINUX_USER -ifndef CONFIG_BSD_USER +nested-vars += obj-y + +# This resolves all nested paths, so it must come last +include $(SRC_PATH)/Makefile.objs + +all-obj-y = $(obj-y) +all-obj-y += $(addprefix ../, $(universal-obj-y)) + +ifdef CONFIG_SOFTMMU + +all-obj-y += $(addprefix ../, $(common-obj-y)) +all-obj-y += $(addprefix ../libdis/, $(libdis-y)) +all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) +all-obj-y += $(addprefix ../, $(trace-obj-y)) + # libcacard needs qemu-thread support, and besides is only needed by devices # so not requires with linux-user / bsd-user targets -obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) -endif # CONFIG_BSD_USER -endif # CONFIG_LINUX_USER +all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) -nested-vars = obj-y -dummy := $(call unnest-vars) +else +all-obj-y += $(addprefix ../libuser/, $(user-obj-y)) +all-obj-y += $(addprefix ../libdis-user/, $(libdis-y)) +endif #CONFIG_LINUX_USER ifdef QEMU_PROGW # The linker builds a windows executable. Make also a console executable. -$(QEMU_PROGW): $(obj-y) +$(QEMU_PROGW): $(all-obj-y) $(call LINK,$^) $(QEMU_PROG): $(QEMU_PROGW) $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") else -$(QEMU_PROG): $(obj-y) +$(QEMU_PROG): $(all-obj-y) $(call LINK,$^) endif -- cgit v1.2.1 From 7f07b9cbc51066ddaa133b29389e225612aaced2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:42:53 +0200 Subject: build: adapt qom/Makefile and move it to Makefile.objs qom/ already used a separate makefile. Convert it to use relative paths, and make it declare both common-obj-y and user-obj-y. This way, the upper makefiles do not need to know that some QOM files are compiled twice. Signed-off-by: Paolo Bonzini --- Makefile.objs | 13 +++++++------ qom/Makefile | 2 -- qom/Makefile.objs | 4 ++++ 3 files changed, 11 insertions(+), 8 deletions(-) delete mode 100644 qom/Makefile create mode 100644 qom/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index e06db126c2..ef49a095af 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -12,9 +12,7 @@ universal-obj-y += $(qobject-obj-y) ####################################################################### # QOM -include $(SRC_PATH)/qom/Makefile -qom-obj-y = $(addprefix qom/, $(qom-y)) -qom-obj-twice-y = $(addprefix qom/, $(qom-twice-y)) +qom-obj-y = qom/ universal-obj-y += $(qom-obj-y) @@ -94,7 +92,7 @@ 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 += $(qom-obj-twice-y) +common-obj-y += qom/ common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX)) common-obj-y += readline.o console.o cursor.o common-obj-y += $(oslib-obj-y) @@ -202,7 +200,7 @@ 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) -user-obj-y += $(qom-obj-twice-y) +user-obj-y += qom/ ###################################################################### # libhw @@ -468,5 +466,8 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) -nested-vars += # ... +nested-vars += \ + qom-obj-y \ + user-obj-y \ + common-obj-y dummy := $(call unnest-vars) diff --git a/qom/Makefile b/qom/Makefile deleted file mode 100644 index 34c6de558a..0000000000 --- a/qom/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -qom-y = object.o container.o qom-qobject.o -qom-twice-y = cpu.o diff --git a/qom/Makefile.objs b/qom/Makefile.objs new file mode 100644 index 0000000000..5ef060a401 --- /dev/null +++ b/qom/Makefile.objs @@ -0,0 +1,4 @@ +qom-obj-y = object.o container.o qom-qobject.o +qom-obj-twice-y = cpu.o +common-obj-y = $(qom-obj-twice-y) +user-obj-y = $(qom-obj-twice-y) -- cgit v1.2.1 From 7456e4ce8de73c2406046f29a0e899d8806820ce Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:44:39 +0200 Subject: build: move block/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 16 ++-------------- block/Makefile.objs | 11 +++++++++++ 2 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 block/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index ef49a095af..3285949975 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -45,20 +45,7 @@ block-obj-y += nbd.o block.o aio.o aes.o qemu-config.o qemu-progress.o qemu-sock block-obj-y += $(coroutine-obj-y) $(qobject-obj-y) $(version-obj-y) block-obj-$(CONFIG_POSIX) += posix-aio-compat.o block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o - -block-nested-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o -block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o -block-nested-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o -block-nested-y += qed-check.o -block-nested-y += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o -block-nested-y += stream.o -block-nested-$(CONFIG_WIN32) += raw-win32.o -block-nested-$(CONFIG_POSIX) += raw-posix.o -block-nested-$(CONFIG_LIBISCSI) += iscsi.o -block-nested-$(CONFIG_CURL) += curl.o -block-nested-$(CONFIG_RBD) += rbd.o - -block-obj-y += $(addprefix block/, $(block-nested-y)) +block-obj-y += block/ net-obj-y = net.o net-nested-y = queue.o checksum.o util.o @@ -467,6 +454,7 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) nested-vars += \ + block-obj-y \ qom-obj-y \ user-obj-y \ common-obj-y diff --git a/block/Makefile.objs b/block/Makefile.objs new file mode 100644 index 0000000000..b5754d39bf --- /dev/null +++ b/block/Makefile.objs @@ -0,0 +1,11 @@ +block-obj-y += raw.o cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o +block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o +block-obj-y += qed.o qed-gencb.o qed-l2-cache.o qed-table.o qed-cluster.o +block-obj-y += qed-check.o +block-obj-y += parallels.o nbd.o blkdebug.o sheepdog.o blkverify.o +block-obj-y += stream.o +block-obj-$(CONFIG_WIN32) += raw-win32.o +block-obj-$(CONFIG_POSIX) += raw-posix.o +block-obj-$(CONFIG_LIBISCSI) += iscsi.o +block-obj-$(CONFIG_CURL) += curl.o +block-obj-$(CONFIG_RBD) += rbd.o -- cgit v1.2.1 From d8469de6c10533ce32be063e1ce3b586dc91406e Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:45:55 +0200 Subject: build: move net/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 17 +---------------- net/Makefile.objs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 net/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index 3285949975..f40be38c64 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -47,21 +47,6 @@ block-obj-$(CONFIG_POSIX) += posix-aio-compat.o block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o block-obj-y += block/ -net-obj-y = net.o -net-nested-y = queue.o checksum.o util.o -net-nested-y += socket.o -net-nested-y += dump.o -net-nested-$(CONFIG_POSIX) += tap.o -net-nested-$(CONFIG_LINUX) += tap-linux.o -net-nested-$(CONFIG_WIN32) += tap-win32.o -net-nested-$(CONFIG_BSD) += tap-bsd.o -net-nested-$(CONFIG_SOLARIS) += tap-solaris.o -net-nested-$(CONFIG_AIX) += tap-aix.o -net-nested-$(CONFIG_HAIKU) += tap-haiku.o -net-nested-$(CONFIG_SLIRP) += slirp.o -net-nested-$(CONFIG_VDE) += vde.o -net-obj-y += $(addprefix net/, $(net-nested-y)) - ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add. # only pull in the actual virtio-9p device if we also enabled virtio. @@ -78,7 +63,7 @@ fsdev-obj-$(CONFIG_VIRTFS) += $(addprefix fsdev/, $(fsdev-nested-y)) # single QEMU executable should support all CPUs and machines. common-obj-y = $(block-obj-y) blockdev.o -common-obj-y += $(net-obj-y) +common-obj-y += net.o net/ common-obj-y += qom/ common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX)) common-obj-y += readline.o console.o cursor.o diff --git a/net/Makefile.objs b/net/Makefile.objs new file mode 100644 index 0000000000..72f50bc903 --- /dev/null +++ b/net/Makefile.objs @@ -0,0 +1,12 @@ +common-obj-y = queue.o checksum.o util.o +common-obj-y += socket.o +common-obj-y += dump.o +common-obj-$(CONFIG_POSIX) += tap.o +common-obj-$(CONFIG_LINUX) += tap-linux.o +common-obj-$(CONFIG_WIN32) += tap-win32.o +common-obj-$(CONFIG_BSD) += tap-bsd.o +common-obj-$(CONFIG_SOLARIS) += tap-solaris.o +common-obj-$(CONFIG_AIX) += tap-aix.o +common-obj-$(CONFIG_HAIKU) += tap-haiku.o +common-obj-$(CONFIG_SLIRP) += slirp.o +common-obj-$(CONFIG_VDE) += vde.o -- cgit v1.2.1 From ee20477d2463dfaf0d88595c8dcbf0f80404f69c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:46:08 +0200 Subject: build: move fsdev/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile | 2 +- Makefile.objs | 11 +++++------ fsdev/Makefile.objs | 9 +++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 fsdev/Makefile.objs diff --git a/Makefile b/Makefile index c0ab97a9d8..0c0540d92e 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ endif subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o -$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $(common-obj-y) subdir-libdis +$(filter %-softmmu,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) $(common-obj-y) $(extra-obj-y) subdir-libdis $(filter %-user,$(SUBDIR_RULES)): $(universal-obj-y) $(trace-obj-y) subdir-libdis-user subdir-libuser diff --git a/Makefile.objs b/Makefile.objs index f40be38c64..4acdbaa1af 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -51,11 +51,7 @@ ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add. # only pull in the actual virtio-9p device if we also enabled virtio. CONFIG_REALLY_VIRTFS=y -fsdev-nested-y = qemu-fsdev.o virtio-9p-marshal.o -else -fsdev-nested-y = qemu-fsdev-dummy.o endif -fsdev-obj-$(CONFIG_VIRTFS) += $(addprefix fsdev/, $(fsdev-nested-y)) ###################################################################### # Target independent part of system emulation. The long term path is to @@ -65,12 +61,14 @@ fsdev-obj-$(CONFIG_VIRTFS) += $(addprefix fsdev/, $(fsdev-nested-y)) common-obj-y = $(block-obj-y) blockdev.o common-obj-y += net.o net/ common-obj-y += qom/ -common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX)) common-obj-y += readline.o console.o cursor.o common-obj-y += $(oslib-obj-y) common-obj-$(CONFIG_WIN32) += os-win32.o common-obj-$(CONFIG_POSIX) += os-posix.o +common-obj-$(CONFIG_LINUX) += fsdev/ +extra-obj-$(CONFIG_LINUX) += fsdev/ + common-obj-y += tcg-runtime.o host-utils.o main-loop.o common-obj-y += irq.o input.o common-obj-$(CONFIG_PTIMER) += ptimer.o @@ -442,5 +440,6 @@ nested-vars += \ block-obj-y \ qom-obj-y \ user-obj-y \ - common-obj-y + common-obj-y \ + extra-obj-y dummy := $(call unnest-vars) diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs new file mode 100644 index 0000000000..cb1e2500b9 --- /dev/null +++ b/fsdev/Makefile.objs @@ -0,0 +1,9 @@ +ifeq ($(CONFIG_REALLY_VIRTFS),y) +common-obj-y = qemu-fsdev.o virtio-9p-marshal.o + +# Toplevel always builds this; targets without virtio will put it in +# common-obj-y +extra-obj-y = qemu-fsdev-dummy.o +else +common-obj-y = qemu-fsdev-dummy.o +endif -- cgit v1.2.1 From 8867aef02e1e5817c72b2e09be4ae952eb0c9d9d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:48:15 +0200 Subject: build: move ui/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 21 ++------------------- ui/Makefile.objs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 ui/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index 4acdbaa1af..a6310e321d 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -110,7 +110,6 @@ common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o 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 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o audio-obj-$(CONFIG_SDL) += sdlaudio.o @@ -127,24 +126,8 @@ audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o audio-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o audio-obj-y += wavcapture.o common-obj-y += $(addprefix audio/, $(audio-obj-y)) - -ui-obj-y += keymaps.o -ui-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o -ui-obj-$(CONFIG_COCOA) += cocoa.o -ui-obj-$(CONFIG_CURSES) += curses.o -vnc-obj-y += vnc.o d3des.o -vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o -vnc-obj-y += vnc-enc-tight.o vnc-palette.o -vnc-obj-y += vnc-enc-zrle.o -vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o -vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o -ifdef CONFIG_VNC_THREAD -vnc-obj-y += vnc-jobs-async.o -else -vnc-obj-y += vnc-jobs-sync.o -endif -common-obj-y += $(addprefix ui/, $(ui-obj-y)) -common-obj-$(CONFIG_VNC) += $(addprefix ui/, $(vnc-obj-y)) +common-obj-$(CONFIG_SPICE) += spice-qemu-char.o +common-obj-y += ui/ common-obj-y += iov.o acl.o common-obj-$(CONFIG_POSIX) += compatfd.o diff --git a/ui/Makefile.objs b/ui/Makefile.objs new file mode 100644 index 0000000000..3687c8a518 --- /dev/null +++ b/ui/Makefile.objs @@ -0,0 +1,18 @@ +vnc-obj-y += vnc.o d3des.o +vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o +vnc-obj-y += vnc-enc-tight.o vnc-palette.o +vnc-obj-y += vnc-enc-zrle.o +vnc-obj-$(CONFIG_VNC_TLS) += vnc-tls.o vnc-auth-vencrypt.o +vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o +ifdef CONFIG_VNC_THREAD +vnc-obj-y += vnc-jobs-async.o +else +vnc-obj-y += vnc-jobs-sync.o +endif + +common-obj-y += keymaps.o +common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o spice-display.o +common-obj-$(CONFIG_SDL) += sdl.o sdl_zoom.o x_keymap.o +common-obj-$(CONFIG_COCOA) += cocoa.o +common-obj-$(CONFIG_CURSES) += curses.o +common-obj-$(CONFIG_VNC) += $(vnc-obj-y) -- cgit v1.2.1 From b0b68fc671a55f73a2a886fe75fbe95df4d9105c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:49:02 +0200 Subject: build: move audio/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 18 ++---------------- audio/Makefile.objs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 audio/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index a6310e321d..7ee2bb633e 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -110,23 +110,9 @@ common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o common-obj-$(CONFIG_WIN32) += version.o - -audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o -audio-obj-$(CONFIG_SDL) += sdlaudio.o -audio-obj-$(CONFIG_OSS) += ossaudio.o -audio-obj-$(CONFIG_SPICE) += spiceaudio.o -audio-obj-$(CONFIG_COREAUDIO) += coreaudio.o -audio-obj-$(CONFIG_ALSA) += alsaaudio.o -audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o -audio-obj-$(CONFIG_FMOD) += fmodaudio.o -audio-obj-$(CONFIG_ESD) += esdaudio.o -audio-obj-$(CONFIG_PA) += paaudio.o -audio-obj-$(CONFIG_WINWAVE) += winwaveaudio.o -audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o -audio-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o -audio-obj-y += wavcapture.o -common-obj-y += $(addprefix audio/, $(audio-obj-y)) common-obj-$(CONFIG_SPICE) += spice-qemu-char.o + +common-obj-y += audio/ common-obj-y += ui/ common-obj-y += iov.o acl.o diff --git a/audio/Makefile.objs b/audio/Makefile.objs new file mode 100644 index 0000000000..0f2932d1b3 --- /dev/null +++ b/audio/Makefile.objs @@ -0,0 +1,14 @@ +common-obj-y = audio.o noaudio.o wavaudio.o mixeng.o +common-obj-$(CONFIG_SDL) += sdlaudio.o +common-obj-$(CONFIG_OSS) += ossaudio.o +common-obj-$(CONFIG_SPICE) += spiceaudio.o +common-obj-$(CONFIG_COREAUDIO) += coreaudio.o +common-obj-$(CONFIG_ALSA) += alsaaudio.o +common-obj-$(CONFIG_DSOUND) += dsoundaudio.o +common-obj-$(CONFIG_FMOD) += fmodaudio.o +common-obj-$(CONFIG_ESD) += esdaudio.o +common-obj-$(CONFIG_PA) += paaudio.o +common-obj-$(CONFIG_WINWAVE) += winwaveaudio.o +common-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o +common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o +common-obj-y += wavcapture.o -- cgit v1.2.1 From 4c696054727edbc274dd174558e0a796c98d1557 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:49:43 +0200 Subject: build: move slirp/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 5 +---- slirp/Makefile.objs | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 slirp/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index 7ee2bb633e..668c1487cb 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -120,10 +120,7 @@ common-obj-$(CONFIG_POSIX) += compatfd.o common-obj-y += notify.o event_notifier.o common-obj-y += qemu-timer.o qemu-timer-common.o -slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o -slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o -slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o arp_table.o -common-obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y)) +common-obj-$(CONFIG_SLIRP) += slirp/ # xen backend driver support common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o diff --git a/slirp/Makefile.objs b/slirp/Makefile.objs new file mode 100644 index 0000000000..bb43d3c08c --- /dev/null +++ b/slirp/Makefile.objs @@ -0,0 +1,3 @@ +common-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o +common-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o +common-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o arp_table.o -- cgit v1.2.1 From dd5614d6f1d22c4e940368e1433325a3669cbbc2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:50:34 +0200 Subject: build: move qapi/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 6 ++---- qapi/Makefile.objs | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 qapi/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index 668c1487cb..e7f7a85c7c 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -375,10 +375,7 @@ libcacard-y = cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o ###################################################################### # qapi -qapi-nested-y = qapi-visit-core.o qapi-dealloc-visitor.o qmp-input-visitor.o -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)) +qapi-obj-y = qapi/ common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o common-obj-y += qmp.o hmp.o @@ -405,6 +402,7 @@ QEMU_CFLAGS+=$(GLIB_CFLAGS) nested-vars += \ block-obj-y \ qom-obj-y \ + qapi-obj-y \ user-obj-y \ common-obj-y \ extra-obj-y diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs new file mode 100644 index 0000000000..d0b0c16b90 --- /dev/null +++ b/qapi/Makefile.objs @@ -0,0 +1,3 @@ +qapi-obj-y = qapi-visit-core.o qapi-dealloc-visitor.o qmp-input-visitor.o +qapi-obj-y += qmp-output-visitor.o qmp-registry.o qmp-dispatch.o +qapi-obj-y += string-input-visitor.o string-output-visitor.o -- cgit v1.2.1 From 4eb7ba8aff38291296bce7e5efa4ac6f42c989c4 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 22 May 2012 13:50:58 +0200 Subject: build: move qga/ objects to nested Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.objs | 7 ++----- qga/Makefile.objs | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 qga/Makefile.objs diff --git a/Makefile.objs b/Makefile.objs index e7f7a85c7c..fec21a4fa9 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -385,11 +385,7 @@ universal-obj-y += $(qapi-obj-y) ###################################################################### # guest agent -qga-nested-y = commands.o guest-agent-command-state.o -qga-nested-$(CONFIG_POSIX) += commands-posix.o channel-posix.o -qga-nested-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o -qga-obj-y = $(addprefix qga/, $(qga-nested-y)) -qga-obj-y += qemu-ga.o module.o +qga-obj-y = qga/ qemu-ga.o module.o qga-obj-$(CONFIG_WIN32) += oslib-win32.o qga-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-sockets.o qemu-option.o @@ -400,6 +396,7 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) nested-vars += \ + qga-obj-y \ block-obj-y \ qom-obj-y \ qapi-obj-y \ diff --git a/qga/Makefile.objs b/qga/Makefile.objs new file mode 100644 index 0000000000..6a4d843436 --- /dev/null +++ b/qga/Makefile.objs @@ -0,0 +1,3 @@ +qga-obj-y = commands.o guest-agent-command-state.o +qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o +qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o -- cgit v1.2.1 From 3d5a3f9a7fded758e37da15471d50de4b0f7e4a5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:08:47 +0200 Subject: build: move target-independent hw/ objects to nested Makefile.objs This patch starts converting the hw/ directory. Some files in hw/ are compiled once, some twice (32-/64-bit), some once per target. Each category is moved in a separate patch. After this patch, the files that are compiled once will show the same hierarchy in the build tree as they do in the source tree, for example hw/qdev.o instead of just qdev.o. Signed-off-by: Paolo Bonzini --- Makefile | 6 ++++-- Makefile.objs | 38 +++----------------------------------- configure | 2 +- hw/Makefile.objs | 32 ++++++++++++++++++++++++++++++++ hw/usb/Makefile.objs | 4 ++++ 5 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 hw/Makefile.objs create mode 100644 hw/usb/Makefile.objs diff --git a/Makefile b/Makefile index 0c0540d92e..a10005a22f 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/include ui/cocoa.o: ui/cocoa.m -ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) +ui/sdl.o audio/sdlaudio.o ui/sdl_zoom.o hw/baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS) @@ -214,6 +214,7 @@ clean: rm -Rf .libs rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d rm -f qom/*.o qom/*.d + rm -f usb/*.o usb/*.d hw/*.o hw/*.d rm -f qemu-img-cmds.h rm -f trace/*.o trace/*.d rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp @@ -400,4 +401,5 @@ tar: Makefile: $(GENERATED_HEADERS) # Include automatically generated dependency files --include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d qapi/*.d qga/*.d) +-include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d qapi/*.d) +-include $(wildcard qga/*.d hw/*.d hw/usb/*.d) diff --git a/Makefile.objs b/Makefile.objs index fec21a4fa9..4aa5f0f98b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -70,50 +70,22 @@ common-obj-$(CONFIG_LINUX) += fsdev/ extra-obj-$(CONFIG_LINUX) += fsdev/ common-obj-y += tcg-runtime.o host-utils.o main-loop.o -common-obj-y += irq.o input.o -common-obj-$(CONFIG_PTIMER) += ptimer.o -common-obj-$(CONFIG_MAX7310) += max7310.o -common-obj-$(CONFIG_WM8750) += wm8750.o -common-obj-$(CONFIG_TWL92230) += twl92230.o -common-obj-$(CONFIG_TSC2005) += tsc2005.o -common-obj-$(CONFIG_LM832X) += lm832x.o -common-obj-$(CONFIG_TMP105) += tmp105.o -common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o -common-obj-$(CONFIG_SSD0303) += ssd0303.o -common-obj-$(CONFIG_SSD0323) += ssd0323.o -common-obj-$(CONFIG_ADS7846) += ads7846.o -common-obj-$(CONFIG_MAX111X) += max111x.o -common-obj-$(CONFIG_DS1338) += ds1338.o -common-obj-y += i2c.o smbus.o smbus_eeprom.o -common-obj-y += eeprom93xx.o -common-obj-y += scsi-disk.o cdrom.o -common-obj-y += scsi-generic.o scsi-bus.o -common-obj-y += hid.o -common-obj-y += usb/core.o usb/bus.o usb/desc.o usb/dev-hub.o -common-obj-y += usb/host-$(HOST_USB).o -common-obj-y += usb/dev-hid.o usb/dev-storage.o usb/dev-wacom.o -common-obj-y += usb/dev-serial.o usb/dev-network.o usb/dev-audio.o -common-obj-$(CONFIG_SSI) += ssi.o -common-obj-$(CONFIG_SSI_SD) += ssi-sd.o -common-obj-$(CONFIG_SD) += sd.o -common-obj-y += bt.o bt-host.o bt-vhci.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o -common-obj-y += bt-hci-csr.o usb/dev-bluetooth.o +common-obj-y += input.o common-obj-y += buffered_file.o migration.o migration-tcp.o common-obj-y += qemu-char.o #aio.o -common-obj-y += msmouse.o ps2.o -common-obj-y += qdev.o qdev-properties.o qdev-monitor.o common-obj-y += block-migration.o iohandler.o common-obj-y += pflib.o common-obj-y += bitmap.o bitops.o -common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o common-obj-$(CONFIG_WIN32) += version.o common-obj-$(CONFIG_SPICE) += spice-qemu-char.o common-obj-y += audio/ +common-obj-y += hw/ common-obj-y += ui/ +common-obj-y += bt-host.o bt-vhci.o common-obj-y += iov.o acl.o common-obj-$(CONFIG_POSIX) += compatfd.o @@ -122,10 +94,6 @@ common-obj-y += qemu-timer.o qemu-timer-common.o common-obj-$(CONFIG_SLIRP) += slirp/ -# xen backend driver support -common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o -common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o - ###################################################################### # libuser diff --git a/configure b/configure index cc77700328..b22ff1020f 100755 --- a/configure +++ b/configure @@ -3955,7 +3955,7 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" DIRS="$DIRS slirp audio block net pc-bios/optionrom" DIRS="$DIRS pc-bios/spapr-rtas" DIRS="$DIRS roms/seabios roms/vgabios" -DIRS="$DIRS fsdev ui usb" +DIRS="$DIRS fsdev ui hw hw/usb" DIRS="$DIRS qapi qapi-generated" DIRS="$DIRS qga trace qom" FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" diff --git a/hw/Makefile.objs b/hw/Makefile.objs new file mode 100644 index 0000000000..00642f31a0 --- /dev/null +++ b/hw/Makefile.objs @@ -0,0 +1,32 @@ +common-obj-y += usb/ +common-obj-y += irq.o +common-obj-$(CONFIG_PTIMER) += ptimer.o +common-obj-$(CONFIG_MAX7310) += max7310.o +common-obj-$(CONFIG_WM8750) += wm8750.o +common-obj-$(CONFIG_TWL92230) += twl92230.o +common-obj-$(CONFIG_TSC2005) += tsc2005.o +common-obj-$(CONFIG_LM832X) += lm832x.o +common-obj-$(CONFIG_TMP105) += tmp105.o +common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o +common-obj-$(CONFIG_SSD0303) += ssd0303.o +common-obj-$(CONFIG_SSD0323) += ssd0323.o +common-obj-$(CONFIG_ADS7846) += ads7846.o +common-obj-$(CONFIG_MAX111X) += max111x.o +common-obj-$(CONFIG_DS1338) += ds1338.o +common-obj-y += i2c.o smbus.o smbus_eeprom.o +common-obj-y += eeprom93xx.o +common-obj-y += scsi-disk.o cdrom.o +common-obj-y += scsi-generic.o scsi-bus.o +common-obj-y += hid.o +common-obj-$(CONFIG_SSI) += ssi.o +common-obj-$(CONFIG_SSI_SD) += ssi-sd.o +common-obj-$(CONFIG_SD) += sd.o +common-obj-y += bt.o bt-l2cap.o bt-sdp.o bt-hci.o bt-hid.o +common-obj-y += bt-hci-csr.o +common-obj-y += msmouse.o ps2.o +common-obj-y += qdev.o qdev-properties.o qdev-monitor.o +common-obj-$(CONFIG_BRLAPI) += baum.o + +# xen backend driver support +common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o +common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs new file mode 100644 index 0000000000..7dbc33b881 --- /dev/null +++ b/hw/usb/Makefile.objs @@ -0,0 +1,4 @@ +common-obj-y += core.o bus.o desc.o dev-hub.o +common-obj-y += host-$(HOST_USB).o dev-bluetooth.o +common-obj-y += dev-hid.o dev-storage.o dev-wacom.o +common-obj-y += dev-serial.o dev-network.o dev-audio.o -- cgit v1.2.1 From be1029ec30d2eee9e0eb56190d1ed2ed9a400bdf Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:10:55 +0200 Subject: build: convert libhw to nested Makefile.objs After this patch, the libhw* directories will have a hierarchy that mimics the source tree. This is useful because we do have a couple of files there that are in the top source directory. Signed-off-by: Paolo Bonzini --- Makefile.hw | 6 +-- Makefile.objs | 143 +------------------------------------------------- configure | 7 +-- hw/9pfs/Makefile.objs | 7 +++ hw/Makefile.objs | 115 ++++++++++++++++++++++++++++++++++++++++ hw/ide/Makefile.objs | 10 ++++ hw/usb/Makefile.objs | 9 ++++ 7 files changed, 150 insertions(+), 147 deletions(-) create mode 100644 hw/9pfs/Makefile.objs create mode 100644 hw/ide/Makefile.objs diff --git a/Makefile.hw b/Makefile.hw index 33f1ab0183..155a0c3432 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -7,7 +7,7 @@ include $(SRC_PATH)/rules.mak .PHONY: all -$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) +$(call set-vpath, $(SRC_PATH)) QEMU_CFLAGS+=-I.. QEMU_CFLAGS += -I$(SRC_PATH)/include @@ -19,7 +19,7 @@ all: $(hw-obj-y) @true clean: - rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ + rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ */*/*.d # Include automatically generated dependency files --include $(wildcard *.d */*.d) +-include $(wildcard *.d */*.d */*/*.d) diff --git a/Makefile.objs b/Makefile.objs index 4aa5f0f98b..ae3770a5f7 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -109,147 +109,7 @@ user-obj-y += qom/ ###################################################################### # libhw -hw-obj-y = -hw-obj-y += vl.o loader.o -hw-obj-$(CONFIG_VIRTIO) += virtio-console.o -hw-obj-y += usb/libhw.o -hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o -hw-obj-y += fw_cfg.o -hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o pci_bridge_dev.o -hw-obj-$(CONFIG_PCI) += msix.o msi.o -hw-obj-$(CONFIG_PCI) += shpc.o -hw-obj-$(CONFIG_PCI) += slotid_cap.o -hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o -hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o -hw-obj-y += watchdog.o -hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o -hw-obj-$(CONFIG_ECC) += ecc.o -hw-obj-$(CONFIG_NAND) += nand.o -hw-obj-$(CONFIG_PFLASH_CFI01) += pflash_cfi01.o -hw-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o - -hw-obj-$(CONFIG_M48T59) += m48t59.o -hw-obj-$(CONFIG_ESCC) += escc.o -hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o - -hw-obj-$(CONFIG_SERIAL) += serial.o -hw-obj-$(CONFIG_PARALLEL) += parallel.o -hw-obj-$(CONFIG_I8254) += i8254_common.o i8254.o -hw-obj-$(CONFIG_PCSPK) += pcspk.o -hw-obj-$(CONFIG_PCKBD) += pckbd.o -hw-obj-$(CONFIG_USB_UHCI) += usb/hcd-uhci.o -hw-obj-$(CONFIG_USB_OHCI) += usb/hcd-ohci.o -hw-obj-$(CONFIG_USB_EHCI) += usb/hcd-ehci.o -hw-obj-$(CONFIG_USB_XHCI) += usb/hcd-xhci.o -hw-obj-$(CONFIG_FDC) += fdc.o -hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o -hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o -hw-obj-$(CONFIG_DMA) += dma.o -hw-obj-$(CONFIG_I82374) += i82374.o -hw-obj-$(CONFIG_HPET) += hpet.o -hw-obj-$(CONFIG_APPLESMC) += applesmc.o -hw-obj-$(CONFIG_SMARTCARD) += usb/dev-smartcard-reader.o ccid-card-passthru.o -hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o -hw-obj-$(CONFIG_USB_REDIR) += usb/redirect.o -hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o - -# PPC devices -hw-obj-$(CONFIG_PREP_PCI) += prep_pci.o -hw-obj-$(CONFIG_I82378) += i82378.o -# Mac shared devices -hw-obj-$(CONFIG_MACIO) += macio.o -hw-obj-$(CONFIG_CUDA) += cuda.o -hw-obj-$(CONFIG_ADB) += adb.o -hw-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o -hw-obj-$(CONFIG_MAC_DBDMA) += mac_dbdma.o -# OldWorld PowerMac -hw-obj-$(CONFIG_HEATHROW_PIC) += heathrow_pic.o -hw-obj-$(CONFIG_GRACKLE_PCI) += grackle_pci.o -# NewWorld PowerMac -hw-obj-$(CONFIG_UNIN_PCI) += unin_pci.o -hw-obj-$(CONFIG_DEC_PCI) += dec_pci.o -# PowerPC E500 boards -hw-obj-$(CONFIG_PPCE500_PCI) += ppce500_pci.o - -# MIPS devices -hw-obj-$(CONFIG_PIIX4) += piix4.o -hw-obj-$(CONFIG_G364FB) += g364fb.o -hw-obj-$(CONFIG_JAZZ_LED) += jazz_led.o - -# PCI watchdog devices -hw-obj-$(CONFIG_PCI) += wdt_i6300esb.o - -hw-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o - -# PCI network cards -hw-obj-$(CONFIG_NE2000_PCI) += ne2000.o -hw-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o -hw-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o -hw-obj-$(CONFIG_PCNET_COMMON) += pcnet.o -hw-obj-$(CONFIG_E1000_PCI) += e1000.o -hw-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o - -hw-obj-$(CONFIG_SMC91C111) += smc91c111.o -hw-obj-$(CONFIG_LAN9118) += lan9118.o -hw-obj-$(CONFIG_NE2000_ISA) += ne2000-isa.o -hw-obj-$(CONFIG_OPENCORES_ETH) += opencores_eth.o - -# IDE -hw-obj-$(CONFIG_IDE_CORE) += ide/core.o ide/atapi.o -hw-obj-$(CONFIG_IDE_QDEV) += ide/qdev.o -hw-obj-$(CONFIG_IDE_PCI) += ide/pci.o -hw-obj-$(CONFIG_IDE_ISA) += ide/isa.o -hw-obj-$(CONFIG_IDE_PIIX) += ide/piix.o -hw-obj-$(CONFIG_IDE_CMD646) += ide/cmd646.o -hw-obj-$(CONFIG_IDE_MACIO) += ide/macio.o -hw-obj-$(CONFIG_IDE_VIA) += ide/via.o -hw-obj-$(CONFIG_AHCI) += ide/ahci.o -hw-obj-$(CONFIG_AHCI) += ide/ich.o - -# SCSI layer -hw-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o -hw-obj-$(CONFIG_ESP) += esp.o - -hw-obj-y += dma-helpers.o sysbus.o isa-bus.o -hw-obj-y += qdev-addr.o - -# VGA -hw-obj-$(CONFIG_VGA_PCI) += vga-pci.o -hw-obj-$(CONFIG_VGA_ISA) += vga-isa.o -hw-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o -hw-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o -hw-obj-$(CONFIG_VMMOUSE) += vmmouse.o -hw-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o - -hw-obj-$(CONFIG_RC4030) += rc4030.o -hw-obj-$(CONFIG_DP8393X) += dp8393x.o -hw-obj-$(CONFIG_DS1225Y) += ds1225y.o -hw-obj-$(CONFIG_MIPSNET) += mipsnet.o - -hw-obj-y += qtest.o - -# Sound -sound-obj-y = -sound-obj-$(CONFIG_SB16) += sb16.o -sound-obj-$(CONFIG_ES1370) += es1370.o -sound-obj-$(CONFIG_AC97) += ac97.o -sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o -sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o -sound-obj-$(CONFIG_CS4231A) += cs4231a.o -sound-obj-$(CONFIG_HDA) += intel-hda.o hda-audio.o - -adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0 -hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) - -9pfs-nested-$(CONFIG_VIRTFS) = virtio-9p.o -9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-local.o virtio-9p-xattr.o -9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-xattr-user.o virtio-9p-posix-acl.o -9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-coth.o cofs.o codir.o cofile.o -9pfs-nested-$(CONFIG_VIRTFS) += coxattr.o virtio-9p-synth.o -9pfs-nested-$(CONFIG_OPEN_BY_HANDLE) += virtio-9p-handle.o -9pfs-nested-$(CONFIG_VIRTFS) += virtio-9p-proxy.o - -hw-obj-$(CONFIG_REALLY_VIRTFS) += $(addprefix 9pfs/, $(9pfs-nested-y)) +hw-obj-y = vl.o dma-helpers.o qtest.o hw/ ###################################################################### # libdis @@ -364,6 +224,7 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) nested-vars += \ + hw-obj-y \ qga-obj-y \ block-obj-y \ qom-obj-y \ diff --git a/configure b/configure index b22ff1020f..785e3f8670 100755 --- a/configure +++ b/configure @@ -3996,10 +3996,11 @@ done for hwlib in 32 64; do d=libhw$hwlib mkdir -p $d - mkdir -p $d/ide - mkdir -p $d/usb + mkdir -p $d/hw + mkdir -p $d/hw/ide + mkdir -p $d/hw/usb symlink "$source_path/Makefile.hw" "$d/Makefile" - mkdir -p $d/9pfs + mkdir -p $d/hw/9pfs echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak done diff --git a/hw/9pfs/Makefile.objs b/hw/9pfs/Makefile.objs new file mode 100644 index 0000000000..2700772b77 --- /dev/null +++ b/hw/9pfs/Makefile.objs @@ -0,0 +1,7 @@ +hw-obj-y = virtio-9p.o +hw-obj-y += virtio-9p-local.o virtio-9p-xattr.o +hw-obj-y += virtio-9p-xattr-user.o virtio-9p-posix-acl.o +hw-obj-y += virtio-9p-coth.o cofs.o codir.o cofile.o +hw-obj-y += coxattr.o virtio-9p-synth.o +hw-obj-$(CONFIG_OPEN_BY_HANDLE) += virtio-9p-handle.o +hw-obj-y += virtio-9p-proxy.o diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 00642f31a0..08dde634ed 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -1,3 +1,118 @@ +hw-obj-y = usb/ ide/ +hw-obj-y += loader.o +hw-obj-$(CONFIG_VIRTIO) += virtio-console.o +hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o +hw-obj-y += fw_cfg.o +hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o pci_bridge_dev.o +hw-obj-$(CONFIG_PCI) += msix.o msi.o +hw-obj-$(CONFIG_PCI) += shpc.o +hw-obj-$(CONFIG_PCI) += slotid_cap.o +hw-obj-$(CONFIG_PCI) += pci_host.o pcie_host.o +hw-obj-$(CONFIG_PCI) += ioh3420.o xio3130_upstream.o xio3130_downstream.o +hw-obj-y += watchdog.o +hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o +hw-obj-$(CONFIG_ECC) += ecc.o +hw-obj-$(CONFIG_NAND) += nand.o +hw-obj-$(CONFIG_PFLASH_CFI01) += pflash_cfi01.o +hw-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o + +hw-obj-$(CONFIG_M48T59) += m48t59.o +hw-obj-$(CONFIG_ESCC) += escc.o +hw-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o + +hw-obj-$(CONFIG_SERIAL) += serial.o +hw-obj-$(CONFIG_PARALLEL) += parallel.o +hw-obj-$(CONFIG_I8254) += i8254_common.o i8254.o +hw-obj-$(CONFIG_PCSPK) += pcspk.o +hw-obj-$(CONFIG_PCKBD) += pckbd.o +hw-obj-$(CONFIG_FDC) += fdc.o +hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o +hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o +hw-obj-$(CONFIG_DMA) += dma.o +hw-obj-$(CONFIG_I82374) += i82374.o +hw-obj-$(CONFIG_HPET) += hpet.o +hw-obj-$(CONFIG_APPLESMC) += applesmc.o +hw-obj-$(CONFIG_SMARTCARD) += ccid-card-passthru.o +hw-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o +hw-obj-$(CONFIG_I8259) += i8259_common.o i8259.o + +# PPC devices +hw-obj-$(CONFIG_PREP_PCI) += prep_pci.o +hw-obj-$(CONFIG_I82378) += i82378.o +# Mac shared devices +hw-obj-$(CONFIG_MACIO) += macio.o +hw-obj-$(CONFIG_CUDA) += cuda.o +hw-obj-$(CONFIG_ADB) += adb.o +hw-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o +hw-obj-$(CONFIG_MAC_DBDMA) += mac_dbdma.o +# OldWorld PowerMac +hw-obj-$(CONFIG_HEATHROW_PIC) += heathrow_pic.o +hw-obj-$(CONFIG_GRACKLE_PCI) += grackle_pci.o +# NewWorld PowerMac +hw-obj-$(CONFIG_UNIN_PCI) += unin_pci.o +hw-obj-$(CONFIG_DEC_PCI) += dec_pci.o +# PowerPC E500 boards +hw-obj-$(CONFIG_PPCE500_PCI) += ppce500_pci.o + +# MIPS devices +hw-obj-$(CONFIG_PIIX4) += piix4.o +hw-obj-$(CONFIG_G364FB) += g364fb.o +hw-obj-$(CONFIG_JAZZ_LED) += jazz_led.o + +# PCI watchdog devices +hw-obj-$(CONFIG_PCI) += wdt_i6300esb.o + +hw-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o + +# PCI network cards +hw-obj-$(CONFIG_NE2000_PCI) += ne2000.o +hw-obj-$(CONFIG_EEPRO100_PCI) += eepro100.o +hw-obj-$(CONFIG_PCNET_PCI) += pcnet-pci.o +hw-obj-$(CONFIG_PCNET_COMMON) += pcnet.o +hw-obj-$(CONFIG_E1000_PCI) += e1000.o +hw-obj-$(CONFIG_RTL8139_PCI) += rtl8139.o + +hw-obj-$(CONFIG_SMC91C111) += smc91c111.o +hw-obj-$(CONFIG_LAN9118) += lan9118.o +hw-obj-$(CONFIG_NE2000_ISA) += ne2000-isa.o +hw-obj-$(CONFIG_OPENCORES_ETH) += opencores_eth.o + +# SCSI layer +hw-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o +hw-obj-$(CONFIG_ESP) += esp.o + +hw-obj-y += sysbus.o isa-bus.o +hw-obj-y += qdev-addr.o + +# VGA +hw-obj-$(CONFIG_VGA_PCI) += vga-pci.o +hw-obj-$(CONFIG_VGA_ISA) += vga-isa.o +hw-obj-$(CONFIG_VGA_ISA_MM) += vga-isa-mm.o +hw-obj-$(CONFIG_VMWARE_VGA) += vmware_vga.o +hw-obj-$(CONFIG_VMMOUSE) += vmmouse.o +hw-obj-$(CONFIG_VGA_CIRRUS) += cirrus_vga.o + +hw-obj-$(CONFIG_RC4030) += rc4030.o +hw-obj-$(CONFIG_DP8393X) += dp8393x.o +hw-obj-$(CONFIG_DS1225Y) += ds1225y.o +hw-obj-$(CONFIG_MIPSNET) += mipsnet.o + +# Sound +sound-obj-y = +sound-obj-$(CONFIG_SB16) += sb16.o +sound-obj-$(CONFIG_ES1370) += es1370.o +sound-obj-$(CONFIG_AC97) += ac97.o +sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o +sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o +sound-obj-$(CONFIG_CS4231A) += cs4231a.o +sound-obj-$(CONFIG_HDA) += intel-hda.o hda-audio.o + +$(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0 + +hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) + +hw-obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/ + common-obj-y += usb/ common-obj-y += irq.o common-obj-$(CONFIG_PTIMER) += ptimer.o diff --git a/hw/ide/Makefile.objs b/hw/ide/Makefile.objs new file mode 100644 index 0000000000..cf718dd016 --- /dev/null +++ b/hw/ide/Makefile.objs @@ -0,0 +1,10 @@ +hw-obj-$(CONFIG_IDE_CORE) += core.o atapi.o +hw-obj-$(CONFIG_IDE_QDEV) += qdev.o +hw-obj-$(CONFIG_IDE_PCI) += pci.o +hw-obj-$(CONFIG_IDE_ISA) += isa.o +hw-obj-$(CONFIG_IDE_PIIX) += piix.o +hw-obj-$(CONFIG_IDE_CMD646) += cmd646.o +hw-obj-$(CONFIG_IDE_MACIO) += macio.o +hw-obj-$(CONFIG_IDE_VIA) += via.o +hw-obj-$(CONFIG_AHCI) += ahci.o +hw-obj-$(CONFIG_AHCI) += ich.o diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 7dbc33b881..9c7ddf5cb2 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -1,3 +1,12 @@ +hw-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o +hw-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o +hw-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o +hw-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o +hw-obj-y += libhw.o + +hw-obj-$(CONFIG_SMARTCARD) += dev-smartcard-reader.o +hw-obj-$(CONFIG_USB_REDIR) += redirect.o + common-obj-y += core.o bus.o desc.o dev-hub.o common-obj-y += host-$(HOST_USB).o dev-bluetooth.o common-obj-y += dev-hid.o dev-storage.o dev-wacom.o -- cgit v1.2.1 From c353f261946ddbd814b333ae2440712b486977fd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:49:34 +0200 Subject: build: move per-target hw/ objects to nested Makefile.objs This completes the move to nested Makefiles for virtio and a few other files that were not part of obj-TARGET-y, but still were compiled separately for each target. Signed-off-by: Paolo Bonzini --- Makefile.hw | 5 +++-- Makefile.target | 35 +++++++---------------------------- configure | 1 + hw/9pfs/Makefile.objs | 2 ++ hw/Makefile.objs | 18 ++++++++++++++++++ 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/Makefile.hw b/Makefile.hw index 155a0c3432..2bcbaffb4f 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -19,7 +19,8 @@ all: $(hw-obj-y) @true clean: - rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ */*/*.d + rm -f $(addsuffix /*.o, $(dir $(sort $(hw-obj-y)))) + rm -f $(addsuffix /*.d, $(dir $(sort $(hw-obj-y)))) # Include automatically generated dependency files --include $(wildcard *.d */*.d */*/*.d) +-include $(patsubst %.o, %.d, $(hw-obj-y)) diff --git a/Makefile.target b/Makefile.target index f1d5fe2566..5635043f4a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,11 +1,5 @@ # -*- Mode: makefile -*- -CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) -CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) -CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) -CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y) -CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y) - include ../config-host.mak include config-devices.mak include config-target.mak @@ -122,19 +116,16 @@ endif #CONFIG_BSD_USER ######################################################### # System emulator target ifdef CONFIG_SOFTMMU +CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) +CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) +CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) +CONFIG_NO_GET_MEMORY_MAPPING = $(if $(subst n,,$(CONFIG_HAVE_GET_MEMORY_MAPPING)),n,y) +CONFIG_NO_CORE_DUMP = $(if $(subst n,,$(CONFIG_HAVE_CORE_DUMP)),n,y) obj-y += arch_init.o cpus.o monitor.o gdbstub.o balloon.o ioport.o -# virtio has to be here due to weird dependency between PCI and virtio-net. -# need to fix this properly -obj-$(CONFIG_NO_PCI) += pci-stub.o -obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o -obj-$(CONFIG_VIRTIO) += virtio-scsi.o -obj-y += vhost_net.o -obj-$(CONFIG_VHOST_NET) += vhost.o -obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p-device.o +obj-y += hw/ obj-$(CONFIG_KVM) += kvm-all.o obj-$(CONFIG_NO_KVM) += kvm-stub.o -obj-$(CONFIG_VGA) += vga.o obj-y += memory.o savevm.o cputlb.o obj-$(CONFIG_HAVE_GET_MEMORY_MAPPING) += memory_mapping.o obj-$(CONFIG_HAVE_CORE_DUMP) += dump.o @@ -148,21 +139,9 @@ QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) QEMU_CFLAGS += $(VNC_PNG_CFLAGS) # xen support -obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o +obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o -# Inter-VM PCI shared memory -CONFIG_IVSHMEM = -ifeq ($(CONFIG_KVM), y) - ifeq ($(CONFIG_PCI), y) - CONFIG_IVSHMEM = y - endif -endif -obj-$(CONFIG_IVSHMEM) += ivshmem.o - -# Generic hotplugging -obj-y += device-hotplug.o - # Hardware support ifeq ($(TARGET_ARCH), sparc64) obj-y += hw/sparc64/ diff --git a/configure b/configure index 785e3f8670..e50ad0bb8f 100755 --- a/configure +++ b/configure @@ -3675,6 +3675,7 @@ mkdir -p $target_dir/9pfs mkdir -p $target_dir/hw mkdir -p $target_dir/hw/ide mkdir -p $target_dir/hw/usb +mkdir -p $target_dir/hw/9pfs mkdir -p $target_dir/hw/kvm mkdir -p $target_dir/hw/$TARGET_ARCH mkdir -p $target_dir/hw/$TARGET_BASE_ARCH diff --git a/hw/9pfs/Makefile.objs b/hw/9pfs/Makefile.objs index 2700772b77..972df24050 100644 --- a/hw/9pfs/Makefile.objs +++ b/hw/9pfs/Makefile.objs @@ -5,3 +5,5 @@ hw-obj-y += virtio-9p-coth.o cofs.o codir.o cofile.o hw-obj-y += coxattr.o virtio-9p-synth.o hw-obj-$(CONFIG_OPEN_BY_HANDLE) += virtio-9p-handle.o hw-obj-y += virtio-9p-proxy.o + +obj-y += virtio-9p-device.o diff --git a/hw/Makefile.objs b/hw/Makefile.objs index 08dde634ed..7e17504278 100644 --- a/hw/Makefile.objs +++ b/hw/Makefile.objs @@ -145,3 +145,21 @@ common-obj-$(CONFIG_BRLAPI) += baum.o # xen backend driver support common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o common-obj-$(CONFIG_XEN_BACKEND) += xen_console.o xenfb.o xen_disk.o xen_nic.o + +# Per-target files +# virtio has to be here due to weird dependency between PCI and virtio-net. +# need to fix this properly +obj-$(CONFIG_VIRTIO) += virtio.o virtio-blk.o virtio-balloon.o virtio-net.o +obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o virtio-scsi.o +obj-$(CONFIG_SOFTMMU) += vhost_net.o +obj-$(CONFIG_VHOST_NET) += vhost.o +obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/ +obj-$(CONFIG_NO_PCI) += pci-stub.o +obj-$(CONFIG_VGA) += vga.o +obj-$(CONFIG_SOFTMMU) += device-hotplug.o +obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o + +# Inter-VM PCI shared memory +ifeq ($(CONFIG_PCI), y) +obj-$(CONFIG_KVM) += ivshmem.o +endif -- cgit v1.2.1 From 49ac9e0a8cfb737d6da9c0b056c062e3dec0ba45 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 17:50:03 +0200 Subject: build: move device tree to per-target Makefile.objs Signed-off-by: Paolo Bonzini --- Makefile.target | 7 ------- hw/arm/Makefile.objs | 1 + hw/microblaze/Makefile.objs | 1 + hw/ppc/Makefile.objs | 1 + 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Makefile.target b/Makefile.target index 5635043f4a..3dfdf925fd 100644 --- a/Makefile.target +++ b/Makefile.target @@ -149,13 +149,6 @@ else obj-y += hw/$(TARGET_BASE_ARCH)/ endif -# Device tree -ifeq ($(CONFIG_FDT), y) -obj-$(TARGET_ARM) += device_tree.o -obj-$(TARGET_MICROBLAZE) += device_tree.o -obj-$(TARGET_PPC) += device_tree.o -endif - main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index 92b4f1eb7f..a0ff6a62d6 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -35,5 +35,6 @@ obj-y += vexpress.o obj-y += strongarm.o obj-y += collie.o obj-y += pl041.o lm4549.o +obj-$(CONFIG_FDT) += ../device_tree.o obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/microblaze/Makefile.objs b/hw/microblaze/Makefile.objs index 41724425cb..020f7b6e9b 100644 --- a/hw/microblaze/Makefile.objs +++ b/hw/microblaze/Makefile.objs @@ -9,5 +9,6 @@ obj-y += xilinx_uartlite.o obj-y += xilinx_ethlite.o obj-y += xilinx_axidma.o obj-y += xilinx_axienet.o +obj-$(CONFIG_FDT) += ../device_tree.o obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index 5b09849bed..842e7b9299 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -21,6 +21,7 @@ obj-y += virtex_ml507.o obj-$(CONFIG_KVM) += kvm_ppc.o # PowerPC OpenPIC obj-y += openpic.o +obj-$(CONFIG_FDT) += ../device_tree.o # Xilinx PPC peripherals obj-y += xilinx_intc.o -- cgit v1.2.1 From 00c705fb92bc6e69e955aeac3614e05ca02feacd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:40:24 +0200 Subject: build: libcacard Makefile cleanups Build vscclient from toplevel Makefile, limit usage of vpath. Signed-off-by: Paolo Bonzini --- Makefile | 4 ++++ Makefile.objs | 8 +++++++- Makefile.target | 6 ------ configure | 12 +++++------- libcacard/Makefile | 17 ++++++----------- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index a10005a22f..1d34b9539e 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,10 @@ libcacard.la: $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(t install-libcacard: libcacard.la $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,) endif + +vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) qemu-timer-common.o libcacard/vscclient.o + $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@") + ###################################################################### qemu-img.o: qemu-img-cmds.h diff --git a/Makefile.objs b/Makefile.objs index ae3770a5f7..74110dda7e 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -198,7 +198,13 @@ $(trace-obj-y): $(GENERATED_HEADERS) ###################################################################### # smartcard -libcacard-y = cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o card_7816.o +libcacard-y += libcacard/cac.o libcacard/event.o +libcacard-y += libcacard/vcard.o libcacard/vreader.o +libcacard-y += libcacard/vcard_emul_nss.o +libcacard-y += libcacard/vcard_emul_type.o +libcacard-y += libcacard/card_7816.o + +common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y) ###################################################################### # qapi diff --git a/Makefile.target b/Makefile.target index 3dfdf925fd..555894db4a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -164,16 +164,10 @@ all-obj-y = $(obj-y) all-obj-y += $(addprefix ../, $(universal-obj-y)) ifdef CONFIG_SOFTMMU - all-obj-y += $(addprefix ../, $(common-obj-y)) all-obj-y += $(addprefix ../libdis/, $(libdis-y)) all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) all-obj-y += $(addprefix ../, $(trace-obj-y)) - -# libcacard needs qemu-thread support, and besides is only needed by devices -# so not requires with linux-user / bsd-user targets -all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) - else all-obj-y += $(addprefix ../libuser/, $(user-obj-y)) all-obj-y += $(addprefix ../libdis-user/, $(libdis-y)) diff --git a/configure b/configure index e50ad0bb8f..cd5e8b349c 100755 --- a/configure +++ b/configure @@ -2927,6 +2927,9 @@ if test "$softmmu" = yes ; then fi fi fi +if test "$smartcard_nss" = "yes" ; then + tools="vscclient\$(EXESUF) $tools" +fi # Mac OS X ships with a broken assembler roms= @@ -3959,9 +3962,10 @@ DIRS="$DIRS roms/seabios roms/vgabios" DIRS="$DIRS fsdev ui hw hw/usb" DIRS="$DIRS qapi qapi-generated" DIRS="$DIRS qga trace qom" +DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" -FILES="$FILES tests/tcg/lm32/Makefile" +FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" FILES="$FILES pc-bios/spapr-rtas/Makefile" FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" @@ -4005,12 +4009,6 @@ for hwlib in 32 64; do echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak done -if [ "$source_path" != `pwd` ]; then - # out of tree build - mkdir -p libcacard - symlink "$source_path/libcacard/Makefile" libcacard/Makefile -fi - d=libuser mkdir -p $d mkdir -p $d/trace diff --git a/libcacard/Makefile b/libcacard/Makefile index c6a896a739..fdc287370d 100644 --- a/libcacard/Makefile +++ b/libcacard/Makefile @@ -2,29 +2,23 @@ -include $(SRC_PATH)/Makefile.objs -include $(SRC_PATH)/rules.mak -libcacard_srcpath=$(SRC_PATH)/libcacard libcacard_includedir=$(includedir)/cacard -$(call set-vpath, $(SRC_PATH):$(libcacard_srcpath)) - -# objects linked against normal qemu binaries, not compiled with libtool -QEMU_OBJS=$(addprefix ../,$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y)) +$(call set-vpath, $(SRC_PATH)) # objects linked into a shared library, built with libtool with -fPIC if required -QEMU_OBJS_LIB=$(addsuffix .lo,$(basename $(QEMU_OBJS))) +QEMU_OBJS=$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y) +QEMU_OBJS_LIB=$(patsubst %.o,%.lo,$(QEMU_OBJS)) QEMU_CFLAGS+=-I../ -libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y))) - -vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o - $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@") +libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y)) clean: rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo .libs/* *.la *.pc rm -Rf .libs -all: vscclient +all: libcacard.la libcacard.pc # Dummy command so that make thinks it has done something @true @@ -41,6 +35,7 @@ else libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB) $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs)," lt LINK $@") +libcacard_srcpath=$(SRC_PATH)/libcacard libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in sed -e 's|@LIBDIR@|$(libdir)|' \ -e 's|@INCLUDEDIR@|$(libcacard_includedir)|' \ -- cgit v1.2.1 From fec90ff0bd522a65beb330ab5ca45a40b2f14f10 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:49:50 +0200 Subject: build: limit usage of vpath All paths are now explicitly given, and the object tree mimics the source tree, so there is no need to apply special vpaths. Signed-off-by: Paolo Bonzini --- Makefile | 2 +- Makefile.target | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1d34b9539e..32550cbfaf 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ configure: ; .PHONY: all clean cscope distclean dvi html info install install-doc \ pdf recurse-all speed tar tarbin test build-all -$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) +$(call set-vpath, $(SRC_PATH)) LIBS+=-lz $(LIBS_TOOLS) diff --git a/Makefile.target b/Makefile.target index 555894db4a..2907aad0c4 100644 --- a/Makefile.target +++ b/Makefile.target @@ -8,12 +8,11 @@ ifneq ($(HWDIR),) include $(HWDIR)/config.mak endif -TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw) +$(call set-vpath, $(SRC_PATH)) ifdef CONFIG_LINUX QEMU_CFLAGS += -I../linux-headers endif -QEMU_CFLAGS += -I.. -I$(TARGET_PATH) -DNEED_CPU_H +QEMU_CFLAGS += -I.. -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H QEMU_CFLAGS+=-I$(SRC_PATH)/include -- cgit v1.2.1 From 25f27a4f7160d077d6992e811021b4bc3a82abc1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 16:32:10 +0200 Subject: build: compile oslib-obj-y once There is no difference in oslib-obj-y between user-mode and system targets. There used to be when user-mode could optionally be compiled with PIE. Signed-off-by: Paolo Bonzini --- Makefile.objs | 3 ++- Makefile.target | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 74110dda7e..8e72f097a6 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -22,6 +22,8 @@ oslib-obj-y = osdep.o oslib-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o oslib-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o +universal-obj-y += $(oslib-obj-y) + ####################################################################### # coroutines coroutine-obj-y = qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o @@ -62,7 +64,6 @@ common-obj-y = $(block-obj-y) blockdev.o common-obj-y += net.o net/ common-obj-y += qom/ common-obj-y += readline.o console.o cursor.o -common-obj-y += $(oslib-obj-y) common-obj-$(CONFIG_WIN32) += os-win32.o common-obj-$(CONFIG_POSIX) += os-posix.o diff --git a/Makefile.target b/Makefile.target index 2907aad0c4..2912307e52 100644 --- a/Makefile.target +++ b/Makefile.target @@ -96,7 +96,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 += gdbstub.o thunk.o user-exec.o $(oslib-obj-y) +obj-y += gdbstub.o thunk.o user-exec.o endif #CONFIG_LINUX_USER -- cgit v1.2.1 From ec5b06d717bc49d8ad4dc5e9760e8f1f2a2a371c Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Wed, 6 Jun 2012 16:57:00 +0800 Subject: configure: ensure directory exists when creating symlink Signed-off-by: Anthony Liguori --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index cd5e8b349c..cbcbcb110e 100755 --- a/configure +++ b/configure @@ -42,6 +42,7 @@ compile_prog() { # symbolically link $1 to $2. Portable version of "ln -sf". symlink() { rm -rf "$2" + mkdir -p "$(dirname "$2")" ln -s "$1" "$2" } @@ -3454,14 +3455,12 @@ if test -f ${config_host_ld}~ ; then fi for d in libdis libdis-user; do - mkdir -p $d symlink "$source_path/Makefile.dis" "$d/Makefile" echo > $d/config.mak done # use included Linux headers if test "$linux" = "yes" ; then - mkdir -p linux-headers case "$cpu" in i386|x86_64) symlink "$source_path/linux-headers/asm-x86" linux-headers/asm -- cgit v1.2.1 From 2dee8d54c62abb0a46578ad21cc25782b83e3773 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 4 Jun 2012 09:15:43 +0200 Subject: build: do not create directories at configure time Signed-off-by: Paolo Bonzini --- configure | 35 ++--------------------------------- rules.mak | 1 + 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/configure b/configure index cbcbcb110e..0ecb55fc38 100755 --- a/configure +++ b/configure @@ -3671,26 +3671,6 @@ if [ "$TARGET_BASE_ARCH" = "" ]; then TARGET_BASE_ARCH=$TARGET_ARCH fi -mkdir -p $target_dir/fpu -mkdir -p $target_dir/tcg -mkdir -p $target_dir/9pfs -mkdir -p $target_dir/hw -mkdir -p $target_dir/hw/ide -mkdir -p $target_dir/hw/usb -mkdir -p $target_dir/hw/9pfs -mkdir -p $target_dir/hw/kvm -mkdir -p $target_dir/hw/$TARGET_ARCH -mkdir -p $target_dir/hw/$TARGET_BASE_ARCH -mkdir -p $target_dir/target-$TARGET_BASE_ARCH -if test "$target_linux_user" = yes; then - mkdir -p $target_dir/linux-user -fi -if test "$target_bsd_user" = yes; then - mkdir -p $target_dir/bsd-user -fi -if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then - mkdir -p $target_dir/linux-user/arm/nwfpe -fi symlink "$source_path/Makefile.target" "$target_dir/Makefile" @@ -3955,12 +3935,9 @@ done # for target in $targets # build tree in object directory in case the source is not in the current directory DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32" -DIRS="$DIRS slirp audio block net pc-bios/optionrom" -DIRS="$DIRS pc-bios/spapr-rtas" +DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" DIRS="$DIRS roms/seabios roms/vgabios" -DIRS="$DIRS fsdev ui hw hw/usb" -DIRS="$DIRS qapi qapi-generated" -DIRS="$DIRS qga trace qom" +DIRS="$DIRS qapi-generated" DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" @@ -3999,19 +3976,11 @@ done for hwlib in 32 64; do d=libhw$hwlib - mkdir -p $d - mkdir -p $d/hw - mkdir -p $d/hw/ide - mkdir -p $d/hw/usb symlink "$source_path/Makefile.hw" "$d/Makefile" - mkdir -p $d/hw/9pfs echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak done d=libuser -mkdir -p $d -mkdir -p $d/trace -mkdir -p $d/qom symlink "$source_path/Makefile.user" "$d/Makefile" if test "$docs" = "yes" ; then diff --git a/rules.mak b/rules.mak index f65283cfbd..4bc5e52fa3 100644 --- a/rules.mak +++ b/rules.mak @@ -111,4 +111,5 @@ endef define unnest-vars $(call unnest-vars-1) $(foreach var,$(nested-vars),$(eval $(var) := $(filter-out %/, $($(var))))) +$(shell mkdir -p $(sort $(foreach var,$(nested-vars),$(dir $($(var)))))) endef -- cgit v1.2.1