1
mirror of https://github.com/rapid7/metasploit-payloads synced 2024-11-20 14:39:22 +01:00

first attempt to merge in Philip Sanderson's work on the POSIX meterpreter

git-svn-id: file:///home/svn/framework3/trunk@10154 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-08-26 05:16:27 +00:00
parent 2397fa851f
commit 4b10b7b0ee
2538 changed files with 221807 additions and 24862 deletions

View File

@ -0,0 +1,19 @@
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ifneq ($(TARGET_SIMULATOR),true)
include $(call all-subdir-makefiles)
endif

View File

@ -0,0 +1,49 @@
# Copyright (C) 2007 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

View File

@ -0,0 +1,6 @@
Bionic support for SuperH
-------------------------
Bionic support for SuperH architecture is written by
Shin-ichiro KAWASAKI <shinichiro.kawasaki.mg@hitachi.com>
and Contributed to Android by Hitachi, Ltd. and Renesas Solutions Corp.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,676 @@
LOCAL_PATH:= $(call my-dir)
include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/syscalls.mk
# Define the common source files for all the libc instances
# =========================================================
libc_common_src_files := \
$(syscall_src) \
unistd/abort.c \
unistd/alarm.c \
unistd/brk.c \
unistd/creat.c \
unistd/daemon.c \
unistd/exec.c \
unistd/fcntl.c \
unistd/fnmatch.c \
unistd/ftime.c \
unistd/ftok.c \
unistd/getcwd.c \
unistd/getdtablesize.c \
unistd/gethostname.c \
unistd/getopt_long.c \
unistd/getpgrp.c \
unistd/getpriority.c \
unistd/getpt.c \
unistd/initgroups.c \
unistd/isatty.c \
unistd/issetugid.c \
unistd/killpg.c \
unistd/lseek64.c \
unistd/mmap.c \
unistd/nice.c \
unistd/open.c \
unistd/openat.c \
unistd/opendir.c \
unistd/pathconf.c \
unistd/perror.c \
unistd/popen.c \
unistd/pread.c \
unistd/pselect.c \
unistd/ptsname.c \
unistd/ptsname_r.c \
unistd/pwrite.c \
unistd/raise.c \
unistd/reboot.c \
unistd/recv.c \
unistd/sbrk.c \
unistd/send.c \
unistd/setegid.c \
unistd/setuid.c \
unistd/seteuid.c \
unistd/setreuid.c \
unistd/setresuid.c \
unistd/setpgrp.c \
unistd/sigblock.c \
unistd/siginterrupt.c \
unistd/siglist.c \
unistd/signal.c \
unistd/signame.c \
unistd/sigsetmask.c \
unistd/sigsuspend.c \
unistd/sigwait.c \
unistd/sleep.c \
unistd/statfs.c \
unistd/strsignal.c \
unistd/sysconf.c \
unistd/syslog.c \
unistd/system.c \
unistd/tcgetpgrp.c \
unistd/tcsetpgrp.c \
unistd/time.c \
unistd/umount.c \
unistd/unlockpt.c \
unistd/usleep.c \
unistd/wait.c \
stdio/asprintf.c \
stdio/clrerr.c \
stdio/fclose.c \
stdio/fdopen.c \
stdio/feof.c \
stdio/ferror.c \
stdio/fflush.c \
stdio/fgetc.c \
stdio/fgetln.c \
stdio/fgetpos.c \
stdio/fgets.c \
stdio/fileno.c \
stdio/findfp.c \
stdio/flags.c \
stdio/flockfile.c \
stdio/fopen.c \
stdio/fprintf.c \
stdio/fpurge.c \
stdio/fputc.c \
stdio/fputs.c \
stdio/fread.c \
stdio/freopen.c \
stdio/fscanf.c \
stdio/fseek.c \
stdio/fsetpos.c \
stdio/ftell.c \
stdio/funopen.c \
stdio/fvwrite.c \
stdio/fwalk.c \
stdio/fwrite.c \
stdio/getc.c \
stdio/getchar.c \
stdio/gets.c \
stdio/makebuf.c \
stdio/mktemp.c \
stdio/printf.c \
stdio/putc.c \
stdio/putchar.c \
stdio/puts.c \
stdio/putw.c \
stdio/refill.c \
stdio/remove.c \
stdio/rewind.c \
stdio/rget.c \
stdio/scanf.c \
stdio/setbuf.c \
stdio/setbuffer.c \
stdio/setvbuf.c \
stdio/snprintf.c\
stdio/sprintf.c \
stdio/sscanf.c \
stdio/stdio.c \
stdio/tempnam.c \
stdio/tmpfile.c \
stdio/tmpnam.c \
stdio/ungetc.c \
stdio/vasprintf.c \
stdio/vfprintf.c \
stdio/vfscanf.c \
stdio/vprintf.c \
stdio/vsnprintf.c \
stdio/vsprintf.c \
stdio/vscanf.c \
stdio/vsscanf.c \
stdio/wbuf.c \
stdio/wsetup.c \
stdlib/rand.c \
stdlib/assert.c \
stdlib/atexit.c \
stdlib/atoi.c \
stdlib/atol.c \
stdlib/atoll.c \
stdlib/bsearch.c \
stdlib/ctype_.c \
stdlib/div.c \
stdlib/exit.c \
stdlib/getenv.c \
stdlib/ldiv.c \
stdlib/lldiv.c \
stdlib/locale.c \
stdlib/putenv.c \
stdlib/qsort.c \
stdlib/setenv.c \
stdlib/setjmperr.c \
stdlib/strntoimax.c \
stdlib/strntoumax.c \
stdlib/strtod.c \
stdlib/strtoimax.c \
stdlib/strtol.c \
stdlib/strtoll.c \
stdlib/strtoul.c \
stdlib/strtoull.c \
stdlib/strtoumax.c \
stdlib/tolower_.c \
stdlib/toupper_.c \
stdlib/wchar.c \
string/index.c \
string/memccpy.c \
string/memchr.c \
string/memmem.c \
string/memrchr.c \
string/memswap.c \
string/strcasecmp.c \
string/strcasestr.c \
string/strcat.c \
string/strchr.c \
string/strcoll.c \
string/strcpy.c \
string/strcspn.c \
string/strdup.c \
string/strerror.c \
string/strerror_r.c \
string/strlcat.c \
string/strlcpy.c \
string/strncat.c \
string/strncpy.c \
string/strndup.c \
string/strnlen.c \
string/strpbrk.c \
string/strrchr.c \
string/strsep.c \
string/strspn.c \
string/strstr.c \
string/strtok.c \
string/strtotimeval.c \
string/strxfrm.c \
inet/bindresvport.c \
inet/inet_addr.c \
inet/inet_aton.c \
inet/inet_ntoa.c \
inet/inet_ntop.c \
inet/inet_pton.c \
inet/ether_aton.c \
inet/ether_ntoa.c \
tzcode/asctime.c \
tzcode/difftime.c \
tzcode/localtime.c \
tzcode/strftime.c \
tzcode/strptime.c \
bionic/__errno.c \
bionic/__set_errno.c \
bionic/cpuacct.c \
bionic/arc4random.c \
bionic/basename.c \
bionic/basename_r.c \
bionic/clearenv.c \
bionic/dirname.c \
bionic/dirname_r.c \
bionic/err.c \
bionic/fdprintf.c \
bionic/fork.c \
bionic/fts.c \
bionic/if_nametoindex.c \
bionic/if_indextoname.c \
bionic/ioctl.c \
bionic/ldexp.c \
bionic/libc_init_common.c \
bionic/logd_write.c \
bionic/md5.c \
bionic/pututline.c \
bionic/realpath.c \
bionic/semaphore.c \
bionic/sha1.c \
bionic/ssp.c \
bionic/stubs.c \
bionic/system_properties.c \
bionic/time64.c \
bionic/thread_atexit.c \
bionic/utime.c \
bionic/utmp.c \
netbsd/gethnamaddr.c \
netbsd/isc/ev_timers.c \
netbsd/isc/ev_streams.c \
netbsd/inet/nsap_addr.c \
netbsd/resolv/__dn_comp.c \
netbsd/resolv/__res_close.c \
netbsd/resolv/__res_send.c \
netbsd/resolv/herror.c \
netbsd/resolv/res_comp.c \
netbsd/resolv/res_data.c \
netbsd/resolv/res_debug.c \
netbsd/resolv/res_init.c \
netbsd/resolv/res_mkquery.c \
netbsd/resolv/res_query.c \
netbsd/resolv/res_send.c \
netbsd/resolv/res_state.c \
netbsd/resolv/res_cache.c \
netbsd/net/nsdispatch.c \
netbsd/net/getaddrinfo.c \
netbsd/net/getnameinfo.c \
netbsd/net/getservbyname.c \
netbsd/net/getservent.c \
netbsd/net/base64.c \
netbsd/net/getservbyport.c \
netbsd/nameser/ns_name.c \
netbsd/nameser/ns_parse.c \
netbsd/nameser/ns_ttl.c \
netbsd/nameser/ns_netint.c \
netbsd/nameser/ns_print.c \
netbsd/nameser/ns_samedomain.c \
regex/regcomp.c \
regex/regerror.c \
regex/regexec.c \
regex/regfree.c \
# Architecture specific source files go here
# =========================================================
ifeq ($(TARGET_ARCH),arm)
libc_common_src_files += \
bionic/bionic_clone.c \
arch-arm/bionic/__get_pc.S \
arch-arm/bionic/__get_sp.S \
arch-arm/bionic/_exit_with_stack_teardown.S \
arch-arm/bionic/_setjmp.S \
arch-arm/bionic/atomics_arm.S \
arch-arm/bionic/clone.S \
arch-arm/bionic/eabi.c \
arch-arm/bionic/ffs.S \
arch-arm/bionic/kill.S \
arch-arm/bionic/libgcc_compat.c \
arch-arm/bionic/tkill.S \
arch-arm/bionic/memcmp.S \
arch-arm/bionic/memcmp16.S \
arch-arm/bionic/memcpy.S \
arch-arm/bionic/memset.S \
arch-arm/bionic/setjmp.S \
arch-arm/bionic/sigsetjmp.S \
arch-arm/bionic/strlen.c.arm \
arch-arm/bionic/syscall.S \
arch-arm/bionic/sigaction.c \
arch-arm/bionic/__sig_restorer.S \
string/memmove.c.arm \
string/bcopy.c \
string/strcmp.c \
string/strncmp.c \
unistd/socketcalls.c
# These files need to be arm so that gdbserver
# can set breakpoints in them without messing
# up any thumb code.
libc_common_src_files += \
bionic/pthread.c.arm \
bionic/pthread-atfork.c.arm \
bionic/pthread-timers.c.arm \
bionic/ptrace.c.arm
# these are used by the static and dynamic versions of the libc
# respectively
libc_arch_static_src_files := \
arch-arm/bionic/exidx_static.c
libc_arch_dynamic_src_files := \
arch-arm/bionic/exidx_dynamic.c
else # !arm
ifeq ($(TARGET_ARCH),x86)
libc_common_src_files += \
arch-x86/bionic/__get_sp.S \
arch-x86/bionic/__get_tls.c \
arch-x86/bionic/__set_tls.c \
arch-x86/bionic/atomics_x86.S \
arch-x86/bionic/clone.S \
arch-x86/bionic/_exit_with_stack_teardown.S \
arch-x86/bionic/setjmp.S \
arch-x86/bionic/_setjmp.S \
arch-x86/bionic/vfork.S \
arch-x86/bionic/syscall.S \
arch-x86/string/bcopy_wrapper.S \
arch-x86/string/memcpy_wrapper.S \
arch-x86/string/memmove_wrapper.S \
arch-x86/string/bzero_wrapper.S \
arch-x86/string/memcmp_wrapper.S \
arch-x86/string/memset_wrapper.S \
arch-x86/string/strcmp_wrapper.S \
arch-x86/string/strncmp_wrapper.S \
arch-x86/string/strlen.S \
bionic/pthread.c \
bionic/pthread-atfork.c \
bionic/pthread-timers.c \
bionic/ptrace.c
# this is needed for static versions of libc
libc_arch_static_src_files := \
arch-x86/bionic/dl_iterate_phdr_static.c
libc_arch_dynamic_src_files :=
else # !x86
ifeq ($(TARGET_ARCH),sh)
libc_common_src_files += \
arch-sh/bionic/__get_pc.S \
arch-sh/bionic/__get_sp.S \
arch-sh/bionic/_exit_with_stack_teardown.S \
arch-sh/bionic/_setjmp.S \
arch-sh/bionic/atomics_sh.c \
arch-sh/bionic/atomic_cmpxchg.S \
arch-sh/bionic/clone.S \
arch-sh/bionic/pipe.S \
arch-sh/bionic/memcpy.S \
arch-sh/bionic/memset.S \
arch-sh/bionic/bzero.S \
arch-sh/bionic/setjmp.S \
arch-sh/bionic/sigsetjmp.S \
arch-sh/bionic/syscall.S \
arch-sh/bionic/memmove.S \
arch-sh/bionic/__set_tls.c \
arch-sh/bionic/__get_tls.c \
arch-sh/bionic/ffs.S \
string/bcopy.c \
string/strcmp.c \
string/strncmp.c \
string/memcmp.c \
string/strlen.c \
bionic/pthread.c \
bionic/pthread-atfork.c \
bionic/pthread-timers.c \
bionic/ptrace.c \
unistd/socketcalls.c
endif # sh
endif # !x86
endif # !arm
# Define some common cflags
# ========================================================
libc_common_cflags := \
-DWITH_ERRLIST \
-DANDROID_CHANGES \
-DUSE_LOCKS \
-DREALLOC_ZERO_BYTES_FREES \
-D_LIBC=1 \
-DSOFTFLOAT \
-DFLOATING_POINT \
-DNEED_PSELECT=1 \
-DINET6 \
-I$(LOCAL_PATH)/private \
-DUSE_DL_PREFIX \
-DPOSIX_MISTAKE
# these macro definitions are required to implement the
# 'timezone' and 'daylight' global variables, as well as
# properly update the 'tm_gmtoff' field in 'struct tm'.
#
libc_common_cflags += \
-DTM_GMTOFF=tm_gmtoff \
-DUSG_COMPAT=1
ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true)
libc_common_cflags += -DDEBUG
endif
ifeq ($(TARGET_ARCH),arm)
libc_common_cflags += -fstrict-aliasing
libc_crt_target_cflags := -mthumb-interwork
#
# Define HAVE_ARM_TLS_REGISTER macro to indicate to the C library
# that it should access the hardware TLS register directly in
# private/bionic_tls.h
#
# The value must match your kernel configuration
#
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
endif
else # !arm
ifeq ($(TARGET_ARCH),x86)
libc_crt_target_cflags := -m32
# Enable recent IA friendly memory routines (such as for Atom)
# These will not work on the earlier x86 machines
libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
endif # x86
endif # !arm
# Define some common includes
# ========================================================
libc_common_c_includes := \
$(LOCAL_PATH)/stdlib \
$(LOCAL_PATH)/string \
$(LOCAL_PATH)/stdio
# Needed to access private/__dso_handle.S from
# crtbegin_xxx.S and crtend_xxx.S
#
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
# Define the libc run-time (crt) support object files that must be built,
# which are needed to build all other objects (shared/static libs and
# executables)
# ==========================================================================
ifneq ($(filter arm x86,$(TARGET_ARCH)),)
# ARM and x86 need crtbegin_so/crtend_so.
#
# For x86, the .init section must point to a function that calls all
# entries in the .ctors section. (on ARM this is done through the
# .init_array section instead).
#
# For both platforms, the .fini_array section must point to a function
# that will call __cxa_finalize(&__dso_handle) in order to ensure that
# static C++ destructors are properly called on dlclose().
#
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
@mkdir -p $(dir $@)
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
ALL_GENERATED_SOURCES += $(GEN)
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
@mkdir -p $(dir $@)
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
ALL_GENERATED_SOURCES += $(GEN)
endif # TARGET_ARCH == x86
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_static.o
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_static.S
@mkdir -p $(dir $@)
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
ALL_GENERATED_SOURCES += $(GEN)
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_dynamic.o
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_dynamic.S
@mkdir -p $(dir $@)
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
ALL_GENERATED_SOURCES += $(GEN)
# We rename crtend.o to crtend_android.o to avoid a
# name clash between gcc and bionic.
GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_android.o
$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend.S
@mkdir -p $(dir $@)
$(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
ALL_GENERATED_SOURCES += $(GEN)
# To enable malloc leak check for statically linked programs, add
# "WITH_MALLOC_CHECK_LIBC_A := true" to buildspec.mk
WITH_MALLOC_CHECK_LIBC_A := $(strip $(WITH_MALLOC_CHECK_LIBC_A))
# ========================================================
# libc_common.a
# ========================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_common_src_files)
LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc_nomalloc.a
# ========================================================
#
# This is a version of the static C library that does not
# include malloc. It's useful in situations when calling
# the user wants to provide their own malloc implementation,
# or wants to explicitly disallow the use of the use of malloc,
# like the dynamic loader.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(libc_arch_static_src_files) \
bionic/libc_init_static.c
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_MODULE := libc_nomalloc
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc.a
# ========================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(libc_arch_static_src_files) \
bionic/dlmalloc.c \
bionic/malloc_debug_common.c \
bionic/libc_init_static.c
LOCAL_CFLAGS := $(libc_common_cflags) \
-DLIBC_STATIC
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc.so
# ========================================================
include $(CLEAR_VARS)
LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
$(libc_arch_dynamic_src_files) \
bionic/dlmalloc.c \
bionic/malloc_debug_common.c \
bionic/libc_init_dynamic.c
LOCAL_MODULE:= libc
# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
# external; if that were the case, then libc would not pull those symbols from libgcc.a as it
# should, instead relying on the external symbols from the dependent libraries. That would
# create an "cloaked" dependency on libgcc.a in libc though the libraries, which is not what
# you wanted!
LOCAL_SHARED_LIBRARIES := libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
include $(BUILD_SHARED_LIBRARY)
# For all builds, except for the -user build we will enable memory
# allocation checking (including memory leaks, buffer overwrites, etc.)
# Note that all these checks are also controlled by env. settings
# that can enable, or disable specific checks. Note also that some of
# the checks are available only in emulator and are implemeted in
# libc_malloc_qemu_instrumented.so.
ifneq ($(TARGET_BUILD_VARIANT),user)
# ========================================================
# libc_malloc_debug_leak.so
# ========================================================
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
-DMALLOC_LEAK_CHECK
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
bionic/malloc_debug_leak.c
LOCAL_MODULE:= libc_malloc_debug_leak
LOCAL_SHARED_LIBRARIES := libc
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
# Don't prelink
LOCAL_PRELINK_MODULE := false
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
include $(BUILD_SHARED_LIBRARY)
# ========================================================
# libc_malloc_debug_qemu.so
# ========================================================
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
-DMALLOC_QEMU_INSTRUMENT
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
bionic/malloc_debug_qemu.c
LOCAL_MODULE:= libc_malloc_debug_qemu
LOCAL_SHARED_LIBRARIES := libc
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Don't prelink
LOCAL_PRELINK_MODULE := false
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
include $(BUILD_SHARED_LIBRARY)
endif #!user
# ========================================================
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@ -0,0 +1,26 @@
Bionic is a very small C library because we have decided to *not* implement various features
of the POSIX standard. we only add functions on a as-needed basis, and there are a few things
we wish we'll never put in there.
this file is here to document explicitely what we don't want to support in Bionic:
- C++ exceptions are not supported. on embedded systems, they lead to extremely larger and
slower code for no good reason (even when so-called zero-cost exception schemes are
implemented, they enforce very large numbers of registers spills to the stack, even
in functions that do not throw an exception themselves).
- pthread cancellation is *not* supported. this seemingly simple "feature" is the source
of much bloat and complexity in a C library. Besides, you'd better write correct
multi-threaded code instead of relying on this stuff.
- pthread_once() doesn't support C++ exceptions thrown from the init function, or the init
function doing a fork().
- locales and wide characters are not supported. we use ICU for all this i18n stuff, which
is much better than the ill-designed related C libraries functions.
- at the moment, several user-account-related functions like getpwd are stubbed and return
the values corresponding to root. this will be fixed when we'll be able to have distinct
users on the Android filesystem. :-(
see bionic/stubs.c for the details

View File

@ -0,0 +1,441 @@
# This file is used to build the Bionic library with the Jam build
# tool. For info, see www.perforce.com/jam/jam.html
#
BIONIC_TOP ?= $(DOT) ;
DEBUG = 1 ;
# pattern used for automatic heade inclusion detection
HDRPATTERN = "^[ ]*#[ ]*include[ ]*[<\"]([^\">]*)[\">].*$" ;
# debugging support, simply define the DEBUG variable to activate verbose output
rule Debug
{
if $(DEBUG) {
Echo $(1) ;
}
}
# return all elements from $(1) that are not in $(2)
rule Filter list : filter
{
local result = ;
local item ;
for item in $(list) {
if ! $(item) in $(filter) {
result += $(item) ;
}
}
return $(result) ;
}
# reverse a list of elements
rule Reverse list
{
local result = ;
local item ;
for item in $(list) {
result = $(item) $(result) ;
}
return $(result) ;
}
# decompose a path into a list of elements
rule PathDecompose dir
{
local result ;
while $(dir:D)
{
if ! $(dir:BS) { # for rooted paths like "/foo"
break ;
}
result = $(dir:BS) $(result) ;
dir = $(dir:D) ;
}
result = $(dir) $(result) ;
return $(result) ;
}
# simply a file path, i.e. get rid of . or .. when possible
rule _PathSimplify dir
{
local result = ;
local dir2 d ;
dir = [ PathDecompose $(dir) ] ;
# get rid of any single dot
dir2 = ;
for d in $(dir) {
if $(d) = "." {
continue ;
}
dir2 += $(d) ;
}
# get rid of .. when possible
for d in $(dir2) {
if $(d) = ".." && $(result) {
result = $(result[2-]) ;
}
else
result = $(d) $(result) ;
}
# now invert the result
result = [ Reverse $(result) ] ;
if ! $(result) {
result = "." ;
}
return $(result:J="/") ;
}
rule PathSimplify dirs
{
local result ;
local d ;
for d in $(dirs) {
result += [ _PathSimplify $(d) ] ;
}
return $(result) ;
}
# retrieve list of subdirectories
rule ListSubDirs paths
{
local result = ;
local entry ;
for entry in [ Glob $(paths) : * ] {
if ! $(entry:S) {
result += $(entry) ;
}
}
return [ PathSimplify $(result) ] ;
}
# retrieve list of sources in a given directory
rule ListSources path
{
return [ Glob $(path) : *.S *.c ] ;
}
# find the prebuilt directory
#
if ! $(TOP) {
Echo "Please define TOP as the root of your device build tree" ;
Exit ;
}
Debug "OS is" $(OS) ;
Debug "CPU is" $(CPU) ;
if $(OS) = LINUX
{
PREBUILT = $(TOP)/prebuilt/Linux ;
}
else if $(OS) = MACOSX
{
switch $(CPU) {
case i386 : PREBUILT = $(TOP)/prebuilt/darwin-x86 ; break ;
case ppc : PREBUILT = $(TOP)/prebuilt/darwin-ppc ; break ;
case * : Echo "unsupported CPU" "$(CPU) !!" ;
Echo "Please contact digit@google.com for help" ;
Exit ;
}
}
else
{
Echo "Unsupported operating system" $(OS) ;
Echo "Please contact digit@google.com for help" ;
Exit ;
}
Debug "TOP is" $(TOP) ;
Debug "PREBUILT is" $(PREBUILT) ;
# check architectures and setup toolchain variables
#
SUPPORTED_ARCHS = x86 arm ;
ARCH ?= $(SUPPORTED_ARCHS) ;
if ! $(ARCH) in $(SUPPORTED_ARCHS) {
Echo "The variable ARCH contains an unsupported value, use one or more of these instead" ;
Echo "separated by spaces:" $(SUPPORTED_ARCHS) ;
Exit ;
}
x86_TOOLSET_PREFIX ?= "" ;
arm_TOOLSET_PREFIX ?= $(TOP)/prebuilt/Linux/toolchain-4.1.1/bin/arm-elf- ;
for arch in $(ARCH) {
CC_$(arch) = $($(arch)_TOOLSET_PREFIX)gcc ;
C++_$(arch) = $($(arch)_TOOLSET_PREFIX)g++ ;
AR_$(arch) = $($(arch)_TOOLSET_PREFIX)ar ;
}
# the list of arch-independent source subdirectories
BIONIC_SRC_SUBDIRS = string ;
BIONIC_x86_SUBDIRS = ;
BIONIC_arm_SUBDIRS = ;
CFLAGS = -O0 -g -W ;
# find sources in a given list of subdirectories
rule FindSources dirs
{
local dir ;
for dir in $(dirs)
{
local LOCAL_SRC NO_LOCAL_SRC ;
if [ Glob $(dir) : rules.jam ] {
include $(dir)/rules.jam ;
if $(LOCAL_SRC) {
_sources = $(LOCAL_SRC) ;
}
else {
_sources = [ Glob $(dir) : *.S *.c ] ;
_sources = $(_sources:BS) ;
}
if $(NO_LOCAL_SRC) {
_sources = [ Filter $(_sources) : $(NO_LOCAL_SRC) ] ;
}
sources += $(dir)/$(_sources) ;
}
else
sources += [ ListSources $(dir) ] ;
}
}
# Compile a given object file from a source
rule Compile object : source
{
Depends $(object) : $(source) ;
Depends bionic : $(object) ;
Clean clean : $(object) ;
MakeLocate $(object) : $(OUT) ;
CC on $(object) = $(CC_$(arch)) ;
CFLAGS on $(object) = $(CFLAGS) ;
INCLUDES on $(object) = $(INCLUDES) ;
DEFINES on $(object) = $(DEFINES) ;
HDRRULE on $(>) = HdrRule ;
HDRSCAN on $(>) = $(HDRPATTERN) ;
HDRSEARCH on $(>) = $(INCLUDES) ;
HDRGRIST on $(>) = $(HDRGRIST) ;
}
actions Compile
{
$(CC) -c -o $(1) $(CFLAGS) -I$(INCLUDES) -D$(DEFINES) $(2)
}
rule RmTemps
{
Temporary $(2) ;
}
actions quietly updated piecemeal together RmTemps
{
rm -f $(2)
}
actions Archive
{
$(AR) ru $(1) $(2)
}
rule Library library : objects
{
local obj ;
if ! $(library:S) {
library = $(library:S=.a) ;
}
library = $(library:G=<$(arch)>) ;
Depends all : $(library) ;
if ! $(library:D) {
MakeLocate $(library) $(library)($(objects:BS)) : $(OUT) ;
}
Depends $(library) : $(library)($(objects:BS)) ;
for obj in $(objects) {
Depends $(library)($(obj:BS)) : $(obj) ;
}
Clean clean : $(library) ;
AR on $(library) = $(AR_$(arch)) ;
Archive $(library) : $(objects) ;
RmTemps $(library) : $(objects) ;
}
rule ProcessDir
{
local CFLAGS = $(CFLAGS) ;
local DEFINES = $(DEFINES) ;
local INCLUDES = $(INCLUDES) ;
local local_rules = [ Glob $(1) : rules.jam ] ;
local source sources ;
if $(local_rules) {
local LOCAL_CFLAGS LOCAL_DEFINES LOCAL_INCLUDES LOCAL_SRC NO_LOCAL_SRC ;
include $(local_rules) ;
CFLAGS += $(LOCAL_CFLAGS) ;
DEFINES += $(LOCAL_DEFINES) ;
INCLUDES += $(LOCAL_INCLUDES) ;
if $(LOCAL_SRC) {
sources = $(LOCAL_SRC) ;
}
else {
sources = [ Glob $(1) : *.S *.c ] ;
sources = $(sources:BS) ;
}
if $(NO_LOCAL_SRC) {
sources = [ Filter $(sources) : $(NO_LOCAL_SRC) ] ;
}
sources = $(1)/$(sources) ;
}
else
sources = [ Glob $(1) : *.S *.c ] ;
for source in $(sources) {
local name = $(source:B) ;
if $(source:S) = ".S" {
# record the list of assembler sources
ASSEMBLER_SOURCES += $(name) ;
}
else if $(source:S) = ".c" && $(name) in $(ASSEMBLER_SOURCES) {
# skip C source file if corresponding assembler exists
continue ;
}
objname = <$(arch)>$(name).o ;
Compile $(objname) : $(source) ;
ALL_OBJECTS += $(objname) ;
}
}
rule ProcessDirs
{
local dir ;
for dir in $(1) {
ProcessDir $(dir) ;
}
}
INCLUDES_x86 = /usr/src/linux/include ;
INCLUDES_arm = ../kernel_headers
include/arch/arm
include/bits32
;
INCLUDES = include stdio string stdlib .
../msun/include
;
DEFINES = USE_LOCKS
ANDROID_CHANGES
REALLOC_ZERO_BYTES_FREES
_LIBC=1
SOFTFLOAT
FLOATING_POINT
NEED_PSELECT=1
ANDROID
;
CFLAGS_x86 = -Iprivate -Ibionic -Ikernel/arch-x86 -Ikernel/common -I../libm/include -fno-stack-protector -fno-pie -DPIC -ffreestanding -fno-tree-scev-cprop ;
for arch in $(ARCH)
{
local ARCH_DIR = $(BIONIC_TOP)/arch-$(arch) ;
local INCLUDES = $(INCLUDES_$(arch)) $(ARCH_DIR)/include $(INCLUDES) ;
local DEFINES = $(DEFINES_$(arch)) $(DEFINES) ARCH=$(arch) ;
local CFLAGS = $(CFLAGS) $(CFLAGS_$(arch)) ;
local OUT = out/$(arch) ;
local ASSEMBLER_SOURCES ALL_OBJECTS ;
ProcessDirs [ ListSubDirs $(ARCH_DIR) ] ;
ProcessDirs stdlib stdio unistd string tzcode inet ;
ProcessDirs [ ListSubDirs netbsd ] ;
ProcessDirs bionic ;
Library bionic : $(ALL_OBJECTS) ;
}
BIONIC_SEARCH = $(BIONIC_TOP)/include ;
# /HdrRule source : headers ;
#
# Arranges the proper dependencies when the file _source_ includes the files
# _headers_ through the #include C preprocessor directive
#
# this rule is not intendend to be called explicitely. It is called
# automatically during header scanning on sources handled by the @Object
# rule (e.g. sources in @Main or @Library rules)
#
rule HdrRule
{
# HdrRule source : headers ;
# N.B. This rule is called during binding, potentially after
# the fate of many targets has been determined, and must be
# used with caution: don't add dependencies to unrelated
# targets, and don't set variables on $(<).
# Tell Jam that anything depending on $(<) also depends on $(>),
# set SEARCH so Jam can find the headers, but then say we don't
# care if we can't actually find the headers (they may have been
# within ifdefs),
local s = $(>:G=$(HDRGRIST:E)) ;
Includes $(<) : $(s) ;
SEARCH on $(s) = $(HDRSEARCH) ;
NoCare $(s) ;
# Propagate on $(<) to $(>)
HDRSEARCH on $(s) = $(HDRSEARCH) ;
HDRSCAN on $(s) = $(HDRSCAN) ;
HDRRULE on $(s) = $(HDRRULE) ;
HDRGRIST on $(s) = $(HDRGRIST) ;
}

View File

@ -0,0 +1,382 @@
Copyright (c) 2005-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.
* Neither the name of The Android Open Source Project 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.
Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
Copyright (c) 1995,1996,1999 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Portions Copyright (c) 1995 by International Business Machines, Inc.
International Business Machines, Inc. (hereinafter called IBM) grants
permission under its copyrights to use, copy, modify, and distribute this
Software with or without fee, provided that the above copyright notice and
all paragraphs of this notice appear in all copies, and that the name of IBM
not be used in connection with the marketing of any product incorporating
the Software or modifications thereof, without specific, written prior
permission.
To the extent it has a right to do so, IBM grants an immunity from suit
under its patents, if any, for the use, sale or manufacture of products to
the extent that such products are used for performing Domain Name System
dynamic updates in TCP/IP networks by means of the Software. No immunity is
granted for any product per se or for any other function of any product.
THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
Copyright (c) 1997, 1998, 1999, 2004 The NetBSD Foundation, Inc.
All rights reserved.
This code is derived from software contributed to The NetBSD Foundation
by Luke Mewburn; and by Jason R. Thorpe.
This code is derived from software contributed to The NetBSD Foundation
by Christos Zoulas.
Copyright (c) 1993 Christopher G. Demetriou
Copyright (c) 1983, 1985, 1993 The Regents of the University of California. All rights reserved.
Copyright (c) 2000 Ben Harris.
Copyright (C) 1995, 1996, 1997, and 1998 WIDE 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:
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.
3. Neither the name of the project 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 PROJECT 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 PROJECT 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.
Copyright (c) 2003 Networks Associates Technology, Inc.
All rights reserved.
Portions of this software were developed for the FreeBSD Project by
Jacques A. Vidrine, Safeport Network Services, and Network
Associates Laboratories, the Security Research Division of Network
Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
("CBOSS"), as part of the DARPA CHATS research program.
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.
Portions Copyright (c) 1993 by Digital Equipment Corporation.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies, and that
the name of Digital Equipment Corporation not be used in advertising or
publicity pertaining to distribution of the document or software without
specific, written prior permission.
THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
Copyright (c) 1997 Mark Brinicombe
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.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Mark Brinicombe
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE 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.
Copyright (c) 1993 Martin Birgmeier
All rights reserved.
You may redistribute unmodified or modified versions of this source
code provided that the above copyright notice and this and the
following conditions are retained.
This software is provided ``as is'', and comes with no warranties
of any kind. I shall in no event be liable for anything that happens
to anyone/anything when using this software.
Arc4 random number generator for OpenBSD.
Copyright 1996 David Mazieres <dm@lcs.mit.edu>.
Modification and redistribution in source and binary forms is
permitted provided that due credit is given to the author and the
OpenBSD project by leaving this copyright notice intact.
Copyright (c) 1999 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
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.
3. Neither the name of KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
====================================================
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
====================================================
Copyright (c) 1997, 2005 Todd C. Miller <Todd.Miller@courtesan.com>
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Copyright (c) 1989, 1993
The Regents of the University of California. All rights reserved.
(c) UNIX System Laboratories, Inc.
All or some portions of this file are derived from material licensed
to the University of California by American Telephone and Telegraph
Co. or Unix System Laboratories, Inc. and are reproduced herein with
the permission of UNIX System Laboratories, Inc.
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.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Copyright (c) 1995, 1996 Carnegie-Mellon University.
All rights reserved.
Author: Chris G. Demetriou
Permission to use, copy, modify and distribute this software and
its documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation.
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Carnegie Mellon requests users of this software to return to
Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
School of Computer Science
Carnegie Mellon University
Pittsburgh PA 15213-3890
any improvements or extensions that they make and grant Carnegie the
rights to redistribute these changes.
Copyright (c) 1995, 1996 Carnegie-Mellon University.
All rights reserved.
Author: Chris G. Demetriou
Permission to use, copy, modify and distribute this software and
its documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation.
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Carnegie Mellon requests users of this software to return to
Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
School of Computer Science
Carnegie Mellon University
Pittsburgh PA 15213-3890
any improvements or extensions that they make and grant Carnegie the
rights to redistribute these changes.
Copyright (c) 2003 Networks Associates Technology, Inc.
All rights reserved.
Portions of this software were developed for the FreeBSD Project by
Jacques A. Vidrine, Safeport Network Services, and Network
Associates Laboratories, the Security Research Division of Network
Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
("CBOSS"), as part of the DARPA CHATS research program.
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.

View File

@ -0,0 +1,54 @@
Welcome to Bionic, Android's small and custom C library for the Android
platform.
Bionic is mainly a port of the BSD C library to our Linux kernel with the
following additions/changes:
- no support for locales
- no support for wide chars (i.e. multi-byte characters)
- its own smallish implementation of pthreads based on Linux futexes
- support for x86, ARM and ARM thumb CPU instruction sets and kernel interfaces
Bionic is released under the standard 3-clause BSD License
Bionic doesn't want to implement all features of a traditional C library, we only
add features to it as we need them, and we try to keep things as simple and small
as possible. Our goal is not to support scaling to thousands of concurrent threads
on multi-processors machines; we're running this on cell-phones, damnit !!
Note that Bionic doesn't provide a libthread_db or a libm implementation.
Adding new syscalls:
====================
Bionic provides the gensyscalls.py Python script to automatically generate syscall
stubs from the list defined in the file SYSCALLS.TXT. You can thus add a new syscall
by doing the following:
- edit SYSCALLS.TXT
- add a new line describing your syscall, it should look like:
return_type syscall_name(parameters) syscall_number
- in the event where you want to differentiate the syscall function from its entry name,
use the alternate:
return_type funcname:syscall_name(parameters) syscall_number
- additionally, if the syscall number is different between ARM and x86, use:
return_type funcname[:syscall_name](parameters) arm_number,x86_number
- a syscall number can be -1 to indicate that the syscall is not implemented on
a given platform, for example:
void __set_tls(void*) arm_number,-1
the comments in SYSCALLS.TXT contain more information about the line format
You can also use the 'checksyscalls.py' script to check that all the syscall
numbers you entered are correct. It does so by looking at the values defined in
your Linux kernel headers. The script indicates where the values are incorrect
and what is expected instead.

View File

@ -0,0 +1,264 @@
# this file is used to list all the syscalls that will be supported by
# the Bionic C library. It is used to automatically generate the syscall
# stubs, the list of syscall constants (__NR_xxxx) and the content of <linux/_unitsd.h>
#
# each non comment line has the following format:
#
# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (#syscall_number|stub)
#
# note that:
# - syscall_name correspond to the name of the syscall, which may differ from
# the exported function name (example: the exit syscall is implemented by the _exit()
# function, which is not the same as the standard C exit() function which calls it)
# The call_id parameter, given that func_name and syscall_name have
# been provided, allows the user to specify dispatch style syscalls.
# For example, socket() syscall on i386 actually becomes:
# socketcall(__NR_socket, 1, *(rest of args on stack)).
#
# - each parameter type is assumed to be stored on 32 bits, there is no plan to support
# 64-bit architectures at the moment
#
# - it there is "stub" instead of a syscall number, the tool will not generate any
# assembler template for the syscall; it's up to the bionic implementation to provide
# a relevant C stub
#
# - additionally, if the syscall number is different amoung ARM, x86 and SuperH, use:
# return_type funcname[:syscall_name](parameters) arm_number,x86_number,superh_number
#
# the file is processed by a python script named gensyscalls.py
#
# process management
void _exit:exit_group (int) 248,252
void _exit_thread:exit (int) 1
pid_t __fork:fork (void) 2
pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7
int waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284
# NOTE: this system call is never called directly, but we list it there
# to have __NR_clone properly defined.
#
pid_t __sys_clone:clone (int, void*, int*, void*, int*) 120
int execve (const char*, char* const*, char* const*) 11
int __setuid:setuid32 (uid_t) 213
uid_t getuid:getuid32 () 199
gid_t getgid:getgid32 () 200
uid_t geteuid:geteuid32 () 201
gid_t getegid:getegid32 () 202
uid_t getresuid:getresuid32 () 209
gid_t getresgid:getresgid32 () 211
pid_t gettid() 224
int getgroups:getgroups32(int, gid_t *) 205
pid_t getpgid(pid_t) 132
pid_t getppid() 64
pid_t setsid() 66
int setgid:setgid32(gid_t) 214
int seteuid:seteuid32(uid_t) stub
int __setreuid:setreuid32(uid_t, uid_t) 203
int __setresuid:setresuid32(uid_t, uid_t, uid_t) 208
int setresgid:setresgid32(gid_t, gid_t, gid_t) 210
void* __brk:brk(void*) 45
# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
int kill(pid_t, int) -1,37
int tkill(pid_t tid, int sig) -1,238
int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26
int __set_thread_area:set_thread_area(void* user_desc) -1,243
int __getpriority:getpriority(int, int) 96
int setpriority(int, int, int) 97
int setrlimit(int resource, const struct rlimit *rlp) 75
int getrlimit:ugetrlimit(int resource, struct rlimit *rlp) 191
int getrusage(int who, struct rusage* r_usage) 77
int setgroups:setgroups32(int, const gid_t *) 206
pid_t getpgrp(void) stub
int setpgid(pid_t, pid_t) 57
pid_t vfork(void) 190,-1,190
int setregid:setregid32(gid_t, gid_t) 204
int chroot(const char *) 61
int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 172
int capget(cap_user_header_t header, cap_user_data_t data) 184
int capset(cap_user_header_t header, const cap_user_data_t data) 185
int sigaltstack(const stack_t*, stack_t*) 186
int acct(const char* filepath) 51
# file descriptors
ssize_t read (int, void*, size_t) 3
ssize_t write (int, const void*, size_t) 4
ssize_t __pread64:pread64 (int, void *, size_t, off_t, off_t) 180
ssize_t __pwrite64:pwrite64 (int, void *, size_t, off_t, off_t) 181
int __open:open (const char*, int, mode_t) 5
int __openat:openat (int, const char*, int, mode_t) 322,295
int close (int) 6
int creat(const char*, mode_t) stub
off_t lseek(int, off_t, int) 19
int __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int) 140
pid_t getpid () 20
void * mmap(void *, size_t, int, int, int, long) stub
void * __mmap2:mmap2(void*, size_t, int, int, int, long) 192
int munmap(void *, size_t) 91
void * mremap(void *, size_t, size_t, unsigned long) 163
int msync(const void *, size_t, int) 144
int mprotect(const void *, size_t, int) 125
int madvise(const void *, size_t, int) 220,219
int mlock(const void *addr, size_t len) 150
int munlock(const void *addr, size_t len) 151
int mincore(void* start, size_t length, unsigned char* vec) 219,218
int __ioctl:ioctl(int, int, void *) 54
int readv(int, const struct iovec *, int) 145
int writev(int, const struct iovec *, int) 146
int __fcntl:fcntl(int, int, void*) 55
int flock(int, int) 143
int fchmod(int, mode_t) 94
int dup(int) 41
int pipe(int *) 42,42,-1
int dup2(int, int) 63
int select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *) 142
int ftruncate(int, off_t) 93
int getdents:getdents64(unsigned int, struct dirent *, unsigned int) 217,220
int fsync(int) 118
int fchown:fchown32(int, uid_t, gid_t) 207
void sync(void) 36
int __fcntl64:fcntl64(int, int, void *) 221
int fstatfs:fstatfs64(int, size_t, struct statfs *) 267,269
ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) 187
int fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags) 327,300
int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296
int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 325,298
int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 333,306
int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 329,302
# file system
int link (const char*, const char*) 9
int unlink (const char*) 10
int unlinkat (int, const char *, int) 328,301
int chdir (const char*) 12
int mknod (const char*, mode_t, dev_t) 14
int chmod (const char*,mode_t) 15
int chown:chown32(const char *, uid_t, gid_t) 212
int lchown:lchown32 (const char*, uid_t, gid_t) 198
int mount (const char*, const char*, const char*, unsigned long, const void*) 21
int umount(const char*) stub
int umount2 (const char*, int) 52
int fstat:fstat64(int, struct stat*) 197
int stat:stat64(const char *, struct stat *) 195
int lstat:lstat64(const char *, struct stat *) 196
int mkdir(const char *, mode_t) 39
int readlink(const char *, char *, size_t) 85
int rmdir(const char *) 40
int rename(const char *, const char *) 38
int __getcwd:getcwd(char * buf, size_t size) 183
int access(const char *, int) 33
int symlink(const char *, const char *) 83
int fchdir(int) 133
int truncate(const char*, off_t) 92
int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268
# time
int pause () 29
int gettimeofday(struct timeval*, struct timezone*) 78
int settimeofday(const struct timeval*, const struct timezone*) 79
clock_t times(struct tms *) 43
int nanosleep(const struct timespec *, struct timespec *) 162
int clock_gettime(clockid_t clk_id, struct timespec *tp) 263,265
int clock_settime(clockid_t clk_id, const struct timespec *tp) 262,264
int clock_getres(clockid_t clk_id, struct timespec *res) 264,266
int clock_nanosleep(const struct timespec *req, struct timespec *rem) 265,267
int getitimer(int, const struct itimerval *) 105
int setitimer(int, const struct itimerval *, struct itimerval *) 104
int __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) 257,259
int __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260
int __timer_gettime:timer_gettime(timer_t, struct itimerspec*) 259,261
int __timer_getoverrun:timer_getoverrun(timer_t) 260,262
int __timer_delete:timer_delete(timer_t) 261,263
int utimes(const char*, const struct timeval tvp[2]) 269, 271
# signals
int sigaction(int, const struct sigaction *, struct sigaction *) -1,67,67
int sigprocmask(int, const sigset_t *, sigset_t *) 126
int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72
int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174
int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175
int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177
int sigpending(sigset_t *) 73
# special stub for ARM, see arch-arm/bionic/sigaction.c
int __sigaction:sigaction(int, const struct sigaction *, struct sigaction *) 67,-1,-1
# sockets
int socket(int, int, int) 281,-1
int socketpair(int, int, int, int*) 288,-1
int bind(int, struct sockaddr *, int) 282,-1
int connect(int, struct sockaddr *, socklen_t) 283,-1
int listen(int, int) 284,-1
int accept(int, struct sockaddr *, socklen_t *) 285,-1
int getsockname(int, struct sockaddr *, socklen_t *) 286,-1
int getpeername(int, struct sockaddr *, socklen_t *) 287,-1
int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) 290,-1
int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) 292,-1
int shutdown(int, int) 293,-1
int setsockopt(int, int, int, const void *, socklen_t) 294,-1
int getsockopt(int, int, int, void *, socklen_t *) 295,-1
int sendmsg(int, const struct msghdr *, unsigned int) 296,-1
int recvmsg(int, struct msghdr *, unsigned int) 297,-1
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
int socket:socketcall:1 (int, int, int) -1,102,-1
int bind:socketcall:2 (int, struct sockaddr *, int) -1,102,-1
int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,102,-1
int listen:socketcall:4(int, int) -1,102,-1
int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,102,-1
int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,102,-1
int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,102,-1
int socketpair:socketcall:8(int, int, int, int*) -1,102,-1
int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,102,-1
int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,102,-1
int shutdown:socketcall:13(int, int) -1,102,-1
int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,102,-1
int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,102,-1
int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,102,-1
int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,102,-1
# sockets for sh.
int __socketcall:__socketcall(int, unsigned long*) -1,-1,102
# scheduler & real-time
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) 156
int sched_getscheduler(pid_t pid) 157
int sched_yield(void) 158
int sched_setparam(pid_t pid, const struct sched_param *param) 154
int sched_getparam(pid_t pid, struct sched_param *param) 155
int sched_get_priority_max(int policy) 159
int sched_get_priority_min(int policy) 160
int sched_rr_get_interval(pid_t pid, struct timespec *interval) 161
# io priorities
int ioprio_set(int which, int who, int ioprio) 314,289
int ioprio_get(int which, int who) 315,290
# other
int uname(struct utsname *) 122
pid_t __wait4:wait4(pid_t pid, int *status, int options, struct rusage *rusage) 114
mode_t umask(mode_t) 60
int __reboot:reboot(int, int, int, void *) 88
int __syslog:syslog(int, char *, int) 103
int init_module(void *, unsigned long, const char *) 128
int delete_module(const char*, unsigned int) 129
int klogctl:syslog(int, char *, int) 103
# futex
int futex(void *, int, int, void *, void *, int) 240
# epoll
int epoll_create(int size) 250,254
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 251,255
int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout) 252,256
int inotify_init(void) 316,291,290
int inotify_add_watch(int, const char *, unsigned int) 317,292,291
int inotify_rm_watch(int, unsigned int) 318,293,292
int poll(struct pollfd *, unsigned int, long) 168
# ARM-specific ARM_NR_BASE == 0x0f0000 == 983040
int __set_tls:ARM_set_tls(void*) 983045,-1
int cacheflush:ARM_cacheflush(long start, long end, long flags) 983042,-1

