merge intel x86 patches into gingerbread branch
This commit is contained in:
@@ -401,7 +401,7 @@ libc_common_src_files += \
|
|||||||
arch-x86/string/memset_wrapper.S \
|
arch-x86/string/memset_wrapper.S \
|
||||||
arch-x86/string/strcmp_wrapper.S \
|
arch-x86/string/strcmp_wrapper.S \
|
||||||
arch-x86/string/strncmp_wrapper.S \
|
arch-x86/string/strncmp_wrapper.S \
|
||||||
arch-x86/string/strlen.S \
|
arch-x86/string/strlen_wrapper.S \
|
||||||
bionic/pthread-rwlocks.c \
|
bionic/pthread-rwlocks.c \
|
||||||
bionic/pthread-timers.c \
|
bionic/pthread-timers.c \
|
||||||
bionic/ptrace.c
|
bionic/ptrace.c
|
||||||
@@ -516,6 +516,10 @@ endif
|
|||||||
#
|
#
|
||||||
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
|
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
|
||||||
|
|
||||||
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
|
libc_crt_target_cflags += -DCRT_LEGACY_WORKAROUND
|
||||||
|
endif
|
||||||
|
|
||||||
# Define some common includes
|
# Define some common includes
|
||||||
# ========================================================
|
# ========================================================
|
||||||
libc_common_c_includes := \
|
libc_common_c_includes := \
|
||||||
@@ -540,18 +544,24 @@ ifneq ($(filter arm x86,$(TARGET_ARCH)),)
|
|||||||
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
|
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
|
||||||
# static C++ destructors are properly called on dlclose().
|
# static C++ destructors are properly called on dlclose().
|
||||||
#
|
#
|
||||||
|
|
||||||
|
libc_crt_target_so_cflags := $(libc_crt_target_cflags)
|
||||||
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
|
# This flag must be added for x86 targets, but not for ARM
|
||||||
|
libc_crt_target_so_cflags += -fPIC
|
||||||
|
endif
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
|
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
|
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
|
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
|
||||||
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
|
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
|
$(TARGET_CC) $(libc_crt_target_so_cflags) -o $@ -c $<
|
||||||
ALL_GENERATED_SOURCES += $(GEN)
|
ALL_GENERATED_SOURCES += $(GEN)
|
||||||
endif # TARGET_ARCH == x86
|
endif # TARGET_ARCH == x86 || TARGET_ARCH == arm
|
||||||
|
|
||||||
|
|
||||||
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
|
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
|
||||||
@@ -587,6 +597,9 @@ include $(CLEAR_VARS)
|
|||||||
|
|
||||||
LOCAL_SRC_FILES := $(libc_common_src_files)
|
LOCAL_SRC_FILES := $(libc_common_src_files)
|
||||||
LOCAL_CFLAGS := $(libc_common_cflags)
|
LOCAL_CFLAGS := $(libc_common_cflags)
|
||||||
|
ifeq ($(TARGET_ARCH),arm)
|
||||||
|
LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
|
||||||
|
endif
|
||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
LOCAL_MODULE := libc_common
|
LOCAL_MODULE := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
@@ -703,6 +716,7 @@ LOCAL_MODULE:= libc_malloc_debug_leak
|
|||||||
LOCAL_SHARED_LIBRARIES := libc
|
LOCAL_SHARED_LIBRARIES := libc
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
||||||
# Don't prelink
|
# Don't prelink
|
||||||
LOCAL_PRELINK_MODULE := false
|
LOCAL_PRELINK_MODULE := false
|
||||||
# Don't install on release build
|
# Don't install on release build
|
||||||
|
69
libc/arch-arm/bionic/atexit.S
Normal file
69
libc/arch-arm/bionic/atexit.S
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CRT_LEGACY_WORKAROUND
|
||||||
|
.arch armv5te
|
||||||
|
.fpu softvfp
|
||||||
|
.eabi_attribute 20, 1
|
||||||
|
.eabi_attribute 21, 1
|
||||||
|
.eabi_attribute 23, 3
|
||||||
|
.eabi_attribute 24, 1
|
||||||
|
.eabi_attribute 25, 1
|
||||||
|
.eabi_attribute 26, 2
|
||||||
|
.eabi_attribute 30, 4
|
||||||
|
.eabi_attribute 18, 4
|
||||||
|
.code 16
|
||||||
|
.section .text.atexit,"ax",%progbits
|
||||||
|
.align 2
|
||||||
|
.global atexit
|
||||||
|
.hidden atexit
|
||||||
|
.code 16
|
||||||
|
.thumb_func
|
||||||
|
.type atexit, %function
|
||||||
|
atexit:
|
||||||
|
.fnstart
|
||||||
|
.LFB0:
|
||||||
|
.save {r4, lr}
|
||||||
|
push {r4, lr}
|
||||||
|
.LCFI0:
|
||||||
|
ldr r3, .L3
|
||||||
|
mov r1, #0
|
||||||
|
@ sp needed for prologue
|
||||||
|
.LPIC0:
|
||||||
|
add r3, pc
|
||||||
|
ldr r2, [r3]
|
||||||
|
bl __cxa_atexit
|
||||||
|
pop {r4, pc}
|
||||||
|
.L4:
|
||||||
|
.align 2
|
||||||
|
.L3:
|
||||||
|
.word __dso_handle-(.LPIC0+4)
|
||||||
|
.LFE0:
|
||||||
|
.fnend
|
||||||
|
.size atexit, .-atexit
|
||||||
|
#endif
|
@@ -85,3 +85,4 @@ __CTOR_LIST__:
|
|||||||
.long -1
|
.long -1
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
|
#include "atexit.S"
|
||||||
|
@@ -52,4 +52,10 @@ __FINI_ARRAY__:
|
|||||||
.long -1
|
.long -1
|
||||||
.long __on_dlclose
|
.long __on_dlclose
|
||||||
|
|
||||||
|
#ifdef CRT_LEGACY_WORKAROUND
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
|
#else
|
||||||
|
#include "__dso_handle_so.S"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "atexit.S"
|
||||||
|
@@ -86,3 +86,4 @@ __CTOR_LIST__:
|
|||||||
|
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
|
#include "atexit.S"
|
||||||
|
48
libc/arch-x86/bionic/__stack_chk_fail_local.S
Normal file
48
libc/arch-x86/bionic/__stack_chk_fail_local.S
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Contributed by: Intel Corporation
|
||||||
|
*/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.globl __stack_chk_fail_local
|
||||||
|
.hidden __stack_chk_fail_local
|
||||||
|
.type __stack_chk_fail_local, @function
|
||||||
|
|
||||||
|
__stack_chk_fail_local:
|
||||||
|
#ifdef __PIC__
|
||||||
|
pushl %ebx
|
||||||
|
call __x86.get_pc_thunk.bx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
|
call __stack_chk_fail@PLT
|
||||||
|
#else /* PIC */
|
||||||
|
jmp __stack_chk_fail
|
||||||
|
#endif /* not PIC */
|
||||||
|
|
||||||
|
.size __stack_chk_fail_local, .-__stack_chk_fail_local
|
66
libc/arch-x86/bionic/atexit.S
Normal file
66
libc/arch-x86/bionic/atexit.S
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.globl atexit
|
||||||
|
.hidden atexit
|
||||||
|
.type atexit, @function
|
||||||
|
atexit:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp, %ebp
|
||||||
|
pushl %ebx
|
||||||
|
call __x86.get_pc_thunk.bx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
|
subl $20, %esp
|
||||||
|
movl $0, 4(%esp)
|
||||||
|
movl __dso_handle@GOTOFF(%ebx), %eax
|
||||||
|
movl %eax, 8(%esp)
|
||||||
|
movl 8(%ebp), %eax
|
||||||
|
movl %eax, (%esp)
|
||||||
|
call __cxa_atexit@PLT
|
||||||
|
addl $20, %esp
|
||||||
|
popl %ebx
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
|
.size atexit, .-atexit
|
||||||
|
|
||||||
|
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
|
||||||
|
.globl __x86.get_pc_thunk.bx
|
||||||
|
.hidden __x86.get_pc_thunk.bx
|
||||||
|
.type __x86.get_pc_thunk.bx, @function
|
||||||
|
__x86.get_pc_thunk.bx:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
movl (%esp), %ebx
|
||||||
|
ret
|
@@ -73,100 +73,3 @@ __futex_syscall4:
|
|||||||
popl %esi
|
popl %esi
|
||||||
popl %ebx
|
popl %ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
/* int __atomic_cmpxchg(int old, int new, volatile int* addr) */
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl __atomic_cmpxchg
|
|
||||||
.type __atomic_cmpxchg, @function
|
|
||||||
.align 4
|
|
||||||
__atomic_cmpxchg:
|
|
||||||
mov 4(%esp), %eax /* old */
|
|
||||||
mov 8(%esp), %ecx /* new */
|
|
||||||
mov 12(%esp), %edx /* addr */
|
|
||||||
lock cmpxchg %ecx, (%edx)
|
|
||||||
jnz 1f
|
|
||||||
xor %eax, %eax
|
|
||||||
jmp 2f
|
|
||||||
1:
|
|
||||||
movl $1, %eax
|
|
||||||
2:
|
|
||||||
ret /* 0 == success, 1 == failure */
|
|
||||||
|
|
||||||
|
|
||||||
/* int __atomic_swap(int new, volatile int* addr) */
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl __atomic_swap
|
|
||||||
.type __atomic_swap, @function
|
|
||||||
.align 4
|
|
||||||
__atomic_swap:
|
|
||||||
mov 4(%esp), %ecx /* new */
|
|
||||||
mov 8(%esp), %edx /* addr */
|
|
||||||
lock xchg %ecx, (%edx)
|
|
||||||
mov %ecx, %eax
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* int __atomic_dec(volatile int* addr)
|
|
||||||
*
|
|
||||||
* My x86 asm is really rusty.. this is probably suboptimal
|
|
||||||
*/
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl __atomic_dec
|
|
||||||
.type __atomic_dec, @function
|
|
||||||
.align 4
|
|
||||||
__atomic_dec:
|
|
||||||
pushl %ebx
|
|
||||||
pushl %esi
|
|
||||||
movl 12(%esp), %ebx /* addr */
|
|
||||||
|
|
||||||
1:
|
|
||||||
movl (%ebx), %esi /* old = *addr */
|
|
||||||
movl %esi, %edx
|
|
||||||
subl $1, %edx /* new = old - 1 */
|
|
||||||
|
|
||||||
pushl %ebx
|
|
||||||
pushl %edx
|
|
||||||
pushl %esi
|
|
||||||
call __atomic_cmpxchg
|
|
||||||
addl $12, %esp
|
|
||||||
test %eax, %eax
|
|
||||||
jnz 1b
|
|
||||||
|
|
||||||
movl %esi, %eax /* return old */
|
|
||||||
popl %esi
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
.text
|
|
||||||
/* int __atomic_inc(volatile int* addr) */
|
|
||||||
.globl __atomic_inc
|
|
||||||
.type __atomic_inc, @function
|
|
||||||
.align 4
|
|
||||||
__atomic_inc:
|
|
||||||
pushl %ebx
|
|
||||||
pushl %esi
|
|
||||||
movl 12(%esp), %ebx /* addr */
|
|
||||||
|
|
||||||
1:
|
|
||||||
movl (%ebx), %esi /* old = *addr */
|
|
||||||
movl %esi, %edx
|
|
||||||
addl $1, %edx /* new = old + 1 */
|
|
||||||
|
|
||||||
pushl %ebx
|
|
||||||
pushl %edx
|
|
||||||
pushl %esi
|
|
||||||
call __atomic_cmpxchg
|
|
||||||
addl $12, %esp
|
|
||||||
test %eax, %eax
|
|
||||||
jnz 1b
|
|
||||||
|
|
||||||
movl %esi, %eax /* return old */
|
|
||||||
popl %esi
|
|
||||||
popl %ebx
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
@@ -20,8 +20,7 @@ __pthread_clone:
|
|||||||
movl %eax, -12(%ecx)
|
movl %eax, -12(%ecx)
|
||||||
movl 24(%esp), %eax
|
movl 24(%esp), %eax
|
||||||
movl %eax, -8(%ecx)
|
movl %eax, -8(%ecx)
|
||||||
lea (%ecx), %eax
|
movl %ecx, -4(%ecx)
|
||||||
movl %eax, -4(%ecx)
|
|
||||||
|
|
||||||
movl $__NR_clone, %eax
|
movl $__NR_clone, %eax
|
||||||
int $0x80
|
int $0x80
|
||||||
|
@@ -66,14 +66,7 @@ _start:
|
|||||||
1: .long __PREINIT_ARRAY__
|
1: .long __PREINIT_ARRAY__
|
||||||
.long __INIT_ARRAY__
|
.long __INIT_ARRAY__
|
||||||
.long __FINI_ARRAY__
|
.long __FINI_ARRAY__
|
||||||
.long __CTOR_LIST__
|
|
||||||
|
|
||||||
# the .ctors section contains a list of pointers to "constructor"
|
|
||||||
# functions that need to be called in order during C library initialization,
|
|
||||||
# just before the program is being run. This is a C++ requirement
|
|
||||||
#
|
|
||||||
# the last entry shall be 0, and is defined in crtend.S
|
|
||||||
#
|
|
||||||
.section .preinit_array, "aw"
|
.section .preinit_array, "aw"
|
||||||
.globl __PREINIT_ARRAY__
|
.globl __PREINIT_ARRAY__
|
||||||
__PREINIT_ARRAY__:
|
__PREINIT_ARRAY__:
|
||||||
@@ -83,15 +76,62 @@ __PREINIT_ARRAY__:
|
|||||||
.globl __INIT_ARRAY__
|
.globl __INIT_ARRAY__
|
||||||
__INIT_ARRAY__:
|
__INIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long frame_dummy
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.globl __FINI_ARRAY__
|
.globl __FINI_ARRAY__
|
||||||
__FINI_ARRAY__:
|
__FINI_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long __do_global_dtors_aux
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.section .eh_frame,"a",@progbits
|
||||||
.globl __CTOR_LIST__
|
.align 4
|
||||||
__CTOR_LIST__:
|
.type __EH_FRAME_BEGIN__, @object
|
||||||
.long -1
|
__EH_FRAME_BEGIN__:
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.type __do_global_dtors_aux, @function
|
||||||
|
__do_global_dtors_aux:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp, %ebp
|
||||||
|
subl $24, %esp
|
||||||
|
cmpb $0, completed.4454
|
||||||
|
jne .L4
|
||||||
|
movl $__deregister_frame_info_bases, %eax
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L3
|
||||||
|
movl $__EH_FRAME_BEGIN__, (%esp)
|
||||||
|
call __deregister_frame_info_bases
|
||||||
|
.L3:
|
||||||
|
movb $1, completed.4454
|
||||||
|
.L4:
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.type frame_dummy, @function
|
||||||
|
frame_dummy:
|
||||||
|
pushl %ebp
|
||||||
|
movl $__register_frame_info_bases, %eax
|
||||||
|
movl %esp, %ebp
|
||||||
|
subl $24, %esp
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L7
|
||||||
|
movl %ebx, 12(%esp)
|
||||||
|
movl $0, 8(%esp)
|
||||||
|
movl $object.4466, 4(%esp)
|
||||||
|
movl $__EH_FRAME_BEGIN__, (%esp)
|
||||||
|
call __register_frame_info_bases
|
||||||
|
.L7:
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
.local completed.4454
|
||||||
|
.comm completed.4454,1,1
|
||||||
|
.local object.4466
|
||||||
|
.comm object.4466,24,4
|
||||||
|
.weak __register_frame_info_bases
|
||||||
|
.weak __deregister_frame_info_bases
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
|
#include "atexit.S"
|
||||||
|
#include "__stack_chk_fail_local.S"
|
||||||
|
@@ -1,18 +1,30 @@
|
|||||||
# This function is to be called when the shared library
|
/*
|
||||||
# is unloaded through dlclose()
|
* Copyright (C) 2008 The Android Open Source Project
|
||||||
_on_dlclose:
|
* All rights reserved.
|
||||||
lea __dso_handle, %eax
|
*
|
||||||
call __cxa_finalize
|
* Redistribution and use in source and binary forms, with or without
|
||||||
ret
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
/* we put the _init() function here in case the user files for the shared
|
* * Redistributions of source code must retain the above copyright
|
||||||
* libs want to drop things into .init section.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* We then will call our ctors from crtend_so.o */
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
.section .init
|
* notice, this list of conditions and the following disclaimer in
|
||||||
.align 4
|
* the documentation and/or other materials provided with the
|
||||||
.type _init, @function
|
* distribution.
|
||||||
.globl _init
|
*
|
||||||
_init:
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
.align 4
|
.align 4
|
||||||
@@ -20,6 +32,7 @@ _init:
|
|||||||
.globl __INIT_ARRAY__
|
.globl __INIT_ARRAY__
|
||||||
__INIT_ARRAY__:
|
__INIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long frame_dummy
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.align 4
|
.align 4
|
||||||
@@ -27,13 +40,72 @@ __INIT_ARRAY__:
|
|||||||
.globl __FINI_ARRAY__
|
.globl __FINI_ARRAY__
|
||||||
__FINI_ARRAY__:
|
__FINI_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
.long _on_dlclose
|
.long __do_global_dtors_aux
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.section .eh_frame,"a",@progbits
|
||||||
.align 4
|
.align 4
|
||||||
.type __CTOR_LIST__, @object
|
.type __EH_FRAME_BEGIN__, @object
|
||||||
.globl __CTOR_LIST__
|
__EH_FRAME_BEGIN__:
|
||||||
__CTOR_LIST__:
|
.text
|
||||||
.long -1
|
.p2align 4,,15
|
||||||
|
.type __do_global_dtors_aux, @function
|
||||||
|
__do_global_dtors_aux:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp, %ebp
|
||||||
|
pushl %ebx
|
||||||
|
call __x86.get_pc_thunk.bx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
|
subl $20, %esp
|
||||||
|
cmpb $0, completed.4454@GOTOFF(%ebx)
|
||||||
|
jne .L5
|
||||||
|
movl __dso_handle@GOTOFF(%ebx), %eax
|
||||||
|
movl %eax, (%esp)
|
||||||
|
call __cxa_finalize@PLT
|
||||||
|
movl __deregister_frame_info_bases@GOT(%ebx), %eax
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L4
|
||||||
|
leal __EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
|
||||||
|
movl %eax, (%esp)
|
||||||
|
call __deregister_frame_info_bases@PLT
|
||||||
|
.L4:
|
||||||
|
movb $1, completed.4454@GOTOFF(%ebx)
|
||||||
|
.L5:
|
||||||
|
addl $20, %esp
|
||||||
|
popl %ebx
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.type frame_dummy, @function
|
||||||
|
frame_dummy:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp, %ebp
|
||||||
|
pushl %ebx
|
||||||
|
call __x86.get_pc_thunk.bx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
|
subl $20, %esp
|
||||||
|
movl __register_frame_info_bases@GOT(%ebx), %eax
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L8
|
||||||
|
leal object.4469@GOTOFF(%ebx), %eax
|
||||||
|
movl %eax, 4(%esp)
|
||||||
|
leal __EH_FRAME_BEGIN__@GOTOFF(%ebx), %eax
|
||||||
|
movl %ebx, 12(%esp)
|
||||||
|
movl $0, 8(%esp)
|
||||||
|
movl %eax, (%esp)
|
||||||
|
call __register_frame_info_bases@PLT
|
||||||
|
.L8:
|
||||||
|
addl $20, %esp
|
||||||
|
popl %ebx
|
||||||
|
popl %ebp
|
||||||
|
ret
|
||||||
|
.local completed.4454
|
||||||
|
.comm completed.4454,1,1
|
||||||
|
.local object.4469
|
||||||
|
.comm object.4469,24,4
|
||||||
|
.weak __register_frame_info_bases
|
||||||
|
.weak __deregister_frame_info_bases
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle_so.S"
|
||||||
|
#include "atexit.S"
|
||||||
|
#include "__stack_chk_fail_local.S"
|
||||||
|
@@ -65,7 +65,6 @@ _start:
|
|||||||
1: .long __PREINIT_ARRAY__
|
1: .long __PREINIT_ARRAY__
|
||||||
.long __INIT_ARRAY__
|
.long __INIT_ARRAY__
|
||||||
.long __FINI_ARRAY__
|
.long __FINI_ARRAY__
|
||||||
.long __CTOR_LIST__
|
|
||||||
|
|
||||||
.section .preinit_array, "aw"
|
.section .preinit_array, "aw"
|
||||||
.globl __PREINIT_ARRAY__
|
.globl __PREINIT_ARRAY__
|
||||||
@@ -76,15 +75,62 @@ __PREINIT_ARRAY__:
|
|||||||
.globl __INIT_ARRAY__
|
.globl __INIT_ARRAY__
|
||||||
__INIT_ARRAY__:
|
__INIT_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long frame_dummy
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.globl __FINI_ARRAY__
|
.globl __FINI_ARRAY__
|
||||||
__FINI_ARRAY__:
|
__FINI_ARRAY__:
|
||||||
.long -1
|
.long -1
|
||||||
|
.long __do_global_dtors_aux
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.section .eh_frame,"a",@progbits
|
||||||
.globl __CTOR_LIST__
|
.align 4
|
||||||
__CTOR_LIST__:
|
.type __EH_FRAME_BEGIN__, @object
|
||||||
.long -1
|
__EH_FRAME_BEGIN__:
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.type __do_global_dtors_aux, @function
|
||||||
|
__do_global_dtors_aux:
|
||||||
|
pushl %ebp
|
||||||
|
movl %esp, %ebp
|
||||||
|
subl $24, %esp
|
||||||
|
cmpb $0, completed.4454
|
||||||
|
jne .L4
|
||||||
|
movl $__deregister_frame_info_bases, %eax
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L3
|
||||||
|
movl $__EH_FRAME_BEGIN__, (%esp)
|
||||||
|
call __deregister_frame_info_bases
|
||||||
|
.L3:
|
||||||
|
movb $1, completed.4454
|
||||||
|
.L4:
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
.text
|
||||||
|
.p2align 4,,15
|
||||||
|
.type frame_dummy, @function
|
||||||
|
frame_dummy:
|
||||||
|
pushl %ebp
|
||||||
|
movl $__register_frame_info_bases, %eax
|
||||||
|
movl %esp, %ebp
|
||||||
|
subl $24, %esp
|
||||||
|
testl %eax, %eax
|
||||||
|
je .L7
|
||||||
|
movl %ebx, 12(%esp)
|
||||||
|
movl $0, 8(%esp)
|
||||||
|
movl $object.4466, 4(%esp)
|
||||||
|
movl $__EH_FRAME_BEGIN__, (%esp)
|
||||||
|
call __register_frame_info_bases
|
||||||
|
.L7:
|
||||||
|
leave
|
||||||
|
ret
|
||||||
|
.local completed.4454
|
||||||
|
.comm completed.4454,1,1
|
||||||
|
.local object.4466
|
||||||
|
.comm object.4466,24,4
|
||||||
|
.weak __register_frame_info_bases
|
||||||
|
.weak __deregister_frame_info_bases
|
||||||
|
|
||||||
#include "__dso_handle.S"
|
#include "__dso_handle.S"
|
||||||
|
#include "atexit.S"
|
||||||
|
#include "__stack_chk_fail_local.S"
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.section .preinit_array, "aw"
|
.section .preinit_array, "aw"
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
@@ -8,6 +7,9 @@
|
|||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
.section .ctors, "aw"
|
.section .eh_frame,"a",@progbits
|
||||||
.long 0
|
.align 4
|
||||||
|
.type __FRAME_END__, @object
|
||||||
|
.size __FRAME_END__, 4
|
||||||
|
__FRAME_END__:
|
||||||
|
.zero 4
|
||||||
|
@@ -1,47 +1,12 @@
|
|||||||
.text
|
|
||||||
.align 4
|
|
||||||
.type __bionic_call_ctors, @function
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The CTORS_LIST is marked by -1 (start) and 0 (end).
|
|
||||||
* We mark the end of the .ctors section with the __CTOR_END__ section so
|
|
||||||
* that we can just iterate backwards from it until we hit -1 and execute
|
|
||||||
* all the function pointers. This seems to be the way to do it for SVR4
|
|
||||||
* derived systems.
|
|
||||||
*/
|
|
||||||
__bionic_call_ctors:
|
|
||||||
pushl %esi
|
|
||||||
mov $__CTOR_END__, %esi
|
|
||||||
|
|
||||||
0:
|
|
||||||
/* now grab the next function pointer and check if its -1. If not,
|
|
||||||
* call it, otherwise we're done. We use %esi since it's callee saved.
|
|
||||||
*/
|
|
||||||
subl $4, %esi
|
|
||||||
mov (%esi), %eax
|
|
||||||
cmp $0xffffffff, %eax
|
|
||||||
je 1f
|
|
||||||
call *%eax
|
|
||||||
jmp 0b
|
|
||||||
|
|
||||||
1:
|
|
||||||
/* we're done */
|
|
||||||
popl %esi
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .init
|
|
||||||
.align 4
|
|
||||||
call __bionic_call_ctors
|
|
||||||
ret
|
|
||||||
|
|
||||||
.section .ctors, "aw", @progbits
|
|
||||||
.align 4
|
|
||||||
.type __CTOR_END__, @object
|
|
||||||
__CTOR_END__:
|
|
||||||
.long 0
|
|
||||||
|
|
||||||
.section .init_array, "aw"
|
.section .init_array, "aw"
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
.section .fini_array, "aw"
|
.section .fini_array, "aw"
|
||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
|
.section .eh_frame,"a",@progbits
|
||||||
|
.align 4
|
||||||
|
.type __FRAME_END__, @object
|
||||||
|
.size __FRAME_END__, 4
|
||||||
|
__FRAME_END__:
|
||||||
|
.zero 4
|
||||||
|
@@ -31,14 +31,14 @@
|
|||||||
|
|
||||||
#if defined(_KERNEL) && !defined(I386_CPU)
|
#if defined(_KERNEL) && !defined(I386_CPU)
|
||||||
#define __swap32md(x) ({ \
|
#define __swap32md(x) ({ \
|
||||||
u_int32_t __swap32md_x = (x); \
|
uint32_t __swap32md_x = (x); \
|
||||||
\
|
\
|
||||||
__asm ("bswap %1" : "+r" (__swap32md_x)); \
|
__asm ("bswap %1" : "+r" (__swap32md_x)); \
|
||||||
__swap32md_x; \
|
__swap32md_x; \
|
||||||
})
|
})
|
||||||
#else
|
#else
|
||||||
#define __swap32md(x) ({ \
|
#define __swap32md(x) ({ \
|
||||||
u_int32_t __swap32md_x = (x); \
|
uint32_t __swap32md_x = (x); \
|
||||||
\
|
\
|
||||||
__asm ("rorw $8, %w1; rorl $16, %1; rorw $8, %w1" : \
|
__asm ("rorw $8, %w1; rorl $16, %1; rorw $8, %w1" : \
|
||||||
"+r" (__swap32md_x)); \
|
"+r" (__swap32md_x)); \
|
||||||
@@ -47,13 +47,13 @@
|
|||||||
#endif /* _KERNEL && !I386_CPU */
|
#endif /* _KERNEL && !I386_CPU */
|
||||||
|
|
||||||
#define __swap64md(x) ({ \
|
#define __swap64md(x) ({ \
|
||||||
u_int64_t __swap64md_x = (x); \
|
uint64_t __swap64md_x = (x); \
|
||||||
\
|
\
|
||||||
(u_int64_t)__swap32md(__swap64md_x >> 32) | \
|
(uint64_t)__swap32md(__swap64md_x >> 32) | \
|
||||||
(u_int64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \
|
(uint64_t)__swap32md(__swap64md_x & 0xffffffff) << 32; \
|
||||||
})
|
})
|
||||||
#define __swap16md(x) ({ \
|
#define __swap16md(x) ({ \
|
||||||
u_int16_t __swap16md_x = (x); \
|
uint16_t __swap16md_x = (x); \
|
||||||
\
|
\
|
||||||
__asm ("rorw $8, %w1" : "+r" (__swap16md_x)); \
|
__asm ("rorw $8, %w1" : "+r" (__swap16md_x)); \
|
||||||
__swap16md_x; \
|
__swap16md_x; \
|
||||||
|
@@ -36,8 +36,8 @@
|
|||||||
#define _I386__TYPES_H_
|
#define _I386__TYPES_H_
|
||||||
|
|
||||||
/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
|
/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
|
||||||
#ifndef _SIZE_T
|
#ifndef _SIZE_T_DEFINED_
|
||||||
# define _SIZE_T
|
# define _SIZE_T_DEFINED_
|
||||||
# ifdef ANDROID
|
# ifdef ANDROID
|
||||||
typedef unsigned int size_t;
|
typedef unsigned int size_t;
|
||||||
# else
|
# else
|
||||||
@@ -54,9 +54,6 @@ typedef long int ssize_t;
|
|||||||
typedef long ptrdiff_t;
|
typedef long ptrdiff_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _OFF_T_DEFINED_
|
|
||||||
#define _SIZE_T_DEFINED_
|
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
/* 7.18.1.1 Exact-width integer types */
|
/* 7.18.1.1 Exact-width integer types */
|
||||||
|
65
libc/arch-x86/include/sys/atomics.h
Normal file
65
libc/arch-x86/include/sys/atomics.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
#ifndef _SYS_ATOMICS_H
|
||||||
|
#define _SYS_ATOMICS_H
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
static inline __attribute__((always_inline)) int
|
||||||
|
__atomic_cmpxchg(int old, int _new, volatile int *ptr)
|
||||||
|
{
|
||||||
|
return !__sync_bool_compare_and_swap (ptr, old, _new);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __attribute__((always_inline)) int
|
||||||
|
__atomic_swap(int _new, volatile int *ptr)
|
||||||
|
{
|
||||||
|
return __sync_lock_test_and_set(ptr, _new);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __attribute__((always_inline)) int
|
||||||
|
__atomic_dec(volatile int *ptr)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_sub (ptr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline __attribute__((always_inline)) int
|
||||||
|
__atomic_inc(volatile int *ptr)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_add (ptr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
|
||||||
|
int __futex_wake(volatile void *ftx, int count);
|
||||||
|
|
||||||
|
__END_DECLS
|
||||||
|
|
||||||
|
#endif /* _SYS_ATOMICS_H */
|
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#if defined(USE_SSSE3)
|
#if defined(USE_SSSE3)
|
||||||
|
|
||||||
# define MEMCMP memcmp
|
# define MEMCMP memcmp
|
||||||
# include "ssse3-memcmp3.S"
|
# include "ssse3-memcmp3-new.S"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_restore
|
#ifndef cfi_restore
|
||||||
# define cfi_restore(reg) .cfi_restore (reg)
|
# define cfi_restore(reg) .cfi_restore reg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_adjust_cfa_offset
|
#ifndef cfi_adjust_cfa_offset
|
||||||
@@ -285,7 +285,6 @@ L(32bytesormore):
|
|||||||
pxor %xmm0, %xmm0
|
pxor %xmm0, %xmm0
|
||||||
#else
|
#else
|
||||||
movd %eax, %xmm0
|
movd %eax, %xmm0
|
||||||
punpcklbw %xmm0, %xmm0
|
|
||||||
pshufd $0, %xmm0, %xmm0
|
pshufd $0, %xmm0, %xmm0
|
||||||
#endif
|
#endif
|
||||||
testl $0xf, %edx
|
testl $0xf, %edx
|
||||||
@@ -329,14 +328,17 @@ L(128bytesormore):
|
|||||||
|
|
||||||
#ifdef DATA_CACHE_SIZE
|
#ifdef DATA_CACHE_SIZE
|
||||||
POP (%ebx)
|
POP (%ebx)
|
||||||
|
# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
|
||||||
cmp $DATA_CACHE_SIZE, %ecx
|
cmp $DATA_CACHE_SIZE, %ecx
|
||||||
#else
|
#else
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
|
# define RESTORE_EBX_STATE
|
||||||
call __i686.get_pc_thunk.bx
|
call __i686.get_pc_thunk.bx
|
||||||
add $_GLOBAL_OFFSET_TABLE_, %ebx
|
add $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx
|
cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx
|
||||||
# else
|
# else
|
||||||
POP (%ebx)
|
POP (%ebx)
|
||||||
|
# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
|
||||||
cmp __x86_data_cache_size, %ecx
|
cmp __x86_data_cache_size, %ecx
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -370,7 +372,7 @@ L(128bytesormore_normal):
|
|||||||
jae L(128bytesormore_normal)
|
jae L(128bytesormore_normal)
|
||||||
|
|
||||||
L(128bytesless_normal):
|
L(128bytesless_normal):
|
||||||
lea 128(%ecx), %ecx
|
add $128, %ecx
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
|
BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
|
||||||
|
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
@@ -393,8 +395,13 @@ L(128bytes_L2_normal):
|
|||||||
L(128bytesless_L2_normal):
|
L(128bytesless_L2_normal):
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
|
BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))
|
||||||
|
|
||||||
|
RESTORE_EBX_STATE
|
||||||
L(128bytesormore_nt_start):
|
L(128bytesormore_nt_start):
|
||||||
sub %ebx, %ecx
|
sub %ebx, %ecx
|
||||||
|
mov %ebx, %eax
|
||||||
|
and $0x7f, %eax
|
||||||
|
add %eax, %ecx
|
||||||
|
movd %xmm0, %eax
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(128bytesormore_shared_cache_loop):
|
L(128bytesormore_shared_cache_loop):
|
||||||
prefetcht0 0x3c0(%edx)
|
prefetcht0 0x3c0(%edx)
|
||||||
|
369
libc/arch-x86/string/sse2-strlen-atom.S
Normal file
369
libc/arch-x86/string/sse2-strlen-atom.S
Normal file
@@ -0,0 +1,369 @@
|
|||||||
|
#define STRLEN sse2_strlen_atom
|
||||||
|
|
||||||
|
#ifndef L
|
||||||
|
# define L(label) .L##label
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_startproc
|
||||||
|
# define cfi_startproc .cfi_startproc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_endproc
|
||||||
|
# define cfi_endproc .cfi_endproc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_rel_offset
|
||||||
|
# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_restore
|
||||||
|
# define cfi_restore(reg) .cfi_restore reg
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_adjust_cfa_offset
|
||||||
|
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_remember_state
|
||||||
|
# define cfi_remember_state .cfi_remember_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_restore_state
|
||||||
|
# define cfi_restore_state .cfi_restore_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENTRY
|
||||||
|
# define ENTRY(name) \
|
||||||
|
.type name, @function; \
|
||||||
|
.globl name; \
|
||||||
|
.p2align 4; \
|
||||||
|
name: \
|
||||||
|
cfi_startproc
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef END
|
||||||
|
# define END(name) \
|
||||||
|
cfi_endproc; \
|
||||||
|
.size name, .-name
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CFI_PUSH(REG) \
|
||||||
|
cfi_adjust_cfa_offset (4); \
|
||||||
|
cfi_rel_offset (REG, 0)
|
||||||
|
|
||||||
|
#define CFI_POP(REG) \
|
||||||
|
cfi_adjust_cfa_offset (-4); \
|
||||||
|
cfi_restore (REG)
|
||||||
|
|
||||||
|
#define PUSH(REG) pushl REG; CFI_PUSH (REG)
|
||||||
|
#define POP(REG) popl REG; CFI_POP (REG)
|
||||||
|
#define PARMS 4
|
||||||
|
#define STR PARMS
|
||||||
|
#define ENTRANCE
|
||||||
|
#define RETURN ret
|
||||||
|
|
||||||
|
.text
|
||||||
|
ENTRY (STRLEN)
|
||||||
|
ENTRANCE
|
||||||
|
mov STR(%esp), %edx
|
||||||
|
xor %eax, %eax
|
||||||
|
cmpb $0, (%edx)
|
||||||
|
jz L(exit_tail0)
|
||||||
|
cmpb $0, 1(%edx)
|
||||||
|
jz L(exit_tail1)
|
||||||
|
cmpb $0, 2(%edx)
|
||||||
|
jz L(exit_tail2)
|
||||||
|
cmpb $0, 3(%edx)
|
||||||
|
jz L(exit_tail3)
|
||||||
|
cmpb $0, 4(%edx)
|
||||||
|
jz L(exit_tail4)
|
||||||
|
cmpb $0, 5(%edx)
|
||||||
|
jz L(exit_tail5)
|
||||||
|
cmpb $0, 6(%edx)
|
||||||
|
jz L(exit_tail6)
|
||||||
|
cmpb $0, 7(%edx)
|
||||||
|
jz L(exit_tail7)
|
||||||
|
cmpb $0, 8(%edx)
|
||||||
|
jz L(exit_tail8)
|
||||||
|
cmpb $0, 9(%edx)
|
||||||
|
jz L(exit_tail9)
|
||||||
|
cmpb $0, 10(%edx)
|
||||||
|
jz L(exit_tail10)
|
||||||
|
cmpb $0, 11(%edx)
|
||||||
|
jz L(exit_tail11)
|
||||||
|
cmpb $0, 12(%edx)
|
||||||
|
jz L(exit_tail12)
|
||||||
|
cmpb $0, 13(%edx)
|
||||||
|
jz L(exit_tail13)
|
||||||
|
cmpb $0, 14(%edx)
|
||||||
|
jz L(exit_tail14)
|
||||||
|
cmpb $0, 15(%edx)
|
||||||
|
jz L(exit_tail15)
|
||||||
|
pxor %xmm0, %xmm0
|
||||||
|
mov %edx, %eax
|
||||||
|
mov %edx, %ecx
|
||||||
|
and $-16, %eax
|
||||||
|
add $16, %ecx
|
||||||
|
add $16, %eax
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm0
|
||||||
|
pmovmskb %xmm0, %edx
|
||||||
|
pxor %xmm1, %xmm1
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm1
|
||||||
|
pmovmskb %xmm1, %edx
|
||||||
|
pxor %xmm2, %xmm2
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm2
|
||||||
|
pmovmskb %xmm2, %edx
|
||||||
|
pxor %xmm3, %xmm3
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm3
|
||||||
|
pmovmskb %xmm3, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm0
|
||||||
|
pmovmskb %xmm0, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm1
|
||||||
|
pmovmskb %xmm1, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm2
|
||||||
|
pmovmskb %xmm2, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm3
|
||||||
|
pmovmskb %xmm3, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm0
|
||||||
|
pmovmskb %xmm0, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm1
|
||||||
|
pmovmskb %xmm1, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm2
|
||||||
|
pmovmskb %xmm2, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm3
|
||||||
|
pmovmskb %xmm3, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm0
|
||||||
|
pmovmskb %xmm0, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm1
|
||||||
|
pmovmskb %xmm1, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm2
|
||||||
|
pmovmskb %xmm2, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
pcmpeqb (%eax), %xmm3
|
||||||
|
pmovmskb %xmm3, %edx
|
||||||
|
test %edx, %edx
|
||||||
|
lea 16(%eax), %eax
|
||||||
|
jnz L(exit)
|
||||||
|
|
||||||
|
and $-0x40, %eax
|
||||||
|
PUSH (%esi)
|
||||||
|
PUSH (%edi)
|
||||||
|
PUSH (%ebx)
|
||||||
|
PUSH (%ebp)
|
||||||
|
xor %ebp, %ebp
|
||||||
|
L(aligned_64):
|
||||||
|
pcmpeqb (%eax), %xmm0
|
||||||
|
pcmpeqb 16(%eax), %xmm1
|
||||||
|
pcmpeqb 32(%eax), %xmm2
|
||||||
|
pcmpeqb 48(%eax), %xmm3
|
||||||
|
pmovmskb %xmm0, %edx
|
||||||
|
pmovmskb %xmm1, %esi
|
||||||
|
pmovmskb %xmm2, %edi
|
||||||
|
pmovmskb %xmm3, %ebx
|
||||||
|
or %edx, %ebp
|
||||||
|
or %esi, %ebp
|
||||||
|
or %edi, %ebp
|
||||||
|
or %ebx, %ebp
|
||||||
|
lea 64(%eax), %eax
|
||||||
|
jz L(aligned_64)
|
||||||
|
L(48leave):
|
||||||
|
test %edx, %edx
|
||||||
|
jnz L(aligned_64_exit_16)
|
||||||
|
test %esi, %esi
|
||||||
|
jnz L(aligned_64_exit_32)
|
||||||
|
test %edi, %edi
|
||||||
|
jnz L(aligned_64_exit_48)
|
||||||
|
mov %ebx, %edx
|
||||||
|
lea (%eax), %eax
|
||||||
|
jmp L(aligned_64_exit)
|
||||||
|
L(aligned_64_exit_48):
|
||||||
|
lea -16(%eax), %eax
|
||||||
|
mov %edi, %edx
|
||||||
|
jmp L(aligned_64_exit)
|
||||||
|
L(aligned_64_exit_32):
|
||||||
|
lea -32(%eax), %eax
|
||||||
|
mov %esi, %edx
|
||||||
|
jmp L(aligned_64_exit)
|
||||||
|
L(aligned_64_exit_16):
|
||||||
|
lea -48(%eax), %eax
|
||||||
|
L(aligned_64_exit):
|
||||||
|
POP (%ebp)
|
||||||
|
POP (%ebx)
|
||||||
|
POP (%edi)
|
||||||
|
POP (%esi)
|
||||||
|
L(exit):
|
||||||
|
sub %ecx, %eax
|
||||||
|
test %dl, %dl
|
||||||
|
jz L(exit_high)
|
||||||
|
test $0x01, %dl
|
||||||
|
jnz L(exit_tail0)
|
||||||
|
|
||||||
|
test $0x02, %dl
|
||||||
|
jnz L(exit_tail1)
|
||||||
|
|
||||||
|
test $0x04, %dl
|
||||||
|
jnz L(exit_tail2)
|
||||||
|
|
||||||
|
test $0x08, %dl
|
||||||
|
jnz L(exit_tail3)
|
||||||
|
|
||||||
|
test $0x10, %dl
|
||||||
|
jnz L(exit_tail4)
|
||||||
|
|
||||||
|
test $0x20, %dl
|
||||||
|
jnz L(exit_tail5)
|
||||||
|
|
||||||
|
test $0x40, %dl
|
||||||
|
jnz L(exit_tail6)
|
||||||
|
add $7, %eax
|
||||||
|
L(exit_tail0):
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_high):
|
||||||
|
add $8, %eax
|
||||||
|
test $0x01, %dh
|
||||||
|
jnz L(exit_tail0)
|
||||||
|
|
||||||
|
test $0x02, %dh
|
||||||
|
jnz L(exit_tail1)
|
||||||
|
|
||||||
|
test $0x04, %dh
|
||||||
|
jnz L(exit_tail2)
|
||||||
|
|
||||||
|
test $0x08, %dh
|
||||||
|
jnz L(exit_tail3)
|
||||||
|
|
||||||
|
test $0x10, %dh
|
||||||
|
jnz L(exit_tail4)
|
||||||
|
|
||||||
|
test $0x20, %dh
|
||||||
|
jnz L(exit_tail5)
|
||||||
|
|
||||||
|
test $0x40, %dh
|
||||||
|
jnz L(exit_tail6)
|
||||||
|
add $7, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
.p2align 4
|
||||||
|
L(exit_tail1):
|
||||||
|
add $1, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail2):
|
||||||
|
add $2, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail3):
|
||||||
|
add $3, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail4):
|
||||||
|
add $4, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail5):
|
||||||
|
add $5, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail6):
|
||||||
|
add $6, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail7):
|
||||||
|
add $7, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail8):
|
||||||
|
add $8, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail9):
|
||||||
|
add $9, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail10):
|
||||||
|
add $10, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail11):
|
||||||
|
add $11, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail12):
|
||||||
|
add $12, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail13):
|
||||||
|
add $13, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail14):
|
||||||
|
add $14, %eax
|
||||||
|
RETURN
|
||||||
|
|
||||||
|
L(exit_tail15):
|
||||||
|
add $15, %eax
|
||||||
|
ret
|
||||||
|
|
||||||
|
END (STRLEN)
|
@@ -53,13 +53,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_restore
|
#ifndef cfi_restore
|
||||||
# define cfi_restore(reg) .cfi_restore (reg)
|
# define cfi_restore(reg) .cfi_restore reg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_adjust_cfa_offset
|
#ifndef cfi_adjust_cfa_offset
|
||||||
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_remember_state
|
||||||
|
# define cfi_remember_state .cfi_remember_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_restore_state
|
||||||
|
# define cfi_restore_state .cfi_restore_state
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ENTRY
|
#ifndef ENTRY
|
||||||
# define ENTRY(name) \
|
# define ENTRY(name) \
|
||||||
.type name, @function; \
|
.type name, @function; \
|
||||||
@@ -91,8 +99,7 @@ name: \
|
|||||||
#define BLK2 BLK1+4
|
#define BLK2 BLK1+4
|
||||||
#define LEN BLK2+4
|
#define LEN BLK2+4
|
||||||
#define RETURN_END POP (%edi); POP (%esi); POP (%ebx); ret
|
#define RETURN_END POP (%edi); POP (%esi); POP (%ebx); ret
|
||||||
#define RETURN RETURN_END; CFI_PUSH (%ebx); CFI_PUSH (%edi); \
|
#define RETURN RETURN_END; cfi_restore_state; cfi_remember_state
|
||||||
CFI_PUSH (%esi)
|
|
||||||
|
|
||||||
.section .text.ssse3,"ax",@progbits
|
.section .text.ssse3,"ax",@progbits
|
||||||
ENTRY (MEMCMP)
|
ENTRY (MEMCMP)
|
||||||
@@ -131,6 +138,7 @@ L(48bytesormore):
|
|||||||
PUSH (%ebx)
|
PUSH (%ebx)
|
||||||
PUSH (%esi)
|
PUSH (%esi)
|
||||||
PUSH (%edi)
|
PUSH (%edi)
|
||||||
|
cfi_remember_state
|
||||||
movdqu (%eax), %xmm3
|
movdqu (%eax), %xmm3
|
||||||
movdqu (%edx), %xmm0
|
movdqu (%edx), %xmm0
|
||||||
movl %eax, %edi
|
movl %eax, %edi
|
||||||
@@ -211,8 +219,8 @@ L(shr_0):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_0_gobble):
|
L(shr_0_gobble):
|
||||||
lea -48(%ecx), %ecx
|
lea -48(%ecx), %ecx
|
||||||
@@ -257,8 +265,8 @@ L(shr_0_gobble_loop_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_1):
|
L(shr_1):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -287,8 +295,8 @@ L(shr_1):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_1_gobble):
|
L(shr_1_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -340,8 +348,8 @@ L(shr_1_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_2):
|
L(shr_2):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -370,8 +378,8 @@ L(shr_2):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_2_gobble):
|
L(shr_2_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -423,8 +431,8 @@ L(shr_2_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_3):
|
L(shr_3):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -453,8 +461,8 @@ L(shr_3):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_3_gobble):
|
L(shr_3_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -506,8 +514,8 @@ L(shr_3_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_4):
|
L(shr_4):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -536,8 +544,8 @@ L(shr_4):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_4_gobble):
|
L(shr_4_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -589,8 +597,8 @@ L(shr_4_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_5):
|
L(shr_5):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -619,8 +627,8 @@ L(shr_5):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_5_gobble):
|
L(shr_5_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -672,8 +680,8 @@ L(shr_5_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_6):
|
L(shr_6):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -702,8 +710,8 @@ L(shr_6):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_6_gobble):
|
L(shr_6_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -755,8 +763,8 @@ L(shr_6_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_7):
|
L(shr_7):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -785,8 +793,8 @@ L(shr_7):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_7_gobble):
|
L(shr_7_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -838,8 +846,8 @@ L(shr_7_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_8):
|
L(shr_8):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -868,8 +876,8 @@ L(shr_8):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_8_gobble):
|
L(shr_8_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -921,8 +929,8 @@ L(shr_8_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_9):
|
L(shr_9):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -951,8 +959,8 @@ L(shr_9):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_9_gobble):
|
L(shr_9_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1004,8 +1012,8 @@ L(shr_9_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_10):
|
L(shr_10):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1034,8 +1042,8 @@ L(shr_10):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_10_gobble):
|
L(shr_10_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1087,8 +1095,8 @@ L(shr_10_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_11):
|
L(shr_11):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1117,8 +1125,8 @@ L(shr_11):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_11_gobble):
|
L(shr_11_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1170,8 +1178,8 @@ L(shr_11_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_12):
|
L(shr_12):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1200,8 +1208,8 @@ L(shr_12):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_12_gobble):
|
L(shr_12_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1253,8 +1261,8 @@ L(shr_12_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_13):
|
L(shr_13):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1283,8 +1291,8 @@ L(shr_13):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_13_gobble):
|
L(shr_13_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1336,8 +1344,8 @@ L(shr_13_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_14):
|
L(shr_14):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1366,8 +1374,8 @@ L(shr_14):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_14_gobble):
|
L(shr_14_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1419,8 +1427,8 @@ L(shr_14_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_15):
|
L(shr_15):
|
||||||
cmp $80, %ecx
|
cmp $80, %ecx
|
||||||
@@ -1449,8 +1457,8 @@ L(shr_15):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shr_15_gobble):
|
L(shr_15_gobble):
|
||||||
sub $32, %ecx
|
sub $32, %ecx
|
||||||
@@ -1502,8 +1510,8 @@ L(shr_15_gobble_next):
|
|||||||
POP (%esi)
|
POP (%esi)
|
||||||
jmp L(less48bytes)
|
jmp L(less48bytes)
|
||||||
|
|
||||||
CFI_PUSH (%esi)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(exit):
|
L(exit):
|
||||||
pmovmskb %xmm1, %ebx
|
pmovmskb %xmm1, %ebx
|
@@ -53,13 +53,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_restore
|
#ifndef cfi_restore
|
||||||
# define cfi_restore(reg) .cfi_restore (reg)
|
# define cfi_restore(reg) .cfi_restore reg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_adjust_cfa_offset
|
#ifndef cfi_adjust_cfa_offset
|
||||||
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_remember_state
|
||||||
|
# define cfi_remember_state .cfi_remember_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_restore_state
|
||||||
|
# define cfi_restore_state .cfi_restore_state
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ENTRY
|
#ifndef ENTRY
|
||||||
# define ENTRY(name) \
|
# define ENTRY(name) \
|
||||||
.type name, @function; \
|
.type name, @function; \
|
||||||
@@ -198,6 +206,7 @@ L(48bytesormore):
|
|||||||
movl %edx, %edi
|
movl %edx, %edi
|
||||||
and $-16, %edx
|
and $-16, %edx
|
||||||
PUSH (%esi)
|
PUSH (%esi)
|
||||||
|
cfi_remember_state
|
||||||
add $16, %edx
|
add $16, %edx
|
||||||
movl %edi, %esi
|
movl %edi, %esi
|
||||||
sub %edx, %edi
|
sub %edx, %edi
|
||||||
@@ -223,6 +232,8 @@ L(48bytesormore):
|
|||||||
|
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %edi, 4)
|
BRANCH_TO_JMPTBL_ENTRY (L(shl_table), %edi, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_0):
|
L(shl_0):
|
||||||
movdqu %xmm0, (%esi)
|
movdqu %xmm0, (%esi)
|
||||||
@@ -270,6 +281,7 @@ L(shl_0_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
CFI_PUSH (%edi)
|
||||||
L(shl_0_gobble):
|
L(shl_0_gobble):
|
||||||
|
|
||||||
#ifdef DATA_CACHE_SIZE_HALF
|
#ifdef DATA_CACHE_SIZE_HALF
|
||||||
@@ -419,7 +431,8 @@ L(shl_0_mem_less_16bytes):
|
|||||||
add %ecx, %eax
|
add %ecx, %eax
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY (L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_1):
|
L(shl_1):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -463,6 +476,8 @@ L(shl_1_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_2):
|
L(shl_2):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -506,6 +521,8 @@ L(shl_2_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_3):
|
L(shl_3):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -549,6 +566,8 @@ L(shl_3_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_4):
|
L(shl_4):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -592,6 +611,8 @@ L(shl_4_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_5):
|
L(shl_5):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -635,7 +656,8 @@ L(shl_5_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_6):
|
L(shl_6):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -679,6 +701,8 @@ L(shl_6_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_7):
|
L(shl_7):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -722,6 +746,8 @@ L(shl_7_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_8):
|
L(shl_8):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -765,6 +791,8 @@ L(shl_8_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_9):
|
L(shl_9):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -808,6 +836,8 @@ L(shl_9_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_10):
|
L(shl_10):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -851,6 +881,8 @@ L(shl_10_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_11):
|
L(shl_11):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -894,6 +926,8 @@ L(shl_11_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_12):
|
L(shl_12):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -937,6 +971,8 @@ L(shl_12_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_13):
|
L(shl_13):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -980,6 +1016,8 @@ L(shl_13_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_14):
|
L(shl_14):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -1023,7 +1061,8 @@ L(shl_14_end):
|
|||||||
POP (%edi)
|
POP (%edi)
|
||||||
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY_TAIL(L(table_48bytes_fwd), %ecx, 4)
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(shl_15):
|
L(shl_15):
|
||||||
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
BRANCH_TO_JMPTBL_ENTRY_VALUE(L(table_48bytes_fwd))
|
||||||
@@ -1264,8 +1303,10 @@ L(fwd_write_3bytes):
|
|||||||
movl DEST(%esp), %eax
|
movl DEST(%esp), %eax
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
RETURN
|
RETURN_END
|
||||||
|
|
||||||
|
cfi_restore_state
|
||||||
|
cfi_remember_state
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(large_page):
|
L(large_page):
|
||||||
movdqu (%eax), %xmm1
|
movdqu (%eax), %xmm1
|
||||||
@@ -1688,6 +1729,7 @@ L(bk_write_less32bytes):
|
|||||||
L(bk_write_less32bytes_2):
|
L(bk_write_less32bytes_2):
|
||||||
BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
|
BRANCH_TO_JMPTBL_ENTRY (L(table_48_bytes_bwd), %ecx, 4)
|
||||||
|
|
||||||
|
CFI_PUSH (%esi)
|
||||||
ALIGN (4)
|
ALIGN (4)
|
||||||
L(bk_align):
|
L(bk_align):
|
||||||
cmp $8, %ecx
|
cmp $8, %ecx
|
||||||
|
@@ -45,13 +45,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_restore
|
#ifndef cfi_restore
|
||||||
# define cfi_restore(reg) .cfi_restore (reg)
|
# define cfi_restore(reg) .cfi_restore reg
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef cfi_adjust_cfa_offset
|
#ifndef cfi_adjust_cfa_offset
|
||||||
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_remember_state
|
||||||
|
# define cfi_remember_state .cfi_remember_state
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef cfi_restore_state
|
||||||
|
# define cfi_restore_state .cfi_restore_state
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ENTRY
|
#ifndef ENTRY
|
||||||
# define ENTRY(name) \
|
# define ENTRY(name) \
|
||||||
.type name, @function; \
|
.type name, @function; \
|
||||||
@@ -201,6 +209,9 @@ L(crosspage):
|
|||||||
PUSH (%ebx)
|
PUSH (%ebx)
|
||||||
PUSH (%edi)
|
PUSH (%edi)
|
||||||
PUSH (%esi)
|
PUSH (%esi)
|
||||||
|
#ifdef USE_AS_STRNCMP
|
||||||
|
cfi_remember_state
|
||||||
|
#endif
|
||||||
|
|
||||||
movl %edx, %edi
|
movl %edx, %edi
|
||||||
movl %eax, %ecx
|
movl %eax, %ecx
|
||||||
@@ -1521,17 +1532,18 @@ L(gobble_ashr_12):
|
|||||||
sub $0xffff, %esi
|
sub $0xffff, %esi
|
||||||
jnz L(exit)
|
jnz L(exit)
|
||||||
|
|
||||||
|
#ifdef USE_AS_STRNCMP
|
||||||
|
cmp $16, %ebp
|
||||||
|
lea -16(%ebp), %ebp
|
||||||
|
jbe L(more8byteseq)
|
||||||
|
#endif
|
||||||
|
|
||||||
add $16, %ecx
|
add $16, %ecx
|
||||||
movdqa %xmm4, %xmm3
|
movdqa %xmm4, %xmm3
|
||||||
|
|
||||||
add $16, %edi
|
add $16, %edi
|
||||||
jg L(nibble_ashr_12)
|
jg L(nibble_ashr_12)
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
|
||||||
cmp $16, %ebp
|
|
||||||
lea -16(%ebp), %ebp
|
|
||||||
jbe L(more8byteseq)
|
|
||||||
#endif
|
|
||||||
movdqa (%eax, %ecx), %xmm1
|
movdqa (%eax, %ecx), %xmm1
|
||||||
movdqa (%edx, %ecx), %xmm2
|
movdqa (%edx, %ecx), %xmm2
|
||||||
movdqa %xmm2, %xmm4
|
movdqa %xmm2, %xmm4
|
||||||
@@ -2087,10 +2099,7 @@ L(neq_bigger):
|
|||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
#ifdef USE_AS_STRNCMP
|
#ifdef USE_AS_STRNCMP
|
||||||
CFI_PUSH (%ebx)
|
cfi_restore_state
|
||||||
CFI_PUSH (%edi)
|
|
||||||
CFI_PUSH (%esi)
|
|
||||||
|
|
||||||
.p2align 4
|
.p2align 4
|
||||||
L(more8byteseq):
|
L(more8byteseq):
|
||||||
POP (%esi)
|
POP (%esi)
|
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#if defined(USE_SSSE3)
|
#if defined(USE_SSSE3)
|
||||||
|
|
||||||
# define ssse3_strcmp_latest strcmp
|
# define ssse3_strcmp_latest strcmp
|
||||||
# include "ssse3-strcmp.S"
|
# include "ssse3-strcmp-latest.S"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
40
libc/arch-x86/string/strlen_wrapper.S
Normal file
40
libc/arch-x86/string/strlen_wrapper.S
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
Copyright (c) 2010, Intel Corporation
|
||||||
|
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 Intel Corporation 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(USE_SSE2)
|
||||||
|
|
||||||
|
# define sse2_strlen_atom strlen
|
||||||
|
# include "sse2-strlen-atom.S"
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# include "strlen.S"
|
||||||
|
|
||||||
|
#endif
|
@@ -32,7 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
# define USE_AS_STRNCMP
|
# define USE_AS_STRNCMP
|
||||||
# define ssse3_strcmp_latest strncmp
|
# define ssse3_strcmp_latest strncmp
|
||||||
# include "ssse3-strcmp.S"
|
# include "ssse3-strcmp-latest.S"
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@@ -35,7 +35,9 @@ typedef struct
|
|||||||
void (**preinit_array)(void);
|
void (**preinit_array)(void);
|
||||||
void (**init_array)(void);
|
void (**init_array)(void);
|
||||||
void (**fini_array)(void);
|
void (**fini_array)(void);
|
||||||
|
#ifndef __i386__
|
||||||
void (**ctors_array)(void);
|
void (**ctors_array)(void);
|
||||||
|
#endif
|
||||||
} structors_array_t;
|
} structors_array_t;
|
||||||
|
|
||||||
extern void __libc_init_common(uintptr_t *elfdata);
|
extern void __libc_init_common(uintptr_t *elfdata);
|
||||||
|
@@ -75,8 +75,10 @@ __noreturn void __libc_init(uintptr_t *elfdata,
|
|||||||
/* pre-init array. */
|
/* pre-init array. */
|
||||||
call_array(structors->preinit_array);
|
call_array(structors->preinit_array);
|
||||||
|
|
||||||
|
#ifndef __i386__
|
||||||
/* .ctors section initializers, for non-arm-eabi ABIs */
|
/* .ctors section initializers, for non-arm-eabi ABIs */
|
||||||
call_array(structors->ctors_array);
|
call_array(structors->ctors_array);
|
||||||
|
#endif
|
||||||
|
|
||||||
// call static constructors
|
// call static constructors
|
||||||
call_array(structors->init_array);
|
call_array(structors->init_array);
|
||||||
|
@@ -68,7 +68,13 @@ int __futex_wait_ex(volatile void *ftx, int pshared, int val, const struct time
|
|||||||
#define __likely(cond) __builtin_expect(!!(cond), 1)
|
#define __likely(cond) __builtin_expect(!!(cond), 1)
|
||||||
#define __unlikely(cond) __builtin_expect(!!(cond), 0)
|
#define __unlikely(cond) __builtin_expect(!!(cond), 0)
|
||||||
|
|
||||||
void _thread_created_hook(pid_t thread_id) __attribute__((noinline));
|
#ifdef __i386__
|
||||||
|
#define ATTRIBUTES __attribute__((noinline)) __attribute__((fastcall))
|
||||||
|
#else
|
||||||
|
#define ATTRIBUTES __attribute__((noinline))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ATTRIBUTES _thread_created_hook(pid_t thread_id);
|
||||||
|
|
||||||
#define PTHREAD_ATTR_FLAG_DETACHED 0x00000001
|
#define PTHREAD_ATTR_FLAG_DETACHED 0x00000001
|
||||||
#define PTHREAD_ATTR_FLAG_USER_STACK 0x00000002
|
#define PTHREAD_ATTR_FLAG_USER_STACK 0x00000002
|
||||||
|
@@ -57,7 +57,12 @@ long ptrace(int request, pid_t pid, void * addr, void * data)
|
|||||||
/*
|
/*
|
||||||
* Hook for gdb to get notified when a thread is created
|
* Hook for gdb to get notified when a thread is created
|
||||||
*/
|
*/
|
||||||
void _thread_created_hook(pid_t thread_id) __attribute__((noinline));
|
#ifdef __i386__
|
||||||
void _thread_created_hook(pid_t thread_id)
|
#define ATTRIBUTES __attribute__((noinline)) __attribute__((fastcall))
|
||||||
|
#else
|
||||||
|
#define ATTRIBUTES __attribute__((noinline))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ATTRIBUTES _thread_created_hook(pid_t thread_id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -84,6 +84,7 @@
|
|||||||
#define ETH_P_TRAILER 0x001C
|
#define ETH_P_TRAILER 0x001C
|
||||||
#define ETH_P_PHONET 0x00F5
|
#define ETH_P_PHONET 0x00F5
|
||||||
#define ETH_P_IEEE802154 0x00F6
|
#define ETH_P_IEEE802154 0x00F6
|
||||||
|
#define ETH_P_CAIF 0x00F7
|
||||||
|
|
||||||
struct ethhdr {
|
struct ethhdr {
|
||||||
unsigned char h_dest[ETH_ALEN];
|
unsigned char h_dest[ETH_ALEN];
|
||||||
|
@@ -138,7 +138,8 @@ struct ucred {
|
|||||||
#define AF_LLC 26
|
#define AF_LLC 26
|
||||||
#define AF_TIPC 30
|
#define AF_TIPC 30
|
||||||
#define AF_BLUETOOTH 31
|
#define AF_BLUETOOTH 31
|
||||||
#define AF_MAX 32
|
#define AF_CAIF 38
|
||||||
|
#define AF_MAX 39
|
||||||
|
|
||||||
#define PF_UNSPEC AF_UNSPEC
|
#define PF_UNSPEC AF_UNSPEC
|
||||||
#define PF_UNIX AF_UNIX
|
#define PF_UNIX AF_UNIX
|
||||||
@@ -170,6 +171,7 @@ struct ucred {
|
|||||||
#define PF_LLC AF_LLC
|
#define PF_LLC AF_LLC
|
||||||
#define PF_TIPC AF_TIPC
|
#define PF_TIPC AF_TIPC
|
||||||
#define PF_BLUETOOTH AF_BLUETOOTH
|
#define PF_BLUETOOTH AF_BLUETOOTH
|
||||||
|
#define PF_CAIF AF_CAIF
|
||||||
#define PF_MAX AF_MAX
|
#define PF_MAX AF_MAX
|
||||||
|
|
||||||
#define SOMAXCONN 128
|
#define SOMAXCONN 128
|
||||||
|
@@ -12,4 +12,6 @@
|
|||||||
#ifndef _LINUX_TTY_H
|
#ifndef _LINUX_TTY_H
|
||||||
#define _LINUX_TTY_H
|
#define _LINUX_TTY_H
|
||||||
|
|
||||||
|
#define N_CAIF 20
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -32,6 +32,11 @@
|
|||||||
#
|
#
|
||||||
.section .bss
|
.section .bss
|
||||||
.align 4
|
.align 4
|
||||||
|
|
||||||
|
#ifndef CRT_LEGACY_WORKAROUND
|
||||||
|
.hidden __dso_handle
|
||||||
|
#endif
|
||||||
|
|
||||||
.globl __dso_handle
|
.globl __dso_handle
|
||||||
__dso_handle:
|
__dso_handle:
|
||||||
.long 0
|
.long 0
|
||||||
|
38
libc/private/__dso_handle_so.S
Normal file
38
libc/private/__dso_handle_so.S
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 The Android Open Source Project
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# The __dso_handle global variable is used by static
|
||||||
|
# C++ constructors and destructors in the binary.
|
||||||
|
# See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
|
||||||
|
#
|
||||||
|
.data
|
||||||
|
.align 4
|
||||||
|
.hidden __dso_handle
|
||||||
|
.globl __dso_handle
|
||||||
|
__dso_handle:
|
||||||
|
.long __dso_handle
|
@@ -104,6 +104,7 @@ unlock:
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CRT_LEGACY_WORKAROUND
|
||||||
/*
|
/*
|
||||||
* Register a function to be performed at exit.
|
* Register a function to be performed at exit.
|
||||||
*/
|
*/
|
||||||
@@ -112,6 +113,7 @@ atexit(void (*func)(void))
|
|||||||
{
|
{
|
||||||
return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
|
return (__cxa_atexit((void (*)(void *))func, NULL, NULL));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call all handlers registered with __cxa_atexit() for the shared
|
* Call all handlers registered with __cxa_atexit() for the shared
|
||||||
|
@@ -35,9 +35,7 @@ int open(const char *pathname, int flags, ...)
|
|||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
|
||||||
#if !defined(__i386__)
|
|
||||||
flags |= O_LARGEFILE;
|
flags |= O_LARGEFILE;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (flags & O_CREAT)
|
if (flags & O_CREAT)
|
||||||
{
|
{
|
||||||
|
@@ -35,9 +35,7 @@ int openat(int fd, const char *pathname, int flags, ...)
|
|||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
|
|
||||||
#if !defined(__i386__)
|
|
||||||
flags |= O_LARGEFILE;
|
flags |= O_LARGEFILE;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (flags & O_CREAT)
|
if (flags & O_CREAT)
|
||||||
{
|
{
|
||||||
|
@@ -38,6 +38,8 @@ sigsetmask(int mask)
|
|||||||
sigset_t the_sigset;
|
sigset_t the_sigset;
|
||||||
} in, out;
|
} in, out;
|
||||||
|
|
||||||
|
in.the_mask = mask;
|
||||||
|
|
||||||
n = sigprocmask(SIG_SETMASK, &in.the_sigset, &out.the_sigset);
|
n = sigprocmask(SIG_SETMASK, &in.the_sigset, &out.the_sigset);
|
||||||
if (n)
|
if (n)
|
||||||
return n;
|
return n;
|
||||||
|
@@ -153,7 +153,8 @@ feholdexcept(fenv_t *envp)
|
|||||||
int
|
int
|
||||||
feupdateenv(const fenv_t *envp)
|
feupdateenv(const fenv_t *envp)
|
||||||
{
|
{
|
||||||
int mxcsr, status;
|
int mxcsr;
|
||||||
|
short status;
|
||||||
|
|
||||||
__fnstsw(&status);
|
__fnstsw(&status);
|
||||||
if (__HAS_SSE())
|
if (__HAS_SSE())
|
||||||
|
240
libm/i387/fenv.h
240
libm/i387/fenv.h
@@ -1,240 +0,0 @@
|
|||||||
/*-
|
|
||||||
* Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 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.
|
|
||||||
*
|
|
||||||
* $FreeBSD: src/lib/msun/i387/fenv.h,v 1.4 2005/03/17 22:21:46 das Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _FENV_H_
|
|
||||||
#define _FENV_H_
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/_types.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* To preserve binary compatibility with FreeBSD 5.3, we pack the
|
|
||||||
* mxcsr into some reserved fields, rather than changing sizeof(fenv_t).
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
__uint16_t __control;
|
|
||||||
__uint16_t __mxcsr_hi;
|
|
||||||
__uint16_t __status;
|
|
||||||
__uint16_t __mxcsr_lo;
|
|
||||||
__uint32_t __tag;
|
|
||||||
char __other[16];
|
|
||||||
} fenv_t;
|
|
||||||
|
|
||||||
#define __get_mxcsr(env) (((env).__mxcsr_hi << 16) | \
|
|
||||||
((env).__mxcsr_lo))
|
|
||||||
#define __set_mxcsr(env, x) do { \
|
|
||||||
(env).__mxcsr_hi = (__uint32_t)(x) >> 16; \
|
|
||||||
(env).__mxcsr_lo = (__uint16_t)(x); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
typedef __uint16_t fexcept_t;
|
|
||||||
|
|
||||||
/* Exception flags */
|
|
||||||
#define FE_INVALID 0x01
|
|
||||||
#define FE_DENORMAL 0x02
|
|
||||||
#define FE_DIVBYZERO 0x04
|
|
||||||
#define FE_OVERFLOW 0x08
|
|
||||||
#define FE_UNDERFLOW 0x10
|
|
||||||
#define FE_INEXACT 0x20
|
|
||||||
#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
|
|
||||||
FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
|
|
||||||
|
|
||||||
/* Rounding modes */
|
|
||||||
#define FE_TONEAREST 0x0000
|
|
||||||
#define FE_DOWNWARD 0x0400
|
|
||||||
#define FE_UPWARD 0x0800
|
|
||||||
#define FE_TOWARDZERO 0x0c00
|
|
||||||
#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
|
|
||||||
FE_UPWARD | FE_TOWARDZERO)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* As compared to the x87 control word, the SSE unit's control word
|
|
||||||
* has the rounding control bits offset by 3 and the exception mask
|
|
||||||
* bits offset by 7.
|
|
||||||
*/
|
|
||||||
#define _SSE_ROUND_SHIFT 3
|
|
||||||
#define _SSE_EMASK_SHIFT 7
|
|
||||||
|
|
||||||
/* After testing for SSE support once, we cache the result in __has_sse. */
|
|
||||||
enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK };
|
|
||||||
extern enum __sse_support __has_sse;
|
|
||||||
int __test_sse(void);
|
|
||||||
#ifdef __SSE__
|
|
||||||
#define __HAS_SSE() 1
|
|
||||||
#else
|
|
||||||
#define __HAS_SSE() (__has_sse == __SSE_YES || \
|
|
||||||
(__has_sse == __SSE_UNK && __test_sse()))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__BEGIN_DECLS
|
|
||||||
|
|
||||||
/* Default floating-point environment */
|
|
||||||
extern const fenv_t __fe_dfl_env;
|
|
||||||
#define FE_DFL_ENV (&__fe_dfl_env)
|
|
||||||
|
|
||||||
#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw))
|
|
||||||
#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env))
|
|
||||||
#define __fnclex() __asm __volatile("fnclex")
|
|
||||||
#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env)))
|
|
||||||
#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
|
|
||||||
#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw)))
|
|
||||||
#define __fwait() __asm __volatile("fwait")
|
|
||||||
#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr))
|
|
||||||
#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
feclearexcept(int __excepts)
|
|
||||||
{
|
|
||||||
fenv_t __env;
|
|
||||||
int __mxcsr;
|
|
||||||
|
|
||||||
if (__excepts == FE_ALL_EXCEPT) {
|
|
||||||
__fnclex();
|
|
||||||
} else {
|
|
||||||
__fnstenv(&__env);
|
|
||||||
__env.__status &= ~__excepts;
|
|
||||||
__fldenv(__env);
|
|
||||||
}
|
|
||||||
if (__HAS_SSE()) {
|
|
||||||
__stmxcsr(&__mxcsr);
|
|
||||||
__mxcsr &= ~__excepts;
|
|
||||||
__ldmxcsr(__mxcsr);
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fegetexceptflag(fexcept_t *__flagp, int __excepts)
|
|
||||||
{
|
|
||||||
int __mxcsr, __status;
|
|
||||||
|
|
||||||
__fnstsw(&__status);
|
|
||||||
if (__HAS_SSE())
|
|
||||||
__stmxcsr(&__mxcsr);
|
|
||||||
else
|
|
||||||
__mxcsr = 0;
|
|
||||||
*__flagp = (__mxcsr | __status) & __excepts;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
|
||||||
int feraiseexcept(int __excepts);
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fetestexcept(int __excepts)
|
|
||||||
{
|
|
||||||
int __mxcsr, __status;
|
|
||||||
|
|
||||||
__fnstsw(&__status);
|
|
||||||
if (__HAS_SSE())
|
|
||||||
__stmxcsr(&__mxcsr);
|
|
||||||
else
|
|
||||||
__mxcsr = 0;
|
|
||||||
return ((__status | __mxcsr) & __excepts);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fegetround(void)
|
|
||||||
{
|
|
||||||
int __control;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We assume that the x87 and the SSE unit agree on the
|
|
||||||
* rounding mode. Reading the control word on the x87 turns
|
|
||||||
* out to be about 5 times faster than reading it on the SSE
|
|
||||||
* unit on an Opteron 244.
|
|
||||||
*/
|
|
||||||
__fnstcw(&__control);
|
|
||||||
return (__control & _ROUND_MASK);
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fesetround(int __round)
|
|
||||||
{
|
|
||||||
int __mxcsr, __control;
|
|
||||||
|
|
||||||
if (__round & ~_ROUND_MASK)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
__fnstcw(&__control);
|
|
||||||
__control &= ~_ROUND_MASK;
|
|
||||||
__control |= __round;
|
|
||||||
__fldcw(__control);
|
|
||||||
|
|
||||||
if (__HAS_SSE()) {
|
|
||||||
__stmxcsr(&__mxcsr);
|
|
||||||
__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT);
|
|
||||||
__mxcsr |= __round << _SSE_ROUND_SHIFT;
|
|
||||||
__ldmxcsr(__mxcsr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int fegetenv(fenv_t *__envp);
|
|
||||||
int feholdexcept(fenv_t *__envp);
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fesetenv(const fenv_t *__envp)
|
|
||||||
{
|
|
||||||
fenv_t __env = *__envp;
|
|
||||||
int __mxcsr;
|
|
||||||
|
|
||||||
__mxcsr = __get_mxcsr(__env);
|
|
||||||
__set_mxcsr(__env, 0xffffffff);
|
|
||||||
__fldenv(__env);
|
|
||||||
if (__HAS_SSE())
|
|
||||||
__ldmxcsr(__mxcsr);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int feupdateenv(const fenv_t *__envp);
|
|
||||||
|
|
||||||
#if __BSD_VISIBLE
|
|
||||||
|
|
||||||
int feenableexcept(int __mask);
|
|
||||||
int fedisableexcept(int __mask);
|
|
||||||
|
|
||||||
static __inline int
|
|
||||||
fegetexcept(void)
|
|
||||||
{
|
|
||||||
int __control;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We assume that the masks for the x87 and the SSE unit are
|
|
||||||
* the same.
|
|
||||||
*/
|
|
||||||
__fnstcw(&__control);
|
|
||||||
return (~__control & FE_ALL_EXCEPT);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __BSD_VISIBLE */
|
|
||||||
|
|
||||||
__END_DECLS
|
|
||||||
|
|
||||||
#endif /* !_FENV_H_ */
|
|
@@ -102,7 +102,7 @@ extern const fenv_t __fe_dfl_env;
|
|||||||
#define __fnclex() __asm __volatile("fnclex")
|
#define __fnclex() __asm __volatile("fnclex")
|
||||||
#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env)))
|
#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env)))
|
||||||
#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
|
#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
|
||||||
#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw)))
|
#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=a" (*(__sw)))
|
||||||
#define __fwait() __asm __volatile("fwait")
|
#define __fwait() __asm __volatile("fwait")
|
||||||
#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr))
|
#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr))
|
||||||
#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
|
#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
|
||||||
@@ -148,7 +148,8 @@ int feraiseexcept(int __excepts);
|
|||||||
static __inline int
|
static __inline int
|
||||||
fetestexcept(int __excepts)
|
fetestexcept(int __excepts)
|
||||||
{
|
{
|
||||||
int __mxcsr, __status;
|
int __mxcsr;
|
||||||
|
short __status;
|
||||||
|
|
||||||
__fnstsw(&__status);
|
__fnstsw(&__status);
|
||||||
if (__HAS_SSE())
|
if (__HAS_SSE())
|
||||||
|
@@ -22,12 +22,7 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_WHOLE_STATIC_LIBRARIES := libthread_db
|
LOCAL_WHOLE_STATIC_LIBRARIES := libthread_db
|
||||||
LOCAL_MODULE:=libthread_db
|
LOCAL_MODULE:=libthread_db
|
||||||
LOCAL_SHARED_LIBRARIES := libdl
|
LOCAL_SHARED_LIBRARIES := libdl
|
||||||
|
LOCAL_ALLOW_UNDEFINED_SYMBOLS := false
|
||||||
# NOTE: Using --no-undefined results in a missing symbol that is defined inside
|
|
||||||
# gdbserver and is resolved at runtime. Since there is no library containing
|
|
||||||
# this symbol that we can link against, set LOCAL_ALLOW_UNDEFINED_SYMBOLS so
|
|
||||||
# that --no-undefined is removed from the linker flags.
|
|
||||||
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
22
libthread_db/include/sys/procfs.h
Normal file
22
libthread_db/include/sys/procfs.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2006 The Android Open Source Project
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _SYS_PROCFS_H
|
||||||
|
#define _SYS_PROCFS_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef pid_t lwpid_t;
|
||||||
|
typedef void *psaddr_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@@ -9,9 +9,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/procfs.h>
|
||||||
typedef void *psaddr_t;
|
|
||||||
typedef pid_t lwpid_t;
|
|
||||||
|
|
||||||
#define TD_THR_ANY_USER_FLAGS 0xffffffff
|
#define TD_THR_ANY_USER_FLAGS 0xffffffff
|
||||||
#define TD_THR_LOWEST_PRIORITY -20
|
#define TD_THR_LOWEST_PRIORITY -20
|
||||||
@@ -151,6 +149,10 @@ extern td_err_e td_thr_event_enable(td_thrhandle_t const * handle,
|
|||||||
extern td_err_e td_ta_thr_iter(td_thragent_t const * agent, td_thr_iter_f * func, void * cookie,
|
extern td_err_e td_ta_thr_iter(td_thragent_t const * agent, td_thr_iter_f * func, void * cookie,
|
||||||
td_thr_state_e state, int32_t prio, sigset_t * sigmask, uint32_t user_flags);
|
td_thr_state_e state, int32_t prio, sigset_t * sigmask, uint32_t user_flags);
|
||||||
|
|
||||||
|
extern td_err_e td_thr_event_enable(td_thrhandle_t const * handle, td_event_e event);
|
||||||
|
|
||||||
|
extern td_err_e td_thr_get_info(td_thrhandle_t const * handle, td_thrinfo_t * info);
|
||||||
|
|
||||||
extern char const ** td_symbol_list(void);
|
extern char const ** td_symbol_list(void);
|
||||||
|
|
||||||
extern td_err_e td_thr_tls_get_addr(const td_thrhandle_t * th,
|
extern td_err_e td_thr_tls_get_addr(const td_thrhandle_t * th,
|
||||||
|
@@ -81,6 +81,25 @@ _event_getmsg_helper(td_thrhandle_t const * handle, void * bkpt_addr)
|
|||||||
{
|
{
|
||||||
void * pc;
|
void * pc;
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
/* Get the eip from offset 12*4 = 48 as defined in the struct
|
||||||
|
* user_regs_struct in user_32.h
|
||||||
|
*/
|
||||||
|
pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)48 /* eip */, NULL);
|
||||||
|
/* FIXME - pc is a non-decremented breakpoint address, hence the
|
||||||
|
* addition of 1 on test. This seems to work for the thread hook
|
||||||
|
* function in libc.so but should be properly fixed.
|
||||||
|
*/
|
||||||
|
if (pc == ((int)bkpt_addr + 1)) {
|
||||||
|
/* The hook function takes the id of the new thread as it's first
|
||||||
|
* param, so grab it from ecx at offset 4 in struct user_regs_struct
|
||||||
|
* (using fastcall convention for x86)
|
||||||
|
*/
|
||||||
|
gEventMsgHandle.pid = ptrace(PTRACE_PEEKUSR, handle->tid, (void *)4 /* ecx */, NULL);
|
||||||
|
gEventMsgHandle.tid = gEventMsgHandle.pid;
|
||||||
|
return 0x42;
|
||||||
|
}
|
||||||
|
#else
|
||||||
pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)60 /* r15/pc */, NULL);
|
pc = (void *)ptrace(PTRACE_PEEKUSR, handle->tid, (void *)60 /* r15/pc */, NULL);
|
||||||
|
|
||||||
if (pc == bkpt_addr) {
|
if (pc == bkpt_addr) {
|
||||||
@@ -90,6 +109,7 @@ _event_getmsg_helper(td_thrhandle_t const * handle, void * bkpt_addr)
|
|||||||
gEventMsgHandle.tid = gEventMsgHandle.pid;
|
gEventMsgHandle.tid = gEventMsgHandle.pid;
|
||||||
return 0x42;
|
return 0x42;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,6 +49,7 @@ LOCAL_CFLAGS += -DANDROID_ARM_LINKER
|
|||||||
else
|
else
|
||||||
ifeq ($(TARGET_ARCH),x86)
|
ifeq ($(TARGET_ARCH),x86)
|
||||||
LOCAL_CFLAGS += -DANDROID_X86_LINKER
|
LOCAL_CFLAGS += -DANDROID_X86_LINKER
|
||||||
|
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/arch-x86/bionic
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET_ARCH),sh)
|
ifeq ($(TARGET_ARCH),sh)
|
||||||
LOCAL_CFLAGS += -DANDROID_SH_LINKER
|
LOCAL_CFLAGS += -DANDROID_SH_LINKER
|
||||||
|
@@ -44,9 +44,5 @@ _start:
|
|||||||
popl %esp
|
popl %esp
|
||||||
jmp *%eax
|
jmp *%eax
|
||||||
|
|
||||||
.section .ctors, "wa"
|
|
||||||
.globl __CTOR_LIST__
|
|
||||||
|
|
||||||
__CTOR_LIST__:
|
|
||||||
.long -1
|
|
||||||
|
|
||||||
|
#include "__stack_chk_fail_local.S"
|
||||||
|
Reference in New Issue
Block a user