Compare commits

..

443 Commits

Author SHA1 Message Date
The Android Automerger
77093f2a8b merge in jb-release history after reset to jb-dev 2012-06-20 06:59:21 -07:00
Andy McFadden
4d0128f13a Merge "Minor tweak to get memory around corrupted heap chunks dumped." into jb-dev 2012-06-19 11:28:15 -07:00
Ben Cheng
ec2ab73b87 Minor tweak to get memory around corrupted heap chunks dumped.
Change-Id: I8f72c5c7e23960b13fc53e2354cd74aca8aac3c0
2012-06-19 07:11:38 -07:00
The Android Automerger
ff7eae7b08 merge in jb-release history after reset to jb-dev 2012-06-11 06:59:25 -07:00
Jeff Brown
b7630f018a Use new debuggerd protocol.
Bug: 6615693
Change-Id: Ibfddc0de3fa2a882f7d0238ab797e5b29296b54b
2012-06-06 18:37:48 -07:00
The Android Automerger
db2e7a4cb6 merge in jb-release history after reset to jb-dev 2012-06-03 05:59:30 -07:00
Iliyan Malchev
e1dd3c287b bionic: import heaptracker as chk_malloc
This patch is a rewrite of libc.debug.malloc = 10 (chk_malloc).  It provides
the same features as the original (poison freed memory, detect heap overruns
and underruns), except that it provides more debugging information whenever it
detects a problem.

In addition to the original features, the new chk_malloc() implementation
detects multiple frees within a given range of the last N allocations, N being
configurable via the system property libc.debug.malloc.backlog.

Finally, this patch keeps track of all outstanding memory allocations.  On
program exit, we walk that list and report each outstanding allocation.

(There is support (not enabled) for a scanner thread periodically walks over
the list of outstanding allocations as well as the backlog of recently-freed
allocations, checking for heap-usage errors.)

Feature overview:

  1) memory leaks
  2) multiple frees
  3) use after free
  4) overrun

Implementation:

-- for each allocation, there is a:
  1) stack trace at the time the allocation is made
  2) if the memory is freed, there is also a stack trace at the point
  3) a front and rear guard (fence)
  4) the stack traces are kept together with the allocation

-- the following lists and maintained

  1) all outstanding memory allocations
  3) a backlog of allocations what are freed; when you call free(), instead of
     actually freed, the allocation is moved to this backlog;
  4) when the backlog of allocations gets full, the oldest entry gets evicted
     from it; at that point, the allocation is checked for overruns or
     use-after-free errors, and then actually freed.
  5) when the program exits, the list of outstanding allocations and the
     backlog are inspected for errors, then freed;

To use this, set the following system properties before running the process or
processes you want to inspect:

libc.malloc.debug.backlog # defaults to 100
libc.malloc.debug 10

When a problem is detected, you will see the following on logcat for a multiple
free:

E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 BYTES MULTIPLY FREED!
E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 ALLOCATED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 4009647c  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 FIRST FREED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 40096490  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 NOW BEING FREED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c6ac  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 400964a0  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so

The following for a heap overrun and underrun:

E/libc    ( 7233): +++ REAR GUARD MISMATCH [10, 11)
E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 HAS A CORRUPTED REAR GUARD
E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 ALLOCATED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 40096438  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 FREED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 40096462  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 HAS A CORRUPTED FRONT GUARD
E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 ALLOCATED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 400964ba  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 FREED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 400964e4  /system/bin/malloctest
E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so

The following for a memory leak:

E/libc    ( 7233): +++ THERE ARE 1 LEAKED ALLOCATIONS
E/libc    ( 7233): +++ DELETING 4096 BYTES OF LEAKED MEMORY AT 0x404b95e8 (1 REMAINING)
E/libc    ( 7233): +++ ALLOCATION 0x404b95e8 SIZE 4096 ALLOCATED HERE:
E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
E/libc    ( 7233):      #03  pc 0001bc94  /system/lib/libc.so
E/libc    ( 7233):      #04  pc 0001edf6  /system/lib/libc.so
E/libc    ( 7233):      #05  pc 0001b80a  /system/lib/libc.so
E/libc    ( 7233):      #06  pc 0001c086  /system/lib/libc.so
E/libc    ( 7233):      #07  pc 40096402  /system/bin/malloctest
E/libc    ( 7233):      #08  pc 00016f24  /system/lib/libc.so

Change-Id: Ic440e9d05a01e2ea86b25e8998714e88bc2d16e0
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-06-01 15:54:34 -07:00
The Android Automerger
e1d591540e merge in jb-release history after reset to jb-dev 2012-05-31 06:59:25 -07:00
Iliyan Malchev
7d2e24eb16 bionic: introduce libc.debug.malloc.program
libc.debug.malloc.program  provides an additional level of control over which
processes to enable libc.debug.malloc functionality for.  The string value of
libc.debug.malloc.program is matched against the program name; if the value of
libc.debug.malloc.program is a substring of the program name, then malloc debug
is applied to that program at whatever level libc.debug.malloc specifies.

If lib.debug.malloc.program is not specified, then libc.debug.malloc has the
same effect as before.

For example, to enable libc.deubug.malloc = 10 only to the mediaserver, do the
following:

   adb root # necessary for setprop
   adb setprop libc.debug.malloc.program mediaserver
   adb setprop libc.debug.malloc 10
   adb kill -9 $(pid mediaserver)

Change-Id: I6f01c12f033c8e2e015d73025369d7f1685ba200
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-05-30 20:03:47 -07:00
Geremy Condra
03539a36b6 Merge "Ensure that the port number and TXID are properly randomized." into jb-dev 2012-05-30 11:06:54 -07:00
Ben Cheng
2481468f22 Print the corrupted address passed to free().
For example:

@@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0x5c3bfbd0
Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2942

The addr=0x5c3bfbd0 part is new.

Change-Id: I8670144b2b0a3a6182384150d762c97dfee5452f
2012-05-25 11:14:20 -07:00
Ben Cheng
c84ff11dad Print the corrupted address passed to free().
For example:

@@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0x5c3bfbd0
Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2942

The addr=0x5c3bfbd0 part is new.

Change-Id: I8670144b2b0a3a6182384150d762c97dfee5452f
2012-05-24 17:06:43 -07:00
Geremy Condra
b23f193dcc Ensure that the port number and TXID are properly randomized.
This fix reads from /dev/urandom to get the required entropy.

Bug: 6535492
Change-Id: Ibc2fec3f71a67607b608ad9b767b0b6504993c1d
2012-05-24 15:26:12 -07:00
The Android Automerger
4dc3a7e1ed merge in jb-release history after reset to jb-dev 2012-05-10 06:59:27 -07:00
Prajakta Gudadhe
08e72d0161 bionic: add support for non-NEON memcpy() on NEON SoCs
Some SoCs that support NEON nevertheless perform better with a non-NEON than a
NEON memcpy().  This patch adds build variable ARCH_ARM_USE_NON_NEON_MEMCPY,
which can be set in BoardConfig.mk.  When ARCH_ARM_USE_NON_NEON_MEMCPY is
defined, we compile in the non-NEON optimized memcpy() even if the SoC supports
NEON.

Change-Id: Ia0e5bee6bad5880ffc5ff8f34a1382d567546cf9
2012-05-09 13:34:31 -07:00
The Android Automerger
e2390bff2e merge in jb-release history after reset to jb-dev 2012-05-09 07:46:07 -07:00
Ben Cheng
08b51e2c09 Implement the "abort" stub in assembly for ARM.
So that we can always get the full stack trace regardless of gcc's handling
of the "noreturn" attribute associated with abort().

[cherry-picked from master]

BUG:6455193
Change-Id: I0102355f5bf20e636d3feab9d1424495f38e39e2
2012-05-08 14:39:35 -07:00
The Android Automerger
e0f1fca46c merge in jb-release history after reset to jb-dev 2012-04-30 06:59:25 -07:00
Mike Lockwood
efcf8893a9 Merge "Update f_accessory.h kernel header" into jb-dev 2012-04-26 13:10:25 -07:00
Nick Kralevich
b091dd9bf2 libc: continue to use Android's custom linker script
By default, Android no longer compiles code using it's custom
linker script /build/core/armelf.xsc. However, this causes
problems for libc. Certain programs linked using older versions
of GOLD expect libc.so to export __exidx_start and __exidx_end.
Removing the custom linker script causes libc.so not to export
those symbols.

For now, continue using the old linker script, until we can
figure out a better solution.

Change-Id: Iaf002afd63a58b848818da24e5a4525620dc4d74
2012-04-26 11:04:44 -07:00
Mike Lockwood
ed87404c44 Update f_accessory.h kernel header
Change-Id: I29ec4aa4843b9308cbfa412df88e026e8475b715
Signed-off-by: Mike Lockwood <lockwood@google.com>
2012-04-25 09:57:32 -07:00
The Android Automerger
22d80c0b35 merge in jb-release history after reset to jb-dev 2012-04-25 07:47:06 -07:00
Nick Kralevich
94179a509e linker: remove STB_LOCAL hack
The ARM static linker wasn't properly handling __exidx_start
and __exidx_end symbols. Now that the static linker has been fixed,
we don't need the dynamic linker to work around this problem.

Change-Id: I041b94903609fafab33663a7d441a5e70b7ffcdd
2012-04-23 16:50:34 -07:00
The Android Automerger
5fb8130be9 merge in jb-release history after reset to master 2012-04-19 06:59:25 -07:00
Erik Gilling
baeacba04d add linux/sw_sync.h
Change-Id: I79de18d04b950c21b985d5ebc01cd3306a43d318
Signed-off-by: Erik Gilling <konkers@android.com>
2012-04-18 15:37:01 -07:00
Erik Gilling
6b99103c31 add linux/sync.h
Change-Id: I38bb9498e18cb2b2e84a97487d4ad1e15fabd9d4
Signed-off-by: Erik Gilling <konkers@android.com>
2012-04-18 14:23:04 -07:00
The Android Automerger
91b76aa298 merge in jb-release history after reset to master 2012-04-18 06:59:34 -07:00
Evgeniy Stepanov
4a9d6e50bb Fix segv when unwinding stack past __libc_init.
This change mirrors cd15bac for statically-linked binaries.

Change-Id: Id870832a50b37f0ef3e79e1ed03ed31390bfc9ef
2012-04-18 12:59:38 +04:00
The Android Automerger
bfb300152c merge in jb-release history after reset to master 2012-04-17 06:59:17 -07:00
Elliott Hughes
762a4fe2ee resolved conflicts for merge of 35d592cc to master
Change-Id: I8184302daf61814d26c837f9920b4e68d96d7f65
2012-04-16 14:40:26 -07:00
Elliott Hughes
f848321c4f resolved conflicts for merge of ef987656 to master
Change-Id: I3854de8f4cddaf344444efa6f9da027642a237d9
2012-04-16 14:26:43 -07:00
Elliott Hughes
8ecb4770a0 resolved conflicts for merge of 6b8fd054 to master
Change-Id: Ifc5a10d9c2f7764ad80d64cc552aad81d5fbf5eb
2012-04-16 14:16:42 -07:00
Elliott Hughes
8266cf94d3 am ff219e57: am 6435d27f: Merge "bionic: fix NULL parameter failure in getcwd()"
* commit 'ff219e57c0ffe5ac2816f79677ce4f1afa677277':
  bionic: fix NULL parameter failure in getcwd()
2012-04-16 13:15:13 -07:00
Elliott Hughes
35d592cc5a am 418e647a: Merge "libstdc++: Fix x86 thread-safe one-time-construction implementation."
* commit '418e647a8300bb8e62b6b73814a5211152cbaacd':
  libstdc++: Fix x86 thread-safe one-time-construction implementation.
2012-04-16 13:12:47 -07:00
Elliott Hughes
ef9876569a am 4994deae: Merge "Bionic: Fix wrong prototype of system call clock_nanosleep"
* commit '4994deaef51d5fa1ac12e6160b47d9cbe3b2bc43':
  Bionic: Fix wrong prototype of system call clock_nanosleep
2012-04-16 13:12:46 -07:00
Elliott Hughes
6b8fd05414 am 7b8666e6: Merge "bionic: Fix wrong prototype of system call getresuid/getresgid"
* commit '7b8666e683e56549091b86fd7b9c421fd0124dbc':
  bionic: Fix wrong prototype of system call getresuid/getresgid
2012-04-16 13:12:46 -07:00
Elliott Hughes
ff219e57c0 am 6435d27f: Merge "bionic: fix NULL parameter failure in getcwd()"
* commit '6435d27f9d45d01fbd15bcc3dcd9617b86b825bb':
  bionic: fix NULL parameter failure in getcwd()
2012-04-16 13:12:45 -07:00
Elliott Hughes
418e647a83 Merge "libstdc++: Fix x86 thread-safe one-time-construction implementation." 2012-04-16 09:13:13 -07:00
Elliott Hughes
4994deaef5 Merge "Bionic: Fix wrong prototype of system call clock_nanosleep" 2012-04-16 09:09:05 -07:00
Elliott Hughes
7b8666e683 Merge "bionic: Fix wrong prototype of system call getresuid/getresgid" 2012-04-16 09:06:22 -07:00
Jack Ren
d515ce465b Bionic: Fix wrong prototype of system call clock_nanosleep
In bionic/libc/SYSCALLS.TXT, the prototype of system call
clock_nanosleep is incorrect.

According to man page:
int clock_nanosleep(clockid_t clock_id, int flags,
                    const struct timespec *request,
                    struct timespec *remain);

Change-Id: Ic44c6db3d632293aa17998035554eacd664c2d57
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-16 23:53:05 +08:00
Elliott Hughes
6435d27f9d Merge "bionic: fix NULL parameter failure in getcwd()" 2012-04-16 08:48:19 -07:00
Jack Ren
41070dd15f bionic: Fix wrong prototype of system call getresuid/getresgid
In bionic/libc/SYSCALLS.TXT, the prototypes of system call
getresuid/getresgid are incorrect.

According to man page, they should be:
    int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
    int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);

Change-Id: I676098868bb05a9e1fe45419b234cf397626fdad
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-16 23:45:36 +08:00
Jack Ren
e5bf068147 bionic: fix NULL parameter failure in getcwd()
LTP: getcwd01 failed in LTP

Need to check getcwd parameters, otherwise it will lead to
posix test case to fail.

Change-Id: Ieb673b6dd4ca6481da81c5339dbf7ec0a463f263
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-16 23:35:05 +08:00
The Android Automerger
b5e8d57664 merge in jb-release history after reset to master 2012-04-16 06:59:27 -07:00
Fengwei Yin
ee18fb4aac libstdc++: Fix x86 thread-safe one-time-construction implementation.
The root of the problem is that the existing implementation is based on the
ARM C++ ABI, which mandates a different guard variable layout than the
Itanium/x86 C++ one.

