Commit graph

79 commits

Author SHA1 Message Date
Kenny Root
3a3c1853ac Use CLZ on ARMv5 and newer
Change-Id: Ia5aa6974c0343ae43fbcb91304501213048e9ec0
2011-02-16 16:40:08 -08:00
David 'Digit' Turner
95d751feac libc: Add ftruncate64 and improve 64-bit parameter syscall handling.
This patch improves the handling of 64-bit parameters in syscalls on ARM.
The ARM EABI mandates that 64-bit quantities be passed in even/odd register
pairs, which requires special treatment.

This allows us to simplify our implementations of pread() and pwrite()
and remove the C stubs for pread64() and pwrite64().

Also add ftruncate64() to <unistd.h>

Change-Id: I407e2fd223ba0093dd2d0b04c6152fadfc9ce3ef

Bug 3107933
2010-12-16 17:04:41 +01:00
David 'Digit' Turner
72e6fd4242 <sched.h>: Add sched_getcpu() and cpu_set_t
This adds the cpu_set_t type definition and related functions
and macros used to handle CPU thread affinity.

  sched_getcpu()
  sched_setaffinity()
  sched_getaffinity()

Change-Id: If382ecafde8926341a88478062b275553645065b
2010-12-06 13:42:54 +01:00
Jean-Baptiste Queru
9c8ea7fa3f am 24dc9363: resolved conflicts for merge of 1bc98ccb to gingerbread-plus-aosp
* commit '24dc936346b4a31005ac28c4bd464320cca9320a':
  bionic: Add ARM optimized strcpy()
2010-11-22 13:38:44 -08:00
Jean-Baptiste Queru
24dc936346 resolved conflicts for merge of 1bc98ccb to gingerbread-plus-aosp
Change-Id: Ief9ec3d0472660e26864e082e03c26e09a043b9d
2010-11-22 13:34:59 -08:00
Jim Huang
73c04b3269 bionic: Add ARM optimized strcpy()
Reference results of the experiments on Qualcomm MSM7x25 (524MHz):

[original C code]
             prc thr   usecs/call      samples   errors cnt/samp
size
strcpy_1k      1   1     14.56159           99        0     1000
1024

[ARM optimized code]
             prc thr   usecs/call      samples   errors cnt/samp
size
strcpy_1k      1   1      3.46653           99        0     1000
1024

The work was derived from ARM Ltd.

Change-Id: I906ac53bb7a7285e14693c77d3ce8d4ed6f98bfd
2010-11-22 13:01:32 -08:00
Jean-Baptiste Queru
482358fda7 am d29b8a51: am 5109146f: Merge "Reconcile assembly-only macros in <machine/cpu-features.h>"
Merge commit 'd29b8a51a5f95a3f38e5fb812231e12e5a66a865'

* commit 'd29b8a51a5f95a3f38e5fb812231e12e5a66a865':
  Reconcile assembly-only macros in <machine/cpu-features.h>
2010-10-21 09:54:30 -07:00
Jean-Baptiste Queru
d29b8a51a5 am 5109146f: Merge "Reconcile assembly-only macros in <machine/cpu-features.h>"
Merge commit '5109146f954d8cca39d34689bff2762e15bc6933' into gingerbread-plus-aosp

* commit '5109146f954d8cca39d34689bff2762e15bc6933':
  Reconcile assembly-only macros in <machine/cpu-features.h>
2010-10-19 15:21:57 -07:00
Ying Wang
76a34d6628 Remove duplicate item
This elimates the makefile warning at the beginning of each build:
libc_common_intermediates/arch-arm/syscalls/eventfd.o' given more than once in the same rule.

Change-Id: I25cc0c373d55b5036dd17811a595c097fd6ca69a
2010-10-08 17:09:55 -07:00
Jim Huang
94e5c5ef37 Reconcile assembly-only macros in <machine/cpu-features.h>
The change explicitly isolates the assembly-only macros in header
<machine/cpu-features.h> in order to prevent mis-inclusion in C/C++
source files.

Change-Id: I0258e87c5ac3fd24944fb227290ac3b9cac4bfba
2010-10-01 17:00:46 +08:00
repo sync
686af0b3a5 resolved conflicts for merge of defd1622 to gingerbread-plus-aosp
Conflicts:
	libc/arch-arm/syscalls/eventfd.S
	libc/include/sys/eventfd.h
	libc/include/sys/linux-syscalls.h

