Merge "bionic: move benchmarks out of tests directory"
authorColin Cross <ccross@android.com>
Wed, 11 Dec 2013 19:05:24 +0000 (19:05 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Wed, 11 Dec 2013 19:05:25 +0000 (19:05 +0000)
555 files changed:
libc/Android.mk
libc/SYSCALLS.TXT
libc/arch-aarch64/syscalls.mk
libc/arch-aarch64/syscalls/__set_tid_address.S [moved from libc/arch-aarch64/syscalls/__clone.S with 73% similarity]
libc/arch-arm/arm.mk
libc/arch-arm/bionic/__bionic_clone.S [moved from libc/arch-arm/bionic/clone.S with 61% similarity]
libc/arch-arm/bionic/_exit_with_stack_teardown.S
libc/arch-arm/bionic/abort_arm.S
libc/arch-arm/bionic/memcmp.S
libc/arch-arm/bionic/memcmp16.S
libc/arch-arm/bionic/setjmp.S
libc/arch-arm/bionic/syscall.S
libc/arch-arm/bionic/tgkill.S [deleted file]
libc/arch-arm/bionic/tkill.S [deleted file]
libc/arch-arm/cortex-a15/bionic/__strcat_chk.S
libc/arch-arm/cortex-a15/bionic/__strcpy_chk.S
libc/arch-arm/cortex-a15/bionic/memcpy.S
libc/arch-arm/cortex-a15/bionic/memcpy_base.S
libc/arch-arm/cortex-a15/bionic/memset.S
libc/arch-arm/cortex-a15/bionic/strcmp.S
libc/arch-arm/cortex-a9/bionic/__strcat_chk.S
libc/arch-arm/cortex-a9/bionic/__strcpy_chk.S
libc/arch-arm/cortex-a9/bionic/memcpy.S
libc/arch-arm/cortex-a9/bionic/memcpy_base.S
libc/arch-arm/cortex-a9/bionic/memset.S
libc/arch-arm/cortex-a9/bionic/strcmp.S
libc/arch-arm/include/machine/asm.h
libc/arch-arm/krait/bionic/__strcat_chk.S
libc/arch-arm/krait/bionic/__strcpy_chk.S
libc/arch-arm/krait/bionic/memcpy.S
libc/arch-arm/krait/bionic/memcpy_base.S
libc/arch-arm/krait/bionic/memset.S
libc/arch-arm/krait/bionic/strcmp.S
libc/arch-arm/syscalls.mk
libc/arch-arm/syscalls/__clone.S [deleted file]
libc/arch-arm/syscalls/__epoll_pwait.S
libc/arch-arm/syscalls/__llseek.S
libc/arch-arm/syscalls/__mmap2.S
libc/arch-arm/syscalls/__ppoll.S
libc/arch-arm/syscalls/__pselect6.S
libc/arch-arm/syscalls/__set_tid_address.S [new file with mode: 0644]
libc/arch-arm/syscalls/__waitid.S
libc/arch-arm/syscalls/fchownat.S
libc/arch-arm/syscalls/fsetxattr.S
libc/arch-arm/syscalls/futex.S
libc/arch-arm/syscalls/getsockopt.S
libc/arch-arm/syscalls/kill.S [new file with mode: 0644]
libc/arch-arm/syscalls/linkat.S
libc/arch-arm/syscalls/lsetxattr.S
libc/arch-arm/syscalls/mount.S
libc/arch-arm/syscalls/perf_event_open.S
libc/arch-arm/syscalls/prctl.S
libc/arch-arm/syscalls/pread64.S
libc/arch-arm/syscalls/pwrite64.S
libc/arch-arm/syscalls/readahead.S
libc/arch-arm/syscalls/recvfrom.S
libc/arch-arm/syscalls/sendto.S
libc/arch-arm/syscalls/setsockopt.S
libc/arch-arm/syscalls/setxattr.S
libc/arch-arm/syscalls/tgkill.S [new file with mode: 0644]
libc/arch-arm/syscalls/tkill.S [new file with mode: 0644]
libc/arch-mips/bionic/__bionic_clone.S [moved from libc/bionic/usleep.c with 58% similarity]
libc/arch-mips/bionic/_exit_with_stack_teardown.S
libc/arch-mips/bionic/clone.S [deleted file]
libc/arch-mips/mips.mk
libc/arch-mips/syscalls.mk
libc/arch-mips/syscalls/__set_tid_address.S [moved from libc/arch-mips/syscalls/__clone.S with 65% similarity]
libc/arch-x86/bionic/__bionic_clone.S [new file with mode: 0644]
libc/arch-x86/bionic/_exit_with_stack_teardown.S
libc/arch-x86/bionic/clone.S [deleted file]
libc/arch-x86/include/machine/asm.h
libc/arch-x86/string/bcopy.S
libc/arch-x86/syscalls.mk
libc/arch-x86/syscalls/__clone.S [deleted file]
libc/arch-x86/syscalls/__set_tid_address.S [new file with mode: 0644]
libc/arch-x86/x86.mk
libc/arch-x86_64/bionic/__bionic_clone.S [moved from libc/arch-x86_64/bionic/clone.S with 62% similarity]
libc/arch-x86_64/bionic/_exit_with_stack_teardown.S
libc/arch-x86_64/bionic/_setjmp.S
libc/arch-x86_64/bionic/futex_x86_64.S
libc/arch-x86_64/bionic/setjmp.S
libc/arch-x86_64/bionic/sigsetjmp.S
libc/arch-x86_64/include/machine/asm.h
libc/arch-x86_64/syscalls.mk
libc/arch-x86_64/syscalls/__set_tid_address.S [moved from libc/arch-x86_64/syscalls/__clone.S with 65% similarity]
libc/arch-x86_64/x86_64.mk
libc/bionic/__thread_entry.cpp [deleted file]
libc/bionic/clone.cpp [moved from libc/bionic/bionic_clone.c with 56% similarity]
libc/bionic/dlmalloc.c
libc/bionic/fork.cpp
libc/bionic/libc_init_common.cpp
libc/bionic/name_mem.c [moved from libc/arch-arm/bionic/kill.S with 55% similarity]
libc/bionic/pthread_cond.cpp
libc/bionic/pthread_create.cpp
libc/bionic/pthread_exit.cpp
libc/bionic/pthread_internal.h
libc/bionic/pthread_internals.cpp
libc/bionic/pthread_join.cpp
libc/bionic/pthread_key.cpp
libc/bionic/pthread_mutex.cpp
libc/include/netdb.h
libc/include/signal.h
libc/include/sys/cdefs.h
libc/include/sys/glibc-syscalls.h
libc/include/sys/reboot.h
libc/include/sys/timerfd.h
libc/include/sys/types.h
libc/include/sys/user.h [new file with mode: 0644]
libc/include/unistd.h
libc/kernel/arch-mips/asm/a.out.h [deleted file]
libc/kernel/arch-mips/asm/addrspace.h [deleted file]
libc/kernel/arch-mips/asm/asm.h [deleted file]
libc/kernel/arch-mips/asm/atomic.h [deleted file]
libc/kernel/arch-mips/asm/auxvec.h [deleted file]
libc/kernel/arch-mips/asm/barrier.h [deleted file]
libc/kernel/arch-mips/asm/bitops.h [deleted file]
libc/kernel/arch-mips/asm/bootinfo.h [deleted file]
libc/kernel/arch-mips/asm/bug.h [deleted file]
libc/kernel/arch-mips/asm/byteorder.h [deleted file]
libc/kernel/arch-mips/asm/cache.h [deleted file]
libc/kernel/arch-mips/asm/cachectl.h [deleted file]
libc/kernel/arch-mips/asm/cacheflush.h [deleted file]
libc/kernel/arch-mips/asm/cacheops.h [deleted file]
libc/kernel/arch-mips/asm/checksum.h [deleted file]
libc/kernel/arch-mips/asm/cmpxchg.h [deleted file]
libc/kernel/arch-mips/asm/compiler.h [deleted file]
libc/kernel/arch-mips/asm/cpu-features.h [deleted file]
libc/kernel/arch-mips/asm/cpu-info.h [deleted file]
libc/kernel/arch-mips/asm/cpu.h [deleted file]
libc/kernel/arch-mips/asm/cputime.h [deleted file]
libc/kernel/arch-mips/asm/current.h [deleted file]
libc/kernel/arch-mips/asm/debug.h [deleted file]
libc/kernel/arch-mips/asm/dec/ecc.h [deleted file]
libc/kernel/arch-mips/asm/dec/ioasic_addrs.h [deleted file]
libc/kernel/arch-mips/asm/dec/kn02xa.h [deleted file]
libc/kernel/arch-mips/asm/delay.h [deleted file]
libc/kernel/arch-mips/asm/device.h [deleted file]
libc/kernel/arch-mips/asm/div64.h [deleted file]
libc/kernel/arch-mips/asm/dma-mapping.h [deleted file]
libc/kernel/arch-mips/asm/dma.h [deleted file]
libc/kernel/arch-mips/asm/ds1286.h [deleted file]
libc/kernel/arch-mips/asm/dsp.h [deleted file]
libc/kernel/arch-mips/asm/errno.h [deleted file]
libc/kernel/arch-mips/asm/fixmap.h [deleted file]
libc/kernel/arch-mips/asm/floppy.h [deleted file]
libc/kernel/arch-mips/asm/fw/arc/types.h [deleted file]
libc/kernel/arch-mips/asm/gt64120.h [deleted file]
libc/kernel/arch-mips/asm/hardirq.h [deleted file]
libc/kernel/arch-mips/asm/hazards.h [deleted file]
libc/kernel/arch-mips/asm/hw_irq.h [deleted file]
libc/kernel/arch-mips/asm/i8253.h [deleted file]
libc/kernel/arch-mips/asm/i8259.h [deleted file]
libc/kernel/arch-mips/asm/ide.h [deleted file]
libc/kernel/arch-mips/asm/io.h [deleted file]
libc/kernel/arch-mips/asm/ioctl.h [deleted file]
libc/kernel/arch-mips/asm/ioctls.h [deleted file]
libc/kernel/arch-mips/asm/ip32/crime.h [deleted file]
libc/kernel/arch-mips/asm/ip32/mace.h [deleted file]
libc/kernel/arch-mips/asm/ipcbuf.h [deleted file]
libc/kernel/arch-mips/asm/irq.h [deleted file]
libc/kernel/arch-mips/asm/irq_gt641xx.h [deleted file]
libc/kernel/arch-mips/asm/irq_regs.h [deleted file]
libc/kernel/arch-mips/asm/jazz.h [deleted file]
libc/kernel/arch-mips/asm/jazzdma.h [deleted file]
libc/kernel/arch-mips/asm/kmap_types.h [deleted file]
libc/kernel/arch-mips/asm/lasat/lasat.h [deleted file]
libc/kernel/arch-mips/asm/linkage.h [deleted file]
libc/kernel/arch-mips/asm/local.h [deleted file]
libc/kernel/arch-mips/asm/mach-au1x00/au1000.h [deleted file]
libc/kernel/arch-mips/asm/mach-au1x00/au1xxx_psc.h [deleted file]
libc/kernel/arch-mips/asm/mach-generic/spaces.h [deleted file]
libc/kernel/arch-mips/asm/mach-ip22/ds1286.h [deleted file]
libc/kernel/arch-mips/asm/mc146818rtc.h [deleted file]
libc/kernel/arch-mips/asm/mips-boards/bonito64.h [deleted file]
libc/kernel/arch-mips/asm/mips-boards/generic.h [deleted file]
libc/kernel/arch-mips/asm/mips-boards/malta.h [deleted file]
libc/kernel/arch-mips/asm/mips-boards/msc01_pci.h [deleted file]
libc/kernel/arch-mips/asm/mips_mt.h [deleted file]
libc/kernel/arch-mips/asm/mipsmtregs.h [deleted file]
libc/kernel/arch-mips/asm/mipsregs.h [deleted file]
libc/kernel/arch-mips/asm/mman.h [deleted file]
libc/kernel/arch-mips/asm/mmu.h [deleted file]
libc/kernel/arch-mips/asm/mmzone.h [deleted file]
libc/kernel/arch-mips/asm/module.h [deleted file]
libc/kernel/arch-mips/asm/msgbuf.h [deleted file]
libc/kernel/arch-mips/asm/mutex.h [deleted file]
libc/kernel/arch-mips/asm/param.h [deleted file]
libc/kernel/arch-mips/asm/pci/bridge.h [deleted file]
libc/kernel/arch-mips/asm/percpu.h [deleted file]
libc/kernel/arch-mips/asm/pgalloc.h [deleted file]
libc/kernel/arch-mips/asm/pgtable-32.h [deleted file]
libc/kernel/arch-mips/asm/pgtable-bits.h [deleted file]
libc/kernel/arch-mips/asm/pgtable.h [deleted file]
libc/kernel/arch-mips/asm/poll.h [deleted file]
libc/kernel/arch-mips/asm/posix_types.h [deleted file]
libc/kernel/arch-mips/asm/prefetch.h [deleted file]
libc/kernel/arch-mips/asm/processor.h [deleted file]
libc/kernel/arch-mips/asm/reg.h [deleted file]
libc/kernel/arch-mips/asm/resource.h [deleted file]
libc/kernel/arch-mips/asm/sections.h [deleted file]
libc/kernel/arch-mips/asm/segment.h [deleted file]
libc/kernel/arch-mips/asm/sembuf.h [deleted file]
libc/kernel/arch-mips/asm/setup.h [deleted file]
libc/kernel/arch-mips/asm/sgi/hpc3.h [deleted file]
libc/kernel/arch-mips/asm/sgi/ioc.h [deleted file]
libc/kernel/arch-mips/asm/sgi/pi1.h [deleted file]
libc/kernel/arch-mips/asm/sgiarcs.h [deleted file]
libc/kernel/arch-mips/asm/sgidefs.h [deleted file]
libc/kernel/arch-mips/asm/shmbuf.h [deleted file]
libc/kernel/arch-mips/asm/shmparam.h [deleted file]
libc/kernel/arch-mips/asm/sibyte/bcm1480_int.h [deleted file]
libc/kernel/arch-mips/asm/sibyte/bcm1480_scd.h [deleted file]
libc/kernel/arch-mips/asm/sibyte/sb1250.h [deleted file]
libc/kernel/arch-mips/asm/sibyte/sb1250_int.h [deleted file]
libc/kernel/arch-mips/asm/sibyte/sb1250_scd.h [deleted file]
libc/kernel/arch-mips/asm/siginfo.h [deleted file]
libc/kernel/arch-mips/asm/signal.h [deleted file]
libc/kernel/arch-mips/asm/smp-ops.h [deleted file]
libc/kernel/arch-mips/asm/smp.h [deleted file]
libc/kernel/arch-mips/asm/sn/addrs.h [deleted file]
libc/kernel/arch-mips/asm/sn/arch.h [deleted file]
libc/kernel/arch-mips/asm/sn/hub.h [deleted file]
libc/kernel/arch-mips/asm/sn/io.h [deleted file]
libc/kernel/arch-mips/asm/sn/ioc3.h [deleted file]
libc/kernel/arch-mips/asm/sn/kldir.h [deleted file]
libc/kernel/arch-mips/asm/sn/klkernvars.h [deleted file]
libc/kernel/arch-mips/asm/sn/sn0/addrs.h [deleted file]
libc/kernel/arch-mips/asm/sn/sn0/hubio.h [deleted file]
libc/kernel/arch-mips/asm/sn/sn0/hubmd.h [deleted file]
libc/kernel/arch-mips/asm/sn/sn0/hubni.h [deleted file]
libc/kernel/arch-mips/asm/sn/sn0/hubpi.h [deleted file]
libc/kernel/arch-mips/asm/sn/types.h [deleted file]
libc/kernel/arch-mips/asm/socket.h [deleted file]
libc/kernel/arch-mips/asm/sockios.h [deleted file]
libc/kernel/arch-mips/asm/stat.h [deleted file]
libc/kernel/arch-mips/asm/statfs.h [deleted file]
libc/kernel/arch-mips/asm/sysmips.h [deleted file]
libc/kernel/arch-mips/asm/system.h [deleted file]
libc/kernel/arch-mips/asm/termbits.h [deleted file]
libc/kernel/arch-mips/asm/termios.h [deleted file]
libc/kernel/arch-mips/asm/thread_info.h [deleted file]
libc/kernel/arch-mips/asm/timex.h [deleted file]
libc/kernel/arch-mips/asm/tlb.h [deleted file]
libc/kernel/arch-mips/asm/tlbflush.h [deleted file]
libc/kernel/arch-mips/asm/topology.h [deleted file]
libc/kernel/arch-mips/asm/txx9irq.h [deleted file]
libc/kernel/arch-mips/asm/types.h [deleted file]
libc/kernel/arch-mips/asm/uaccess.h [deleted file]
libc/kernel/arch-mips/asm/ucontext.h [deleted file]
libc/kernel/arch-mips/asm/unaligned.h [deleted file]
libc/kernel/arch-mips/asm/unistd.h [deleted file]
libc/kernel/arch-mips/asm/user.h [deleted file]
libc/kernel/arch-mips/asm/vga.h [deleted file]
libc/kernel/arch-mips/asm/vr41xx/irq.h [deleted file]
libc/kernel/arch-mips/asm/war.h [deleted file]
libc/kernel/arch-mips/asm/xtalk/xtalk.h [deleted file]
libc/kernel/arch-mips/asm/xtalk/xwidget.h [deleted file]
libc/kernel/arch-x86/asm/a.out.h [deleted file]
libc/kernel/arch-x86/asm/acpi.h [deleted file]
libc/kernel/arch-x86/asm/acpi_32.h [deleted file]
libc/kernel/arch-x86/asm/alternative.h [deleted file]
libc/kernel/arch-x86/asm/alternative_32.h [deleted file]
libc/kernel/arch-x86/asm/apic.h [deleted file]
libc/kernel/arch-x86/asm/apic_32.h [deleted file]
libc/kernel/arch-x86/asm/apicdef.h [deleted file]
libc/kernel/arch-x86/asm/apicdef_32.h [deleted file]
libc/kernel/arch-x86/asm/atomic.h [deleted file]
libc/kernel/arch-x86/asm/atomic_32.h [deleted file]
libc/kernel/arch-x86/asm/auxvec.h [deleted file]
libc/kernel/arch-x86/asm/bitops.h [deleted file]
libc/kernel/arch-x86/asm/bitops_32.h [deleted file]
libc/kernel/arch-x86/asm/bitsperlong.h [deleted file]
libc/kernel/arch-x86/asm/bug.h [deleted file]
libc/kernel/arch-x86/asm/byteorder.h [deleted file]
libc/kernel/arch-x86/asm/cache.h [deleted file]
libc/kernel/arch-x86/asm/cacheflush.h [deleted file]
libc/kernel/arch-x86/asm/cmpxchg.h [deleted file]
libc/kernel/arch-x86/asm/cmpxchg_32.h [deleted file]
libc/kernel/arch-x86/asm/cpufeature.h [deleted file]
libc/kernel/arch-x86/asm/cpufeature_32.h [deleted file]
libc/kernel/arch-x86/asm/cputime.h [deleted file]
libc/kernel/arch-x86/asm/current.h [deleted file]
libc/kernel/arch-x86/asm/current_32.h [deleted file]
libc/kernel/arch-x86/asm/delay.h [deleted file]
libc/kernel/arch-x86/asm/desc.h [deleted file]
libc/kernel/arch-x86/asm/desc_32.h [deleted file]
libc/kernel/arch-x86/asm/div64.h [deleted file]
libc/kernel/arch-x86/asm/dma-mapping.h [deleted file]
libc/kernel/arch-x86/asm/dma-mapping_32.h [deleted file]
libc/kernel/arch-x86/asm/dma.h [deleted file]
libc/kernel/arch-x86/asm/dma_32.h [deleted file]
libc/kernel/arch-x86/asm/dwarf2.h [deleted file]
libc/kernel/arch-x86/asm/dwarf2_32.h [deleted file]
libc/kernel/arch-x86/asm/e820.h [deleted file]
libc/kernel/arch-x86/asm/errno.h [deleted file]
libc/kernel/arch-x86/asm/fcntl.h [deleted file]
libc/kernel/arch-x86/asm/fixmap.h [deleted file]
libc/kernel/arch-x86/asm/fixmap_32.h [deleted file]
libc/kernel/arch-x86/asm/genapic.h [deleted file]
libc/kernel/arch-x86/asm/genapic_32.h [deleted file]
libc/kernel/arch-x86/asm/hardirq.h [deleted file]
libc/kernel/arch-x86/asm/hardirq_32.h [deleted file]
libc/kernel/arch-x86/asm/highmem.h [deleted file]
libc/kernel/arch-x86/asm/hw_irq.h [deleted file]
libc/kernel/arch-x86/asm/hw_irq_32.h [deleted file]
libc/kernel/arch-x86/asm/i387.h [deleted file]
libc/kernel/arch-x86/asm/i387_32.h [deleted file]
libc/kernel/arch-x86/asm/i8253.h [deleted file]
libc/kernel/arch-x86/asm/i8259.h [deleted file]
libc/kernel/arch-x86/asm/ia32_unistd.h [deleted file]
libc/kernel/arch-x86/asm/io.h [deleted file]
libc/kernel/arch-x86/asm/io_32.h [deleted file]
libc/kernel/arch-x86/asm/io_apic.h [deleted file]
libc/kernel/arch-x86/asm/io_apic_32.h [deleted file]
libc/kernel/arch-x86/asm/ioctl.h [deleted file]
libc/kernel/arch-x86/asm/ioctls.h [deleted file]
libc/kernel/arch-x86/asm/ipcbuf.h [deleted file]
libc/kernel/arch-x86/asm/irq.h [deleted file]
libc/kernel/arch-x86/asm/irq_32.h [deleted file]
libc/kernel/arch-x86/asm/irqflags.h [deleted file]
libc/kernel/arch-x86/asm/irqflags_32.h [deleted file]
libc/kernel/arch-x86/asm/ist.h [deleted file]
libc/kernel/arch-x86/asm/ldt.h [deleted file]
libc/kernel/arch-x86/asm/linkage.h [deleted file]
libc/kernel/arch-x86/asm/linkage_32.h [deleted file]
libc/kernel/arch-x86/asm/local.h [deleted file]
libc/kernel/arch-x86/asm/local_32.h [deleted file]
libc/kernel/arch-x86/asm/mc146818rtc.h [deleted file]
libc/kernel/arch-x86/asm/mc146818rtc_32.h [deleted file]
libc/kernel/arch-x86/asm/mman.h [deleted file]
libc/kernel/arch-x86/asm/mmsegment.h [deleted file]
libc/kernel/arch-x86/asm/mmu.h [deleted file]
libc/kernel/arch-x86/asm/module.h [deleted file]
libc/kernel/arch-x86/asm/mpspec.h [deleted file]
libc/kernel/arch-x86/asm/mpspec_32.h [deleted file]
libc/kernel/arch-x86/asm/mpspec_def.h [deleted file]
libc/kernel/arch-x86/asm/msgbuf.h [deleted file]
libc/kernel/arch-x86/asm/msr-index.h [deleted file]
libc/kernel/arch-x86/asm/msr.h [deleted file]
libc/kernel/arch-x86/asm/param.h [deleted file]
libc/kernel/arch-x86/asm/paravirt.h [deleted file]
libc/kernel/arch-x86/asm/pda.h [deleted file]
libc/kernel/arch-x86/asm/percpu.h [deleted file]
libc/kernel/arch-x86/asm/percpu_32.h [deleted file]
libc/kernel/arch-x86/asm/pgalloc.h [deleted file]
libc/kernel/arch-x86/asm/pgalloc_32.h [deleted file]
libc/kernel/arch-x86/asm/pgtable-2level-defs.h [deleted file]
libc/kernel/arch-x86/asm/pgtable-2level.h [deleted file]
libc/kernel/arch-x86/asm/pgtable.h [deleted file]
libc/kernel/arch-x86/asm/pgtable_32.h [deleted file]
libc/kernel/arch-x86/asm/poll.h [deleted file]
libc/kernel/arch-x86/asm/posix_types.h [deleted file]
libc/kernel/arch-x86/asm/posix_types_32.h [deleted file]
libc/kernel/arch-x86/asm/posix_types_64.h [deleted file]
libc/kernel/arch-x86/asm/prctl.h [deleted file]
libc/kernel/arch-x86/asm/processor-flags.h [deleted file]
libc/kernel/arch-x86/asm/processor.h [deleted file]
libc/kernel/arch-x86/asm/processor_32.h [deleted file]
libc/kernel/arch-x86/asm/ptrace-abi.h [deleted file]
libc/kernel/arch-x86/asm/ptrace.h [deleted file]
libc/kernel/arch-x86/asm/required-features.h [deleted file]
libc/kernel/arch-x86/asm/resource.h [deleted file]
libc/kernel/arch-x86/asm/rwlock.h [deleted file]
libc/kernel/arch-x86/asm/scatterlist.h [deleted file]
libc/kernel/arch-x86/asm/scatterlist_32.h [deleted file]
libc/kernel/arch-x86/asm/sections.h [deleted file]
libc/kernel/arch-x86/asm/segment.h [deleted file]
libc/kernel/arch-x86/asm/segment_32.h [deleted file]
libc/kernel/arch-x86/asm/semaphore.h [deleted file]
libc/kernel/arch-x86/asm/semaphore_32.h [deleted file]
libc/kernel/arch-x86/asm/sembuf.h [deleted file]
libc/kernel/arch-x86/asm/setup.h [deleted file]
libc/kernel/arch-x86/asm/shmbuf.h [deleted file]
libc/kernel/arch-x86/asm/shmparam.h [deleted file]
libc/kernel/arch-x86/asm/sigcontext.h [deleted file]
libc/kernel/arch-x86/asm/siginfo.h [deleted file]
libc/kernel/arch-x86/asm/signal.h [deleted file]
libc/kernel/arch-x86/asm/smp.h [deleted file]
libc/kernel/arch-x86/asm/smp_32.h [deleted file]
libc/kernel/arch-x86/asm/socket.h [deleted file]
libc/kernel/arch-x86/asm/sockios.h [deleted file]
libc/kernel/arch-x86/asm/spinlock.h [deleted file]
libc/kernel/arch-x86/asm/spinlock_32.h [deleted file]
libc/kernel/arch-x86/asm/spinlock_types.h [deleted file]
libc/kernel/arch-x86/asm/stat.h [deleted file]
libc/kernel/arch-x86/asm/statfs.h [deleted file]
libc/kernel/arch-x86/asm/string.h [deleted file]
libc/kernel/arch-x86/asm/string_32.h [deleted file]
libc/kernel/arch-x86/asm/swiotlb.h [deleted file]
libc/kernel/arch-x86/asm/system.h [deleted file]
libc/kernel/arch-x86/asm/system_32.h [deleted file]
libc/kernel/arch-x86/asm/termbits.h [deleted file]
libc/kernel/arch-x86/asm/termios.h [deleted file]
libc/kernel/arch-x86/asm/thread_info.h [deleted file]
libc/kernel/arch-x86/asm/thread_info_32.h [deleted file]
libc/kernel/arch-x86/asm/tlbflush.h [deleted file]
libc/kernel/arch-x86/asm/tlbflush_32.h [deleted file]
libc/kernel/arch-x86/asm/tsc.h [deleted file]
libc/kernel/arch-x86/asm/types.h [deleted file]
libc/kernel/arch-x86/asm/uaccess.h [deleted file]
libc/kernel/arch-x86/asm/uaccess_32.h [deleted file]
libc/kernel/arch-x86/asm/ucontext.h [deleted file]
libc/kernel/arch-x86/asm/unaligned.h [deleted file]
libc/kernel/arch-x86/asm/unistd.h [deleted file]
libc/kernel/arch-x86/asm/unistd_32.h [deleted file]
libc/kernel/arch-x86/asm/unistd_64.h [deleted file]
libc/kernel/arch-x86/asm/user32.h [deleted file]
libc/kernel/arch-x86/asm/user_32.h [deleted file]
libc/kernel/arch-x86/asm/user_64.h [deleted file]
libc/kernel/arch-x86/asm/vm86.h [deleted file]
libc/kernel/arch-x86/asm/voyager.h [deleted file]
libc/kernel/arch-x86/asm/vsyscall.h [deleted file]
libc/kernel/arch-x86/asm/xen/hypercall.h [deleted file]
libc/kernel/arch-x86_64 [deleted symlink]
libc/kernel/common/linux/kexec.h [deleted file]
libc/kernel/tools/cpp.py
libc/kernel/tools/generate_uapi_headers.sh [new file with mode: 0755]
libc/kernel/uapi/asm-aarch64/asm/bug.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/bugs.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/checksum.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/clkdev.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/cputime.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/current.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/delay.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/div64.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/dma.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/emergency-restart.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/ftrace.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/hw_irq.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/irq_regs.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/kdebug.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/kmap_types.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/kvm.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/local.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/local64.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/mutex.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/pci.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/percpu.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/scatterlist.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/sections.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/segment.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/serial.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/sizes.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/switch_to.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/topology.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/trace_clock.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/unaligned.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/user.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/vga.h [deleted file]
libc/kernel/uapi/asm-aarch64/asm/xor.h [deleted file]
libc/kernel/uapi/asm-arm/asm/a.out.h [moved from libc/kernel/arch-x86/asm/math_emu.h with 75% similarity]
libc/kernel/uapi/asm-arm/asm/hwcap.h
libc/kernel/uapi/asm-arm/asm/ptrace.h
libc/kernel/uapi/asm-arm/asm/user.h [deleted file]
libc/kernel/uapi/asm-generic/fcntl.h
libc/kernel/uapi/asm-generic/poll.h
libc/kernel/uapi/asm-generic/socket.h
libc/kernel/uapi/asm-mips/asm/fcntl.h
libc/kernel/uapi/asm-mips/asm/inst.h
libc/kernel/uapi/asm-mips/asm/msgbuf.h
libc/kernel/uapi/asm-mips/asm/resource.h
libc/kernel/uapi/asm-mips/asm/siginfo.h
libc/kernel/uapi/asm-mips/asm/socket.h
libc/kernel/uapi/asm-mips/asm/swab.h
libc/kernel/uapi/asm-mips/asm/trace_clock.h [deleted file]
libc/kernel/uapi/asm-x86/asm/clkdev.h [deleted file]
libc/kernel/uapi/asm-x86/asm/msr-index.h
libc/kernel/uapi/asm-x86/asm/processor-flags.h
libc/kernel/uapi/asm-x86/asm/syscalls_32.h [deleted file]
libc/kernel/uapi/drm/drm.h
libc/kernel/uapi/drm/drm_mode.h
libc/kernel/uapi/drm/i915_drm.h
libc/kernel/uapi/drm/radeon_drm.h
libc/kernel/uapi/drm/tegra_drm.h
libc/kernel/uapi/linux/acct.h
libc/kernel/uapi/linux/aio_abi.h
libc/kernel/uapi/linux/android_alarm.h [moved from libc/kernel/arch-mips/asm/sigcontext.h with 54% similarity]
libc/kernel/uapi/linux/ashmem.h [moved from libc/kernel/arch-mips/asm/fcntl.h with 61% similarity]
libc/kernel/uapi/linux/binder.h [new file with mode: 0644]
libc/kernel/uapi/linux/btrfs.h
libc/kernel/uapi/linux/cm4000_cs.h
libc/kernel/uapi/linux/const.h
libc/kernel/uapi/linux/dm-ioctl.h
libc/kernel/uapi/linux/gen_stats.h
libc/kernel/uapi/linux/if_arp.h
libc/kernel/uapi/linux/if_link.h
libc/kernel/uapi/linux/if_pppolac.h [moved from libc/kernel/arch-x86/asm/module_32.h with 79% similarity]
libc/kernel/uapi/linux/if_pppopns.h [moved from libc/kernel/arch-mips/asm/string.h with 81% similarity]
libc/kernel/uapi/linux/if_pppox.h
libc/kernel/uapi/linux/if_tun.h
libc/kernel/uapi/linux/input.h
libc/kernel/uapi/linux/ion.h [moved from libc/kernel/arch-x86/asm/desc_defs.h with 58% similarity]
libc/kernel/uapi/linux/ip.h
libc/kernel/uapi/linux/ip_vs.h
libc/kernel/uapi/linux/keychord.h [moved from libc/kernel/arch-mips/asm/kdebug.h with 85% similarity]
libc/kernel/uapi/linux/kvm.h
libc/kernel/uapi/linux/msdos_fs.h
libc/kernel/uapi/linux/netfilter/nfnetlink_queue.h
libc/kernel/uapi/linux/netfilter/xt_IDLETIMER.h
libc/kernel/uapi/linux/netfilter/xt_socket.h
libc/kernel/uapi/linux/nfc.h
libc/kernel/uapi/linux/nl80211.h
libc/kernel/uapi/linux/openvswitch.h
libc/kernel/uapi/linux/perf_event.h
libc/kernel/uapi/linux/pkt_sched.h
libc/kernel/uapi/linux/prctl.h
libc/kernel/uapi/linux/ptrace.h
libc/kernel/uapi/linux/raid/md_p.h
libc/kernel/uapi/linux/rtnetlink.h
libc/kernel/uapi/linux/serial_core.h
libc/kernel/uapi/linux/snmp.h
libc/kernel/uapi/linux/sockios.h
libc/kernel/uapi/linux/sw_sync.h [moved from libc/kernel/arch-mips/asm/scatterlist.h with 77% similarity]
libc/kernel/uapi/linux/sync.h [moved from libc/kernel/arch-x86/asm/user.h with 67% similarity]
libc/kernel/uapi/linux/usb/ch11.h
libc/kernel/uapi/linux/usb/f_accessory.h [moved from libc/kernel/arch-mips/asm/ptrace.h with 56% similarity]
libc/kernel/uapi/linux/usb/f_mtp.h [moved from libc/kernel/arch-x86/asm/kmap_types.h with 72% similarity]
libc/kernel/uapi/linux/version.h [moved from libc/kernel/arch-mips/asm/dec/system.h with 90% similarity]
libc/kernel/uapi/linux/vfio.h
libc/kernel/uapi/linux/videodev2.h
libc/kernel/uapi/linux/virtio_config.h
libc/kernel/uapi/linux/virtio_console.h
libc/kernel/uapi/linux/virtio_pci.h
libc/kernel/uapi/rdma/rdma_user_cm.h
libc/kernel/uapi/sound/asound.h
libc/kernel/uapi/video/adf.h [new file with mode: 0644]
libc/netbsd/gethnamaddr.c
libc/netbsd/net/getaddrinfo.c
libc/netbsd/net/getnameinfo.c
libc/netbsd/resolv/res_cache.c
libc/netbsd/resolv/res_init.c
libc/netbsd/resolv/res_send.c
libc/private/bionic_futex.h
libc/private/bionic_name_mem.h [moved from libc/bionic/sleep.c with 71% similarity]
libc/private/bionic_tls.h
libc/private/resolv_cache.h
libc/private/resolv_iface.h
libc/private/resolv_private.h
libc/tools/gensyscalls.py
libc/upstream-freebsd/freebsd-compat.h
libc/upstream-freebsd/lib/libc/gen/sleep.c [new file with mode: 0644]
libc/upstream-freebsd/lib/libc/gen/usleep.c [new file with mode: 0644]
libc/upstream-netbsd/libc/stdlib/exit.c [moved from libc/stdlib/exit.c with 71% similarity]
libc/upstream-netbsd/libc/thread-stub/__isthreaded.c [new file with mode: 0644]
libm/Android.mk
libm/freebsd-compat.h [new file with mode: 0644]
tests/Android.mk
tests/buffer_tests.cpp [new file with mode: 0644]
tests/buffer_tests.h [new file with mode: 0644]
tests/math_test.cpp
tests/pthread_test.cpp
tests/stdio_test.cpp
tests/stdlib_test.cpp
tests/string_test.cpp
tests/system_properties_test.cpp

index b24320dcc5b4bfa392c7af3b9c2278465e858ba0..962365e397cb7c97ebd0bccca15b7d00f9c95d30 100644 (file)
@@ -50,7 +50,6 @@ libc_common_src_files := \
        stdio/wbuf.c \
        stdlib/atexit.c \
        stdlib/ctype_.c \
-       stdlib/exit.c \
        stdlib/getenv.c \
        stdlib/putenv.c \
        stdlib/setenv.c \
@@ -78,7 +77,6 @@ libc_common_src_files := \
        bionic/atol.c \
        bionic/atoll.c \
        bionic/bindresvport.c \
-       bionic/bionic_clone.c \
        bionic/clearenv.c \
        bionic/daemon.c \
        bionic/err.c \
@@ -104,6 +102,7 @@ libc_common_src_files := \
        bionic/md5.c \
        bionic/memmem.c \
        bionic/memswap.c \
+       bionic/name_mem.c \
        bionic/pathconf.c \
        bionic/perror.c \
        bionic/ptsname.c \
@@ -122,7 +121,6 @@ libc_common_src_files := \
        bionic/siglist.c \
        bionic/signame.c \
        bionic/sigsetmask.c \
-       bionic/sleep.c \
        bionic/strndup.c \
        bionic/strntoimax.c \
        bionic/strntoumax.c \
@@ -134,7 +132,6 @@ libc_common_src_files := \
        bionic/time64.c \
        bionic/umount.c \
        bionic/unlockpt.c \
-       bionic/usleep.c \
        bionic/utmp.c \
        bionic/wcscoll.c \
 
@@ -208,6 +205,7 @@ libc_bionic_src_files := \
     bionic/brk.cpp \
     bionic/chmod.cpp \
     bionic/chown.cpp \
+    bionic/clone.cpp \
     bionic/dirent.cpp \
     bionic/dup2.cpp \
     bionic/epoll_create.cpp \
@@ -289,7 +287,6 @@ libc_bionic_src_files := \
     bionic/sysconf.cpp \
     bionic/thread_atexit.cpp \
     bionic/tdestroy.cpp \
-    bionic/__thread_entry.cpp \
     bionic/timer.cpp \
     bionic/tmpfile.cpp \
     bionic/unlink.cpp \
@@ -312,6 +309,8 @@ libc_tzcode_src_files := \
     tzcode/strptime.c \
 
 libc_upstream_freebsd_src_files := \
+    upstream-freebsd/lib/libc/gen/sleep.c \
+    upstream-freebsd/lib/libc/gen/usleep.c \
     upstream-freebsd/lib/libc/stdio/clrerr.c \
     upstream-freebsd/lib/libc/stdio/fclose.c \
     upstream-freebsd/lib/libc/stdio/fdopen.c \
@@ -400,6 +399,7 @@ libc_upstream_netbsd_src_files := \
     upstream-netbsd/libc/stdlib/div.c \
     upstream-netbsd/libc/stdlib/drand48.c \
     upstream-netbsd/libc/stdlib/erand48.c \
+    upstream-netbsd/libc/stdlib/exit.c \
     upstream-netbsd/libc/stdlib/jrand48.c \
     upstream-netbsd/libc/stdlib/ldiv.c \
     upstream-netbsd/libc/stdlib/lldiv.c \
@@ -416,6 +416,7 @@ libc_upstream_netbsd_src_files := \
     upstream-netbsd/libc/string/strcasestr.c \
     upstream-netbsd/libc/string/strcoll.c \
     upstream-netbsd/libc/string/strxfrm.c \
+    upstream-netbsd/libc/thread-stub/__isthreaded.c \
     upstream-netbsd/libc/unistd/killpg.c \
 
 # Architecture specific source files go here
index 533116e60e4231d6b353223085fb1afaa149637b..1277b1a6f4e0dbdf0b89b808a6feab0aea223810 100644 (file)
@@ -57,10 +57,9 @@ int     setresuid:setresuid(uid_t, uid_t, uid_t)     aarch64,mips,x86_64
 int     setresgid:setresgid32(gid_t, gid_t, gid_t)   arm,x86
 int     setresgid:setresgid(gid_t, gid_t, gid_t)     aarch64,mips,x86_64
 void*   __brk:brk(void*)           all
-# See comments in kill.S to understand why we don't generate ARM stubs for kill/tkill/tgkill.
-int     kill(pid_t, int)           aarch64,mips,x86,x86_64
-int     tkill(pid_t tid, int sig)  aarch64,mips,x86,x86_64
-int     tgkill(pid_t tgid, pid_t tid, int sig)  aarch64,mips,x86,x86_64
+int     kill(pid_t, int)           all
+int     tkill(pid_t tid, int sig)  all
+int     tgkill(pid_t tgid, pid_t tid, int sig)  all
 int     __ptrace:ptrace(int request, int pid, void* addr, void* data)  all
 int     __set_thread_area:set_thread_area(void*  user_desc)  mips,x86
 int     __getpriority:getpriority(int, int)  all
@@ -275,8 +274,6 @@ int     sysinfo(struct sysinfo*)  all
 int     personality(unsigned long)  all
 long    perf_event_open(struct perf_event_attr* attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) all
 
-pid_t __clone:clone(int, void*, int*, void*, int*)  all
-
 int epoll_create1(int)  all
 int epoll_ctl(int, int op, int, struct epoll_event*)  all
 int __epoll_pwait:epoll_pwait(int, struct epoll_event*, int, int, const sigset_t*, size_t)  all
@@ -295,6 +292,8 @@ int inotify_rm_watch(int, unsigned int)  all
 int __pselect6:pselect6(int, fd_set*, fd_set*, fd_set*, timespec*, void*)  all
 int __ppoll:ppoll(pollfd*, unsigned int, timespec*, const sigset_t*, size_t)  all
 
+int __set_tid_address:set_tid_address(int*)  all
+
 pid_t wait4(pid_t, int*, int, struct rusage*)  all
 int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*)  all
 
