From 8905ecd5e445cb7def474fcad96878ddf7bd4d6a Mon Sep 17 00:00:00 2001 From: Chen Huitao Date: Mon, 27 Apr 2020 19:54:58 +0800 Subject: [PATCH 1/5] move some operations after hook callback (#1243) * fix finding python path which only has python3. * move some operations after hook callback. --- qemu/cpu-exec.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qemu/cpu-exec.c b/qemu/cpu-exec.c index 99b3d938..1b6400da 100644 --- a/qemu/cpu-exec.c +++ b/qemu/cpu-exec.c @@ -122,6 +122,15 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq ret = cpu->exception_index; break; #else +#if defined(TARGET_X86_64) + if (env->exception_is_int) { + // point EIP to the next instruction after INT + env->eip = env->exception_next_eip; + } +#endif +#if defined(TARGET_MIPS) || defined(TARGET_MIPS64) + env->active_tc.PC = uc->next_pc; +#endif if (uc->stop_interrupt && uc->stop_interrupt(cpu->exception_index)) { // Unicorn: call registered invalid instruction callbacks HOOK_FOREACH_VAR_DECLARE; @@ -151,15 +160,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq } cpu->exception_index = -1; -#if defined(TARGET_X86_64) - if (env->exception_is_int) { - // point EIP to the next instruction after INT - env->eip = env->exception_next_eip; - } -#endif -#if defined(TARGET_MIPS) || defined(TARGET_MIPS64) - env->active_tc.PC = uc->next_pc; -#endif #endif } } From d2c66b838638a64dcb344648f6f91885367d3eed Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 27 Apr 2020 20:44:11 +0800 Subject: [PATCH 2/5] cleanup qemu/configure --- qemu/configure | 5 ----- 1 file changed, 5 deletions(-) diff --git a/qemu/configure b/qemu/configure index 5eab6e30..e6522af8 100755 --- a/qemu/configure +++ b/qemu/configure @@ -1216,11 +1216,6 @@ echo "CFLAGS=$CFLAGS" >> $config_host_mak echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak -if test "$cross_prefix" != ""; then - echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak -else - echo "AUTOCONF_HOST := " >> $config_host_mak -fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak From cdd9340113cb3603013b96b8355e5da920827d43 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 27 Apr 2020 23:01:26 +0800 Subject: [PATCH 3/5] cleanup qemu Makefile* --- qemu/Makefile | 3 --- qemu/Makefile.objs | 17 +---------------- qemu/Makefile.target | 3 --- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/qemu/Makefile b/qemu/Makefile index 385291c1..4a07b0eb 100644 --- a/qemu/Makefile +++ b/qemu/Makefile @@ -103,8 +103,6 @@ endif dummy := $(call unnest-vars,, \ util-obj-y \ - block-obj-y \ - block-obj-m \ common-obj-y \ common-obj-m) @@ -116,7 +114,6 @@ config-host.h-timestamp: config-host.mak SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES)) -$(SOFTMMU_SUBDIR_RULES): $(block-obj-y) $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak subdir-%: diff --git a/qemu/Makefile.objs b/qemu/Makefile.objs index 96590cfd..fcf5f302 100644 --- a/qemu/Makefile.objs +++ b/qemu/Makefile.objs @@ -2,25 +2,10 @@ # Common libraries for tools and emulators util-obj-y = util/ qobject/ qapi/ qapi-types.o qapi-visit.o -####################################################################### -# block-obj-y is code used by both qemu system emulation and qemu-img - -block-obj-y = -block-obj-y += ../uc.o ../list.o glib_compat.o - -####################################################################### -# Target independent part of system emulation. The long term path is to -# suppress *all* target specific code in case of system emulation, i.e. a -# single QEMU executable should support all CPUs and machines. - -ifeq ($(CONFIG_SOFTMMU),y) common-obj-y += hw/ common-obj-y += accel.o common-obj-y += vl.o qemu-timer.o -endif - -####################################################################### -# Target-independent parts used in system and user emulation +common-obj-y += ../uc.o ../list.o glib_compat.o common-obj-y += qemu-log.o common-obj-y += tcg-runtime.o common-obj-y += hw/ diff --git a/qemu/Makefile.target b/qemu/Makefile.target index 913df1b4..2e80c234 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -36,7 +36,6 @@ obj-y += target-$(TARGET_BASE_ARCH)/ ######################################################### # System emulator target -ifdef CONFIG_SOFTMMU obj-y += cpus.o ioport.o obj-y += hw/ obj-y += memory.o cputlb.o @@ -50,8 +49,6 @@ else obj-y += hw/$(TARGET_BASE_ARCH)/ endif -endif # CONFIG_SOFTMMU - # Workaround for http://gcc.gnu.org/PR55489, see configure. %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) From dd28727e997de423653295e3ff92a726f344a24d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Tue, 28 Apr 2020 01:53:39 +0800 Subject: [PATCH 4/5] more qemu/Makefile* cleanup --- qemu/Makefile | 2 -- qemu/Makefile.target | 16 +++------------- qemu/configure | 7 ------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/qemu/Makefile b/qemu/Makefile index 4a07b0eb..8e205951 100644 --- a/qemu/Makefile +++ b/qemu/Makefile @@ -55,8 +55,6 @@ configure: ; $(call set-vpath, $(SRC_PATH)) -LIBS+=-lz $(LIBS_TOOLS) - SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR) SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS)) SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS)) diff --git a/qemu/Makefile.target b/qemu/Makefile.target index 2e80c234..843aa6c6 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -12,20 +12,11 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/include # system emulator name QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) -ifneq (,$(findstring -mwindows,$(libs_softmmu))) -# Terminate program name with a 'w' because the linker builds a windows executable. -QEMU_PROGW=qemu-system-$(TARGET_NAME)w$(EXESUF) -QEMU_PROG_BUILD = $(QEMU_PROGW) -else -QEMU_PROG_BUILD = $(QEMU_PROG) -endif - -PROGS=$(QEMU_PROG) $(QEMU_PROGW) config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak -all: $(PROGS) +all: $(QEMU_PROG) ######################################################### # cpu emulator library @@ -40,7 +31,6 @@ obj-y += cpus.o ioport.o obj-y += hw/ obj-y += memory.o cputlb.o obj-y += memory_mapping.o -LIBS+=$(libs_softmmu) # Hardware support ifeq ($(TARGET_NAME), sparc64) @@ -83,10 +73,10 @@ endif endif # build either PROG or PROGW -$(QEMU_PROG_BUILD): $(all-obj-y) +$(QEMU_PROG): $(all-obj-y) clean: - rm -f *.a *~ $(PROGS) + rm -f *.a *~ $(QEMU_PROG) rm -f $(shell find . -name '*.[od]') GENERATED_HEADERS += config-target.h diff --git a/qemu/configure b/qemu/configure index e6522af8..fcf04d14 100755 --- a/qemu/configure +++ b/qemu/configure @@ -139,7 +139,6 @@ cpu="" static="no" cross_prefix="" host_cc="cc" -libs_softmmu="" cc_i386=i386-pc-linux-gnu-gcc debug_info="yes" stack_protector="" @@ -996,11 +995,6 @@ elif compile_prog "" "$pthread_lib -lrt" ; then LIBS="$LIBS -lrt" fi -if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \ - "$aix" != "yes" -a "$haiku" != "yes" ; then - libs_softmmu="-lutil $libs_softmmu" -fi - ######################################## # check if we have valgrind/valgrind.h @@ -1113,7 +1107,6 @@ echo >> $config_host_mak echo all: >> $config_host_mak echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak -echo "libs_softmmu=$libs_softmmu" >> $config_host_mak echo "ARCH=$ARCH" >> $config_host_mak From 709d0819722abec2f34786c131d92b5d2093dc1e Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Tue, 28 Apr 2020 02:38:51 +0800 Subject: [PATCH 5/5] more qemu/Makefile* cleanup --- qemu/Makefile | 5 +---- qemu/Makefile.target | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/qemu/Makefile b/qemu/Makefile index 8e205951..cfae599e 100644 --- a/qemu/Makefile +++ b/qemu/Makefile @@ -99,10 +99,7 @@ ifneq ($(wildcard config-host.mak),) include $(SRC_PATH)/Makefile.objs endif -dummy := $(call unnest-vars,, \ - util-obj-y \ - common-obj-y \ - common-obj-m) +dummy := $(call unnest-vars,,util-obj-y common-obj-y) all: $(HELPERS-y) recurse-all modules diff --git a/qemu/Makefile.target b/qemu/Makefile.target index 843aa6c6..356ce1c1 100644 --- a/qemu/Makefile.target +++ b/qemu/Makefile.target @@ -52,7 +52,7 @@ dummy := $(call unnest-vars,..,util-obj-y) target-obj-y-save := $(target-obj-y) $(util-obj-y) -dummy := $(call unnest-vars,..,common-obj-y,common-obj-m) +dummy := $(call unnest-vars,..,common-obj-y) target-obj-y := $(target-obj-y-save) all-obj-y += $(common-obj-y)