Merge branch 'master' of github.com:unicorn-engine/unicorn

This commit is contained in:
Nguyen Anh Quynh
2020-04-28 08:58:41 +08:00
5 changed files with 15 additions and 63 deletions

View File

@@ -46,8 +46,6 @@ configure: ;
$(call set-vpath, $(SRC_PATH)) $(call set-vpath, $(SRC_PATH))
LIBS+=-lz $(LIBS_TOOLS)
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR) SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS)) SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS)) SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
@@ -92,12 +90,7 @@ ifneq ($(wildcard config-host.mak),)
include $(SRC_PATH)/Makefile.objs include $(SRC_PATH)/Makefile.objs
endif endif
dummy := $(call unnest-vars,, \ dummy := $(call unnest-vars,,util-obj-y common-obj-y)
util-obj-y \
block-obj-y \
block-obj-m \
common-obj-y \
common-obj-m)
all: $(HELPERS-y) recurse-all modules all: $(HELPERS-y) recurse-all modules
@@ -107,7 +100,6 @@ config-host.h-timestamp: config-host.mak
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS)) SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES)) SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
$(SOFTMMU_SUBDIR_RULES): $(block-obj-y)
$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak $(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
subdir-%: subdir-%:

View File

@@ -2,25 +2,10 @@
# Common libraries for tools and emulators # Common libraries for tools and emulators
util-obj-y = util/ qobject/ qapi/ qapi-types.o qapi-visit.o 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 += hw/
common-obj-y += accel.o common-obj-y += accel.o
common-obj-y += vl.o qemu-timer.o common-obj-y += vl.o qemu-timer.o
endif common-obj-y += ../uc.o ../list.o glib_compat.o
#######################################################################
# Target-independent parts used in system and user emulation
common-obj-y += qemu-log.o common-obj-y += qemu-log.o
common-obj-y += tcg-runtime.o common-obj-y += tcg-runtime.o
common-obj-y += hw/ common-obj-y += hw/

View File

@@ -12,20 +12,11 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/include
# system emulator name # system emulator name
QEMU_PROG=qemu-system-$(TARGET_NAME)$(EXESUF) 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: config-target.h-timestamp
config-target.h-timestamp: config-target.mak config-target.h-timestamp: config-target.mak
all: $(PROGS) all: $(QEMU_PROG)
######################################################### #########################################################
# cpu emulator library # cpu emulator library
@@ -36,12 +27,10 @@ obj-y += target-$(TARGET_BASE_ARCH)/
######################################################### #########################################################
# System emulator target # System emulator target
ifdef CONFIG_SOFTMMU
obj-y += cpus.o ioport.o obj-y += cpus.o ioport.o
obj-y += hw/ obj-y += hw/
obj-y += memory.o cputlb.o obj-y += memory.o cputlb.o
obj-y += memory_mapping.o obj-y += memory_mapping.o
LIBS+=$(libs_softmmu)
# Hardware support # Hardware support
ifeq ($(TARGET_NAME), sparc64) ifeq ($(TARGET_NAME), sparc64)
@@ -50,8 +39,6 @@ else
obj-y += hw/$(TARGET_BASE_ARCH)/ obj-y += hw/$(TARGET_BASE_ARCH)/
endif endif
endif # CONFIG_SOFTMMU
# Workaround for http://gcc.gnu.org/PR55489, see configure. # Workaround for http://gcc.gnu.org/PR55489, see configure.
%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) %/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS)
@@ -65,7 +52,7 @@ dummy := $(call unnest-vars,..,util-obj-y)
target-obj-y-save := $(target-obj-y) $(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) target-obj-y := $(target-obj-y-save)
all-obj-y += $(common-obj-y) all-obj-y += $(common-obj-y)
@@ -86,10 +73,10 @@ endif
endif endif
# build either PROG or PROGW # build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) $(QEMU_PROG): $(all-obj-y)
clean: clean:
rm -f *.a *~ $(PROGS) rm -f *.a *~ $(QEMU_PROG)
rm -f $(shell find . -name '*.[od]') rm -f $(shell find . -name '*.[od]')
GENERATED_HEADERS += config-target.h GENERATED_HEADERS += config-target.h

12
qemu/configure vendored
View File

@@ -139,7 +139,6 @@ cpu=""
static="no" static="no"
cross_prefix="" cross_prefix=""
host_cc="cc" host_cc="cc"
libs_softmmu=""
cc_i386=i386-pc-linux-gnu-gcc cc_i386=i386-pc-linux-gnu-gcc
debug_info="yes" debug_info="yes"
stack_protector="" stack_protector=""
@@ -996,11 +995,6 @@ elif compile_prog "" "$pthread_lib -lrt" ; then
LIBS="$LIBS -lrt" LIBS="$LIBS -lrt"
fi 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 # check if we have valgrind/valgrind.h
@@ -1113,7 +1107,6 @@ echo >> $config_host_mak
echo all: >> $config_host_mak echo all: >> $config_host_mak
echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
echo "extra_ldflags=$EXTRA_LDFLAGS" >> $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 echo "ARCH=$ARCH" >> $config_host_mak
@@ -1216,11 +1209,6 @@ echo "CFLAGS=$CFLAGS" >> $config_host_mak
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $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=$LDFLAGS" >> $config_host_mak
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak

View File

@@ -122,6 +122,15 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
ret = cpu->exception_index; ret = cpu->exception_index;
break; break;
#else #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)) { if (uc->stop_interrupt && uc->stop_interrupt(cpu->exception_index)) {
// Unicorn: call registered invalid instruction callbacks // Unicorn: call registered invalid instruction callbacks
HOOK_FOREACH_VAR_DECLARE; HOOK_FOREACH_VAR_DECLARE;
@@ -151,15 +160,6 @@ int cpu_exec(struct uc_struct *uc, CPUArchState *env) // qq
} }
cpu->exception_index = -1; 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 #endif
} }
} }