Change-Id: I02f6e9536aa5478322240c199ff4c2f4367922d0
2010-09-28 12:23:55 +02:00
David 'Digit' Turner
a511f24561 am 9973a564: libc: Add missing waitid() implementation.
Merge commit '9973a564222b842eb7497fd6e659fe8c8c49e2b3' into gingerbread-plus-aosp

* commit '9973a564222b842eb7497fd6e659fe8c8c49e2b3':
  libc: Add missing waitid() implementation.
2010-09-28 00:22:25 -07:00
David 'Digit' Turner
defd162212 libc: add <sys/eventfd.h> and corresponding implementations.
Change-Id: Ide040884c456190226e580513099fdb8377e015b
2010-09-28 09:20:37 +02:00
David 'Digit' Turner
052fbd8808 am a3ae60d3: libc: Add missing fdatasync() implementation
Merge commit 'a3ae60d343661784e3f6f4566b276d8e6b8a06a7' into gingerbread-plus-aosp

* commit 'a3ae60d343661784e3f6f4566b276d8e6b8a06a7':
  libc: Add missing fdatasync() implementation
2010-09-28 00:19:31 -07:00
David 'Digit' Turner
9973a56422 libc: Add missing waitid() implementation.
Change-Id: I312ee608dbf9249e4886a10d45d13e3cda8a9042
2010-09-28 09:18:26 +02:00
David 'Digit' Turner
a3ae60d343 libc: Add missing fdatasync() implementation
Change-Id: I04bb655d77e414021e1f2a973329167ad76ca1c4
2010-09-28 09:17:17 +02:00
David 'Digit' Turner
914528cdc9 am 223ddfcf: Merge "libc: Add missing pipe2() declaration and implementation." into gingerbread
Merge commit '223ddfcfc4cb354641e70da31a60556248db5036' into gingerbread-plus-aosp

* commit '223ddfcfc4cb354641e70da31a60556248db5036':
  libc: Add missing pipe2() declaration and implementation.
2010-09-28 00:13:48 -07:00
David 'Digit' Turner
9aac38249b am bd8d987b: libc: remove C++ comments from public headers.
Merge commit 'bd8d987b3c3aa6d9d00cede2cb091f00bdb42204' into gingerbread-plus-aosp

* commit 'bd8d987b3c3aa6d9d00cede2cb091f00bdb42204':
  libc: remove C++ comments from public headers.
2010-09-28 00:13:43 -07:00
David 'Digit' Turner
223ddfcfc4 Merge "libc: Add missing pipe2() declaration and implementation." into gingerbread 2010-09-28 00:12:08 -07:00
Elliott Hughes
8120a8df84 am 3cf53d1a: Fixes for the ARM-specific bswap_16, bswap_32, and bswap_64.
Merge commit '3cf53d1a7814e1520df09d24b009c16f4f27db0d' into gingerbread-plus-aosp

* commit '3cf53d1a7814e1520df09d24b009c16f4f27db0d':
  Fixes for the ARM-specific bswap_16, bswap_32, and bswap_64.
2010-09-27 11:39:39 -07:00
David 'Digit' Turner
bd8d987b3c libc: remove C++ comments from public headers.
Change-Id: I4af84f912062cd2ff34711c25122fb323f20c032
2010-09-27 17:35:26 +02:00
David 'Digit' Turner
275cd48511 libc: Add missing pipe2() declaration and implementation.
Change-Id: Iacb914bd6ac5adc60c5671e6fef680ede21f9b0c
2010-09-27 17:33:08 +02:00
Elliott Hughes
3cf53d1a78 Fixes for the ARM-specific bswap_16, bswap_32, and bswap_64.
1. Make the feature test work by excluding known-deficient processors, so
we don't have to maintain a complete list of all the processors that support
REV and REV16.

2. Don't abuse 'register' to get an effect similar to GCC's +l constraint,
but which was unnecessarily restrictive.

3. Fix __swap64md so _x isn't clobbered, breaking 64-bit swaps.

4. Make <byteswap.h> (which declars bswap_16 and friends) use <endian.h>
rather than <sys/endian.h>, so we get the machine-dependent implementations.

Change-Id: I6a38fad7a9fbe394aff141489617eb3883e1e944
2010-09-26 11:26:53 -07:00
Jean-Baptiste Queru
ef3644d110 am 312be567: Merge "Use ARMv6 instruction for handling byte order"
Merge commit '312be567a03aaf851707a268807ee666b12f8c74' into gingerbread-plus-aosp

