From 741dc13597ac064e6a48bb2a6ec069cbc1cd0dbb Mon Sep 17 00:00:00 2001 From: Bhanu Chetlapalli Date: Tue, 8 May 2012 17:16:03 -0700 Subject: [MIPS] Add Goldfish target support Basic Goldfish support for MIPS. Also, Fix host CPU consumption when guest is idle When the CPU is in wait state, do not wake-up if an interrupt can't be taken. This avoid host CPU running at 100% if a device (e.g. timer) has an interrupt line left enabled. Also factorize code to check if interrupts are enabled in cpu_mips_hw_interrupts_pending(). CPU consumption based on a patch from Edgar E. Iglesias Change-Id: Ie8371c8d0c9af1e0c8ba4cac419979350de0f5d9 Signed-off-by: yajin Signed-off-by: Douglas Leung Signed-off-by: Bhanu Chetlapalli Signed-off-by: Chris Dearman --- Makefile.target | 60 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 13 deletions(-) (limited to 'Makefile.target') diff --git a/Makefile.target b/Makefile.target index 5b4ec5f..608761c 100644 --- a/Makefile.target +++ b/Makefile.target @@ -1,6 +1,6 @@ # This file is included several times to build target-specific # modules for the Android emulator. It will be called several times -# (e.g. once for the arm target, and once for the x86 target). +# for arm, x86 and mips # ifndef EMULATOR_TARGET_ARCH @@ -26,7 +26,7 @@ EMULATOR_TARGET_CFLAGS := \ -I$(LOCAL_PATH)/android/config/target-$(EMULATOR_TARGET_ARCH) \ -I$(LOCAL_PATH)/target-$(EMULATOR_TARGET_CPU) \ -I$(LOCAL_PATH)/fpu \ - -DNEED_CPU_H \ + -DNEED_CPU_H TCG_TARGET := $(HOST_ARCH) ifeq ($(HOST_ARCH),x86) @@ -96,7 +96,7 @@ HW_SOURCES += android_arm.c \ goldfish_switch.c \ goldfish_timer.c \ goldfish_trace.c \ - arm_boot.c \ + arm_boot.c # The following sources must be compiled with the final executables # because they contain device_init() or machine_init() statements. @@ -135,6 +135,31 @@ HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) endif +ifeq ($(EMULATOR_TARGET_ARCH),mips) +HW_SOURCES += \ + android_mips.c \ + mips_pic.c \ + goldfish_interrupt.c \ + goldfish_switch.c \ + goldfish_timer.c \ + goldfish_trace.c \ + mips_timer.c \ + mips_int.c + +# The following sources must be compiled with the final executables +# because they contain device_init() or machine_init() statements. +HW_OBJ_SOURCES := hw/smc91c111.c +HW_OBJ_CFLAGS := $(EMULATOR_TARGET_CFLAGS) + +common_LOCAL_SRC_FILES += mips-dis.c + +# smc91c111.c requires +LOCAL_CFLAGS += $(ZLIB_CFLAGS) +ifeq ($(ARCH_HAS_BIGENDIAN),true) + LOCAL_CFLAGS += -DTARGET_WORDS_BIGENDIAN +endif + +endif common_LOCAL_SRC_FILES += $(HW_SOURCES:%=hw/%) common_LOCAL_SRC_FILES += \ @@ -143,7 +168,7 @@ common_LOCAL_SRC_FILES += \ translate-all.c \ trace.c \ varint.c \ - softmmu_outside_jit.c \ + softmmu_outside_jit.c ############################################################################## # CPU-specific emulation. @@ -165,7 +190,7 @@ common_LOCAL_SRC_FILES += \ target-arm/machine.c \ hw/armv7m.c \ hw/armv7m_nvic.c \ - arm-semi.c \ + arm-semi.c common_LOCAL_SRC_FILES += fpu/softfloat.c endif @@ -192,6 +217,16 @@ endif common_LOCAL_SRC_FILES += fpu/softfloat-native.c endif +ifeq ($(EMULATOR_TARGET_ARCH), mips) +common_LOCAL_SRC_FILES += \ + target-mips/op_helper.c \ + target-mips/helper.c \ + target-mips/translate.c \ + target-mips/machine.c + +common_LOCAL_SRC_FILES += fpu/softfloat.c +endif + # compile KVM only if target is x86 on x86 Linux QEMU_KVM_TAG := $(QEMU_HOST_TAG)-$(EMULATOR_TARGET_ARCH) QEMU_DO_KVM := $(if $(filter linux-x86-x86 linux-x86_64-x86,$(QEMU_KVM_TAG)),true,false) @@ -220,7 +255,7 @@ MCHK_SOURCES := \ memcheck_proc_management.c \ memcheck_malloc_map.c \ memcheck_mmrange_map.c \ - memcheck_util.c \ + memcheck_util.c common_LOCAL_SRC_FILES += $(MCHK_SOURCES:%=memcheck/%) @@ -272,7 +307,7 @@ LOCAL_CFLAGS += \ $(ELFF_CFLAGS) \ $(EMULATOR_LIBQEMU_CFLAGS) \ $(EMULATOR_TARGET_CFLAGS) \ - -DCONFIG_STANDALONE_CORE \ + -DCONFIG_STANDALONE_CORE ifneq ($(QEMU_OPENGLES_INCLUDE),) LOCAL_CFLAGS += -I$(QEMU_OPENGLES_INCLUDE) @@ -284,13 +319,12 @@ LOCAL_STATIC_LIBRARIES := \ emulator-libqemu \ emulator-target-$(EMULATOR_TARGET_CPU) \ emulator-libelff \ - emulator-common \ - + emulator-common LOCAL_LDLIBS += \ $(EMULATOR_COMMON_LDLIBS) \ $(EMULATOR_LIBQEMU_LDLIBS) \ - $(ELFF_LDLIBS) \ + $(ELFF_LDLIBS) LOCAL_SRC_FILES := \ audio/audio.c \ @@ -312,7 +346,7 @@ LOCAL_SRC_FILES := \ android/protocol/user-events-impl.c \ android/protocol/ui-commands-proxy.c \ android/protocol/core-commands-impl.c \ - android/protocol/core-commands-qemu.c \ + android/protocol/core-commands-qemu.c $(call gen-hx-header,qemu-monitor.hx,qemu-monitor.h,monitor.c) $(call gen-hx-header,qemu-options.hx,qemu-options.def,vl-android.c qemu-options.h) @@ -360,13 +394,13 @@ common_LOCAL_STATIC_LIBRARIES := \ emulator-libqemu \ emulator-target-$(EMULATOR_TARGET_CPU) \ emulator-libelff \ - emulator-common \ + emulator-common common_LOCAL_LDLIBS += \ $(EMULATOR_COMMON_LDLIBS) \ $(EMULATOR_LIBQEMU_LDLIBS) \ $(EMULATOR_LIBUI_LDLIBS) \ - $(ELFF_LDLIBS) \ + $(ELFF_LDLIBS) common_LOCAL_CFLAGS += \ $(EMULATOR_TARGET_CFLAGS) \ -- cgit v1.1