This patch modifies the implementation in a way that satisfies both ABIs (and
doesn't require changing the toolchains).

Change-Id: I885e9adc7f088b9c0a78355bd752f1e6aeec9f07
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-16 14:20:30 +08:00
Elliott Hughes
307d1c982d am cebc8fb0: am 6bc18fa5: Merge "libm: fix invalid result of function remquo/remquof"
* commit 'cebc8fb0862a8e1ecd86f9d09b0a3fca0f0781fa':
  libm: fix invalid result of function remquo/remquof
2012-04-13 17:10:06 -07:00
Elliott Hughes
cebc8fb086 am 6bc18fa5: Merge "libm: fix invalid result of function remquo/remquof"
* commit '6bc18fa58849a4307cf6ddcfd526d9258e8175fc':
  libm: fix invalid result of function remquo/remquof
2012-04-13 17:07:43 -07:00
Kenny Root
a401160cee Merge changes I427a1881,I959b6428
* changes:
  Add faccessat to syscall list
  Update unistd.h for new syscalls
2012-04-13 16:03:51 -07:00
Kenny Root
f0ec06ba60 Add faccessat to syscall list
Change-Id: I427a18811089cb280769ac8da3ed8adc00a65a10
2012-04-13 15:45:42 -07:00
Elliott Hughes
6bc18fa588 Merge "libm: fix invalid result of function remquo/remquof" 2012-04-13 14:57:59 -07:00
Kenny Root
e54cc75f59 Update unistd.h for new syscalls
gensyscalls.py run from external/kernel-headers at commit
efab8f3e49f7f36ef0354b0996ecd5f3fa031e52

Change-Id: I959b64280e184655ef8c713aa79f9e23cb1f7df4
2012-04-13 14:50:14 -07:00
Travis Geiselbrecht
8565e21f4d am 0613dce0: regenerate linux/fb.h
* commit '0613dce0a7b806d48758cabfb2d638d0ba4dd2bc':
  regenerate linux/fb.h
2012-04-12 16:09:29 -07:00
Travis Geiselbrecht
0613dce0a7 regenerate linux/fb.h
Change-Id: Icd8c0f53306a48ffd513378abdf387af21e886a3
2012-04-12 14:51:43 -07:00
Evgeniy Stepanov
1a78fbb5c8 Initialize TLS before any application code is run.
Since e19d702b8e, dlsym and friends use recursive mutexes that
require the current thread id, which is not available before the libc
constructor. This prevents us from using dlsym() in .preinit_array.

This change moves TLS initialization from libc constructor to the earliest
possible point - immediately after linker itself is relocated. As a result,
pthread_internal_t for the initial thread is available from the start.

As a bonus, values stored in TLS in .preinit_array are not lost when libc is
initialized.

Change-Id: Iee5a710ee000173bff63e924adeb4a4c600c1e2d
2012-04-13 00:08:11 +04:00
Elliott Hughes
d5099016f7 Merge "Fix segv when unwinding stack past __libc_init." 2012-04-12 11:52:44 -07:00
The Android Automerger
f0a9d98a39 merge in jb-release history after reset to master 2012-04-12 06:59:24 -07:00
Kenny Root
470835b215 Move end of __on_dlclose up
The END macro was put too far down which made the linker complain about
it. Move up to the end of the code.

Change-Id: Ica71a9c6083b437d2213c7cefe34b0083c78f16b
2012-04-11 14:24:28 -07:00
The Android Automerger
85611165ab merge in jb-release history after reset to master 2012-04-11 06:59:29 -07:00
Kenny Root
03273f8fc0 __on_dlclose should be aligned
Marking segments read-only was pushing the alignment of __on_dlclose by
2 bytes making it unaligned. This change makes sure the ARM code is
aligned to the 4 byte boundary.

Bug: 6313309
Change-Id: Ic2bf475e120dd61225ec19e5d8a9a8b1d0b7f081
2012-04-10 17:53:11 -07:00
Nick Kralevich
ad7ff82771 Revert "linker: remove STB_LOCAL hack"
This reverts commit 61ff83475c.

This code is harmless, and only applies to the linker, so
there's no harm in keeping it in the tree a little bit longer.
Let's roll this back while we try to figure out the root cause
of bug 6314858.

Bug: 6314858
Change-Id: I9f5ed81d23a7abe273baf792aa8a0a2839ef094c
2012-04-10 16:08:31 -07:00
Nick Kralevich
7f03d2356f Revert "linker: remove STB_LOCAL hack"
This reverts commit 61ff83475c.

This code is harmless, and only applies to the linker, so
there's no harm in keeping it in the tree a little bit longer.
Let's roll this back while we try to figure out the root cause
of bug 6314858.

Bug: 6314858
Change-Id: I9f5ed81d23a7abe273baf792aa8a0a2839ef094c
2012-04-10 13:49:35 -07:00
The Android Automerger
92cf47c006 merge in jb-release history after reset to master 2012-04-10 06:59:26 -07:00
Evgeniy Stepanov
cd15bacf33 Fix segv when unwinding stack past __libc_init.
This change fixes a segmentation fault in the libc unwinder when it goes
past __libc_init.

Unwind instructions for __libc_init direct it to grab the return address from
the stack frame. Without this change, the unwinder gets a wild address and
looks up further unwind instructions for the routine at that address. If it's
unlucky enough to hit an existing function, it will try to unwind it. Bad
things happen then.

With this change, the return address always points to the _start function,
which does not have unwind instructions associated with it. This stop the
unwind process.

__libc_init never returns, so this does not affect program execution, other
than adding 4 bytes on the main thread stack.

Change-Id: Id58612172e8825c8729cccd081541a13bff96bd0
2012-04-10 16:45:54 +04:00
Jack Ren
bd0383acf8 libm: fix invalid result of function remquo/remquof
Currently we will get the wrong result as follows:
remquof(0x7bb33336, 0x63000000) = -671088640, 0x00000000
remquo(0xbff0000000000003, 0x3ff0000000000003) = 1, 0x8000000000000000
remquo(0x9120000000000001, 0x0000000000000005) = -1288490188, 0x0000000000000004
while the correct one should be:
remquof(0x7bb33336, 0x63000000) = 1476395008, 0x00000000
remquo(0xbff0000000000003, 0x3ff0000000000003) = -1, 0x8000000000000000
remquo(0x9120000000000001, 0x0000000000000005) = -1288490189, 0x0000000000000001

Fixed in this patch.

Change-Id: I540b348cd10a539f3b39b1753945c893c4c7ec46
Signed-off-by: Jingwei Zhang <jingwei.zhang@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-04-10 12:55:43 +08:00
Nick Kralevich
8777e2f54e Merge "linker: remove STB_LOCAL hack" 2012-04-09 13:41:14 -07:00
Nick Kralevich
61ff83475c linker: remove STB_LOCAL hack
The ARM static linker wasn't properly handling __exidx_start
and __exidx_end symbols. Now that the static linker has been fixed,
we don't need the dynamic linker to work around this problem.

Change-Id: Ic567122b6c7746cc016795e2befba2c6bd7c0478
2012-04-09 12:50:17 -07:00
Jeff Brown
d09f5a2e01 Merge "Update linux/input.h to version 3.4." 2012-04-09 11:24:27 -07:00
The Android Automerger
66929e845d merge in jb-release history after reset to master 2012-04-09 06:59:24 -07:00
Jeff Brown
0fdc190cc0 Update linux/input.h to version 3.4.
Bug: 6292993
Change-Id: Ic7628068df6c8de9cb3711a4540d51365b96ebdb
2012-04-06 19:25:25 -07:00
Dima Zavin
07a387e196 libc/kernel: update cleaned v4l2 header
Change-Id: Ib3747b45eb1e4095cca3de6d7692387953e8c4a7
Signed-off-by: Dima Zavin <dima@android.com>
2012-04-06 14:11:09 -07:00
JP Abgrall
048822d6af Merge "libc/kernel-headers: Auto generated files for netfilter/xt_IDLETIMER" 2012-04-05 20:36:36 -07:00
Ashish Sharma
17ed54ddcf libc/kernel-headers: Auto generated files for netfilter/xt_IDLETIMER
From Change I526b5fce: Add NETLINK_IDLETIMER msg type and include the corresponding header file.

Change-Id: I24bffc11394c8664e4d7d7f439b0600545f07536
Signed-off-by: Ashish Sharma <ashishsharma@google.com>
2012-04-05 19:52:24 -07:00
The Android Automerger
199213bba9 merge in jb-release history after reset to master 2012-04-05 06:59:23 -07:00
Nick Kralevich
8c4f3ce8d0 linker: surround "debug_verbosity" by "#if LINKER_DEBUG"
Avoid executing useless code when we're not compiled
with debugging support.

Change-Id: Iea1821b241acacdf65d1a91d743356058dfef273
2012-04-04 12:43:32 -07:00
Nick Kralevich
3a7ea52f17 linker: enable -fvisibility=hidden
Compile the linker with -fvisibility=hidden. This reduces the number
of symbols that show up in the .dynsym section of the linker.
These symbols are never exported to other applications.

In particular, this fixes a problem with setting -DLINKER_DEBUG=1
introduced in 468319ce4f.
Because the symbols "debug_verbosity" and "format_log" have not been
resolved before the linker links itself, any attempt to call
PRINT / INFO / TRACE / WARN / ERROR will result in a segfault.
This change allows the static linker to produce a relative reference
to these symbols rather than relying on relocation.

This also has a nice side effect of making the linker slightly smaller
and slightly more optimized.

The following symbols no longer in the .dynsym section of the linker
after this change:

-addr_to_name
-call_constructors_recursi
-calloc
-debugger_init
-debugger_signal_handler
-debug_verbosity
-dladdr
-dlclose
-dlerror
-dl_lock
-dlopen
-dlsym
-dl_unwind_find_exidx
-find_containing_library
-find_containing_symbol
-find_library
-format_buffer
-free
-libdl_info
-linker_env_get
-linker_env_init
-linker_env_secure
-linker_env_unset
-linker_get_error
-__linker_init
-lookup
-lookup_in_library
-malloc
-notify_gdb_of_libraries
-notify_gdb_of_load
-notify_gdb_of_unload
-realloc
-rtld_db_dlactivity
-unload_library
-vsnprintf

Bug: 5827809
Change-Id: I5e8cd7dcf48c1d6831a970a67f63f24916c5e437
2012-04-04 11:13:51 -07:00
Mike Lockwood
8aeaa478df Merge remote-tracking branch 'goog/ics-aah' 2012-04-03 11:35:33 -07:00
The Android Automerger
485fc9f4ef merge in jb-release history after reset to master 2012-04-03 03:27:58 -07:00
Elliott Hughes
1302f6936b am fdb11929: am b88f810d: Merge "Update to tzdata2012c."
* commit 'fdb119297ac421e2fc2ec096a6d5370b81938de8':
  Update to tzdata2012c.
2012-04-02 16:09:36 -07:00
Elliott Hughes
fdb119297a am b88f810d: Merge "Update to tzdata2012c."
* commit 'b88f810d585a1736a1759c2c22e9f4999441ae00':
  Update to tzdata2012c.
2012-04-02 16:07:46 -07:00
Elliott Hughes
b88f810d58 Merge "Update to tzdata2012c." 2012-04-02 10:25:43 -07:00
Elliott Hughes
8f78ddb422 Update to tzdata2012c.
From the release notes:

       africa
               Summer time changes for Morocco (to start late April 2012)

       asia
               Changes for 2012 for Gaza & the West Bank (Hebron) and Syria

       northamerica
               Haiti following US/Canada rules for 2012 (and we're assuming,
               for now anyway, for the future).

Also include a change made internally to the 'generate' script as part of
the tzdata2011m update that apparently never made it to AOSP; the original
checkin comment for which was:

    Update to tzdata2011m.

    Fixes for Europe/Tiraspol (Moldova) and all four Ukrainian zones.

    Also show the MD5 of the downloaded data, for comparison against the MD5
    given in the announcement mails. (There's a plan to move to proper signing,
    but that's not implemented on their end yet.)

(I'm repeating the tzdata change for the convenience of anyone grepping the
log, since the 2012 tzdata releases also contain the 2011m changes; 2011m
is the only missing release I noticed.)

Change-Id: I9a2e530b3a8ea88e3375334a12376e3d8526f267
2012-04-02 07:43:15 -07:00
The Android Automerger
b955ffa5b3 merge in jb-release history after reset to master 2012-04-02 06:59:31 -07:00
Elliott Hughes
4e362f230b am cd834618: am 63b14755: Merge "libc/x86: ensure the stack 16-byte aligned when tasks created"
* commit 'cd834618c4752b61d54ff4005a8baa8219b822e4':
  libc/x86: ensure the stack 16-byte aligned when tasks created
2012-03-30 22:16:02 -07:00
Elliott Hughes
cd834618c4 am 63b14755: Merge "libc/x86: ensure the stack 16-byte aligned when tasks created"
* commit '63b14755512d515762cbe3ad8544c561a576f32e':
  libc/x86: ensure the stack 16-byte aligned when tasks created
2012-03-30 15:53:19 -07:00
Elliott Hughes
63b1475551 Merge "libc/x86: ensure the stack 16-byte aligned when tasks created" 2012-03-30 13:42:42 -07:00
Dima Zavin
ddb2f13549 Revert "libc/kernel: Add rules to autogenerate device specific kernel headers"
This reverts commit 884147c7d0.

Change-Id: I09723858ac961f3e1155791aa5c54d5d3abfbd36
Signed-off-by: Dima Zavin <dima@android.com>
2012-03-30 10:21:25 -07:00
The Android Automerger
30c8b110f3 merge in jb-release history after reset to master 2012-03-28 06:59:31 -07:00
Elliott Hughes
8fd682f7f2 am ea76f414: am d509f9cc: am 09ce7749: Merge "[MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture."
* commit 'ea76f4147825cc39d9aa91230cd863ed29f28e27':
  [MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture.
2012-03-27 17:58:57 -07:00
Elliott Hughes
ea76f41478 am d509f9cc: am 09ce7749: Merge "[MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture."
* commit 'd509f9ccbba6e1dd53acfd7425bfc06d6b3f8693':
  [MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture.
2012-03-27 17:57:41 -07:00
Elliott Hughes
d509f9ccbb am 09ce7749: Merge "[MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture."
* commit '09ce7749d74733b28d4fa7a1d36457cb366cc5da':
  [MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture.
2012-03-27 17:53:35 -07:00
Elliott Hughes
09ce7749d7 Merge "[MIPS] Clean Kernel headers are generated by running libc/kernel/tools/update_all.py script. This patch ignores any changes to libc/kernel directory not related to MIPS architecture." 2012-03-27 16:49:29 -07:00
Raghu Gandham
82fa43febc [MIPS] Clean Kernel headers are generated by running
libc/kernel/tools/update_all.py script. This patch ignores
any changes to libc/kernel directory not related to MIPS
architecture.

Change-Id: I2c9e461dccb7c33eb4420be2db1a562f45137c8d
Signed-off-by: Raghu Gandham <raghu@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
2012-03-27 11:38:00 -07:00
Jean-Baptiste Queru
32913bf7d9 am b52c941e: am d7c6147e: am 56731351: Merge "bionic: fix atfork hanlder_mutex deadlock"
* commit 'b52c941ed4f24134b78a73daee84bdc328f969da':
  bionic: fix atfork hanlder_mutex deadlock
2012-03-27 10:10:50 -07:00
The Android Automerger
8149d73652 merge in jb-release history after reset to master 2012-03-27 06:59:30 -07:00
Jean-Baptiste Queru
b52c941ed4 am d7c6147e: am 56731351: Merge "bionic: fix atfork hanlder_mutex deadlock"
* commit 'd7c6147eff65572762d55950b965db949ccd0281':
  bionic: fix atfork hanlder_mutex deadlock
2012-03-26 18:29:23 -07:00
Jean-Baptiste Queru
d7c6147eff am 56731351: Merge "bionic: fix atfork hanlder_mutex deadlock"
* commit '56731351de7230180fc99a1a4b0afd12f881b0f7':
  bionic: fix atfork hanlder_mutex deadlock
2012-03-26 18:25:43 -07:00
Benoit Goby
8491327448 Merge "Add auto-generated headers for USB FunctionFS" 2012-03-26 17:14:24 -07:00
Jean-Baptiste Queru
56731351de Merge "bionic: fix atfork hanlder_mutex deadlock" 2012-03-26 16:19:36 -07:00
Jean-Baptiste Queru
faca92f2f1 Handle pthread-related changes (mutex/atfork)
First commit:

Revert "Revert "am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()"""

This reverts commit 06823da2f0.

Second commit:

bionic: fix atfork hanlder_mutex deadlock

This cherry-picks commit 34e89c232d

After applying the kernel_id fix, the system refused to boot up and we
got following crash log:
I/DEBUG   (  113): pid: 618, tid: 618  >>> org.simalliance.openmobileapi.service:remote <<<
I/DEBUG   (  113): signal 16 (SIGSTKFLT), code -6 (?), fault addr --------
I/DEBUG   (  113):  eax fffffe00  ebx b77de994  ecx 00000080  edx 00724002
I/DEBUG   (  113):  esi 00000000  edi 00004000
I/DEBUG   (  113):  xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000 xss 0000007b
I/DEBUG   (  113):  eip b7761351  ebp bfdf3de8  esp bfdf3dc4  flags 00000202
I/DEBUG   (  113):     #00  eip: 00015351  /system/lib/libc.so
I/DEBUG   (  113):     #01  eip: 0000d13c  /system/lib/libc.so (pthread_mutex_lock)
I/DEBUG   (  113):     #02  eip: 00077b48  /system/lib/libc.so (__bionic_atfork_run_prepare)
I/DEBUG   (  113):     #03  eip: 00052cdb  /system/lib/libc.so (fork)
I/DEBUG   (  113):     #04  eip: 0009ae91  /system/lib/libdvm.so (_Z18dvmOptimizeDexFileillPKcjjb)
I/DEBUG   (  113):     #05  eip: 000819d6  /system/lib/libdvm.so (_Z14dvmJarFileOpenPKcS0_PP7JarFileb)
I/DEBUG   (  113):     #06  eip: 000b175e  /system/lib/libdvm.so (_ZL40Dalvik_dalvik_system_DexFile_openDexFilePKjP6JValue)
I/DEBUG   (  113):     #07  eip: 0011fb94  /system/lib/libdvm.so

Root cause:
The atfork uses the mutex handler_mutex to protect the atfork_head. The
parent will call __bionic_atfork_run_prepare() to lock the handler_mutex,
and need both the parent and child to unlock their own copy of handler_mutex
after fork. At that time, the owner of hanlder_mutex is set as the parent.
If we apply the kernel_id fix, then the child's kernel_id will be set as
child's tid.
The handler_mutex is a recursive lock, and pthread_mutex_unlock(&hander_mutex)
will fail because the mutex owner is the parent, while the current tid
(__get_thread()->kernel_id) is child, not matched with the mutex owner.
At that time, the handler_mutex is left in lock state.If the child wants to
fork other process after than, then it will try to lock handler_mutex, and
then be deadlocked.

Fix:
Since the child has its own copy of vm space from the the parent, the
child space's handler_mutex should be reset to the initialized state.

Change-Id: I3907dd9a153418fb78862f2aa6d0302c375d9e27
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>

Change-Id: Ic8072f366a877443a60fe215f3c00b3df5a259c8
2012-03-26 15:38:59 -07:00
Benoit Goby
2ab5bfd43f Add auto-generated headers for USB FunctionFS
linux/usb/ch9.h and linux/usb/functionfs.h

Change-Id: I2907081aba63b32740eb9916315759692a96ab42
2012-03-26 15:10:29 -07:00
The Android Automerger
665a2207af merge in jb-release history after reset to master 2012-03-26 06:59:35 -07:00
Andrew Hsieh
126601dd3f Fixed to #include correct 32-bit headers; Refreshed libc/kernel headers
This patch fixes an issue where 64-bit hreaders are incorrectly included
in kernel headers.  For example, file "libc/kernel/arch-x86/asm/io.h"
incorreclty includes "io_64.h" (missing, BTW) instead of "io_32.h".

The reason is because CONFIG_X86_32 isn't considered pre-defined in
"kernel_default_arch_macros" for x86, and clean_header.py doesn't
look at it at all anyway (ie. __i386__ is also ignored, but it's
okay since x86 cross compiler defines it back)

Fixed 2 tools/*py, README.TXT, and refreshed libc/kernel headers

Change-Id: Iac834cc8b3548f055d3f2a214af36072dd679fe8
2012-03-23 23:07:36 +08:00
Jack Ren
cb08204053 libc/x86: ensure the stack 16-byte aligned when tasks created
Currently Renderscript sample code RsBalls crashed on x86 when SSE2
enabled. The root cause is that the stack was not 16-byte aligned
from the beginning when the processes/threads were created, so the
RsBalls crashed when SSE2 instructions tried to access the variables
on the stack.

- For the thread created by fork():
Its stack alignment is determined by crtbegin_{dynamic, static}.S

- For the thread created by pthread_create():
Its stack alignment is determined by clone.S. __thread_entry( ) is
a standard C function. In order to have its stack be aligned with
16 byte properly, __thread_entry() needs the stack with following
layout when it is called:
layout #1 (correct)
--------------
|            |
-------------- <--ESP (ECX - 20)
| ret EIP    |
-------------- <--ECX - 16
| arg0       |
-------------- <--ECX - 12
| arg1       |
-------------- <--ECX - 8
| arg2       |
-------------- <--ECX - 4
| unused     |
-------------- <--ECX (16-byte boundary)

But it has following layout for now:
layout #2: (incorrect)
--------------
|            |
-------------- <--ESP (ECX - 16)
| unused     |
-------------- <--ECX - 12
| arg0       |
-------------- <--ECX - 8
| arg1       |
-------------- <--ECX - 4
| arg2       |
-------------- <--ECX (16-byte boundary)

Fixed in this patch.

Change-Id: Ibe01f64db14be14033c505d854c73033556ddaa8
Signed-off-by: Michael Liao <michael.liao@intel.com>
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-03-23 20:04:04 +08:00
Ben Cheng
eaae81082c Initialize mspace->least_addr properly in the mmap path.
BUG: 6206963
Change-Id: Id2ab580246de50a4511b56a734a7bece98fb945c
2012-03-21 15:47:12 -07:00
Nick Kralevich
891966d020 Merge "string.h: add __attribute__ ((pure)) to string functions" 2012-03-21 14:40:41 -07:00
Iliyan Malchev
1ca0b9d158 Merge "bionic: pass MADV_MERGEABLE on private & anonymous mmaps" 2012-03-21 13:51:42 -07:00
JP Abgrall
16a8fcce9f Merge "Update the libc kernel includes to support the newer mman for KSM support" 2012-03-21 13:43:10 -07:00
JP Abgrall
b8e1e9685e bionic: pass MADV_MERGEABLE on private & anonymous mmaps
Change-Id: I8bc167bb33dec6417fe772172697ea6ff97da2f6
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-03-21 13:21:33 -07:00
JP Abgrall
2f33c5a8e4 Update the libc kernel includes to support the newer mman for KSM support
These are generated from the matching external/kernel-headers/original
files (from kernel/samsung android-samsung-3.0-wip).

Change-Id: I982ff6a0d522ea250c3a437f5756766fcc6c5c91
2012-03-21 13:21:33 -07:00
Nick Kralevich
f082444291 Merge "fnmatch.c: Update to version in OpenBSD HEAD" 2012-03-21 10:07:55 -07:00
Nick Kralevich
d1860ad8dd fnmatch.c: Update to version in OpenBSD HEAD
Upgrade fnmatch.c from OpenBSD version 1.13 to 1.16.
This is needed primarily to address CVE-2011-0419.

This is a straight copy from upstream's version at
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/fnmatch.c and
incorporates the following changes:

Revision 1.16:
New fnmatch(3) implementation which is not recursive.
Written and provided under BSD licence by William A. Rowe Jr.
Originally released in Apache APR-1.4.5.
Merged class matching code from r1.14 and PATH_MAX check from r1.15.
ok miod millert

Revision 1.15:
Put a limit on recursion during matching, and reject input of size greater
or equal PATH_MAX. Based on similar fix made in NetBSD.
ok miod@ millert@

Revision 1.14:
POSIX character class support for fnmatch(3) and glob(3).  OK deraadt@

Version 1.14 introduced charclasses.h, which we copy unmodified
from upstream version 1.1.
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/gen/charclass.h

Bug: 3435120
Change-Id: I45133468f0c3d439fd10eb087a1c647799f9d25b
2012-03-21 09:53:05 -07:00
Ben Cheng
e80f799d89 Merge "New additions/bug fixes required/found when porting perf." 2012-03-21 09:32:24 -07:00
Nick Kralevich
a677907ee8 string.h: add __attribute__ ((pure)) to string functions
cdefs.h: Introduce the __purefunc attribute, which allows us to mark
certain functions as being "pure".

http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

  Many functions have no effects except the return value and their
  return value depends only on the parameters and/or global variables.
  Such a function can be subject to common subexpression elimination
  and loop optimization just as an arithmetic operator would be.

string.h: Mark many commently used string functions as "pure", to
allow for additional compiler optimizations.

Change-Id: I42961f90f822b6dbcbc3fd72cdbe774a7adc8785
2012-03-21 08:54:54 -07:00
The Android Automerger
9f7df549a2 merge in jb-release history after reset to master 2012-03-21 06:59:50 -07:00
Dima Zavin
884147c7d0 libc/kernel: Add rules to autogenerate device specific kernel headers
This change will automatically post-process kernel headers
specified by device, board, and product. This will allow us
to not check in each kernel header twice, at least for the
device specific headers for now.

Change-Id: I3bb144b6535504b7c26b807daa75de495554356d
Signed-off-by: Dima Zavin <dima@android.com>
2012-03-20 15:28:34 -07:00
Ben Cheng
21eab513e7 New additions/bug fixes required/found when porting perf.
New functions:
	tfind
	tsearch
	tdelete
	twalk
	tdestroy (GNU extension)

Bug fix: the current implementation for realpath would crash
	if the second argument (resolved_path) is NULL.

New headers:
	ar.h
	search.h

Change-Id: Ib6c1e42fc186a6d597a6e5a9692b16acaa155804
2012-03-20 12:54:55 -07:00
Nick Kralevich
aac0dc97a9 Merge "linker: fix off-by-one error in GNU_RELRO handling" 2012-03-20 10:52:42 -07:00
Nick Kralevich
0814eea3ec Merge "linker: initially reserved memory as PROT_NONE" 2012-03-20 10:52:23 -07:00
Nick Kralevich
d73b5cafa0 linker: fix off-by-one error in GNU_RELRO handling
Fix a bug where the GNU_RELRO end address could be exactly
the end of the loadable segment.

Change-Id: If6c43acabc06e9aff9217c0f6016e158b28bb41f
2012-03-20 09:24:58 -07:00
The Android Automerger
6e9e53d15f merge in jb-release history after reset to master 2012-03-19 06:59:35 -07:00
Jack Ren
34e89c232d bionic: fix atfork hanlder_mutex deadlock
After applying the kernel_id fix, the system refused to boot up and we
got following crash log:
I/DEBUG   (  113): pid: 618, tid: 618  >>> org.simalliance.openmobileapi.service:remote <<<
I/DEBUG   (  113): signal 16 (SIGSTKFLT), code -6 (?), fault addr --------
I/DEBUG   (  113):  eax fffffe00  ebx b77de994  ecx 00000080  edx 00724002
I/DEBUG   (  113):  esi 00000000  edi 00004000
I/DEBUG   (  113):  xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000 xss 0000007b
I/DEBUG   (  113):  eip b7761351  ebp bfdf3de8  esp bfdf3dc4  flags 00000202
I/DEBUG   (  113):     #00  eip: 00015351  /system/lib/libc.so
I/DEBUG   (  113):     #01  eip: 0000d13c  /system/lib/libc.so (pthread_mutex_lock)
I/DEBUG   (  113):     #02  eip: 00077b48  /system/lib/libc.so (__bionic_atfork_run_prepare)
I/DEBUG   (  113):     #03  eip: 00052cdb  /system/lib/libc.so (fork)
I/DEBUG   (  113):     #04  eip: 0009ae91  /system/lib/libdvm.so (_Z18dvmOptimizeDexFileillPKcjjb)
I/DEBUG   (  113):     #05  eip: 000819d6  /system/lib/libdvm.so (_Z14dvmJarFileOpenPKcS0_PP7JarFileb)
I/DEBUG   (  113):     #06  eip: 000b175e  /system/lib/libdvm.so (_ZL40Dalvik_dalvik_system_DexFile_openDexFilePKjP6JValue)
I/DEBUG   (  113):     #07  eip: 0011fb94  /system/lib/libdvm.so

Root cause:
The atfork uses the mutex handler_mutex to protect the atfork_head. The
parent will call __bionic_atfork_run_prepare() to lock the handler_mutex,
and need both the parent and child to unlock their own copy of handler_mutex
after fork. At that time, the owner of hanlder_mutex is set as the parent.
If we apply the kernel_id fix, then the child's kernel_id will be set as
child's tid.
The handler_mutex is a recursive lock, and pthread_mutex_unlock(&hander_mutex)
will fail because the mutex owner is the parent, while the current tid
(__get_thread()->kernel_id) is child, not matched with the mutex owner.
At that time, the handler_mutex is left in lock state.If the child wants to
fork other process after than, then it will try to lock handler_mutex, and
then be deadlocked.

Fix:
Since the child has its own copy of vm space from the the parent, the
child space's handler_mutex should be reset to the initialized state.

Change-Id: I3907dd9a153418fb78862f2aa6d0302c375d9e27
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-03-17 17:08:54 +08:00
Nick Kralevich
6625986f3a linker: initially reserved memory as PROT_NONE
When the dynamic linker loads a shared library into memory, it
initially allocates a chunk of memory. The memory is then carved
into smaller chunks for each LOAD region, and appropriate memory
protections applied.

Modify the initial memory allocation so that the pages are mapped
as PROT_NONE, rather than PROT_READ / PROT_EXEC. This ensures that
gaps between LOAD regions are not inadvertantly readable / executable.

(Long term, we should munmap() these gaps entirely)

Change-Id: If128a203ccc6fe12dcbbd2bfe0cf13a2045675af
2012-03-16 13:06:12 -07:00
Kenny Root
ad812ef2a4 Add in auto-generated if_alg.h header
Change-Id: I5d0934069e74be2eafecdee43074590124db57a7
2012-03-15 21:59:01 -07:00
The Android Automerger
9bcaf0ea6d merge in jb-release history after reset to master 2012-03-14 06:59:45 -07:00
Ben Cheng
adb6989786 Merge "Update kernel headers and add syscall "perf_event_open"" 2012-03-13 13:04:22 -07:00
Ben Cheng
1a823691a2 Update kernel headers and add syscall "perf_event_open"
Change-Id: I43f12b727881df002a8524f2738586c043833bae
2012-03-13 12:28:40 -07:00
Guang Zhu
06823da2f0 Revert "am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()""
This reverts commit 76d56cf4a9, reversing
changes made to c59ba4595b.

Bug: 6157577
2012-03-12 22:05:36 -07:00
Elliott Hughes
76d56cf4a9 am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()"
* commit 'be741d472868a8ffcb455588f18cda889b0f465c':
  bionic: Fix wrong kernel_id in pthread descriptor after fork()
2012-03-12 17:12:35 -07:00
Elliott Hughes
be741d4728 am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()"
* commit '2f460fbee9abe2936175379c49c6618de7421233':
  bionic: Fix wrong kernel_id in pthread descriptor after fork()
2012-03-12 17:10:46 -07:00
Elliott Hughes
2f460fbee9 am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()"
* commit '73b5cad989da317cc8089b57ee25f502b1cac71f':
  bionic: Fix wrong kernel_id in pthread descriptor after fork()
2012-03-12 17:06:09 -07:00
Elliott Hughes
73b5cad989 Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()" 2012-03-12 10:32:02 -07:00
Jack Ren
d8bc6e7119 bionic: Fix wrong kernel_id in pthread descriptor after fork()
After forking, the kernel_id field in the phtread_internal_t returned by pthread_self()
is incorrect --- it's the tid from the parent, not the new tid of the
child.

The root cause is that: currently the kernel_id is set by
_init_thread(), which is called in 2 cases:
(1) called by __libc_init_common(). That happens when the execv( ) is
called after fork( ). But when the zygote tries to fork the android
application, the child application doesn't call execv( ), instread, it
tries to call the Java main method directly.
(2) called by pthread_create(). That happens when a new thread is
created.

For the lead thread which is the thread created by fork(), it should
call execv() but it doesn't, as described in (1) above. So its kernel_id
will inherit the parent's kernel_id.

Fixed it in this patch.

Change-Id: I63513e82af40ec5fe51fbb69456b1843e4bc0fc7
Signed-off-by: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-03-12 23:14:56 +08:00
The Android Automerger
26b666b35e merge in jb-release history after reset to master 2012-03-12 06:59:42 -07:00
Robert Greenwalt
c59ba4595b Use new binary code format
3-digits + null.  Old was 3-digits + space + null.

Change-Id: If5fdf9ced073f432ace3a76858025ad651c74e3d
2012-03-09 11:50:46 -08:00
Andy McFadden
ca9a0712b8 Re-throw signals
If we catch a fatal signal that won't automatically re-throw when
the thread resumes, re-throw it manually.  (Common examples are
SIGPIPE and the SIGFPE from integer division by zero.)

Change-Id: I329e6d4db907047c555957b42cbd09c50fc808e7
2012-03-08 11:14:37 -08:00
The Android Automerger
56ae6bdaa1 merge in jb-release history after reset to master 2012-03-08 06:59:22 -08:00
Ben Cheng
654325de02 Update bionic kernel headers using update_all.py
Change-Id: I9c377436e9bf158e7236b3b7dcebf3e79fa961de
2012-03-07 21:13:49 -08:00
Selim Gurun
db6d20be77 Merge "Prevent potential stall on dns proxy operations." 2012-03-07 17:05:15 -08:00
Ben Cheng
36c8c1039f Merge "Revert "Update bionic kernel headers using update_all.py"" 2012-03-07 16:16:10 -08:00
Ben Cheng
4b29af0a1b Revert "Update bionic kernel headers using update_all.py"
This reverts commit 94a85f6636

There is a smoke test failure for Prime but Crespo/Stingray are fine. Will revert the change for now until further investigation is made.
2012-03-07 16:14:53 -08:00
Selim Gurun
06e1831f19 Prevent potential stall on dns proxy operations.
Update wire protocol to return and process error code first.
This will make sure dns proxy operations do not stall when
an internal error happens.
Also fix a compiler warning.
Also fix a potential buffer overflow.
And use correct types (uint32_t) rather than int when reading from network.

Change-Id: I9f99c16d6fd5e9137491a4d1b293a7c78e31b9c3
2012-03-07 15:09:05 -08:00
Ben Cheng
27a5923b24 Merge "Update bionic kernel headers using update_all.py" 2012-03-07 13:57:09 -08:00
Marco Nelissen
e5cf8166dc Merge "Log the thread id and name for fatal signals." 2012-03-07 13:09:36 -08:00
Marco Nelissen
3df3e672f5 Log the thread id and name for fatal signals.
This adds the thread id and name to the "Fatal signal" logging,
making it easier to track down where in process it actually crashed.

Change-Id: I17a365042b2f10b161debe98bc2e7070af055dfb
2012-03-07 12:32:15 -08:00
Ben Cheng
94a85f6636 Update bionic kernel headers using update_all.py
Change-Id: I4da6b23cdbce89445f1ca5d2fadeb23345ce694c
2012-03-07 12:27:59 -08:00
The Android Automerger
151fac68c3 merge in jb-release history after reset to master 2012-03-07 06:59:17 -08:00
Nick Kralevich
d027ffdd7a Merge "Add relro support" 2012-03-06 11:31:59 -08:00
Nick Kralevich
9ec0f03a0d Add relro support
Add support for PT_GNU_RELRO. This allows the static linker to
indicate that certain regions of memory should be marked as
"read-only" after dynamic linking is complete.

See:
  * http://www.akkadia.org/drepper/nonselsec.pdf (section 6)
  * http://tk-blog.blogspot.com/2009/02/relro-not-so-well-known-memory.html

Note that this change has no effect on Android right now, because
we don't compile our code with relro enabled.

Change-Id: I6541f8775367e8558b4388f7d105b1ae6e8f046b
2012-03-05 16:44:42 -08:00
Kenny Root
fa3f72ee53 Revert "Reference __dso_handle in PIC way"
This reverts commit 93cb308137
2012-03-05 11:55:23 -08:00
Kenny Root
4597687335 Merge "Revert "Reference __dso_handle in PIC way"" 2012-03-05 10:46:01 -08:00
Kenny Root
be101bf39a Revert "Reference __dso_handle in PIC way"
This reverts commit 93cb308137
2012-03-05 10:45:31 -08:00
The Android Automerger
fa944c190c merge in jb-release history after reset to master 2012-03-05 06:59:32 -08:00
Kenny Root
1fe109ecf3 Merge "Reference __dso_handle in PIC way" 2012-03-02 16:05:57 -08:00
Kenny Root
93cb308137 Reference __dso_handle in PIC way
Use the same pattern in atexit.S to reference __dso_handle in a way that
doesn't require a TEXTREL flag to be set.

Change-Id: Id69d20863ee203d2b2f7ef0db230f9b548657741
2012-03-02 13:09:36 -08:00
Elliott Hughes
079989259f am 6d074bb7: am 70d1d45f: am a58c88c2: Merge "Upgrade to tzdata2012b."
* commit '6d074bb71a316f73f35f4430a71fa706c46d4b75':
  Upgrade to tzdata2012b.
2012-03-02 11:13:05 -08:00
Elliott Hughes
6d074bb71a am 70d1d45f: am a58c88c2: Merge "Upgrade to tzdata2012b."
* commit '70d1d45f0ecaee262627a6ca323fc2b4fe3e9024':
  Upgrade to tzdata2012b.
2012-03-02 11:10:43 -08:00
Elliott Hughes
70d1d45f0e am a58c88c2: Merge "Upgrade to tzdata2012b."
* commit 'a58c88c235bfeeb17ac495991e66f7b906935852':
  Upgrade to tzdata2012b.
2012-03-02 11:07:03 -08:00
Elliott Hughes
da16ad11fe am a2b1bbc9: am a480cf93: resolved conflicts for merge of cfe535ef to stage-aosp-master
* commit 'a2b1bbc9a605819eb5ecd1df61d4f2a79f1a8f92':
  Upgrade to tzdata2011a.
2012-03-02 10:49:45 -08:00
Elliott Hughes
a2b1bbc9a6 am a480cf93: resolved conflicts for merge of cfe535ef to stage-aosp-master
* commit 'a480cf930f31ab404e7efe66259427a53d72fa2b':
  Upgrade to tzdata2011a.
2012-03-02 10:47:23 -08:00
Elliott Hughes
a480cf930f resolved conflicts for merge of cfe535ef to stage-aosp-master
Change-Id: I21a1dd41503518e75892180c14f1ce79102772ad
2012-03-02 10:11:18 -08:00
Elliott Hughes
a58c88c235 Merge "Upgrade to tzdata2012b." 2012-03-02 00:09:04 -08:00
Elliott Hughes
dd8e4045e7 Upgrade to tzdata2012b.
Summer time in Cuba has been delayed 3 weeks (now starts April 1 rather
than March 11). Since March 11 (the old start date, as listed in 2012a)
is just a little over a week away, this change is urgent.

Change-Id: Iadf4dc30072bdac0bcd0ad4b9e076a9ca071efbe
2012-03-01 23:34:11 -08:00
Elliott Hughes
cfe535ef9f Merge "Upgrade to tzdata2011a." 2012-03-01 23:32:15 -08:00
Jean-Baptiste Queru
3690bcb217 am cff86bdc: am 018c27ed: am 25f2d1f0: Merge "update stddef.h"
* commit 'cff86bdc02f70bb5758234ace75a2f84a626cc3c':
  update stddef.h
2012-03-01 15:35:45 -08:00
Jean-Baptiste Queru
4053f8530d am 568ee0d1: am 51d22d7e: am afab5a70: Merge "Eliminate duplicate constants"
* commit '568ee0d135c23c5a49fb4f93de01999b76523428':
  Eliminate duplicate constants
2012-03-01 15:35:44 -08:00
Jean-Baptiste Queru
446a772bc4 am dc755140: (-s ours) am 7c38f53d: am 7f28e0b4: Merge "Clean up the remnants of SuperH support"
* commit 'dc755140c11bb0ff64f7c3d224dd5588fc643485':
  Clean up the remnants of SuperH support
2012-03-01 15:35:20 -08:00
Elliott Hughes
69ea1c03e0 Upgrade to tzdata2011a.
From the notes:

       Chile 2011/2012 and 2012/2013 summer time date adjustments.
       Falkland Islands onto permanent summer time (we're assuming for the
               foreseeable future, though 2012 is all we're fairly certain of.)
       Armenia has abolished Summer Time.
       Tokelau jumped the International Date Line back last December
               (just the same as their near neighbour, Samoa).
       America/Creston is a new zone for a small area of British Columbia
       There will be a leapsecod 2012-06-30 23:59:60 UTC.

Change-Id: I1d66edf8d33fd1dbcf21178def91844025fd9047
2012-03-01 09:38:31 -08:00
The Android Automerger
73c88b70b2 merge in jb-release history after reset to master 2012-03-01 06:59:21 -08:00
Jean-Baptiste Queru
cff86bdc02 am 018c27ed: am 25f2d1f0: Merge "update stddef.h"
* commit '018c27eda89b54e59e6c043ea2986c6e39ec2ee0':
  update stddef.h
2012-02-29 19:12:17 -08:00
Jean-Baptiste Queru
568ee0d135 am 51d22d7e: am afab5a70: Merge "Eliminate duplicate constants"
* commit '51d22d7ea92e77f47accee59c99cb8157bf29fcb':
  Eliminate duplicate constants
2012-02-29 19:12:16 -08:00
Jean-Baptiste Queru
018c27eda8 am 25f2d1f0: Merge "update stddef.h"
* commit '25f2d1f0c3c7802af0d4d1e2bbd3bf95a7e0970b':
  update stddef.h
2012-02-29 19:08:50 -08:00
Jean-Baptiste Queru
51d22d7ea9 am afab5a70: Merge "Eliminate duplicate constants"
* commit 'afab5a703d30df613848cb30ab3ecceafd76102b':
  Eliminate duplicate constants
2012-02-29 19:08:49 -08:00
Jean-Baptiste Queru
25f2d1f0c3 Merge "update stddef.h" 2012-02-29 18:59:16 -08:00
Jean-Baptiste Queru
afab5a703d Merge "Eliminate duplicate constants" 2012-02-29 18:58:53 -08:00
Nick Kralevich
53d161a2bc update stddef.h
Pull in an updated version of stddef.h from the linux kernel.
Pulled from upstream kernel at 891003abb0db6bfffd61b76ad0ed39bb7c3db8e1

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/stddef.h

Change-Id: I6c29f3fa100c5368da41d0f0da39bc50fa668e9d
2012-02-29 18:43:55 -08:00
Nick Kralevich
9921947e6f Eliminate duplicate constants
include/elf.h contains basically the same values as
linux/auxvec.h. Eliminate dups.

include/sys/exec_elf.h contains basically the same
values as linux/elf.h. Eliminate dups.

Change-Id: I66b8358161bb52223bb657f8f73ba28b324f4fa3
2012-02-29 18:43:51 -08:00
Jean-Baptiste Queru
dc755140c1 am 7c38f53d: am 7f28e0b4: Merge "Clean up the remnants of SuperH support"
* commit '7c38f53d1911e04acf6398921a7bd4444d585c2b':
  Clean up the remnants of SuperH support
2012-02-29 15:43:24 -08:00
Jean-Baptiste Queru
7c38f53d19 am 7f28e0b4: Merge "Clean up the remnants of SuperH support"
* commit '7f28e0b4501de7c4f8f627fd3e4be323d737ae82':
  Clean up the remnants of SuperH support
2012-02-29 15:38:55 -08:00
Jean-Baptiste Queru
7f28e0b450 Merge "Clean up the remnants of SuperH support" 2012-02-29 14:39:42 -08:00
Nick Kralevich
86addd65ab Merge "Eliminate duplicate constants" 2012-02-29 13:30:48 -08:00
Nick Kralevich
67e7a93844 Eliminate duplicate constants
include/elf.h contains basically the same values as
linux/auxvec.h. Eliminate dups.

include/sys/exec_elf.h contains basically the same
values as linux/elf.h. Eliminate dups.

Change-Id: I66b8358161bb52223bb657f8f73ba28b324f4fa3
2012-02-29 11:21:53 -08:00
Andrew Hsieh
4fc1273459 Merge "Trivial fix in comment" 2012-02-29 09:40:49 -08:00
The Android Automerger
16310b5582 merge in jb-release history after reset to master 2012-02-29 06:59:21 -08:00
Nick Kralevich
d638a500e9 Merge "update stddef.h" 2012-02-28 14:39:12 -08:00
Nick Kralevich
ec37237d69 update stddef.h
Pull in an updated version of stddef.h from the linux kernel.
Pulled from upstream kernel at 891003abb0db6bfffd61b76ad0ed39bb7c3db8e1

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/stddef.h

Change-Id: I6c29f3fa100c5368da41d0f0da39bc50fa668e9d
2012-02-28 14:04:57 -08:00
Jean-Baptiste Queru
a1d3e0d8eb am 2e236c13: am 17edd38f: am 9c9b0fc7: Merge "libm: cherry-pick one patch from freebsd to fix logb() denormals issue"
* commit '2e236c132fe38e52d8a52d264cca5c520d778c98':
  libm: cherry-pick one patch from freebsd to fix logb() denormals issue
2012-02-28 13:55:51 -08:00
Jean-Baptiste Queru
2e236c132f am 17edd38f: am 9c9b0fc7: Merge "libm: cherry-pick one patch from freebsd to fix logb() denormals issue"
* commit '17edd38f03300af28c89f9031dad177af8232c3a':
  libm: cherry-pick one patch from freebsd to fix logb() denormals issue
2012-02-28 13:53:14 -08:00
Jean-Baptiste Queru
17edd38f03 am 9c9b0fc7: Merge "libm: cherry-pick one patch from freebsd to fix logb() denormals issue"
* commit '9c9b0fc7e1dff39baa8cdf2536be9776aa4af766':
  libm: cherry-pick one patch from freebsd to fix logb() denormals issue
2012-02-28 13:28:30 -08:00
Jean-Baptiste Queru
9c9b0fc7e1 Merge "libm: cherry-pick one patch from freebsd to fix logb() denormals issue" 2012-02-28 09:44:41 -08:00
Jack Ren
1fa7b45df8 libm: cherry-pick one patch from freebsd to fix logb() denormals issue
from http://svnweb.freebsd.org/base?view=revision&revision=176101
"
Oops, fix the fix in rev.1.10.  logb() and logbf() were broken on
 denormals, and logb() remained broken after 1.10 because the fix for
 logbf() was incompletely translated.

Convert to __FBSDID().
"

Change-Id: I54f33648db7c421b06eee1ea8e63c57a179fae0d
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-02-28 12:28:05 +08:00
The Android Automerger
fcf16907c7 merge in jb-release history after reset to master 2012-02-27 06:59:29 -08:00
Kenny Root
93b8f941f2 Revert "Use the new NativeDaemonConnector style."
The other changes relating to this were already reverted.

This reverts commit 1625c7a837
2012-02-25 10:39:07 -08:00
Dima Zavin
906dbea2b4 libc: Add __aeabi_llsl and __aeabi_llsr to libgcc_compat
Some platform libraries built for ICS do not work with master
because of some refactoring in frameworks/base.

Make sure that these libgcc symbols are always present in our libc

Change-Id: Ib8d345878be0ba711f051082a778f5cc1f1b3a19
Signed-off-by: Dima Zavin <dima@android.com>
2012-02-24 11:38:07 -08:00
Kenny Root
83c366cf09 Merge "Revert "Use the new NativeDaemonConnector style."" 2012-02-24 11:04:56 -08:00
Kenny Root
1fb6662d1a Revert "Use the new NativeDaemonConnector style."
The other changes relating to this were already reverted.

This reverts commit 1625c7a837
2012-02-24 11:04:42 -08:00
Jean-Baptiste Queru
7dbbfac0fc am 5d8fd2a0: am a71aefc6: am d041bf20: Merge "bionic/x86: fix one potential deadlock in __set_tls()"
* commit '5d8fd2a0bc059cd07405a372c98617829f8ac378':
  bionic/x86: fix one potential deadlock in __set_tls()
2012-02-23 12:34:02 -08:00
Jean-Baptiste Queru
5d8fd2a0bc am a71aefc6: am d041bf20: Merge "bionic/x86: fix one potential deadlock in __set_tls()"
* commit 'a71aefc66f6d4bf1302e0ce5c321aff1a2c769d1':
  bionic/x86: fix one potential deadlock in __set_tls()
2012-02-23 12:32:37 -08:00
Jean-Baptiste Queru
a71aefc66f am d041bf20: Merge "bionic/x86: fix one potential deadlock in __set_tls()"
* commit 'd041bf2095f5f133c87f7ba632a8dfb39537a437':
  bionic/x86: fix one potential deadlock in __set_tls()
2012-02-23 12:29:10 -08:00
Jean-Baptiste Queru
76ab561b4d am 49a05c06: am 62daffe1: am f9c5afb1: Merge "Redesign dlopen() locks to be recursive per thread."
* commit '49a05c060acd4d3e17b2819f00a694271bf40977':
  Redesign dlopen() locks to be recursive per thread.
2012-02-23 11:20:49 -08:00
Jean-Baptiste Queru
d041bf2095 Merge "bionic/x86: fix one potential deadlock in __set_tls()" 2012-02-23 08:43:30 -08:00
Jin Wei
c5393b23f6 bionic/x86: fix one potential deadlock in __set_tls()
Fix bug:
Currently the mutex lock _tls_desc_lock is not released
when __set_thread_area() fails. That will leads to the deadlock
when __set_tls( ) is called later on.

Change-Id: Iea3267cb0659971cba7766cbc3346f6924274f86
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-02-23 17:37:58 +08:00
Dima Zavin
f1a17e762b libc: Add __aeabi_llsl and __aeabi_llsr to libgcc_compat
Some platform libraries built for ICS do not work with master
because of some refactoring in frameworks/base.

Make sure that these libgcc symbols are always present in our libc

Change-Id: Ib8d345878be0ba711f051082a778f5cc1f1b3a19
Signed-off-by: Dima Zavin <dima@android.com>
2012-02-22 15:18:56 -08:00
Jean-Baptiste Queru
49a05c060a am 62daffe1: am f9c5afb1: Merge "Redesign dlopen() locks to be recursive per thread."
* commit '62daffe147e8810ce48a897df46b0b3db95ebaa3':
  Redesign dlopen() locks to be recursive per thread.
2012-02-22 09:58:17 -08:00
Jean-Baptiste Queru
62daffe147 am f9c5afb1: Merge "Redesign dlopen() locks to be recursive per thread."
* commit 'f9c5afb1f9d8e615ab98774a10bbf117962db66d':
  Redesign dlopen() locks to be recursive per thread.
2012-02-22 09:54:52 -08:00
Jean-Baptiste Queru
f9c5afb1f9 Merge "Redesign dlopen() locks to be recursive per thread." 2012-02-22 09:30:53 -08:00
Andrew Hsieh
58b2c1616b Trivial fix in comment
Very, very trivial fix for minor typo in comment about how it works

Change-Id: Ia08d332366837dec8f7e91b9728732c5edea223e
2012-02-21 15:09:32 -08:00
Pavel Chupin
e19d702b8e Redesign dlopen() locks to be recursive per thread.
That is to fix the bug:
dlxxx functions can't be called recursively.
For example, if we use dlopen() to use open one library whose constructor
also calls dlopen() in order to open another library, then the thread is
dead-blocked.

By changing the dl_lock from a non-recursive lock to a recursive lock, we can
prevent the thread from dead-blocked by recursive dlxxx calls in the same
thread context.

Change-Id: I1018b41c82f4641cc009c0a2eda31f5a47a534f9
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-02-21 14:57:26 -08:00
The Android Automerger
f351ae488b merge in jb-release history after reset to master 2012-02-14 06:59:28 -08:00
Jean-Baptiste Queru
d6b58b03b8 am 09049311: am cfff36df: am a60ff6c5: Merge "libc: Define new symbol visibility macros"
* commit '09049311a229c427f73e3e0ac873bf344b45aaf2':
  libc: Define new symbol visibility macros
2012-02-13 14:42:48 -08:00
Jean-Baptiste Queru
09049311a2 am cfff36df: am a60ff6c5: Merge "libc: Define new symbol visibility macros"
* commit 'cfff36df2bebd95f2663b7b053c6308593c343dd':
  libc: Define new symbol visibility macros
2012-02-13 14:39:52 -08:00
Jean-Baptiste Queru
cfff36df2b am a60ff6c5: Merge "libc: Define new symbol visibility macros"
* commit 'a60ff6c5b2ca76181b387d8c10aee22a2cbcf840':
  libc: Define new symbol visibility macros
2012-02-13 14:25:53 -08:00
Jean-Baptiste Queru
a60ff6c5b2 Merge "libc: Define new symbol visibility macros" 2012-02-13 14:23:13 -08:00
The Android Automerger
8f627eec55 merge in jb-release history after reset to master 2012-02-13 08:56:04 -08:00
Glenn Kasten
32c226d6ed Merge "Allow C++ to call fdprintf" 2012-02-10 13:45:49 -08:00
Dianne Hackborn
058d6d88b9 Update bionic to know users and isolated uids for uid string representation.
Change-Id: I6681bacd69299a7f9837ef8025a80c5562081bad
2012-02-09 16:14:28 -08:00
Raghu Gandham
b69060f1ae Clean up the remnants of SuperH support 2012-02-09 15:58:46 -08:00
Glenn Kasten
f39a3fe67d Allow C++ to call fdprintf
Change-Id: I1adb7b165ab9f62eaee4e7a9108e8b461350b347
2012-02-09 10:15:45 -08:00
The Android Automerger
bec678c5a7 merge in jb-release history after reset to master 2012-02-08 06:59:26 -08:00
Robert Greenwalt
1625c7a837 Use the new NativeDaemonConnector style.
Prepend a 0 to match the new sequence-number style, though this module
doesn't really need/use it.

bug:5864209
Change-Id: Iacbcddaced6fe8bb01d186596a916e4fb4805fef
2012-02-07 11:53:55 -08:00
The Android Automerger
a7bd1bf276 merge in jb-release history after reset to master 2012-02-02 06:59:19 -08:00
David 'Digit' Turner
9db064a0d3 am 5d7181a7: am 68fc85ff: am 177a7706: linker: fix x86 build
* commit '5d7181a71c0b066fe6c19b9c5906bd694a399a59':
  linker: fix x86 build
2012-02-01 11:24:29 -08:00
David 'Digit' Turner
5d7181a71c am 68fc85ff: am 177a7706: linker: fix x86 build
* commit '68fc85ffc05aca5cc187676bd1502c3c446046d9':
  linker: fix x86 build
2012-02-01 11:22:07 -08:00
David 'Digit' Turner
68fc85ffc0 am 177a7706: linker: fix x86 build
* commit '177a77067b6d3326dbcf88fd93d0664e48e27f9f':
  linker: fix x86 build
2012-02-01 11:18:06 -08:00
David 'Digit' Turner
177a77067b linker: fix x86 build
Change-Id: I47d76a0f50515013c37ccef89accba03cc69529d
2012-02-01 10:47:04 -08:00
The Android Open Source Project
0245c426ee am 09d695d7: am 44eae4c7: Reconcile with ics-mr1-release
* commit '09d695d782007f45504841c1535e53ccf2059a68':
2012-02-01 10:03:20 -08:00
The Android Open Source Project
09d695d782 am 44eae4c7: Reconcile with ics-mr1-release
* commit '44eae4c7af901e521e2e880a8300b285bbf53010':
2012-02-01 10:00:28 -08:00
Jean-Baptiste Queru
25b7a16a6e Merge c4cb87f3
Change-Id: I4cc14eba43fde75a7702fdc7ad07d3d949e9c092
2012-02-01 09:46:08 -08:00
The Android Open Source Project
44eae4c7af Reconcile with ics-mr1-release
Change-Id: I37e2eb5cd34a47e3eb7b2bf2353b50fc14972adf
2012-02-01 08:49:24 -08:00
Jean-Baptiste Queru
c4cb87f367 Merge 5b892aa7
Change-Id: Ic82bc2866bdb0c93822c94281301fa127fd4bb0c
2012-02-01 07:12:13 -08:00
The Android Automerger
a43debbc43 merge in jb-release history after reset to master 2012-02-01 06:59:19 -08:00
David 'Digit' Turner
5fbf2e0992 libc: Define new symbol visibility macros
This patch defines a few new macros that can be used to control the
visibility of symbols exported by the C library:

- ENTRY_PRIVATE() can be used in assembly sources to indicate
  that an assembler function should have "hidden" visibility, i.e.
  will never be exported by the C library's shared library.

  This is the equivalent of using __LIBC_HIDDEN__ for a C function,
  but ENTRY_PRIVATE() works like ENTRY(), and must be used with
  END() to tag the end of the function.

- __LIBC_ABI_PUBLIC__ can be used to tag a C functions as being
  part of the C library's public ABI. This is important for a
  few functions that must be exposed by the NDK to maintain
  binary compatibility.

  Once a symbol has been tagged with this macro, it shall
  *never* be removed from the library, even if it becomes
  directly unused due to implementation changes
  (e.g. __is_threaded).

- __LIBC_ABI_PRIVATE__ can be used for C functions that should
  always be exported by the C library because they are used by
  other libraries in the platform, but should not be exposed
  by the NDK. It is possible to remove such symbols from the
  implementation if all callers are also modified.

+ Add missing END() assembly macro for x86

Change-Id: Ia96236ea0dbec41d57bea634b39d246b30e5e234
2012-01-31 22:19:09 +01:00
Jean-Baptiste Queru
5b892aa7e5 Merge "remove obsolete SuperH support" 2012-01-31 12:44:01 -08:00
David 'Digit' Turner
70b1668a76 remove obsolete SuperH support
We don't have a toolchain anymore, we don't have working original
kernel headers, and nobody is maintaining this so there is really
no point in keeping this here. Details of the patch:

- removed code paths from Android.mk files related to the SuperH
  architecture ("sh")

- removed libc/arch-sh, linker/arch-sh, libc/kernel/arch-sh

- simplified libc/SYSCALLS.TXT

- simplified the scripts in libc/tools/ and libc/kernel/tools

Change-Id: I26b0e1422bdc347489e4573e2fbec0e402f75560

Signed-off-by: David 'Digit' Turner <digit@android.com>
2012-01-31 20:28:23 +01:00
David 'Digit' Turner
b118b9c5cd Merge "libc: remove global lock from recursive mutex implementation." 2012-01-31 11:02:33 -08:00
Jeff Brown
a7ad339910 Merge "Add new suspend-block input ioctls." 2012-01-31 10:05:35 -08:00
The Android Automerger
3350468499 merge in jb-release history after reset to master 2012-01-31 06:59:17 -08:00
Jesse Hall
f5d1693e3c Fix recursive ELF constructor check
The flag to avoid calling ELF constructors recursively (in the case
of recursive .so dependencies) was being set after the dangerous
recursive constructor call had already been made.

This fixes the libc's debug malloc implementation.

Change-Id: I5e601f0ea19ab1df81b8b1ad4df25c3eab0ccda4
2012-01-30 15:39:57 -08:00
The Android Automerger
a0b800aba9 merge in jb-release history after reset to master 2012-01-30 06:59:27 -08:00
David 'Digit' Turner
e1414aa96b libc: remove global lock from recursive mutex implementation.
This optimization improves the performance of recursive locks
drastically. When running the thread_stress program on a Xoom,
the total time to perform all operations goes from 1500 ms to
500 ms on average after this change is pushed to the device.

Change-Id: I5d9407a9191bdefdaccff7e7edefc096ebba9a9d
2012-01-30 10:13:41 +01:00
Jean-Baptiste Queru
632c07c092 am cc12c74f: am e8004445: Merge "Make sure __u64 is defined even for strict ansi or -std=c99"
* commit 'cc12c74f7f65c571778989cd902eb5b9fa74fb11':
  Make sure __u64 is defined even for strict ansi or -std=c99
2012-01-27 21:09:07 -08:00
Jean-Baptiste Queru
cc12c74f7f am e8004445: Merge "Make sure __u64 is defined even for strict ansi or -std=c99"
* commit 'e80044455961005ac95e405c8d553f2418d8e50c':
  Make sure __u64 is defined even for strict ansi or -std=c99
2012-01-27 07:41:43 -08:00
Jean-Baptiste Queru
e800444559 Merge "Make sure __u64 is defined even for strict ansi or -std=c99" 2012-01-27 07:31:10 -08:00
Robert Greenwalt
514126b2b5 Merge "Increase the size of the system-wide dns cache" 2012-01-26 14:51:08 -08:00
Andy McFadden
1fc51769de Log debuggerd connection failures
Write a message to the log file if the signal handler is not able
to connect to debuggerd.  This is especially handy if the failure
was caused by running out of file descriptors, since there's some
chance that the lack of fds relates to the crash.

Sample:

 F libc    : Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
 F libc    : Unable to open connection to debuggerd: Too many open files

Bug 5926330

Change-Id: I0ff210d82ab1db39b08f328bae5e08f67a69e5d7
2012-01-26 13:40:38 -08:00
The Android Automerger
056daf6a1c merge in jb-release history after reset to master 2012-01-25 15:49:01 -08:00
Robert Greenwalt
52764f5546 Increase the size of the system-wide dns cache
32 enteries perhaps was ok for per-process caching with ipv4 only
but adding ipv6 records makes it effectively 16 entries and making
it system wide makes is pretty useless.  Increasing to 640 entries.

bug:5841178
Change-Id: I879f8bf4d3c4d8c1708bb46d46a67c1f64b1861f
2012-01-25 15:36:58 -08:00
Martin Storsjo
738b175a93 Make sure __u64 is defined even for strict ansi or -std=c99
The x86 asm headers define __u64 regardless of __STRICT_ANSI__.
The linux/videodev2.h header requires __u64 to be defined, thus
this fixes compiling with -std=c99 when including the
linux/videodev2.h header.

In glibc, the asm/types.h header defines __u64 regardless of
__STRICT_ANSI__.

This is the change for the generated arch-arm/asm/types.h
header, as produced by the update_all.py script (without all
the other unrelated changes that the script produces).

FWIW, the same issue also is present in
arch-sh/asm/types.h, but there are no source headers for
arch-sh in external/kernel-headers (and regenerating the
headers simply removes that file).

Change-Id: If05fcc9ed6ff5943602be121c7be140116e361fe
2012-01-25 23:41:19 +02:00
Jean-Baptiste Queru
8584a922dc am 482d59a4: am e22dfc46: Merge "execvp: bcopy() is deprecated. Use memcpy() instead"
* commit '482d59a42f6c81e3a142ffbf23c67a903836f203':
  execvp: bcopy() is deprecated. Use memcpy() instead
2012-01-25 08:57:30 -08:00
The Android Automerger
7cad7230ff merge in ics-release history after reset to master 2012-01-25 06:59:13 -08:00
Jean-Baptiste Queru
482d59a42f am e22dfc46: Merge "execvp: bcopy() is deprecated. Use memcpy() instead"
* commit 'e22dfc46b763e9b0c6300b7068609d2db60a9b2c':
  execvp: bcopy() is deprecated. Use memcpy() instead
2012-01-24 15:07:56 -08:00
Jean-Baptiste Queru
e22dfc46b7 Merge "execvp: bcopy() is deprecated. Use memcpy() instead" 2012-01-24 14:26:36 -08:00
David 'Digit' Turner
b70659d8ea Merge "libc: Fix recursive mutex lock implementation." 2012-01-24 09:28:29 -08:00
David 'Digit' Turner
b57db7581c libc: Fix recursive mutex lock implementation.
This fixes a bug that was introduced in the latest pthread optimization.
It happens when a recursive lock is contented by several threads. The main
issue was that the atomic counter increment in _recursive_increment() could
be annihilated by a non-conditional write in pthread_mutex_lock() used to
update the value's lower bits to indicate contention.

This patch re-introduces the use of the global recursive lock in
_recursive_increment(). This will hit performance, but a future patch
will be provided to remove it from the source code.

Change-Id: Ie22069d376cebf2e7d613ba00b6871567f333544
2012-01-24 13:20:38 +01:00
The Android Automerger
70f0e9d86d merge in ics-release history after reset to master 2012-01-23 06:59:19 -08:00
Jean-Baptiste Queru
f20d59e691 am c83c1da5: am cee8425f: Merge "Move variable declaration on its own line"
* commit 'c83c1da54831ef1c9ff59cf9df8d5c0173893ee5':
  Move variable declaration on its own line
2012-01-20 17:23:52 -08:00
Jean-Baptiste Queru
c3650d6a4b am 5b44655f: am 7e6a5773: Merge "Use the AT_SECURE auxv flag to determine whether to enable secure mode."
* commit '5b44655f22dd05c7cd8afcd218102616a6f5f4da':
  Use the AT_SECURE auxv flag to determine whether to enable secure mode.
2012-01-20 17:23:51 -08:00
Jean-Baptiste Queru
73fa5fdaf9 Merge 2f80f07d
Change-Id: Iff51b8530dbee01499ba4af0ecd6ab837c8c94fb
2012-01-20 16:47:01 -08:00
The Android Open Source Project
d8545e2690 am 8eb948d8: Reconcile with ics-mr1-release
* commit '8eb948d8c8b66d8442a45d398db4e970fb3bf68b':
2012-01-20 15:52:14 -08:00
Elliott Hughes
4a1f3cb4eb am dac52ff9: am e8e1efea: Update to tzdata2011n.
* commit 'dac52ff9f5591afda2b8c2a3d41aa08d7cab179e':
  Update to tzdata2011n.
2012-01-20 15:48:16 -08:00
Jean-Baptiste Queru
c83c1da548 am cee8425f: Merge "Move variable declaration on its own line"
* commit 'cee8425f22cfe268614c7bb47b2f5874ac6a0e4b':
  Move variable declaration on its own line
2012-01-20 11:54:49 -08:00
Jean-Baptiste Queru
5b44655f22 am 7e6a5773: Merge "Use the AT_SECURE auxv flag to determine whether to enable secure mode."
* commit '7e6a5773133e4b65d678535418b1f5d594859da2':
  Use the AT_SECURE auxv flag to determine whether to enable secure mode.
2012-01-20 11:54:48 -08:00
Jean-Baptiste Queru
2f80f07d81 am 23f56bbb: Merge "Add extended attribute (xattr) system call wrappers to bionic."
* commit '23f56bbb6ae053996dd821f29379aea0c7166055':
  Add extended attribute (xattr) system call wrappers to bionic.
2012-01-20 11:54:47 -08:00
Jean-Baptiste Queru
cee8425f22 Merge "Move variable declaration on its own line" 2012-01-20 11:07:41 -08:00
Stephen Smalley
bb44055d0a Move variable declaration on its own line
Change-Id: Ied54ffabccdc867ea4e124a0f0324a217270d6e7
2012-01-20 10:59:15 -08:00
Jean-Baptiste Queru
7e6a577313 Merge "Use the AT_SECURE auxv flag to determine whether to enable secure mode." 2012-01-20 10:43:19 -08:00
Stephen Smalley
861b42a2d8 Use the AT_SECURE auxv flag to determine whether to enable secure mode.
The Linux kernel provides an AT_SECURE auxv flag to inform userspace
whether or not a security transition has occurred.  This is more reliable
than directly checking the uid/gid against the euid/egid, because it covers
not only setuid/setgid but also file capabilities, SELinux, and AppArmor
security transitions.  It is also a more efficient test since it does
not require any additional system calls.

Change-Id: I9752a4f6da452273258d2876d13b05e402fb0409
2012-01-20 13:35:57 -05:00
Jean-Baptiste Queru
23f56bbb6a Merge "Add extended attribute (xattr) system call wrappers to bionic." 2012-01-20 10:29:22 -08:00
Jeff Brown
3452e301ec Add new suspend-block input ioctls.
Change-Id: I8cfd63d22ecf8e08f261eb576d6ea448f396f709
2012-01-19 14:27:30 -08:00
The Android Open Source Project
8eb948d8c8 Reconcile with ics-mr1-release
Change-Id: Iece5fc7cf15320addfda3f143235664e2ef3083d
2012-01-19 13:06:24 -08:00
The Android Automerger
cd24e61e57 merge in ics-release history after reset to master 2012-01-19 06:59:13 -08:00
David 'Digit' Turner
79fcc6948d Merge "libc: remove private declarations from <time.h> and <resolv.h>" 2012-01-19 04:15:38 -08:00
The Android Automerger
3d11bf0f3f merge in ics-mr1-release history after reset to ics-mr1 2012-01-18 21:16:26 -08:00
Elliott Hughes
de3c594723 am e8e1efea: Update to tzdata2011n.
* commit 'e8e1efeafb8754ea8358e78cfe3d0f7ad4e809b2':
  Update to tzdata2011n.
2012-01-18 16:34:28 -08:00
Elliott Hughes
dac52ff9f5 am e8e1efea: Update to tzdata2011n.
* commit 'e8e1efeafb8754ea8358e78cfe3d0f7ad4e809b2':
  Update to tzdata2011n.
2012-01-18 16:34:01 -08:00
Nick Kralevich
df49ebabfe Merge "Eliminate duplicate copies of constants." 2012-01-18 08:53:51 -08:00
The Android Automerger
45af9ba7c4 merge in ics-release history after reset to master 2012-01-18 06:59:12 -08:00
Stephen Smalley
5eb686d105 Add extended attribute (xattr) system call wrappers to bionic.
The xattr system calls are required for the SE Android userspace in
order to get and set file security contexts.  In particular, libselinux
requires these calls.

Change-Id: I78f5eb3d8f3384aed0a5e7c6a6f001781d982017
2012-01-18 08:02:23 -05:00
Jean-Baptiste Queru
5f926c2679 am b00d7a33: am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"
* commit 'b00d7a331c9f2a578a4cfc4dfe0d626aa58fa702':
  res_send: Avoid spurious close()s and (rare) failure
2012-01-17 18:18:29 -08:00
Jean-Baptiste Queru
b00d7a331c am eae1f1fb: Merge "res_send: Avoid spurious close()s and (rare) failure"
* commit 'eae1f1fba33cb105302227b044a14e5abcbe55e7':
  res_send: Avoid spurious close()s and (rare) failure
2012-01-17 18:16:10 -08:00
Elliott Hughes
e8e1efeafb Update to tzdata2011n.
There are three changes of note - most urgently, Cuba (America/Havana)
has extended summer time by two weeks, now to end on Nov 13, rather than
the (already past) Oct 30.   Second, the Pridnestrovian Moldavian Republic
(Europe/Tiraspol) decided not to split from the rest of Moldova after
all, and consequently that zone has been removed (again) and reinstated
in the "backward" file as a link to Europe/Chisinau.   And third, the
end date for Fiji's summer time this summer was moved forward from the
earlier planned Feb 26, to Jan 22.

Apart from that, Moldova (MD) returns to a single entry in zone.tab
(and the incorrect syntax that was in the 2011m version of that file
is so fixed - it would have been fixed in a different way had this
change not happened - that's the "missing" sccs version id).

Bug: 5863692

Change-Id: I78e29c682c623b1dec0b0ea2cb6545713ae9eed0
2012-01-17 17:47:59 -08:00
Nick Kralevich
ea29cd5a4a Eliminate duplicate copies of constants.
sys/personality.h and linux/personality.h contain mostly
identical contents. Eliminate dups.

Change-Id: Ie786edcb5dca57af7ee5b5fdad2949369f1bc4e4
2012-01-17 17:28:42 -08:00
Nick Kralevich
d6045cba4e Don't generate sys/linux-unistd.h
linux-unistd.h was here for reference purposes, but shouldn't
have been accessible to client code. Delete it.

Change-Id: I60c264ff6ca489a48117914bdf6daa486737af8c
2012-01-17 15:56:26 -08:00
Nick Kralevich
fc5ea79c5e Merge "update personality.h" 2012-01-17 15:46:54 -08:00
Jean-Baptiste Queru
eae1f1fba3 Merge "res_send: Avoid spurious close()s and (rare) failure" 2012-01-17 15:26:18 -08:00
Nick Kralevich
023e5409df am 06f51ba1: am f44de270: add personality() system call.
* commit '06f51ba1af2fafeec7fdfcba5d635bd001a31b3e':
  add personality() system call.
2012-01-17 13:09:53 -08:00
Nick Kralevich
b6f40f0027 update personality.h
Pull in an updated version of personality.h from the linux
kernel.

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/personality.h

Change-Id: I860ce21110ebf7e7499fb8165584d296a73aa602
2012-01-17 13:03:11 -08:00
Nick Kralevich
e4cb70aef3 am f44de270: add personality() system call.
* commit 'f44de270bba32c9b1b5eff8a34be07b10ddff238':
  add personality() system call.
2012-01-17 11:45:42 -08:00
Nick Kralevich
06f51ba1af am f44de270: add personality() system call.
* commit 'f44de270bba32c9b1b5eff8a34be07b10ddff238':
  add personality() system call.
2012-01-17 11:45:25 -08:00
The Android Automerger
09670ec2d1 merge in ics-release history after reset to master 2012-01-17 06:59:15 -08:00
Jim Huang
87043f9c89 res_send: Avoid spurious close()s and (rare) failure
When looping over the current list of sockets we are connected to,
use getpeername() not getsockname() to find out who the remote
end is.  This change avoids spurious close() and (rare) failure.

Origin: ISC bug #18625 and fixed in libbind 6.0

Change-Id: I5e85f9ff4b98c237978e4bf4bd85ba0a90d768e6
2012-01-14 11:30:00 +08:00
Jim Huang
28a7c35fea execvp: bcopy() is deprecated. Use memcpy() instead
The function bcopy() is marked as LEGACY in POSIX.1-2001 and removed in
POSIX.1-2008. memcpy (POSIX.1-2001) is its recommended replacement.

Change-Id: I2cc0cc4673d1368255afd11132ddbfd3f87b530b
2012-01-14 11:22:36 +08:00
The Android Automerger
43828aa3a7 merge in ics-mr1-release history after reset to ics-mr1 2012-01-13 16:16:49 -08:00
Nick Kralevich
f44de270bb add personality() system call.
Change-Id: Ie899def8ea1d705930ed83adae1343c1353e7c57
2012-01-13 15:50:40 -08:00
David 'Digit' Turner
697011d3c4 Merge "libc: Copy private C library declarations to private/" 2012-01-13 14:25:25 -08:00
Glenn Kasten
c61f990566 Fix misspelled Python variable name and typos
Typos:
 - Update pathname in README.txt
 - Fix missing newlines in header update script.

Change-Id: Ib0e053f92a27ff10071b9805fa64e5653ab31b0c
2012-01-13 07:41:20 -08:00
David 'Digit' Turner
208898ee77 libc: remove private declarations from <time.h> and <resolv.h>
This patch is used to remove private C library declarations from the
public headers (that are exported to the NDK). It should *only* be
submitted after all other patches modifying the users of said
private functions have been submitted to the tree, to avoid
breakages.

Change-Id: I0a5e3014f8e3ac9ed8df86a5cdae506337c23252
2012-01-13 14:24:08 +01:00
David 'Digit' Turner
11f3d5a431 libc: Copy private C library declarations to private/
This patch is the first in a series that aims at cleaning up the
public C library headers (which end up being distributed with the NDK).

<resolv.h> and <time.h> contain declarations that should not be public.
They are used by other parts of the platform, but NDK applications should
not use or rely on them.

So copy them to private <bionic_time.h> and <resolv_iface.h> headers
and use a guard macro to avoid conflicts when both headers are included
at the same time.

The idea is that we're going to fix the other platform modules to
include these private headers. After this is done, we will remove the
duplicate definitions from <resolv.h> and <time.h>

Change-Id: I121c11936951c98ca7165e811126ed8a4a3a394d
2012-01-13 13:26:50 +01:00
Robert Greenwalt
e4ade69654 am 82c4be54: am ecd0e95a: Adding a timeout to tcp dns lookup connects.
* commit '82c4be54da0825ebe74b524932c9db733419057a':
  Adding a timeout to tcp dns lookup connects.
2012-01-12 15:05:57 -08:00
Robert Greenwalt
a70e3eb15c am ecd0e95a: Adding a timeout to tcp dns lookup connects.
* commit 'ecd0e95a0276c1ba72c7331f5e4617815f015f22':
  Adding a timeout to tcp dns lookup connects.
2012-01-12 15:04:09 -08:00
Robert Greenwalt
82c4be54da am ecd0e95a: Adding a timeout to tcp dns lookup connects.
* commit 'ecd0e95a0276c1ba72c7331f5e4617815f015f22':
  Adding a timeout to tcp dns lookup connects.
2012-01-12 15:03:52 -08:00
Robert Greenwalt
ecd0e95a02 Adding a timeout to tcp dns lookup connects.
TCP isn't supported on some dns servers, which makes the old code
hang forever.

NOT adding a stopship to remove debugging stuff - it was too painful
(14s timeout on failed tcp dns lookups) so we decided not to bother people.

bug:5766949
Change-Id: I381c20c3e11b8e994438d4f7c58ef643cd36554e
2012-01-12 14:26:41 -08:00
The Android Automerger
348eea2dbe merge in ics-release history after reset to master 2012-01-12 14:11:59 -08:00
David Turner
5977ee02f6 Merge "Execute .preinit_array before any shared object initialization functions." 2012-01-12 01:04:46 -08:00
Evgeniy Stepanov
e83c56dfbb Execute .preinit_array before any shared object initialization functions.
This change makes linker handling of .preinit_array compliant with the
System V ABI:

"These [pre-initialization] functions are executed after the dynamic linker has
built the process image and performed relocations but before any shared object
initialization functions."
http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#init_fini

Change-Id: Iebfee22bb1ebe1d7c7e69cb4686e4ebae0dfc4bb
2012-01-10 13:30:41 +04:00
The Android Automerger
13585da4b4 merge in ics-release history after reset to master 2012-01-09 06:59:16 -08:00
Mathias Agopian
68d03fdbd8 Merge "implement pthread mutex deadlock detection" 2012-01-05 14:05:30 -08:00
The Android Automerger
f40d3e7608 merge in ics-release history after reset to master 2012-01-04 06:59:09 -08:00
Bruce Beare
6519c8124e am e30e9093: sreadahead: adding readahead system call into bionic libc
* commit 'e30e909363c5c706f394050d9cd00ce222caadbf':
  sreadahead: adding readahead system call into bionic libc
2012-01-03 18:37:28 -08:00
Bruce Beare
e30e909363 sreadahead: adding readahead system call into bionic libc
Add bionic libc to support readahead system call.
This is needed to enable sreadahead to work.

Change-Id: I3856e1a3833db82e6cf42fd34af7631bd40cc723
Author: Winson Yung <winson.w.yung@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-01-03 15:18:04 -08:00
The Android Automerger
646ca9f1c9 merge in ics-release history after reset to master 2011-12-21 06:59:12 -08:00
Ken Sumrall
334379dada Merge "Add the posix_memalign(3) function to bionic" 2011-12-20 15:06:52 -08:00
The Android Automerger
f920b20654 merge in ics-release history after reset to master 2011-12-20 06:59:10 -08:00
Bruce Beare
5936e36f6b am a37f3729: readdir: fix interface to kernel getdents64 function
* commit 'a37f3729730e4e7345977915d67adc3eea93dfe4':
  readdir: fix interface to kernel getdents64 function
2011-12-19 11:36:48 -08:00
Bruce Beare
a37f372973 readdir: fix interface to kernel getdents64 function
Issue:
  The kernel will pad the entry->d_reclen in a getdents64 call to a
  long-word boundary.  For very long records, this could exceed the
  size of a struct dirent. The mismatch in the size was causing error
  paranoid checking code in bionic to fail... thus causing an early
  "end" when reading the dirent structures from the kernel buffer.

Test:
 ls
 mkdir abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu
 ls

Change-Id: I75d1f8e45e1655fdd7bac4a08a481d086f28073a
Author: Bruce Beare <bruce.j.beare@intel.com>
2011-12-19 09:38:48 -08:00
The Android Automerger
fbc3abcbfc merge in ics-release history after reset to master 2011-12-15 06:59:15 -08:00
Ken Sumrall
85aad90956 Add the posix_memalign(3) function to bionic
The posix_memalign(3) function is very similar to the traditional
memalign(3) function, but with better error reporting and a guarantee
that the memory it allocates can be freed.  In bionic, memalign(3)
allocated memory can be freed, so posix_memalign(3) is just a wrapper
around memalign(3).

Change-Id: I62ee908aa5ba6b887d8446a00d8298d080a6a299
2011-12-14 20:55:43 -08:00
David 'Digit' Turner
a5cb76bca0 libc: x86: Use SSE2 or SSSE3 optimized routines when possible.
This patch uses the new hardware feature macros for x86 to define
various compile-time macros used to make the C library use
SSE2 and/or SSSE3 optimized memory functions for target CPUs
that support these features.

Note that previously, we relied on the macros being defined by
build/core/combo/TARGET_linux-x86.mk, but this is no longer the
case.

Change-Id: Ieae5ff5284c0c839bc920953fb6b91d2f2633afc
2011-12-14 18:23:40 +01:00
The Android Automerger
3ea9368d92 merge in ics-release history after reset to master 2011-12-14 06:59:15 -08:00
The Android Open Source Project
f6aa779383 am c2d5944e: Reconcile with ics-mr1-release
* commit 'c2d5944e19863bb2d831b13893a3bb78e0d53783':
2011-12-13 19:11:25 -08:00
The Android Open Source Project
c2d5944e19 Reconcile with ics-mr1-release
Change-Id: I62bace5c4272d043a51d3f0f698556716838aa51
2011-12-13 19:10:03 -08:00
Erik Gilling
ddaa771cd5 am 8d28b043: am 94963af2: update video/dsscomp.h
* commit '8d28b043e93d323684add3406ebae6b8fe6475d5':
  update video/dsscomp.h
2011-12-13 17:29:12 -08:00
Erik Gilling
24aae1b1d4 am 94963af2: update video/dsscomp.h
* commit '94963af28e445384e19775a838a29e6a71708179':
  update video/dsscomp.h
2011-12-13 16:03:09 -08:00
Erik Gilling
8d28b043e9 am 94963af2: update video/dsscomp.h
* commit '94963af28e445384e19775a838a29e6a71708179':
  update video/dsscomp.h
2011-12-13 16:02:50 -08:00
The Android Automerger
55b9099976 merge in ics-release history after reset to master 2011-12-13 06:59:15 -08:00
Bruce Beare
e2bb45a7c0 am f3087c6e: am af96d4da: x86: libc may use the gcc flags from TARGET_linux-x86.mk
* commit 'f3087c6e86f54874538669d899d8a2ede59f7433':
  x86: libc may use the gcc flags from TARGET_linux-x86.mk
2011-12-12 15:39:04 -08:00
Bruce Beare
cb4d9c0e1d am 68ec71eb: am 7d03c9cb: pathconf: dead loop in bionic function __2_symlinks
* commit '68ec71ebd6df12596dc5688c907c76ea4b32c9b4':
  pathconf: dead loop in bionic function __2_symlinks
2011-12-12 15:30:11 -08:00
The Android Open Source Project
e2cb764778 am c14ea96f: Reconcile with ics-mr1-release
* commit 'c14ea96f2f4e36f7a3b3d9676df845afb09c2245':
2011-12-12 15:29:53 -08:00
Erik Gilling
61f90d1898 am ffe65783: am bba5c314: update video/dsscomp.h
* commit 'ffe65783b4afc3f687a54b582a4e236caa22ed30':
  update video/dsscomp.h
2011-12-12 12:34:57 -08:00
Bruce Beare
f3087c6e86 am af96d4da: x86: libc may use the gcc flags from TARGET_linux-x86.mk
* commit 'af96d4dadc3f3d8466dbbeaf3a816e6871715fbc':
  x86: libc may use the gcc flags from TARGET_linux-x86.mk
2011-12-09 16:19:30 -08:00
Mathias Agopian
7c0c379372 implement pthread mutex deadlock detection
this works by building a directed graph of acquired
pthread mutexes and making sure there are no loops in
that graph.

this feature is enabled with:

    setprop debug.libc.pthread 1

when a potential deadlock is detected, a large warning is
output to the log with appropriate back traces.

currently disabled at compile-time. set PTHREAD_DEBUG_ENABLED=1
to enable.

Change-Id: I916eed2319599e8aaf8f229d3f18a8ddbec3aa8a
2011-12-09 14:38:57 -08:00
The Android Open Source Project
b7590d784f am c448c082: Reconcile with ics-mr1-release
* commit 'c448c082cf834f95afcfa3296eba2c67780727cf':
2011-12-09 14:25:56 -08:00
Bruce Beare
af96d4dadc x86: libc may use the gcc flags from TARGET_linux-x86.mk
Change-Id: Iaf4d864d4b6fe388bd3c2d7c4d7d6e42aebb0d35
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-09 13:54:20 -08:00
Bruce Beare
68ec71ebd6 am 7d03c9cb: pathconf: dead loop in bionic function __2_symlinks
* commit '7d03c9cbcedb1dc7e3a8210ac0001120558ec6df':
  pathconf: dead loop in bionic function __2_symlinks
2011-12-09 10:19:37 -08:00
The Android Open Source Project
c14ea96f2f Reconcile with ics-mr1-release
Change-Id: I0a43c4d104894fdde4eff9970bc78ed0aeb88ec2
2011-12-09 07:10:40 -08:00
Erik Gilling
cb9e9ccb2b am bba5c314: update video/dsscomp.h
* commit 'bba5c314b2420483e2c0e3e441bf54bda6935bc1':
  update video/dsscomp.h
2011-12-08 14:57:32 -08:00
Erik Gilling
ffe65783b4 am bba5c314: update video/dsscomp.h
* commit 'bba5c314b2420483e2c0e3e441bf54bda6935bc1':
  update video/dsscomp.h
2011-12-08 14:57:00 -08:00
The Android Open Source Project
c448c082cf Reconcile with ics-mr1-release
Change-Id: Icc9d31cb9a4f379354808a4c7e913685dfa22e80
2011-12-08 10:17:32 -08:00
The Android Automerger
d6da8336b8 merge in ics-release history after reset to master 2011-12-08 06:59:13 -08:00
David 'Digit' Turner
022d303116 libc: optimize pthread mutex lock/unlock operations (1/2)
This patch provides several small optimizations to the
implementation of mutex locking and unlocking. Note that
a following patch will get rid of the global recursion
lock, and provide a few more aggressive changes, I
though it'd be simpler to split this change in two parts.

+ New behaviour: pthread_mutex_lock et al now detect
  recursive mutex overflows and will return EAGAIN in
  this case, as suggested by POSIX. Before, the counter
  would just wrap to 0.

- Remove un-necessary reloads of the mutex value from memory
  by storing it in a local variable (mvalue)

- Remove un-necessary reload of the mutex value by passing
  the 'shared' local variable to _normal_lock / _normal_unlock

- Remove un-necessary reload of the mutex value by using a
  new macro (MUTEX_VALUE_OWNER()) to compare the thread id
  for recursive/errorcheck mutexes

- Use a common inlined function to increment the counter
  of a recursive mutex. Also do not use the global
  recursion lock in this case to speed it up.

Change-Id: I106934ec3a8718f8f852ef547f3f0e9d9435c816
2011-12-07 22:09:48 +01:00
David 'Digit' Turner
6c6de44f04 libc: optimize pthread_once() implementation.
This patch changes the implementation of pthread_once()
to avoid the use of a single global recursive mutex. This
should also slightly speed up the non-common case where
we have to call the init function, or wait for another
thread to finish the call.

Change-Id: I8a93f4386c56fb89b5d0eb716689c2ce43bdcad9
2011-12-07 22:06:36 +01:00
Bruce Beare
7d03c9cbce pathconf: dead loop in bionic function __2_symlinks
Fix dead loops in file ./bionic/libc/unistd/pathconf.c

Change-Id: I7a1e6bcd9879c96bacfd376b88a1f899793295c8
Author: Jin Wei <wei.a.jin@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-07 09:47:20 -08:00
The Android Automerger
6855359e57 merge in ics-release history after reset to master 2011-12-07 06:59:12 -08:00
Rabin Vincent
6e9d51701e am a73de44b: am 177ba8cb: Prevent deadlock when using fork
* commit 'a73de44b7c0a50908ea8afe16134316cfc6cfbbe':
  Prevent deadlock when using fork
2011-12-06 16:04:56 -08:00
Rabin Vincent
a73de44b7c am 177ba8cb: Prevent deadlock when using fork
* commit '177ba8cb42ed6d232e7c8bcad5e6ee21fc51a0e8':
  Prevent deadlock when using fork
2011-12-06 13:59:56 -08:00
Rabin Vincent
177ba8cb42 Prevent deadlock when using fork
When forking of a new process in bionic, it is critical that it
does not allocate any memory according to the comment in
java_lang_ProcessManager.c:
"Note: We cannot malloc() or free() after this point!
A no-longer-running thread may be holding on to the heap lock, and
an attempt to malloc() or free() would result in deadlock."
However, as fork is using standard lib calls when tracing it a bit,
they might allocate memory, and thus causing the deadlock.
This is a rewrite so that the function cpuacct_add, that fork calls,
will use system calls instead of standard lib calls.

Signed-off-by: christian bejram <christian.bejram@stericsson.com>

Change-Id: Iff22ea6b424ce9f9bf0ac8e9c76593f689e0cc86
2011-12-06 08:39:18 -08:00
Jean-Baptiste Queru
c5819d427d Merge 35765066 from ics-mr1-plus-aosp
Change-Id: Ibaeb49dc20f3c736417d5cb68769e7b501a61632
2011-12-06 08:35:08 -08:00
The Android Automerger
04c3d4d709 merge in ics-release history after reset to master 2011-12-06 06:59:14 -08:00
Bruce Beare
6d77a81456 am cb835cd7: am cb1df916: string: Fix wrong comparison semantics
* commit 'cb835cd77c8e60b4a9fb8a54a06d4fd4039ae1b0':
  string: Fix wrong comparison semantics
2011-12-05 22:13:21 -08:00
Bruce Beare
35765066b9 am e4a21c89: signal: Align the sigset_t size passed to from user space to kernel.
* commit 'e4a21c89a8b24b32f7a2637b45522dfa59f2aaa4':
  signal: Align the sigset_t size passed to from user space to kernel.
2011-12-05 22:12:08 -08:00
Bruce Beare
cb835cd77c am cb1df916: string: Fix wrong comparison semantics
* commit 'cb1df9161666db2a312814752de67fc623149a9b':
  string: Fix wrong comparison semantics
2011-12-05 22:12:07 -08:00
Bruce Beare
e4a21c89a8 signal: Align the sigset_t size passed to from user space to kernel.
Pass kernel space sigset_t size to __rt_sigprocmask to workaround
the miss-match of NSIG/sigset_t definition between kernel and bionic.

Note: Patch originally from Google...
Change-Id: I4840fdc56d0b90d7ce2334250f04a84caffcba2a
Signed-off-by: Chenyang Du <chenyang.du@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-05 18:37:33 -08:00
Bruce Beare
cb1df91616 string: Fix wrong comparison semantics
Chars are signed for x86 -- correct the comparison semantics.

Change-Id: I2049e98eb063c0b4e83ea973d3fcae49c6817dde
Author: Liubov Dmitrieva <liubov.dmitrieva@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-12-05 18:37:10 -08:00
Bruce Beare
aed4a4c90b am 75039baf: am 89d3fdca: MALLOC_DEBUG: enable the option libc.debug.malloc = 10
* commit '75039bafde8e6f03caffa9d6aa7142a09ba50952':
  MALLOC_DEBUG: enable the option libc.debug.malloc = 10
2011-12-05 17:02:20 -08:00
Bruce Beare
75039bafde am 89d3fdca: MALLOC_DEBUG: enable the option libc.debug.malloc = 10
* commit '89d3fdcae26980bf81a4622c3c83e48ead4c1c3a':
  MALLOC_DEBUG: enable the option libc.debug.malloc = 10
2011-12-05 17:01:13 -08:00
Nick Kralevich
253b763160 get rid of unused "main" function.
confuses gdb.

Change-Id: I1c64357ce122fe5a2564ee96bb4caa32b733f6ea
2011-12-05 16:09:30 -08:00
Bruce Beare
89d3fdcae2 MALLOC_DEBUG: enable the option libc.debug.malloc = 10
Fix the compile warning to let the libc.debug.malloc=10 works well
Due to unsuitable value comparison, which cause compiler optimize the
code of comparing two digits.

Change-Id: I0bedd596c9ca2ba308fb008da20ecb328d8548f5
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Author: liu chuansheng <chuansheng.liu@intel.com>
2011-12-05 14:58:55 -08:00
The Android Automerger
5e7783097a merge in ics-release history after reset to master 2011-12-01 06:59:15 -08:00
Jack Ren
bec5dec947 am 0c3d21e6: am e480fc83: bionic: fix pthread_{create, exit}/signal race condition
* commit '0c3d21e63c6e75ae73aaf2b8d64af0bd8caa6beb':
  bionic: fix pthread_{create, exit}/signal race condition
2011-11-30 10:50:59 -08:00
Jack Ren
338a06f4bc am 621df526: am 31e72bc3: bionic: fix __get_tls( ) crash issue
* commit '621df52644cc19001688c0964ad425c5ed6c8990':
  bionic: fix __get_tls( ) crash issue
2011-11-30 10:50:58 -08:00
Zhenghua Wang
0e0bd58631 am 1ad08626: am 897815a1: bionic: add machine type check
* commit '1ad08626a143dc684e92f56754c7176cc4914ce8':
  bionic: add machine type check
2011-11-30 10:50:57 -08:00
The Android Automerger
d999c93401 merge in ics-release history after reset to master 2011-11-30 06:59:12 -08:00
Jack Ren
0c3d21e63c am e480fc83: bionic: fix pthread_{create, exit}/signal race condition
* commit 'e480fc83b2887388d469eb3bf58c86c610f5b082':
  bionic: fix pthread_{create, exit}/signal race condition
2011-11-29 22:42:32 -08:00
Jack Ren
621df52644 am 31e72bc3: bionic: fix __get_tls( ) crash issue
* commit '31e72bc3289acdd85b0b745fbf64c5949ca33432':
  bionic: fix __get_tls( ) crash issue
2011-11-29 22:42:31 -08:00
Zhenghua Wang
1ad08626a1 am 897815a1: bionic: add machine type check
* commit '897815a1feff230be3ea42655a77dcbb9a8dcca9':
  bionic: add machine type check
2011-11-29 22:42:30 -08:00
Jack Ren
e480fc83b2 bionic: fix pthread_{create, exit}/signal race condition
(1) in pthread_create:
    If the one signal is received before esp is subtracted by 16 and
    __thread_entry( ) is called, the stack will be cleared by kernel
    when it tries to contruct the signal stack frame. That will cause
    that __thread_entry will get a wrong tls pointer from the stack
    which leads to the segment fault when trying to access tls content.

(2) in pthread_exit
    After pthread_exit called system call unmap(), its stack will be
    freed.  If one signal is received at that time, there is no stack
    available for it.

Fixed by subtracting the child's esp by 16 before the clone system
call and by blocking signal handling before pthread_exit is started.

Author: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-11-29 17:09:51 -08:00
Jack Ren
31e72bc328 bionic: fix __get_tls( ) crash issue
When running the stress test of pthread create/destroy, a crash may
oocur in __get_tls(). That is caused by the race condition with __set_tls( ):

Author: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-11-29 17:09:15 -08:00
Zhenghua Wang
897815a1fe bionic: add machine type check
android linker doesn't check machine type, it may load some
libraries which it doesn't support sometimes.

Author: Zhenghua Wang <zhenghua.wang@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2011-11-29 17:01:08 -08:00
Robert Greenwalt
e796d39d80 Merge "Request both v4 and v6 dns when on secondary net" 2011-11-29 15:48:48 -08:00
Nick Kralevich
495f16cbac update capabilities.h
Pull in an updated version of capabilities.h from the linux
kernel.

This file was generated using the following command:

cd bionic/libc/kernel/
./tools/clean_header.py -u ../../../external/kernel-headers/original/linux/capability.h

Change-Id: I43c8f014954f543858006f24e60a2e69955349da
2011-11-28 13:42:50 -08:00
The Android Automerger
86ad80b6be merge in ics-release history after reset to master 2011-11-28 12:23:08 -08:00
David 'Digit' Turner
f1a39dce60 libc: Fix typo that broke NDK compatibility.
The function must be named __atomic_cmpxchg, not __android_cmpxchg.
This typo broke existing prebuilt binaries (they couldn't be loaded
at runtime anymore).

Change-Id: I25ca7d18329817f0056e616a0409113269ad7b1f
2011-11-23 14:38:36 +01:00
Robert Greenwalt
ca6fe7bebe Request both v4 and v6 dns when on secondary net
We can't easily tell the protocol family of the secondary network,
so try both and trust that the carrier has configured dns servers
according to the protocols supported on its network.

bug:5468224
Change-Id: If4f017573d313a6ad8354574076de6d63d43b444
2011-11-22 15:24:44 -08:00
David 'Digit' Turner
de44d0b2bd Merge "libc: provide atomic operations will full barriers for NDK apps." 2011-11-22 02:10:06 -08:00
Jeff Brown
95a17848d3 Merge "Add tgkill syscall." 2011-11-21 13:13:26 -08:00
Jeff Brown
10c8ce59a4 Add tgkill syscall.
Use tgkill instead of tkill to implement pthread_kill.
This is safer in the event that the thread has already terminated
and its id has been reused by a different process.

Change-Id: Ied715e11d7eadeceead79f33db5e2b5722954ac9
2011-11-18 16:40:48 -08:00
The Android Open Source Project
f638339d09 Reconcile with ics-mr1-release
Change-Id: I5bf77ac8b8c77cf7a075c6f0ffa99fa696ce13d3
2011-11-18 15:42:18 -08:00
Nick Kralevich
5f64df4bc3 ASLR: enable pthread stack location randomization
Allow the kernel to choose a memory location to put the
thread stack, rather than hard coding 0x10000000

Change-Id: Ib1f37cf0273d4977e8d274fbdab9431ec1b7cb4f
2011-11-18 10:07:12 -08:00
The Android Automerger
71b9eedbea merge in ics-release history after reset to master 2011-11-17 06:59:15 -08:00
Nick Kralevich
7e2daefe6c Merge "Make the linker relocatable." 2011-11-16 10:43:56 -08:00
David 'Digit' Turner
0fec6b9d88 libc: provide atomic operations will full barriers for NDK apps.
__atomic_cmpxchg and other related atomic operations did not
provide memory barriers, which can be a problem for non-platform
code that links against them when it runs on multi-core devices.

This patch does two things to fix this:

- It modifies the existing implementation of the functions
  that are exported by the C library to always provide
  full memory barriers. We need to keep them exported by
  the C library to prevent breaking existing application
  machine code.

- It also modifies <sys/atomics.h> to only export
  always-inlined versions of the functions, to ensure that
  any application code compiled against the new header will
  not rely on the platform version of the functions.

  This ensure that said machine code will run properly on
  all multi-core devices.

This is based on the GCC built-in sync primitives.

The end result should be only slightly slower than the
previous implementation.

Note that the platform code does not use these functions
at all. A previous patch completely removed their usage in
the pthread and libstdc++ code.

+ rename arch-arm/bionic/atomics_arm.S to futex_arm.S
+ rename arch-x86/bionic/atomics_x86.S to futex_x86.S
+ remove arch-x86/include/sys/atomics.h which already
  provided inlined functions to the x86 platform.

Change-Id: I752a594475090cf37fa926bb38209c2175dda539
2011-11-16 17:37:15 +01:00
David 'Digit' Turner
b385229837 Merge "libc: speed-up flockfile()/funlockfile()" 2011-11-16 07:31:31 -08:00
David Turner
90c4c1e82b Merge "bionic: Do not use <sys/atomics.h> for platform code." 2011-11-16 07:29:59 -08:00
David 'Digit' Turner
e31bfae2ba bionic: Do not use <sys/atomics.h> for platform code.
We're going to modify the __atomic_xxx implementation to provide
full memory barriers, to avoid problems for NDK machine code that
link to these functions.

First step is to remove their usage from our platform code.
We now use inlined versions of the same functions for a slight
performance boost.

+ remove obsolete atomics_x86.c (was never compiled)

NOTE: This improvement was benchmarked on various devices.
      Comparing a pthread mutex lock + atomic increment + unlock
      we get:

  - ARMv7 emulator, running on a 2.4 GHz Xeon:
       before: 396 ns    after: 288 ns

  - x86 emulator in KVM mode on same machine:
       before: 27 ns     after: 27 ns

  - Google Nexus S, in ARMv7 mode (single-core):
       before: 82 ns     after: 76 ns

  - Motorola Xoom, in ARMv7 mode (multi-core):
       before: 121 ns    after: 120 ns

The code has also been rebuilt in ARMv5TE mode for correctness.

Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
2011-11-16 16:28:10 +01:00
The Android Automerger
a938409c0e merge in ics-release history after reset to master 2011-11-16 06:59:17 -08:00
Eino-Ville Talvala
fd7d5acdeb am 0d9f87a3: Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
* commit '0d9f87a3b71057cf804b2d7aa8589e3bf94eab28':
  Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
2011-11-15 18:25:18 -08:00
Eino-Ville Talvala
87426ed37a am 0d9f87a3: Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
* commit '0d9f87a3b71057cf804b2d7aa8589e3bf94eab28':
  Add auto-exposure/auto-white balance lock support to soc2030 image sensor.
2011-11-15 16:45:26 -08:00
David 'Digit' Turner
8180b08fb2 linker: Fix the computation of si->base
The computation of si->base assumed that the first entry in the
program header table is a PT_PHDR. This results in the dynamic
linker crashing with a SIGSEGV/MAPERR when trying to load some
of the NDK unit test programs, which happen to have an EXIDX
header first, followed byu a PHDR one.

This patch fixes the computation by parsing the program header
table, looking explicitely for the PHDR entry. This fixes the
load of the NDK unit test programs, and doesn't affect system
libraries.

Change-Id: Id18ea6037dbe950b5abbbce816c2960321f0b81d
2011-11-15 17:17:28 +01:00
The Android Automerger
2f3309c9e3 merge in ics-release history after reset to master 2011-11-15 06:59:11 -08:00
David 'Digit' Turner
9831ad3ce6 libc: speed-up flockfile()/funlockfile()
For Honeycomb, we added proper file thread-safety for
all FILE* operations. However, we did implement that by
using an out-of-band hash table to map FILE* pointers
to phtread_mutex_t mutexes, because we couldn't change
the size of 'struct _sFILE' without breaking the ABI.

It turns out that our BSD-derived code already has
some support code to extend FILE* objects, so use it
instead. See libc/stdio/fileext.h

This patch gets rid of the hash table, and put the
mutex directly into the sFILE extension.

Change-Id: If1c3fe0a0a89da49c568e9a7560b7827737ff4d0
2011-11-15 13:16:42 +01:00
Nick Kralevich
4b469eae40 Merge "generate PIC code." 2011-11-14 15:12:43 -08:00
David 'Digit' Turner
9bf330b567 libc: fix the pthread_sigmask implementation
The old code didn't work because the kernel expects a 64-bit sigset_t
while the one provided by our ABI is only 32-bit. This is originally
due to the fact that the kernel headers themselves define sigset_t
as a 32-bit type when __KERNEL__ is not defined (apparently to cater
to libc5 or some similarly old C library).

We can't modify the size of sigset_t without breaking the NDK ABI,
so instead perform runtime translation during the call.

Change-Id: Ibfdc3cbceaff864af7a05ca193aa050047b4773f
2011-11-14 22:57:24 +01:00
Nick Kralevich
468319ce4f Make the linker relocatable.
Previously, the linker always loaded itself into the same
location in memory, which inhibited the effectiveness of Android's
ASLR implementation. Modify the linker code so it can be relocatable
and link itself at runtime.

Change-Id: Ia80273d7a00ff648b4da545f4b69debee6343968
2011-11-11 18:01:53 -08:00
Nick Kralevich
0aa8289c6f generate PIC code.
Change-Id: I6740c30e2782ae203aa7ddaeaf3b233e90de9c4d
2011-11-11 17:28:59 -08:00
The Android Automerger
16e818f90b merge in ics-release history after reset to master 2011-11-06 06:59:20 -08:00
Nick Kralevich
7939908c83 linker: set LOCAL_NO_CRT := true
Use LOCAL_NO_CRT to prevent linking against crtbegin.o, rather than
messing with build rules. This also prevents linking against crtend.o,
which isn't needed for the linker.

Change-Id: I0c5b9999be7e8676560fe145c1c033ffce8db4d1
2011-11-04 10:22:55 -07:00
Nick Kralevich
8e8a7b1f0f Revert "Make the linker relocatable."
This reverts commit 994e9a5ed1.

Broke x86 build.
2011-11-03 09:25:06 -07:00
Nick Kralevich
994e9a5ed1 Make the linker relocatable.
Previously, the linker always loaded itself into the same
location in memory, which inhibited the effectiveness of Android's
ASLR implementation. Modify the linker code so it can be relocatable
and link itself at runtime.

Change-Id: I90d064743abdd29450ac0482ed28752b2196286c
2011-11-02 16:20:06 -07:00
The Android Automerger
9bf1daaaf9 merge in ics-release history after reset to master 2011-11-01 06:59:13 -07:00
Elliott Hughes
29992cf978 Merge "Update to tzdata2011n." 2011-10-31 14:43:50 -07:00
Elliott Hughes
f3dbdbe269 Update to tzdata2011n.
There are three changes of note - most urgently, Cuba (America/Havana)
has extended summer time by two weeks, now to end on Nov 13, rather than
the (already past) Oct 30.   Second, the Pridnestrovian Moldavian Republic
(Europe/Tiraspol) decided not to split from the rest of Moldova after
all, and consequently that zone has been removed (again) and reinstated
in the "backward" file as a link to Europe/Chisinau.   And third, the
end date for Fiji's summer time this summer was moved forward from the
earlier planned Feb 26, to Jan 22.

Apart from that, Moldova (MD) returns to a single entry in zone.tab
(and the incorrect syntax that was in the 2011m version of that file
is so fixed - it would have been fixed in a different way had this
change not happened - that's the "missing" sccs version id).

Change-Id: I7a0fba88d1fc6face649648013aaf2b111c29d7f
2011-10-31 14:11:32 -07:00
The Android Open Source Project
31f0610798 Reconcile with ics-mr1-release
Change-Id: Ifc8b7e46968eb77bb47eb85274aa7ab35ed36925
2011-10-31 13:19:03 -07:00
Ed Heyl
143970a5b0 keep previous history after reset to mr1 plus aah changes (ics-aah-wip) 2011-10-28 19:05:43 +00:00
Ed Heyl
125207c307 undo reset to ics-mr1 until we have a better method 2011-10-26 21:53:16 +00:00
Ed Heyl
c8be370b34 reset to ics-mr1, but keep history 2011-10-26 18:50:08 +00:00
The Android Automerger
98873f6540 merge in ics-release history after reset to master 2011-10-25 07:14:09 -07:00
Elliott Hughes
a5c0d72bfb am bcb2edac: Update to tzdata2011m.
* commit 'bcb2edac654962758c6d7d8d3e0e4cdcb75c89fc':
  Update to tzdata2011m.
2011-10-24 11:24:28 -07:00
Elliott Hughes
bcb2edac65 Update to tzdata2011m.
Fixes for Europe/Tiraspol (Moldova) and all four Ukrainian zones.

Also show the MD5 of the downloaded data, for comparison against the MD5
given in the announcement mails. (There's a plan to move to proper signing,
but that's not implemented on their end yet.)

Change-Id: I845e6f125c0f54298abadc643adfeca2eff4827a
2011-10-24 10:52:14 -07:00
Nick Kralevich
9ab38c67eb am d9ad6234: Add linker support for PIE
* commit 'd9ad62343c2db6b66a5fa597c9b20a6faabd7a9a':
  Add linker support for PIE
2011-10-24 08:45:00 -07:00
Nick Kralevich
d9ad62343c Add linker support for PIE
Modify the dynamic linker so that executables can be loaded
at locations other than 0x00000000.

Modify crtbegin* so that non-PIC compilant "thumb interwork
veneers" are not created by the linker.

Bug: 5323301
Change-Id: Iece0272e2b708c79034f302c20160e1fe9029588
2011-10-22 13:19:23 -07:00
Jesse Wilson
c66f220c44 am b0641d4a: Merge "Use ENTRY and EXIT macros for strcmp, memcpy, atexit."
* commit 'b0641d4a446fa98c72fd6252e5a5ca7e44c41f1f':
  Use ENTRY and EXIT macros for strcmp, memcpy, atexit.
2011-10-12 17:43:06 -07:00
Elliott Hughes
f5c6dc8b7c am faa7c1d2: Update to tzdata2011l.
* commit 'faa7c1d29f9ed0b3eb252bb0bd43e7596eed5d9c':
  Update to tzdata2011l.
2011-10-10 14:51:37 -07:00
David 'Digit' Turner
b7001bce52 am 0a1b306f: am 32ca348e: am ce0d646c: resolved conflicts for merge of 6cda7b62 to gingerbread-plus-aosp
* commit '0a1b306fe1e86b4d218506d2d3d3e72df8f795ba':
  Bionic: x86: Fix libm macro definitions
2011-09-30 05:46:33 -07:00
Lorenzo Colitti
74cf48f0c1 am 229ab1a3: Merge "Send both A and AAAA queries if all probes fail."
* commit '229ab1a33ea79fcea42302fbe9680a6c1047325f':
  Send both A and AAAA queries if all probes fail.
2011-09-29 10:53:51 -07:00
Lorenzo Colitti
b99c197b27 am 4638822f: Merge "Revert "Use framework hints to determine dns query type.""
* commit '4638822fc07aae8cc08600c85c16183ed8d5ef79':
  Revert "Use framework hints to determine dns query type."
2011-09-29 10:53:50 -07:00
Mathias Agopian
451159035a am bda5da07: fix prototype of dladdr
* commit 'bda5da074eab4bdf374e1f4a19d480c62c72f5ff':
  fix prototype of dladdr
2011-09-28 15:18:12 -07:00
Elliott Hughes
3abc9d98c9 am 00964912: Update to tzdata2011k.
* commit '00964912745f0bb7e081f84ddcc74940f973149f':
  Update to tzdata2011k.
2011-09-26 11:23:50 -07:00
Robert Greenwalt
3ec1bd2c7a am 924c8785: am 8af58f0f: Use framework hints to determine dns query type.
* commit '924c8785f0b0822ab23a8a8917d312b7c5f63243':
  Use framework hints to determine dns query type.
2011-09-22 23:44:57 -07:00
JP Abgrall
26bee12899 am 77160041: am 3884bfe9: libc: popen: work around data corruption
* commit '771600415f41b9075b83dcf1e5395d2292ea05b2':
  libc: popen: work around data corruption
2011-09-17 16:33:55 -07:00
Glenn Kasten
370bbc5dea am d53cae0e: Add non-NDK internal API __pthread_gettid
* commit 'd53cae0e45dafdb3a83ccc3675051c0aee532111':
  Add non-NDK internal API __pthread_gettid
2011-09-16 14:45:24 -07:00
Erik Gilling
d0e629a68e am b8ef90d6: update linux/fb.h
* commit 'b8ef90d67950c5d4e04f95c30e164e924f41f70a':
  update linux/fb.h
2011-09-14 12:08:54 -07:00
Elliott Hughes
268bec521c am 5da3ed17: Merge "Update to tzdata2011j."
* commit '5da3ed177c52cdd8344b86f9b95b08b6aa473210':
  Update to tzdata2011j.
2011-09-12 11:22:57 -07:00
Erik Gilling
fa6128ad17 am 763230ae: update kernel video/dsscomp.h
* commit '763230ae5509da3ec83cde5bf6ce54dd728a0adf':
  update kernel video/dsscomp.h
2011-09-07 12:55:18 -07:00
Robert Greenwalt
2d461c7c00 am 7f84da69: Add some logging of dns cache operations
* commit '7f84da69f86ed9daf610c8d1129392ba3f7c4405':
  Add some logging of dns cache operations
2011-09-02 13:03:41 -07:00
David 'Digit' Turner
b0d9c83041 am 96e5facc: am 91966c30: am 0acdbe08: am 89ea107d: Merge "linker: allow debugging of constructors"
* commit '96e5faccdc5616bb6d4a55d50a0e6148f99d943b':
  linker: allow debugging of constructors
2011-08-30 09:52:46 -07:00
David 'Digit' Turner
a0223a888f am 09b36dc7: am 35aebd36: am c7f5c8e2: am 0f7d9df1: Merge "libc: fix typo in kernel helper script"
* commit '09b36dc7a939c68b519fc0f46d6dad25c5f7637c':
  libc: fix typo in kernel helper script
2011-08-30 09:52:44 -07:00
Nick Kralevich
3b242f82b5 am 38bccb27: linker.h: don\'t change the soinfo structure
* commit '38bccb271f121fc06eaa0d8fbd3c982bc44c36b7':
  linker.h: don't change the soinfo structure
2011-08-29 16:33:46 -07:00
Elliott Hughes
999f7711cd am b0bbbff6: Update to tzdata2011i.
* commit 'b0bbbff6060b382d2c4607f026e182adb67d0cc0':
  Update to tzdata2011i.
2011-08-29 09:19:49 -07:00
Erik Gilling
7a796df91d am 4f346524: Merge "update video/dsscomp.h"
* commit '4f3465240a9f0a7ba913188acb048483aef9d6b9':
  update video/dsscomp.h
2011-08-25 13:09:49 -07:00
Mike Lockwood
39ac5c2714 am 0b33d998: Add linux/leds-an30259a.h
* commit '0b33d9982e68991efb5035d126516391113b0baa':
  Add linux/leds-an30259a.h
2011-08-25 13:07:25 -07:00
David 'Digit' Turner
19726f59d7 am 58246b70: libc: Add __aeabi_f2uiz to libgcc_compat.c
* commit '58246b7067b4e1a0b3ce48ccd94331f6fd8fa7cc':
  libc: Add __aeabi_f2uiz to libgcc_compat.c
2011-08-22 10:58:08 -07:00
Jing Yu
d3f2d49f3a am d50225ad: Disable sincos optimization for sincos calls.
* commit 'd50225ad20b4510892dc5f2306b64f04bab6e711':
  Disable sincos optimization for sincos calls.
2011-08-17 15:18:52 -07:00
David Turner
68990d19e4 am 6dcf0d73: am 3dc94305: am 17a40ffb: am c57fd963: Merge "NDK: x86 header file has incorrect definition for ptrdiff_t"
* commit '6dcf0d73a69e01a9ef1d4d2f1e61cd114c0851a5':
  NDK: x86 header file has incorrect definition for ptrdiff_t
2011-08-09 13:39:42 -07:00
David Turner
9ac3e4377f am 3afafd46: am 951e8381: am 3906a9c1: am f5aa1382: Merge "x86 libc: Fix the range to check the error"
* commit '3afafd46f3e0c820e3d0a1b13cceddbeea1b5966':
  x86 libc: Fix the range to check the error
2011-08-09 13:39:40 -07:00
Andy McFadden
af60b29097 am 8363448f: Merge "Log signal info at time of receipt"
* commit '8363448fb594707e1d1bb5664963c549890dc84d':
  Log signal info at time of receipt
2011-08-05 15:05:36 -07:00
Iliyan Malchev
fadfe40155 am 5598077d: bionic: update sanitized kernel header dsscomp.h
* commit '5598077d35f349a88549c6d4fe27458c9577edc9':
  bionic: update sanitized kernel header dsscomp.h
2011-08-04 17:18:08 -07:00
David 'Digit' Turner
dda5d14a6b am 83eb46c5: am a64990f3: am f03fb955: am 023c4988: Merge "libc: x86: Fixed size_t definition."
* commit '83eb46c59df8f54d7b73aaf67c8110aecfa25009':
  libc: x86: Fixed size_t definition.
2011-08-04 11:19:39 -07:00
Iliyan Malchev
2abf4606f9 am 3a5d668e: bionic: add clean kernel header dsscomp.h
* commit '3a5d668e012eb27c33ecea7159d24209d45c5baa':
  bionic: add clean kernel header dsscomp.h
2011-08-03 21:03:50 -07:00
Iliyan Malchev
a11bb504ec am 7b79d1ed: bionic: add processed kernel header rpmsg_omx.h
* commit '7b79d1ed88158ca43e2c307f4d9801280d4a8849':
  bionic: add processed kernel header rpmsg_omx.h
2011-08-03 18:11:18 -07:00
David Turner
d34ff3cb96 am ae3c9783: am bc9d1fe7: am 4685acbd: am 9efda5b7: Merge "typo in libc/stdio/wcio.h"
* commit 'ae3c9783f286f07e794fb67a458b0c9dc2becc29':
  typo in libc/stdio/wcio.h
2011-08-03 17:45:26 -07:00
Robert Greenwalt
a4f633ff2a am 5a09973f: am 663e0579: am dfec555c: am bcf861f2: Merge "Don\'t call freeaddrinfo with a NULL ptr."
* commit '5a09973fa51aec83f934c95bf7b0b35ae4b3a017':
  Don't call freeaddrinfo with a NULL ptr.
2011-07-29 12:32:33 -07:00
JP Abgrall
c8b9ba7d41 am 0ade879a: (-s ours) am 4e5f0d41: (-s ours) am 821bea02: Merge "DO NOT MERGE: libc: enable IPTOS_MINCOST, fixup gethostbyaddr() proto." into honeycomb-LTE
* commit '0ade879a502ac4a0c2da80a7f5e456cddef4fefd':
  DO NOT MERGE: libc: enable IPTOS_MINCOST, fixup gethostbyaddr() proto.
2011-07-27 09:25:52 -07:00
JP Abgrall
88f6fa70d7 am 26619dfb: (-s ours) am cec4e990: (-s ours) am 30517a93: Merge "DO NOT MERGE: Update netlink-related kernel includes" into honeycomb-LTE
* commit '26619dfbb8c1f470407745837818b2654eb6a28f':
  DO NOT MERGE: Update netlink-related kernel includes
2011-07-27 09:25:50 -07:00
1426 changed files with 41692 additions and 26846 deletions

View File

@@ -281,8 +281,12 @@ libc_common_src_files := \
bionic/ssp.c \
bionic/stubs.c \
bionic/system_properties.c \
bionic/tdelete.c \
bionic/tdestroy.c \
bionic/time64.c \
bionic/tfind.c \
bionic/thread_atexit.c \
bionic/tsearch.c \
bionic/utime.c \
bionic/utmp.c \
netbsd/gethnamaddr.c \
@@ -346,13 +350,16 @@ libc_common_src_files += \
arch-arm/bionic/__get_sp.S \
arch-arm/bionic/_exit_with_stack_teardown.S \
arch-arm/bionic/_setjmp.S \
arch-arm/bionic/atomics_arm.S \
arch-arm/bionic/abort_arm.S \
arch-arm/bionic/atomics_arm.c \
arch-arm/bionic/clone.S \
arch-arm/bionic/eabi.c \
arch-arm/bionic/ffs.S \
arch-arm/bionic/futex_arm.S \
arch-arm/bionic/kill.S \
arch-arm/bionic/libgcc_compat.c \
arch-arm/bionic/tkill.S \
arch-arm/bionic/tgkill.S \
arch-arm/bionic/memcmp.S \
arch-arm/bionic/memcmp16.S \
arch-arm/bionic/memcpy.S \
@@ -394,9 +401,9 @@ libc_common_src_files += \
arch-x86/bionic/__get_sp.S \
arch-x86/bionic/__get_tls.c \
arch-x86/bionic/__set_tls.c \
arch-x86/bionic/atomics_x86.S \
arch-x86/bionic/clone.S \
arch-x86/bionic/_exit_with_stack_teardown.S \
arch-x86/bionic/futex_x86.S \
arch-x86/bionic/setjmp.S \
arch-x86/bionic/_setjmp.S \
arch-x86/bionic/sigsetjmp.S \
@@ -427,43 +434,6 @@ libc_arch_static_src_files := \
libc_arch_dynamic_src_files :=
else # !x86
ifeq ($(TARGET_ARCH),sh)
libc_common_src_files += \
arch-sh/bionic/__get_pc.S \
arch-sh/bionic/__get_sp.S \
arch-sh/bionic/_exit_with_stack_teardown.S \
arch-sh/bionic/_setjmp.S \
arch-sh/bionic/atomics_sh.c \
arch-sh/bionic/atomic_cmpxchg.S \
arch-sh/bionic/clone.S \
arch-sh/bionic/pipe.S \
arch-sh/bionic/memcpy.S \
arch-sh/bionic/memset.S \
arch-sh/bionic/bzero.S \
arch-sh/bionic/setjmp.S \
arch-sh/bionic/sigsetjmp.S \
arch-sh/bionic/syscall.S \
arch-sh/bionic/memmove.S \
arch-sh/bionic/__set_tls.c \
arch-sh/bionic/__get_tls.c \
arch-sh/bionic/ffs.S \
string/bcopy.c \
string/strcmp.c \
string/strncmp.c \
string/memcmp.c \
string/strlen.c \
string/strcpy.c \
bionic/pthread-atfork.c \
bionic/pthread-rwlocks.c \
bionic/pthread-timers.c \
bionic/ptrace.c \
unistd/socketcalls.c
libc_static_common_src_files += \
bionic/pthread.c \
endif # sh
endif # !x86
endif # !arm
@@ -508,13 +478,18 @@ ifeq ($(TARGET_ARCH),arm)
ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
libc_common_cflags += -DHAVE_ARM_TLS_REGISTER
endif
ifeq ($(ARCH_ARM_USE_NON_NEON_MEMCPY),true)
libc_common_cflags += -DARCH_ARM_USE_NON_NEON_MEMCPY
endif
else # !arm
ifeq ($(TARGET_ARCH),x86)
libc_crt_target_cflags := -m32
# Enable recent IA friendly memory routines (such as for Atom)
# These will not work on the earlier x86 machines
libc_common_cflags += -mtune=i686 -DUSE_SSSE3 -DUSE_SSE2
libc_crt_target_cflags :=
ifeq ($(ARCH_X86_HAVE_SSE2),true)
libc_crt_target_cflags += -DUSE_SSE2=1
endif
ifeq ($(ARCH_X86_HAVE_SSSE3),true)
libc_crt_target_cflags += -DUSE_SSSE3=1
endif
endif # x86
endif # !arm
@@ -543,8 +518,9 @@ libc_common_c_includes := \
# Needed to access private/__dso_handle.S from
# crtbegin_xxx.S and crtend_xxx.S
# and machine/asm.h
#
libc_crt_target_cflags += -I$(LOCAL_PATH)/private
libc_crt_target_cflags += -I$(LOCAL_PATH)/private -I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
# Define the libc run-time (crt) support object files that must be built,
# which are needed to build all other objects (shared/static libs and
@@ -680,7 +656,19 @@ include $(BUILD_STATIC_LIBRARY)
# ========================================================
include $(CLEAR_VARS)
LOCAL_CFLAGS := $(libc_common_cflags)
# pthread deadlock prediction:
# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for
# pthread deadlock prediction.
# Since this code is experimental it is disabled by default.
# see libc/bionic/pthread_debug.c for details
LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0
ifeq ($(TARGET_ARCH),arm)
# TODO: At some point, we need to remove this custom linker script.
LOCAL_LDFLAGS := -Wl,-T,$(BUILD_SYSTEM)/armelf.xsc
endif
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
@@ -688,6 +676,7 @@ LOCAL_SRC_FILES := \
$(libc_static_common_src_files) \
bionic/dlmalloc.c \
bionic/malloc_debug_common.c \
bionic/pthread_debug.c \
bionic/libc_init_dynamic.c
LOCAL_MODULE:= libc
@@ -727,7 +716,10 @@ LOCAL_CFLAGS := \
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
bionic/malloc_debug_leak.c
bionic/malloc_debug_leak.c \
bionic/malloc_debug_check.c \
bionic/malloc_debug_check_mapinfo.c \
bionic/malloc_debug_stacktrace.c
LOCAL_MODULE:= libc_malloc_debug_leak
@@ -758,7 +750,7 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE:= libc_malloc_debug_qemu
LOCAL_SHARED_LIBRARIES := libc
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=

View File

@@ -4,7 +4,7 @@
#
# each non comment line has the following format:
#
# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (#syscall_number|stub)
# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (syscall_number|"stub")
#
# note that:
# - syscall_name correspond to the name of the syscall, which may differ from
@@ -22,15 +22,15 @@
# assembler template for the syscall; it's up to the bionic implementation to provide
# a relevant C stub
#
# - additionally, if the syscall number is different amoung ARM, x86 and SuperH, use:
# return_type funcname[:syscall_name](parameters) arm_number,x86_number,superh_number
# - additionally, if the syscall number is different amoung ARM, and x86, use:
# return_type funcname[:syscall_name](parameters) arm_number,x86_number
#
# the file is processed by a python script named gensyscalls.py
#
# process management
void _exit:exit_group (int) 248,252
void _exit_thread:exit (int) 1
void _exit_thread:exit (int) 1
pid_t __fork:fork (void) 2
pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7
int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284
@@ -47,12 +47,13 @@ uid_t getuid:getuid32 () 199
gid_t getgid:getgid32 () 200
uid_t geteuid:geteuid32 () 201
gid_t getegid:getegid32 () 202
uid_t getresuid:getresuid32 () 209
gid_t getresgid:getresgid32 () 211
uid_t getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid) 209
gid_t getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid) 211
pid_t gettid() 224
ssize_t readahead(int, off64_t, size_t) 225
int getgroups:getgroups32(int, gid_t *) 205
pid_t getpgid(pid_t) 132
pid_t getppid() 64
pid_t getppid() 64
pid_t setsid() 66
int setgid:setgid32(gid_t) 214
int seteuid:seteuid32(uid_t) stub
@@ -63,6 +64,7 @@ void* __brk:brk(void*) 45
# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
int kill(pid_t, int) -1,37
int tkill(pid_t tid, int sig) -1,238
int tgkill(pid_t tgid, pid_t tid, int sig) -1,270
int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26
int __set_thread_area:set_thread_area(void* user_desc) -1,243
int __getpriority:getpriority(int, int) 96
@@ -113,7 +115,7 @@ int __fcntl:fcntl(int, int, void*) 55
int flock(int, int) 143
int fchmod(int, mode_t) 94
int dup(int) 41
int pipe(int *) 42,42,-1
int pipe(int *) 42,42
int pipe2(int *, int) 359,331
int dup2(int, int) 63
int select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *) 142
@@ -132,6 +134,10 @@ int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296
int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 325,298
int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 333,306
int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 329,302
int fsetxattr(int, const char *, const void *, size_t, int) 228
ssize_t fgetxattr(int, const char *, void *, size_t) 231
ssize_t flistxattr(int, char *, size_t) 234
int fremovexattr(int, const char *) 237
# file system
int link (const char*, const char*) 9
@@ -154,10 +160,20 @@ int rmdir(const char *) 40
int rename(const char *, const char *) 38
int __getcwd:getcwd(char * buf, size_t size) 183
int access(const char *, int) 33
int faccessat(int, const char *, int, int) 334,307
int symlink(const char *, const char *) 83
int fchdir(int) 133
int truncate(const char*, off_t) 92
int setxattr(const char *, const char *, const void *, size_t, int) 226
int lsetxattr(const char *, const char *, const void *, size_t, int) 227
ssize_t getxattr(const char *, const char *, void *, size_t) 229
ssize_t lgetxattr(const char *, const char *, void *, size_t) 230
ssize_t listxattr(const char *, char *, size_t) 232
ssize_t llistxattr(const char *, char *, size_t) 233
int removexattr(const char *, const char *) 235
int lremovexattr(const char *, const char *) 236
int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268
# time
int pause () 29
int gettimeofday(struct timeval*, struct timezone*) 78
@@ -167,7 +183,7 @@ int nanosleep(const struct timespec *, struct timespec *) 162
int clock_gettime(clockid_t clk_id, struct timespec *tp) 263,265
int clock_settime(clockid_t clk_id, const struct timespec *tp) 262,264
int clock_getres(clockid_t clk_id, struct timespec *res) 264,266
int clock_nanosleep(const struct timespec *req, struct timespec *rem) 265,267
int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem) 265,267
int getitimer(int, const struct itimerval *) 105
int setitimer(int, const struct itimerval *, struct itimerval *) 104
int __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) 257,259
@@ -205,24 +221,21 @@ int sendmsg(int, const struct msghdr *, unsigned int) 296,-1
int recvmsg(int, struct msghdr *, unsigned int) 297,-1
# sockets for x86. These are done as an "indexed" call to socketcall syscall.
int socket:socketcall:1 (int, int, int) -1,102,-1
int bind:socketcall:2 (int, struct sockaddr *, int) -1,102,-1
int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,102,-1
int listen:socketcall:4(int, int) -1,102,-1
int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,102,-1
int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,102,-1
int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,102,-1
int socketpair:socketcall:8(int, int, int, int*) -1,102,-1
int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,102,-1
int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,102,-1
int socket:socketcall:1 (int, int, int) -1,102
int bind:socketcall:2 (int, struct sockaddr *, int) -1,102
int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,102
int listen:socketcall:4(int, int) -1,102
int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,102
int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,102
int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,102
int socketpair:socketcall:8(int, int, int, int*) -1,102
int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,102
int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,102
int shutdown:socketcall:13(int, int) -1,102,-1
int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,102,-1
int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,102,-1
int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,102,-1
int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,102,-1
# sockets for sh.
int __socketcall:socketcall(int, unsigned long*) -1,-1,102
int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,102
int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,102
int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,102
int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,102
# scheduler & real-time
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) 156
@@ -235,11 +248,11 @@ int sched_get_priority_min(int policy) 160
int sched_rr_get_interval(pid_t pid, struct timespec *interval) 161
int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241
int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) 242
int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318,318
int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318
# io priorities
int ioprio_set(int which, int who, int ioprio) 314,289,288
int ioprio_get(int which, int who) 315,290,289
int ioprio_set(int which, int who, int ioprio) 314,289
int ioprio_get(int which, int who) 315,290
# other
int uname(struct utsname *) 122
@@ -251,6 +264,8 @@ int init_module(void *, unsigned long, const char *) 128
int delete_module(const char*, unsigned int) 129
int klogctl:syslog(int, char *, int) 103
int sysinfo(struct sysinfo *) 116
int personality(unsigned long) 136
long perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364
# futex
int futex(void *, int, int, void *, void *, int) 240
@@ -261,8 +276,8 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 251,25
int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout) 252,256
int inotify_init(void) 316,291,290
int inotify_add_watch(int, const char *, unsigned int) 317,292,291
int inotify_rm_watch(int, unsigned int) 318,293,292
int inotify_add_watch(int, const char *, unsigned int) 317,292
int inotify_rm_watch(int, unsigned int) 318,293
int poll(struct pollfd *, unsigned int, long) 168

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,13 +25,18 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <pthread.h>
#include <machine/asm.h>
/*
* Simply set tls address into GBR.
* Coding the abort function in assembly so that registers are guaranteed to
* be preserved properly regardless of GCC's assumption on the "noreturn"
* attribute. When the registers are not properly preserved we won't be able
* to unwind the stack all the way to the bottom to fully reveal the call
* sequence when the crash happens.
*/
int __set_tls(void *ptr)
{
asm volatile("ldc %0, gbr" : /* no output */ : "r" (ptr));
return 0;
}
ENTRY(abort)
.save {r3, r14}
stmfd sp!, {r3, r14}
blx PIC_SYM(_C_LABEL(__libc_android_abort), PLT)
END(abort)

View File

@@ -1,236 +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 <sys/linux-syscalls.h>
#include <machine/asm.h>
#include <machine/cpu-features.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#if defined(__ARM_HAVE_LDREX_STREX)
/*
* ===========================================================================
* ARMv6+ implementation
* ===========================================================================
*/
/* r0(addr) -> r0(old) */
ENTRY(__atomic_dec)
mov r1, r0 @ copy addr so we don't clobber it
1: ldrex r0, [r1] @ load current value into r0
sub r2, r0, #1 @ generate new value into r2
strex r3, r2, [r1] @ try to store new value; result in r3
cmp r3, #0 @ success?
bxeq lr @ yes, return
b 1b @ no, retry
END(__atomic_dec)
/* r0(addr) -> r0(old) */
ENTRY(__atomic_inc)
mov r1, r0
1: ldrex r0, [r1]
add r2, r0, #1
strex r3, r2, [r1]
cmp r3, #0
bxeq lr
b 1b
END(__atomic_inc)
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
ENTRY(__atomic_cmpxchg)
1: mov ip, #2 @ ip=2 means "new != old"
ldrex r3, [r2] @ load current value into r3
teq r0, r3 @ new == old?
strexeq ip, r1, [r2] @ yes, try store, set ip to 0 or 1
teq ip, #1 @ strex failure?
beq 1b @ yes, retry
mov r0, ip @ return 0 on success, 2 on failure
bx lr
END(__atomic_cmpxchg)
/* r0(new) r1(addr) -> r0(old) */
ENTRY(__atomic_swap)
1: ldrex r2, [r1]
strex r3, r0, [r1]
teq r3, #0
bne 1b
mov r0, r2
bx lr
END(__atomic_swap)
#else /*not defined __ARM_HAVE_LDREX_STREX*/
/*
* ===========================================================================
* Pre-ARMv6 implementation
* ===========================================================================
*/
/* int __kernel_cmpxchg(int oldval, int newval, int* ptr) */
.equ kernel_cmpxchg, 0xFFFF0FC0
.equ kernel_atomic_base, 0xFFFF0FFF
/* r0(addr) -> r0(old) */
ENTRY(__atomic_dec)
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_dec
ldr r0, [r2]
mov r3, #kernel_atomic_base
add lr, pc, #4
sub r1, r0, #1
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcc 1b
add r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
END(__atomic_dec)
/* r0(addr) -> r0(old) */
ENTRY(__atomic_inc)
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r2, r0
1: @ atomic_inc
ldr r0, [r2]
mov r3, #kernel_atomic_base
add lr, pc, #4
add r1, r0, #1
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcc 1b
sub r0, r1, #1
ldmia sp!, {r4, lr}
bx lr
END(__atomic_inc)
/* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */
ENTRY(__atomic_cmpxchg)
.save {r4, lr}
stmdb sp!, {r4, lr}
mov r4, r0 /* r4 = save oldvalue */
1: @ atomic_cmpxchg
mov r3, #kernel_atomic_base
add lr, pc, #4
mov r0, r4 /* r0 = oldvalue */
add pc, r3, #(kernel_cmpxchg - kernel_atomic_base)
bcs 2f /* swap was made. we're good, return. */
ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */
cmp r3, r4
beq 1b
2: @ atomic_cmpxchg
ldmia sp!, {r4, lr}
bx lr
END(__atomic_cmpxchg)
/* r0(new) r1(addr) -> r0(old) */
ENTRY(__atomic_swap)
swp r0, r0, [r1]
bx lr
END(__atomic_swap)
#endif /*not defined __ARM_HAVE_LDREX_STREX*/
/* __futex_wait(*ftx, val, *timespec) */
/* __futex_wake(*ftx, counter) */
/* __futex_syscall3(*ftx, op, val) */
/* __futex_syscall4(*ftx, op, val, *timespec) */
.global __futex_wait
.type __futex_wait, %function
.global __futex_wake
.type __futex_wake, %function
.global __futex_syscall3
.type __futex_syscall3, %function
.global __futex_syscall4
.type __futex_syscall4, %function
#if __ARM_EABI__
ENTRY(__futex_syscall3)
stmdb sp!, {r4, r7}
.save {r4, r7}
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_syscall3)
ENTRY(__futex_wait)
stmdb sp!, {r4, r7}
.save {r4, r7}
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_wait)
ENTRY(__futex_wake)
.save {r4, r7}
stmdb sp!, {r4, r7}
mov r2, r1
mov r1, #FUTEX_WAKE
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_wake)
#else
ENTRY(__futex_syscall3)
swi #__NR_futex
bx lr
END(__futex_syscall3)
ENTRY(__futex_wait)
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
swi #__NR_futex
bx lr
END(__futex_wait)
ENTRY(__futex_wake)
mov r2, r1
mov r1, #FUTEX_WAKE
swi #__NR_futex
bx lr
END(__futex_wake)
#endif
ENTRY(__futex_syscall4)
b __futex_syscall3
END(__futex_syscall4)

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2011 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* The purpose of this file is to export a small set of atomic-related
* functions from the C library, to ensure binary ABI compatibility for
* the NDK.
*
* These functions were initially exposed by the NDK through <sys/atomics.h>,
* which was unfortunate because their implementation didn't provide any
* memory barriers at all.
*
* This wasn't a problem for the platform code that used them, because it
* used explicit barrier instructions around them. On the other hand, it means
* that any NDK-generated machine code that linked against them would not
* perform correctly when running on multi-core devices.
*
* To fix this, the platform code was first modified to not use any of these
* functions (everything is now inlined through assembly statements, see
* libc/private/bionic_arm_inline.h and the headers it includes.
*
* The functions here are thus only for the benefit of NDK applications,
* and now includes full memory barriers to prevent any random memory ordering
* issue from cropping.
*
* Note that we also provide an updated <sys/atomics.h> header that defines
* always_inlined versions of the functions that use the GCC builtin
* intrinsics to perform the same thing.
*
* NOTE: There is no need for a similar file for non-ARM platforms.
*/
/* DO NOT INCLUDE <sys/atomics.h> HERE ! */
int
__atomic_cmpxchg(int old, int _new, volatile int *ptr)
{
/* We must return 0 on success */
return __sync_val_compare_and_swap(ptr, old, _new) != old;
}
int
__atomic_swap(int _new, volatile int *ptr)
{
int prev;
do {
prev = *ptr;
} while (__sync_val_compare_and_swap(ptr, prev, _new) != prev);
return prev;
}
int
__atomic_dec(volatile int *ptr)
{
return __sync_fetch_and_sub (ptr, 1);
}
int
__atomic_inc(volatile int *ptr)
{
return __sync_fetch_and_add (ptr, 1);
}

View File

@@ -43,21 +43,19 @@
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
# - address of the "main" function of the program.
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
ldr r2, =main
adr r3, 1f
ldr r4, =__libc_init
blx r4
mov r0, #0
bx r0
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__

View File

@@ -26,6 +26,8 @@
* SUCH DAMAGE.
*/
#include <machine/asm.h>
# Implement static C++ destructors when the shared
# library is unloaded through dlclose().
#
@@ -33,10 +35,11 @@
# in the .fini_array. See 3.3.5.3.C of C++ ABI
# standard.
#
__on_dlclose:
ENTRY(__on_dlclose)
adr r0, 0f
ldr r0, [r0]
b __cxa_finalize
END(__on_dlclose)
0:
.long __dso_handle

View File

@@ -43,21 +43,19 @@
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
# - address of the "main" function of the program.
#
# - address of the constructor list
#
_start:
mov r0, sp
mov r1, #0
adr r2, 0f
adr r3, 1f
b __libc_init
0: b main
ldr r2, =main
adr r3, 1f
ldr r4, =__libc_init
blx r4
mov r0, #0
bx r0
1: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__

View File

@@ -0,0 +1,112 @@
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/linux-syscalls.h>
#include <machine/asm.h>
#include <machine/cpu-features.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
/* __futex_wait(*ftx, val, *timespec) */
/* __futex_wake(*ftx, counter) */
/* __futex_syscall3(*ftx, op, val) */
/* __futex_syscall4(*ftx, op, val, *timespec) */
.global __futex_wait
.type __futex_wait, %function
.global __futex_wake
.type __futex_wake, %function
.global __futex_syscall3
.type __futex_syscall3, %function
.global __futex_syscall4
.type __futex_syscall4, %function
#if __ARM_EABI__
ENTRY(__futex_syscall3)
stmdb sp!, {r4, r7}
.save {r4, r7}
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_syscall3)
ENTRY(__futex_wait)
stmdb sp!, {r4, r7}
.save {r4, r7}
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_wait)
ENTRY(__futex_wake)
.save {r4, r7}
stmdb sp!, {r4, r7}
mov r2, r1
mov r1, #FUTEX_WAKE
ldr r7, =__NR_futex
swi #0
ldmia sp!, {r4, r7}
bx lr
END(__futex_wake)
#else
ENTRY(__futex_syscall3)
swi #__NR_futex
bx lr
END(__futex_syscall3)
ENTRY(__futex_wait)
mov r3, r2
mov r2, r1
mov r1, #FUTEX_WAIT
swi #__NR_futex
bx lr
END(__futex_wait)
ENTRY(__futex_wake)
mov r2, r1
mov r1, #FUTEX_WAKE
swi #__NR_futex
bx lr
END(__futex_wake)
#endif
ENTRY(__futex_syscall4)
b __futex_syscall3
END(__futex_syscall4)

View File

@@ -66,7 +66,7 @@
* any native shared library generated with it should now be safe from that
* problem. On the other hand, existing shared libraries distributed with
* applications that were generated with a previous version of the NDK
* still need all 1.5/1.6 helper functions in libc.so and libn.so
* still need all 1.5/1.6 helper functions in libc.so and libm.so
*
* After 3.2, the toolchain was updated again, adding __aeabi_f2uiz to the
* list of requirements. Technically, this is due to mis-linked NDK libraries
@@ -113,6 +113,8 @@
XX(__aeabi_l2d) \
XX(__aeabi_l2f) \
XX(__aeabi_lmul) \
XX(__aeabi_llsl) \
XX(__aeabi_llsr) \
XX(__aeabi_ui2d) \
XX(__aeabi_ui2f) \
XX(__aeabi_ul2d) \

View File

@@ -29,7 +29,7 @@
#include <machine/cpu-features.h>
#include <machine/asm.h>
#if defined(__ARM_NEON__)
#if defined(__ARM_NEON__) && !defined(ARCH_ARM_USE_NON_NEON_MEMCPY)
.text
.fpu neon

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,39 +25,27 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* unlike our auto-generated syscall stubs, this code saves lr
on the stack, as well as a few other registers. this makes
our stack unwinder happy, when we generate debug stack
traces after the C library or other parts of the system
abort due to a fatal runtime error (e.g. detection
of a corrupted malloc heap).
*/
#include <sys/linux-syscalls.h>
#include <machine/asm.h>
.text
.type pipe, @function
.globl pipe
.align 4
#ifndef __NR_tgkill
#define __NR_tgkill 268
#endif
pipe:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(0 + 0x10)
/* check return value */
cmp/pz r0
bt setfds
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
bra end
nop
setfds:
mov.l r0, @r4
add #4, r4
mov.l r1, @r4
end:
rts
nop
.align 2
0: .long __NR_pipe
1: .long __set_syscall_errno
ENTRY(tgkill)
stmfd sp!, {r4-r7, ip, lr}
ldr r7, =__NR_tgkill
swi #0
ldmfd sp!, {r4-r7, ip, lr}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(tgkill)

View File

@@ -97,6 +97,12 @@
#define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y))
#define ASEND(y) _END(_ASM_LABEL(y))
#ifdef __ELF__
#define ENTRY_PRIVATE(y) ENTRY(y); .hidden _C_LABEL(y)
#else
#define ENTRY_PRIVATE(y) ENTRY(y)
#endif
#define ASMSTR .asciz
#if defined(__ELF__) && defined(PIC)

View File

@@ -14,6 +14,7 @@ syscall_src += arch-arm/syscalls/getegid.S
syscall_src += arch-arm/syscalls/getresuid.S
syscall_src += arch-arm/syscalls/getresgid.S
syscall_src += arch-arm/syscalls/gettid.S
syscall_src += arch-arm/syscalls/readahead.S
syscall_src += arch-arm/syscalls/getgroups.S
syscall_src += arch-arm/syscalls/getpgid.S
syscall_src += arch-arm/syscalls/getppid.S
@@ -84,6 +85,10 @@ syscall_src += arch-arm/syscalls/mkdirat.S
syscall_src += arch-arm/syscalls/fchownat.S
syscall_src += arch-arm/syscalls/fchmodat.S
syscall_src += arch-arm/syscalls/renameat.S
syscall_src += arch-arm/syscalls/fsetxattr.S
syscall_src += arch-arm/syscalls/fgetxattr.S
syscall_src += arch-arm/syscalls/flistxattr.S
syscall_src += arch-arm/syscalls/fremovexattr.S
syscall_src += arch-arm/syscalls/link.S
syscall_src += arch-arm/syscalls/unlink.S
syscall_src += arch-arm/syscalls/unlinkat.S
@@ -103,9 +108,18 @@ syscall_src += arch-arm/syscalls/rmdir.S
syscall_src += arch-arm/syscalls/rename.S
syscall_src += arch-arm/syscalls/__getcwd.S
syscall_src += arch-arm/syscalls/access.S
syscall_src += arch-arm/syscalls/faccessat.S
syscall_src += arch-arm/syscalls/symlink.S
syscall_src += arch-arm/syscalls/fchdir.S
syscall_src += arch-arm/syscalls/truncate.S
syscall_src += arch-arm/syscalls/setxattr.S
syscall_src += arch-arm/syscalls/lsetxattr.S
syscall_src += arch-arm/syscalls/getxattr.S
syscall_src += arch-arm/syscalls/lgetxattr.S
syscall_src += arch-arm/syscalls/listxattr.S
syscall_src += arch-arm/syscalls/llistxattr.S
syscall_src += arch-arm/syscalls/removexattr.S
syscall_src += arch-arm/syscalls/lremovexattr.S
syscall_src += arch-arm/syscalls/__statfs64.S
syscall_src += arch-arm/syscalls/pause.S
syscall_src += arch-arm/syscalls/gettimeofday.S
@@ -169,6 +183,8 @@ syscall_src += arch-arm/syscalls/init_module.S
syscall_src += arch-arm/syscalls/delete_module.S
syscall_src += arch-arm/syscalls/klogctl.S
syscall_src += arch-arm/syscalls/sysinfo.S
syscall_src += arch-arm/syscalls/personality.S
syscall_src += arch-arm/syscalls/perf_event_open.S
syscall_src += arch-arm/syscalls/futex.S
syscall_src += arch-arm/syscalls/epoll_create.S
syscall_src += arch-arm/syscalls/epoll_ctl.S

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(faccessat)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_faccessat
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(faccessat)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(fgetxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fgetxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(fgetxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(flistxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_flistxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(flistxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(fremovexattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_fremovexattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(fremovexattr)

View File

@@ -0,0 +1,16 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(fsetxattr)
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_fsetxattr
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(fsetxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(getxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_getxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(getxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(lgetxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_lgetxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(lgetxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(listxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_listxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(listxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(llistxattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_llistxattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(llistxattr)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(lremovexattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_lremovexattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(lremovexattr)

View File

@@ -0,0 +1,16 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(lsetxattr)
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_lsetxattr
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(lsetxattr)

View File

@@ -0,0 +1,16 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(perf_event_open)
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_perf_event_open
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(perf_event_open)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(personality)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_personality
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(personality)

View File

@@ -0,0 +1,16 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(readahead)
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_readahead
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(readahead)

View File

@@ -0,0 +1,14 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(removexattr)
.save {r4, r7}
stmfd sp!, {r4, r7}
ldr r7, =__NR_removexattr
swi #0
ldmfd sp!, {r4, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(removexattr)

View File

@@ -0,0 +1,16 @@
/* autogenerated by gensyscalls.py */
#include <machine/asm.h>
#include <sys/linux-syscalls.h>
ENTRY(setxattr)
mov ip, sp
.save {r4, r5, r6, r7}
stmfd sp!, {r4, r5, r6, r7}
ldmfd ip, {r4, r5, r6}
ldr r7, =__NR_setxattr
swi #0
ldmfd sp!, {r4, r5, r6, r7}
movs r0, r0
bxpl lr
b __set_syscall_errno
END(setxattr)

View File

@@ -1,37 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
.text
.type __get_pc, @function
.globl __get_pc
.align 4
__get_pc:
mova 1f, r0
rts
1: nop

View File

@@ -1,37 +0,0 @@
/*
* Copyright (C) 2009 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.
*/
/* see the implementation of __set_tls and pthread.c to understand this
* code. Basically, the content of fs:[0] always is a pointer to the base
* address of the tls region
*/
void *__get_tls(void)
{
void *tls;
asm volatile("stc gbr, %0" : "=r"(tls));
return tls;
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <asm/unistd.h>
.text
.type _exit_with_stack_teardown, @function
.globl _exit_with_stack_teardown
.align 4
# void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode)
_exit_with_stack_teardown:
mov r6, r8 /* save retCode : breaks r8 value */
mov.l 0f, r3 /* system call number */
trapa #(2 + 0x10) /* invoke system call with num of args */
mov r8, r4 /* restore retCode */
mov.l 1f, r3 /* system call number */
trapa #(1 + 0x10) /* invoke system call with num of args */
/* exit() should never return, cause a crash if it does */
mov #0, r0
mov.l @r0, r0
.align 2
0: .long __NR_munmap
1: .long __NR_exit

View File

@@ -1,125 +0,0 @@
/* $OpenBSD: _setjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $ */
/* $NetBSD: _setjmp.S,v 1.7 2006/01/05 02:04:41 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)_setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- _setjmp, _longjmp
*
* _longjmp(a,v)
* will generate a "return(v)" from the last call to
* _setjmp(a)
* by restoring registers from the stack.
* The previous signal state is NOT restored.
*/
ENTRY(_setjmp)
xor r0, r0
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
add #(_JBLEN * 4), r4
sts fpscr, r1
mov.l r1, @-r4
lds r0, fpscr
sts.l fpul, @-r4
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
frchg
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
lds r1, fpscr
#else
add #((_JBLEN - 10) * 4), r4
#endif
sts.l mach, @-r4
sts.l macl, @-r4
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
sts.l pr, @-r4
mov.l r0, @-r4 /* dummy signal mask */
rts
mov.l r0, @-r4 /* no saved signal mask */
SET_ENTRY_SIZE(_setjmp)
ENTRY(_longjmp)
add #8, r4
lds.l @r4+, pr
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
lds.l @r4+, macl
lds.l @r4+, mach
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
xor r0, r0
lds r0, fpscr
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
lds.l @r4+, fpul
lds.l @r4+, fpscr
#endif
mov r5, r0
tst r0, r0
bf .L0
add #1, r0
.L0:
rts
nop
SET_ENTRY_SIZE(_longjmp)

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
.text
.type __atomic_cmpxchg, @function
.globl __atomic_cmpxchg
.align 4
__atomic_cmpxchg:
mova 1f, r0
nop
mov r15, r1
mov #-8, r15 /* critical region start */
0: mov.l @r6, r2
cmp/eq r2, r4
bt not_yet_modified
mov #1, r0
bra done
nop
not_yet_modified:
mov #0, r0
mov.l r5, @r6
done:
1: mov r1, r15 /* critical region end */
rts
nop

View File

@@ -1,110 +0,0 @@
/*
* Copyright (C) 2009 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 <linux/futex.h>
#define SWAP_LOCK_COUNT 32U
static pthread_mutex_t _swap_locks[SWAP_LOCK_COUNT];
#define SWAP_LOCK(addr) \
&_swap_locks[((unsigned)(void *)(addr) >> 3U) % SWAP_LOCK_COUNT]
#if 0
/*
* Only this function is moved to atomic_cmpxchg.S, and
* implemented with gUSA framework.
*/
int __atomic_cmpxchg(int old, int _new, volatile int *ptr)
{
int result;
pthread_mutex_t *lock = SWAP_LOCK(ptr);
pthread_mutex_lock(lock);
if (*ptr == old) {
*ptr = _new;
result = 0;
} else {
result = 1;
}
pthread_mutex_unlock(lock);
return result;
}
#else
extern int __atomic_cmpxchg(int old, int _new, volatile int *ptr);
#endif
int __atomic_swap(int _new, volatile int *ptr)
{
int oldValue;
do {
oldValue = *ptr;
} while (__atomic_cmpxchg(oldValue, _new, ptr));
return oldValue;
}
int __atomic_dec(volatile int *ptr)
{
int oldValue;
do {
oldValue = *ptr;
} while (__atomic_cmpxchg(oldValue, oldValue-1, ptr));
return oldValue;
}
int __atomic_inc(volatile int *ptr)
{
int32_t oldValue;
do {
oldValue = *ptr;
} while (__atomic_cmpxchg(oldValue, oldValue+1, ptr));
return oldValue;
}
extern int futex(volatile void *, int, int, void *, void *, int);
int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout)
{
return futex(ftx, FUTEX_WAIT, val, (void *)timeout, NULL, 0);
}
int __futex_wake(volatile void *ftx, int count)
{
return futex(ftx, FUTEX_WAKE, count, NULL, NULL, 0);
}
int __futex_syscall3(volatile void *ftx, int op, int val)
{
return futex(ftx, op, val, NULL, NULL, 0);
}
int __futex_syscall4(volative void *ftx, int op, int val, const struct timespec *timeout)
{
return futex(ftx, op, val, (void *)timeout, NULL, 0);
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright (C) 2009 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.
*/
#define BZERO
#include "memset.S"

View File

@@ -1,79 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/linux-syscalls.h>
.text
.type __pthread_clone, @function
.globl __pthread_clone
.align 4
__pthread_clone:
/* insert the args onto the new stack */
mov r5, r0
mov.l r4, @-r0 /* func */
mov.l r7, @-r0 /* arg */
/* do the system call */
mov r6, r4 /* Set clone_flags. new sp is ready in r5. */
mov.l 0f, r3
trapa #(4 + 0x10)
/* check error */
cmp/pz r0
bf __error
/* check if parent or child */
cmp/pl r0
bt __return
/* prepare args for __thread_entry */
mov #8, r1
sub r1, r15 /* -8 */
mov.l @r15+, r5 /* +4 */ /* arg */
mov.l @r15+, r4 /* +4 */ /* func */
mov r15, r6 /* tls */
/* jump to __thread_entry */
mov.l 1f, r0
jmp @r0
nop
__error:
mov #-1, r0
__return:
rts
nop
.align 2
0: .long __NR_clone
1: .long __thread_entry
/* XXX: TODO: Add __bionic_clone here
* See bionic/bionic_clone.c and arch-arm/bionic/clone.S
* for more details...
*/

View File

@@ -1,97 +0,0 @@
/*
* Copyright (C) 2009-2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
.text
.align 4
.type _start,#function
.globl _start
# this is the small startup code that is first run when
# any executable that is dynamically-linked with Bionic
# runs.
#
# it's purpose is to call __libc_init with appropriate
# arguments, which are:
#
# - the address of the raw data block setup by the Linux
# kernel ELF loader
#
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
#
# - address of the constructor list
#
_start:
mov r15, r4
mov #0, r5
mov.l 0f, r6
mova 2f, r0
mov r0, r7
mov.l 1f, r0
jmp @r0
nop
.balign 4
0: .long main
1: .long __libc_init
2: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
.long __FINI_ARRAY__
.long __CTOR_LIST__
# the .ctors section contains a list of pointers to "constructor"
# functions that need to be called in order during C library initialization,
# just before the program is being run. This is a C++ requirement
#
# the last entry shall be 0, and is defined in crtend.S
#
.section .preinit_array, "aw"
.globl __PREINIT_ARRAY__
__PREINIT_ARRAY__:
.long -1
.section .init_array, "aw"
.globl __INIT_ARRAY__
__INIT_ARRAY__:
.long -1
.section .fini_array, "aw"
.globl __FINI_ARRAY__
__FINI_ARRAY__:
.long -1
.section .ctors, "aw"
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
#include "__dso_handle.S"

View File

@@ -1,91 +0,0 @@
/*
* Copyright (C) 2009-2010 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
.text
.align 4
.type _start,#function
.globl _start
# this is the small startup code that is first run when
# any executable that is statically-linked with Bionic
# runs.
#
# it's purpose is to call __libc_init with appropriate
# arguments, which are:
#
# - the address of the raw data block setup by the Linux
# kernel ELF loader
#
# - address of an "onexit" function, not used on any
# platform supported by Bionic
#
# - address of the "main" function of the program. We
# can't hard-code it in the adr pseudo instruction
# so we use a tiny trampoline that will get relocated
# by the dynamic linker before this code runs
#
# - address of the constructor list
#
_start:
mov r15, r4
mov #0, r5
mov.l 0f, r6
mova 2f, r0
mov r0, r7
mov.l 1f, r0
jmp @r0
nop
.balign 4
0: .long main
1: .long __libc_init
2: .long __PREINIT_ARRAY__
.long __INIT_ARRAY__
.long __FINI_ARRAY__
.long __CTOR_LIST__
.section .preinit_array, "aw"
.globl __PREINIT_ARRAY__
__PREINIT_ARRAY__:
.long -1
.section .init_array, "aw"
.globl __INIT_ARRAY__
__INIT_ARRAY__:
.long -1
.section .fini_array, "aw"
.globl __FINI_ARRAY__
__FINI_ARRAY__:
.long -1
.section .ctors, "aw"
.globl __CTOR_LIST__
__CTOR_LIST__:
.long -1
#include "__dso_handle.S"

View File

@@ -1,103 +0,0 @@
/* $NetBSD: ffs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by ITOH Yasufumi.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: ffs.S,v 1.1 2005/12/20 19:28:50 christos Exp $")
#endif
/*
* ffs - find first bit set
*
* This code makes use of ``test 8bit'' and ``shift 8bit'' instructions.
* The remaining 8bit is tested in every 2bit.
*/
ENTRY(ffs)
mov r4,r0 ! using r0 specific instructions
tst #0xff,r0
bf/s L8bit
mov #0+1,r1 ! ret = 1..8
tst r0,r0 ! ffs(0) is 0
bt Lzero ! testing here to accelerate ret=1..8 cases
shlr8 r0
tst #0xff,r0
bf/s L8bit
mov #8+1,r1 ! ret = 9..16
shlr8 r0
tst #0xff,r0
bf/s L8bit
mov #16+1,r1 ! ret = 17..24
shlr8 r0
mov #24+1,r1 ! ret = 25..32
L8bit:
tst #0x0f,r0
bt 4f
tst #0x03,r0
bt 2f
tst #0x01,r0 ! not bit 0 -> T
mov #0,r0
rts
addc r1,r0 ! 0 + r1 + T -> r0
2: tst #0x04,r0
mov #2,r0
rts
addc r1,r0
4: tst #0x30,r0
bt 6f
tst #0x10,r0
mov #4,r0
rts
addc r1,r0
6: tst #0x40,r0
mov #6,r0
rts
addc r1,r0
Lzero: rts
nop

View File

@@ -1,268 +0,0 @@
/* $OpenBSD: memcpy.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $ */
/* $NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */
/*
* Copyright (c) 2000 SHIMIZU Ryo <ryo@misakimix.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#if !defined(MEMCOPY) && !defined(MEMMOVE) && !defined(BCOPY)
#define MEMCOPY
#endif
#if defined(MEMCOPY) || defined(MEMMOVE)
#define REG_DST0 r3
#define REG_SRC r5
#define REG_DST r4
#else
#define REG_SRC r4
#define REG_DST r5
#endif
#define REG_LEN r6
#if defined(MEMCOPY)
ENTRY(memcpy)
#elif defined(MEMMOVE)
ENTRY(memmove)
#elif defined(BCOPY)
ENTRY(bcopy)
#endif
#ifdef REG_DST0
mov REG_DST,REG_DST0
#endif
cmp/eq REG_DST,REG_SRC /* if ( src == dst ) return; */
bt/s bcopy_return
cmp/hi REG_DST,REG_SRC
bf/s bcopy_overlap
mov REG_SRC,r0
xor REG_DST,r0
and #3,r0
mov r0,r1
tst r0,r0 /* (src ^ dst) & 3 */
bf/s word_align
longword_align:
tst REG_LEN,REG_LEN /* if ( len==0 ) return; */
bt/s bcopy_return
mov REG_SRC,r0
tst #1,r0 /* if ( src & 1 ) */
bt 1f
mov.b @REG_SRC+,r0 /* *dst++ = *src++; */
add #-1,REG_LEN
mov.b r0,@REG_DST
add #1,REG_DST
1:
mov #1,r0
cmp/hi r0,REG_LEN /* if ( (len > 1) && */
bf/s 1f
mov REG_SRC,r0
tst #2,r0 /* (src & 2) { */
bt 1f
mov.w @REG_SRC+,r0 /* *((unsigned short*)dst)++ = *((unsigned short*)src)++; */
add #-2,REG_LEN /* len -= 2; */
mov.w r0,@REG_DST
add #2,REG_DST /* } */
1:
mov #3,r1
cmp/hi r1,REG_LEN /* while ( len > 3 ) { */
bf/s no_align_delay
tst REG_LEN,REG_LEN
2:
mov.l @REG_SRC+,r0 /* *((unsigned long*)dst)++ = *((unsigned long*)src)++; */
add #-4,REG_LEN /* len -= 4; */
mov.l r0,@REG_DST
cmp/hi r1,REG_LEN
bt/s 2b
add #4,REG_DST /* } */
bra no_align_delay
tst REG_LEN,REG_LEN
word_align:
mov r1,r0
tst #1,r0
bf/s no_align_delay
tst REG_LEN,REG_LEN /* if ( len == 0 ) return; */
bt bcopy_return
mov REG_SRC,r0 /* if ( src & 1 ) */
tst #1,r0
bt 1f
mov.b @REG_SRC+,r0 /* *dst++ = *src++; */
add #-1,REG_LEN
mov.b r0,@REG_DST
add #1,REG_DST
1:
mov #1,r1
cmp/hi r1,REG_LEN /* while ( len > 1 ) { */
bf/s no_align_delay
tst REG_LEN,REG_LEN
2:
mov.w @REG_SRC+,r0 /* *((unsigned short*)dst)++ = *((unsigned short*)src)++; */
add #-2,REG_LEN /* len -= 2; */
mov.w r0,@REG_DST
cmp/hi r1,REG_LEN
bt/s 2b
add #2,REG_DST /* } */
no_align:
tst REG_LEN,REG_LEN /* while ( len!= ) { */
no_align_delay:
bt bcopy_return
1:
mov.b @REG_SRC+,r0 /* *dst++ = *src++; */
add #-1,REG_LEN /* len--; */
mov.b r0,@REG_DST
tst REG_LEN,REG_LEN
bf/s 1b
add #1,REG_DST /* } */
bcopy_return:
rts
#ifdef REG_DST0
mov REG_DST0,r0
#else
nop
#endif
bcopy_overlap:
add REG_LEN,REG_SRC
add REG_LEN,REG_DST
mov REG_SRC,r0
xor REG_DST,r0
and #3,r0
mov r0,r1
tst r0,r0 /* (src ^ dst) & 3 */
bf/s ov_word_align
ov_longword_align:
tst REG_LEN,REG_LEN /* if ( len==0 ) return; */
bt/s bcopy_return
mov REG_SRC,r0
tst #1,r0 /* if ( src & 1 ) */
bt 1f
add #-1,REG_SRC /* *--dst = *--src; */
mov.b @REG_SRC,r0
mov.b r0,@-REG_DST
add #-1,REG_LEN
1:
mov #1,r0
cmp/hi r0,REG_LEN /* if ( (len > 1) && */
bf/s 1f
mov REG_SRC,r0
tst #2,r0 /* (src & 2) { */
bt 1f
add #-2,REG_SRC /* *--((unsigned short*)dst) = *--((unsigned short*)src); */
mov.w @REG_SRC,r0
add #-2,REG_LEN /* len -= 2; */
mov.w r0,@-REG_DST /* } */
1:
mov #3,r1
cmp/hi r1,REG_LEN /* while ( len > 3 ) { */
bf/s ov_no_align_delay
tst REG_LEN,REG_LEN
2:
add #-4,REG_SRC
mov.l @REG_SRC,r0 /* *((unsigned long*)dst)++ = *((unsigned long*)src)++; */
add #-4,REG_LEN /* len -= 4; */
cmp/hi r1,REG_LEN
bt/s 2b
mov.l r0,@-REG_DST /* } */
bra ov_no_align_delay
tst REG_LEN,REG_LEN
ov_word_align:
mov r1,r0
tst #1,r0
bf/s ov_no_align_delay
tst REG_LEN,REG_LEN /* if ( len == 0 ) return; */
bt bcopy_return
mov REG_SRC,r0 /* if ( src & 1 ) */
tst #1,r0
bt 1f
add #-1,REG_SRC
mov.b @REG_SRC,r0 /* *--dst = *--src; */
add #-1,REG_LEN
mov.b r0,@-REG_DST
1:
mov #1,r1
cmp/hi r1,REG_LEN /* while ( len > 1 ) { */
bf/s ov_no_align_delay
tst REG_LEN,REG_LEN
2:
add #-2,REG_SRC
mov.w @REG_SRC,r0 /* *--((unsigned short*)dst) = *--((unsigned short*)src); */
add #-2,REG_LEN /* len -= 2; */
cmp/hi r1,REG_LEN
bt/s 2b
mov.w r0,@-REG_DST /* } */
ov_no_align:
tst REG_LEN,REG_LEN /* while ( len!= ) { */
ov_no_align_delay:
bt 9f
1:
add #-1,REG_SRC
mov.b @REG_SRC,r0 /* *--dst = *--src; */
add #-1,REG_LEN /* len--; */
tst REG_LEN,REG_LEN
bf/s 1b
mov.b r0,@-REG_DST /* } */
9:
rts
#ifdef REG_DST0
mov REG_DST0,r0
#else
nop
#endif

View File

@@ -1,5 +0,0 @@
/* $OpenBSD: memmove.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $ */
/* $NetBSD: memmove.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */
#define MEMMOVE
#include "memcpy.S"

View File

@@ -1,295 +0,0 @@
/* $OpenBSD: memset.S,v 1.1.1.1 2006/10/10 22:07:10 miod Exp $ */
/* $NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */
/*-
* Copyright (c) 2002 SHIMIZU Ryo. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/asm.h>
#define REG_PTR r0
#define REG_TMP1 r1
#ifdef BZERO
# define REG_C r2
# define REG_DST r4
# define REG_LEN r5
#else
# define REG_DST0 r3
# define REG_DST r4
# define REG_C r5
# define REG_LEN r6
#endif
#ifdef BZERO
ENTRY(bzero)
#else
ENTRY(memset)
mov REG_DST,REG_DST0 /* for return value */
#endif
/* small amount to fill ? */
mov #28,REG_TMP1
cmp/hs REG_TMP1,REG_LEN /* if (len >= 28) goto large; */
bt/s large
mov #12,REG_TMP1 /* if (len >= 12) goto small; */
cmp/hs REG_TMP1,REG_LEN
bt/s small
#ifdef BZERO
mov #0,REG_C
#endif
/* very little fill (0 ~ 11 bytes) */
tst REG_LEN,REG_LEN
add REG_DST,REG_LEN
bt/s done
add #1,REG_DST
/* unroll 4 loops */
cmp/eq REG_DST,REG_LEN
1: mov.b REG_C,@-REG_LEN
bt/s done
cmp/eq REG_DST,REG_LEN
mov.b REG_C,@-REG_LEN
bt/s done
cmp/eq REG_DST,REG_LEN
mov.b REG_C,@-REG_LEN
bt/s done
cmp/eq REG_DST,REG_LEN
mov.b REG_C,@-REG_LEN
bf/s 1b
cmp/eq REG_DST,REG_LEN
done:
#ifdef BZERO
rts
nop
#else
rts
mov REG_DST0,r0
#endif
small:
mov REG_DST,r0
tst #1,r0
bt/s small_aligned
mov REG_DST,REG_TMP1
shll REG_LEN
mova 1f,r0 /* 1f must be 4bytes aligned! */
add #16,REG_TMP1 /* REG_TMP1 = dst+16; */
sub REG_LEN,r0
jmp @r0
mov REG_C,r0
.align 2
mov.b r0,@(15,REG_TMP1)
mov.b r0,@(14,REG_TMP1)
mov.b r0,@(13,REG_TMP1)
mov.b r0,@(12,REG_TMP1)
mov.b r0,@(11,REG_TMP1)
mov.b r0,@(10,REG_TMP1)
mov.b r0,@(9,REG_TMP1)
mov.b r0,@(8,REG_TMP1)
mov.b r0,@(7,REG_TMP1)
mov.b r0,@(6,REG_TMP1)
mov.b r0,@(5,REG_TMP1)
mov.b r0,@(4,REG_TMP1)
mov.b r0,@(3,REG_TMP1)
mov.b r0,@(2,REG_TMP1)
mov.b r0,@(1,REG_TMP1)
mov.b r0,@REG_TMP1
mov.b r0,@(15,REG_DST)
mov.b r0,@(14,REG_DST)
mov.b r0,@(13,REG_DST)
mov.b r0,@(12,REG_DST)
mov.b r0,@(11,REG_DST)
mov.b r0,@(10,REG_DST)
mov.b r0,@(9,REG_DST)
mov.b r0,@(8,REG_DST)
mov.b r0,@(7,REG_DST)
mov.b r0,@(6,REG_DST)
mov.b r0,@(5,REG_DST)
mov.b r0,@(4,REG_DST)
mov.b r0,@(3,REG_DST)
mov.b r0,@(2,REG_DST)
mov.b r0,@(1,REG_DST)
#ifdef BZERO
rts
1: mov.b r0,@REG_DST
#else
mov.b r0,@REG_DST
1: rts
mov REG_DST0,r0
#endif
/* 2 bytes aligned small fill */
small_aligned:
#ifndef BZERO
extu.b REG_C,REG_TMP1 /* REG_C = ??????xx, REG_TMP1 = ????00xx */
shll8 REG_C /* REG_C = ????xx00, REG_TMP1 = ????00xx */
or REG_TMP1,REG_C /* REG_C = ????xxxx */
#endif
mov REG_LEN,r0
tst #1,r0 /* len is aligned? */
bt/s 1f
add #-1,r0
mov.b REG_C,@(r0,REG_DST) /* fill last a byte */
mov r0,REG_LEN
1:
mova 1f,r0 /* 1f must be 4bytes aligned! */
sub REG_LEN,r0
jmp @r0
mov REG_C,r0
.align 2
mov.w r0,@(30,REG_DST)
mov.w r0,@(28,REG_DST)
mov.w r0,@(26,REG_DST)
mov.w r0,@(24,REG_DST)
mov.w r0,@(22,REG_DST)
mov.w r0,@(20,REG_DST)
mov.w r0,@(18,REG_DST)
mov.w r0,@(16,REG_DST)
mov.w r0,@(14,REG_DST)
mov.w r0,@(12,REG_DST)
mov.w r0,@(10,REG_DST)
mov.w r0,@(8,REG_DST)
mov.w r0,@(6,REG_DST)
mov.w r0,@(4,REG_DST)
mov.w r0,@(2,REG_DST)
#ifdef BZERO
rts
1: mov.w r0,@REG_DST
#else
mov.w r0,@REG_DST
1: rts
mov REG_DST0,r0
#endif
.align 2
large:
#ifdef BZERO
mov #0,REG_C
#else
extu.b REG_C,REG_TMP1 /* REG_C = ??????xx, REG_TMP1 = ????00xx */
shll8 REG_C /* REG_C = ????xx00, REG_TMP1 = ????00xx */
or REG_C,REG_TMP1 /* REG_C = ????xx00, REG_TMP1 = ????xxxx */
swap.w REG_TMP1,REG_C /* REG_C = xxxx????, REG_TMP1 = ????xxxx */
xtrct REG_TMP1,REG_C /* REG_C = xxxxxxxx */
#endif
mov #3,REG_TMP1
tst REG_TMP1,REG_DST
mov REG_DST,REG_PTR
bf/s unaligned_dst
add REG_LEN,REG_PTR /* REG_PTR = dst + len; */
tst REG_TMP1,REG_LEN
bf/s unaligned_len
aligned:
/* fill 32*n bytes */
mov #32,REG_TMP1
cmp/hi REG_LEN,REG_TMP1
bt 9f
.align 2
1: sub REG_TMP1,REG_PTR
mov.l REG_C,@REG_PTR
sub REG_TMP1,REG_LEN
mov.l REG_C,@(4,REG_PTR)
cmp/hi REG_LEN,REG_TMP1
mov.l REG_C,@(8,REG_PTR)
mov.l REG_C,@(12,REG_PTR)
mov.l REG_C,@(16,REG_PTR)
mov.l REG_C,@(20,REG_PTR)
mov.l REG_C,@(24,REG_PTR)
bf/s 1b
mov.l REG_C,@(28,REG_PTR)
9:
/* fill left 4*n bytes */
cmp/eq REG_DST,REG_PTR
bt 9f
add #4,REG_DST
cmp/eq REG_DST,REG_PTR
1: mov.l REG_C,@-REG_PTR
bt/s 9f
cmp/eq REG_DST,REG_PTR
mov.l REG_C,@-REG_PTR
bt/s 9f
cmp/eq REG_DST,REG_PTR
mov.l REG_C,@-REG_PTR
bt/s 9f
cmp/eq REG_DST,REG_PTR
mov.l REG_C,@-REG_PTR
bf/s 1b
cmp/eq REG_DST,REG_PTR
9:
#ifdef BZERO
rts
nop
#else
rts
mov REG_DST0,r0
#endif
unaligned_dst:
mov #1,REG_TMP1
tst REG_TMP1,REG_DST /* if (dst & 1) { */
add #1,REG_TMP1
bt/s 2f
tst REG_TMP1,REG_DST
mov.b REG_C,@REG_DST /* *dst++ = c; */
add #1,REG_DST
tst REG_TMP1,REG_DST
2: /* } */
/* if (dst & 2) { */
bt 4f
mov.w REG_C,@REG_DST /* *(u_int16_t*)dst++ = c; */
add #2,REG_DST
4: /* } */
tst #3,REG_PTR /* if (ptr & 3) { */
bt/s 4f /* */
unaligned_len:
tst #1,REG_PTR /* if (ptr & 1) { */
bt/s 2f
tst #2,REG_PTR
mov.b REG_C,@-REG_PTR /* --ptr = c; */
2: /* } */
/* if (ptr & 2) { */
bt 4f
mov.w REG_C,@-REG_PTR /* *--(u_int16_t*)ptr = c; */
4: /* } */
/* } */
mov REG_PTR,REG_LEN
bra aligned
sub REG_DST,REG_LEN

View File

@@ -1,167 +0,0 @@
/* $OpenBSD: setjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $ */
/* $NetBSD: setjmp.S,v 1.10 2006/01/05 19:21:37 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
/*
* C library -- setjmp, longjmp
*
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
* by restoring registers from the stack.
* The previous signal state is restored.
*/
ENTRY(setjmp)
PIC_PROLOGUE(.L_got_1)
sts.l pr, @-sp
mov.l r4, @-sp
mov.l .L_sigprocmask_1, r0
mov r4, r6
mov #1, r4 /* how = SIG_BLOCK */
mov #0, r5 /* new = NULL */
1: CALL r0
add #4, r6 /* old = &sigmask */
mov.l @sp+, r4
lds.l @sp+, pr
PIC_EPILOGUE
/* identical to _setjmp except that the first word is non-zero */
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
add #(_JBLEN * 4), r4
sts fpscr, r1
xor r0, r0
mov.l r1, @-r4
lds r0, fpscr
sts.l fpul, @-r4
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
frchg
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
lds r1, fpscr
#else
add #((_JBLEN - 10) * 4), r4
#endif
sts.l mach, @-r4
sts.l macl, @-r4
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
sts.l pr, @-r4
add #-4, r4 /* skip signal mask */
mov #1, r0
mov.l r0, @-r4 /* has signal mask */
rts
xor r0, r0
.align 2
.L_got_1: PIC_GOT_DATUM
.L_sigprocmask_1: CALL_DATUM(_C_LABEL(sigprocmask), 1b)
SET_ENTRY_SIZE(setjmp)
ENTRY(longjmp)
/* we won't return here, so we don't need to save pr and r12 */
PIC_PROLOGUE_NOSAVE(.L_got_2)
mov.l r5, @-sp
mov.l r4, @-sp
mov.l .L_sigprocmask_2, r0
mov r4, r5
mov #3, r4 /* how = SIG_SETMASK */
add #4, r5 /* new = &sigmask */
1: CALL r0
mov #0, r6 /* old = NULL */
mov.l @sp+, r4
mov.l @sp+, r5
/* identical to _longjmp */
add #8, r4
lds.l @r4+, pr
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
lds.l @r4+, macl
lds.l @r4+, mach
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
xor r0, r0
lds r0, fpscr
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
lds.l @r4+, fpul
lds.l @r4+, fpscr
#endif
mov r5, r0
tst r0, r0 /* make sure return value is non-zero */
bf .L0
add #1, r0
.L0:
rts
nop
.align 2
.L_got_2: PIC_GOT_DATUM
.L_sigprocmask_2: CALL_DATUM(_C_LABEL(sigprocmask), 1b)
SET_ENTRY_SIZE(longjmp)

View File

@@ -1,166 +0,0 @@
/* $OpenBSD: sigsetjmp.S,v 1.2 2007/03/02 06:11:54 miod Exp $ */
/* $NetBSD: sigsetjmp.S,v 1.9 2006/01/05 19:21:37 uwe Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)setjmp.s 5.1 (Berkeley) 4/23/90
*/
#include <machine/asm.h>
#include <machine/setjmp.h>
ENTRY(sigsetjmp)
tst r5, r5 /* if (savemask == 0) */
bt 2f
/* identical to setjmp */
PIC_PROLOGUE(.L_got_1)
sts.l pr, @-sp
mov.l r4, @-sp
mov.l r5, @-sp
mov.l .L_sigprocmask_1, r0
mov r4, r6
mov #1, r4 /* how = SIG_BLOCK */
mov #0, r5 /* new = NULL */
1: CALL r0
add #4, r6 /* old = &sigmask */
mov.l @sp+, r5
mov.l @sp+, r4
lds.l @sp+, pr
PIC_EPILOGUE
2: /* identical to _setjmp except that first word is in r5 */
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
add #(_JBLEN * 4), r4
sts fpscr, r1
xor r0, r0
mov.l r1, @-r4
lds r0, fpscr
sts.l fpul, @-r4
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
frchg
fmov.s fr15, @-r4
fmov.s fr14, @-r4
fmov.s fr13, @-r4
fmov.s fr12, @-r4
lds r1, fpscr
#else
add #((_JBLEN - 10) * 4), r4
#endif
sts.l mach, @-r4
sts.l macl, @-r4
mov.l r15, @-r4
mov.l r14, @-r4
mov.l r13, @-r4
mov.l r12, @-r4
mov.l r11, @-r4
mov.l r10, @-r4
mov.l r9, @-r4
mov.l r8, @-r4
sts.l pr, @-r4
add #-4, r4 /* skip signal mask */
mov.l r5, @-r4 /* has signal mask? */
rts
xor r0, r0
.align 2
.L_got_1: PIC_GOT_DATUM
.L_sigprocmask_1: CALL_DATUM(_C_LABEL(sigprocmask), 1b)
SET_ENTRY_SIZE(sigsetjmp)
ENTRY(siglongjmp)
mov.l @r4+, r0
tst r0, r0
bt 2f /* if no mask */
/* identical to longjmp */
/* we won't return here, so we don't need to save pr and r12 */
PIC_PROLOGUE_NOSAVE(.L_got_2)
mov.l r5, @-sp
mov.l r4, @-sp
mov.l .L_sigprocmask_2, r0
mov r4, r5 /* new = &sigmask */
mov #3, r4 /* how = SIG_SETMASK */
1: CALL r0
mov #0, r6 /* old = NULL */
mov.l @sp+, r4
mov.l @sp+, r5
2: /* identical to _longjmp */
add #4, r4
lds.l @r4+, pr
mov.l @r4+, r8
mov.l @r4+, r9
mov.l @r4+, r10
mov.l @r4+, r11
mov.l @r4+, r12
mov.l @r4+, r13
mov.l @r4+, r14
mov.l @r4+, r15
lds.l @r4+, macl
lds.l @r4+, mach
#if defined(__SH4__) && !defined(__SH4_NOFPU__)
xor r0, r0
lds r0, fpscr
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
frchg
fmov.s @r4+, fr12
fmov.s @r4+, fr13
fmov.s @r4+, fr14
fmov.s @r4+, fr15
lds.l @r4+, fpul
lds.l @r4+, fpscr
#endif
mov r5, r0
tst r0, r0 /* make sure return value is non-zero */
bf .L0
add #1, r0
.L0:
rts
nop
.align 2
.L_got_2: PIC_GOT_DATUM
.L_sigprocmask_2: CALL_DATUM(_C_LABEL(sigprocmask), 1b)
SET_ENTRY_SIZE(siglongjmp)

View File

@@ -1,69 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/linux-syscalls.h>
.text
.type syscall, @function
.globl syscall
.align 4
/*
* Current implementation assumes that the all syscall
* has maximum 7 arguments.
*/
syscall:
/* get args */
mov r4, r3 /* system call number */
mov r5, r4
mov r6, r5
mov r7, r6
mov.l @r15, r7
mov.l @(4, r15), r0
mov.l @(8, r15), r1
mov.l @(12, r15), r2
/* invoke trap */
trapa #(7 + 0x10) /* assuming 7 arguments */
/* check return value */
cmp/pz r0
bt end
/* keep error number */
mov.l r0, @-r15
mov.l 0f, r1
jsr @r1
mov r0, r4
mov.l @r15+, r0
end:
rts
nop
.align 2
0: .long __set_errno

View File

@@ -1,30 +0,0 @@
/*
* Copyright (C) 2009 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
typedef long unsigned int *_Unwind_Ptr;

View File

@@ -1,39 +0,0 @@
/* $OpenBSD: endian.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
/* $NetBSD: endian.h,v 1.4 2000/03/17 00:09:25 mycroft Exp $ */
/* Written by Manuel Bouyer. Public domain */
#ifndef _SH_ENDIAN_H_
#define _SH_ENDIAN_H_
#ifdef __GNUC__
#define __swap64md __swap64gen
#define __swap16md(x) ({ \
uint16_t rval; \
\
__asm volatile ("swap.b %1,%0" : "=r"(rval) : "r"(x)); \
\
rval; \
})
#define __swap32md(x) ({ \
uint32_t rval; \
\
__asm volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0" \
: "=r"(rval) : "r"(x)); \
\
rval; \
})
#define MD_SWAP
#endif /* __GNUC_ */
#define _BYTE_ORDER _LITTLE_ENDIAN
#include <sys/endian.h>
#define __STRICT_ALIGNMENT
#endif /* !_SH_ENDIAN_H_ */

View File

@@ -1,126 +0,0 @@
/* $OpenBSD: _types.h,v 1.6 2008/07/21 20:50:55 martynas Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
* @(#)ansi.h 8.2 (Berkeley) 1/4/94
*/
#ifndef _SH__TYPES_H_
#define _SH__TYPES_H_
#if defined(_KERNEL)
typedef struct label_t {
int val[9];
} label_t;
#endif
/* 7.18.1.1 Exact-width integer types */
typedef __signed char __int8_t;
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
/* LONGLONG */
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef __int8_t __int_least8_t;
typedef __uint8_t __uint_least8_t;
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
typedef __int64_t __int_least64_t;
typedef __uint64_t __uint_least64_t;
/* 7.18.1.3 Fastest minimum-width integer types */
typedef __int32_t __int_fast8_t;
typedef __uint32_t __uint_fast8_t;
typedef __int32_t __int_fast16_t;
typedef __uint32_t __uint_fast16_t;
typedef __int32_t __int_fast32_t;
typedef __uint32_t __uint_fast32_t;
typedef __int64_t __int_fast64_t;
typedef __uint64_t __uint_fast64_t;
/* 7.18.1.4 Integer types capable of holding object pointers */
typedef long __intptr_t;
typedef unsigned long __uintptr_t;
/* 7.18.1.5 Greatest-width integer types */
typedef __int64_t __intmax_t;
typedef __uint64_t __uintmax_t;
/* Register size */
typedef __uint32_t __register_t;
/* VM system types */
typedef unsigned long __vaddr_t;
typedef unsigned long __paddr_t;
typedef unsigned long __vsize_t;
typedef unsigned long __psize_t;
/* Standard system types */
typedef int __clock_t;
typedef int __clockid_t;
typedef double __double_t;
typedef float __float_t;
typedef long long __off_t;
typedef long __ptrdiff_t;
#if 0
/* cut it off for Android-SH */
typedef unsigned long __size_t;
#endif
typedef long __ssize_t;
typedef int __time_t;
typedef int __timer_t;
#if defined(__GNUC__) && __GNUC__ >= 3
typedef __builtin_va_list __va_list;
#else
struct __va_list_tag;
typedef struct __va_list_tag * __va_list;
#endif
/* Wide character support types */
#ifndef __cplusplus
typedef int __wchar_t;
#endif
typedef int __wint_t;
typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
/* Feature test macros */
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#endif /* _SH__TYPES_H_ */

View File

@@ -1,217 +0,0 @@
/* $OpenBSD: asm.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
/* $NetBSD: asm.h,v 1.25 2006/01/20 22:02:40 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)asm.h 5.5 (Berkeley) 5/7/91
*/
#ifndef _SH_ASM_H_
#define _SH_ASM_H_
#ifdef __ELF__
# define _C_LABEL(x) x
#else
#ifdef __STDC__
# define _C_LABEL(x) _ ## x
#else
# define _C_LABEL(x) _/**/x
#endif
#endif
#define _ASM_LABEL(x) x
#ifdef __STDC__
# define __CONCAT(x,y) x ## y
# define __STRING(x) #x
#else
# define __CONCAT(x,y) x/**/y
# define __STRING(x) "x"
#endif
/* let kernels and others override entrypoint alignment */
#ifndef _ALIGN_TEXT
# define _ALIGN_TEXT .align 2
#endif
#ifdef __ELF__
#define _ENTRY(x) \
.text ;\
_ALIGN_TEXT ;\
.globl x ;\
.type x,@function ;\
x:
#else /* !__ELF__ */
#define _ENTRY(x) \
.text ;\
_ALIGN_TEXT ;\
.globl x ;\
x:
#endif /* !__ELF__ */
#ifdef GPROF
#define _PROF_PROLOGUE \
mov.l 1f,r1 ; \
mova 2f,r0 ; \
jmp @r1 ; \
nop ; \
.align 2 ; \
1: .long __mcount ; \
2:
#else /* !GPROF */
#define _PROF_PROLOGUE
#endif /* !GPROF */
#define ENTRY(y) _ENTRY(_C_LABEL(y)) _PROF_PROLOGUE
#define NENTRY(y) _ENTRY(_C_LABEL(y))
#define ASENTRY(y) _ENTRY(_ASM_LABEL(y)) _PROF_PROLOGUE
#define SET_ENTRY_SIZE(y) \
.size _C_LABEL(y), . - _C_LABEL(y)
#define SET_ASENTRY_SIZE(y) \
.size _ASM_LABEL(y), . - _ASM_LABEL(y)
#ifdef __ELF__
#define ALTENTRY(name) \
.globl _C_LABEL(name) ;\
.type _C_LABEL(name),@function ;\
_C_LABEL(name):
#else
#define ALTENTRY(name) \
.globl _C_LABEL(name) ;\
_C_LABEL(name):
#endif
/*
* Hide the gory details of PIC calls vs. normal calls. Use as in the
* following example:
*
* sts.l pr, @-sp
* PIC_PROLOGUE(.L_got, r0) ! saves old r12 on stack
* ...
* mov.l .L_function_1, r0
* 1: CALL r0 ! each call site needs a label
* nop
* ...
* mov.l .L_function_2, r0
* 2: CALL r0
* nop
* ...
* PIC_EPILOGUE ! restores r12 from stack
* lds.l @sp+, pr ! so call in right order
* rts
* nop
*
* .align 2
* .L_got:
* PIC_GOT_DATUM
* .L_function_1: ! if you call the same function twice
* CALL_DATUM(function, 1b) ! provide call datum for each call
* .L_function_2:
* CALL_DATUM(function, 2b)
*/
#ifdef PIC
#define PIC_PLT(x) x@PLT
#define PIC_GOT(x) x@GOT
#define PIC_GOTOFF(x) x@GOTOFF
#define PIC_PROLOGUE(got) \
mov.l r12, @-sp; \
PIC_PROLOGUE_NOSAVE(got)
/*
* Functions that do non local jumps don't need to preserve r12,
* so we can shave off two instructions to save/restore it.
*/
#define PIC_PROLOGUE_NOSAVE(got) \
mov.l got, r12; \
mova got, r0; \
add r0, r12
#define PIC_EPILOGUE \
mov.l @sp+, r12
#define PIC_EPILOGUE_SLOT \
PIC_EPILOGUE
#define PIC_GOT_DATUM \
.long _GLOBAL_OFFSET_TABLE_
#define CALL bsrf
#define JUMP braf
#define CALL_DATUM(function, lpcs) \
.long PIC_PLT(function) - ((lpcs) + 4 - (.))
/*
* This will result in text relocations in the shared library,
* unless the function is local or has hidden or protected visibility.
* Does not require PIC prologue.
*/
#define CALL_DATUM_LOCAL(function, lpcs) \
.long function - ((lpcs) + 4)
#else /* !PIC */
#define PIC_PROLOGUE(label)
#define PIC_PROLOGUE_NOSAVE(label)
#define PIC_EPILOGUE
#define PIC_EPILOGUE_SLOT nop
#define PIC_GOT_DATUM
#define CALL jsr @
#define JUMP jmp @
#define CALL_DATUM(function, lpcs) \
.long function
#define CALL_DATUM_LOCAL(function, lpcs) \
.long function
#endif /* !PIC */
#define ASMSTR .asciz
#ifdef __ELF__
#define WEAK_ALIAS(alias,sym) \
.weak _C_LABEL(alias); \
_C_LABEL(alias) = _C_LABEL(sym)
#endif
#define WARN_REFERENCES(_sym,_msg) \
.section .gnu.warning._sym; .ascii _msg; .previous
#endif /* !_SH_ASM_H_ */

View File

@@ -1,35 +0,0 @@
/* $OpenBSD: exec.h,v 1.2 2006/11/10 20:34:06 drahn Exp $ */
/* $NetBSD: elf_machdep.h,v 1.8 2002/04/28 17:10:34 uch Exp $ */
#define __LDPGSZ 4096
#define NATIVE_EXEC_ELF
#define ARCH_ELFSIZE 32 /* MD native binary size */
#define ELF_TARG_CLASS ELFCLASS32
#ifdef __LITTLE_ENDIAN__
#define ELF_TARG_DATA ELFDATA2LSB
#else
#define ELF_TARG_DATA ELFDATA2MSB
#endif
#define ELF_TARG_MACH EM_SH
#define _KERN_DO_ELF
#define _NLIST_DO_ELF
/*
* SuperH ELF header flags.
*/
#define EF_SH_MACH_MASK 0x1f
#define EF_SH_UNKNOWN 0x00
#define EF_SH_SH1 0x01
#define EF_SH_SH2 0x02
#define EF_SH_SH3 0x03
#define EF_SH_DSP 0x04
#define EF_SH_SH3_DSP 0x05
#define EF_SH_SH3E 0x08
#define EF_SH_SH4 0x09
#define EF_SH_HAS_DSP(x) ((x) & EF_SH_DSP)
#define EF_SH_HAS_FP(x) ((x) & EF_SH_SH3E)

View File

@@ -1,132 +0,0 @@
/* $OpenBSD: ieee.h,v 1.2 2006/11/10 20:29:36 otto Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
*/
/*
* ieee.h defines the machine-dependent layout of the machine's IEEE
* floating point. It does *not* define (yet?) any of the rounding
* mode bits, exceptions, and so forth.
*/
/*
* Define the number of bits in each fraction and exponent.
*
* k k+1
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
*
* (-exp_bias+1)
* as fractions that look like 0.fffff x 2 . This means that
*
* -126
* the number 0.10000 x 2 , for instance, is the same as the normalized
*
* -127 -128
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
*
* -129
* in the fraction; to represent 2 , we need two, and so on. This
*
* (-exp_bias-fracbits+1)
* implies that the smallest denormalized number is 2
*
* for whichever format we are talking about: for single precision, for
*
* -126 -149
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
*
* -149 == -127 - 23 + 1.
*/
#define SNG_EXPBITS 8
#define SNG_FRACBITS 23
#define DBL_EXPBITS 11
#define DBL_FRACBITS 52
#define EXT_EXPBITS 15
#define EXT_FRACBITS 112
struct ieee_single {
u_int sng_frac:23;
u_int sng_exp:8;
u_int sng_sign:1;
};
struct ieee_double {
u_int dbl_fracl;
u_int dbl_frach:20;
u_int dbl_exp:11;
u_int dbl_sign:1;
};
struct ieee_ext {
u_int ext_sign:1;
u_int ext_exp:15;
u_int ext_frach:16;
u_int ext_frachm;
u_int ext_fraclm;
u_int ext_fracl;
};
/*
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
* Floats whose exponent is zero are either zero (iff all fraction
* bits are zero) or subnormal values.
*
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
* high fraction; if the bit is set, it is a `quiet NaN'.
*/
#define SNG_EXP_INFNAN 255
#define DBL_EXP_INFNAN 2047
#define EXT_EXP_INFNAN 32767
#if 0
#define SNG_QUIETNAN (1 << 22)
#define DBL_QUIETNAN (1 << 19)
#define EXT_QUIETNAN (1 << 15)
#endif
/*
* Exponent biases.
*/
#define SNG_EXP_BIAS 127
#define DBL_EXP_BIAS 1023
#define EXT_EXP_BIAS 16383

View File

@@ -1,6 +0,0 @@
/* $OpenBSD: internal_types.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
/* Public domain */
#ifndef _SH_INTERNAL_TYPES_H_
#define _SH_INTERNAL_TYPES_H_
#endif

View File

@@ -1,60 +0,0 @@
/* $OpenBSD: limits.h,v 1.1.1.1 2006/10/06 21:02:55 miod Exp $ */
/* $NetBSD: limits.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``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 TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SH_LIMITS_H_
#define _SH_LIMITS_H_
#include <sys/cdefs.h>
#define MB_LEN_MAX 1 /* no multibyte characters */
#ifndef SIZE_MAX
#define SIZE_MAX UINT_MAX /* max value for a size_t */
#endif
#define SSIZE_MAX INT_MAX /* max value for a ssize_t */
#if __BSD_VISIBLE
#define SIZE_T_MAX UINT_MAX /* max value for a size_t (historic) */
#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
#endif /* __BSD_VISIBLE */
#define LONGLONG_BIT 64
#define LONGLONG_MIN (-9223372036854775807LL-1)
#define LONGLONG_MAX 9223372036854775807LL
#define ULONGLONG_MAX 18446744073709551615ULL
#endif /* _SH_LIMITS_H_ */

View File

@@ -1,7 +0,0 @@
/* $OpenBSD: setjmp.h,v 1.2 2007/03/02 06:11:54 miod Exp $ */
/* $NetBSD: setjmp.h,v 1.3 2006/01/05 00:50:23 uwe Exp $ */
/*
* machine/setjmp.h: machine dependent setjmp-related information.
*/

View File

@@ -1,169 +0,0 @@
# auto-generated by gensyscalls.py, do not touch
syscall_src :=
syscall_src += arch-sh/syscalls/_exit.S
syscall_src += arch-sh/syscalls/_exit_thread.S
syscall_src += arch-sh/syscalls/__fork.S
syscall_src += arch-sh/syscalls/_waitpid.S
syscall_src += arch-sh/syscalls/__waitid.S
syscall_src += arch-sh/syscalls/__sys_clone.S
syscall_src += arch-sh/syscalls/execve.S
syscall_src += arch-sh/syscalls/__setuid.S
syscall_src += arch-sh/syscalls/getuid.S
syscall_src += arch-sh/syscalls/getgid.S
syscall_src += arch-sh/syscalls/geteuid.S
syscall_src += arch-sh/syscalls/getegid.S
syscall_src += arch-sh/syscalls/getresuid.S
syscall_src += arch-sh/syscalls/getresgid.S
syscall_src += arch-sh/syscalls/gettid.S
syscall_src += arch-sh/syscalls/getgroups.S
syscall_src += arch-sh/syscalls/getpgid.S
syscall_src += arch-sh/syscalls/getppid.S
syscall_src += arch-sh/syscalls/setsid.S
syscall_src += arch-sh/syscalls/setgid.S
syscall_src += arch-sh/syscalls/__setreuid.S
syscall_src += arch-sh/syscalls/__setresuid.S
syscall_src += arch-sh/syscalls/setresgid.S
syscall_src += arch-sh/syscalls/__brk.S
syscall_src += arch-sh/syscalls/kill.S
syscall_src += arch-sh/syscalls/tkill.S
syscall_src += arch-sh/syscalls/__ptrace.S
syscall_src += arch-sh/syscalls/__set_thread_area.S
syscall_src += arch-sh/syscalls/__getpriority.S
syscall_src += arch-sh/syscalls/setpriority.S
syscall_src += arch-sh/syscalls/setrlimit.S
syscall_src += arch-sh/syscalls/getrlimit.S
syscall_src += arch-sh/syscalls/getrusage.S
syscall_src += arch-sh/syscalls/setgroups.S
syscall_src += arch-sh/syscalls/setpgid.S
syscall_src += arch-sh/syscalls/vfork.S
syscall_src += arch-sh/syscalls/setregid.S
syscall_src += arch-sh/syscalls/chroot.S
syscall_src += arch-sh/syscalls/prctl.S
syscall_src += arch-sh/syscalls/capget.S
syscall_src += arch-sh/syscalls/capset.S
syscall_src += arch-sh/syscalls/sigaltstack.S
syscall_src += arch-sh/syscalls/acct.S
syscall_src += arch-sh/syscalls/read.S
syscall_src += arch-sh/syscalls/write.S
syscall_src += arch-sh/syscalls/pread64.S
syscall_src += arch-sh/syscalls/pwrite64.S
syscall_src += arch-sh/syscalls/__open.S
syscall_src += arch-sh/syscalls/__openat.S
syscall_src += arch-sh/syscalls/close.S
syscall_src += arch-sh/syscalls/lseek.S
syscall_src += arch-sh/syscalls/__llseek.S
syscall_src += arch-sh/syscalls/getpid.S
syscall_src += arch-sh/syscalls/__mmap2.S
syscall_src += arch-sh/syscalls/munmap.S
syscall_src += arch-sh/syscalls/mremap.S
syscall_src += arch-sh/syscalls/msync.S
syscall_src += arch-sh/syscalls/mprotect.S
syscall_src += arch-sh/syscalls/madvise.S
syscall_src += arch-sh/syscalls/mlock.S
syscall_src += arch-sh/syscalls/munlock.S
syscall_src += arch-sh/syscalls/mincore.S
syscall_src += arch-sh/syscalls/__ioctl.S
syscall_src += arch-sh/syscalls/readv.S
syscall_src += arch-sh/syscalls/writev.S
syscall_src += arch-sh/syscalls/__fcntl.S
syscall_src += arch-sh/syscalls/flock.S
syscall_src += arch-sh/syscalls/fchmod.S
syscall_src += arch-sh/syscalls/dup.S
syscall_src += arch-sh/syscalls/pipe2.S
syscall_src += arch-sh/syscalls/dup2.S
syscall_src += arch-sh/syscalls/select.S
syscall_src += arch-sh/syscalls/ftruncate.S
syscall_src += arch-sh/syscalls/ftruncate64.S
syscall_src += arch-sh/syscalls/getdents.S
syscall_src += arch-sh/syscalls/fsync.S
syscall_src += arch-sh/syscalls/fdatasync.S
syscall_src += arch-sh/syscalls/fchown.S
syscall_src += arch-sh/syscalls/sync.S
syscall_src += arch-sh/syscalls/__fcntl64.S
syscall_src += arch-sh/syscalls/__fstatfs64.S
syscall_src += arch-sh/syscalls/sendfile.S
syscall_src += arch-sh/syscalls/fstatat.S
syscall_src += arch-sh/syscalls/mkdirat.S
syscall_src += arch-sh/syscalls/fchownat.S
syscall_src += arch-sh/syscalls/fchmodat.S
syscall_src += arch-sh/syscalls/renameat.S
syscall_src += arch-sh/syscalls/link.S
syscall_src += arch-sh/syscalls/unlink.S
syscall_src += arch-sh/syscalls/unlinkat.S
syscall_src += arch-sh/syscalls/chdir.S
syscall_src += arch-sh/syscalls/mknod.S
syscall_src += arch-sh/syscalls/chmod.S
syscall_src += arch-sh/syscalls/chown.S
syscall_src += arch-sh/syscalls/lchown.S
syscall_src += arch-sh/syscalls/mount.S
syscall_src += arch-sh/syscalls/umount2.S
syscall_src += arch-sh/syscalls/fstat.S
syscall_src += arch-sh/syscalls/stat.S
syscall_src += arch-sh/syscalls/lstat.S
syscall_src += arch-sh/syscalls/mkdir.S
syscall_src += arch-sh/syscalls/readlink.S
syscall_src += arch-sh/syscalls/rmdir.S
syscall_src += arch-sh/syscalls/rename.S
syscall_src += arch-sh/syscalls/__getcwd.S
syscall_src += arch-sh/syscalls/access.S
syscall_src += arch-sh/syscalls/symlink.S
syscall_src += arch-sh/syscalls/fchdir.S
syscall_src += arch-sh/syscalls/truncate.S
syscall_src += arch-sh/syscalls/__statfs64.S
syscall_src += arch-sh/syscalls/pause.S
syscall_src += arch-sh/syscalls/gettimeofday.S
syscall_src += arch-sh/syscalls/settimeofday.S
syscall_src += arch-sh/syscalls/times.S
syscall_src += arch-sh/syscalls/nanosleep.S
syscall_src += arch-sh/syscalls/clock_gettime.S
syscall_src += arch-sh/syscalls/clock_settime.S
syscall_src += arch-sh/syscalls/clock_getres.S
syscall_src += arch-sh/syscalls/clock_nanosleep.S
syscall_src += arch-sh/syscalls/getitimer.S
syscall_src += arch-sh/syscalls/setitimer.S
syscall_src += arch-sh/syscalls/__timer_create.S
syscall_src += arch-sh/syscalls/__timer_settime.S
syscall_src += arch-sh/syscalls/__timer_gettime.S
syscall_src += arch-sh/syscalls/__timer_getoverrun.S
syscall_src += arch-sh/syscalls/__timer_delete.S
syscall_src += arch-sh/syscalls/utimes.S
syscall_src += arch-sh/syscalls/utimensat.S
syscall_src += arch-sh/syscalls/sigaction.S
syscall_src += arch-sh/syscalls/sigprocmask.S
syscall_src += arch-sh/syscalls/__sigsuspend.S
syscall_src += arch-sh/syscalls/__rt_sigaction.S
syscall_src += arch-sh/syscalls/__rt_sigprocmask.S
syscall_src += arch-sh/syscalls/__rt_sigtimedwait.S
syscall_src += arch-sh/syscalls/sigpending.S
syscall_src += arch-sh/syscalls/__socketcall.S
syscall_src += arch-sh/syscalls/sched_setscheduler.S
syscall_src += arch-sh/syscalls/sched_getscheduler.S
syscall_src += arch-sh/syscalls/sched_yield.S
syscall_src += arch-sh/syscalls/sched_setparam.S
syscall_src += arch-sh/syscalls/sched_getparam.S
syscall_src += arch-sh/syscalls/sched_get_priority_max.S
syscall_src += arch-sh/syscalls/sched_get_priority_min.S
syscall_src += arch-sh/syscalls/sched_rr_get_interval.S
syscall_src += arch-sh/syscalls/sched_setaffinity.S
syscall_src += arch-sh/syscalls/__sched_getaffinity.S
syscall_src += arch-sh/syscalls/__getcpu.S
syscall_src += arch-sh/syscalls/ioprio_set.S
syscall_src += arch-sh/syscalls/ioprio_get.S
syscall_src += arch-sh/syscalls/uname.S
syscall_src += arch-sh/syscalls/__wait4.S
syscall_src += arch-sh/syscalls/umask.S
syscall_src += arch-sh/syscalls/__reboot.S
syscall_src += arch-sh/syscalls/__syslog.S
syscall_src += arch-sh/syscalls/init_module.S
syscall_src += arch-sh/syscalls/delete_module.S
syscall_src += arch-sh/syscalls/klogctl.S
syscall_src += arch-sh/syscalls/sysinfo.S
syscall_src += arch-sh/syscalls/futex.S
syscall_src += arch-sh/syscalls/epoll_create.S
syscall_src += arch-sh/syscalls/epoll_ctl.S
syscall_src += arch-sh/syscalls/epoll_wait.S
syscall_src += arch-sh/syscalls/inotify_init.S
syscall_src += arch-sh/syscalls/inotify_add_watch.S
syscall_src += arch-sh/syscalls/inotify_rm_watch.S
syscall_src += arch-sh/syscalls/poll.S
syscall_src += arch-sh/syscalls/eventfd.S

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __brk, @function
.globl __brk
.align 4
__brk:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_brk_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_brk_end:
rts
nop
.align 2
0: .long __NR_brk
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fcntl, @function
.globl __fcntl
.align 4
__fcntl:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_fcntl_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_fcntl_end:
rts
nop
.align 2
0: .long __NR_fcntl
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fcntl64, @function
.globl __fcntl64
.align 4
__fcntl64:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_fcntl64_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_fcntl64_end:
rts
nop
.align 2
0: .long __NR_fcntl64
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __fstatfs64, @function
.globl __fstatfs64
.align 4
__fstatfs64:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_fstatfs64_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_fstatfs64_end:
rts
nop
.align 2
0: .long __NR_fstatfs64
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __getcpu, @function
.globl __getcpu
.align 4
__getcpu:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_getcpu_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_getcpu_end:
rts
nop
.align 2
0: .long __NR_getcpu
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __getcwd, @function
.globl __getcwd
.align 4
__getcwd:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_getcwd_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_getcwd_end:
rts
nop
.align 2
0: .long __NR_getcwd
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __getpriority, @function
.globl __getpriority
.align 4
__getpriority:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_getpriority_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_getpriority_end:
rts
nop
.align 2
0: .long __NR_getpriority
1: .long __set_syscall_errno

View File

@@ -1,35 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __llseek, @function
.globl __llseek
.align 4
__llseek:
/* get ready for additonal arg */
mov.l @r15, r0
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(5 + 0x10)
/* check return value */
cmp/pz r0
bt __NR__llseek_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR__llseek_end:
rts
nop
.align 2
0: .long __NR__llseek
1: .long __set_syscall_errno

View File

@@ -1,36 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __mmap2, @function
.globl __mmap2
.align 4
__mmap2:
/* get ready for additonal arg */
mov.l @r15, r0
mov.l @(4, r15), r1
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(6 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_mmap2_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_mmap2_end:
rts
nop
.align 2
0: .long __NR_mmap2
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __open, @function
.globl __open
.align 4
__open:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_open_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_open_end:
rts
nop
.align 2
0: .long __NR_open
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __openat, @function
.globl __openat
.align 4
__openat:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_openat_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_openat_end:
rts
nop
.align 2
0: .long __NR_openat
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __ptrace, @function
.globl __ptrace
.align 4
__ptrace:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_ptrace_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_ptrace_end:
rts
nop
.align 2
0: .long __NR_ptrace
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __reboot, @function
.globl __reboot
.align 4
__reboot:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_reboot_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_reboot_end:
rts
nop
.align 2
0: .long __NR_reboot
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigaction, @function
.globl __rt_sigaction
.align 4
__rt_sigaction:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_rt_sigaction_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_rt_sigaction_end:
rts
nop
.align 2
0: .long __NR_rt_sigaction
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigprocmask, @function
.globl __rt_sigprocmask
.align 4
__rt_sigprocmask:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_rt_sigprocmask_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_rt_sigprocmask_end:
rts
nop
.align 2
0: .long __NR_rt_sigprocmask
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __rt_sigtimedwait, @function
.globl __rt_sigtimedwait
.align 4
__rt_sigtimedwait:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_rt_sigtimedwait_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_rt_sigtimedwait_end:
rts
nop
.align 2
0: .long __NR_rt_sigtimedwait
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sched_getaffinity, @function
.globl __sched_getaffinity
.align 4
__sched_getaffinity:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_sched_getaffinity_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_sched_getaffinity_end:
rts
nop
.align 2
0: .long __NR_sched_getaffinity
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __set_thread_area, @function
.globl __set_thread_area
.align 4
__set_thread_area:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_set_thread_area_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_set_thread_area_end:
rts
nop
.align 2
0: .long __NR_set_thread_area
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setresuid, @function
.globl __setresuid
.align 4
__setresuid:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_setresuid32_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_setresuid32_end:
rts
nop
.align 2
0: .long __NR_setresuid32
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setreuid, @function
.globl __setreuid
.align 4
__setreuid:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_setreuid32_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_setreuid32_end:
rts
nop
.align 2
0: .long __NR_setreuid32
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __setuid, @function
.globl __setuid
.align 4
__setuid:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_setuid32_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_setuid32_end:
rts
nop
.align 2
0: .long __NR_setuid32
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sigsuspend, @function
.globl __sigsuspend
.align 4
__sigsuspend:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_sigsuspend_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_sigsuspend_end:
rts
nop
.align 2
0: .long __NR_sigsuspend
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __socketcall, @function
.globl __socketcall
.align 4
__socketcall:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_socketcall_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_socketcall_end:
rts
nop
.align 2
0: .long __NR_socketcall
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __statfs64, @function
.globl __statfs64
.align 4
__statfs64:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_statfs64_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_statfs64_end:
rts
nop
.align 2
0: .long __NR_statfs64
1: .long __set_syscall_errno

View File

@@ -1,35 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __sys_clone, @function
.globl __sys_clone
.align 4
__sys_clone:
/* get ready for additonal arg */
mov.l @r15, r0
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(5 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_clone_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_clone_end:
rts
nop
.align 2
0: .long __NR_clone
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __syslog, @function
.globl __syslog
.align 4
__syslog:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_syslog_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_syslog_end:
rts
nop
.align 2
0: .long __NR_syslog
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_create, @function
.globl __timer_create
.align 4
__timer_create:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_timer_create_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_timer_create_end:
rts
nop
.align 2
0: .long __NR_timer_create
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_delete, @function
.globl __timer_delete
.align 4
__timer_delete:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_timer_delete_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_timer_delete_end:
rts
nop
.align 2
0: .long __NR_timer_delete
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_getoverrun, @function
.globl __timer_getoverrun
.align 4
__timer_getoverrun:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_timer_getoverrun_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_timer_getoverrun_end:
rts
nop
.align 2
0: .long __NR_timer_getoverrun
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_gettime, @function
.globl __timer_gettime
.align 4
__timer_gettime:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_timer_gettime_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_timer_gettime_end:
rts
nop
.align 2
0: .long __NR_timer_gettime
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __timer_settime, @function
.globl __timer_settime
.align 4
__timer_settime:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_timer_settime_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_timer_settime_end:
rts
nop
.align 2
0: .long __NR_timer_settime
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __wait4, @function
.globl __wait4
.align 4
__wait4:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_wait4_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_wait4_end:
rts
nop
.align 2
0: .long __NR_wait4
1: .long __set_syscall_errno

View File

@@ -1,35 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type __waitid, @function
.globl __waitid
.align 4
__waitid:
/* get ready for additonal arg */
mov.l @r15, r0
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(5 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_waitid_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_waitid_end:
rts
nop
.align 2
0: .long __NR_waitid
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type _exit, @function
.globl _exit
.align 4
_exit:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_exit_group_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_exit_group_end:
rts
nop
.align 2
0: .long __NR_exit_group
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type _exit_thread, @function
.globl _exit_thread
.align 4
_exit_thread:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_exit_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_exit_end:
rts
nop
.align 2
0: .long __NR_exit
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type _waitpid, @function
.globl _waitpid
.align 4
_waitpid:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(4 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_waitpid_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_waitpid_end:
rts
nop
.align 2
0: .long __NR_waitpid
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type access, @function
.globl access
.align 4
access:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_access_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_access_end:
rts
nop
.align 2
0: .long __NR_access
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type acct, @function
.globl acct
.align 4
acct:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_acct_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_acct_end:
rts
nop
.align 2
0: .long __NR_acct
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type capget, @function
.globl capget
.align 4
capget:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_capget_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_capget_end:
rts
nop
.align 2
0: .long __NR_capget
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type capset, @function
.globl capset
.align 4
capset:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_capset_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_capset_end:
rts
nop
.align 2
0: .long __NR_capset
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chdir, @function
.globl chdir
.align 4
chdir:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(1 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_chdir_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_chdir_end:
rts
nop
.align 2
0: .long __NR_chdir
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chmod, @function
.globl chmod
.align 4
chmod:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(2 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_chmod_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_chmod_end:
rts
nop
.align 2
0: .long __NR_chmod
1: .long __set_syscall_errno

View File

@@ -1,32 +0,0 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type chown, @function
.globl chown
.align 4
chown:
/* invoke trap */
mov.l 0f, r3 /* trap num */
trapa #(3 + 0x10)
/* check return value */
cmp/pz r0
bt __NR_chown32_end
/* keep error number */
sts.l pr, @-r15
mov.l 1f, r1
jsr @r1
mov r0, r4
lds.l @r15+, pr
__NR_chown32_end:
rts
nop
.align 2
0: .long __NR_chown32
1: .long __set_syscall_errno

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