* commit '312be567a03aaf851707a268807ee666b12f8c74':
  Use ARMv6 instruction for handling byte order
2010-09-10 16:37:38 -07:00
Jean-Baptiste Queru
312be567a0 Merge "Use ARMv6 instruction for handling byte order" 2010-09-10 16:02:59 -07:00
Keith Deacon
d7b156d2a3 am 3a1bbee3: Add eventfd system call support
Merge commit '3a1bbee36b773862e88c6f1895b607c0cd81b499' into gingerbread-plus-aosp

* commit '3a1bbee36b773862e88c6f1895b607c0cd81b499':
  Add eventfd system call support
2010-09-08 03:06:26 -07:00
Keith Deacon
3a1bbee36b Add eventfd system call support 2010-08-31 16:16:01 -05:00
Jim Huang
aa35095517 Use ARMv6 instruction for handling byte order
ARMv6 ISA has several instructions to handle data in different byte order.
For endian conversion (byte swapping) of single data words, it might be a
good idea to use the REV/REV16 instruction simply.

Change-Id: Ic4a5ed6254e082763e54aa70d428f59a0088636e
2010-08-31 14:51:44 +08:00
Jim Huang
a172709259 bionic: Rename _ARM_HAVE_LDREX_STREX to __ARM_HAVE_LDREX_STREX for consistency
The patch follows the naming manner in existing macros with prefix
__ARM_HAVE.

Change-Id: I6763ce2bf3ee85fd1da112c719543061d8d19bf4
2010-08-09 05:35:11 +08:00
Dima Zavin
18c5bcc66a Revert "Set SA_RESTORER in sigaction()"
This reverts commit e4fa46e75c.
2010-07-29 19:12:04 -07:00
David 'Digit' Turner
ab8b54101e libc: fix fstatfs() implementation.
The syscall expects the size of the buffer as the second argument.

Change-Id: I99ede2fec7fcd385ca03ff022c2cffa4297bea8d
2010-07-08 16:52:27 -07:00
David 'Digit' Turner
3b43f87d29 Allow dlclose() to properly call static C++ destructors.
With this patch _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
(before that, all shared libraries used the __dso_handle
global variable from the C library).

Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
breaking the build until the next patch to build/core/combo/
appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

NOTE: The NDK will need to be modified to enable this feature in
         the shared libraries that are generated through it.

Change-Id: I99cd801375bbaef0581175893d1aa0943211b9bc
2010-07-01 23:09:28 -07:00
David 'Digit' Turner
6a9b888d7c Allow static C++ destructors to be properly called on dlclose().
With this patch, _and_ an upcoming build/ patch, the destruction
of static C++ objects contained in shared libraries will happen
properly when dlclose() is called.

Note that this change introduces crtbegin_so.S and crtend_so.S which
are currently ignored by the build system.

+ move definition of __dso_handle to the right place
  (before that, all shared libraries used the __dso_handle
   global variable from the C library).

  Note that we keep a 'weak' __dso_handle in aeabi.c to avoid
  breaking the build until the next patch to build/core/combo/
  appears. We will be able to remove that later.

+ move bionic/aeabi.c to arch-arm/bionic/ (its proper location)

Change-Id: Ie771aa204e3acbdf02fd30ebd4150373a1398f39
NOTE: The NDK will need to be modified to enable this feature in
      the shared libraries that are generated through it.
2010-06-18 16:07:10 -07:00
David 'Digit' Turner
b8e6c50cfa Fix setjmp()/longjmp() to save FP registers on ARMv7. - DO NOT MERGE
Change-Id: I3a0c2c05e295ac05ed51a531dabda668be204ca0
2010-06-09 13:18:29 -07:00
David 'Digit' Turner
aa4b1d0429 Add missing sysinfo() implementation (already declared in <sys/sysinfo.h>) - DO NOT MERGE
Change-Id: Iac4eb5911ffe4a7ab72b84df44e907685ac816af
2010-06-09 13:12:15 -07:00
Andy McFadden
fcd00ebbdf Atomic/SMP update, part 3.
Update ARM atomic ops to use LDREX/STREX.  Stripped out #if 0 chunk.

Insert explicit memory barriers in pthread and semaphore code.

For bug 2721865.

Change-Id: I0f153b797753a655702d8be41679273d1d5d6ae7
2010-05-28 16:12:01 -07:00
Andy McFadden
4fdbadde92 Atomic/SMP update.
Added an underscore to _ARM_HAVE_LDREX_STREX to make it match the others.

