Commit graph

3939 commits

Author SHA1 Message Date
Christopher Ferris
185ce72d00 Update to latest cortexa15 memcpy code.
This uses the new code original submitted as memcpy.a15.S as
the base. However, the old code handled unaligned src/dst better
so that was spliced in. I optimized the original unaligned code by
removing a few unnecessary instructions. I optimized the a15 code by
rewriting the pre and post code. I also modified the main loop to add
a pld so that larger copies would not stall waiting for memory.

Test cases for the new memcpy:

- Copy all sized values from 0 to 1024 bytes, using whatever alignment
  is returned by malloc.
For each alignment case described below, the test copied from 0 to 128
bytes.
- Src and dst pointers are both aligned to the same value, starting
  at one going through every power of two up to and including 128.
- Src aligned to double word boundary, dst aligned to word boundary.
- Src aligned to word boundary, dst aligned to double word boundary.
- Src aligned to 16 bit boundary, dst aligned to word boundary.
- Src aligned to word boundary, dst aligned to 16 byte boundary.
- Src aligned to word boundary, dst aligned to 1 byte from a word
  boundary.
- Src aligned to word boundary, dst aligned to 2 bytes from a word
  boundary.
- Src aligned to word boundary, dst aligned to 3 bytes from a word
  boundary.
- Src aligned to 1 byte from a word boundary, dst aligned to a word
  boundary.
- Src aligned to 2 bytes from a word boundary, dst aligned to a word
  boundary.
- Src aligned to 3 bytes from a word boundary, dst aligned to a word
  boundary.

Cases to verify the unaligned source code properly aligns to a 16 bit
boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  4 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  8 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  12 + 128 bit boundary.
- Src aligned to 1 byte from a 128 bit boundary, dst aligned to
  16 + 128 bit boundary.

In all cases, a two byte fencepost was placed at the end of the
destination to verify that only the requested number of bytes were copied.

Bug: 8005082

Merge from internal master.

(cherry-picked from commit 21ede92d79)

