兴趣是坚持一件事永不衰竭的动力
分类: Android平台
2015-09-13 22:33:59
project bionic/ diff --git a/libc/Android.mk b/libc/Android.mk index faca333..e471a93 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -206,13 +206,9 @@ libc_common_src_files := \ arch-arm/bionic/_setjmp.S \ arch-arm/bionic/atomics_arm.S \ arch-arm/bionic/clone.S \ - arch-arm/bionic/memcmp.S \ - arch-arm/bionic/memcmp16.S \ - arch-arm/bionic/memcpy.S \ arch-arm/bionic/memset.S \ arch-arm/bionic/setjmp.S \ arch-arm/bionic/sigsetjmp.S \ - arch-arm/bionic/strlen.c.arm \ arch-arm/bionic/syscall.S \ arch-arm/bionic/kill.S \ arch-arm/bionic/tkill.S \ @@ -274,6 +270,18 @@ libc_common_src_files := \ netbsd/nameser/ns_print.c \ netbsd/nameser/ns_samedomain.c + +ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) +libc_common_src_files += arch-arm/bionic/memcmp.S \ + arch-arm/bionic/memcmp16.S \ + arch-arm/bionic/memcpy.S \ + arch-arm/bionic/strlen.c.arm +else +libc_common_src_files += string/memcmp.c string/memcpy.c string/strlen.c string/ffs.c +endif +endif + # These files need to be arm so that gdbserver # can set breakpoints in them without messing # up any thumb code. diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c index 4cd4a80..dea78b2 100644 --- a/libc/string/memcpy.c +++ b/libc/string/memcpy.c @@ -25,5 +25,5 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#define MEM_COPY +#define MEMCOPY #include "bcopy.c" project build/ diff --git a/core/combo/linux-arm.mk b/core/combo/linux-arm.mk index adb82d3..a43368f 100644 --- a/core/combo/linux-arm.mk +++ b/core/combo/linux-arm.mk @@ -7,6 +7,8 @@ $(combo_target)TOOLS_PREFIX := \ prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi- endif +TARGET_ARCH_VERSION ?= armv5te + $(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX) $(combo_target)CXX := $($(combo_target)TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX) $(combo_target)AR := $($(combo_target)TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX) @@ -46,6 +48,7 @@ ifneq ($(wildcard $($(combo_target)CC)),) $(combo_target)LIBGCC := $(shell $($(combo_target)CC) -mthumb-interwork -print-libgcc-file-name) endif +ifeq ($(TARGET_ARCH_VERSION), armv5te) $(combo_target)GLOBAL_CFLAGS += \ -march=armv5te -mtune=xscale \ -msoft-float -fpic \ @@ -56,6 +59,21 @@ $(combo_target)GLOBAL_CFLAGS += \ -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ \ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ \ -include $(call select-android-config-h,linux-arm) +else +ifeq ($(TARGET_ARCH_VERSION), armv4t) +$(combo_target)GLOBAL_CFLAGS += \ + -march=armv4t \ + -msoft-float -fpic \ + -mthumb-interwork \ + -ffunction-sections \ + -funwind-tables \ + -fstack-protector \ + -D__ARM_ARCH_4__ -D__ARM_ARCH_4T__ \ + -include $(call select-android-config-h,linux-arm) +else +$(error Unknown TARGET_ARCH_VERSION=$(TARGET_ARCH_VERSION)) +endif +endif $(combo_target)GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map index d4ebf43..6e0bc43 100644 --- a/core/prelink-linux-arm.map +++ b/core/prelink-linux-arm.map @@ -113,3 +113,4 @@ libctest.so 0x9A700000 libUAPI_jni.so 0x9A500000 librpc.so 0x9A400000 libtrace_test.so 0x9A300000 +libffi.so 0x9A200000 project dalvik/ diff --git a/vm/Android.mk b/vm/Android.mk index dfed78d..c66a861 100644 --- a/vm/Android.mk +++ b/vm/Android.mk @@ -189,6 +189,7 @@ ifeq ($(TARGET_SIMULATOR),true) endif ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) # use custom version rather than FFI #LOCAL_SRC_FILES += arch/arm/CallC.c LOCAL_SRC_FILES += arch/arm/CallOldABI.S arch/arm/CallEABI.S @@ -204,6 +205,16 @@ else mterp/out/InterpC-desktop.c \ mterp/out/InterpAsm-desktop.S LOCAL_SHARED_LIBRARIES += libffi + LOCAL_SHARED_LIBRARIES += libdl +endif +else + # use FFI + LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH) + LOCAL_SRC_FILES += arch/generic/Call.c + LOCAL_SRC_FILES += \ + mterp/out/InterpC-desktop.c \ + mterp/out/InterpAsm-desktop.S + LOCAL_SHARED_LIBRARIES += libffi endif LOCAL_MODULE := libdvm project external/jpeg/ diff --git a/Android.mk b/Android.mk index 9cfe4f6..3c052cd 100644 --- a/Android.mk +++ b/Android.mk @@ -19,6 +19,12 @@ ifneq ($(TARGET_ARCH),arm) ANDROID_JPEG_NO_ASSEMBLER := true endif +# the assembler doesn't work for armv4t +ifeq ($(TARGET_ARCH_VERSION),armv4t) +ANDROID_JPEG_NO_ASSEMBLER := true +endif + + # temp fix until we understand why this broke cnn.com #ANDROID_JPEG_NO_ASSEMBLER := true @@ -29,7 +35,10 @@ LOCAL_SRC_FILES += jidctint.c jidctfst.S endif LOCAL_CFLAGS += -DAVOID_TABLES -LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays +LOCAL_CFLAGS += -O3 -fstrict-aliasing +ifeq ($(TARGET_ARCH_VERSION),armv5te) +LOCAL_FLAGS += -fprefetch-loop-arrays +endif #LOCAL_CFLAGS += -march=armv6j LOCAL_MODULE:= libjpeg project external/libffi/ diff --git a/Android.mk b/Android.mk index f4452c9..07b5c2f 100644 --- a/Android.mk +++ b/Android.mk @@ -6,7 +6,7 @@ # We need to generate the appropriate defines and select the right set of # source files for the OS and architecture. -ifneq ($(TARGET_ARCH),arm) +ifneq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) project external/opencore/ diff --git a/codecs_v2/audio/aac/dec/Android.mk b/codecs_v2/audio/aac/dec/Android.mk index ffe0089..6abdc2d 100644 --- a/codecs_v2/audio/aac/dec/Android.mk +++ b/codecs_v2/audio/aac/dec/Android.mk @@ -150,7 +150,7 @@ LOCAL_SRC_FILES := \ LOCAL_MODULE := libpv_aac_dec LOCAL_CFLAGS := -DAAC_PLUS -DHQ_SBR -DPARAMETRICSTEREO $(PV_CFLAGS) -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_CFLAGS += -D_ARM_GCC else LOCAL_CFLAGS += -DC_EQUIVALENT diff --git a/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk b/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk index e184178..3223841 100644 --- a/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk +++ b/codecs_v2/audio/gsm_amr/amr_wb/dec/Android.mk @@ -48,7 +48,7 @@ LOCAL_SRC_FILES := \ LOCAL_MODULE := libpvamrwbdecoder LOCAL_CFLAGS := $(PV_CFLAGS) -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_CFLAGS += -D_ARM_GCC else LOCAL_CFLAGS += -DC_EQUIVALENT diff --git a/codecs_v2/audio/mp3/dec/Android.mk b/codecs_v2/audio/mp3/dec/Android.mk index 254cb6b..c2430fe 100644 --- a/codecs_v2/audio/mp3/dec/Android.mk +++ b/codecs_v2/audio/mp3/dec/Android.mk @@ -28,8 +28,8 @@ LOCAL_SRC_FILES := \ src/pvmp3_seek_synch.cpp \ src/pvmp3_stereo_proc.cpp \ src/pvmp3_reorder.cpp - -ifeq ($(TARGET_ARCH),arm) + +ifeq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_SRC_FILES += \ src/asm/pvmp3_polyphase_filter_window_gcc.s \ src/asm/pvmp3_mdct_18_gcc.s \ @@ -46,7 +46,7 @@ endif LOCAL_MODULE := libpvmp3 LOCAL_CFLAGS := $(PV_CFLAGS) -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) LOCAL_CFLAGS += -DPV_ARM_GCC else LOCAL_CFLAGS += -DC_EQUIVALENT diff --git a/codecs_v2/video/m4v_h263/enc/src/dct_inline.h b/codecs_v2/video/m4v_h263/enc/src/dct_inline.h index 86474b2..41a3297 100644 --- a/codecs_v2/video/m4v_h263/enc/src/dct_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/dct_inline.h @@ -22,7 +22,7 @@ #ifndef _DCT_INLINE_H_ #define _DCT_INLINE_H_ -#if !defined(PV_ARM_GCC)&& defined(__arm__) +#if !(defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_5TE__)) #include "oscl_base_macros.h" @@ -109,7 +109,7 @@ __inline int32 sum_abs(int32 k0, int32 k1, int32 k2, int32 k3, #elif defined(__CC_ARM) /* only work with arm v5 */ #if defined(__TARGET_ARCH_5TE) - +#error __inline int32 mla724(int32 op1, int32 op2, int32 op3) { int32 out; @@ -266,7 +266,7 @@ __inline int32 sum_abs(int32 k0, int32 k1, int32 k2, int32 k3, return abs_sum; } -#elif defined(PV_ARM_GCC) && defined(__arm__) /* ARM GNU COMPILER */ +#elif defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_5TE__) /* ARM GNU COMPILER */ __inline int32 mla724(int32 op1, int32 op2, int32 op3) { diff --git a/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h b/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h index 6a35d43..fbfeddf 100644 --- a/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h @@ -25,7 +25,7 @@ #include "mp4def.h" #include "oscl_base_macros.h" -#if !defined(PV_ARM_GCC) && defined(__arm__) /* ARM GNU COMPILER */ +#if !(defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_V5TE__)) /* ARM GNU COMPILER */ __inline int32 aan_scale(int32 q_value, int32 coeff, int32 round, int32 QPdiv2) { @@ -423,7 +423,7 @@ __inline int32 coeff_dequant_mpeg_intra(int32 q_value, int32 tmp) return q_value; } -#elif defined(PV_ARM_GCC) && defined(__arm__) /* ARM GNU COMPILER */ +#elif defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_V5TE__) /* ARM GNU COMPILER */ __inline int32 aan_scale(int32 q_value, int32 coeff, int32 round, int32 QPdiv2) diff --git a/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h b/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h index 69857f3..b0bf46d 100644 --- a/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h +++ b/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h @@ -18,7 +18,7 @@ #ifndef _VLC_ENCODE_INLINE_H_ #define _VLC_ENCODE_INLINE_H_ -#if !defined(PV_ARM_GCC)&& defined(__arm__) +#if !(defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_V5TE__)) __inline Int zero_run_search(UInt *bitmapzz, Short *dataBlock, RunLevelBlock *RLB, Int nc) { @@ -208,7 +208,7 @@ __inline Int zero_run_search(UInt *bitmapzz, Short *dataBlock, RunLevelBlock *R return idx; } -#elif defined(PV_ARM_GCC) && defined(__arm__) /* ARM GNU COMPILER */ +#elif defined(PV_ARM_GCC) && defined(__arm__) && defined(__ARCH_ARM_V5TE__) /* ARM GNU COMPILER */ __inline Int m4v_enc_clz(UInt temp) { project external/skia/ diff --git a/include/corecg/SkMath.h b/include/corecg/SkMath.h index 76cf279..5f0264f 100644 --- a/include/corecg/SkMath.h +++ b/include/corecg/SkMath.h @@ -162,7 +162,7 @@ static inline int SkNextLog2(uint32_t value) { With this requirement, we can generate faster instructions on some architectures. */ -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARM_ARCH_5TE__) && !defined(__thumb__) static inline int32_t SkMulS16(S16CPU x, S16CPU y) { SkASSERT((int16_t)x == x); SkASSERT((int16_t)y == y); project external/sonivox/ diff --git a/arm-wt-22k/Android.mk b/arm-wt-22k/Android.mk index 565c233..fb96a5c 100644 --- a/arm-wt-22k/Android.mk +++ b/arm-wt-22k/Android.mk @@ -72,7 +72,7 @@ LOCAL_COPY_HEADERS := \ host_src/eas_types.h \ host_src/eas_reverb.h -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5) LOCAL_SRC_FILES+= \ lib_src/ARM-E_filter_gnu.s \ lib_src/ARM-E_interpolate_loop_gnu.s \ project frameworks/base/ diff --git a/libs/audioflinger/AudioMixer.cpp b/libs/audioflinger/AudioMixer.cpp index 9f1b17f..4c0890c 100644 --- a/libs/audioflinger/AudioMixer.cpp +++ b/libs/audioflinger/AudioMixer.cpp @@ -400,7 +400,7 @@ void AudioMixer::process__validate(state_t* state, void* output) static inline int32_t mulAdd(int16_t in, int16_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; asm( "smlabb %[out], %[in], %[v], %[a] \n" : [out]"=r"(out) @@ -415,7 +415,7 @@ int32_t mulAdd(int16_t in, int16_t v, int32_t a) static inline int32_t mul(int16_t in, int16_t v) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; asm( "smulbb %[out], %[in], %[v] \n" : [out]"=r"(out) @@ -430,7 +430,7 @@ int32_t mul(int16_t in, int16_t v) static inline int32_t mulAddRL(int left, uint32_t inRL, uint32_t vRL, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; if (left) { asm( "smlabb %[out], %[inRL], %[vRL], %[a] \n" @@ -456,7 +456,7 @@ int32_t mulAddRL(int left, uint32_t inRL, uint32_t vRL, int32_t a) static inline int32_t mulRL(int left, uint32_t inRL, uint32_t vRL) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; if (left) { asm( "smulbb %[out], %[inRL], %[vRL] \n" diff --git a/libs/audioflinger/AudioResamplerSinc.cpp b/libs/audioflinger/AudioResamplerSinc.cpp index e710d16..88b8c22 100644 --- a/libs/audioflinger/AudioResamplerSinc.cpp +++ b/libs/audioflinger/AudioResamplerSinc.cpp @@ -62,7 +62,7 @@ const int32_t AudioResamplerSinc::mFirCoefsDown[] = { static inline int32_t mulRL(int left, int32_t in, uint32_t vRL) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; if (left) { asm( "smultb %[out], %[in], %[vRL] \n" @@ -88,7 +88,7 @@ int32_t mulRL(int left, int32_t in, uint32_t vRL) static inline int32_t mulAdd(int16_t in, int32_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; asm( "smlawb %[out], %[v], %[in], %[a] \n" : [out]"=r"(out) @@ -103,7 +103,7 @@ int32_t mulAdd(int16_t in, int32_t v, int32_t a) static inline int32_t mulAddRL(int left, uint32_t inRL, int32_t v, int32_t a) { -#if defined(__arm__) && !defined(__thumb__) +#if defined(__arm__) && defined(__ARCH_ARM_5TE__) && !defined(__thumb__) int32_t out; if (left) { asm( "smlawb %[out], %[v], %[inRL], %[a] \n" project system/core/ diff --git a/include/arch/linux-arm/AndroidConfig.h b/include/arch/linux-arm/AndroidConfig.h index d7e182a..76f424e 100644 --- a/include/arch/linux-arm/AndroidConfig.h +++ b/include/arch/linux-arm/AndroidConfig.h @@ -249,8 +249,9 @@ /* * Do we have __memcmp16()? */ +#if defined(__ARCH_ARM_5TE__) #define HAVE__MEMCMP16 1 - +#endif /* * type for the third argument to mincore(). */ diff --git a/libpixelflinger/Android.mk b/libpixelflinger/Android.mk index a8e5ee4..077cf47 100644 --- a/libpixelflinger/Android.mk +++ b/libpixelflinger/Android.mk @@ -5,7 +5,7 @@ include $(CLEAR_VARS) # ARMv6 specific objects # -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv6) LOCAL_ASFLAGS := -march=armv6 LOCAL_SRC_FILES := rotate90CW_4x4_16v6.S LOCAL_MODULE := libpixelflinger_armv6 @@ -39,7 +39,7 @@ PIXELFLINGER_SRC_FILES:= \ raster.cpp \ buffer.cpp -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv5te) PIXELFLINGER_SRC_FILES += t32cb16blend.S endif @@ -67,7 +67,7 @@ ifneq ($(BUILD_TINY_ANDROID),true) LOCAL_MODULE:= libpixelflinger LOCAL_SRC_FILES := $(PIXELFLINGER_SRC_FILES) LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) -DWITH_LIB_HARDWARE -ifeq ($(TARGET_ARCH),arm) +ifeq ($(TARGET_ARCH_VERSION),armv6) LOCAL_WHOLE_STATIC_LIBRARIES := libpixelflinger_armv6 endif include $(BUILD_SHARED_LIBRARY) diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index d24c988..685a3b7 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -1312,7 +1312,7 @@ void scanline_t32cb16blend(context_t* c) const int32_t v = (c->state.texture[0].shade.it0>>16) + y; uint32_t *src = reinterpret_cast<uint32_t*>(tex->data)+(u+(tex->stride*v)); -#if ((ANDROID_CODEGEN >= ANDROID_CODEGEN_ASM) && defined(__arm__)) +#if ((ANDROID_CODEGEN >= ANDROID_CODEGEN_ASM) && defined(__arm__) && defined(__ARCH_ARM_5TE__)) scanline_t32cb16blend_arm(dst, src, ct); #else while (ct--) { diff --git a/libc/string/ffs.c b/libc/string/ffs.c new file mode 100644 index 0000000..341a61e --- /dev/null +++ b/libc/string/ffs.c @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS OR CONTRIBUTORS 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 <stddef.h> +#include <strings.h> + +/* + * Find First Set bit + */ +int +ffs(int mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned int)mask >> 1; + return (bit); +}