View File

@ -0,0 +1,34 @@
/*
* 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.
*/
.global __get_pc
.type __get_pc, %function
__get_pc:
mov r0, pc
bx lr

View File

@ -0,0 +1,34 @@
/*
* 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.
*/
.global __get_sp
.type __get_sp, %function
__get_sp:
mov r0, sp
bx lr

View File

@ -0,0 +1,7 @@
.global __sig_restorer
/* This is the opcode sequence GDB looks for in order to recognize
this stack frame as a signal trampoline (see sigaction.c) */
__sig_restorer:
mov r7, #119 /* __NR_sigreturn */
swi #0

View File

@ -0,0 +1,55 @@
/*
* 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.
*/
#include <asm/unistd.h>
.text
.type _exit_with_stack_teardown, #function
.globl _exit_with_stack_teardown
.align 4
@ void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode)
_exit_with_stack_teardown:
#if __ARM_EABI__
mov lr, r2
ldr r7, =__NR_munmap
swi #0 @ the stack is destroyed by this call
mov r0, lr
ldr r7, =__NR_exit
swi #0
#else
mov lr, r2
swi # __NR_munmap @ the stack is destroyed by this call
mov r0, lr
swi # __NR_exit
#endif
@ exit() should never return, cause a crash if it does
mov r0, #0
ldr r0, [r0]