Added __ARM_HAVE_DMB and __ARM_HAVE_LDREXD when appropriate.

Fixed some typos.

Change-Id: I2f55febcff4aeb7de572a514fb2cd2f820dca27c
2010-05-20 15:59:32 -07:00
The Android Open Source Project
4aef0ae660 merge from open-source master
Change-Id: I2be62bce462ee53fe9519f433523bd7a44a73d40
2010-05-13 14:31:02 -07:00
Matt Fischer
e4fa46e75c Set SA_RESTORER in sigaction()
GDB looks for specific opcode sequences when trying to recognize a stack
frame as a signal trampoline.  The sequences it looks for happen to be those
created when SA_RESTORER is set, since glibc always sets a restorer.  This
patch does the same here, so that the trampolines can be correctly identified.

Change-Id: I0ac574a68818cb24d939c3527f3aaeb04b853d04
2010-05-12 14:18:36 -05:00
David 'Digit' Turner
88f06cd84a Use private futexes for pthread_mutex_t.
This does not change the implementation of conditional variables
since we're waiting for other system components to properly use
pthread_condattr_init/setpshared before that.

Also remove an obsolete x86 source file.

Change-Id: Ia3e3fbac35b87a534fb04d4381c3c66b975bc8f7
2010-03-18 17:13:41 -07:00
Fabrice Di Meglio
8641833b62 Revert "bionic: pthread: use private futexes by default for mutexes and condvars"
This reverts commit ba9c6f0989.
2010-03-11 14:47:47 -08:00
David 'Digit' Turner
ba9c6f0989 bionic: pthread: use private futexes by default for mutexes and condvars
Private futexes are a recent kernel addition: faster futexes that cannot be
shared between processes. This patch uses them by default, unless the PROCESS_SHARED
attribute flag is used when creating a mutex and/or conditional variable.

Also introduces pthread_condattr_init/destroy/setpshared/getpshared.

Change-Id: I3a0e2116f467072b046524cb5babc00e41057a53
2010-03-11 11:48:38 -08:00
Colin Cross
ecede40222 Only use NEON memcpy if __ARM_NEON__ is defined
Change-Id: I32e6b9385d46efeec15dee8e395a82eef24ba3ea
2010-03-09 16:23:51 -08:00
Mike Chan
9f6915631b bonic: libc: cpuacct support for setuid functions
Any of the setuid functions now updates /acct/uid/ with its own tid
before changing users. This is so we can properly account for cpu time
per uid.

Change-Id: I34186cf4d5228cac8439e582a9e26c01ef3011e4
Signed-off-by: Mike Chan <mike@android.com>
2010-03-02 18:18:04 -08:00
Andrei Popescu
eb9d5ed347 add sigaltstack syscall 2010-03-02 11:43:24 +00:00
San Mehat
75c5e25ae3 bionic: syscalls: Add ioprio_set/ioprio_get syscall wrappers
Signed-off-by: San Mehat <san@google.com>
2010-02-23 15:55:29 -08:00
David 'Digit' Turner
97cf7f3394 Implement clone() C library function properly.
Only provide an implementation for ARM at the moment, since
it requires specific assembly fragments (the standard syscall
stubs cannot be used because the child returns in a different
stack).
2010-01-25 11:18:30 -08:00
Doug Kwan
d548a265ca Add missing symbol type directives. 2009-12-03 16:26:04 -08:00
Mathias Agopian
ecac54db21 am 3ba822cc: am 199f9d92: Improve memcpy performance from 290 MiB/s to 340 MiB/s (17% improvment)
Merge commit '3ba822cc3f0a252db73cf63cb8390e46fc0ceb0a' into eclair-mr2-plus-aosp

* commit '3ba822cc3f0a252db73cf63cb8390e46fc0ceb0a':
  Improve memcpy performance from 290 MiB/s to 340 MiB/s (17% improvment)
2009-10-29 19:53:39 -07:00
Mathias Agopian
47c5e30b61 am 199f9d92: Improve memcpy performance from 290 MiB/s to 340 MiB/s (17% improvment)
Merge commit '199f9d923804d74e021dd80e48ec75c0a96dba77' into eclair-plus-aosp

* commit '199f9d923804d74e021dd80e48ec75c0a96dba77':
  Improve memcpy performance from 290 MiB/s to 340 MiB/s (17% improvment)
2009-10-29 02:44:15 -07:00