index 995d44afd5f3b028a597adbe17ab9891f1705491..ab9c839d1a8c6bbc078309a0e0fa5a47b42d764b 100644 (file)
@@ -1,7 +1,6 @@
 # Generated by gensyscalls.py. Do not edit.
 syscall_src :=
 syscall_src += arch-aarch64/syscalls/__brk.S
-syscall_src += arch-aarch64/syscalls/__clone.S
 syscall_src += arch-aarch64/syscalls/__epoll_pwait.S
 syscall_src += arch-aarch64/syscalls/__exit.S
 syscall_src += arch-aarch64/syscalls/__getcpu.S
@@ -19,6 +18,7 @@ syscall_src += arch-aarch64/syscalls/__rt_sigprocmask.S
 syscall_src += arch-aarch64/syscalls/__rt_sigsuspend.S
 syscall_src += arch-aarch64/syscalls/__rt_sigtimedwait.S
 syscall_src += arch-aarch64/syscalls/__sched_getaffinity.S
+syscall_src += arch-aarch64/syscalls/__set_tid_address.S
 syscall_src += arch-aarch64/syscalls/__syslog.S
 syscall_src += arch-aarch64/syscalls/__timer_create.S
 syscall_src += arch-aarch64/syscalls/__timer_delete.S
similarity index 73%
rename from libc/arch-aarch64/syscalls/__clone.S
rename to libc/arch-aarch64/syscalls/__set_tid_address.S
index 45c20224923309b3d5ad31bfcd6643bc7abd91b9..b7541fcc9d78b7bf37999c25c028abad9f0a0564 100644 (file)
@@ -2,12 +2,12 @@
 
 #include <private/bionic_asm.h>
 