View File

@ -0,0 +1,106 @@
/* $OpenBSD: _setjmp.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */
/* $NetBSD: _setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from the last call to
* _setjmp(a)
* by restoring registers from the stack.
* The previous signal state is NOT restored.
*
* Note: r0 is the return value
* r1-r3 are scratch registers in functions
*/
ENTRY(_setjmp)
ldr r1, .L_setjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /* SOFTFLOAT */
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
bx lr
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
ENTRY(_longjmp)
ldr r2, .L_setjmp_magic
ldr r3, [r0], #4
teq r2, r3
bne botch
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore fpsr */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r4-r14}
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
beq botch
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
bx lr
/* validation failed, die die die. */
botch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */

View File

@ -0,0 +1,230 @@
/*
* 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.
*/
#include <sys/linux-syscalls.h>
.global __atomic_cmpxchg
.type __atomic_cmpxchg, %function
.global __atomic_swap
.type __atomic_swap, %function
.global __atomic_dec
.type __atomic_dec, %function
.global __atomic_inc
.type __atomic_inc, %function
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#if 1
.equ kernel_cmpxchg, 0xFFFF0FC0
.equ kernel_atomic_base, 0xFFFF0FFF
__atomic_dec:
.fnstart
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_dec
ldr r0, [r2]
mov r3, #kernel_atomic_base
add lr, pc, #4
sub r1, r0, #1
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcc 1b
add r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
.fnend
__atomic_inc:
.fnstart
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_inc
ldr r0, [r2]
mov r3, #kernel_atomic_base
add lr, pc, #4
add r1, r0, #1
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcc 1b
sub r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
.fnend
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
__atomic_cmpxchg:
.fnstart
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r4, r0 /* r4 = save oldvalue */
1: @ atomic_cmpxchg
mov r3, #kernel_atomic_base
add lr, pc, #4
mov r0, r4 /* r0 = oldvalue */
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcs 2f /* swap was made. we're good, return. */
ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */
cmp r3, r4
beq 1b
2: @ atomic_cmpxchg
ldmia sp!, {r4, lr}
bx lr
.fnend
#else
#define KUSER_CMPXCHG 0xffffffc0
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
__atomic_cmpxchg:
stmdb sp!, {r4, lr}
mov r4, r0 /* r4 = save oldvalue */
1: add lr, pc, #4
mov r0, r4 /* r0 = oldvalue */
mov pc, #KUSER_CMPXCHG
bcs 2f /* swap was made. we're good, return. */
ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */
cmp r3, r4
beq 1b
2: ldmia sp!, {r4, lr}
bx lr
/* r0(addr) -> r0(old) */
__atomic_dec:
stmdb sp!, {r4, lr}
mov r2, r0 /* address */
1: ldr r0, [r2] /* oldvalue */
add lr, pc, #4
sub r1, r0, #1 /* newvalue = oldvalue - 1 */
mov pc, #KUSER_CMPXCHG
bcc 1b /* no swap, try again until we get it right */
mov r0, ip /* swapped, return the old value */
ldmia sp!, {r4, lr}
bx lr
/* r0(addr) -> r0(old) */
__atomic_inc:
stmdb sp!, {r4, lr}
mov r2, r0 /* address */
1: ldr r0, [r2] /* oldvalue */
add lr, pc, #4
add r1, r0, #1 /* newvalue = oldvalue + 1 */
mov pc, #KUSER_CMPXCHG
bcc 1b /* no swap, try again until we get it right */
mov r0, ip /* swapped, return the old value */
ldmia sp!, {r4, lr}
bx lr
#endif
/* r0(new) r1(addr) -> r0(old) */
/* replaced swp instruction with ldrex/strex for ARMv6 & ARMv7 */
__atomic_swap:
#if defined (_ARM_HAVE_LDREX_STREX)
1: ldrex r2, [r1]
strex r3, r0, [r1]
teq r3, #0
bne 1b
mov r0, r2
mcr p15, 0, r0, c7, c10, 5 /* or, use dmb */
#else
swp r0, r0, [r1]
#endif
bx lr
/* __futex_wait(*ftx, val, *timespec) */
/* __futex_wake(*ftx, counter) */
/* __futex_syscall3(*ftx, op, val) */
/* __futex_syscall4(*ftx, op, val, *timespec) */
.global __futex_wait
.type __futex_wait, %function
.global __futex_wake
.type __futex_wake, %function
.global __futex_syscall3
.type __futex_syscall3, %function
.global __futex_syscall4
.type __futex_syscall4, %function
#if __ARM_EABI__
__futex_syscall3:
.fnstart
stmdb sp!, {r4, r7}
.save {r4, r7}
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
.fnend
__futex_wait:
.fnstart
stmdb sp!, {r4, r7}
.save {r4, r7}
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
.fnend
__futex_wake:
stmdb sp!, {r4, r7}
mov r2, r1
mov r1, #FUTEX_WAKE
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
#else
__futex_syscall3:
swi #__NR_futex
bx lr
__futex_wait:
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
swi #__NR_futex
bx lr
__futex_wake:
mov r2, r1
mov r1, #FUTEX_WAKE
swi #__NR_futex
bx lr
#endif
__futex_syscall4:
b __futex_syscall3