Change-Id: Ief70c9e6dc8c6473ae245b6570b2c266fed9618c
2013-04-08 18:13:35 -07:00
Elliott Hughes
240fb8623b Merge "Make abort messages available to debuggerd." 2013-04-05 18:25:21 +00:00
Elliott Hughes
0d787c1fa1 Make abort messages available to debuggerd.
This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
2013-04-05 11:24:19 -07:00
Elliott Hughes
014c75c78b Merge "Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a" 2013-04-03 18:11:30 +00:00
Kito Cheng
8baa929d5d Prevent name conflict for eventfd.cpp and eventfd.s when building libc.a
- eventfd.cpp and eventfd.s will output to the same file when building libc.a
   out/target/product/*/obj/STATIC_LIBRARIES/libc_intermediates/WHOLE/libc_common_objs/eventfd.o
 - And then `eventfd` will undefined when statically linked to libc.

Also add a unit test.

Change-Id: Ib310ade3256712ca617a90539e8eb07459c98505
2013-04-03 11:10:37 -07:00
Elliott Hughes
14c840df90 Merge "Fix the SYSCALLS.TXT documentation and remove a dead script." 2013-04-03 17:22:18 +00:00
Elliott Hughes
a51916b58b Fix the SYSCALLS.TXT documentation and remove a dead script.
We use the system call constants from the kernel header files now,
so there's no need to check that they've been correctly transcribed
into SYSCALLS.TXT.

This is a work in progress. I've added TODOs to SYSCALLS.TXT explaining
what's left to do.

Change-Id: I3b86acfe7f84b4da1c802ee5a4ef13a2e83e7939
2013-04-03 10:08:09 -07:00
Elliott Hughes
162b4411fc Merge "Stop using unreasonable numbers of map entries." 2013-04-03 00:48:07 +00:00
Elliott Hughes
4ace92c62a Stop using unreasonable numbers of map entries.
Bug: 8460659
Change-Id: Ib0ee71e3cf61e122d0449c9d8a4e4670a7d7129a
2013-04-02 17:41:14 -07:00
Elliott Hughes
7a29f404e1 Merge "Update getaddrinfo to RFC6724" 2013-04-02 01:05:23 +00:00
Lorenzo Colitti
378b0e1ea2 Update getaddrinfo to RFC6724
Currently, our getaddrinfo implementation does not conform to
any IETF standard. It follows draft-ietf-6man-rfc3484-revise-01,
but that draft has expired. Update the policy table to RFC6724.

(cherry-pick of e919b116d35aa7deb24ddece69c491e24c3b0d6f.)

Bug: 8276725
Change-Id: I2d17122defd966ac6c2c13d04887fb110f2598a0
2013-04-01 18:04:25 -07:00
Elliott Hughes
6bb17dfad3 Merge "Extra logging in pthread_create." 2013-03-29 23:47:24 +00:00
Elliott Hughes
cfa089df23 Extra logging in pthread_create.
pthread_create returns EAGAIN when it can't allocate a pthread_internal_t,
when it can't allocate a stack for the new thread, or when clone(2) fails
because there are too many threads. It's useful to be able to know why your
pthread_create just failed, so add some logging.

Bug: 8470684
Change-Id: I1bb4497d4f7528eacce0db35c2014771cba64569
2013-03-29 16:35:00 -07:00
Jean-Baptiste Queru
74b324ac09 Merge "Update processed linux/fs.h header file" 2013-03-28 15:49:04 +00:00
Ken Sumrall
ce636ca088 Update processed linux/fs.h header file
Need to get the defintion of the FITRIM ioctl().  Also need
to update the blk_types.h header file as fs.h includes it.

Change-Id: I617622b620925942dc5aead9e49f8e17d17e5d74
2013-03-27 16:05:22 -07:00
Elliott Hughes
bd014c2e42 Merge "Remove some dead script code and fix a script comment." 2013-03-25 21:20:22 +00:00
Elliott Hughes
e6ddfc55c8 Remove some dead script code and fix a script comment.
Change-Id: I91ca466d1b6f8a39da50ce61acebc268d0daab3a
2013-03-25 14:09:52 -07:00
Elliott Hughes
e51d75a9ac Merge "Clarify the dlmalloc USAGE_ERROR." 2013-03-25 20:54:14 +00:00
Elliott Hughes
65a8eb606f Clarify the dlmalloc USAGE_ERROR.
Bug: 8468088
Change-Id: I1ff6d51ec17fc74ef56229aa76d2986cbd662874
2013-03-25 13:48:41 -07:00
Elliott Hughes
48f25cef45 Merge "Stop generating <sys/linux-syscalls.h>." 2013-03-25 17:13:26 +00:00
Elliott Hughes
a40751185f Merge "Unhide __set_errno for backwards compatibility." 2013-03-25 17:12:19 +00:00
Elliott Hughes
3198850ea1 Unhide __set_errno for backwards compatibility.
This was in <errno.h>, and people called it :-(

Change-Id: I038490be77eb9372b3f31305ec580fa7b09c983e
2013-03-22 19:12:52 -07:00
Elliott Hughes
1b91c6c11f Stop generating <sys/linux-syscalls.h>.
The <asm/unistd.h> files contain the canonical data, and
<sys/glibc-syscalls.h> contain new glibc-compatible names,
and if you #include the standard <sys/syscall.h> you get
both sets of names.

Change-Id: I9919c080931c0ba1660f5e37c6a6265ea716d603
2013-03-22 18:56:24 -07:00
Elliott Hughes
c019345a3a Merge "Use the correct names for the __ARM_NR_* syscalls." 2013-03-22 21:50:49 +00:00
Elliott Hughes
cda62094ef Use the correct names for the __ARM_NR_* syscalls.
This lets us move all the ARM syscall stubs over to the kernel <asm/unistd.h>.
Our generated <sys/linux-syscalls.h> is now unused, but I'll remove that in a
later change.

Change-Id: Ie5ff2cc4abce1938576af7cbaef615a79c7f310d
2013-03-22 13:53:43 -07:00
Elliott Hughes
c37dd59956 Merge "Fix builds where _FORTIFY_SOURCE is off." 2013-03-22 18:01:50 +00:00
Elliott Hughes
890c8ed6ef Fix builds where _FORTIFY_SOURCE is off.
Also add a more intention-revealing guard so we don't have loads of
places checking whether our inlining macro is defined.

Change-Id: I168860cedcfc798b07a5145bc48a125700265e47
2013-03-22 10:58:55 -07:00
Elliott Hughes
34895c1bdf Merge "Replace unnecessary ARM uses of <sys/linux-syscalls.h> with <asm/unistd.h>." 2013-03-22 17:51:43 +00:00
Elliott Hughes
5c5f303e4c Merge "Replace unnecessary MIPS uses of <sys/linux-syscalls.h> with <asm/unistd.h>." 2013-03-22 16:30:56 +00:00
Elliott Hughes
e7cb795cb6 Merge "Replace unnecessary x86 uses of <sys/linux-syscalls.h> with <asm/unistd.h>." 2013-03-22 16:30:37 +00:00
Elliott Hughes
8794ece296 Replace unnecessary ARM uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
For some reason, socketcalls.c was only being compiled for ARM, where
it makes no sense. For x86 we generate stubs for the socket functions
that use __NR_socketcall directly.

Change-Id: I84181e6183fae2314ae3ed862276eba82ad21e8e
2013-03-21 23:07:11 -07:00
Elliott Hughes
56d161bb62 Replace unnecessary MIPS uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
Change-Id: I193a35f9790b82c83fd3b5672e24ac1b2034d0b0
2013-03-21 22:52:25 -07:00
Elliott Hughes
4cdde5f123 Replace unnecessary x86 uses of <sys/linux-syscalls.h> with <asm/unistd.h>.
Change-Id: I9d016ee8e8329cccf244d27c336d9524348af996
2013-03-21 22:48:18 -07:00
Elliott Hughes
3323628d63 Merge "The SYS_ constants should cover all __NR_ values." 2013-03-22 05:39:06 +00:00
Elliott Hughes
5c2772f59d The SYS_ constants should cover all __NR_ values.
<sys/linux-syscalls.h> only contains constants for the syscalls
we're generating stubs for. We want all the syscalls available
on the architecture in question.

Keep using <sys/linux-syscalls.h> on ARM for now because the
__NR_ARM_set_tls and __NR_ARM_cacheflush values aren't in <asm/unistd.h>.

Change-Id: I66683950d87d9b18d6107d0acc0ed238a4496f44
2013-03-21 22:26:20 -07:00
Elliott Hughes
babb72dc29 Merge "Fix pthread_setname_np's behavior on invalid pthread_ts." 2013-03-22 05:11:35 +00:00
Elliott Hughes
a41ba2f0bf Fix pthread_setname_np's behavior on invalid pthread_ts.
Change-Id: I0a154beaab4d164ac812f2564d12e4d79b80a8e8
2013-03-21 20:02:35 -07:00
Elliott Hughes
26c815c489 Merge "Drop magic number in strrchr and strchr" 2013-03-22 02:48:32 +00:00
Elliott Hughes
612333f671 Merge "Don't #define SYS_ constants unless they make sense for the current architecture." 2013-03-22 02:46:22 +00:00
Elliott Hughes
9724ce3a09 Don't #define SYS_ constants unless they make sense for the current architecture.
Fixes the MIPS and x86 builds. strace tests whether syscalls
are supported using #ifdef of the appropriate SYS_ constant.

Change-Id: I90be118dc42abfdaf5b0f9b1e676e8601f55106e
2013-03-21 19:44:36 -07:00
Elliott Hughes
4453c51c82 Merge "Drop unnecessary execution permission for .cpp/.c/.h" 2013-03-22 02:30:28 +00:00
Kito Cheng
8f7120bbac Drop unnecessary execution permission for .cpp/.c/.h
Change-Id: I9ac2b9d8f6bdb4fab8962210c5ec8f9c3e8c0ebf
2013-03-22 10:28:15 +08:00
Kito Cheng
a6cc67c9b5 Drop magic number in strrchr and strchr
Change-Id: Ic7391be8575eaaac76914dab62bc41c9773d703d
2013-03-22 10:18:09 +08:00
Elliott Hughes
800ad8249a Merge "Provide glibc-compatible SYS_* aliases for the __NR_* constants." 2013-03-22 01:41:57 +00:00
Elliott Hughes
8ecf225827 Provide glibc-compatible SYS_* aliases for the __NR_* constants.
This helps us remove another external/strace bionic hack.

Change-Id: I3e82c0d2fd27e479be98f096e05b666fd16f8eb3
2013-03-21 18:06:55 -07:00
Elliott Hughes
6eb978c9bf Merge "Expose wait4 as wait4 rather than __wait4." 2013-03-21 23:14:48 +00:00
Elliott Hughes
17a8b0db63 Expose wait4 as wait4 rather than __wait4.
This helps strace(1) compile with one fewer hack.

Change-Id: I5296d0cfec5546709cda990abd705ad33d7c4626
2013-03-21 16:14:06 -07:00
Christopher Ferris
86c3184972 Merge "Create arch specific versions of strcmp." 2013-03-20 22:14:48 +00:00
Christopher Ferris
31dea25b8b Create arch specific versions of strcmp.
This uses the new strcmp.a15.S code as the basis for new versions
of strcmp.S.

The cortex-a15 code is the performance optimized version of strcmp.a15.S
taken with only the addition of a few pld instructions.
The cortex-a9 code is the same as the cortex-a15 code except that the
unaligned strcmp code was taken from the original strcmp.S.
The krait code is the same as the cortex-a15 code except that one path
in the unaligned strcmp code was taken from the original strcmp.S code
(the 2 byte overlap case).
The generic code is the original unmodified strmp.S from the bionic
subdirectory.

All three new versions underwent these test cases:

Strings the same, all same size:
- Both pointers double word aligned.
- One pointer double word aligned, one pointer word aligned.
- Both pointers word aligned.
- One pointer double word aligned, one pointer 1 off a word alignment.
- One pointer double word aligned, one pointer 2 off a word alignment.
- One pointer double word aligned, one pointer 3 off a word alignment.
- One pointer word aligned, one pointer 1 off a word alignment.
- One pointer word aligned, one pointer 2 off a word alignment.
- One pointer word aligned, one pointer 3 off a word alignment.
For all cases where it made sense, the two pointers were also tested
swapped.

Different strings, all same size:
- Single difference at double word boundary.
- Single difference at word boudary.
- Single difference at 1 off a word alignment.
- Single difference at 2 off a word alignment.
- Single difference at 3 off a word alignment.

Different sized strings, strings the same until the end:
- Shorter string ends on a double word boundary.
- Shorter string ends on word boundary.
- Shorter string ends at 1 off a word boundary.
- Shorter string ends at 2 off a word boundary.
- Shorter string ends at 3 off a word boundary.

For all different cases, run them through the same pointer alignment
cases when the strings are the same size.
For all cases the two pointers were also tested swapped.

Bug: 8005082

Merge from internal master.

(cherry-picked from commit a9a5870d16)

Change-Id: I4c2b98f8a50804fb98ab67f75e9d660f1315a144
2013-03-20 14:33:54 -07:00
Elliott Hughes
adeec09629 Merge "Hide various symbols that shouldn't be exposed." 2013-03-15 23:52:09 +00:00