-ENTRY(__clone)
+ENTRY(__set_tid_address)
     stp     x29, x30, [sp, #-16]!
     mov     x29,  sp
     str     x8,       [sp, #-16]!
 
-    mov     x8, __NR_clone
+    mov     x8, __NR_set_tid_address
     svc     #0
 
     ldr     x8,       [sp], #16
@@ -18,5 +18,5 @@ ENTRY(__clone)
     b.hi    __set_errno
 
     ret
-END(__clone)
-.hidden _C_LABEL(__clone)
+END(__set_tid_address)
+.hidden _C_LABEL(__set_tid_address)
index dea303affc10709f00f994de428545caa1ff9a9d..95c3b610d738b80206b7d911ec418a2480fd71e8 100644 (file)
@@ -1,12 +1,11 @@
 _LIBC_ARCH_COMMON_SRC_FILES := \
     arch-arm/bionic/abort_arm.S \
     arch-arm/bionic/atomics_arm.c \
-    arch-arm/bionic/clone.S \
+    arch-arm/bionic/__bionic_clone.S \
     arch-arm/bionic/eabi.c \
     arch-arm/bionic/_exit_with_stack_teardown.S \
     arch-arm/bionic/futex_arm.S \
     arch-arm/bionic/__get_sp.S \
-    arch-arm/bionic/kill.S \
     arch-arm/bionic/libgcc_compat.c \
     arch-arm/bionic/memcmp16.S \
     arch-arm/bionic/memcmp.S \
@@ -14,8 +13,6 @@ _LIBC_ARCH_COMMON_SRC_FILES := \
     arch-arm/bionic/setjmp.S \
     arch-arm/bionic/sigsetjmp.S \
     arch-arm/bionic/syscall.S \
-    arch-arm/bionic/tgkill.S \
-    arch-arm/bionic/tkill.S \
 
 # These are used by the static and dynamic versions of the libc
 # respectively.
similarity index 61%
rename from libc/arch-arm/bionic/clone.S
rename to libc/arch-arm/bionic/__bionic_clone.S
index 3556b8ed404ef1774a86267972a0ca4d5b6a9f37..7b76f5e9fbff8d4467691f310a627db6aaece1d5 100644 (file)
 
 #include <private/bionic_asm.h>
 
-// int  __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
-ENTRY(__pthread_clone)
-    # Push 'fn' and 'arg' onto 'child_stack'.
-    stmdb   r1!, {r0, r3}
-
-    # The sys_clone system call only takes two arguments: 'flags' and 'child_stack'.
-    # 'child_stack' is already in r1, but we need to move 'flags' into position.
-    mov     r0, r2
-
-    # System call.
-    mov     ip, r7
-    ldr     r7, =__NR_clone
-    swi     #0
-
-    # Child?
-    movs    r0, r0
-    beq     1f
-
-    # Parent.
-    mov     r7, ip
-    cmn     r0, #(MAX_ERRNO + 1)
-    bxls    lr
-    neg     r0, r0
-    b       __set_errno
-
-1:  # Child.
-    # Pop 'fn' and 'arg' back off the stack and call __thread_entry.
-    pop     {r0, r1}
-    # __thread_entry also needs our stack pointer.
-    mov     r2, sp
-    b       __thread_entry
-END(__pthread_clone)
-
-
-    #
-    # 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 as the glibc
-    #       __clone function. Placing 'fn' and 'arg'
-    #       at the end of the parameter list makes the
-    #       implementation much simpler.
-    #
-
+// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
 ENTRY(__bionic_clone)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
-
     # save registers to parent stack
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
 
     # load extra parameters
     ldmfd   ip, {r4, r5, r6}
@@ -97,12 +54,19 @@ ENTRY(__bionic_clone)
 
     # In the parent, reload saved registers then either return or set errno.
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
     b       __set_errno
 
 1:  # The child.
+    # Re-add the unwind directives that were reset from above.
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldr    r0, [sp, #-4]
     ldr    r1, [sp, #-8]
     b      __bionic_clone_entry
index c430edbe4447d718da6b624f7670623374e3597b..0d97f06138abbeeba83114344295058bf83f50d1 100644 (file)
 ENTRY(_exit_with_stack_teardown)
     mov     lr, r2
     ldr     r7, =__NR_munmap
-    swi     #0              // the stack is destroyed by this call
+    swi     #0
+    // If munmap failed, we ignore the failure and exit anyway.
+
     mov     r0, lr
     ldr     r7, =__NR_exit
     swi     #0
-
-    // exit() should never return, cause a crash if it does
-    mov     r0, #0
-    ldr     r0, [r0]
+    // The exit syscall does not return.
 END(_exit_with_stack_teardown)
index e1ab86b6ea1d6d354bfb0a179bce56409454330f..1aaf21ad88b17b075817a449e5e626aca6c88fa9 100644 (file)
@@ -36,7 +36,9 @@
  * sequence when the crash happens.
  */
 ENTRY(abort)
-    .save   {r3, r14}
     stmfd   sp!, {r3, r14}
+    .cfi_def_cfa_offset 8
+    .cfi_rel_offset r3, 0
+    .cfi_rel_offset r14, 4
     bl      PIC_SYM(_C_LABEL(__libc_android_abort), PLT)
 END(abort)
index 7fb428391573bdc89b0e33562dcdd4c506f8a194..0dc3af0cabbafe4448957e1fcfa10d39686dac29 100644 (file)
@@ -107,9 +107,11 @@ ENTRY(memcmp)
         bmi        10f
 #endif
 
-        .save {r4, lr}
         /* save registers */
         stmfd       sp!, {r4, lr}
+        .cfi_def_cfa_offset 8
+        .cfi_rel_offset r4, 0
+        .cfi_rel_offset lr, 4
 
         /* since r0 hold the result, move the first source
          * pointer somewhere else
index 99c9b884240ef253659574e8a964074f57b63e95..825c94f15afe75c227de2bbdfa982bf5672306a1 100644 (file)
@@ -74,9 +74,11 @@ ENTRY(__memcmp16)
         bx          lr
 
 
-        .save {r4, lr}
         /* save registers */
 0:      stmfd       sp!, {r4, lr}
+        .cfi_def_cfa_offset 8
+        .cfi_rel_offset r4, 0
+        .cfi_rel_offset lr, 4
         
         /* align first pointer to word boundary */
         tst         r3, #2
index 996e55e0081d87d775e0c0a8a12806affef6235a..65b93fdec68ccfd5fd85c674caf7aad7c910aa4c 100644 (file)
 ENTRY(setjmp)
        /* Block all signals and retrieve the old signal mask */
        stmfd   sp!, {r0, r14}
+       .cfi_def_cfa_offset 8
+       .cfi_rel_offset r0, 0
+       .cfi_rel_offset r14, 4
        mov     r0, #0x00000000
 
        bl      PIC_SYM(_C_LABEL(sigblock), PLT)
        mov     r1, r0
 
        ldmfd   sp!, {r0, r14}
+       .cfi_def_cfa_offset 0
 
        /* Store signal mask */
        str     r1, [r0, #(_JB_SIGMASK * 4)]
@@ -96,13 +100,20 @@ ENTRY(longjmp)
 
        /* Set signal mask */
        stmfd   sp!, {r0, r1, r14}
+       .cfi_def_cfa_offset 12
+       .cfi_rel_offset r0, 0
+       .cfi_rel_offset r1, 4
+       .cfi_rel_offset r14, 8
        sub     sp, sp, #4      /* align the stack */
+       .cfi_adjust_cfa_offset 4
 
        mov     r0, r2
        bl      PIC_SYM(_C_LABEL(sigsetmask), PLT)
 
        add     sp, sp, #4      /* unalign the stack */
+       .cfi_adjust_cfa_offset -4
        ldmfd   sp!, {r0, r1, r14} 
+       .cfi_def_cfa_offset 0
 
 #ifdef __ARM_HAVE_VFP
        /* Restore floating-point registers */
index a622b58b0be8cbadfbfda0cf8f30da4be4027104..86477184158b9b08a1f9c840586098267f0c0971 100644 (file)
 ENTRY(syscall)
     mov     ip, sp
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     mov     r7, r0
     mov     r0, r1
     mov     r1, r2
@@ -38,6 +43,7 @@ ENTRY(syscall)
     ldmfd   ip, {r3, r4, r5, r6}
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
diff --git a/libc/arch-arm/bionic/tgkill.S b/libc/arch-arm/bionic/tgkill.S
deleted file mode 100644 (file)
index 4ef2abc..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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 <private/bionic_asm.h>
-
-/* 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).
-*/
-
-ENTRY(tgkill)
-    .save   {r4-r7, ip, lr}
-    stmfd   sp!, {r4-r7, ip, lr}
-    ldr     r7, =__NR_tgkill
-    swi     #0
-    ldmfd   sp!, {r4-r7, ip, lr}
-    cmn     r0, #(MAX_ERRNO + 1)
-    bxls    lr
-    neg     r0, r0
-    b       __set_errno
-END(tgkill)
diff --git a/libc/arch-arm/bionic/tkill.S b/libc/arch-arm/bionic/tkill.S
deleted file mode 100644 (file)
index 0a067d6..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 <private/bionic_asm.h>
-
-/* 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).
-*/
-
-ENTRY(tkill)
-    stmfd   sp!, {r4-r7, ip, lr}
-    ldr     r7, =__NR_tkill
-    swi     #0
-    ldmfd   sp!, {r4-r7, ip, lr}
-    cmn     r0, #(MAX_ERRNO + 1)
-    bxls    lr
-    neg     r0, r0
-    b       __set_errno
-END(tkill)
index 616da0104a6a344f21e62d0138cd26a5f50da325..dc86150d590df4d301a613638a27efcf1892ab2e 100644 (file)
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -188,8 +187,6 @@ ENTRY(__strcat_chk)
     mov     r2, r4
     add     r0, r0, r3
     pop     {r4, r5}
-
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -198,7 +195,6 @@ END(__strcat_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .save   {r4, r5}
 
@@ -218,8 +214,6 @@ error_code:
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_failed)
 
     .data
index 929cc98dff38f6d7a69e71a62bd64b12f9ba0201..95aaf4f56b065f5f84b6a5b30b0db3ede5d65e4d 100644 (file)
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -155,8 +154,6 @@ ENTRY(__strcpy_chk)
 
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
-
-    .cfi_endproc
 END(__strcpy_chk)
 
 #define MEMCPY_BASE         __strcpy_chk_memcpy_base
@@ -164,7 +161,6 @@ END(__strcpy_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -179,8 +175,6 @@ error_code:
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcpy_chk_failed)
 
     .data
index 6f77ca62803c60252262eea091847afd1e05ab09..badc93bf11235ca0815e66d910709ed96d862feb 100644 (file)
         .fpu    neon
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp     r2, r3
         bhi     __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
         pld     [r1, #64]
         push    {r0, lr}
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
-
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -88,7 +83,6 @@ END(memcpy)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -104,7 +98,6 @@ error_code:
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+8)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
index 4de23b391d13b3fae854f0478424f21ee0e72fd3..6ba4931f9d5088d728638eb0e52859581dea33ad 100644 (file)
@@ -54,7 +54,6 @@
  */
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -74,8 +73,10 @@ ENTRY_PRIVATE(MEMCPY_BASE)
         cmp     r2, #16
         blo     .L_copy_less_than_16_unknown_align
 
-        cmp     r2, #832
-        bge     .L_check_alignment
+        // TODO: The aligned copy code is extremely slow copying some large
+        //       buffers so always go through the unaligned path for now.
+        //cmp     r2, #832
+        //bge     .L_check_alignment
 
 .L_copy_unknown_alignment:
         // Unknown alignment of src and dst.
@@ -168,12 +169,9 @@ ENTRY_PRIVATE(MEMCPY_BASE)
         eor     r3, r0, r1
         ands    r3, r3, #0x3
         bne     .L_copy_unknown_alignment
-
-        .cfi_endproc
 END(MEMCPY_BASE)
 
 ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
-        .cfi_startproc
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -322,6 +320,4 @@ ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
 
         // Src is guaranteed to be at least word aligned by this point.
         b       .L_word_aligned
-
-        .cfi_endproc
 END(MEMCPY_BASE_ALIGNED)
index 701310c1fc5e03b56b378666acbc2b19d03da161..4e6d322d606cc608d4df7ee8222789f5d1e4a642 100644 (file)
@@ -40,7 +40,6 @@
         .syntax     unified
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -59,21 +58,16 @@ error_code:
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov         r2, r1
         mov         r1, #0
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 ENTRY(memset)
-        .cfi_startproc
         .save       {r0}
         stmfd       sp!, {r0}
         .cfi_def_cfa_offset 4
@@ -192,7 +186,6 @@ ENTRY(memset)
         strbcs      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-        .cfi_endproc
 END(memset)
 
         .data
index 422be863d1eaff020c38b6a88949911215147fab..0cccf06c9b8d2edced063aba4631035b57e53098 100644 (file)
@@ -159,7 +159,6 @@ ENTRY(strcmp)
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -375,5 +374,4 @@ ENTRY(strcmp)
         it      ls
         sbcls   r0, r0, r0
         bx      lr
-        .cfi_endproc
 END(strcmp)
index 23b4e985220e8448d049d81175d0893beb037293..7009168227fd112296ee691a855d4afedcc74201 100644 (file)
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -193,7 +192,6 @@ ENTRY(__strcat_chk)
     pop     {r4, r5}
 
     // Fall through into the memcpy_base function.
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -201,8 +199,6 @@ END(__strcat_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_fail)
-    .cfi_startproc
-
     .save   {r0, lr}
     .save   {r4, r5}
     .cfi_def_cfa_offset 8
@@ -221,8 +217,6 @@ error_code:
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_fail)
 
     .data
index adefdc39bbb1576db53693323985adeada9eca9b..908eec4c0f6ee2ee52706a32a65e675525d25736 100644 (file)
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -158,8 +157,6 @@ ENTRY(__strcpy_chk)
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
 
-    .cfi_endproc
-
     // Fall through into the memcpy_base function.
 END(__strcpy_chk)
 
@@ -168,8 +165,6 @@ END(__strcpy_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_fail)
-    .cfi_startproc
-
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -185,8 +180,6 @@ error_code:
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcpy_chk_fail)
 
     .data
index 6e0712f59e1a4c4b3d9d1f17d374ed5754f44f87..72c1a668ccc7f8d283757baf74d76daf4b662d87 100644 (file)
         .thumb_func
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp         r2, r3
         bhi         __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
-
         pld     [r1, #0]
         stmfd   sp!, {r0, lr}
         .save   {r0, lr}
@@ -59,8 +55,6 @@ ENTRY(memcpy)
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
         pld     [r1, #64]
-
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -68,7 +62,6 @@ END(memcpy)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -84,7 +77,6 @@ error_code:
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+4)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
index 55fd3bd561d62082f177ec3c3e32a4aedcca272c..c385657cab205eb3f270d7c07117eb6a8a2a5ccf 100644 (file)
@@ -33,7 +33,6 @@
  */
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save       {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -137,13 +136,9 @@ ENTRY_PRIVATE(MEMCPY_BASE)
 
         ldmfd       sp!, {r0, lr}
         bx          lr
-
-        .cfi_endproc
 END(MEMCPY_BASE)
 
 ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
-        .cfi_startproc
-
         .save       {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -228,6 +223,4 @@ ENTRY_PRIVATE(MEMCPY_BASE_ALIGNED)
 6:
         ldmfd       sp!, {r4-r8}
         ldmfd       sp!, {r0, pc}
-
-        .cfi_endproc
 END(MEMCPY_BASE_ALIGNED)
index e2a3f75033f70f3d3b45299d68c5eeb95d88e6ce..7f77dad42f3d059445059e49d0f6c7f700ac7882 100644 (file)
@@ -38,7 +38,6 @@
     .fpu    neon
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -57,25 +56,19 @@ error_code:
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov     r2, r1
         mov     r1, #0
 
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 /* memset() returns its first argument.  */
 ENTRY(memset)
-        .cfi_startproc
-
-        # The neon memset only wins for less than 132.
+        // The neon memset only wins for less than 132.
         cmp         r2, #132
         bhi         __memset_large_copy
 
@@ -115,13 +108,9 @@ ENTRY(memset)
         strcsb      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-
-        .cfi_endproc
 END(memset)
 
 ENTRY_PRIVATE(__memset_large_copy)
-        .cfi_startproc
-
         /* compute the offset to align the destination
          * offset = (4-(src&3))&3 = -src & 3
          */
@@ -196,7 +185,6 @@ ENTRY_PRIVATE(__memset_large_copy)
         strcsb      r1, [r0]
         ldmfd       sp!, {r0, r4-r7, lr}
         bx          lr
-        .cfi_endproc
 END(__memset_large_copy)
 
         .data
index 24a4157bd522725a29679bfb127234f1515332d0..eacdb89049cd9424d1dfb14ab8a0274f5e0b7cad 100644 (file)
@@ -159,7 +159,6 @@ ENTRY(strcmp)
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -547,5 +546,4 @@ ENTRY(strcmp)
     adds    sp, sp, #16
 
        bx      lr
-    .cfi_endproc
 END(strcmp)
index 047e54d17bf77cd0c8d301af1cfa4bf5450223e2..f16baf882f94a92920a63e96985759abcb336b61 100644 (file)
 #define _ASM_TYPE_FUNCTION     #function
 #define _ASM_TYPE_OBJECT       #object
 #define _ENTRY(x) \
-       .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart
+       .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart; .cfi_startproc;
 
 #define _ASM_SIZE(x)   .size x, .-x;
 
 #define _END(x) \
-       .fnend; \
+       .fnend; .cfi_endproc; \
        _ASM_SIZE(x)
 
 #ifdef GPROF
index 302478e41ca3bd91db2b5c2550cc47f8a7224dd9..a5d06f3f826763d5e5561d6f35b5e333a7480db0 100644 (file)
@@ -38,7 +38,6 @@
 // Check that the two lengths together don't exceed the threshold, then
 // do a memcpy of the data.
 ENTRY(__strcat_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -188,8 +187,6 @@ ENTRY(__strcat_chk)
     mov     r2, r4
     add     r0, r0, r3
     pop     {r4, r5}
-
-    .cfi_endproc
 END(__strcat_chk)
 
 #define MEMCPY_BASE         __strcat_chk_memcpy_base
@@ -197,7 +194,6 @@ END(__strcat_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcat_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .save   {r4, r5}
     .cfi_def_cfa_offset 8
@@ -216,8 +212,6 @@ error_code:
     .word   BIONIC_EVENT_STRCAT_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-
-    .cfi_endproc
 END(__strcat_chk_failed)
 
     .data
index a2c1df1c13b583a4398909b8f134fb9a302d76fd..95aaf4f56b065f5f84b6a5b30b0db3ede5d65e4d 100644 (file)
@@ -37,7 +37,6 @@
 // Get the length of the source string first, then do a memcpy of the data
 // instead of a strcpy.
 ENTRY(__strcpy_chk)
-    .cfi_startproc
     pld     [r0, #0]
     push    {r0, lr}
     .save   {r0, lr}
@@ -155,8 +154,6 @@ ENTRY(__strcpy_chk)
 
     // Add 1 for copy length to get the string terminator.
     add     r2, r3, #1
-
-    .cfi_endproc
 END(__strcpy_chk)
 
 #define MEMCPY_BASE         __strcpy_chk_memcpy_base
@@ -164,7 +161,6 @@ END(__strcpy_chk)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__strcpy_chk_failed)
-    .cfi_startproc
     .save   {r0, lr}
     .cfi_def_cfa_offset 8
     .cfi_rel_offset r0, 0
@@ -179,7 +175,6 @@ error_code:
     .word   BIONIC_EVENT_STRCPY_BUFFER_OVERFLOW
 error_message:
     .word   error_string-(1b+4)
-    .cfi_endproc
 END(__strcpy_chk_failed)
 
     .data
index b3ce95de671df7a73fd8550f5939e40210d9ec82..54405fa9dfb18d8ff3a30b4958334cf9d875018c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
         .thumb_func
 
 ENTRY(__memcpy_chk)
-        .cfi_startproc
         cmp         r2, r3
         bhi         __memcpy_chk_fail
 
         // Fall through to memcpy...
-        .cfi_endproc
 END(__memcpy_chk)
 
 ENTRY(memcpy)
-        .cfi_startproc
         pld     [r1, #64]
         stmfd   sp!, {r0, lr}
         .save   {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
         .cfi_rel_offset lr, 4
-        .cfi_endproc
 END(memcpy)
 
 #define MEMCPY_BASE         __memcpy_base
@@ -68,7 +64,6 @@ END(memcpy)
 #include "memcpy_base.S"
 
 ENTRY_PRIVATE(__memcpy_chk_fail)
-        .cfi_startproc
         // Preserve lr for backtrace.
         push    {lr}
         .save   {lr}
@@ -84,7 +79,6 @@ error_code:
         .word   BIONIC_EVENT_MEMCPY_BUFFER_OVERFLOW
 error_message:
         .word   error_string-(1b+4)
-        .cfi_endproc
 END(__memcpy_chk_fail)
 
         .data
index 9984177d3ba3b1cabbde097ae0772661d7114224..99fc255f3fc9abe12e2e4144f84786ace912300a 100644 (file)
@@ -36,7 +36,6 @@
 // Assumes neon instructions and a cache line size of 32 bytes.
 
 ENTRY_PRIVATE(MEMCPY_BASE)
-        .cfi_startproc
         .save {r0, lr}
         .cfi_def_cfa_offset 8
         .cfi_rel_offset r0, 0
@@ -122,6 +121,4 @@ ENTRY_PRIVATE(MEMCPY_BASE)
 
         ldmfd       sp!, {r0, lr}
         bx          lr
-
-        .cfi_endproc
 END(MEMCPY_BASE)
index c5a93862c5075aabf1c0ee94c071247811f1db0c..1563327c448551bbd3591231f64f0d264fae1bc4 100644 (file)
@@ -39,7 +39,6 @@
     .fpu    neon
 
 ENTRY(__memset_chk)
-        .cfi_startproc
         cmp         r2, r3
         bls         .L_done
 
@@ -58,23 +57,18 @@ error_code:
         .word       BIONIC_EVENT_MEMSET_BUFFER_OVERFLOW
 error_message:
         .word       error_string-(1b+8)
-
-        .cfi_endproc
 END(__memset_chk)
 
 ENTRY(bzero)
-        .cfi_startproc
         mov     r2, r1
         mov     r1, #0
 
 .L_done:
         // Fall through to memset...
-        .cfi_endproc
 END(bzero)
 
 /* memset() returns its first argument.  */
 ENTRY(memset)
-        .cfi_startproc
         .save       {r0}
         stmfd       sp!, {r0}
         .cfi_def_cfa_offset 4
@@ -111,7 +105,6 @@ ENTRY(memset)
         strcsb      r1, [r0], #1
         ldmfd       sp!, {r0}
         bx          lr
-        .cfi_endproc
 END(memset)
 
         .data
index e78bc9cfd2fc291b1bd1884ce8c77fcc14233eb8..f735fb5e70b608577fec5276cde4bca0a1a255d0 100644 (file)
@@ -159,7 +159,6 @@ ENTRY(strcmp)
 #endif /* not  __ARMEB__ */
         .endm /* setup_return */
 
-        .cfi_startproc
         pld [r0, #0]
         pld [r1, #0]
 
@@ -485,5 +484,4 @@ ENTRY(strcmp)
     .cfi_restore r7
 
        bx      lr
-    .cfi_endproc
 END(strcmp)
index 75b6133868916216b317eedd769f77672838ad9a..a1d4689fc003b71d0e3ed3a691df0b136f7d38ec 100644 (file)
@@ -1,7 +1,6 @@
 # Generated by gensyscalls.py. Do not edit.
 syscall_src :=
 syscall_src += arch-arm/syscalls/__brk.S
-syscall_src += arch-arm/syscalls/__clone.S
 syscall_src += arch-arm/syscalls/__epoll_pwait.S
 syscall_src += arch-arm/syscalls/__exit.S
 syscall_src += arch-arm/syscalls/__fcntl64.S
@@ -23,6 +22,7 @@ syscall_src += arch-arm/syscalls/__rt_sigprocmask.S
 syscall_src += arch-arm/syscalls/__rt_sigsuspend.S
 syscall_src += arch-arm/syscalls/__rt_sigtimedwait.S
 syscall_src += arch-arm/syscalls/__sched_getaffinity.S
+syscall_src += arch-arm/syscalls/__set_tid_address.S
 syscall_src += arch-arm/syscalls/__set_tls.S
 syscall_src += arch-arm/syscalls/__sigaction.S
 syscall_src += arch-arm/syscalls/__statfs64.S
@@ -100,6 +100,7 @@ syscall_src += arch-arm/syscalls/inotify_init1.S
 syscall_src += arch-arm/syscalls/inotify_rm_watch.S
 syscall_src += arch-arm/syscalls/ioprio_get.S
 syscall_src += arch-arm/syscalls/ioprio_set.S
+syscall_src += arch-arm/syscalls/kill.S
 syscall_src += arch-arm/syscalls/klogctl.S
 syscall_src += arch-arm/syscalls/lgetxattr.S
 syscall_src += arch-arm/syscalls/linkat.S
@@ -175,10 +176,12 @@ syscall_src += arch-arm/syscalls/swapon.S
 syscall_src += arch-arm/syscalls/symlinkat.S
 syscall_src += arch-arm/syscalls/sync.S
 syscall_src += arch-arm/syscalls/sysinfo.S
+syscall_src += arch-arm/syscalls/tgkill.S
 syscall_src += arch-arm/syscalls/timerfd_create.S
 syscall_src += arch-arm/syscalls/timerfd_gettime.S
 syscall_src += arch-arm/syscalls/timerfd_settime.S
 syscall_src += arch-arm/syscalls/times.S
+syscall_src += arch-arm/syscalls/tkill.S
 syscall_src += arch-arm/syscalls/truncate.S
 syscall_src += arch-arm/syscalls/truncate64.S
 syscall_src += arch-arm/syscalls/umask.S
diff --git a/libc/arch-arm/syscalls/__clone.S b/libc/arch-arm/syscalls/__clone.S
deleted file mode 100644 (file)
index fb074bc..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <private/bionic_asm.h>
-
-ENTRY(__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}
-    cmn     r0, #(MAX_ERRNO + 1)
-    bxls    lr
-    neg     r0, r0
-    b       __set_errno
-END(__clone)
index f0b14440369199dc33c9b90f21527d0bcaab8c1a..b2d8d48f0af2d5106465254fd082f4ad109db0e3 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__epoll_pwait)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_epoll_pwait
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 5d215a448d16efbd1c947554bf8fc12e882f592f..ec307d2911e582dbf372818730c44b29479f853d 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__llseek)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR__llseek
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index c8dec862a922639bc4330a359f0c18d80c2d7160..8a179977d039695d99d0e4b4d3aeeb076e079267 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__mmap2)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_mmap2
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 5992178790b0cebf5d64b899566f2c3079e9be5f..d9fb3d9fb744b9e7a04112b23ecb7ea76732bf82 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__ppoll)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_ppoll
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index d44e7ed58d65055de68e641aeaf51bf020fe1597..05fea543e99bcdcc983a09da966d942d2c4be216 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__pselect6)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_pselect6
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
diff --git a/libc/arch-arm/syscalls/__set_tid_address.S b/libc/arch-arm/syscalls/__set_tid_address.S
new file mode 100644 (file)
index 0000000..b4b42e7
--- /dev/null
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    mov     ip, r7
+    ldr     r7, =__NR_set_tid_address
+    swi     #0
+    mov     r7, ip
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
+END(__set_tid_address)
index 51b64875b92a808733aea637e943bc296fccc0c0..e5e1f54dc14a37b5af7b8d7f9dafadefda53f356 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(__waitid)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_waitid
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 12a771001a38bd317d45c61076877261685b9013..ea8193f4374cff5ea5b412a7ca1d23d080da7df2 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(fchownat)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_fchownat
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 7f957208321f2a65e10b05b74255f59498bc1452..64b8d031e345acccb0688750619eb29dc64c713c 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(fsetxattr)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_fsetxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index a553b7ea92bd0ce90f9bfef57a04dde58958c613..1646ca2073b546f1e782b33c399676889a40120b 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(futex)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_futex
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index e5cac30808ee1b0b892637587c8c646915154c54..2ded34fd3de123bb1c985eff13af34f99daf2411 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(getsockopt)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_getsockopt
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
diff --git a/libc/arch-arm/syscalls/kill.S b/libc/arch-arm/syscalls/kill.S
new file mode 100644 (file)
index 0000000..9a44208
--- /dev/null
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(kill)
+    mov     ip, r7
+    ldr     r7, =__NR_kill
+    swi     #0
+    mov     r7, ip
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
+END(kill)
index 5e4d541ba966bc9b99cd8dcf33d4719df86d08c4..27f1e00984756a2ec3fd7e55259d1b87ba063f96 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(linkat)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_linkat
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index c1a26b4268d7749bbf9ce6b333ceff026da79b5c..fb3f75fdc9e642ca6bfa6c2a340e3dd397752570 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(lsetxattr)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_lsetxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index dae9f3c281c96024a0de03adf31318073f4550af..d56682c6333f8feb062d243860029abba1aed464 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(mount)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_mount
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 4cd624eff4f242f51a13890ebaac29d2eb5a84d6..2821ac5d9c81d34dfb31d95b8cdbb1776f9b54f7 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(perf_event_open)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_perf_event_open
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 51b3c97c6569f5c429b32218ff760c845d040b62..615a2fa2ea3b8360dfd7e6137a88440e5e663134 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(prctl)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_prctl
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 59bd15468decb319008dafcf5a1d390227b07b04..0bfb6d05158af72e10c80763bb1667f1ab2761d4 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(pread64)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_pread64
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 18477f4c5888b72907ca24ce125c60ec1cbfe5ae..03247b100bb5aa367bff96ffa7d70d9842ccb5eb 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(pwrite64)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_pwrite64
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index acd35bdbb247d61841c4f0f7b1dde98c9e56d54d..83d84424fa29a510c84e5a4f0dcaabe31643c430 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(readahead)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_readahead
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 54c7855265bf747dc37f0341eb9cd17f6dfc7756..cb89f7230cb175b36f8f2d379ec0d8322fb2b0d3 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(recvfrom)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_recvfrom
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index b430e06732b2f35d5bc633eeb697f71396380f35..bd0ec1d4c8705698be381f48fe72db835ae0965d 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(sendto)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_sendto
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 9dc7b1ed6e9cad4ec91487f80b3254e0de9ad978..b2d75979011a9fe4ce8d26fa0d64ba102c281d94 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(setsockopt)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_setsockopt
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
index 536630b63e8ae3c54e0465f775c2edfdb7b25203..022195d01c8dfa57210f502919212e2b6445211b 100644 (file)
@@ -4,12 +4,17 @@
 
 ENTRY(setxattr)
     mov     ip, sp
-    .save   {r4, r5, r6, r7}
     stmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 16
+    .cfi_rel_offset r4, 0
+    .cfi_rel_offset r5, 4
+    .cfi_rel_offset r6, 8
+    .cfi_rel_offset r7, 12
     ldmfd   ip, {r4, r5, r6}
     ldr     r7, =__NR_setxattr
     swi     #0
     ldmfd   sp!, {r4, r5, r6, r7}
+    .cfi_def_cfa_offset 0
     cmn     r0, #(MAX_ERRNO + 1)
     bxls    lr
     neg     r0, r0
diff --git a/libc/arch-arm/syscalls/tgkill.S b/libc/arch-arm/syscalls/tgkill.S
new file mode 100644 (file)
index 0000000..4ea04f5
--- /dev/null
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tgkill)
+    mov     ip, r7
+    ldr     r7, =__NR_tgkill
+    swi     #0
+    mov     r7, ip
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
+END(tgkill)
diff --git a/libc/arch-arm/syscalls/tkill.S b/libc/arch-arm/syscalls/tkill.S
new file mode 100644 (file)
index 0000000..2626ae7
--- /dev/null
@@ -0,0 +1,14 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(tkill)
+    mov     ip, r7
+    ldr     r7, =__NR_tkill
+    swi     #0
+    mov     r7, ip
+    cmn     r0, #(MAX_ERRNO + 1)
+    bxls    lr
+    neg     r0, r0
+    b       __set_errno
+END(tkill)
similarity index 58%
rename from libc/bionic/usleep.c
rename to libc/arch-mips/bionic/__bionic_clone.S
index 19e8ee8928f5912e854e5d8149ad23b76272cc91..8970b6ec7fa7f57a83c31cd0e0a8da261bffd545 100644 (file)
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include <time.h>
-#include <errno.h>
-
-int usleep(unsigned long usec)
-{
-  struct timespec ts;
-
-  ts.tv_sec  = usec/1000000UL;
-
-#ifdef __arm__
-    /* avoid divisions and modulos on the ARM */
-  ts.tv_nsec = (usec - ts.tv_sec*1000000UL)*1000;
-#else
-  ts.tv_nsec = (usec % 1000000UL) * 1000UL;
-#endif
-
-  for (;;)
-  {
-    if ( nanosleep( &ts, &ts ) == 0 )
-        return 0;
-
-    // We try again if the nanosleep failure is EINTR.
-    // The other possible failures are EINVAL (which we should pass through),
-    // and ENOSYS, which doesn't happen.
-    if ( errno != EINTR )
-        return -1;
-  }
-}
+
+#include <asm/unistd.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+
+// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
+       .text
+       .type __bionic_clone, @function
+       .global __bionic_clone
+       .align 4
+        .ent __bionic_clone
+__bionic_clone:
+        .set   noreorder
+        .cpload $t9
+        .set   reorder
+
+       # set up child stack
+       subu    $a1,16
+       lw      $t0,20($sp)     # fn
+       lw      $t1,24($sp)     # arg
+       sw      $t0,0($a1)      # fn
+       sw      $t1,4($a1)      # arg
+
+       # remainder of arguments are correct for clone system call
+        li     $v0,__NR_clone
+        syscall
+
+        bnez   $a3,.L__error_bc
+
+        beqz   $v0,.L__thread_start_bc
+
+        j $ra
+
+.L__thread_start_bc:
+        lw     $a0,0($sp)      #  fn
+        lw     $a1,4($sp)      #  arg
+
+       # void __bionic_clone_entry(int (*func)(void*), void *arg)
+        la     $t9,__bionic_clone_entry
+        j      $t9
+
+.L__error_bc:
+       move    $a0,$v0
+       la      $t9,__set_errno
+       j       $t9
+
+        .end __bionic_clone
index 8351e2eade9189ca29b4e00f37b0db10aa37e7f5..9cab52b277109eb4e5a4e7cd6205ff8f2662d090 100644 (file)
@@ -30,7 +30,7 @@
 
        .text
 
-// void _exit_with_stack_teardown(void * stackBase, size_t stackSize, int status)
+// void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
 
        .type   _exit_with_stack_teardown, @function
        .global _exit_with_stack_teardown
@@ -40,12 +40,11 @@ _exit_with_stack_teardown:
        move    $s0,$a2         /* preserve status for exit() call */
 
        li      $v0,__NR_munmap
-       syscall                 /* the stack is destroyed by this call */
+       syscall
+       // If munmap failed, we ignore the failure and exit anyway.
+
        move    $a0,$s0
        li      $v0,__NR_exit
        syscall
-
-       /* exit() should never return, cause a crash if it does */
-       move    $a0,$0
-       lw      $a0,($a0)
+        // The exit syscall does not return.
        .end    _exit_with_stack_teardown
diff --git a/libc/arch-mips/bionic/clone.S b/libc/arch-mips/bionic/clone.S
deleted file mode 100644 (file)
index 94e18a2..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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>
-#include <linux/errno.h>
-#include <linux/sched.h>
-
-       .text
-       .type __pthread_clone, @function
-       .global __pthread_clone
-       .align 4
-        .ent __pthread_clone
-
-/*
- * int __pthread_clone(void* (*fn)(void*), void *child_stack,
- *                      int flags, void *arg);
- */
-
-__pthread_clone:
-        .set   noreorder
-        .cpload $t9
-        .set   reorder
-
-       # set up child stack
-       subu    $a1,16
-       sw      $a0,0($a1)      # fn
-       sw      $a3,4($a1)      # arg
-#      sw      $a1+16,8($a1)   # tls
-
-       /*
-        * int sys_clone(int flags, void *child_stack, int *parent_tidptr,
-        *       struct user_desc *newtls, int *child_tidptr);
-        */
-
-       move    $a0,$a2         # flags
-#      move    $a1,$a1         # child_stack
-       move    $a2,$0          # parent_tidptr
-       move    $a3,$0          # user_desc
-       and     $a0,~(CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
-                               # make sure the kernel doesn't access child_tidptr
-
-        li     $v0,__NR_clone
-        syscall
-
-        bnez   $a3,.L__error
-
-        beqz   $v0,.L__thread_start
-
-        j $ra
-
-.L__thread_start:
-        lw     $a0,0($sp)      #  fn
-        lw     $a1,4($sp)      #  arg
-        addu   $a2,$sp,16      #  tls
-
-       # void __thread_entry(void* (*func)(void*), void *arg, void *tls)
-        la     $t9, __thread_entry
-        j      $t9
-
-.L__error:
-       move    $a0,$v0
-       la      $t9,__set_errno
-       j       $t9
-
-        .end __pthread_clone
-
-
-    #
-    # 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.
-    #
-       .text
-       .type __bionic_clone, @function
-       .global __bionic_clone
-       .align 4
-        .ent __bionic_clone
-__bionic_clone:
-        .set   noreorder
-        .cpload $t9
-        .set   reorder
-
-       # set up child stack
-       subu    $a1,16
-       lw      $t0,20($sp)     # fn
-       lw      $t1,24($sp)     # arg
-       sw      $t0,0($a1)      # fn
-       sw      $t1,4($a1)      # arg
-
-       # remainder of arguments are correct for clone system call
-        li     $v0,__NR_clone
-        syscall
-
-        bnez   $a3,.L__error_bc
-
-        beqz   $v0,.L__thread_start_bc
-
-        j $ra
-
-.L__thread_start_bc:
-        lw     $a0,0($sp)      #  fn
-        lw     $a1,4($sp)      #  arg
-
-       # void __bionic_clone_entry(int (*func)(void*), void *arg)
-        la     $t9,__bionic_clone_entry
-        j      $t9
-
-.L__error_bc:
-       move    $a0,$v0
-       la      $t9,__set_errno
-       j       $t9
-
-        .end __bionic_clone
index c8953576b0fde175fbaf4f9e81323995d3e85357..1119a66be34dfd1a2d3dfdf709700a5f9916a355 100644 (file)
@@ -1,7 +1,7 @@
 _LIBC_ARCH_COMMON_SRC_FILES := \
+    arch-mips/bionic/__bionic_clone.S \
     arch-mips/bionic/bzero.S \
     arch-mips/bionic/cacheflush.cpp \
-    arch-mips/bionic/clone.S \
     arch-mips/bionic/_exit_with_stack_teardown.S \
     arch-mips/bionic/futex_mips.S \
     arch-mips/bionic/__get_sp.S \
index e141a65968cd8b901da56e713e574c394ad96c0b..40932b7126ca42b1650c877e7bbfe86b2678bdab 100644 (file)
@@ -1,7 +1,6 @@
 # Generated by gensyscalls.py. Do not edit.
 syscall_src :=
 syscall_src += arch-mips/syscalls/__brk.S
-syscall_src += arch-mips/syscalls/__clone.S
 syscall_src += arch-mips/syscalls/__epoll_pwait.S
 syscall_src += arch-mips/syscalls/__exit.S
 syscall_src += arch-mips/syscalls/__fcntl64.S
@@ -24,6 +23,7 @@ syscall_src += arch-mips/syscalls/__rt_sigsuspend.S
 syscall_src += arch-mips/syscalls/__rt_sigtimedwait.S
 syscall_src += arch-mips/syscalls/__sched_getaffinity.S
 syscall_src += arch-mips/syscalls/__set_thread_area.S
+syscall_src += arch-mips/syscalls/__set_tid_address.S
 syscall_src += arch-mips/syscalls/__sigaction.S
 syscall_src += arch-mips/syscalls/__statfs64.S
 syscall_src += arch-mips/syscalls/__syslog.S
similarity index 65%
rename from libc/arch-mips/syscalls/__clone.S
rename to libc/arch-mips/syscalls/__set_tid_address.S
index 5ad14897f18ed31baa37c7e4a648907d42f1a432..4fcc82a5e1c2ed479f851f89a3c45d687701104b 100644 (file)
@@ -2,14 +2,14 @@
 
 #include <asm/unistd.h>
     .text
-    .globl __clone
+    .globl __set_tid_address
     .align 4
-    .ent __clone
+    .ent __set_tid_address
 
-__clone:
+__set_tid_address:
     .set noreorder
     .cpload $t9
-    li $v0, __NR_clone
+    li $v0, __NR_set_tid_address
     syscall
     bnez $a3, 1f
     move $a0, $v0
@@ -20,4 +20,4 @@ __clone:
     j $t9
     nop
     .set reorder
-    .end __clone
+    .end __set_tid_address
diff --git a/libc/arch-x86/bionic/__bionic_clone.S b/libc/arch-x86/bionic/__bionic_clone.S
new file mode 100644 (file)
index 0000000..3823ecc
--- /dev/null
@@ -0,0 +1,54 @@
+#include <asm/unistd.h>
+#include <machine/asm.h>
+
+// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
+ENTRY(__bionic_clone)
+        pushl   %ebx
+        pushl   %esi
+        pushl   %edi
+
+        # Align child stack.
+        movl    20(%esp), %ecx
+        andl    $~15, %ecx
+
+        # Copy 'fn' and 'arg' onto the child stack
+        movl    36(%esp), %eax   # Read 'fn'.
+        movl    %eax, -16(%ecx)  # Write 'fn'.
+        movl    40(%esp), %eax   # Read 'arg'.
+        movl    %eax, -12(%ecx)  # Write 'arg'.
+        subl    $16, %ecx
+
+        # Make the system call.
+        movl    $__NR_clone, %eax
+        movl    16(%esp), %ebx  # flags
+        #movl   %ecx, %ecx      # child stack (already there)
+        movl    24(%esp), %edx  # parent_tid
+        movl    28(%esp), %esi  # tls
+        movl    32(%esp), %edi  # child_tid
+        int     $0x80
+
+        # Check result.
+        cmpl    $0, %eax
+        je      bc_child
+        jg      bc_parent
+
+        # An error occurred, so set errno and return -1.
+        negl    %eax
+        pushl   %eax
+        call    __set_errno
+        addl    $4, %esp
+        orl     $-1, %eax
+        jmp     bc_return
+
+bc_child:
+        call    __bionic_clone_entry
+        hlt
+
+bc_parent:
+        # we're the parent; nothing to do.
+bc_return:
+        popl    %edi
+        popl    %esi
+        popl    %ebx
+        ret
+END(__bionic_clone)
index 1c6d48adca694d552291ebf8d4e809cb2e88395d..03a4be02b102c84235514ab898e7bb4ac1ba0ccf 100644 (file)
@@ -3,20 +3,19 @@
 
 // void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status)
 ENTRY(_exit_with_stack_teardown)
-    // We can trash %ebx here since this call should never return.
+    // We can trash registers because this function never returns.
     // We can also take advantage of the fact that the linux syscall trap
     // handler saves all the registers, so we don't need a stack to keep
-    // the status argument for exit while doing the munmap */
+    // the status argument for exit while doing the munmap.
     mov     4(%esp), %ebx             // stackBase
     mov     8(%esp), %ecx             // stackSize
+    mov     12(%esp), %edx            // Also copy 'status' off the stack we're about to unmap.
     mov     $__NR_munmap, %eax
     int     $0x80
-
     // If munmap failed, we ignore the failure and exit anyway.
 
     mov     %edx, %ebx                // status
     movl    $__NR_exit, %eax
     int     $0x80
-
     // The exit syscall does not return.
 END(_exit_with_stack_teardown)
diff --git a/libc/arch-x86/bionic/clone.S b/libc/arch-x86/bionic/clone.S
deleted file mode 100644 (file)
index 457cb4a..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <asm/unistd.h>
-#include <machine/asm.h>
-
-// int  __pthread_clone(void* (*fn)(void*), void* tls, int flags, void* arg);
-ENTRY(__pthread_clone)
-        pushl   %ebx
-        pushl   %ecx
-        movl    16(%esp), %ecx
-
-        # save tls
-        movl    %ecx, %ebx
-        # 16-byte alignment on child stack
-        andl    $~15, %ecx
-
-        # insert arguments onto the child stack
-        movl    12(%esp), %eax
-        movl    %eax, -16(%ecx)
-        movl    24(%esp), %eax
-        movl    %eax, -12(%ecx)
-        movl    %ebx, -8(%ecx)
-
-        subl    $16, %ecx
-        movl    20(%esp), %ebx
-
-        # make system call
-        movl    $__NR_clone, %eax
-        int     $0x80
-
-        cmpl    $0, %eax
-        je      pc_child
-        jg      pc_parent
-
-        # an error occurred, set errno and return -1
-        negl    %eax
-        pushl   %eax
-        call    __set_errno
-        addl    $4, %esp
-        orl     $-1, %eax
-        jmp     pc_return
-
-pc_child:
-        # we're in the child thread now, call __thread_entry
-        # with the appropriate arguments on the child stack
-        # we already placed most of them
-        call    __thread_entry
-        hlt
-
-pc_parent:
-        # we're the parent; nothing to do.
-pc_return:
-        popl    %ecx
-        popl    %ebx
-        ret
-END(__pthread_clone)
-
-
-/*
- * int  __bionic_clone(unsigned long clone_flags,
- *                     void*         newsp,
- *                     int           *parent_tidptr,
- *                     void          *new_tls,
- *                     int           *child_tidptr,
- *                     int           (*fn)(void *),
- *                     void          *arg);
- */
-ENTRY(__bionic_clone)
-        pushl   %ebx
-        pushl   %esi
-        pushl   %edi
-
-        # insert arguments onto the child stack
-        movl    20(%esp), %ecx
-        andl    $~15, %ecx
-        movl    36(%esp), %eax
-        movl    %eax, -16(%ecx)
-        movl    40(%esp), %eax
-        movl    %eax, -12(%ecx)
-
-        subl    $16, %ecx
-        movl    16(%esp), %ebx
-        movl    24(%esp), %edx
-        movl    32(%esp), %esi
-        movl    28(%esp), %edi
-
-        # make system call
-        movl    $__NR_clone, %eax
-        int     $0x80
-
-        cmpl    $0, %eax
-        je      bc_child
-        jg      bc_parent
-
-        # an error occurred, set errno and return -1
-        negl    %eax
-        pushl   %eax
-        call    __set_errno
-        addl    $4, %esp
-        orl     $-1, %eax
-        jmp     bc_return
-
-bc_child:
-        # we're in the child now, call __bionic_clone_entry
-        # with the appropriate arguments on the child stack
-        # we already placed most of them
-        call    __bionic_clone_entry
-        hlt
-
-bc_parent:
-        # we're the parent; nothing to do.
-bc_return:
-        popl    %edi
-        popl    %esi
-        popl    %ebx
-        ret
-END(__bionic_clone)
index 2e8d298c783e167b4fca9539efd2eca37123f202..5ccf78f13badeac45eda49514886eadc87a6cedf 100644 (file)
@@ -94,7 +94,7 @@
 #endif
 
 #define _ENTRY(x) \
-       .text; _ALIGN_TEXT; .globl x; .type x,@function; x:
+       .text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
 #define _LABEL(x) \
        .globl x; x:
 
 #define        NENTRY(y)       _ENTRY(_C_LABEL(y))
 #define        ASENTRY(y)      _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define        LABEL(y)        _LABEL(_C_LABEL(y))
-#define        END(y)          .size y, . - y
+#define        END(y)          .cfi_endproc; .size y, . - y
 
 #define        ASMSTR          .asciz
 
index dde5ae111f45d2dfa070a36a18c6681cb0e838b9..40df1d026bc7eace677cd6eed472c5a81c3b4aec 100644 (file)
         *  ws@tools.de     (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
         */
 
-#ifdef MEMCOPY
+#if defined(MEMCOPY)
 ENTRY(memcpy)
-#else
-#ifdef MEMMOVE
+#elif defined(MEMMOVE)
 ENTRY(memmove)
 #else
 ENTRY(bcopy)
-#endif
 #endif
        pushl   %esi
        pushl   %edi
@@ -91,3 +89,10 @@ ENTRY(bcopy)
        popl    %esi
        cld
        ret
+#if defined(MEMCOPY)
+END(memcpy)
+#elif defined(MEMMOVE)
+END(memmove)
+#else
+END(bcopy)
+#endif
index 70e6e39c74579e91b53b859494583216872d25db..780972f1f87e35aec43e11e0a8d37eb861d68c38 100644 (file)
@@ -1,7 +1,6 @@
 # Generated by gensyscalls.py. Do not edit.
 syscall_src :=
 syscall_src += arch-x86/syscalls/__brk.S
-syscall_src += arch-x86/syscalls/__clone.S
 syscall_src += arch-x86/syscalls/__epoll_pwait.S
 syscall_src += arch-x86/syscalls/__exit.S
 syscall_src += arch-x86/syscalls/__fcntl64.S
@@ -24,6 +23,7 @@ syscall_src += arch-x86/syscalls/__rt_sigsuspend.S
 syscall_src += arch-x86/syscalls/__rt_sigtimedwait.S
 syscall_src += arch-x86/syscalls/__sched_getaffinity.S
 syscall_src += arch-x86/syscalls/__set_thread_area.S
+syscall_src += arch-x86/syscalls/__set_tid_address.S
 syscall_src += arch-x86/syscalls/__sigaction.S
 syscall_src += arch-x86/syscalls/__statfs64.S
 syscall_src += arch-x86/syscalls/__syslog.S
diff --git a/libc/arch-x86/syscalls/__clone.S b/libc/arch-x86/syscalls/__clone.S
deleted file mode 100644 (file)
index 2ff8fcd..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Generated by gensyscalls.py. Do not edit. */
-
-#include <private/bionic_asm.h>
-
-ENTRY(__clone)
-    pushl   %ebx
-    pushl   %ecx
-    pushl   %edx
-    pushl   %esi
-    pushl   %edi
-    mov     24(%esp), %ebx
-    mov     28(%esp), %ecx
-    mov     32(%esp), %edx
-    mov     36(%esp), %esi
-    mov     40(%esp), %edi
-    movl    $__NR_clone, %eax
-    int     $0x80
-    cmpl    $-MAX_ERRNO, %eax
-    jb      1f
-    negl    %eax
-    pushl   %eax
-    call    __set_errno
-    addl    $4, %esp
-    orl     $-1, %eax
-1:
-    popl    %edi
-    popl    %esi
-    popl    %edx
-    popl    %ecx
-    popl    %ebx
-    ret
-END(__clone)
diff --git a/libc/arch-x86/syscalls/__set_tid_address.S b/libc/arch-x86/syscalls/__set_tid_address.S
new file mode 100644 (file)
index 0000000..0c66d47
--- /dev/null
@@ -0,0 +1,20 @@
+/* Generated by gensyscalls.py. Do not edit. */
+
+#include <private/bionic_asm.h>
+
+ENTRY(__set_tid_address)
+    pushl   %ebx
+    mov     8(%esp), %ebx
+    movl    $__NR_set_tid_address, %eax
+    int     $0x80
+    cmpl    $-MAX_ERRNO, %eax
+    jb      1f
+    negl    %eax
+    pushl   %eax
+    call    __set_errno
+    addl    $4, %esp
+    orl     $-1, %eax
+1:
+    popl    %ebx
+    ret
+END(__set_tid_address)
index 5911ad9f110e18e90bff4b114b486f385f24cf63..9c7408496d0b1763050a9ee5c491c5bc02b66656 100644 (file)
@@ -1,5 +1,5 @@
 _LIBC_ARCH_COMMON_SRC_FILES := \
-    arch-x86/bionic/clone.S \
+    arch-x86/bionic/__bionic_clone.S \
     arch-x86/bionic/_exit_with_stack_teardown.S \
     arch-x86/bionic/futex_x86.S \
     arch-x86/bionic/__get_sp.S \
similarity index 62%
rename from libc/arch-x86_64/bionic/clone.S
rename to libc/arch-x86_64/bionic/__bionic_clone.S
index 7511e86731bdf850bbba3b1581103be7e52b413f..7692013432845065e2eaa6e60cd7fb401763caa3 100644 (file)
 #include <asm/unistd.h>
 #include <machine/asm.h>
 
-// int  __pthread_clone(void* (*fn)(void*), void* tls, int flags, void* arg);
-ENTRY(__pthread_clone)
-        # Save tls.
-        movq    %rsi, %r11
-        # Enforce 16-byte alignment for child stack.
-        andq    $~15, %rsi
-
-        # Copy 'fn', 'arg', and 'tls' onto the child stack.
-        movq    %rdi, -32(%rsi)  # fn
-        movq    %rcx, -24(%rsi)  # arg
-        movq    %r11, -16(%rsi)  # tls
-        subq    $32, %rsi
-
-        movq    %rdx, %rdi
-        movl    $__NR_clone, %eax
-        syscall
-        testl   %eax, %eax
-        jns     1f
-
-        # An error occurred, set errno and return -1.
-        negl    %eax
-        movl    %eax, %edi
-        call    __set_errno
-        orl     $-1, %eax
-        jmp     2f
-1:
-        jnz     2f
-
-        # We're in the child now, so call __thread_entry
-        # with the arguments from the child stack moved into
-        # the appropriate registers. We avoid pop here to keep
-        # the required 16-byte stack alignment.
-        movq    (%rsp), %rdi    # fn
-        movq    8(%rsp), %rsi   # arg
-        movq    16(%rsp), %rdx  # tls
-        call    __thread_entry
-        hlt
-2:
-        ret
-
-// int __bionic_clone(unsigned long clone_flags,
-//                    void* new_sp,
-//                    int* parent_tid_ptr,
-//                    void* new_tls,
-//                    int* child_tid_ptr,
-//                    int (*fn)(void*),
-//                    void* arg);
+// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
 ENTRY(__bionic_clone)
         # Enforce 16-byte alignment for child stack.
         andq    $~15, %rsi
@@ -86,8 +40,13 @@ ENTRY(__bionic_clone)
         movq    %rax, -8(%rsi)  # Write 'arg'.
 
         subq    $16, %rsi
+
+        # Translate to the kernel calling convention and swap the 'tls' and 'child_tid' arguments.
+        # They're flipped for x86-64 compared to all our other architectures and __bionic_clone.
         movq    %r8, %r10
         movq    %rcx, %r8
+
+        # Make the system call.
         movl    $__NR_clone, %eax
         syscall
         testl   %eax, %eax
@@ -111,3 +70,4 @@ ENTRY(__bionic_clone)
         hlt
 2:
         ret
+END(__bionic_clone)
index a09babe2ef7176975709bd7a36cd5635a4d8dcd2..eca3b68f970d0abadb742c13eed7767d7492351a 100644 (file)
@@ -36,12 +36,10 @@ ENTRY(_exit_with_stack_teardown)
     // the status argument for exit(2) while doing the munmap(2).
     mov     $__NR_munmap, %eax
     syscall
-
-    // If munmap failed, ignore the failure and exit anyway.
+    // If munmap failed, we ignore the failure and exit anyway.
 
     mov     %rdx, %rdi        // status
     mov     $__NR_exit, %eax
     syscall
-
     // The exit syscall does not return.
 END(_exit_with_stack_teardown)
index d9a59f7aa1473a8bd811cffbe971ddbf0055498c..e9b8dbbd5b53a3d600bc297512885c1ff7fa97fb 100644 (file)
@@ -63,6 +63,7 @@ ENTRY(_setjmp)
 
        xorl    %eax,%eax
        ret
+END(_setjmp)
 
 ENTRY(_longjmp)
        movq    (_JB_RBX * 8)(%rdi),%rbx
@@ -80,3 +81,4 @@ ENTRY(_longjmp)
        incl    %eax
 1:     movq    %r11,0(%rsp)
        ret
+END(_longjmp)
index d94792edc6b5570a2d157c9d16be2c4d1e48b6a2..48a437e76133f00d1cf5d4766eaad39c45fcd04d 100644 (file)
@@ -42,7 +42,7 @@ ENTRY(__futex_wait)
     mov     $__NR_futex, %eax
     syscall
     ret
-
+END(__futex_wait)
 
 /* int __futex_wake(volatile void *ftx, int count) */
 
@@ -52,12 +52,14 @@ ENTRY(__futex_wake)
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_wake)
 
 /* int __futex_syscall3(volatile void *ftx, int op, int count) */
 ENTRY(__futex_syscall3)
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_syscall3)
 
 /* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */
 ENTRY(__futex_syscall4)
@@ -65,3 +67,4 @@ ENTRY(__futex_syscall4)
     mov     $__NR_futex, %eax
     syscall
     ret
+END(__futex_syscall4)
index 1641add9a3a1829a3d519dd084a1b8f73a9707fb..4dd9028915d5931d2f1f7b59e3901dc2fd84f71c 100644 (file)
@@ -73,6 +73,7 @@ ENTRY(setjmp)
 
 2:     xorl    %eax,%eax
        ret
+END(setjmp)
 
 ENTRY(longjmp)
        movq    %rdi,%r12
@@ -101,3 +102,4 @@ ENTRY(longjmp)
        incl    %eax
 1:     movq    %r11,0(%rsp)
        ret
+END(longjmp)
index 51b055a0f58d5d285f136df2accc2204cbbf078d..842d6ffb54a729c42f12cb9d995d90487664d43b 100644 (file)
@@ -77,6 +77,7 @@ ENTRY(sigsetjmp)
 
 2:     xorl    %eax,%eax
        ret
+END(sigsetjmp)
 
 ENTRY(siglongjmp)
        movq    %rdi,%r12
@@ -105,3 +106,4 @@ ENTRY(siglongjmp)
        incl    %eax
 1:     movq    %r11,0(%rsp)
        ret
+END(siglongjmp)
index 07b241c8afffd1c561a630a74ed9c531413fef66..310b23000c227d2632ef5721148cceac6d990014 100644 (file)
@@ -70,7 +70,7 @@
 #endif
 
 #define _ENTRY(x) \
-       .text; _ALIGN_TEXT; .globl x; .type x,@function; x:
+       .text; _ALIGN_TEXT; .globl x; .type x,@function; x: .cfi_startproc;
 #define _LABEL(x) \
        .globl x; x:
 
 #define        ALTENTRY(x)     NENTRY(x)
 #define        ASENTRY(y)      _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
 #define        LABEL(y)        _LABEL(_C_LABEL(y))
-#define        END(y)          .size y, . - y
+#define        END(y)          .cfi_endproc; .size y, . - y
 
 #define        ASMSTR          .asciz
 
index c874b6133a024fe48082259be96273ff3c798d3c..9e2bfccfe81a90a5e6cf49e029e86b4e0ef81033 100644 (file)
@@ -2,7 +2,6 @@
 syscall_src :=
 syscall_src += arch-x86_64/syscalls/__arch_prctl.S
 syscall_src += arch-x86_64/syscalls/__brk.S
-syscall_src += arch-x86_64/syscalls/__clone.S
 syscall_src += arch-x86_64/syscalls/__epoll_pwait.S
 syscall_src += arch-x86_64/syscalls/__exit.S
 syscall_src += arch-x86_64/syscalls/__getcpu.S
@@ -20,6 +19,7 @@ syscall_src += arch-x86_64/syscalls/__rt_sigprocmask.S
 syscall_src += arch-x86_64/syscalls/__rt_sigsuspend.S
 syscall_src += arch-x86_64/syscalls/__rt_sigtimedwait.S
 syscall_src += arch-x86_64/syscalls/__sched_getaffinity.S
+syscall_src += arch-x86_64/syscalls/__set_tid_address.S
 syscall_src += arch-x86_64/syscalls/__syslog.S
 syscall_src += arch-x86_64/syscalls/__timer_create.S
 syscall_src += arch-x86_64/syscalls/__timer_delete.S
similarity index 65%
rename from libc/arch-x86_64/syscalls/__clone.S
rename to libc/arch-x86_64/syscalls/__set_tid_address.S
index 4999762bfdbc5df36825809fce0c40c825244c00..fe7260f0d37fd212abd705abbcbc03aec288bbd9 100644 (file)
@@ -2,9 +2,8 @@
 
 #include <private/bionic_asm.h>
 
-ENTRY(__clone)
-    movq    %rcx, %r10
-    movl    $__NR_clone, %eax
+ENTRY(__set_tid_address)
+    movl    $__NR_set_tid_address, %eax
     syscall
     cmpq    $-MAX_ERRNO, %rax
     jb      1f
@@ -14,5 +13,5 @@ ENTRY(__clone)
     orq     $-1, %rax
 1:
     ret
-END(__clone)
-.hidden _C_LABEL(__clone)
+END(__set_tid_address)
+.hidden _C_LABEL(__set_tid_address)
index 4f833c15bb031610fbd048cb57b2b5cab8652477..26145378453ac8512baee32729f4dfd72716b9e6 100644 (file)
@@ -1,5 +1,5 @@
 _LIBC_ARCH_COMMON_SRC_FILES := \
-    arch-x86_64/bionic/clone.S \
+    arch-x86_64/bionic/__bionic_clone.S \
     arch-x86_64/bionic/_exit_with_stack_teardown.S \
     arch-x86_64/bionic/futex_x86_64.S \
     arch-x86_64/bionic/__get_sp.S \
diff --git a/libc/bionic/__thread_entry.cpp b/libc/bionic/__thread_entry.cpp
deleted file mode 100644 (file)
index 8300a64..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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 <pthread.h>
-
-#include "pthread_internal.h"
-
-#include "private/bionic_tls.h"
-
-// This trampoline is called from the assembly _pthread_clone function.
-// Our 'tls' and __pthread_clone's 'child_stack' are one and the same, just growing in
-// opposite directions.
-extern "C" void __thread_entry(void* (*func)(void*), void* arg, void** tls) {
-  // Wait for our creating thread to release us. This lets it have time to
-  // notify gdb about this thread before we start doing anything.
-  // This also provides the memory barrier needed to ensure that all memory
-  // accesses previously made by the creating thread are visible to us.
-  pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
-  pthread_mutex_lock(start_mutex);
-  pthread_mutex_destroy(start_mutex);
-
-  pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID];
-  thread->tls = tls;
-  __init_tls(thread);
-
-  if ((thread->internal_flags & PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED) != 0) {
-    pthread_exit(NULL);
-  }
-
-  void* result = func(arg);
-  pthread_exit(result);
-}
similarity index 56%
rename from libc/bionic/bionic_clone.c
rename to libc/bionic/clone.cpp
index 8a17e135e6451265eaa7895c8b632a09238031f9..1d997fed73f8f6d2c2907e3a540e4598f3cd00c5 100644 (file)
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
 #define __GNU_SOURCE 1
 #include <sched.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include <stdio.h>
-
-extern int  __bionic_clone(unsigned long   clone_flags,
-                           void*           newsp,
-                           int            *parent_tidptr,
-                           void           *new_tls,
-                           int            *child_tidptr,
-                           int            (*fn)(void *),
-                           void          *arg);
 
-extern void __exit(int status);
+extern "C" pid_t __bionic_clone(uint32_t flags, void* child_stack, int* parent_tid, void* tls, int* child_tid, int (*fn)(void*), void* arg);
+extern "C" void __exit(int status);
 
-/* this function is called from the __bionic_clone
- * assembly fragment to call the thread function
- * then exit. */
-extern void __bionic_clone_entry(int (*fn)(void*), void* arg) {
+// Called from the __bionic_clone assembler to call the thread function then exit.
+extern "C" void __bionic_clone_entry(int (*fn)(void*), void* arg) {
   int status = (*fn)(arg);
   __exit(status);
 }
 
 int clone(int (*fn)(void*), void* child_stack, int flags, void* arg, ...) {
-    va_list  args;
-    int     *parent_tidptr = NULL;
-    void    *new_tls = NULL;
-    int     *child_tidptr = NULL;
+  int* parent_tid = NULL;
+  void* new_tls = NULL;
+  int* child_tid = NULL;
 
-    /* extract optional parameters - they are cumulative. */
-    va_start(args, arg);
-    if (flags & (CLONE_PARENT_SETTID|CLONE_SETTLS|CLONE_CHILD_SETTID)) {
-        parent_tidptr = va_arg(args, int*);
-    }
-    if (flags & (CLONE_SETTLS|CLONE_CHILD_SETTID)) {
-        new_tls = va_arg(args, void*);
-    }
-    if (flags & CLONE_CHILD_SETTID) {
-        child_tidptr = va_arg(args, int*);
-    }
-    va_end(args);
+  // Extract any optional parameters required by the flags.
+  va_list args;
+  va_start(args, arg);
+  if ((flags & (CLONE_PARENT_SETTID|CLONE_SETTLS|CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) != 0) {
+    parent_tid = va_arg(args, int*);
+  }
+  if ((flags & (CLONE_SETTLS|CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) != 0) {
+    new_tls = va_arg(args, void*);
+  }
+  if ((flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) != 0) {
+    child_tid = va_arg(args, int*);
+  }
+  va_end(args);
 
-    return __bionic_clone(flags, child_stack, parent_tidptr, new_tls, child_tidptr, fn, arg);
+  return __bionic_clone(flags, child_stack, parent_tid, new_tls, child_tid, fn, arg);
 }
index 78f2e1d56c37c4897d36989ad21b4173d6718d26..66a825b3382cf9a3bb97ce65cd31cafc23f1803f 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "dlmalloc.h"
 
+#include "private/bionic_name_mem.h"
 #include "private/libc_logging.h"
 
 // Send dlmalloc errors to the log.
@@ -25,6 +26,11 @@ static void __bionic_heap_usage_error(const char* function, void* address);
 #define CORRUPTION_ERROR_ACTION(m) __bionic_heap_corruption_error(__FUNCTION__)
 #define USAGE_ERROR_ACTION(m,p) __bionic_heap_usage_error(__FUNCTION__, p)
 
+/* Bionic named anonymous memory declarations */
+static void* named_anonymous_mmap(size_t length);
+#define MMAP(s) named_anonymous_mmap(s)
+#define DIRECT_MMAP(s) named_anonymous_mmap(s)
+
 // Ugly inclusion of C file so that bionic specific #defines configure dlmalloc.
 #include "../upstream-dlmalloc/malloc.c"
 
@@ -42,3 +48,15 @@ static void __bionic_heap_usage_error(const char* function, void* address) {
   // TODO: improve the debuggerd protocol so we can tell it to dump an address when we abort.
   *((int**) 0xdeadbaad) = (int*) address;
 }
+
+static void* named_anonymous_mmap(size_t length)
+{
+    void* ret;
+    ret = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+    if (ret == MAP_FAILED)
+        return ret;
+
+    __bionic_name_mem(ret, length, "libc_malloc");
+
+    return ret;
+}
index 339a0e830ef5e471d1b1f6a742bc57e16a53d903..9fa5fcf5faf11c2b9e08be7fffae1b7d60be54c8 100644 (file)
  */
 
 #include <unistd.h>
-#include "pthread_internal.h"
-
-#include "private/bionic_pthread.h"
+#include <sys/syscall.h>
 
-extern "C" int __clone(int, void*, int*, void*, int*);
+#include "private/libc_logging.h"
+#include "pthread_internal.h"
 
 int fork() {
   // POSIX mandates that the timers of a fork child process be
@@ -41,14 +40,18 @@ int fork() {
   __timer_table_start_stop(1);
   __bionic_atfork_run_prepare();
 
-  int result = __clone(SIGCHLD, NULL, NULL, NULL, NULL);
-  if (result != 0) {  // Not a child process.
+  pthread_internal_t* self = __get_thread();
+  int flags = CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD;
+#if defined(__x86_64__) // sys_clone's last two arguments are flipped on x86-64.
+  int result = syscall(__NR_clone, flags, NULL, NULL, &(self->tid), NULL);
+#else
+  int result = syscall(__NR_clone, flags, NULL, NULL, NULL, &(self->tid));
+#endif
+  if (result == 0) {
+    __bionic_atfork_run_child();
+  } else {
     __timer_table_start_stop(0);
     __bionic_atfork_run_parent();
-  } else {
-    // Fix the tid in the pthread_internal_t struct after a fork.
-    __pthread_settid(pthread_self(), gettid());
-    __bionic_atfork_run_child();
   }
   return result;
 }
index f88a26d265731d1384b6e98f3e063a966c9f1c99..1cfaf507abd3573eaa0ef8c0fb8e3157381624e6 100644 (file)
@@ -49,6 +49,8 @@
 extern "C" abort_msg_t** __abort_message_ptr;
 extern "C" uintptr_t __get_sp(void);
 extern "C" int __system_properties_init(void);
+extern "C" int __set_tls(void* ptr);
+extern "C" int __set_tid_address(int* tid_address);
 
 // Not public, but well-known in the BSDs.
 const char* __progname;
@@ -89,14 +91,24 @@ void __libc_init_tls(KernelArgumentBlock& args) {
   uintptr_t stack_bottom = stack_top - stack_size;
 
   static void* tls[BIONIC_TLS_SLOTS];
-  static pthread_internal_t thread;
-  thread.tid = gettid();
-  thread.tls = tls;
-  pthread_attr_init(&thread.attr);
-  pthread_attr_setstack(&thread.attr, (void*) stack_bottom, stack_size);
-  _init_thread(&thread, false);
-  __init_tls(&thread);
+  static pthread_internal_t main_thread;
+  main_thread.tls = tls;
+
+  // Tell the kernel to clear our tid field when we exit, so we're like any other pthread.
+  main_thread.tid = __set_tid_address(&main_thread.tid);
+
+  // We already have a stack, and we don't want to free it up on exit (because things like
+  // environment variables with global scope live on it).
+  pthread_attr_init(&main_thread.attr);
+  pthread_attr_setstack(&main_thread.attr, (void*) stack_bottom, stack_size);
+  main_thread.attr.flags = PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK | PTHREAD_ATTR_FLAG_MAIN_THREAD;
+
+  __init_thread(&main_thread, false);
+  __init_tls(&main_thread);
+  __set_tls(main_thread.tls);
   tls[TLS_SLOT_BIONIC_PREINIT] = &args;
+
+  __init_alternate_signal_stack(&main_thread);
 }
 
 void __libc_init_common(KernelArgumentBlock& args) {
@@ -112,7 +124,6 @@ void __libc_init_common(KernelArgumentBlock& args) {
 
   // Get the main thread from TLS and add it to the thread list.
   pthread_internal_t* main_thread = __get_thread();
-  main_thread->allocated_on_heap = false;
   _pthread_internal_add(main_thread);
 
   __system_properties_init(); // Requires 'environ'.
similarity index 55%
rename from libc/arch-arm/bionic/kill.S
rename to libc/bionic/name_mem.c
index 0d24a3fb3069c5a5d9326972516c5cd838489003..69e10c252a870a2c8c5e2134fe1774926d069034 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2013 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * SUCH DAMAGE.
  */
 
-#include <private/bionic_asm.h>
+#include "private/bionic_name_mem.h"
 
-/* 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).
-*/
+/*
+ * Local definitions of custom prctl arguments to set a vma name in some kernels
+ */
+#define BIONIC_PR_SET_VMA               0x53564d41
+#define BIONIC_PR_SET_VMA_ANON_NAME     0
 
-ENTRY(kill)
-    stmfd   sp!, {r4-r7, ip, lr}
-    ldr     r7, =__NR_kill
-    swi     #0
-    ldmfd   sp!, {r4-r7, ip, lr}
-    cmn     r0, #(MAX_ERRNO + 1)
-    bxls    lr
-    neg     r0, r0
-    b       __set_errno
-END(kill)
+/*
+ * Names a region of memory.  The name is expected to show up in /proc/pid/maps
+ * and /proc/pid/smaps.  There is no guarantee that it will work, and it if it
+ * does work it is likely to only work on memory that was allocated with
+ * mmap(MAP_ANONYMOUS), and only on regions that are page aligned.  name should
+ * be a pointer to a string that is valid for as long as the memory is mapped,
+ * preferably a compile-time constant string.
+ *
+ * Returns -1 on error and sets errno.  If it returns an error naming page
+ * aligned anonymous memory the kernel doesn't support naming, and an alternate
+ * method of naming memory should be used (like ashmem).
+ */
+int __bionic_name_mem(void *addr, size_t len, const char *name)
+{
+    return prctl(BIONIC_PR_SET_VMA, BIONIC_PR_SET_VMA_ANON_NAME,
+                 addr, len, name);
+}
index abd453e8f034e78c8bf6e7f6710ccbd92b427ac4..7c229b5ec4b4748f9b9bffad4cd7c025e69f3596 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "private/bionic_atomic_inline.h"
 #include "private/bionic_futex.h"
-#include "private/bionic_pthread.h"
 #include "private/bionic_time_conversions.h"
 #include "private/bionic_tls.h"
 #include "private/thread_private.h"
index 21533108f223b06bae239945e7e0412c340899d8..f20a0053e80eb88cf58f9627ecb7836bb28f2697 100644 (file)
@@ -40,7 +40,8 @@
 #include "private/ErrnoRestorer.h"
 #include "private/ScopedPthreadMutexLocker.h"
 
-extern "C" int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags, void* arg);
+extern "C" pid_t __bionic_clone(uint32_t flags, void* child_stack, int* parent_tid, void* tls, int* child_tid, int (*fn)(void*), void* arg);
+extern "C" int __set_tls(void*);
 
 #ifdef __i386__
 #define ATTRIBUTES __attribute__((noinline)) __attribute__((fastcall))
@@ -50,28 +51,30 @@ extern "C" int __pthread_clone(void* (*fn)(void*), void* child_stack, int flags,
 
 extern "C" void ATTRIBUTES _thread_created_hook(pid_t thread_id);
 
-extern "C" int __set_tls(void* ptr);
-
 static pthread_mutex_t gPthreadStackCreationLock = PTHREAD_MUTEX_INITIALIZER;
 
 static pthread_mutex_t gDebuggerNotificationLock = PTHREAD_MUTEX_INITIALIZER;
 
+// This code is used both by each new pthread and the code that initializes the main thread.
 void  __init_tls(pthread_internal_t* thread) {
-  // Zero-initialize all the slots.
-  for (size_t i = 0; i < BIONIC_TLS_SLOTS; ++i) {
+  // Zero-initialize all the slots after TLS_SLOT_SELF and TLS_SLOT_THREAD_ID.
+  for (size_t i = TLS_SLOT_ERRNO; i < BIONIC_TLS_SLOTS; ++i) {
     thread->tls[i] = NULL;
   }
 
+#if defined(__i386__)
+  __set_tls(thread->tls);
+#endif
+
   // Slot 0 must point to itself. The x86 Linux kernel reads the TLS from %fs:0.
   thread->tls[TLS_SLOT_SELF] = thread->tls;
   thread->tls[TLS_SLOT_THREAD_ID] = thread;
   // GCC looks in the TLS for the stack guard on x86, so copy it there from our global.
   thread->tls[TLS_SLOT_STACK_GUARD] = (void*) __stack_chk_guard;
+}
 
-  __set_tls(thread->tls);
-
+void __init_alternate_signal_stack(pthread_internal_t* thread) {
   // Create and set an alternate signal stack.
-  // This must happen after __set_tls, in case a system call fails and tries to set errno.
   stack_t ss;
   ss.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
   if (ss.ss_sp != MAP_FAILED) {
@@ -82,7 +85,7 @@ void  __init_tls(pthread_internal_t* thread) {
   }
 }
 
-int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) {
+int __init_thread(pthread_internal_t* thread, bool add_to_thread_list) {
   int error = 0;
 
   // Set the scheduling policy/priority of the thread.
@@ -99,7 +102,6 @@ int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) {
     }
   }
 
-  pthread_cond_init(&thread->join_cond, NULL);
   thread->cleanup_stack = NULL;
 
   if (add_to_thread_list) {
@@ -136,6 +138,34 @@ static void* __create_thread_stack(pthread_internal_t* thread) {
   return stack;
 }
 
+static int __pthread_start(void* arg) {
+  pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(arg);
+
+  // Wait for our creating thread to release us. This lets it have time to
+  // notify gdb about this thread before we start doing anything.
+  // This also provides the memory barrier needed to ensure that all memory
+  // accesses previously made by the creating thread are visible to us.
+  pthread_mutex_t* start_mutex = (pthread_mutex_t*) &thread->tls[TLS_SLOT_START_MUTEX];
+  pthread_mutex_lock(start_mutex);
+  pthread_mutex_destroy(start_mutex);
+
+  __init_tls(thread);
+
+  __init_alternate_signal_stack(thread);
+
+  void* result = thread->start_routine(thread->start_routine_arg);
+  pthread_exit(result);
+
+  return 0;
+}
+
+// A dummy start routine for pthread_create failures where we've created a thread but aren't
+// going to run user code on it. We swap out the user's start routine for this and take advantage
+// of the regular thread teardown to free up resources.
+static void* __do_nothing(void*) {
+  return NULL;
+}
+
 int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
                    void* (*start_routine)(void*), void* arg) {
   ErrnoRestorer errno_restorer;
@@ -152,7 +182,6 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
     __libc_format_log(ANDROID_LOG_WARN, "libc", "pthread_create failed: couldn't allocate thread");
     return EAGAIN;
   }
-  thread->allocated_on_heap = true;
 
   if (attr == NULL) {
     pthread_attr_init(&thread->attr);
@@ -181,26 +210,39 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
   // The child stack is the same address, just growing in the opposite direction.
   // At offsets >= 0, we have the TLS slots.
   // At offsets < 0, we have the child stack.
-  void** tls = (void**)((uint8_t*)(thread->attr.stack_base) + thread->attr.stack_size - BIONIC_TLS_SLOTS * sizeof(void*));
-  void* child_stack = tls;
+  thread->tls = (void**)((uint8_t*)(thread->attr.stack_base) + thread->attr.stack_size - BIONIC_TLS_SLOTS * sizeof(void*));
+  void* child_stack = thread->tls;
 
-  // Create a mutex for the thread in TLS_SLOT_SELF to wait on once it starts so we can keep
+  // Create a mutex for the thread in TLS to wait on once it starts so we can keep
   // it from doing anything until after we notify the debugger about it
   //
   // This also provides the memory barrier we need to ensure that all
   // memory accesses previously performed by this thread are visible to
   // the new thread.
-  pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
+  pthread_mutex_t* start_mutex = (pthread_mutex_t*) &thread->tls[TLS_SLOT_START_MUTEX];
   pthread_mutex_init(start_mutex, NULL);
-  ScopedPthreadMutexLocker start_locker(start_mutex);
+  pthread_mutex_lock(start_mutex);
 
-  tls[TLS_SLOT_THREAD_ID] = thread;
+  thread->tls[TLS_SLOT_THREAD_ID] = thread;
 
-  int flags = CLONE_FILES | CLONE_FS | CLONE_VM | CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM;
+  thread->start_routine = start_routine;
+  thread->start_routine_arg = arg;
 
-  int tid = __pthread_clone(start_routine, child_stack, flags, arg);
-  if (tid < 0) {
+  int flags = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
+      CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID;
+#if defined(__i386__)
+  // On x86 (but not x86-64), CLONE_SETTLS takes a pointer to a struct user_desc rather than
+  // a pointer to the TLS itself. Rather than try to deal with that here, we just let x86 set
+  // the TLS manually in __init_tls, like all architectures used to.
+  flags &= ~CLONE_SETTLS;
+#endif
+  int rc = __bionic_clone(flags, child_stack, &(thread->tid), thread->tls, &(thread->tid), __pthread_start, thread);
+  if (rc == -1) {
     int clone_errno = errno;
+    // We don't have to unlock the mutex at all because clone(2) failed so there's no child waiting to
+    // be unblocked, but we're about to unmap the memory the mutex is stored in, so this serves as a
+    // reminder that you can't rewrite this function to use a ScopedPthreadMutexLocker.
+    pthread_mutex_unlock(start_mutex);
     if ((thread->attr.flags & PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK) == 0) {
       munmap(thread->attr.stack_base, thread->attr.stack_size);
     }
@@ -209,14 +251,13 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
     return clone_errno;
   }
 
-  thread->tid = tid;
-
-  int init_errno = _init_thread(thread, true);
+  int init_errno = __init_thread(thread, true);
   if (init_errno != 0) {
-    // Mark the thread detached and let its __thread_entry run to
-    // completion. (It'll just exit immediately, cleaning up its resources.)
-    thread->internal_flags |= PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED;
+    // Mark the thread detached and replace its start_routine with a no-op.
+    // Letting the thread run is the easiest way to clean up its resources.
     thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED;
+    thread->start_routine = __do_nothing;
+    pthread_mutex_unlock(start_mutex);
     return init_errno;
   }
 
@@ -226,8 +267,9 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
     _thread_created_hook(thread->tid);
   }
 
-  // Publish the pthread_t and let the thread run.
-  *thread_out = (pthread_t) thread;
+  // Publish the pthread_t and unlock the mutex to let the new thread start running.
+  *thread_out = reinterpret_cast<pthread_t>(thread);
+  pthread_mutex_unlock(start_mutex);
 
   return 0;
 }
index cc86271091558aafee3693dddd87695db8d52ee0..c1140de9da236b9d749941aa0fc4bf3c39e7703b 100644 (file)
@@ -36,6 +36,7 @@
 
 extern "C" void _exit_with_stack_teardown(void*, size_t, int);
 extern "C" void __exit(int);
+extern "C" int __set_tid_address(int*);
 
 /* CAVEAT: our implementation of pthread_cleanup_push/pop doesn't support C++ exceptions
  *         and thread cancelation
@@ -57,8 +58,9 @@ void __pthread_cleanup_pop(__pthread_cleanup_t* c, int execute) {
   }
 }
 
-void pthread_exit(void* retval) {
+void pthread_exit(void* return_value) {
   pthread_internal_t* thread = __get_thread();
+  thread->return_value = return_value;
 
   // Call the cleanup handlers first.
   while (thread->cleanup_stack) {
@@ -90,10 +92,12 @@ void pthread_exit(void* retval) {
   size_t stack_size = thread->attr.stack_size;
   bool user_allocated_stack = ((thread->attr.flags & PTHREAD_ATTR_FLAG_USER_ALLOCATED_STACK) != 0);
 
-  // If the thread is detached, destroy the pthread_internal_t,
-  // otherwise keep it in memory and signal any joiners.
   pthread_mutex_lock(&gThreadListLock);
-  if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) {
+  if ((thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) != 0) {
+    // The thread is detached, so we can destroy the pthread_internal_t.
+    // First make sure that the thread does not try to clear the tid since
+    // it points into memory that will be freed.
+    __set_tid_address(NULL);
     _pthread_internal_remove_locked(thread);
   } else {
     // Make sure that the pthread_internal_t doesn't have stale pointers to a stack that
@@ -103,15 +107,8 @@ void pthread_exit(void* retval) {
       thread->attr.stack_size = 0;
       thread->tls = NULL;
     }
-
-    // Indicate that the thread has exited for joining threads.
-    thread->attr.flags |= PTHREAD_ATTR_FLAG_ZOMBIE;
-    thread->return_value = retval;
-
-    // Signal the joining thread if present.
-    if (thread->attr.flags & PTHREAD_ATTR_FLAG_JOINED) {
-      pthread_cond_signal(&thread->join_cond);
-    }
+    // pthread_join is responsible for destroying the pthread_internal_t for non-detached threads.
+    // The kernel will futex_wake on the pthread_internal_t::tid field to wake pthread_join.
   }
   pthread_mutex_unlock(&gThreadListLock);
 
@@ -131,6 +128,6 @@ void pthread_exit(void* retval) {
     _exit_with_stack_teardown(stack_base, stack_size, 0);
   }
 
-  /* NOTREACHED, but we told the compiler this function is noreturn, and it doesn't believe us. */
+  // NOTREACHED, but we told the compiler this function is noreturn, and it doesn't believe us.
   abort();
 }
index 8cca83aa970d343c618c2092fbbc1046d810305d..31ed07c2198d10f8a67b993b5b55f93505ac750f 100644 (file)
 #include <pthread.h>
 
 struct pthread_internal_t {
-    struct pthread_internal_t*  next;
-    struct pthread_internal_t*  prev;
-    pthread_attr_t              attr;
-    pid_t                       tid;
-    bool                        allocated_on_heap;
-    pthread_cond_t              join_cond;
-    void*                       return_value;
-    int                         internal_flags;
-    __pthread_cleanup_t*        cleanup_stack;
-    void**                      tls;         /* thread-local storage area */
-
-    void* alternate_signal_stack;
-
-    /*
-     * The dynamic linker implements dlerror(3), which makes it hard for us to implement this
-     * per-thread buffer by simply using malloc(3) and free(3).
-     */
+  struct pthread_internal_t* next;
+  struct pthread_internal_t* prev;
+
+  pid_t tid;
+
+  void** tls;
+
+  pthread_attr_t attr;
+
+  __pthread_cleanup_t* cleanup_stack;
+
+  void* (*start_routine)(void*);
+  void* start_routine_arg;
+  void* return_value;
+
+  void* alternate_signal_stack;
+
+  /*
+   * The dynamic linker implements dlerror(3), which makes it hard for us to implement this
+   * per-thread buffer by simply using malloc(3) and free(3).
+   */
 #define __BIONIC_DLERROR_BUFFER_SIZE 512
-    char dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
+  char dlerror_buffer[__BIONIC_DLERROR_BUFFER_SIZE];
 };
 
-__LIBC_HIDDEN__ int _init_thread(pthread_internal_t* thread, bool add_to_thread_list);
+__LIBC_HIDDEN__ int __init_thread(pthread_internal_t* thread, bool add_to_thread_list);
 __LIBC_HIDDEN__ void __init_tls(pthread_internal_t* thread);
+__LIBC_HIDDEN__ void __init_alternate_signal_stack(pthread_internal_t*);
 __LIBC_HIDDEN__ void _pthread_internal_add(pthread_internal_t* thread);
 __LIBC_HIDDEN__ pthread_internal_t* __get_thread(void);
 
@@ -69,10 +74,8 @@ __LIBC_HIDDEN__ void _pthread_internal_remove_locked(pthread_internal_t* thread)
 /* Has the thread been joined by another thread? */
 #define PTHREAD_ATTR_FLAG_JOINED 0x00000004
 
-/* Has the thread already exited but not been joined? */
-#define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000008
-
-#define PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED 1
+/* Is this the main thread? */
+#define PTHREAD_ATTR_FLAG_MAIN_THREAD 0x80000000
 
 /*
  * Traditionally we give threads a 1MiB stack. When we started
@@ -93,6 +96,5 @@ __LIBC_HIDDEN__ extern void __timer_table_start_stop(int);
 __LIBC_HIDDEN__ extern void __bionic_atfork_run_prepare();
 __LIBC_HIDDEN__ extern void __bionic_atfork_run_child();
 __LIBC_HIDDEN__ extern void __bionic_atfork_run_parent();
-__LIBC_HIDDEN__ extern int __pthread_settid(pthread_t, pid_t);
 
 #endif /* _PTHREAD_INTERNAL_H_ */
index 4b1f6efb9ee089d4161e93f0256c29e0c2eaa916..09c48dcd37224a76a9e13da10afef69232ff7de3 100644 (file)
@@ -48,7 +48,7 @@ void _pthread_internal_remove_locked(pthread_internal_t* thread) {
 
   // The main thread is not heap-allocated. See __libc_init_tls for the declaration,
   // and __libc_init_common for the point where it's added to the thread list.
-  if (thread->allocated_on_heap) {
+  if ((thread->attr.flags & PTHREAD_ATTR_FLAG_MAIN_THREAD) == 0) {
     free(thread);
   }
 }
@@ -73,14 +73,6 @@ pid_t __pthread_gettid(pthread_t t) {
   return reinterpret_cast<pthread_internal_t*>(t)->tid;
 }
 
-int __pthread_settid(pthread_t t, pid_t tid) {
-  if (t == 0) {
-    return EINVAL;
-  }
-  reinterpret_cast<pthread_internal_t*>(t)->tid = tid;
-  return 0;
-}
-
 // Initialize 'ts' with the difference between 'abstime' and the current time
 // according to 'clock'. Returns -1 if abstime already expired, or 0 otherwise.
 int __timespec_to_absolute(timespec* ts, const timespec* abstime, clockid_t clock) {
index 7e022c224574ad10954e26fd0c5330d42351736c..0cbed62bad51f3ada3f6bb5e047ad929c1e8f6db 100644 (file)
 
 #include <errno.h>
 
+#include "private/bionic_futex.h"
 #include "pthread_accessor.h"
 
-int pthread_join(pthread_t t, void** ret_val) {
+int pthread_join(pthread_t t, void** return_value) {
   if (t == pthread_self()) {
     return EDEADLK;
   }
 
-  pthread_accessor thread(t);
-  if (thread.get() == NULL) {
+  pid_t tid;
+  volatile int* tid_ptr;
+  {
+    pthread_accessor thread(t);
+    if (thread.get() == NULL) {
       return ESRCH;
-  }
+    }
 
-  if (thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) {
-    return EINVAL;
-  }
+    if ((thread->attr.flags & PTHREAD_ATTR_FLAG_DETACHED) != 0) {
+      return EINVAL;
+    }
+
+    if ((thread->attr.flags & PTHREAD_ATTR_FLAG_JOINED) != 0) {
+      return EINVAL;
+    }
 
-  if (thread->attr.flags & PTHREAD_ATTR_FLAG_JOINED) {
-    return EINVAL;
+    // Okay, looks like we can signal our intention to join.
+    thread->attr.flags |= PTHREAD_ATTR_FLAG_JOINED;
+    tid = thread->tid;
+    tid_ptr = &thread->tid;
   }
 
-  // Signal our intention to join, and wait for the thread to exit.
-  thread->attr.flags |= PTHREAD_ATTR_FLAG_JOINED;
-  while ((thread->attr.flags & PTHREAD_ATTR_FLAG_ZOMBIE) == 0) {
-    pthread_cond_wait(&thread->join_cond, &gThreadListLock);
+  // We set the PTHREAD_ATTR_FLAG_JOINED flag with the lock held,
+  // so no one is going to remove this thread except us.
+
+  // Wait for the thread to actually exit, if it hasn't already.
+  while (*tid_ptr != 0) {
+    __futex_wait(tid_ptr, tid, NULL);
   }
-  if (ret_val) {
-    *ret_val = thread->return_value;
+
+  // Take the lock again so we can pull the thread's return value
+  // and remove the thread from the list.
+  pthread_accessor thread(t);
+
+  if (return_value) {
+    *return_value = thread->return_value;
   }
 
   _pthread_internal_remove_locked(thread.get());
index 440a715e5656427c78c59e71ed84cdd6c55c8acd..6cc68affec1d8aeb8b720d3e44bb522ae1f11fe9 100644 (file)
@@ -215,10 +215,10 @@ int pthread_key_delete(pthread_key_t key) {
     // Skip zombie threads. They don't have a valid TLS area any more.
     // Similarly, it is possible to have t->tls == NULL for threads that
     // were just recently created through pthread_create() but whose
-    // startup trampoline (__thread_entry) hasn't been run yet by the
+    // startup trampoline (__pthread_start) hasn't been run yet by the
     // scheduler. t->tls will also be NULL after a thread's stack has been
     // unmapped but before the ongoing pthread_join() is finished.
-    if ((t->attr.flags & PTHREAD_ATTR_FLAG_ZOMBIE) || t->tls == NULL) {
+    if (t->tid == 0 || t->tls == NULL) {
       continue;
     }
 
index 7e43cd841a738eda69ab42259a3a17cfe51f91c0..1010f11d4cc09ba6f7042ad0ea7d9612b9b4cbaf 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "private/bionic_atomic_inline.h"
 #include "private/bionic_futex.h"
-#include "private/bionic_pthread.h"
 #include "private/bionic_tls.h"
 #include "private/thread_private.h"
 
index 3ea512c7551c4a4abace097dce30b6757cf7d0a7..62a7a3cc821d8a9e09e9126e031e039407c7e691 100644 (file)
@@ -207,13 +207,13 @@ void endprotoent(void);
 void endservent(void);
 void freehostent(struct hostent *);
 struct hostent *gethostbyaddr(const void *, socklen_t, int);
-struct hostent *android_gethostbyaddrforiface(const void *, socklen_t, int, const char*);
+struct hostent *android_gethostbyaddrforiface(const void *, socklen_t, int, const char*, int);
 int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent *gethostbyname(const char *);
 int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent *gethostbyname2(const char *, int);
 int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
-struct hostent *android_gethostbynameforiface(const char *, int, const char *);
+struct hostent *android_gethostbynameforiface(const char *, int, const char *, int);
 struct hostent *gethostent(void);
 int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
@@ -241,9 +241,9 @@ void sethostent(int);
 void setnetent(int);
 void setprotoent(int);
 int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **);
-int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, struct addrinfo **);
+int android_getaddrinfoforiface(const char *, const char *, const struct addrinfo *, const char *, int, struct addrinfo **);
 int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
-int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *);
+int android_getnameinfoforiface(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int, const char *, int);
 void freeaddrinfo(struct addrinfo *);
 const char     *gai_strerror(int);
 void setnetgrent(const char *);
index fe2c586356f2d4bdab9b97029d277790bd6ecca3..e326ddb1abe7599496e4cefb1b59adbf44aa03e9 100644 (file)
@@ -35,8 +35,8 @@
 #include <string.h>            /* For memset() */
 #include <sys/types.h>
 
-#if defined(__LP64__)
-/* For 64-bit, the kernel's struct sigaction doesn't match the POSIX one,
+#if defined(__LP64__) || defined(__mips__)
+/* For 64-bit (and mips), the kernel's struct sigaction doesn't match the POSIX one,
  * so we need to expose our own and translate behind the scenes. */
 #  define sigaction __kernel_sigaction
 #  include <linux/signal.h>
@@ -44,7 +44,7 @@
 #else
 /* For 32-bit, we're stuck with the definitions we already shipped,
  * even though they contain a sigset_t that's too small. */
-#  define __ARCH_SI_UID_T __kernel_uid32_t /* TODO: remove this when we switch to uapi. */
+#  define __ARCH_SI_UID_T __kernel_uid32_t /* TODO: 64-bit: remove this when we've switch 32-bit to uapi too. */
 #  include <linux/signal.h>
 #  undef __ARCH_SI_UID_T
 #endif
@@ -53,15 +53,12 @@ __BEGIN_DECLS
 
 typedef int sig_atomic_t;
 
-/* _NSIG is used by the SIGRTMAX definition under <asm/signal.h>, however
- * its definition is part of a #if __KERNEL__ .. #endif block in the original
- * kernel headers and is thus not part of our cleaned-up versions.
- *
- * Looking at the current kernel sources, it is defined as 64 for all
- * architectures except for the 'mips' one which set it to 128.
- */
+/* TODO: 64-bit: we should probably #undef the uapi NSIG and add a unit test that NSIG == _NSIG && NSIG >= 64. */
 #ifndef _NSIG
-#  define _NSIG  64
+#  define _NSIG 64
+#endif
+#ifndef NSIG
+#  define NSIG _NSIG
 #endif
 
 extern const char* const sys_siglist[];
@@ -70,7 +67,7 @@ extern const char* const sys_signame[];
 typedef __sighandler_t sig_t; /* BSD compatibility. */
 typedef __sighandler_t sighandler_t; /* glibc compatibility. */
 
-#if __LP64__
+#if defined(__LP64__)
 
 struct sigaction {
   unsigned int sa_flags;
@@ -82,6 +79,17 @@ struct sigaction {
   void (*sa_restorer)(void);
 };
 
+#elif defined(__mips__)
+
+struct sigaction {
+  unsigned int sa_flags;
+  union {
+    sighandler_t sa_handler;
+    void (*sa_sigaction) (int, struct siginfo*, void*);
+  };
+  sigset_t sa_mask;
+};
+
 #endif
 
 extern int sigaction(int, const struct sigaction*, struct sigaction*);
index 175c28b045f3c5ea20d9cd692903a291d7e7afec..c7f2ac7ac752a630691b3d4ac0da34b857814236 100644 (file)
 #endif
 #define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
 
-/* Android-added: for FreeBSD's libm. */
-#define __weak_reference(sym,alias) \
-    __asm__(".weak " #alias); \
-    __asm__(".equ "  #alias ", " #sym)
-#define __strong_reference(sym,aliassym) \
-    extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
-
 #endif /* !_SYS_CDEFS_H_ */
index 3683533a92df20b9e9fc7783cf0b970fea551cbe..0deb73a423d554058e33343fbd075c3d490a9efc 100644 (file)
 #define SYS_fcntl64 __NR_fcntl64
 #define SYS_fdatasync __NR_fdatasync
 #define SYS_fgetxattr __NR_fgetxattr
+#define SYS_finit_module __NR_finit_module
 #define SYS_flistxattr __NR_flistxattr
 #define SYS_flock __NR_flock
 #define SYS_fork __NR_fork
 #define SYS_ioprio_get __NR_ioprio_get
 #define SYS_ioprio_set __NR_ioprio_set
 #define SYS_ipc __NR_ipc
+#define SYS_kcmp __NR_kcmp
 #define SYS_kexec_load __NR_kexec_load
 #define SYS_keyctl __NR_keyctl
 #define SYS_kill __NR_kill
 #define SYS_fcntl64 __NR_fcntl64
 #define SYS_fdatasync __NR_fdatasync
 #define SYS_fgetxattr __NR_fgetxattr
+#define SYS_finit_module __NR_finit_module
 #define SYS_flistxattr __NR_flistxattr
 #define SYS_flock __NR_flock
 #define SYS_fork __NR_fork
 #define SYS_ioprio_get __NR_ioprio_get
 #define SYS_ioprio_set __NR_ioprio_set
 #define SYS_ipc __NR_ipc
+#define SYS_kcmp __NR_kcmp
 #define SYS_kexec_load __NR_kexec_load
 #define SYS_keyctl __NR_keyctl
 #define SYS_kill __NR_kill
 #define SYS_lstat __NR_lstat
 #define SYS_lstat64 __NR_lstat64
 #define SYS_madvise __NR_madvise
-#define SYS_madvise1 __NR_madvise1
 #define SYS_mbind __NR_mbind
 #define SYS_migrate_pages __NR_migrate_pages
 #define SYS_mincore __NR_mincore
 #define SYS_pread64 __NR_pread64
 #define SYS_preadv __NR_preadv
 #define SYS_prlimit64 __NR_prlimit64
+#define SYS_process_vm_readv __NR_process_vm_readv
+#define SYS_process_vm_writev __NR_process_vm_writev
 #define SYS_prof __NR_prof
 #define SYS_profil __NR_profil
 #define SYS_pselect6 __NR_pselect6
 #define SYS_fcntl __NR_fcntl
 #define SYS_fdatasync __NR_fdatasync
 #define SYS_fgetxattr __NR_fgetxattr
+#define SYS_finit_module __NR_finit_module
 #define SYS_flistxattr __NR_flistxattr
 #define SYS_flock __NR_flock
 #define SYS_fork __NR_fork
 #define SYS_iopl __NR_iopl
 #define SYS_ioprio_get __NR_ioprio_get
 #define SYS_ioprio_set __NR_ioprio_set
+#define SYS_kcmp __NR_kcmp
 #define SYS_kexec_load __NR_kexec_load
 #define SYS_keyctl __NR_keyctl
 #define SYS_kill __NR_kill
index df81139da416d30118442cad493e158e3cbea3e9..7d202f736f5c814db5c804e1c0c5580768b4bf63 100644 (file)
@@ -42,7 +42,6 @@ __BEGIN_DECLS
 #define RB_POWER_OFF    LINUX_REBOOT_CMD_POWER_OFF
 
 extern int reboot(int  reboot_type);
-extern int __reboot(int, int, int, void *);
 
 __END_DECLS
 
index 0651f1ca630a95f88c7d0db95956173da14aa862..1aa97b40c638508e8f8e037528502e7832adc479 100644 (file)
 #ifndef _SYS_TIMERFD_H_
 #define _SYS_TIMERFD_H_
 
+#include <fcntl.h> /* For O_CLOEXEC and O_NONBLOCK. */
 #include <time.h>
 #include <sys/types.h>
-#include <linux/timerfd.h>
 
 __BEGIN_DECLS
 
+#define TFD_TIMER_ABSTIME (1 << 0)
+#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+
+#define TFD_CLOEXEC O_CLOEXEC
+#define TFD_NONBLOCK O_NONBLOCK
+
 extern int timerfd_create(clockid_t, int);
 extern int timerfd_settime(int, int, const struct itimerspec*,
                            struct itimerspec*);
index bb4a9d4333cc22d58837e27fc7e36ceeb067932b..978393ce5cf9f882d26d7d4b5f2d6c7bb35be633 100644 (file)
@@ -55,6 +55,7 @@ typedef __kernel_dev_t       dev_t;
 typedef __kernel_fsblkcnt_t  fsblkcnt_t;
 typedef __kernel_fsfilcnt_t  fsfilcnt_t;
 typedef __kernel_gid32_t     gid_t;
+typedef __kernel_uid32_t     uid_t;
 typedef __kernel_id_t        id_t;
 typedef __kernel_ino_t       ino_t;
 typedef __kernel_key_t       key_t;
@@ -94,10 +95,10 @@ typedef  .... pthread_t;
 typedef __kernel_ssize_t ssize_t;
 #endif
 
-typedef __kernel_suseconds_t  suseconds_t;
-typedef __kernel_time_t       time_t;
-typedef __kernel_uid32_t        uid_t;
-typedef signed long           useconds_t;
+typedef __kernel_time_t time_t;
+
+typedef __kernel_suseconds_t suseconds_t;
+typedef unsigned int useconds_t;
 
 typedef __kernel_daddr_t       daddr_t;
 typedef __kernel_timer_t       timer_t;
diff --git a/libc/include/sys/user.h b/libc/include/sys/user.h
new file mode 100644 (file)
index 0000000..