View File

@ -0,0 +1,128 @@
/*
* Copyright (C) 2008-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.
*/
#include <sys/linux-syscalls.h>
.text
.type __pthread_clone, #function
.global __pthread_clone
.align 4
.fnstart
__pthread_clone:
@ insert the args onto the new stack
str r0, [r1, #-4]
str r3, [r1, #-8]
@ do the system call
@ get flags
mov r0, r2
@ new sp is already in r1
#if __ARM_EABI__
stmfd sp!, {r4, r7}
ldr r7, =__NR_clone
swi #0
#else
swi #__NR_clone
#endif
movs r0, r0
#if __ARM_EABI__
ldmnefd sp!, {r4, r7}
#endif
blt __error
bxne lr
@ pick the function arg and call address off the stack and jump
@ to the C __thread_entry function which does some setup and then
@ calls the thread's start function
ldr r0, [sp, #-4]
ldr r1, [sp, #-8]
mov r2, sp @ __thread_entry needs the TLS pointer
b __thread_entry
__error:
mov r0, #-1
bx lr
.fnend
#
# This function is defined as:
#
# pid_t __bionic_clone( int flags, void *child_stack,
# pid_t *pid, void *tls, pid_t *ctid,
# int (*fn)(void *), void* arg );
#
# NOTE: This is not the same signature than the GLibc
# __clone function here !! Placing 'fn' and 'arg'
# at the end of the parameter list makes the
# implementation much simpler.
#
.type __bionic_clone, #function
.globl __bionic_clone
.align 4
.fnstart
__bionic_clone:
mov ip, sp
.save {r4, r5, r6, r7}
# save registers to parent stack
stmfd sp!, {r4, r5, r6, r7}
# load extra parameters
ldmfd ip, {r4, r5, r6}
# store 'fn' and 'arg' to the child stack
str r5, [r1, #-4]
str r6, [r1, #-8]
# system call
ldr r7, =__NR_clone
swi #0
movs r0, r0
beq 1f
# in parent, reload saved registers
# then either exit or error
#
ldmfd sp!, {r4, r5, r6, r7}
bxne lr
b __set_syscall_errno
1: # in the child - pick arguments
ldr r0, [sp, #-4]
ldr r1, [sp, #-8]
b __bionic_clone_entry
.fnend

View File

@ -0,0 +1,87 @@
/*
* 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
.align 4
.type _start,#function
.globl _start
# this is the small startup code that is first run when
# any executable that is dynamically-linked with Bionic
# runs.
#
# it's purpose is to call __libc_init with appropriate
# arguments, which are:
#
# - the address of the raw data block setup by the Linux
# kernel ELF loader
#
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
.long __FINI_ARRAY__
.long __CTOR_LIST__
.section .preinit_array, "aw"
.globl __PREINIT_ARRAY__
__PREINIT_ARRAY__:
.long -1
.section .init_array, "aw"
.globl __INIT_ARRAY__
__INIT_ARRAY__:
.long -1
.section .fini_array, "aw"
.globl __FINI_ARRAY__
__FINI_ARRAY__:
.long -1
.section .ctors, "aw"
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
#include "__dso_handle.S"

View File

@ -0,0 +1,55 @@
/*
* 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.
*/
# Implement static C++ destructors when the shared
# library is unloaded through dlclose().
#
# A call to this function must be the first entry
# in the .fini_array. See 3.3.5.3.C of C++ ABI
# standard.
#
__on_dlclose:
adr r0, 0f
ldr r0, [r0]
b __cxa_finalize
0:
.long __dso_handle
.section .init_array, "aw"
.globl __INIT_ARRAY__
__INIT_ARRAY__:
.long -1
.section .fini_array, "aw"
.globl __FINI_ARRAY__
__FINI_ARRAY__:
.long -1
.long __on_dlclose
#include "__dso_handle.S"

View File

@ -0,0 +1,88 @@
/*
* 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
.align 4
.type _start,#function
.globl _start
# this is the small startup code that is first run when
# any executable that is statically-linked with Bionic
# runs.
#
# it's purpose is to call __libc_init with appropriate
# arguments, which are:
#
# - the address of the raw data block setup by the Linux
# kernel ELF loader
#
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
.long __FINI_ARRAY__
.long __CTOR_LIST__
.section .preinit_array, "aw"
.globl __PREINIT_ARRAY__
__PREINIT_ARRAY__:
.long -1
.section .init_array, "aw"
.globl __INIT_ARRAY__
__INIT_ARRAY__:
.long -1
.section .fini_array, "aw"
.globl __FINI_ARRAY__
__FINI_ARRAY__:
.long -1
.section .ctors, "aw"
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
#include "__dso_handle.S"

View File

@ -0,0 +1,40 @@
/*
* 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.
*/
.section .preinit_array, "aw"
.long 0
.section .init_array, "aw"
.long 0
.section .fini_array, "aw"
.long 0
.section .ctors, "aw"
.long 0

View 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.
*/
/* This is the same than crtend.S except that a shared library
* cannot have a .preinit_array
*/
.section .init_array, "aw"
.long 0
.section .fini_array, "aw"
.long 0

View File

@ -0,0 +1,119 @@
/*
* 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.
*/
#include <stddef.h>
#include <string.h>
extern int __cxa_atexit(void (*)(void*), void*, void* );
/* Temporary hack: this variable should not be part of the C library
* itself, but placed in the .bss section of each executable or
* shared library instead.
*
* We keep it here temporarily until the build system has been
* modified properly to use crtbegin_so.S and crtend_so.S when
* generating shared libraries.
*
* It must be a 'weak' symbol to avoid conflicts with the definitions
* that have been moved to crtbegin_static.S and crtbegin_dynamic.S
*
* For the record, it is used for static C++ object construction
* and destruction. See http://www.codesourcery.com/public/cxx-abi/abi.html#dso-dtor
*/
void* __attribute__((weak)) __dso_handle;
/* The "C++ ABI for ARM" document states that static C++ constructors,
* which are called from the .init_array, should manually call
* __aeabi_atexit() to register static destructors explicitely.
*
* Note that 'dso_handle' is the address of a magic linker-generate
* variable from the shared object that contains the constructor/destructor
*/
/* Make this a weak symbol to avoid a multiple definition error when linking
* with libstdc++-v3. */
int __attribute__((weak))
__aeabi_atexit (void *object, void (*destructor) (void *), void *dso_handle)
{
return __cxa_atexit(destructor, object, dso_handle);
}
void __aeabi_memcpy8(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __aeabi_memcpy4(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __aeabi_memcpy(void *dest, const void *src, size_t n) {
memcpy(dest, src, n);
}
void __aeabi_memmove8(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __aeabi_memmove4(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
void __aeabi_memmove(void *dest, const void *src, size_t n) {
memmove(dest, src, n);
}
/*
* __aeabi_memset has the order of its second and third arguments reversed.
* This allows __aeabi_memclr to tail-call __aeabi_memset
*/
void __aeabi_memset8(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __aeabi_memset4(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __aeabi_memset(void *dest, size_t n, int c) {
memset(dest, c, n);
}
void __aeabi_memclr8(void *dest, size_t n) {
__aeabi_memset8(dest, n, 0);
}
void __aeabi_memclr4(void *dest, size_t n) {
__aeabi_memset4(dest, n, 0);
}
void __aeabi_memclr(void *dest, size_t n) {
__aeabi_memset(dest, n, 0);
}

View File

@ -0,0 +1,47 @@
/*
* 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.
*/
typedef long unsigned int *_Unwind_Ptr;
/* Stubbed out in libdl and defined in the dynamic linker.
* Same semantics as __gnu_Unwind_Find_exidx().
*/
extern _Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
/* For a given PC, find the .so that it belongs to.
* Returns the base address of the .ARM.exidx section
* for that .so, and the number of 8-byte entries
* in that section (via *pcount).
*
* libgcc declares __gnu_Unwind_Find_exidx() as a weak symbol, with
* the expectation that libc will define it and call through to
* a differently-named function in the dynamic linker.
*/
_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc, int *pcount)
{
return dl_unwind_find_exidx(pc, pcount);
}

View File

@ -0,0 +1,45 @@
/*
* 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.
*/
typedef long unsigned int *_Unwind_Ptr;
/* Find the .ARM.exidx section (which in the case of a static executable
* can be identified through its start and end symbols), and return its
* beginning and numbe of entries to the caller. Note that for static
* executables we do not need to use the value of the PC to find the
* EXIDX section.
*/
extern unsigned __exidx_end;
extern unsigned __exidx_start;
_Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr pc __attribute__((unused)),
int *pcount)
{
*pcount = (__exidx_end-__exidx_start)/8;
return (_Unwind_Ptr)__exidx_start;
}

View File

@ -0,0 +1,82 @@
/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
/*
* Copyright (c) 2001 Christopher Gilbert
* 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.
* 3. The name of the company nor the name of the author may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
*/
#include <machine/asm.h>
/*
* ffs - find first set bit, this algorithm isolates the first set
* bit, then multiplies the number by 0x0450fbaf which leaves the top
* 6 bits as an index into the table. This algorithm should be a win
* over the checking each bit in turn as per the C compiled version.
*
* under ARMv5 there's an instruction called CLZ (count leading Zero's) that
* could be used
*
* This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
* 16 Feb 1994.
*/
ENTRY(ffs)
/* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
rsb r1, r0, #0
ands r0, r0, r1
#ifndef __ARM_ARCH_5__
/*
* now r0 has at most one set bit, call this X
* if X = 0, all further instructions are skipped
*/
adrne r2, .L_ffs_table
orrne r0, r0, r0, lsl #4 /* r0 = X * 0x11 */
orrne r0, r0, r0, lsl #6 /* r0 = X * 0x451 */
rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */
/* now lookup in table indexed on top 6 bits of r0 */
ldrneb r0, [ r2, r0, lsr #26 ]
bx lr
.text;
.type .L_ffs_table, _ASM_TYPE_OBJECT;
.L_ffs_table:
/* 0 1 2 3 4 5 6 7 */
.byte 0, 1, 2, 13, 3, 7, 0, 14 /* 0- 7 */
.byte 4, 0, 8, 0, 0, 0, 0, 15 /* 8-15 */
.byte 11, 5, 0, 0, 9, 0, 0, 26 /* 16-23 */
.byte 0, 0, 0, 0, 0, 22, 28, 16 /* 24-31 */
.byte 32, 12, 6, 0, 0, 0, 0, 0 /* 32-39 */
.byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */
.byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */
.byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */
#else
clzne r0, r0
rsbne r0, r0, #32
bx lr
#endif

View File

@ -0,0 +1,53 @@
/*
* 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.
*/
/* unlike our auto-generated syscall stubs, this code saves lr
on the stack, as well as a few other registers. this makes
our stack unwinder happy, when we generate debug stack
traces after the C library or other parts of the system
abort due to a fatal runtime error (e.g. detection
of a corrupted malloc heap).
*/
#include <sys/linux-syscalls.h>
#ifndef __NR_kill
#define __NR_kill 37
#endif
.text
.type kill, #function
.globl kill
.align 4
kill:
stmfd sp!, {r4-r7, ip, lr}
ldr r7, =__NR_kill
swi #0
ldmfd sp!, {r4-r7, ip, lr}
movs r0, r0
bxpl lr
b __set_syscall_errno

View File

@ -0,0 +1,152 @@
/*
* 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.
*/
/* This file contains dummy references to libgcc.a functions to force the
* dynamic linker to copy their definition into the final libc.so binary.
*
* They are required to ensure backwards binary compatibility with
* Android 1.5 and Android 1.6 system images. Some applications built
* using the NDK require them to be here.
*
* Now, for a more elaborate description of the issue:
*
* libgcc.a is a compiler-specific library containing various helper
* functions used to implement certain operations that are not necessarily
* supported by the target CPU. For example, integer division doesn't have a
* corresponding CPU instruction on ARMv5, and is instead implemented in the
* compiler-generated machine code as a call to an __idiv helper function.
*
* Normally, one has to place libgcc.a in the link command used to generate
* target binaries (shared libraries and executables) after all objects and
* static libraries, but before dependent shared libraries, i.e. something
* like:
* gcc <options> -o libfoo.so foo.a libgcc.a -lc -lm
*
* This ensures that any helper function needed by the code in foo.a is copied
* into the final libfoo.so. Unfortunately, the Android build system has been
* using this instead:
*
* gcc <options> -o libfoo.so foo.a -lc -lm libgcc.a
*
* The problem with this is that if one helper function needed by foo.a has
* already been copied into libc.so or libm.so, then nothing will be copied
* into libfoo.so. Instead, a symbol import definition will be added to it
* so libfoo.so can directly call the one in libc.so at runtime.
*
* When changing toolchains for 2.0, the set of helper functions copied to
* libc.so changed, which resulted in some native shared libraries generated
* with the NDK to fail to load properly.
*
* The NDK has been fixed after 1.6_r1 to use the correct link command, so
* any native shared library generated with it should now be safe from that
* problem. On the other hand, existing shared libraries distributed with
* applications that were generated with a previous version of the NDK
* still need all 1.5/1.6 helper functions in libc.so and libn.so
*
* Final note: some of the functions below should really be in libm.so to
* completely reflect the state of 1.5/1.6 system images. However,
* since libm.so depends on libc.so, it's easier to put all of
* these in libc.so instead, since the dynamic linker will always
* search in libc.so before libm.so for dependencies.
*/
#define COMPAT_FUNCTIONS_LIST \
XX(__adddf3) \
XX(__addsf3) \
XX(__aeabi_cdcmpeq) \
XX(__aeabi_cdcmple) \
XX(__aeabi_cdrcmple) \
XX(__aeabi_d2f) \
XX(__aeabi_d2iz) \
XX(__aeabi_dadd) \
XX(__aeabi_dcmpeq) \
XX(__aeabi_dcmpge) \
XX(__aeabi_dcmpgt) \
XX(__aeabi_dcmple) \
XX(__aeabi_dcmplt) \
XX(__aeabi_dcmpun) \
XX(__aeabi_ddiv) \
XX(__aeabi_dmul) \
XX(__aeabi_drsub) \
XX(__aeabi_dsub) \
XX(__aeabi_f2d) \
XX(__aeabi_f2iz) \
XX(__aeabi_fadd) \
XX(__aeabi_fcmpun) \
XX(__aeabi_fdiv) \
XX(__aeabi_fmul) \
XX(__aeabi_frsub) \
XX(__aeabi_fsub) \
XX(__aeabi_i2d) \
XX(__aeabi_i2f) \
XX(__aeabi_l2d) \
XX(__aeabi_l2f) \
XX(__aeabi_lmul) \
XX(__aeabi_ui2d) \
XX(__aeabi_ui2f) \
XX(__aeabi_ul2d) \
XX(__aeabi_ul2f) \
XX(__cmpdf2) \
XX(__divdf3) \
XX(__divsf3) \
XX(__eqdf2) \
XX(__extendsfdf2) \
XX(__fixdfsi) \
XX(__fixsfsi) \
XX(__floatdidf) \
XX(__floatdisf) \
XX(__floatsidf) \
XX(__floatsisf) \
XX(__floatundidf) \
XX(__floatundisf) \
XX(__floatunsidf) \
XX(__floatunsisf) \
XX(__gedf2) \
XX(__gtdf2) \
XX(__ledf2) \
XX(__ltdf2) \
XX(__muldf3) \
XX(__muldi3) \
XX(__mulsf3) \
XX(__nedf2) \
XX(__subdf3) \
XX(__subsf3) \
XX(__truncdfsf2) \
XX(__unorddf2) \
XX(__unordsf2) \
#define XX(f) extern void f(void);
COMPAT_FUNCTIONS_LIST
#undef XX
void __bionic_libgcc_compat_hooks(void)
{
#define XX(f) f();
COMPAT_FUNCTIONS_LIST
#undef XX
}

View File

@ -0,0 +1,288 @@
/*
* 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.
*/
#include <machine/cpu-features.h>
.text
.global memcmp
.type memcmp, %function
.align 4
/*
* Optimized memcmp() for ARM9.
* This would not be optimal on XScale or ARM11, where more prefetching
* and use of PLD will be needed.
* The 2 major optimzations here are
* (1) The main loop compares 16 bytes at a time
* (2) The loads are scheduled in a way they won't stall
*/
memcmp:
.fnstart
PLD (r0, #0)
PLD (r1, #0)
/* take of the case where length is 0 or the buffers are the same */
cmp r0, r1
cmpne r2, #0
moveq r0, #0
bxeq lr
.save {r4, lr}
/* save registers */
stmfd sp!, {r4, lr}
PLD (r0, #32)
PLD (r1, #32)
/* since r0 hold the result, move the first source
* pointer somewhere else
*/
mov r4, r0
/* make sure we have at least 8+4 bytes, this simplify things below
* and avoid some overhead for small blocks
*/
cmp r2, #(8+4)
bmi 8f
/* align first pointer to word boundary
* offset = -src & 3
*/
rsb r3, r4, #0
ands r3, r3, #3
beq 0f
/* align first pointer */
sub r2, r2, r3
1: ldrb r0, [r4], #1
ldrb ip, [r1], #1
subs r0, r0, ip
bne 9f
subs r3, r3, #1
bne 1b
0: /* here the first pointer is aligned, and we have at least 4 bytes
* to process.
*/
/* see if the pointers are congruent */
eor r0, r4, r1
ands r0, r0, #3
bne 5f
/* congruent case, 32 bytes per iteration
* We need to make sure there are at least 32+4 bytes left
* because we effectively read ahead one word, and we could
* read past the buffer (and segfault) if we're not careful.
*/
ldr ip, [r1]
subs r2, r2, #(32 + 4)
bmi 1f
0: PLD (r4, #64)
PLD (r1, #64)
ldr r0, [r4], #4
ldr lr, [r1, #4]!
eors r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r4], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r4], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
bne 2f
subs r2, r2, #32
bhs 0b
/* do we have at least 4 bytes left? */
1: adds r2, r2, #(32 - 4 + 4)
bmi 4f
/* finish off 4 bytes at a time */
3: ldr r0, [r4], #4
ldr ip, [r1], #4
eors r0, r0, ip
bne 2f
subs r2, r2, #4
bhs 3b
/* are we done? */
4: adds r2, r2, #4
moveq r0, #0
beq 9f
/* finish off the remaining bytes */
b 8f
2: /* the last 4 bytes are different, restart them */
sub r4, r4, #4
sub r1, r1, #4
mov r2, #4
/* process the last few bytes */
8: ldrb r0, [r4], #1
ldrb ip, [r1], #1
// stall
subs r0, r0, ip
bne 9f
subs r2, r2, #1
bne 8b
9: /* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
.fnend
5: /*************** non-congruent case ***************/
and r0, r1, #3
cmp r0, #2
bne 4f
/* here, offset is 2 (16-bits aligned, special cased) */
/* make sure we have at least 16 bytes to process */
subs r2, r2, #16
addmi r2, r2, #16
bmi 8b
/* align the unaligned pointer */
bic r1, r1, #3
ldr lr, [r1], #4
6: PLD (r1, #64)
PLD (r4, #64)
mov ip, lr, lsr #16
ldr lr, [r1], #4
ldr r0, [r4], #4
orr ip, ip, lr, lsl #16
eors r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #16
bhs 6b
sub r1, r1, #2
/* are we done? */
adds r2, r2, #16
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #(4+2)
sub r4, r4, #4
mov r2, #4
b 8b
4: /*************** offset is 1 or 3 (less optimized) ***************/
stmfd sp!, {r5, r6, r7}
// r5 = rhs
// r6 = lhs
// r7 = scratch
mov r5, r0, lsl #3 /* r5 = right shift */
rsb r6, r5, #32 /* r6 = left shift */
/* align the unaligned pointer */
bic r1, r1, #3
ldr r7, [r1], #4
sub r2, r2, #8
6: mov ip, r7, lsr r5
ldr r7, [r1], #4
ldr r0, [r4], #4
orr ip, ip, r7, lsl r6
eors r0, r0, ip
moveq ip, r7, lsr r5
ldreq r7, [r1], #4
ldreq r0, [r4], #4
orreq ip, ip, r7, lsl r6
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #8
bhs 6b
sub r1, r1, r6, lsr #3
ldmfd sp!, {r5, r6, r7}
/* are we done? */
adds r2, r2, #8
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #4
sub r1, r1, r6, lsr #3
sub r4, r4, #4
mov r2, #4
ldmfd sp!, {r5, r6, r7}
b 8b

View File

@ -0,0 +1,239 @@
/*
* 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.
*/
#include <machine/cpu-features.h>
.text
.global __memcmp16
.type __memcmp16, %function
.align 4
/*
* Optimized memcmp16() for ARM9.
* This would not be optimal on XScale or ARM11, where more prefetching
* and use of PLD will be needed.
* The 2 major optimzations here are
* (1) The main loop compares 16 bytes at a time
* (2) The loads are scheduled in a way they won't stall
*/
__memcmp16:
.fnstart
PLD (r0, #0)
PLD (r1, #0)
/* take of the case where length is nul or the buffers are the same */
cmp r0, r1
cmpne r2, #0
moveq r0, #0
bxeq lr
/* since r0 hold the result, move the first source
* pointer somewhere else
*/
mov r3, r0
/* make sure we have at least 12 words, this simplify things below
* and avoid some overhead for small blocks
*/
cmp r2, #12
bpl 0f
/* small blocks (less then 12 words) */
PLD (r0, #32)
PLD (r1, #32)
1: ldrh r0, [r3], #2
ldrh ip, [r1], #2
subs r0, r0, ip
bxne lr
subs r2, r2, #1
bne 1b
bx lr
.save {r4, lr}
/* save registers */
0: stmfd sp!, {r4, lr}
/* align first pointer to word boundary */
tst r3, #2
beq 0f
ldrh r0, [r3], #2
ldrh ip, [r1], #2
sub r2, r2, #1
subs r0, r0, ip
/* restore registers and return */
ldmnefd sp!, {r4, lr}
bxne lr
.fnend
0: /* here the first pointer is aligned, and we have at least 3 words
* to process.
*/
/* see if the pointers are congruent */
eor r0, r3, r1
ands r0, r0, #2
bne 5f
/* congruent case, 16 half-words per iteration
* We need to make sure there are at least 16+2 words left
* because we effectively read ahead one long word, and we could
* read past the buffer (and segfault) if we're not careful.
*/
ldr ip, [r1]
subs r2, r2, #(16 + 2)
bmi 1f
0:
PLD (r3, #64)
PLD (r1, #64)
ldr r0, [r3], #4
ldr lr, [r1, #4]!
eors r0, r0, ip
ldreq r0, [r3], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r3], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r3], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r3], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r3], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
ldreq r0, [r3], #4
ldreq lr, [r1, #4]!
eoreqs r0, r0, ip
ldreq r0, [r3], #4
ldreq ip, [r1, #4]!
eoreqs r0, r0, lr
bne 2f
subs r2, r2, #16
bhs 0b
/* do we have at least 2 words left? */
1: adds r2, r2, #(16 - 2 + 2)
bmi 4f
/* finish off 2 words at a time */
3: ldr r0, [r3], #4
ldr ip, [r1], #4
eors r0, r0, ip
bne 2f
subs r2, r2, #2
bhs 3b
/* are we done? */
4: adds r2, r2, #2
bne 8f
/* restore registers and return */
mov r0, #0
ldmfd sp!, {r4, lr}
bx lr
2: /* the last 2 words are different, restart them */
ldrh r0, [r3, #-4]
ldrh ip, [r1, #-4]
subs r0, r0, ip
ldreqh r0, [r3, #-2]
ldreqh ip, [r1, #-2]
subeqs r0, r0, ip
/* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
/* process the last few words */
8: ldrh r0, [r3], #2
ldrh ip, [r1], #2
subs r0, r0, ip
bne 9f
subs r2, r2, #1
bne 8b
9: /* restore registers and return */
ldmfd sp!, {r4, lr}
bx lr
5: /*************** non-congruent case ***************/
/* align the unaligned pointer */
bic r1, r1, #3
ldr lr, [r1], #4
sub r2, r2, #8
6:
PLD (r3, #64)
PLD (r1, #64)
mov ip, lr, lsr #16
ldr lr, [r1], #4
ldr r0, [r3], #4
orr ip, ip, lr, lsl #16
eors r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r3], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r3], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
moveq ip, lr, lsr #16
ldreq lr, [r1], #4
ldreq r0, [r3], #4
orreq ip, ip, lr, lsl #16
eoreqs r0, r0, ip
bne 7f
subs r2, r2, #8
bhs 6b
sub r1, r1, #2
/* are we done? */
adds r2, r2, #8
moveq r0, #0
beq 9b
/* finish off the remaining bytes */
b 8b
7: /* fix up the 2 pointers and fallthrough... */
sub r1, r1, #2
b 2b

View File

@ -0,0 +1,510 @@
/*
* 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.
*/
#include <machine/cpu-features.h>
#if defined(__ARM_NEON__)
.text
.fpu neon
.global memcpy
.type memcpy, %function
.align 4
/* a prefetch distance of 4 cache-lines works best experimentally */
#define CACHE_LINE_SIZE 64
#define PREFETCH_DISTANCE (CACHE_LINE_SIZE*4)
memcpy:
.fnstart
.save {r0, lr}
stmfd sp!, {r0, lr}
/* start preloading as early as possible */
pld [r1, #(CACHE_LINE_SIZE*0)]
pld [r1, #(CACHE_LINE_SIZE*1)]
/* do we have at least 16-bytes to copy (needed for alignment below) */
cmp r2, #16
blo 5f
/* align destination to half cache-line for the write-buffer */
rsb r3, r0, #0
ands r3, r3, #0xF
beq 0f
/* copy up to 15-bytes (count in r3) */
sub r2, r2, r3
movs ip, r3, lsl #31
ldrmib lr, [r1], #1
strmib lr, [r0], #1
ldrcsb ip, [r1], #1
ldrcsb lr, [r1], #1
strcsb ip, [r0], #1
strcsb lr, [r0], #1
movs ip, r3, lsl #29
bge 1f
// copies 4 bytes, destination 32-bits aligned
vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]!
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0, :32]!
1: bcc 2f
// copies 8 bytes, destination 64-bits aligned
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0, :64]!
2:
0: /* preload immediately the next cache line, which we may need */
pld [r1, #(CACHE_LINE_SIZE*0)]
pld [r1, #(CACHE_LINE_SIZE*1)]
/* make sure we have at least 64 bytes to copy */
subs r2, r2, #64
blo 2f
/* preload all the cache lines we need.
* NOTE: the number of pld below depends on PREFETCH_DISTANCE,
* ideally would would increase the distance in the main loop to
* avoid the goofy code below. In practice this doesn't seem to make
* a big difference.
*/
pld [r1, #(CACHE_LINE_SIZE*2)]
pld [r1, #(CACHE_LINE_SIZE*3)]
pld [r1, #(PREFETCH_DISTANCE)]
1: /* The main loop copies 64 bytes at a time */
vld1.8 {d0 - d3}, [r1]!
vld1.8 {d4 - d7}, [r1]!
pld [r1, #(PREFETCH_DISTANCE)]
subs r2, r2, #64
vst1.8 {d0 - d3}, [r0, :128]!
vst1.8 {d4 - d7}, [r0, :128]!
bhs 1b
2: /* fix-up the remaining count and make sure we have >= 32 bytes left */
add r2, r2, #64
subs r2, r2, #32
blo 4f
3: /* 32 bytes at a time. These cache lines were already preloaded */
vld1.8 {d0 - d3}, [r1]!
subs r2, r2, #32
vst1.8 {d0 - d3}, [r0, :128]!
bhs 3b
4: /* less than 32 left */
add r2, r2, #32
tst r2, #0x10
beq 5f
// copies 16 bytes, 128-bits aligned
vld1.8 {d0, d1}, [r1]!
vst1.8 {d0, d1}, [r0, :128]!
5: /* copy up to 15-bytes (count in r2) */
movs ip, r2, lsl #29
bcc 1f
vld1.8 {d0}, [r1]!
vst1.8 {d0}, [r0]!
1: bge 2f
vld4.8 {d0[0], d1[0], d2[0], d3[0]}, [r1]!
vst4.8 {d0[0], d1[0], d2[0], d3[0]}, [r0]!
2: movs ip, r2, lsl #31
ldrmib r3, [r1], #1
ldrcsb ip, [r1], #1
ldrcsb lr, [r1], #1
strmib r3, [r0], #1
strcsb ip, [r0], #1
strcsb lr, [r0], #1
ldmfd sp!, {r0, lr}
bx lr
.fnend
#else /* __ARM_ARCH__ < 7 */
.text
.global memcpy
.type memcpy, %function
.align 4
/*
* Optimized memcpy() for ARM.
*
* note that memcpy() always returns the destination pointer,
* so we have to preserve R0.
*/
memcpy:
/* The stack must always be 64-bits aligned to be compliant with the
* ARM ABI. Since we have to save R0, we might as well save R4
* which we can use for better pipelining of the reads below
*/
.fnstart
.save {r0, r4, lr}
stmfd sp!, {r0, r4, lr}
/* Making room for r5-r11 which will be spilled later */
.pad #28
sub sp, sp, #28
// preload the destination because we'll align it to a cache line
// with small writes. Also start the source "pump".
PLD (r0, #0)
PLD (r1, #0)
PLD (r1, #32)
/* it simplifies things to take care of len<4 early */
cmp r2, #4
blo copy_last_3_and_return
/* compute the offset to align the source
* offset = (4-(src&3))&3 = -src & 3
*/
rsb r3, r1, #0
ands r3, r3, #3
beq src_aligned
/* align source to 32 bits. We need to insert 2 instructions between
* a ldr[b|h] and str[b|h] because byte and half-word instructions
* stall 2 cycles.
*/
movs r12, r3, lsl #31
sub r2, r2, r3 /* we know that r3 <= r2 because r2 >= 4 */
ldrmib r3, [r1], #1
ldrcsb r4, [r1], #1
ldrcsb r12,[r1], #1
strmib r3, [r0], #1
strcsb r4, [r0], #1
strcsb r12,[r0], #1
src_aligned:
/* see if src and dst are aligned together (congruent) */
eor r12, r0, r1
tst r12, #3
bne non_congruent
/* Use post-incriment mode for stm to spill r5-r11 to reserved stack
* frame. Don't update sp.
*/
stmea sp, {r5-r11}
/* align the destination to a cache-line */
rsb r3, r0, #0
ands r3, r3, #0x1C
beq congruent_aligned32
cmp r3, r2
andhi r3, r2, #0x1C
/* conditionnaly copies 0 to 7 words (length in r3) */
movs r12, r3, lsl #28
ldmcsia r1!, {r4, r5, r6, r7} /* 16 bytes */
ldmmiia r1!, {r8, r9} /* 8 bytes */
stmcsia r0!, {r4, r5, r6, r7}
stmmiia r0!, {r8, r9}
tst r3, #0x4
ldrne r10,[r1], #4 /* 4 bytes */
strne r10,[r0], #4
sub r2, r2, r3
congruent_aligned32:
/*
* here source is aligned to 32 bytes.
*/
cached_aligned32:
subs r2, r2, #32
blo less_than_32_left
/*
* We preload a cache-line up to 64 bytes ahead. On the 926, this will
* stall only until the requested world is fetched, but the linefill
* continues in the the background.
* While the linefill is going, we write our previous cache-line
* into the write-buffer (which should have some free space).
* When the linefill is done, the writebuffer will
* start dumping its content into memory
*
* While all this is going, we then load a full cache line into
* 8 registers, this cache line should be in the cache by now
* (or partly in the cache).
*
* This code should work well regardless of the source/dest alignment.
*
*/
// Align the preload register to a cache-line because the cpu does
// "critical word first" (the first word requested is loaded first).
bic r12, r1, #0x1F
add r12, r12, #64
1: ldmia r1!, { r4-r11 }
PLD (r12, #64)
subs r2, r2, #32
// NOTE: if r12 is more than 64 ahead of r1, the following ldrhi
// for ARM9 preload will not be safely guarded by the preceding subs.
// When it is safely guarded the only possibility to have SIGSEGV here
// is because the caller overstates the length.
ldrhi r3, [r12], #32 /* cheap ARM9 preload */
stmia r0!, { r4-r11 }
bhs 1b
add r2, r2, #32
less_than_32_left:
/*
* less than 32 bytes left at this point (length in r2)
*/
/* skip all this if there is nothing to do, which should
* be a common case (if not executed the code below takes
* about 16 cycles)
*/
tst r2, #0x1F
beq 1f
/* conditionnaly copies 0 to 31 bytes */
movs r12, r2, lsl #28
ldmcsia r1!, {r4, r5, r6, r7} /* 16 bytes */
ldmmiia r1!, {r8, r9} /* 8 bytes */
stmcsia r0!, {r4, r5, r6, r7}
stmmiia r0!, {r8, r9}
movs r12, r2, lsl #30
ldrcs r3, [r1], #4 /* 4 bytes */
ldrmih r4, [r1], #2 /* 2 bytes */
strcs r3, [r0], #4
strmih r4, [r0], #2
tst r2, #0x1
ldrneb r3, [r1] /* last byte */
strneb r3, [r0]
/* we're done! restore everything and return */
1: ldmfd sp!, {r5-r11}
ldmfd sp!, {r0, r4, lr}
bx lr
/********************************************************************/
non_congruent:
/*
* here source is aligned to 4 bytes
* but destination is not.
*
* in the code below r2 is the number of bytes read
* (the number of bytes written is always smaller, because we have
* partial words in the shift queue)
*/
cmp r2, #4
blo copy_last_3_and_return
/* Use post-incriment mode for stm to spill r5-r11 to reserved stack
* frame. Don't update sp.
*/
stmea sp, {r5-r11}
/* compute shifts needed to align src to dest */
rsb r5, r0, #0
and r5, r5, #3 /* r5 = # bytes in partial words */
mov r12, r5, lsl #3 /* r12 = right */
rsb lr, r12, #32 /* lr = left */
/* read the first word */
ldr r3, [r1], #4
sub r2, r2, #4
/* write a partial word (0 to 3 bytes), such that destination
* becomes aligned to 32 bits (r5 = nb of words to copy for alignment)
*/
movs r5, r5, lsl #31
strmib r3, [r0], #1
movmi r3, r3, lsr #8
strcsb r3, [r0], #1
movcs r3, r3, lsr #8
strcsb r3, [r0], #1
movcs r3, r3, lsr #8
cmp r2, #4
blo partial_word_tail
/* Align destination to 32 bytes (cache line boundary) */
1: tst r0, #0x1c
beq 2f
ldr r5, [r1], #4
sub r2, r2, #4
orr r4, r3, r5, lsl lr
mov r3, r5, lsr r12
str r4, [r0], #4
cmp r2, #4
bhs 1b
blo partial_word_tail
/* copy 32 bytes at a time */
2: subs r2, r2, #32
blo less_than_thirtytwo
/* Use immediate mode for the shifts, because there is an extra cycle
* for register shifts, which could account for up to 50% of
* performance hit.
*/
cmp r12, #24
beq loop24
cmp r12, #8
beq loop8
loop16:
ldr r12, [r1], #4
1: mov r4, r12
ldmia r1!, { r5,r6,r7, r8,r9,r10,r11}
PLD (r1, #64)
subs r2, r2, #32
ldrhs r12, [r1], #4
orr r3, r3, r4, lsl #16
mov r4, r4, lsr #16
orr r4, r4, r5, lsl #16
mov r5, r5, lsr #16
orr r5, r5, r6, lsl #16
mov r6, r6, lsr #16
orr r6, r6, r7, lsl #16
mov r7, r7, lsr #16
orr r7, r7, r8, lsl #16
mov r8, r8, lsr #16
orr r8, r8, r9, lsl #16
mov r9, r9, lsr #16
orr r9, r9, r10, lsl #16
mov r10, r10, lsr #16
orr r10, r10, r11, lsl #16
stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
mov r3, r11, lsr #16
bhs 1b
b less_than_thirtytwo
loop8:
ldr r12, [r1], #4
1: mov r4, r12
ldmia r1!, { r5,r6,r7, r8,r9,r10,r11}
PLD (r1, #64)
subs r2, r2, #32
ldrhs r12, [r1], #4
orr r3, r3, r4, lsl #24
mov r4, r4, lsr #8
orr r4, r4, r5, lsl #24
mov r5, r5, lsr #8
orr r5, r5, r6, lsl #24
mov r6, r6, lsr #8
orr r6, r6, r7, lsl #24
mov r7, r7, lsr #8
orr r7, r7, r8, lsl #24
mov r8, r8, lsr #8
orr r8, r8, r9, lsl #24
mov r9, r9, lsr #8
orr r9, r9, r10, lsl #24
mov r10, r10, lsr #8
orr r10, r10, r11, lsl #24
stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
mov r3, r11, lsr #8
bhs 1b
b less_than_thirtytwo
loop24:
ldr r12, [r1], #4
1: mov r4, r12
ldmia r1!, { r5,r6,r7, r8,r9,r10,r11}
PLD (r1, #64)
subs r2, r2, #32
ldrhs r12, [r1], #4
orr r3, r3, r4, lsl #8
mov r4, r4, lsr #24
orr r4, r4, r5, lsl #8
mov r5, r5, lsr #24
orr r5, r5, r6, lsl #8
mov r6, r6, lsr #24
orr r6, r6, r7, lsl #8
mov r7, r7, lsr #24
orr r7, r7, r8, lsl #8
mov r8, r8, lsr #24
orr r8, r8, r9, lsl #8
mov r9, r9, lsr #24
orr r9, r9, r10, lsl #8
mov r10, r10, lsr #24
orr r10, r10, r11, lsl #8
stmia r0!, {r3,r4,r5,r6, r7,r8,r9,r10}
mov r3, r11, lsr #24
bhs 1b
less_than_thirtytwo:
/* copy the last 0 to 31 bytes of the source */
rsb r12, lr, #32 /* we corrupted r12, recompute it */
add r2, r2, #32
cmp r2, #4
blo partial_word_tail
1: ldr r5, [r1], #4
sub r2, r2, #4
orr r4, r3, r5, lsl lr
mov r3, r5, lsr r12
str r4, [r0], #4
cmp r2, #4
bhs 1b
partial_word_tail:
/* we have a partial word in the input buffer */
movs r5, lr, lsl #(31-3)
strmib r3, [r0], #1
movmi r3, r3, lsr #8
strcsb r3, [r0], #1
movcs r3, r3, lsr #8
strcsb r3, [r0], #1
/* Refill spilled registers from the stack. Don't update sp. */
ldmfd sp, {r5-r11}
copy_last_3_and_return:
movs r2, r2, lsl #31 /* copy remaining 0, 1, 2 or 3 bytes */
ldrmib r2, [r1], #1
ldrcsb r3, [r1], #1
ldrcsb r12,[r1]
strmib r2, [r0], #1
strcsb r3, [r0], #1
strcsb r12,[r0]
/* we're done! restore sp and spilled registers and return */
add sp, sp, #28
ldmfd sp!, {r0, r4, lr}
bx lr
.fnend
#endif /* __ARM_ARCH__ < 7 */

View File

@ -0,0 +1,117 @@
/*
* 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
.global memset
.type memset, %function
.global bzero
.type bzero, %function
.align
/*
* Optimized memset() for ARM.
*
* memset() returns its first argument.
*/
bzero:
mov r2, r1
mov r1, #0
memset:
/* compute the offset to align the destination
* offset = (4-(src&3))&3 = -src & 3
*/
.fnstart
.save {r0, r4-r7, lr}
stmfd sp!, {r0, r4-r7, lr}
rsb r3, r0, #0
ands r3, r3, #3
cmp r3, r2
movhi r3, r2
/* splat r1 */
mov r1, r1, lsl #24
orr r1, r1, r1, lsr #8
orr r1, r1, r1, lsr #16
movs r12, r3, lsl #31
strcsb r1, [r0], #1 /* can't use strh (alignment unknown) */
strcsb r1, [r0], #1
strmib r1, [r0], #1
subs r2, r2, r3
ldmlsfd sp!, {r0, r4-r7, lr} /* return */
bxls lr
/* align the destination to a cache-line */
mov r12, r1
mov lr, r1
mov r4, r1
mov r5, r1
mov r6, r1
mov r7, r1
rsb r3, r0, #0
ands r3, r3, #0x1C
beq 3f
cmp r3, r2
andhi r3, r2, #0x1C
sub r2, r2, r3
/* conditionnaly writes 0 to 7 words (length in r3) */
movs r3, r3, lsl #28
stmcsia r0!, {r1, lr}
stmcsia r0!, {r1, lr}
stmmiia r0!, {r1, lr}
movs r3, r3, lsl #2
strcs r1, [r0], #4
3:
subs r2, r2, #32
mov r3, r1
bmi 2f
1: subs r2, r2, #32
stmia r0!, {r1,r3,r4,r5,r6,r7,r12,lr}
bhs 1b
2: add r2, r2, #32
/* conditionnaly stores 0 to 31 bytes */
movs r2, r2, lsl #28
stmcsia r0!, {r1,r3,r12,lr}
stmmiia r0!, {r1, lr}
movs r2, r2, lsl #2
strcs r1, [r0], #4
strmih r1, [r0], #2
movs r2, r2, lsl #2
strcsb r1, [r0]
ldmfd sp!, {r0, r4-r7, lr}
bx lr
.fnend

View File

@ -0,0 +1,136 @@
/* $OpenBSD: setjmp.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */
/* $NetBSD: setjmp.S,v 1.5 2003/04/05 23:08:51 bjh21 Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(setjmp)
/* Block all signals and retrieve the old signal mask */
stmfd sp!, {r0, r14}
mov r0, #0x00000000
bl PIC_SYM(_C_LABEL(sigblock), PLT)
mov r1, r0
ldmfd sp!, {r0, r14}
/* Store signal mask */
str r1, [r0, #(25 * 4)]
ldr r1, .Lsetjmp_magic
str r1, [r0], #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Store fp registers */
sfm f4, 4, [r0], #48
/* Store fpsr */
rfs r1
str r1, [r0], #0x0004
#endif /*SOFTFLOAT*/
/* Store integer registers */
stmia r0, {r4-r14}
mov r0, #0x00000000
bx lr
.Lsetjmp_magic:
.word _JB_MAGIC_SETJMP
ENTRY(longjmp)
ldr r2, .Lsetjmp_magic
ldr r3, [r0]
teq r2, r3
bne botch
/* Fetch signal mask */
ldr r2, [r0, #(25 * 4)]
/* Set signal mask */
stmfd sp!, {r0, r1, r14}
sub sp, sp, #4 /* align the stack */
mov r0, r2
bl PIC_SYM(_C_LABEL(sigsetmask), PLT)
add sp, sp, #4 /* unalign the stack */
ldmfd sp!, {r0, r1, r14}
add r0, r0, #4
#ifdef SOFTFLOAT
add r0, r0, #52
#else
/* Restore fp registers */
lfm f4, 4, [r0], #48
/* Restore FPSR */
ldr r4, [r0], #0x0004
wfs r4
#endif /* SOFTFLOAT */
/* Restore integer registers */
ldmia r0, {r4-r14}
/* Validate sp and r14 */
teq sp, #0
teqne r14, #0
beq botch
/* Set return value */
mov r0, r1
teq r0, #0x00000000
moveq r0, #0x00000001
bx lr
#ifdef __ARM_26__
mov r15, r14
#else
mov r15, r14
#endif
/* validation failed, die die die. */
botch:
bl PIC_SYM(_C_LABEL(longjmperror), PLT)
bl PIC_SYM(_C_LABEL(abort), PLT)
b . - 8 /* Cannot get here */

View File

@ -0,0 +1,29 @@
#include <signal.h>
extern int __sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
extern void __sig_restorer();
int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
{
struct sigaction real_act;
/* If the caller has not set a custom restorer, then set up a default one.
* The code will function properly without this, however GDB will not be
* able to recognize the stack frame as a signal trampoline, because it
* is hardcoded to look for the instruction sequence that glibc uses in
* its custom restorer. By creating our own restorer with the same
* sequence, we ensure that GDB correctly identifies this as a signal
* trampoline frame.
*
* See http://sourceware.org/ml/gdb/2010-01/msg00143.html for more
* information on this.*/
if(act && !(act->sa_flags & SA_RESTORER)) {
real_act = *act;
real_act.sa_flags |= SA_RESTORER;
real_act.sa_restorer = __sig_restorer;
act = &real_act;
}
return __sigaction(signum, act, oldact);
}

View File

@ -0,0 +1,62 @@
/* $OpenBSD: sigsetjmp.S,v 1.2 2004/02/01 05:40:52 drahn Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.3 2002/08/17 19:54:30 thorpej Exp $ */
/*
* Copyright (c) 1997 Mark Brinicombe
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Mark Brinicombe
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- sigsetjmp, siglongjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a, m)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(sigsetjmp)
teq r1, #0
beq PIC_SYM(_C_LABEL(_setjmp), PLT)
b PIC_SYM(_C_LABEL(setjmp), PLT)
.L_setjmp_magic:
.word _JB_MAGIC__SETJMP
ENTRY(siglongjmp)
ldr r2, .L_setjmp_magic
ldr r3, [r0]
teq r2, r3
beq PIC_SYM(_C_LABEL(_longjmp), PLT)
b PIC_SYM(_C_LABEL(longjmp), PLT)

View File

@ -0,0 +1,129 @@
/*
* 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.
*/
#include <string.h>
#include <stdint.h>
#include <machine/cpu-features.h>
size_t strlen(const char *s)
{
__builtin_prefetch(s);
__builtin_prefetch(s+32);
union {
const char *b;
const uint32_t *w;
uintptr_t i;
} u;
// these are some scratch variables for the asm code below
uint32_t v, t;
// initialize the string length to zero
size_t l = 0;
// align the pointer to a 32-bit word boundary
u.b = s;
while (u.i & 0x3) {
if (__builtin_expect(*u.b++ == 0, 0)) {
goto done;
}
l++;
}
// loop for each word, testing if it contains a zero byte
// if so, exit the loop and update the length.
// We need to process 32 bytes per loop to schedule PLD properly
// and achieve the maximum bus speed.
asm(
"ldr %[v], [ %[s] ], #4 \n"
"sub %[l], %[l], %[s] \n"
"0: \n"
#if __ARM_HAVE_PLD
"pld [ %[s], #64 ] \n"
#endif
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
#if !defined(__OPTIMIZE_SIZE__)
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
"bne 1f \n"
"sub %[t], %[v], %[mask], lsr #7\n"
"and %[t], %[t], %[mask] \n"
"bics %[t], %[t], %[v] \n"
"ldreq %[v], [ %[s] ], #4 \n"
#endif
"beq 0b \n"
"1: \n"
"add %[l], %[l], %[s] \n"
"tst %[v], #0xFF \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF00 \n"
"beq 2f \n"
"add %[l], %[l], #1 \n"
"tst %[v], #0xFF0000 \n"
"addne %[l], %[l], #1 \n"
"2: \n"
: [l]"=&r"(l), [v]"=&r"(v), [t]"=&r"(t), [s]"=&r"(u.b)
: "%[l]"(l), "%[s]"(u.b), [mask]"r"(0x80808080UL)
: "cc"
);
done:
return l;
}

View File

@ -0,0 +1,71 @@
/*
* 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.
*/
#include <sys/linux-syscalls.h>
.text
.align 4
.type syscall,#function
.globl syscall
.text
.align
#if __ARM_EABI__
syscall:
mov ip, sp
stmfd sp!, {r4, r5, r6, r7}
mov r7, r0
mov r0, r1
mov r1, r2
mov r2, r3
ldmfd ip, {r3, r4, r5, r6}
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
#else
#ifndef __NR_syscall
#define __NR_syscall 113
#endif
syscall:
stmfd sp!, {r4, r5, lr}
ldr r4, [sp, #12]
ldr r5, [sp, #16]
swi __NR_syscall
ldmfd sp!, {r4, r5, lr}
movs r0, r0
bxpl lr
b __set_syscall_errno
#endif

View File

@ -0,0 +1,53 @@
/*
* 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.
*/
/* unlike our auto-generated syscall stubs, this code saves lr
on the stack, as well as a few other registers. this makes
our stack unwinder happy, when we generate debug stack
traces after the C library or other parts of the system
abort due to a fatal runtime error (e.g. detection
of a corrupted malloc heap).
*/
#include <sys/linux-syscalls.h>
#ifndef __NR_tkill
#define __NR_tkill 238
#endif
.text
.type tkill, #function
.globl tkill
.align 4
tkill:
stmfd sp!, {r4-r7, ip, lr}
ldr r7, =__NR_tkill
swi #0
ldmfd sp!, {r4-r7, ip, lr}
movs r0, r0
bxpl lr
b __set_syscall_errno

View File

@ -0,0 +1,10 @@
/* $OpenBSD: endian.h,v 1.3 2005/12/13 00:35:23 millert Exp $ */
#ifdef __ARMEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#define __STRICT_ALIGNMENT
#include <sys/types.h>
#include <sys/endian.h>

View File

@ -0,0 +1,127 @@
/* $OpenBSD: _types.h,v 1.3 2006/02/14 18:12:58 miod Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
*/
#ifndef _ARM__TYPES_H_
#define _ARM__TYPES_H_
#if !defined(__ARM_EABI__)
/* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */
#define _SIZE_T
#define _SSIZE_T
#define _PTRDIFF_T
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#endif
//#include <linux/types.h>
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef __int8_t __int_least8_t;
typedef __uint8_t __uint_least8_t;
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
typedef __int64_t __int_least64_t;
typedef __uint64_t __uint_least64_t;
/* 7.18.1.3 Fastest minimum-width integer types */
typedef __int32_t __int_fast8_t;
typedef __uint32_t __uint_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __uint32_t __uint_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __uint32_t __uint_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __uint64_t __uint_fast64_t;
/* 7.18.1.4 Integer types capable of holding object pointers */
typedef int __intptr_t;
typedef unsigned int __uintptr_t;
/* 7.18.1.5 Greatest-width integer types */
typedef __int64_t __intmax_t;
typedef __uint64_t __uintmax_t;
/* Register size */
typedef __int32_t __register_t;
/* VM system types */
typedef unsigned long __vaddr_t;
typedef unsigned long __paddr_t;
typedef unsigned long __vsize_t;
typedef unsigned long __psize_t;
/* Standard system types */
typedef int __clock_t;
typedef int __clockid_t;
typedef long __ptrdiff_t;
typedef int __time_t;
typedef int __timer_t;
#if defined(__GNUC__) && __GNUC__ >= 3
typedef __builtin_va_list __va_list;
#else
typedef char * __va_list;
#endif
/* Wide character support types */
#ifndef __cplusplus
typedef int __wchar_t;
#endif
typedef int __wint_t;
typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
#ifdef __ARMEB__
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
#endif
#endif /* _ARM__TYPES_H_ */

View File

@ -0,0 +1,130 @@
/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
/* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)asm.h 5.5 (Berkeley) 5/7/91
*/
#ifndef _ARM32_ASM_H_
#define _ARM32_ASM_H_
#ifdef __ELF__
# define _C_LABEL(x) x
#else
# ifdef __STDC__
# define _C_LABEL(x) _ ## x
# else
# define _C_LABEL(x) _/**/x
# endif
#endif
#define _ASM_LABEL(x) x
#ifdef __STDC__
# define __CONCAT(x,y) x ## y
# define __STRING(x) #x
#else
# define __CONCAT(x,y) x/**/y
# define __STRING(x) "x"
#endif
#ifndef _ALIGN_TEXT
# define _ALIGN_TEXT .align 0
#endif
/*
* gas/arm uses @ as a single comment character and thus cannot be used here
* Instead it recognised the # instead of an @ symbols in .type directives
* We define a couple of macros so that assembly code will not be dependant
* on one or the other.
*/
#define _ASM_TYPE_FUNCTION #function
#define _ASM_TYPE_OBJECT #object
#define _ENTRY(x) \
.text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x:
#ifdef GPROF
# ifdef __ELF__
# define _PROF_PROLOGUE \
mov ip, lr; bl __mcount
# else
# define _PROF_PROLOGUE \
mov ip,lr; bl mcount
# endif
#else
# define _PROF_PROLOGUE
#endif
#define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
#define ENTRY_NP(y) _ENTRY(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define ASMSTR .asciz
#if defined(__ELF__) && defined(PIC)
#ifdef __STDC__
#define PIC_SYM(x,y) x ## ( ## y ## )
#else
#define PIC_SYM(x,y) x/**/(/**/y/**/)
#endif
#else
#define PIC_SYM(x,y) x
#endif
#ifdef __ELF__
#define RCSID(x) .section ".ident"; .asciz x
#else
#define RCSID(x) .text; .asciz x
#endif
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak alias; \
alias = sym
#endif
#ifdef __STDC__
#define WARN_REFERENCES(sym,msg) \
.stabs msg ## ,30,0,0,0 ; \
.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
#elif defined(__ELF__)
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(sym),1,0,0,0
#else
#define WARN_REFERENCES(sym,msg) \
.stabs msg,30,0,0,0 ; \
.stabs __STRING(_/**/sym),1,0,0,0
#endif /* __STDC__ */
#endif /* !_ARM_ASM_H_ */

View File

@ -0,0 +1,19 @@
/* $OpenBSD: cdefs.h,v 1.2 2005/11/24 20:46:44 deraadt Exp $ */
#ifndef _MACHINE_CDEFS_H_
#define _MACHINE_CDEFS_H_
#if defined(lint)
#define __indr_reference(sym,alias) __lint_equal__(sym,alias)
#define __warn_references(sym,msg)
#define __weak_alias(alias,sym) __lint_equal__(sym,alias)
#elif defined(__GNUC__) && defined(__STDC__)
#define __weak_alias(alias,sym) \
__asm__(".weak " __STRING(alias) " ; " __STRING(alias) \
" = " __STRING(sym));
#define __warn_references(sym,msg) \
__asm__(".section .gnu.warning." __STRING(sym) \
" ; .ascii \"" msg "\" ; .text");
#endif
#endif /* !_MACHINE_CDEFS_H_ */

View File

@ -0,0 +1,171 @@
/*
* 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.
*/
#ifndef _ARM_MACHINE_CPU_FEATURES_H
#define _ARM_MACHINE_CPU_FEATURES_H
/* The purpose of this file is to define several macros corresponding
* to CPU features that may or may not be available at build time on
* on the target CPU.
*
* This is done to abstract us from the various ARM Architecture
* quirks and alphabet soup.
*
* IMPORTANT: We have no intention to support anything below an ARMv4T !
*/
/* _ARM_ARCH_REVISION is a number corresponding to the ARM revision
* we're going to support
*
* it looks like our toolchain doesn't define __ARM_ARCH__
* so try to guess it.
*
*
*
*/
#ifndef __ARM_ARCH__
# if defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ || \
defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__
# define __ARM_ARCH__ 7
# elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ || \
defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6Z__ || \
defined __ARM_ARCH_6KZ__ || defined __ARM_ARCH_6T2__
#
# define __ARM_ARCH__ 6
#
# elif defined __ARM_ARCH_5__ || defined __ARM_ARCH_5T__ || \
defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__
#
# define __ARM_ARCH__ 5
#
# elif defined __ARM_ARCH_4T__
#
# define __ARM_ARCH__ 4
#
# elif defined __ARM_ARCH_4__
# error ARMv4 is not supported, please use ARMv4T at a minimum
# else
# error Unknown or unsupported ARM architecture
# endif
#endif
/* experimental feature used to check that our ARMv4 workarounds
* work correctly without a real ARMv4 machine */
#ifdef BIONIC_EXPERIMENTAL_FORCE_ARMV4
# undef __ARM_ARCH__
# define __ARM_ARCH__ 4
#endif
/* define __ARM_HAVE_5TE if we have the ARMv5TE instructions */
#if __ARM_ARCH__ > 5
# define __ARM_HAVE_5TE 1
#elif __ARM_ARCH__ == 5
# if defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__
# define __ARM_HAVE_5TE 1
# endif
#endif
/* instructions introduced in ARMv5 */
#if __ARM_ARCH__ >= 5
# define __ARM_HAVE_BLX 1
# define __ARM_HAVE_CLZ 1
# define __ARM_HAVE_LDC2 1
# define __ARM_HAVE_MCR2 1
# define __ARM_HAVE_MRC2 1
# define __ARM_HAVE_STC2 1
#endif
/* ARMv5TE introduces a few instructions */
#if __ARM_HAVE_5TE
# define __ARM_HAVE_PLD 1
# define __ARM_HAVE_MCRR 1
# define __ARM_HAVE_MRRC 1
#endif
/* define __ARM_HAVE_HALFWORD_MULTIPLY when half-word multiply instructions
* this means variants of: smul, smulw, smla, smlaw, smlal
*/
#if __ARM_HAVE_5TE
# define __ARM_HAVE_HALFWORD_MULTIPLY 1
#endif
/* define __ARM_HAVE_PAIR_LOAD_STORE when 64-bit memory loads and stored
* into/from a pair of 32-bit registers is supported throuhg 'ldrd' and 'strd'
*/
#if __ARM_HAVE_5TE
# define __ARM_HAVE_PAIR_LOAD_STORE 1
#endif
/* define __ARM_HAVE_SATURATED_ARITHMETIC is you have the saturated integer
* arithmetic instructions: qdd, qdadd, qsub, qdsub
*/
#if __ARM_HAVE_5TE
# define __ARM_HAVE_SATURATED_ARITHMETIC 1
#endif
/* define __ARM_HAVE_PC_INTERWORK when a direct assignment to the
* pc register will switch into thumb/ARM mode depending on bit 0
* of the new instruction address. Before ARMv5, this was not the
* case, and you have to write:
*
* mov r0, [<some address>]
* bx r0
*
* instead of:
*
* ldr pc, [<some address>]
*
* note that this affects any instruction that explicitely changes the
* value of the pc register, including ldm { ...,pc } or 'add pc, #offset'
*/
#if __ARM_ARCH__ >= 5
# define __ARM_HAVE_PC_INTERWORK
#endif
/* define _ARM_HAVE_LDREX_STREX for ARMv6 and ARMv7 architecure to be
* used in replacement of depricated swp instruction
*/
#if __ARM_ARCH__ >= 6
# define _ARM_HAVE_LDREX_STREX
#endif
/* Assembly-only macros */
/* define a handy PLD(address) macro since the cache preload
* is an optional opcode
*/
#if __ARM_HAVE_PLD
# define PLD(reg,offset) pld [reg, offset]
#else
# define PLD(reg,offset) /* nothing */
#endif
#endif /* _ARM_MACHINE_CPU_FEATURES_H */

View File

@ -0,0 +1,50 @@
/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */
/* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */
/*
* Copyright (c) 1993 Christopher G. Demetriou
* 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 _ARM_EXEC_H_
#define _ARM_EXEC_H_
#define __LDPGSZ 4096
#define NATIVE_EXEC_ELF
#define ARCH_ELFSIZE 32
#define ELF_TARG_CLASS ELFCLASS32
#define ELF_TARG_DATA ELFDATA2LSB
#define ELF_TARG_MACH EM_ARM
#define _NLIST_DO_AOUT
#define _NLIST_DO_ELF
#define _KERN_DO_AOUT
#define _KERN_DO_ELF
#endif /* _ARM_EXEC_H_ */

View File

@ -0,0 +1,191 @@
/* $OpenBSD: ieee.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
/* $NetBSD: ieee.h,v 1.2 2001/02/21 17:43:50 bjh21 Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
*
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
*/
/*
* ieee.h defines the machine-dependent layout of the machine's IEEE
* floating point.
*/
/*
* Define the number of bits in each fraction and exponent.
*
* k k+1
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
*
* (-exp_bias+1)
* as fractions that look like 0.fffff x 2 . This means that
*
* -126
* the number 0.10000 x 2 , for instance, is the same as the normalized
*
* -127 -128
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
*
* -129
* in the fraction; to represent 2 , we need two, and so on. This
*
* (-exp_bias-fracbits+1)
* implies that the smallest denormalized number is 2
*
* for whichever format we are talking about: for single precision, for
*
* -126 -149
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
*
* -149 == -127 - 23 + 1.
*/
/*
* The ARM has two sets of FP data formats. The FPA supports 32-bit, 64-bit
* and 96-bit IEEE formats, with the words in big-endian order. VFP supports
* 32-bin and 64-bit IEEE formats with the words in the CPU's native byte
* order.
*
* The FPA also has two packed decimal formats, but we ignore them here.
*/
#define SNG_EXPBITS 8
#define SNG_FRACBITS 23
#define DBL_EXPBITS 11
#define DBL_FRACBITS 52
#ifndef __VFP_FP__
#define E80_EXPBITS 15
#define E80_FRACBITS 64
#define EXT_EXPBITS 15
#define EXT_FRACBITS 112
#endif
struct ieee_single {
u_int sng_frac:23;
u_int sng_exponent:8;
u_int sng_sign:1;
};
#ifdef __VFP_FP__
struct ieee_double {
#ifdef __ARMEB__
u_int dbl_sign:1;
u_int dbl_exp:11;
u_int dbl_frach:20;
u_int dbl_fracl;
#else /* !__ARMEB__ */
u_int dbl_fracl;
u_int dbl_frach:20;
u_int dbl_exp:11;
u_int dbl_sign:1;
#endif /* !__ARMEB__ */
};
#else /* !__VFP_FP__ */
struct ieee_double {
u_int dbl_frach:20;
u_int dbl_exp:11;
u_int dbl_sign:1;
u_int dbl_fracl;
};
union ieee_double_u {
double dblu_d;
struct ieee_double dblu_dbl;
};
struct ieee_e80 {
u_int e80_exp:15;
u_int e80_zero:16;
u_int e80_sign:1;
u_int e80_frach:31;
u_int e80_j:1;
u_int e80_fracl;
};
struct ieee_ext {
u_int ext_frach:16;
u_int ext_exp:15;
u_int ext_sign:1;
u_int ext_frachm;
u_int ext_fraclm;
u_int ext_fracl;
};
#endif /* !__VFP_FP__ */
/*
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
* Floats whose exponent is zero are either zero (iff all fraction
* bits are zero) or subnormal values.
*
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
* high fraction; if the bit is set, it is a `quiet NaN'.
*/
#define SNG_EXP_INFNAN 255
#define DBL_EXP_INFNAN 2047
#ifndef __VFP_FP__
#define E80_EXP_INFNAN 32767
#define EXT_EXP_INFNAN 32767
#endif /* !__VFP_FP__ */
#if 0
#define SNG_QUIETNAN (1 << 22)
#define DBL_QUIETNAN (1 << 19)
#ifndef __VFP_FP__
#define E80_QUIETNAN (1 << 15)
#define EXT_QUIETNAN (1 << 15)
#endif /* !__VFP_FP__ */
#endif
/*
* Exponent biases.
*/
#define SNG_EXP_BIAS 127
#define DBL_EXP_BIAS 1023
#ifndef __VFP_FP__
#define E80_EXP_BIAS 16383
#define EXT_EXP_BIAS 16383
#endif /* !__VFP_FP__ */

View File

@ -0,0 +1,10 @@
/* $OpenBSD: internal_types.h,v 1.2 2004/05/06 15:53:39 drahn Exp $ */
/* Public domain */
#ifndef _ARM_INTERNAL_TYPES_H_
#define _ARM_INTERNAL_TYPES_H_
#ifdef __CHAR_UNSIGNED__
#define __machine_has_unsigned_chars
#endif
#endif

View File

@ -0,0 +1,42 @@
/*
* 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.
*/
#ifndef _ARCH_ARM_KERNEL_H
#define _ARCH_ARM_KERNEL_H
/* this file contains kernel-specific definitions that were optimized out of
our processed kernel headers, but still useful nonetheless... */
typedef unsigned long __kernel_blkcnt_t;
typedef unsigned long __kernel_blksize_t;
/* these aren't really defined by the kernel headers though... */
typedef unsigned long __kernel_fsblkcnt_t;
typedef unsigned long __kernel_fsfilcnt_t;
typedef unsigned int __kernel_id_t;
#endif /* _ARCH_ARM_KERNEL_H */

View File

@ -1,6 +1,9 @@
/* $OpenBSD: limits.h,v 1.3 2006/01/06 22:48:46 millert Exp $ */
/* $NetBSD: limits.h,v 1.4 2003/04/28 23:16:18 bjh21 Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -10,7 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -25,40 +28,36 @@
* 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(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getpagesize.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: user/kmacy/releng_7_2_zfs/lib/libc/gen/getpagesize.c 165903 2007-01-09 00:28:16Z imp $");
#include <sys/param.h>
#include <sys/sysctl.h>
#include <unistd.h>
/*
* This is unlikely to change over the running time of any
* program, so we cache the result to save some syscalls.
*
* NB: This function may be called from malloc(3) at initialization
* NB: so must not result in a malloc(3) related call!
* from: @(#)limits.h 7.2 (Berkeley) 6/28/90
*/
int
getpagesize()
{
int mib[2];
static int value;
size_t size;
#ifndef _ARM32_LIMITS_H_
#define _ARM32_LIMITS_H_
if (!value) {
mib[0] = CTL_HW;
mib[1] = HW_PAGESIZE;
size = sizeof value;
if (sysctl(mib, 2, &value, &size, NULL, 0) == -1)
return (-1);
}
return (value);
}
#include <sys/cdefs.h>
#define MB_LEN_MAX 1 /* no multibyte characters */
#ifndef SIZE_MAX
#define SIZE_MAX UINT_MAX /* max value for a size_t */
#endif
#ifndef SSIZE_MAX
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#endif
#if __BSD_VISIBLE
#define SIZE_T_MAX UINT_MAX /* max value for a size_t (historic) */
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
#endif /* __BSD_VISIBLE */
#define LONGLONG_BIT 64
#define LONGLONG_MIN (-9223372036854775807LL-1)
#define LONGLONG_MAX 9223372036854775807LL
#define ULONGLONG_MAX 18446744073709551615ULL
#endif /* _ARM32_LIMITS_H_ */

View File

@ -0,0 +1,87 @@
/* $OpenBSD: setjmp.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */
/* $NetBSD: setjmp.h,v 1.2 2001/08/25 14:45:59 bjh21 Exp $ */
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*/
#ifdef __ELF__
#define _JBLEN 64 /* size, in longs, of a jmp_buf */
#else
#define _JBLEN 29 /* size, in longs, of a jmp_buf */
#endif
/*
* NOTE: The internal structure of a jmp_buf is *PRIVATE*
* This information is provided as there is software
* that fiddles with this with obtain the stack pointer
* (yes really ! and its commercial !).
*
* Description of the setjmp buffer
*
* word 0 magic number (dependant on creator)
* 1 - 3 f4 fp register 4
* 4 - 6 f5 fp register 5
* 7 - 9 f6 fp register 6
* 10 - 12 f7 fp register 7
* 13 fpsr fp status register
* 14 r4 register 4
* 15 r5 register 5
* 16 r6 register 6
* 17 r7 register 7
* 18 r8 register 8
* 19 r9 register 9
* 20 r10 register 10 (sl)
* 21 r11 register 11 (fp)
* 22 r12 register 12 (ip)
* 23 r13 register 13 (sp)
* 24 r14 register 14 (lr)
* 25 signal mask (dependant on magic)
* 26 (con't)
* 27 (con't)
* 28 (con't)
*
* The magic number number identifies the jmp_buf and
* how the buffer was created as well as providing
* a sanity check
*
* A side note I should mention - Please do not tamper
* with the floating point fields. While they are
* always saved and restored at the moment this cannot
* be garenteed especially if the compiler happens
* to be generating soft-float code so no fp
* registers will be used.
*
* Whilst this can be seen an encouraging people to
* use the setjmp buffer in this way I think that it
* is for the best then if changes occur compiles will
* break rather than just having new builds falling over
* mysteriously.
*/
#define _JB_MAGIC__SETJMP 0x4278f500
#define _JB_MAGIC_SETJMP 0x4278f501
/* Valid for all jmp_buf's */
#define _JB_MAGIC 0
#define _JB_REG_F4 1
#define _JB_REG_F5 4
#define _JB_REG_F6 7
#define _JB_REG_F7 10
#define _JB_REG_FPSR 13
#define _JB_REG_R4 14
#define _JB_REG_R5 15
#define _JB_REG_R6 16
#define _JB_REG_R7 17
#define _JB_REG_R8 18
#define _JB_REG_R9 19
#define _JB_REG_R10 20
#define _JB_REG_R11 21
#define _JB_REG_R12 22
#define _JB_REG_R13 23
#define _JB_REG_R14 24
/* Only valid with the _JB_MAGIC_SETJMP magic */
#define _JB_SIGMASK 25

View File

@ -0,0 +1,173 @@
# auto-generated by gensyscalls.py, do not touch
syscall_src :=
syscall_src += arch-arm/syscalls/_exit.S
syscall_src += arch-arm/syscalls/_exit_thread.S
syscall_src += arch-arm/syscalls/__fork.S
syscall_src += arch-arm/syscalls/waitid.S
syscall_src += arch-arm/syscalls/__sys_clone.S
syscall_src += arch-arm/syscalls/execve.S
syscall_src += arch-arm/syscalls/__setuid.S
syscall_src += arch-arm/syscalls/getuid.S
syscall_src += arch-arm/syscalls/getgid.S
syscall_src += arch-arm/syscalls/geteuid.S
syscall_src += arch-arm/syscalls/getegid.S
syscall_src += arch-arm/syscalls/getresuid.S
syscall_src += arch-arm/syscalls/getresgid.S
syscall_src += arch-arm/syscalls/gettid.S
syscall_src += arch-arm/syscalls/getgroups.S
syscall_src += arch-arm/syscalls/getpgid.S
syscall_src += arch-arm/syscalls/getppid.S
syscall_src += arch-arm/syscalls/setsid.S
syscall_src += arch-arm/syscalls/setgid.S
syscall_src += arch-arm/syscalls/__setreuid.S
syscall_src += arch-arm/syscalls/__setresuid.S
syscall_src += arch-arm/syscalls/setresgid.S
syscall_src += arch-arm/syscalls/__brk.S
syscall_src += arch-arm/syscalls/__ptrace.S
syscall_src += arch-arm/syscalls/__getpriority.S
syscall_src += arch-arm/syscalls/setpriority.S
syscall_src += arch-arm/syscalls/setrlimit.S
syscall_src += arch-arm/syscalls/getrlimit.S
syscall_src += arch-arm/syscalls/getrusage.S
syscall_src += arch-arm/syscalls/setgroups.S
syscall_src += arch-arm/syscalls/setpgid.S
syscall_src += arch-arm/syscalls/vfork.S
syscall_src += arch-arm/syscalls/setregid.S
syscall_src += arch-arm/syscalls/chroot.S
syscall_src += arch-arm/syscalls/prctl.S
syscall_src += arch-arm/syscalls/capget.S
syscall_src += arch-arm/syscalls/capset.S
syscall_src += arch-arm/syscalls/sigaltstack.S
syscall_src += arch-arm/syscalls/acct.S
syscall_src += arch-arm/syscalls/read.S
syscall_src += arch-arm/syscalls/write.S
syscall_src += arch-arm/syscalls/__pread64.S
syscall_src += arch-arm/syscalls/__pwrite64.S
syscall_src += arch-arm/syscalls/__open.S
syscall_src += arch-arm/syscalls/__openat.S
syscall_src += arch-arm/syscalls/close.S
syscall_src += arch-arm/syscalls/lseek.S
syscall_src += arch-arm/syscalls/__llseek.S
syscall_src += arch-arm/syscalls/getpid.S
syscall_src += arch-arm/syscalls/__mmap2.S
syscall_src += arch-arm/syscalls/munmap.S
syscall_src += arch-arm/syscalls/mremap.S
syscall_src += arch-arm/syscalls/msync.S
syscall_src += arch-arm/syscalls/mprotect.S
syscall_src += arch-arm/syscalls/madvise.S
syscall_src += arch-arm/syscalls/mlock.S
syscall_src += arch-arm/syscalls/munlock.S
syscall_src += arch-arm/syscalls/mincore.S
syscall_src += arch-arm/syscalls/__ioctl.S
syscall_src += arch-arm/syscalls/readv.S
syscall_src += arch-arm/syscalls/writev.S
syscall_src += arch-arm/syscalls/__fcntl.S
syscall_src += arch-arm/syscalls/flock.S
syscall_src += arch-arm/syscalls/fchmod.S
syscall_src += arch-arm/syscalls/dup.S
syscall_src += arch-arm/syscalls/pipe.S
syscall_src += arch-arm/syscalls/dup2.S
syscall_src += arch-arm/syscalls/select.S
syscall_src += arch-arm/syscalls/ftruncate.S
syscall_src += arch-arm/syscalls/getdents.S
syscall_src += arch-arm/syscalls/fsync.S
syscall_src += arch-arm/syscalls/fchown.S
syscall_src += arch-arm/syscalls/sync.S
syscall_src += arch-arm/syscalls/__fcntl64.S
syscall_src += arch-arm/syscalls/fstatfs.S
syscall_src += arch-arm/syscalls/sendfile.S
syscall_src += arch-arm/syscalls/fstatat.S
syscall_src += arch-arm/syscalls/mkdirat.S
syscall_src += arch-arm/syscalls/fchownat.S
syscall_src += arch-arm/syscalls/fchmodat.S
syscall_src += arch-arm/syscalls/renameat.S
syscall_src += arch-arm/syscalls/link.S
syscall_src += arch-arm/syscalls/unlink.S
syscall_src += arch-arm/syscalls/unlinkat.S
syscall_src += arch-arm/syscalls/chdir.S
syscall_src += arch-arm/syscalls/mknod.S
syscall_src += arch-arm/syscalls/chmod.S
syscall_src += arch-arm/syscalls/chown.S
syscall_src += arch-arm/syscalls/lchown.S
syscall_src += arch-arm/syscalls/mount.S
syscall_src += arch-arm/syscalls/umount2.S
syscall_src += arch-arm/syscalls/fstat.S
syscall_src += arch-arm/syscalls/stat.S
syscall_src += arch-arm/syscalls/lstat.S
syscall_src += arch-arm/syscalls/mkdir.S
syscall_src += arch-arm/syscalls/readlink.S
syscall_src += arch-arm/syscalls/rmdir.S
syscall_src += arch-arm/syscalls/rename.S
syscall_src += arch-arm/syscalls/__getcwd.S
syscall_src += arch-arm/syscalls/access.S
syscall_src += arch-arm/syscalls/symlink.S
syscall_src += arch-arm/syscalls/fchdir.S
syscall_src += arch-arm/syscalls/truncate.S
syscall_src += arch-arm/syscalls/__statfs64.S
syscall_src += arch-arm/syscalls/pause.S
syscall_src += arch-arm/syscalls/gettimeofday.S
syscall_src += arch-arm/syscalls/settimeofday.S
syscall_src += arch-arm/syscalls/times.S
syscall_src += arch-arm/syscalls/nanosleep.S
syscall_src += arch-arm/syscalls/clock_gettime.S
syscall_src += arch-arm/syscalls/clock_settime.S
syscall_src += arch-arm/syscalls/clock_getres.S
syscall_src += arch-arm/syscalls/clock_nanosleep.S
syscall_src += arch-arm/syscalls/getitimer.S
syscall_src += arch-arm/syscalls/setitimer.S
syscall_src += arch-arm/syscalls/__timer_create.S
syscall_src += arch-arm/syscalls/__timer_settime.S
syscall_src += arch-arm/syscalls/__timer_gettime.S
syscall_src += arch-arm/syscalls/__timer_getoverrun.S
syscall_src += arch-arm/syscalls/__timer_delete.S
syscall_src += arch-arm/syscalls/utimes.S
syscall_src += arch-arm/syscalls/sigprocmask.S
syscall_src += arch-arm/syscalls/__sigsuspend.S
syscall_src += arch-arm/syscalls/__rt_sigaction.S
syscall_src += arch-arm/syscalls/__rt_sigprocmask.S
syscall_src += arch-arm/syscalls/__rt_sigtimedwait.S
syscall_src += arch-arm/syscalls/sigpending.S
syscall_src += arch-arm/syscalls/__sigaction.S
syscall_src += arch-arm/syscalls/socket.S
syscall_src += arch-arm/syscalls/socketpair.S
syscall_src += arch-arm/syscalls/bind.S
syscall_src += arch-arm/syscalls/connect.S
syscall_src += arch-arm/syscalls/listen.S
syscall_src += arch-arm/syscalls/accept.S
syscall_src += arch-arm/syscalls/getsockname.S
syscall_src += arch-arm/syscalls/getpeername.S
syscall_src += arch-arm/syscalls/sendto.S
syscall_src += arch-arm/syscalls/recvfrom.S
syscall_src += arch-arm/syscalls/shutdown.S
syscall_src += arch-arm/syscalls/setsockopt.S
syscall_src += arch-arm/syscalls/getsockopt.S
syscall_src += arch-arm/syscalls/sendmsg.S
syscall_src += arch-arm/syscalls/recvmsg.S
syscall_src += arch-arm/syscalls/sched_setscheduler.S
syscall_src += arch-arm/syscalls/sched_getscheduler.S
syscall_src += arch-arm/syscalls/sched_yield.S
syscall_src += arch-arm/syscalls/sched_setparam.S
syscall_src += arch-arm/syscalls/sched_getparam.S
syscall_src += arch-arm/syscalls/sched_get_priority_max.S
syscall_src += arch-arm/syscalls/sched_get_priority_min.S
syscall_src += arch-arm/syscalls/sched_rr_get_interval.S
syscall_src += arch-arm/syscalls/ioprio_set.S
syscall_src += arch-arm/syscalls/ioprio_get.S
syscall_src += arch-arm/syscalls/uname.S
syscall_src += arch-arm/syscalls/__wait4.S
syscall_src += arch-arm/syscalls/umask.S
syscall_src += arch-arm/syscalls/__reboot.S
syscall_src += arch-arm/syscalls/__syslog.S
syscall_src += arch-arm/syscalls/init_module.S
syscall_src += arch-arm/syscalls/delete_module.S
syscall_src += arch-arm/syscalls/klogctl.S
syscall_src += arch-arm/syscalls/futex.S
syscall_src += arch-arm/syscalls/epoll_create.S
syscall_src += arch-arm/syscalls/epoll_ctl.S
syscall_src += arch-arm/syscalls/epoll_wait.S
syscall_src += arch-arm/syscalls/inotify_init.S
syscall_src += arch-arm/syscalls/inotify_add_watch.S
syscall_src += arch-arm/syscalls/inotify_rm_watch.S
syscall_src += arch-arm/syscalls/poll.S
syscall_src += arch-arm/syscalls/__set_tls.S
syscall_src += arch-arm/syscalls/cacheflush.S

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __brk, #function
.globl __brk
.align 4
.fnstart
__brk:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_brk
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fcntl, #function
.globl __fcntl
.align 4
.fnstart
__fcntl:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fcntl
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fcntl64, #function
.globl __fcntl64
.align 4
.fnstart
__fcntl64:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fcntl64
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fork, #function
.globl __fork
.align 4
.fnstart
__fork:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fork
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __getcwd, #function
.globl __getcwd
.align 4
.fnstart
__getcwd:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_getcwd
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __getpriority, #function
.globl __getpriority
.align 4
.fnstart
__getpriority:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_getpriority
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __ioctl, #function
.globl __ioctl
.align 4
.fnstart
__ioctl:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_ioctl
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,21 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __llseek, #function
.globl __llseek
.align 4
.fnstart
__llseek:
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR__llseek
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,21 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __mmap2, #function
.globl __mmap2
.align 4
.fnstart
__mmap2:
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_mmap2
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __open, #function
.globl __open
.align 4
.fnstart
__open:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_open
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __openat, #function
.globl __openat
.align 4
.fnstart
__openat:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_openat
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,21 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __pread64, #function
.globl __pread64
.align 4
.fnstart
__pread64:
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_pread64
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __ptrace, #function
.globl __ptrace
.align 4
.fnstart
__ptrace:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_ptrace
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,21 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __pwrite64, #function
.globl __pwrite64
.align 4
.fnstart
__pwrite64:
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_pwrite64
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __reboot, #function
.globl __reboot
.align 4
.fnstart
__reboot:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_reboot
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigaction, #function
.globl __rt_sigaction
.align 4
.fnstart
__rt_sigaction:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_rt_sigaction
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigprocmask, #function
.globl __rt_sigprocmask
.align 4
.fnstart
__rt_sigprocmask:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_rt_sigprocmask
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigtimedwait, #function
.globl __rt_sigtimedwait
.align 4
.fnstart
__rt_sigtimedwait:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_rt_sigtimedwait
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __set_tls, #function
.globl __set_tls
.align 4
.fnstart
__set_tls:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_ARM_set_tls
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setresuid, #function
.globl __setresuid
.align 4
.fnstart
__setresuid:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_setresuid32
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setreuid, #function
.globl __setreuid
.align 4
.fnstart
__setreuid:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_setreuid32
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setuid, #function
.globl __setuid
.align 4
.fnstart
__setuid:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_setuid32
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sigaction, #function
.globl __sigaction
.align 4
.fnstart
__sigaction:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_sigaction
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sigsuspend, #function
.globl __sigsuspend
.align 4
.fnstart
__sigsuspend:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_sigsuspend
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __statfs64, #function
.globl __statfs64
.align 4
.fnstart
__statfs64:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_statfs64
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,21 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sys_clone, #function
.globl __sys_clone
.align 4
.fnstart
__sys_clone:
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_clone
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __syslog, #function
.globl __syslog
.align 4
.fnstart
__syslog:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_syslog
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_create, #function
.globl __timer_create
.align 4
.fnstart
__timer_create:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_timer_create
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_delete, #function
.globl __timer_delete
.align 4
.fnstart
__timer_delete:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_timer_delete
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_getoverrun, #function
.globl __timer_getoverrun
.align 4
.fnstart
__timer_getoverrun:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_timer_getoverrun
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_gettime, #function
.globl __timer_gettime
.align 4
.fnstart
__timer_gettime:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_timer_gettime
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_settime, #function
.globl __timer_settime
.align 4
.fnstart
__timer_settime:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_timer_settime
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __wait4, #function
.globl __wait4
.align 4
.fnstart
__wait4:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_wait4
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type _exit, #function
.globl _exit
.align 4
.fnstart
_exit:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_exit_group
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type _exit_thread, #function
.globl _exit_thread
.align 4
.fnstart
_exit_thread:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_exit
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type accept, #function
.globl accept
.align 4
.fnstart
accept:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_accept
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type access, #function
.globl access
.align 4
.fnstart
access:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_access
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type acct, #function
.globl acct
.align 4
.fnstart
acct:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_acct
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type bind, #function
.globl bind
.align 4
.fnstart
bind:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_bind
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type cacheflush, #function
.globl cacheflush
.align 4
.fnstart
cacheflush:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_ARM_cacheflush
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type capget, #function
.globl capget
.align 4
.fnstart
capget:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_capget
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type capset, #function
.globl capset
.align 4
.fnstart
capset:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_capset
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chdir, #function
.globl chdir
.align 4
.fnstart
chdir:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_chdir
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chmod, #function
.globl chmod
.align 4
.fnstart
chmod:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_chmod
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chown, #function
.globl chown
.align 4
.fnstart
chown:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_chown32
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chroot, #function
.globl chroot
.align 4
.fnstart
chroot:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_chroot
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type clock_getres, #function
.globl clock_getres
.align 4
.fnstart
clock_getres:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_clock_getres
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type clock_gettime, #function
.globl clock_gettime
.align 4
.fnstart
clock_gettime:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_clock_gettime
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

View File

@ -0,0 +1,19 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type clock_nanosleep, #function
.globl clock_nanosleep
.align 4
.fnstart
clock_nanosleep:
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_clock_nanosleep
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
.fnend

Some files were not shown because too many files have changed in this diff Show More