Compare commits

...

338 Commits

Author SHA1 Message Date
The Android Automerger
e13338429f merge in jb-mr0-release history after reset to jb-dev 2012-07-11 23:11:59 -07:00
Andrew Hsieh
40e7ed58d7 Unhide rtld_db_dlactivity()
Since linker is built with -fvisibility=hidden rtld_db_dlactivity()
if hidden from gdb.  Unhide it otherwise gdb may not know linker
activity and rescan solib

Change-Id: Ia8cd8d9738c6ea5696ba2ef0ebf2cf783f9ca70a
2012-07-02 11:17:04 -07:00
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
The Android Automerger
b5e8d57664 merge in jb-release history after reset to master 2012-04-16 06:59:27 -07: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
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
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
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
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
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
Benoit Goby
8491327448 Merge "Add auto-generated headers for USB FunctionFS" 2012-03-26 17:14:24 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
The Android Automerger
a43debbc43 merge in jb-release history after reset to master 2012-02-01 06:59:19 -08: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
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
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
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
Jeff Brown
3452e301ec Add new suspend-block input ioctls.
Change-Id: I8cfd63d22ecf8e08f261eb576d6ea448f396f709
2012-01-19 14:27:30 -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
Elliott Hughes
de3c594723 am e8e1efea: Update to tzdata2011n.
* commit 'e8e1efeafb8754ea8358e78cfe3d0f7ad4e809b2':
  Update to tzdata2011n.
2012-01-18 16:34:28 -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
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
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
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
The Android Automerger
09670ec2d1 merge in ics-release history after reset to master 2012-01-17 06:59:15 -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
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
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
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
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
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
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
Erik Gilling
cb9e9ccb2b am bba5c314: update video/dsscomp.h
* commit 'bba5c314b2420483e2c0e3e441bf54bda6935bc1':
  update video/dsscomp.h
2011-12-08 14:57: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
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
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
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
Nick Kralevich
253b763160 get rid of unused "main" function.
confuses gdb.

Change-Id: I1c64357ce122fe5a2564ee96bb4caa32b733f6ea
2011-12-05 16:09:30 -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
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
882 changed files with 22648 additions and 11350 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 \
@@ -471,10 +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 :=
# TARGET_GLOBAL_CFLAGS from build/core/combo/TARGET_linux-x86.mk sets all required flags.
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
@@ -503,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
@@ -640,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 := \
@@ -648,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
@@ -687,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
@@ -718,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

@@ -64,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
@@ -159,6 +160,7 @@ 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
@@ -190,7 +192,7 @@ int __timer_gettime:timer_gettime(timer_t, struct itimerspec*)
int __timer_getoverrun:timer_getoverrun(timer_t) 260,262
int __timer_delete:timer_delete(timer_t) 261,263
int utimes(const char*, const struct timeval tvp[2]) 269, 271
int utimensat(int, const char *, const struct timespec times[2], int) 348, 320
int utimensat(int, const char *, const struct timespec times[2], int) 348, 320, 320
# signals
int sigaction(int, const struct sigaction *, struct sigaction *) 67
@@ -229,7 +231,7 @@ int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,
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
int shutdown:socketcall:13(int, int) -1,102,-1
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
@@ -263,6 +265,7 @@ 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

View File

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

@@ -25,71 +25,27 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/atomics.h>
/* unlike our auto-generated syscall stubs, this code saves lr
on the stack, as well as a few other registers. this makes
our stack unwinder happy, when we generate debug stack
traces after the C library or other parts of the system
abort due to a fatal runtime error (e.g. detection
of a corrupted malloc heap).
*/
#define FUTEX_SYSCALL 240
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#include <sys/linux-syscalls.h>
#include <machine/asm.h>
int __futex_wait(volatile void *ftx, int val)
{
int ret;
asm volatile (
"int $0x80;"
: "=a" (ret)
: "0" (FUTEX_SYSCALL),
"b" (ftx),
"c" (FUTEX_WAIT),
"d" (val),
"S" (0)
);
return ret;
}
#ifndef __NR_tgkill
#define __NR_tgkill 268
#endif
int __futex_wake(volatile void *ftx, int count)
{
int ret;
asm volatile (
"int $0x80;"
: "=a" (ret)
: "0" (FUTEX_SYSCALL),
"b" (ftx),
"c" (FUTEX_WAKE),
"d" (count)
);
return ret;
}
int __atomic_cmpxchg(int old, int new, volatile int* addr) {
int xchg;
asm volatile (
"lock;"
"cmpxchg %%ecx, (%%edx);"
"setne %%al;"
: "=a" (xchg)
: "a" (old),
"c" (new),
"d" (addr)
);
return xchg;
}
int __atomic_swap(int new, volatile int* addr) {
int old;
asm volatile (
"lock;"
"xchg %%ecx, (%%edx);"
: "=c" (old)
: "c" (new),
"d" (addr)
);
return old;
}
int __atomic_dec(volatile int* addr) {
int old;
do {
old = *addr;
} while (atomic_cmpxchg(old, old-1, addr));
return old;
}
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

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

View File

@@ -93,7 +93,7 @@ name: \
# define SETRTNVAL movl DEST(%esp), %eax
#endif
#ifdef SHARED
#if (defined SHARED || defined __PIC__)
# define ENTRANCE PUSH (%ebx);
# define RETURN_END POP (%ebx); ret
# define RETURN RETURN_END; CFI_PUSH (%ebx)
@@ -313,7 +313,7 @@ L(128bytesormore):
PUSH (%ebx)
mov $SHARED_CACHE_SIZE, %ebx
#else
# ifdef SHARED
# if (defined SHARED || defined __PIC__)
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx
@@ -331,7 +331,7 @@ L(128bytesormore):
# define RESTORE_EBX_STATE CFI_PUSH (%ebx)
cmp $DATA_CACHE_SIZE, %ecx
#else
# ifdef SHARED
# if (defined SHARED || defined __PIC__)
# define RESTORE_EBX_STATE
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
@@ -436,7 +436,7 @@ L(128bytesormore_nt):
jae L(128bytesormore_nt)
sfence
L(shared_cache_loop_end):
#if defined DATA_CACHE_SIZE || !defined SHARED
#if defined DATA_CACHE_SIZE || !(defined SHARED || defined __PIC__)
POP (%ebx)
#endif
BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes))

View File

@@ -104,7 +104,7 @@ name: \
#define PUSH(REG) pushl REG; CFI_PUSH (REG)
#define POP(REG) popl REG; CFI_POP (REG)
#ifdef SHARED
#if (defined SHARED || defined __PIC__)
# define PARMS 8 /* Preserve EBX. */
# define ENTRANCE PUSH (%ebx);
# define RETURN_END POP (%ebx); ret
@@ -216,7 +216,7 @@ L(48bytesormore):
#ifdef SHARED_CACHE_SIZE_HALF
cmp $SHARED_CACHE_SIZE_HALF, %ecx
#else
# ifdef SHARED
# if (defined SHARED || defined __PIC__)
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
cmp __x86_shared_cache_size_half@GOTOFF(%ebx), %ecx
@@ -287,7 +287,7 @@ L(shl_0_gobble):
#ifdef DATA_CACHE_SIZE_HALF
cmp $DATA_CACHE_SIZE_HALF, %ecx
#else
# ifdef SHARED
# if (defined SHARED || defined __PIC__)
call __i686.get_pc_thunk.bx
add $_GLOBAL_OFFSET_TABLE_, %ebx
cmp __x86_data_cache_size_half@GOTOFF(%ebx), %ecx

View File

@@ -27,6 +27,7 @@ syscall_src += arch-x86/syscalls/setresgid.S
syscall_src += arch-x86/syscalls/__brk.S
syscall_src += arch-x86/syscalls/kill.S
syscall_src += arch-x86/syscalls/tkill.S
syscall_src += arch-x86/syscalls/tgkill.S
syscall_src += arch-x86/syscalls/__ptrace.S
syscall_src += arch-x86/syscalls/__set_thread_area.S
syscall_src += arch-x86/syscalls/__getpriority.S
@@ -111,6 +112,7 @@ syscall_src += arch-x86/syscalls/rmdir.S
syscall_src += arch-x86/syscalls/rename.S
syscall_src += arch-x86/syscalls/__getcwd.S
syscall_src += arch-x86/syscalls/access.S
syscall_src += arch-x86/syscalls/faccessat.S
syscall_src += arch-x86/syscalls/symlink.S
syscall_src += arch-x86/syscalls/fchdir.S
syscall_src += arch-x86/syscalls/truncate.S
@@ -186,6 +188,7 @@ syscall_src += arch-x86/syscalls/delete_module.S
syscall_src += arch-x86/syscalls/klogctl.S
syscall_src += arch-x86/syscalls/sysinfo.S
syscall_src += arch-x86/syscalls/personality.S
syscall_src += arch-x86/syscalls/perf_event_open.S
syscall_src += arch-x86/syscalls/futex.S
syscall_src += arch-x86/syscalls/epoll_create.S
syscall_src += arch-x86/syscalls/epoll_ctl.S

View File

@@ -0,0 +1,32 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type faccessat, @function
.globl faccessat
.align 4
faccessat:
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
mov 20(%esp), %ebx
mov 24(%esp), %ecx
mov 28(%esp), %edx
mov 32(%esp), %esi
movl $__NR_faccessat, %eax
int $0x80
cmpl $-129, %eax
jb 1f
negl %eax
pushl %eax
call __set_errno
addl $4, %esp
orl $-1, %eax
1:
popl %esi
popl %edx
popl %ecx
popl %ebx
ret

View File

@@ -0,0 +1,35 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type perf_event_open, @function
.globl perf_event_open
.align 4
perf_event_open:
pushl %ebx
pushl %ecx
pushl %edx
pushl %esi
pushl %edi
mov 24(%esp), %ebx
mov 28(%esp), %ecx
mov 32(%esp), %edx
mov 36(%esp), %esi
mov 40(%esp), %edi
movl $__NR_perf_event_open, %eax
int $0x80
cmpl $-129, %eax
jb 1f
negl %eax
pushl %eax
call __set_errno
addl $4, %esp
orl $-1, %eax
1:
popl %edi
popl %esi
popl %edx
popl %ecx
popl %ebx
ret

View File

@@ -0,0 +1,29 @@
/* autogenerated by gensyscalls.py */
#include <sys/linux-syscalls.h>
.text
.type tgkill, @function
.globl tgkill
.align 4
tgkill:
pushl %ebx
pushl %ecx
pushl %edx
mov 16(%esp), %ebx
mov 20(%esp), %ecx
mov 24(%esp), %edx
movl $__NR_tgkill, %eax
int $0x80
cmpl $-129, %eax
jb 1f
negl %eax
pushl %eax
call __set_errno
addl $4, %esp
orl $-1, %eax
1:
popl %edx
popl %ecx
popl %ebx
ret

View File

@@ -773,6 +773,22 @@ void* dlrealloc(void*, size_t);
*/
void* dlmemalign(size_t, size_t);
/*
int posix_memalign(void **memptr, size_t alignment, size_t size);
Places a pointer to a newly allocated chunk of size bytes, aligned
in accord with the alignment argument, in *memptr.
The return value is 0 on success, and ENOMEM on failure.
The alignment argument should be a power of two. If the argument is
not a power of two, the nearest greater power is used.
8-byte alignment is guaranteed by normal malloc calls, so don't
bother calling memalign with an argument of 8 or less.
Overreliance on posix_memalign is a sure way to fragment space.
*/
int posix_memalign(void **memptr, size_t alignment, size_t size);
/*
valloc(size_t n);
Equivalent to memalign(pagesize, n), where pagesize is the page
@@ -2274,7 +2290,22 @@ static void reset_on_error(mstate m);
# include <private/logd.h>
static void __bionic_heap_error(const char* msg, const char* function)
/* Convert a pointer into hex string */
static void __bionic_itox(char* hex, void* ptr)
{
intptr_t val = (intptr_t) ptr;
/* Terminate with NULL */
hex[8] = 0;
int i;
for (i = 7; i >= 0; i--) {
int digit = val & 15;
hex[i] = (digit <= 9) ? digit + '0' : digit - 10 + 'a';
val >>= 4;
}
}
static void __bionic_heap_error(const char* msg, const char* function, void* p)
{
/* We format the buffer explicitely, i.e. without using snprintf()
* which may use malloc() internally. Not something we can trust
@@ -2287,23 +2318,33 @@ static void __bionic_heap_error(const char* msg, const char* function)
strlcat(buffer, " IN ", sizeof(buffer));
strlcat(buffer, function, sizeof(buffer));
}
if (p != NULL) {
char hexbuffer[9];
__bionic_itox(hexbuffer, p);
strlcat(buffer, " addr=0x", sizeof(buffer));
strlcat(buffer, hexbuffer, sizeof(buffer));
}
__libc_android_log_write(ANDROID_LOG_FATAL,"libc",buffer);
abort();
/* So that we can get a memory dump around p */
*((int **) 0xdeadbaad) = (int *) p;
}
# ifndef CORRUPTION_ERROR_ACTION
# define CORRUPTION_ERROR_ACTION(m) \
__bionic_heap_error("HEAP MEMORY CORRUPTION", __FUNCTION__)
# define CORRUPTION_ERROR_ACTION(m,p) \
__bionic_heap_error("HEAP MEMORY CORRUPTION", __FUNCTION__, p)
# endif
# ifndef USAGE_ERROR_ACTION
# define USAGE_ERROR_ACTION(m,p) \
__bionic_heap_error("INVALID HEAP ADDRESS", __FUNCTION__)
__bionic_heap_error("INVALID HEAP ADDRESS", __FUNCTION__, p)
# endif
#else /* !LOG_ON_HEAP_ERROR */
# ifndef CORRUPTION_ERROR_ACTION
# define CORRUPTION_ERROR_ACTION(m) ABORT
# define CORRUPTION_ERROR_ACTION(m,p) ABORT
# endif /* CORRUPTION_ERROR_ACTION */
# ifndef USAGE_ERROR_ACTION
@@ -3040,7 +3081,7 @@ static void internal_malloc_stats(mstate m) {
else if (RTCHECK(ok_address(M, B->fd)))\
F = B->fd;\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, B);\
}\
B->fd = P;\
F->bk = P;\
@@ -3057,7 +3098,7 @@ static void internal_malloc_stats(mstate m) {
mchunkptr B = P->bk;\
bindex_t I = small_index(S);\
if (__builtin_expect (F->bk != P || B->fd != P, 0))\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, P);\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
@@ -3069,7 +3110,7 @@ static void internal_malloc_stats(mstate m) {
B->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, P);\
}\
}
@@ -3080,7 +3121,7 @@ static void internal_malloc_stats(mstate m) {
#define unlink_first_small_chunk(M, B, P, I) {\
mchunkptr F = P->fd;\
if (__builtin_expect (F->bk != P || B->fd != P, 0))\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, P);\
assert(P != B);\
assert(P != F);\
assert(chunksize(P) == small_index2size(I));\
@@ -3091,7 +3132,7 @@ static void internal_malloc_stats(mstate m) {
F->bk = B;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, P);\
}\
}
@@ -3140,7 +3181,7 @@ static void internal_malloc_stats(mstate m) {
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, C);\
break;\
}\
}\
@@ -3154,7 +3195,7 @@ static void internal_malloc_stats(mstate m) {
break;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, F);\
break;\
}\
}\
@@ -3189,13 +3230,13 @@ static void internal_malloc_stats(mstate m) {
tchunkptr F = X->fd;\
R = X->bk;\
if (__builtin_expect (F->bk != X || R->fd != X, 0))\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, X);\
if (RTCHECK(ok_address(M, F))) {\
F->bk = R;\
R->fd = F;\
}\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, F);\
}\
}\
else {\
@@ -3210,7 +3251,7 @@ static void internal_malloc_stats(mstate m) {
if (RTCHECK(ok_address(M, RP)))\
*RP = 0;\
else {\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, RP);\
}\
}\
}\
@@ -3227,7 +3268,7 @@ static void internal_malloc_stats(mstate m) {
XP->child[1] = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, XP);\
if (R != 0) {\
if (RTCHECK(ok_address(M, R))) {\
tchunkptr C0, C1;\
@@ -3238,7 +3279,7 @@ static void internal_malloc_stats(mstate m) {
C0->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, C0);\
}\
if ((C1 = X->child[1]) != 0) {\
if (RTCHECK(ok_address(M, C1))) {\
@@ -3246,11 +3287,11 @@ static void internal_malloc_stats(mstate m) {
C1->parent = R;\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, C1);\
}\
}\
else\
CORRUPTION_ERROR_ACTION(M);\
CORRUPTION_ERROR_ACTION(M, R);\
}\
}\
}
@@ -3316,7 +3357,7 @@ static void* mmap_alloc(mstate m, size_t nb) {
chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
if (mm < m->least_addr)
if (m->least_addr == 0 || mm < m->least_addr)
m->least_addr = mm;
if ((m->footprint += mmsize) > m->max_footprint)
m->max_footprint = m->footprint;
@@ -3662,7 +3703,9 @@ static void* sys_alloc(mstate m, size_t nb) {
m->max_footprint = m->footprint;
if (!is_initialized(m)) { /* first-time initialization */
m->seg.base = m->least_addr = tbase;
if (m->least_addr == 0 || tbase < m->least_addr)
m->least_addr = tbase;
m->seg.base = tbase;
m->seg.size = tsize;
m->seg.sflags = mmap_flag;
m->magic = mparams.magic;
@@ -3899,7 +3942,7 @@ static void* tmalloc_large(mstate m, size_t nb) {
return chunk2mem(v);
}
}
CORRUPTION_ERROR_ACTION(m);
CORRUPTION_ERROR_ACTION(m, v);
}
return 0;
}
@@ -3939,7 +3982,7 @@ static void* tmalloc_small(mstate m, size_t nb) {
}
}
CORRUPTION_ERROR_ACTION(m);
CORRUPTION_ERROR_ACTION(m, v);
return 0;
}
@@ -4507,6 +4550,18 @@ void* dlmemalign(size_t alignment, size_t bytes) {
return internal_memalign(gm, alignment, bytes);
}
int posix_memalign(void **memptr, size_t alignment, size_t size) {
int ret = 0;
*memptr = dlmemalign(alignment, size);
if (*memptr == 0) {
ret = ENOMEM;
}
return ret;
}
void** dlindependent_calloc(size_t n_elements, size_t elem_size,
void* chunks[]) {
size_t sz = elem_size; /* serves as 1-element array */

View File

@@ -52,12 +52,19 @@ unsigned int __page_shift = PAGE_SHIFT;
int __system_properties_init(void);
void __libc_init_common(uintptr_t *elfdata)
/* Init TLS for the initial thread. Called by the linker _before_ libc is mapped
* in memory. Beware: all writes to libc globals from this function will
* apply to linker-private copies and will not be visible from libc later on.
*
* Note: this function creates a pthread_internal_t for the initial thread and
* stores the pointer in TLS, but does not add it to pthread's gThreadList. This
* has to be done later from libc itself (see __libc_init_common).
*
* This function also stores elfdata argument in a specific TLS slot to be later
* picked up by the libc constructor.
*/
void __libc_init_tls(unsigned** elfdata)
{
int argc = *elfdata;
char** argv = (char**)(elfdata + 1);
char** envp = argv + argc + 1;
pthread_attr_t thread_attr;
static pthread_internal_t thread;
static void* tls_area[BIONIC_TLS_SLOTS];
@@ -72,7 +79,19 @@ void __libc_init_common(uintptr_t *elfdata)
_init_thread(&thread, gettid(), &thread_attr, (void*)stackbottom);
__init_tls(tls_area, &thread);
/* clear errno - requires TLS area */
tls_area[TLS_SLOT_BIONIC_PREINIT] = elfdata;
}
void __libc_init_common(uintptr_t *elfdata)
{
int argc = *elfdata;
char** argv = (char**)(elfdata + 1);
char** envp = argv + argc + 1;
/* get the initial thread from TLS and add it to gThreadList */
_pthread_internal_add(__get_thread());
/* clear errno */
errno = 0;
/* set program name */
@@ -119,4 +138,12 @@ void __libc_fini(void* array)
func();
}
#ifndef LIBC_STATIC
{
extern void __libc_postfini(void) __attribute__((weak));
if (__libc_postfini)
__libc_postfini();
}
#endif
}

View File

@@ -76,6 +76,12 @@ void __libc_preinit(void)
__libc_init_common(elfdata);
/* Setup pthread routines accordingly to the environment.
* Requires system properties
*/
extern void pthread_debug_init(void);
pthread_debug_init();
/* Setup malloc routines accordingly to the environment.
* Requires system properties
*/
@@ -83,6 +89,12 @@ void __libc_preinit(void)
malloc_debug_init();
}
void __libc_postfini(void)
{
extern void malloc_debug_fini(void);
malloc_debug_fini();
}
/* This function is called from the executable's _start entry point
* (see arch-$ARCH/bionic/crtbegin_dynamic.S), which is itself
* called by the dynamic linker after it has loaded all shared

View File

@@ -65,6 +65,11 @@ __noreturn void __libc_init(uintptr_t *elfdata,
int argc;
char **argv, **envp;
__libc_init_tls(NULL);
/* get the initial thread from TLS and add it to gThreadList */
_pthread_internal_add(__get_thread());
/* Initialize the C runtime environment */
__libc_init_common(elfdata);

View File

@@ -0,0 +1,574 @@
/*
* Copyright (C) 2012 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 <errno.h>
#include <pthread.h>
#include <time.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stddef.h>
#include <stdarg.h>
#include <fcntl.h>
#include <unwind.h>
#include <dlfcn.h>
#include <stdbool.h>
#include <sys/types.h>
#include <sys/system_properties.h>
#include "dlmalloc.h"
#include "logd.h"
#include "malloc_debug_common.h"
#include "malloc_debug_check_mapinfo.h"
static mapinfo *milist;
/* libc.debug.malloc.backlog */
extern unsigned int malloc_double_free_backlog;
#define MAX_BACKTRACE_DEPTH 15
#define ALLOCATION_TAG 0x1ee7d00d
#define BACKLOG_TAG 0xbabecafe
#define FREE_POISON 0xa5
#define BACKLOG_DEFAULT_LEN 100
#define FRONT_GUARD 0xaa
#define FRONT_GUARD_LEN (1<<5)
#define REAR_GUARD 0xbb
#define REAR_GUARD_LEN (1<<5)
static void print_backtrace(const intptr_t *bt, unsigned int depth);
static void log_message(const char* format, ...)
{
extern pthread_mutex_t gAllocationsMutex;
extern const MallocDebug __libc_malloc_default_dispatch;
extern const MallocDebug* __libc_malloc_dispatch;
va_list args;
pthread_mutex_lock(&gAllocationsMutex);
{
const MallocDebug* current_dispatch = __libc_malloc_dispatch;
__libc_malloc_dispatch = &__libc_malloc_default_dispatch;
va_start(args, format);
__libc_android_log_vprint(ANDROID_LOG_ERROR, "libc",
format, args);
va_end(args);
__libc_malloc_dispatch = current_dispatch;
}
pthread_mutex_unlock(&gAllocationsMutex);
}
struct hdr {
uint32_t tag;
struct hdr *prev;
struct hdr *next;
intptr_t bt[MAX_BACKTRACE_DEPTH];
int bt_depth;
intptr_t freed_bt[MAX_BACKTRACE_DEPTH];
int freed_bt_depth;
size_t size;
char front_guard[FRONT_GUARD_LEN];
} __attribute__((packed));
struct ftr {
char rear_guard[REAR_GUARD_LEN];
} __attribute__((packed));
static inline struct ftr * to_ftr(struct hdr *hdr)
{
return (struct ftr *)(((char *)(hdr + 1)) + hdr->size);
}
static inline void *user(struct hdr *hdr)
{
return hdr + 1;
}
static inline struct hdr *meta(void *user)
{
return ((struct hdr *)user) - 1;
}
/* Call this on exit() to get leaked memory */
void free_leaked_memory(void);
static unsigned num;
static struct hdr *tail;
static struct hdr *head;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static unsigned backlog_num;
static struct hdr *backlog_tail;
static struct hdr *backlog_head;
static pthread_mutex_t backlog_lock = PTHREAD_MUTEX_INITIALIZER;
extern __LIBC_HIDDEN__
int get_backtrace(intptr_t* addrs, size_t max_entries);
static void print_backtrace(const intptr_t *bt, unsigned int depth)
{
const mapinfo *mi;
unsigned int cnt;
unsigned int rel_pc;
intptr_t self_bt[MAX_BACKTRACE_DEPTH];
if (!bt) {
depth = get_backtrace(self_bt, MAX_BACKTRACE_DEPTH);
bt = self_bt;
}
log_message("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");
for (cnt = 0; cnt < depth && cnt < MAX_BACKTRACE_DEPTH; cnt++) {
mi = pc_to_mapinfo(milist, bt[cnt], &rel_pc);
log_message("\t#%02d pc %08x %s\n", cnt,
mi ? (intptr_t)rel_pc : bt[cnt],
mi ? mi->name : "(unknown)");
}
}
static inline void init_front_guard(struct hdr *hdr)
{
memset(hdr->front_guard, FRONT_GUARD, FRONT_GUARD_LEN);
}
static inline bool is_front_guard_valid(struct hdr *hdr)
{
unsigned i;
for (i = 0; i < FRONT_GUARD_LEN; i++)
if (hdr->front_guard[i] != FRONT_GUARD)
return 0;
return 1;
}
static inline void init_rear_guard(struct hdr *hdr)
{
struct ftr *ftr = to_ftr(hdr);
memset(ftr->rear_guard, REAR_GUARD, REAR_GUARD_LEN);
}
static inline bool is_rear_guard_valid(struct hdr *hdr)
{
unsigned i;
int valid = 1;
int first_mismatch = -1;
struct ftr *ftr = to_ftr(hdr);
for (i = 0; i < REAR_GUARD_LEN; i++) {
if (ftr->rear_guard[i] != REAR_GUARD) {
if (first_mismatch < 0)
first_mismatch = i;
valid = 0;
}
else if (first_mismatch >= 0) {
log_message("+++ REAR GUARD MISMATCH [%d, %d)\n", first_mismatch, i);
first_mismatch = -1;
}
}
if (first_mismatch >= 0)
log_message("+++ REAR GUARD MISMATCH [%d, %d)\n", first_mismatch, i);
return valid;
}
static inline void add_locked(struct hdr *hdr, struct hdr **tail, struct hdr **head)
{
hdr->prev = NULL;
hdr->next = *head;
if (*head)
(*head)->prev = hdr;
else
*tail = hdr;
*head = hdr;
}
static inline int del_locked(struct hdr *hdr, struct hdr **tail, struct hdr **head)
{
if (hdr->prev)
hdr->prev->next = hdr->next;
else
*head = hdr->next;
if (hdr->next)
hdr->next->prev = hdr->prev;
else
*tail = hdr->prev;
return 0;
}
static inline void add(struct hdr *hdr, size_t size)
{
pthread_mutex_lock(&lock);
hdr->tag = ALLOCATION_TAG;
hdr->size = size;
init_front_guard(hdr);
init_rear_guard(hdr);
num++;
add_locked(hdr, &tail, &head);
pthread_mutex_unlock(&lock);
}
static inline int del(struct hdr *hdr)
{
if (hdr->tag != ALLOCATION_TAG)
return -1;
pthread_mutex_lock(&lock);
del_locked(hdr, &tail, &head);
num--;
pthread_mutex_unlock(&lock);
return 0;
}
static inline void poison(struct hdr *hdr)
{
memset(user(hdr), FREE_POISON, hdr->size);
}
static int was_used_after_free(struct hdr *hdr)
{
unsigned i;
const char *data = (const char *)user(hdr);
for (i = 0; i < hdr->size; i++)
if (data[i] != FREE_POISON)
return 1;
return 0;
}
/* returns 1 if valid, *safe == 1 if safe to dump stack */
static inline int check_guards(struct hdr *hdr, int *safe)
{
*safe = 1;
if (!is_front_guard_valid(hdr)) {
if (hdr->front_guard[0] == FRONT_GUARD) {
log_message("+++ ALLOCATION %p SIZE %d HAS A CORRUPTED FRONT GUARD\n",
user(hdr), hdr->size);
} else {
log_message("+++ ALLOCATION %p HAS A CORRUPTED FRONT GUARD "\
"(NOT DUMPING STACKTRACE)\n", user(hdr));
/* Allocation header is probably corrupt, do not print stack trace */
*safe = 0;
}
return 0;
}
if (!is_rear_guard_valid(hdr)) {
log_message("+++ ALLOCATION %p SIZE %d HAS A CORRUPTED REAR GUARD\n",
user(hdr), hdr->size);
return 0;
}
return 1;
}
/* returns 1 if valid, *safe == 1 if safe to dump stack */
static inline int check_allocation_locked(struct hdr *hdr, int *safe)
{
int valid = 1;
*safe = 1;
if (hdr->tag != ALLOCATION_TAG && hdr->tag != BACKLOG_TAG) {
log_message("+++ ALLOCATION %p HAS INVALID TAG %08x (NOT DUMPING STACKTRACE)\n",
user(hdr), hdr->tag);
/* Allocation header is probably corrupt, do not dequeue or dump stack
* trace.
*/
*safe = 0;
return 0;
}
if (hdr->tag == BACKLOG_TAG && was_used_after_free(hdr)) {
log_message("+++ ALLOCATION %p SIZE %d WAS USED AFTER BEING FREED\n",
user(hdr), hdr->size);
valid = 0;
/* check the guards to see if it's safe to dump a stack trace */
(void)check_guards(hdr, safe);
}
else
valid = check_guards(hdr, safe);
if (!valid && *safe) {
log_message("+++ ALLOCATION %p SIZE %d ALLOCATED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->bt, hdr->bt_depth);
if (hdr->tag == BACKLOG_TAG) {
log_message("+++ ALLOCATION %p SIZE %d FREED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->freed_bt, hdr->freed_bt_depth);
}
}
return valid;
}
static inline int del_and_check_locked(struct hdr *hdr,
struct hdr **tail, struct hdr **head, unsigned *cnt,
int *safe)
{
int valid;
valid = check_allocation_locked(hdr, safe);
if (safe) {
(*cnt)--;
del_locked(hdr, tail, head);
}
return valid;
}
static inline void del_from_backlog_locked(struct hdr *hdr)
{
int safe;
(void)del_and_check_locked(hdr,
&backlog_tail, &backlog_head, &backlog_num,
&safe);
hdr->tag = 0; /* clear the tag */
}
static inline void del_from_backlog(struct hdr *hdr)
{
pthread_mutex_lock(&backlog_lock);
del_from_backlog_locked(hdr);
pthread_mutex_unlock(&backlog_lock);
}
static inline int del_leak(struct hdr *hdr, int *safe)
{
int valid;
pthread_mutex_lock(&lock);
valid = del_and_check_locked(hdr,
&tail, &head, &num,
safe);
pthread_mutex_unlock(&lock);
return valid;
}
static inline void add_to_backlog(struct hdr *hdr)
{
pthread_mutex_lock(&backlog_lock);
hdr->tag = BACKLOG_TAG;
backlog_num++;
add_locked(hdr, &backlog_tail, &backlog_head);
poison(hdr);
/* If we've exceeded the maximum backlog, clear it up */
while (backlog_num > malloc_double_free_backlog) {
struct hdr *gone = backlog_tail;
del_from_backlog_locked(gone);
dlfree(gone);
}
pthread_mutex_unlock(&backlog_lock);
}
void* chk_malloc(size_t size)
{
struct hdr *hdr;
// log_message("%s: %s\n", __FILE__, __FUNCTION__);
hdr = dlmalloc(sizeof(struct hdr) + size + sizeof(struct ftr));
if (hdr) {
hdr->bt_depth = get_backtrace(hdr->bt, MAX_BACKTRACE_DEPTH);
add(hdr, size);
return user(hdr);
}
return NULL;
}
void* chk_memalign(size_t alignment, size_t bytes)
{
// log_message("%s: %s\n", __FILE__, __FUNCTION__);
// XXX: it's better to use malloc, than being wrong
return chk_malloc(bytes);
}
void chk_free(void *ptr)
{
struct hdr *hdr;
// log_message("%s: %s\n", __FILE__, __FUNCTION__);
if (!ptr) /* ignore free(NULL) */
return;
hdr = meta(ptr);
if (del(hdr) < 0) {
intptr_t bt[MAX_BACKTRACE_DEPTH];
int depth;
depth = get_backtrace(bt, MAX_BACKTRACE_DEPTH);
if (hdr->tag == BACKLOG_TAG) {
log_message("+++ ALLOCATION %p SIZE %d BYTES MULTIPLY FREED!\n",
user(hdr), hdr->size);
log_message("+++ ALLOCATION %p SIZE %d ALLOCATED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->bt, hdr->bt_depth);
/* hdr->freed_bt_depth should be nonzero here */
log_message("+++ ALLOCATION %p SIZE %d FIRST FREED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->freed_bt, hdr->freed_bt_depth);
log_message("+++ ALLOCATION %p SIZE %d NOW BEING FREED HERE:\n",
user(hdr), hdr->size);
print_backtrace(bt, depth);
}
else {
log_message("+++ ALLOCATION %p IS CORRUPTED OR NOT ALLOCATED VIA TRACKER!\n",
user(hdr));
print_backtrace(bt, depth);
/* Leak here so that we do not crash */
//dlfree(user(hdr));
}
}
else {
hdr->freed_bt_depth = get_backtrace(hdr->freed_bt,
MAX_BACKTRACE_DEPTH);
add_to_backlog(hdr);
}
}
void *chk_realloc(void *ptr, size_t size)
{
struct hdr *hdr;
// log_message("%s: %s\n", __FILE__, __FUNCTION__);
if (!size) {
chk_free(ptr);
return NULL;
}
if (!ptr)
return chk_malloc(size);
hdr = meta(ptr);
if (del(hdr) < 0) {
intptr_t bt[MAX_BACKTRACE_DEPTH];
int depth;
depth = get_backtrace(bt, MAX_BACKTRACE_DEPTH);
if (hdr->tag == BACKLOG_TAG) {
log_message("+++ REALLOCATION %p SIZE %d OF FREED MEMORY!\n",
user(hdr), size, hdr->size);
log_message("+++ ALLOCATION %p SIZE %d ALLOCATED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->bt, hdr->bt_depth);
/* hdr->freed_bt_depth should be nonzero here */
log_message("+++ ALLOCATION %p SIZE %d FIRST FREED HERE:\n",
user(hdr), hdr->size);
print_backtrace(hdr->freed_bt, hdr->freed_bt_depth);
log_message("+++ ALLOCATION %p SIZE %d NOW BEING REALLOCATED HERE:\n",
user(hdr), hdr->size);
print_backtrace(bt, depth);
/* We take the memory out of the backlog and fall through so the
* reallocation below succeeds. Since we didn't really free it, we
* can default to this behavior.
*/
del_from_backlog(hdr);
}
else {
log_message("+++ REALLOCATION %p SIZE %d IS CORRUPTED OR NOT ALLOCATED VIA TRACKER!\n",
user(hdr), size);
print_backtrace(bt, depth);
// just get a whole new allocation and leak the old one
return dlrealloc(0, size);
// return dlrealloc(user(hdr), size); // assuming it was allocated externally
}
}
hdr = dlrealloc(hdr, sizeof(struct hdr) + size + sizeof(struct ftr));
if (hdr) {
hdr->bt_depth = get_backtrace(hdr->bt, MAX_BACKTRACE_DEPTH);
add(hdr, size);
return user(hdr);
}
return NULL;
}
void *chk_calloc(int nmemb, size_t size)
{
// log_message("%s: %s\n", __FILE__, __FUNCTION__);
struct hdr *hdr;
size_t total_size = nmemb * size;
hdr = dlcalloc(1, sizeof(struct hdr) + total_size + sizeof(struct ftr));
if (hdr) {
hdr->bt_depth = get_backtrace(
hdr->bt, MAX_BACKTRACE_DEPTH);
add(hdr, total_size);
return user(hdr);
}
return NULL;
}
static void heaptracker_free_leaked_memory(void)
{
struct hdr *del; int cnt;
if (num)
log_message("+++ THERE ARE %d LEAKED ALLOCATIONS\n", num);
while (head) {
int safe;
del = head;
log_message("+++ DELETING %d BYTES OF LEAKED MEMORY AT %p (%d REMAINING)\n",
del->size, user(del), num);
if (del_leak(del, &safe)) {
/* safe == 1, because the allocation is valid */
log_message("+++ ALLOCATION %p SIZE %d ALLOCATED HERE:\n",
user(del), del->size);
print_backtrace(del->bt, del->bt_depth);
}
dlfree(del);
}
// log_message("+++ DELETING %d BACKLOGGED ALLOCATIONS\n", backlog_num);
while (backlog_head) {
del = backlog_tail;
del_from_backlog(del);
dlfree(del);
}
}
/* Initializes malloc debugging framework.
* See comments on MallocDebugInit in malloc_debug_common.h
*/
int malloc_debug_initialize(void)
{
if (!malloc_double_free_backlog)
malloc_double_free_backlog = BACKLOG_DEFAULT_LEN;
milist = init_mapinfo(getpid());
return 0;
}
void malloc_debug_finalize(void)
{
heaptracker_free_leaked_memory();
deinit_mapinfo(milist);
}

View File

@@ -0,0 +1,126 @@
/*
* Copyright (C) 2012 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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "dlmalloc.h"
#include "malloc_debug_check_mapinfo.h"
// 6f000000-6f01e000 rwxp 00000000 00:0c 16389419 /system/lib/libcomposer.so
// 012345678901234567890123456789012345678901234567890123456789
// 0 1 2 3 4 5
static mapinfo *parse_maps_line(char *line)
{
mapinfo *mi;
int len = strlen(line);
if(len < 1) return 0;
line[--len] = 0;
if(len < 50) return 0;
if(line[20] != 'x') return 0;
mi = dlmalloc(sizeof(mapinfo) + (len - 47));
if(mi == 0) return 0;
mi->start = strtoul(line, 0, 16);
mi->end = strtoul(line + 9, 0, 16);
/* To be filled in parse_elf_info if the mapped section starts with
* elf_header
*/
mi->next = 0;
strcpy(mi->name, line + 49);
return mi;
}
__LIBC_HIDDEN__
mapinfo *init_mapinfo(int pid)
{
struct mapinfo *milist = NULL;
char data[1024];
sprintf(data, "/proc/%d/maps", pid);
FILE *fp = fopen(data, "r");
if(fp) {
while(fgets(data, sizeof(data), fp)) {
mapinfo *mi = parse_maps_line(data);
if(mi) {
mi->next = milist;
milist = mi;
}
}
fclose(fp);
}
return milist;
}
__LIBC_HIDDEN__
void deinit_mapinfo(mapinfo *mi)
{
mapinfo *del;
while(mi) {
del = mi;
mi = mi->next;
dlfree(del);
}
}
/* Map a pc address to the name of the containing ELF file */
__LIBC_HIDDEN__
const char *map_to_name(mapinfo *mi, unsigned pc, const char* def)
{
while(mi) {
if((pc >= mi->start) && (pc < mi->end)){
return mi->name;
}
mi = mi->next;
}
return def;
}
/* Find the containing map info for the pc */
__LIBC_HIDDEN__
const mapinfo *pc_to_mapinfo(mapinfo *mi, unsigned pc, unsigned *rel_pc)
{
*rel_pc = pc;
while(mi) {
if((pc >= mi->start) && (pc < mi->end)){
// Only calculate the relative offset for shared libraries
if (strstr(mi->name, ".so")) {
*rel_pc -= mi->start;
}
return mi;
}
mi = mi->next;
}
return NULL;
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef MALLOC_DEBUG_CHECK_MAPINFO_H
#define MALLOC_DEBUG_CHECK_MAPINFO_H
#include <sys/cdefs.h>
typedef struct mapinfo {
struct mapinfo *next;
unsigned start;
unsigned end;
char name[];
} mapinfo;
__LIBC_HIDDEN__ mapinfo *init_mapinfo(int pid);
__LIBC_HIDDEN__ void deinit_mapinfo(mapinfo *mi);
__LIBC_HIDDEN__ const char *map_to_name(mapinfo *mi, unsigned pc, const char* def);
__LIBC_HIDDEN__ const mapinfo *pc_to_mapinfo(mapinfo *mi, unsigned pc, unsigned *rel_pc);
#endif/*MALLOC_DEBUG_CHECK_MAPINFO_H*/

View File

@@ -240,17 +240,6 @@ void* memalign(size_t alignment, size_t bytes) {
#include <dlfcn.h>
#include "logd.h"
// =============================================================================
// log functions
// =============================================================================
#define debug_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", (format), ##__VA_ARGS__ )
#define error_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_ERROR, "libc", (format), ##__VA_ARGS__ )
#define info_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_INFO, "libc", (format), ##__VA_ARGS__ )
/* Table for dispatching malloc calls, depending on environment. */
static MallocDebug gMallocUse __attribute__((aligned(32))) = {
dlmalloc, dlfree, dlcalloc, dlrealloc, dlmemalign
@@ -288,6 +277,14 @@ static void* libc_malloc_impl_handle = NULL;
#define MALLOC_ALIGNMENT ((size_t)8U)
#endif /* MALLOC_ALIGNMENT */
/* This variable is set to the value of property libc.debug.malloc.backlog,
* when the value of libc.debug.malloc = 10. It determines the size of the
* backlog we use to detect multiple frees. If the property is not set, the
* backlog length defaults to an internal constant defined in
* malloc_debug_check.c
*/
unsigned int malloc_double_free_backlog;
/* Initializes memory allocation framework once per process. */
static void malloc_init_impl(void)
{
@@ -298,6 +295,7 @@ static void malloc_init_impl(void)
unsigned int memcheck_enabled = 0;
char env[PROP_VALUE_MAX];
char memcheck_tracing[PROP_VALUE_MAX];
char debug_program[PROP_VALUE_MAX];
/* Get custom malloc debug level. Note that emulator started with
* memory checking option will have priority over debug level set in
@@ -325,13 +323,30 @@ static void malloc_init_impl(void)
return;
}
/* If libc.debug.malloc.program is set and is not a substring of progname,
* then exit.
*/
if (__system_property_get("libc.debug.malloc.program", debug_program)) {
if (!strstr(__progname, debug_program)) {
return;
}
}
// Lets see which .so must be loaded for the requested debug level
switch (debug_level) {
case 1:
case 5:
case 10:
case 10: {
char debug_backlog[PROP_VALUE_MAX];
if (__system_property_get("libc.debug.malloc.backlog", debug_backlog)) {
malloc_double_free_backlog = atoi(debug_backlog);
info_log("%s: setting backlog length to %d\n",
__progname, malloc_double_free_backlog);
}
so_name = "/system/lib/libc_malloc_debug_leak.so";
break;
}
case 20:
// Quick check: debug level 20 can only be handled in emulator.
if (!qemu_running) {
@@ -475,7 +490,19 @@ static void malloc_init_impl(void)
}
}
static void malloc_fini_impl(void)
{
if (libc_malloc_impl_handle) {
MallocDebugFini malloc_debug_finalize = NULL;
malloc_debug_finalize =
dlsym(libc_malloc_impl_handle, "malloc_debug_finalize");
if (malloc_debug_finalize)
malloc_debug_finalize();
}
}
static pthread_once_t malloc_init_once_ctl = PTHREAD_ONCE_INIT;
static pthread_once_t malloc_fini_once_ctl = PTHREAD_ONCE_INIT;
#endif // !LIBC_STATIC
#endif // USE_DL_PREFIX
@@ -494,3 +521,14 @@ void malloc_debug_init(void)
}
#endif // USE_DL_PREFIX && !LIBC_STATIC
}
void malloc_debug_fini(void)
{
/* We need to finalize malloc iff we implement here custom
* malloc routines (i.e. USE_DL_PREFIX is defined) for libc.so */
#if defined(USE_DL_PREFIX) && !defined(LIBC_STATIC)
if (pthread_once(&malloc_fini_once_ctl, malloc_fini_impl)) {
error_log("Unable to finalize malloc_debug component.");
}
#endif // USE_DL_PREFIX && !LIBC_STATIC
}

View File

@@ -82,15 +82,31 @@ struct MallocDebug {
void* (*memalign)(size_t alignment, size_t bytes);
};
/* Malloc debugging initialization routine.
* This routine must be implemented in .so modules that implement malloc
* debugging. This routine is called once per process from malloc_init_impl
* routine implemented in bionic/libc/bionic/malloc_debug_common.c when malloc
/* Malloc debugging initialization and finalization routines.
*
* These routines must be implemented in .so modules that implement malloc
* debugging. The are is called once per process from malloc_init_impl and
* malloc_fini_impl respectively.
*
* They are implemented in bionic/libc/bionic/malloc_debug_common.c when malloc
* debugging gets initialized for the process.
* Return:
* 0 on success, -1 on failure.
*
* MallocDebugInit returns:
* 0 on success, -1 on failure.
*/
typedef int (*MallocDebugInit)(void);
typedef void (*MallocDebugFini)(void);
// =============================================================================
// log functions
// =============================================================================
#define debug_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_DEBUG, "malloc_leak_check", (format), ##__VA_ARGS__ )
#define error_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_ERROR, "malloc_leak_check", (format), ##__VA_ARGS__ )
#define info_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_INFO, "malloc_leak_check", (format), ##__VA_ARGS__ )
#ifdef __cplusplus
}; /* end of extern "C" */

View File

@@ -61,22 +61,11 @@
extern int gMallocLeakZygoteChild;
extern pthread_mutex_t gAllocationsMutex;
extern HashTable gHashTable;
extern const MallocDebug __libc_malloc_default_dispatch;
extern const MallocDebug* __libc_malloc_dispatch;
// =============================================================================
// log functions
// stack trace functions
// =============================================================================
#define debug_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_DEBUG, "malloc_leak_check", (format), ##__VA_ARGS__ )
#define error_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_ERROR, "malloc_leak_check", (format), ##__VA_ARGS__ )
#define info_log(format, ...) \
__libc_android_log_print(ANDROID_LOG_INFO, "malloc_leak_check", (format), ##__VA_ARGS__ )
static int gTrapOnError = 1;
#define MALLOC_ALIGNMENT 8
#define GUARD 0x48151642
#define DEBUG 0
@@ -210,246 +199,12 @@ static void remove_entry(HashEntry* entry)
gHashTable.count--;
}
// =============================================================================
// stack trace functions
// =============================================================================
typedef struct
{
size_t count;
intptr_t* addrs;
} stack_crawl_state_t;
/* depends how the system includes define this */
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
typedef struct _Unwind_Context __unwind_context;
#else
typedef _Unwind_Context __unwind_context;
#endif
static _Unwind_Reason_Code trace_function(__unwind_context *context, void *arg)
{
stack_crawl_state_t* state = (stack_crawl_state_t*)arg;
if (state->count) {
intptr_t ip = (intptr_t)_Unwind_GetIP(context);
if (ip) {
state->addrs[0] = ip;
state->addrs++;
state->count--;
return _URC_NO_REASON;
}
}
/*
* If we run out of space to record the address or 0 has been seen, stop
* unwinding the stack.
*/
return _URC_END_OF_STACK;
}
static inline
int get_backtrace(intptr_t* addrs, size_t max_entries)
{
stack_crawl_state_t state;
state.count = max_entries;
state.addrs = (intptr_t*)addrs;
_Unwind_Backtrace(trace_function, (void*)&state);
return max_entries - state.count;
}
// =============================================================================
// malloc check functions
// malloc fill functions
// =============================================================================
#define CHK_FILL_FREE 0xef
#define CHK_SENTINEL_VALUE (char)0xeb
#define CHK_SENTINEL_HEAD_SIZE 16
#define CHK_SENTINEL_TAIL_SIZE 16
#define CHK_OVERHEAD_SIZE ( CHK_SENTINEL_HEAD_SIZE + \
CHK_SENTINEL_TAIL_SIZE + \
sizeof(size_t) )
static void dump_stack_trace()
{
intptr_t addrs[20];
int c = get_backtrace(addrs, 20);
char buf[16];
char tmp[16*20];
int i;
tmp[0] = 0; // Need to initialize tmp[0] for the first strcat
for (i=0 ; i<c; i++) {
snprintf(buf, sizeof buf, "%2d: %08x\n", i, addrs[i]);
strlcat(tmp, buf, sizeof tmp);
}
__libc_android_log_print(ANDROID_LOG_ERROR, "libc", "call stack:\n%s", tmp);
}
static int is_valid_malloc_pointer(void* addr)
{
return 1;
}
static void assert_log_message(const char* format, ...)
{
va_list args;
pthread_mutex_lock(&gAllocationsMutex);
{
const MallocDebug* current_dispatch = __libc_malloc_dispatch;
__libc_malloc_dispatch = &__libc_malloc_default_dispatch;
va_start(args, format);
__libc_android_log_vprint(ANDROID_LOG_ERROR, "libc",
format, args);
va_end(args);
dump_stack_trace();
if (gTrapOnError) {
__builtin_trap();
}
__libc_malloc_dispatch = current_dispatch;
}
pthread_mutex_unlock(&gAllocationsMutex);
}
static void assert_valid_malloc_pointer(void* mem)
{
if (mem && !is_valid_malloc_pointer(mem)) {
assert_log_message(
"*** MALLOC CHECK: buffer %p, is not a valid "
"malloc pointer (are you mixing up new/delete "
"and malloc/free?)", mem);
}
}
/* Check that a given address corresponds to a guarded block,
* and returns its original allocation size in '*allocated'.
* 'func' is the capitalized name of the caller function.
* Returns 0 on success, or -1 on failure.
* NOTE: Does not return if gTrapOnError is set.
*/
static int chk_mem_check(void* mem,
size_t* allocated,
const char* func)
{
char* buffer;
size_t offset, bytes;
int i;
char* buf;
/* first check the bytes in the sentinel header */
buf = (char*)mem - CHK_SENTINEL_HEAD_SIZE;
for (i=0 ; i<CHK_SENTINEL_HEAD_SIZE ; i++) {
if (buf[i] != CHK_SENTINEL_VALUE) {
assert_log_message(
"*** %s CHECK: buffer %p "
"corrupted %d bytes before allocation",
func, mem, CHK_SENTINEL_HEAD_SIZE-i);
return -1;
}
}
/* then the ones in the sentinel trailer */
buffer = (char*)mem - CHK_SENTINEL_HEAD_SIZE;
offset = dlmalloc_usable_size(buffer) - sizeof(size_t);
bytes = *(size_t *)(buffer + offset);
buf = (char*)mem + bytes;
for (i=CHK_SENTINEL_TAIL_SIZE-1 ; i>=0 ; i--) {
if (buf[i] != CHK_SENTINEL_VALUE) {
assert_log_message(
"*** %s CHECK: buffer %p, size=%lu, "
"corrupted %d bytes after allocation",
func, buffer, bytes, i+1);
return -1;
}
}
*allocated = bytes;
return 0;
}
void* chk_malloc(size_t bytes)
{
char* buffer = (char*)dlmalloc(bytes + CHK_OVERHEAD_SIZE);
if (buffer) {
memset(buffer, CHK_SENTINEL_VALUE, bytes + CHK_OVERHEAD_SIZE);
size_t offset = dlmalloc_usable_size(buffer) - sizeof(size_t);
*(size_t *)(buffer + offset) = bytes;
buffer += CHK_SENTINEL_HEAD_SIZE;
}
return buffer;
}
void chk_free(void* mem)
{
assert_valid_malloc_pointer(mem);
if (mem) {
size_t size;
char* buffer;
if (chk_mem_check(mem, &size, "FREE") == 0) {
buffer = (char*)mem - CHK_SENTINEL_HEAD_SIZE;
memset(buffer, CHK_FILL_FREE, size + CHK_OVERHEAD_SIZE);
dlfree(buffer);
}
}
}
void* chk_calloc(size_t n_elements, size_t elem_size)
{
size_t size;
void* ptr;
/* Fail on overflow - just to be safe even though this code runs only
* within the debugging C library, not the production one */
if (n_elements && MAX_SIZE_T / n_elements < elem_size) {
return NULL;
}
size = n_elements * elem_size;
ptr = chk_malloc(size);
if (ptr != NULL) {
memset(ptr, 0, size);
}
return ptr;
}
void* chk_realloc(void* mem, size_t bytes)
{
char* buffer;
int ret;
size_t old_bytes = 0;
assert_valid_malloc_pointer(mem);
if (mem != NULL && chk_mem_check(mem, &old_bytes, "REALLOC") < 0)
return NULL;
char* new_buffer = chk_malloc(bytes);
if (mem == NULL) {
return new_buffer;
}
if (new_buffer) {
if (bytes > old_bytes)
bytes = old_bytes;
memcpy(new_buffer, mem, bytes);
chk_free(mem);
}
return new_buffer;
}
void* chk_memalign(size_t alignment, size_t bytes)
{
// XXX: it's better to use malloc, than being wrong
return chk_malloc(bytes);
}
// =============================================================================
// malloc fill functions
// =============================================================================
void* fill_malloc(size_t bytes)
{
@@ -497,6 +252,9 @@ void* fill_memalign(size_t alignment, size_t bytes)
#define MEMALIGN_GUARD ((void*)0xA1A41520)
extern __LIBC_HIDDEN__
int get_backtrace(intptr_t* addrs, size_t max_entries);
void* leak_malloc(size_t bytes)
{
// allocate enough space infront of the allocation to store the pointer for
@@ -632,12 +390,3 @@ void* leak_memalign(size_t alignment, size_t bytes)
}
return base;
}
/* Initializes malloc debugging framework.
* See comments on MallocDebugInit in malloc_debug_common.h
*/
int malloc_debug_initialize(void)
{
// We don't really have anything that requires initialization here.
return 0;
}

View File

@@ -287,7 +287,7 @@ static void dump_malloc_descriptor(char* str,
/*
* Logging helper macros.
*/
#define debug_log(format, ...) \
#define qemu_debug_log(format, ...) \
do { \
__libc_android_log_print(ANDROID_LOG_DEBUG, "memcheck", \
(format), ##__VA_ARGS__ ); \
@@ -296,7 +296,7 @@ static void dump_malloc_descriptor(char* str,
} \
} while (0)
#define error_log(format, ...) \
#define qemu_error_log(format, ...) \
do { \
__libc_android_log_print(ANDROID_LOG_ERROR, "memcheck", \
(format), ##__VA_ARGS__ ); \
@@ -305,7 +305,7 @@ static void dump_malloc_descriptor(char* str,
} \
} while (0)
#define info_log(format, ...) \
#define qemu_info_log(format, ...) \
do { \
__libc_android_log_print(ANDROID_LOG_INFO, "memcheck", \
(format), ##__VA_ARGS__ ); \
@@ -692,7 +692,7 @@ memcheck_initialize(int alignment, const char* memcheck_param)
notify_qemu_libc_initialized(malloc_pid);
debug_log("Instrumented for pid=%03u: malloc=%p, free=%p, calloc=%p, realloc=%p, memalign=%p",
qemu_debug_log("Instrumented for pid=%03u: malloc=%p, free=%p, calloc=%p, realloc=%p, memalign=%p",
malloc_pid, qemu_instrumented_malloc, qemu_instrumented_free,
qemu_instrumented_calloc, qemu_instrumented_realloc,
qemu_instrumented_memalign);
@@ -717,7 +717,7 @@ qemu_instrumented_malloc(size_t bytes)
desc.suffix_size = DEFAULT_SUFFIX_SIZE;
desc.ptr = dlmalloc(mallocdesc_alloc_size(&desc));
if (desc.ptr == NULL) {
error_log("<libc_pid=%03u, pid=%03u> malloc(%u): dlmalloc(%u) failed.",
qemu_error_log("<libc_pid=%03u, pid=%03u> malloc(%u): dlmalloc(%u) failed.",
malloc_pid, getpid(), bytes, mallocdesc_alloc_size(&desc));
return NULL;
}
@@ -797,7 +797,7 @@ qemu_instrumented_calloc(size_t n_elements, size_t elem_size)
if (n_elements == 0 || elem_size == 0) {
// Just let go zero bytes allocation.
info_log("::: <libc_pid=%03u, pid=%03u>: Zero calloc redir to malloc",
qemu_info_log("::: <libc_pid=%03u, pid=%03u>: Zero calloc redir to malloc",
malloc_pid, getpid());
return qemu_instrumented_malloc(0);
}
@@ -874,14 +874,14 @@ qemu_instrumented_realloc(void* mem, size_t bytes)
if (mem == NULL) {
// Nothing to realloc. just do regular malloc.
info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to malloc",
qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to malloc",
malloc_pid, getpid(), mem, bytes);
return qemu_instrumented_malloc(bytes);
}
if (bytes == 0) {
// This is a "free" condition.
info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to free and malloc",
qemu_info_log("::: <libc_pid=%03u, pid=%03u>: realloc(%p, %u) redir to free and malloc",
malloc_pid, getpid(), mem, bytes);
qemu_instrumented_free(mem);
@@ -977,7 +977,7 @@ qemu_instrumented_memalign(size_t alignment, size_t bytes)
if (bytes == 0) {
// Just let go zero bytes allocation.
info_log("::: <libc_pid=%03u, pid=%03u>: memalign(%X, %u) redir to malloc",
qemu_info_log("::: <libc_pid=%03u, pid=%03u>: memalign(%X, %u) redir to malloc",
malloc_pid, getpid(), alignment, bytes);
return qemu_instrumented_malloc(0);
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright (C) 2012 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 <unwind.h>
#include <sys/types.h>
// =============================================================================
// stack trace functions
// =============================================================================
typedef struct
{
size_t count;
intptr_t* addrs;
} stack_crawl_state_t;
/* depends how the system includes define this */
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
typedef struct _Unwind_Context __unwind_context;
#else
typedef _Unwind_Context __unwind_context;
#endif
static _Unwind_Reason_Code trace_function(__unwind_context *context, void *arg)
{
stack_crawl_state_t* state = (stack_crawl_state_t*)arg;
if (state->count) {
intptr_t ip = (intptr_t)_Unwind_GetIP(context);
if (ip) {
state->addrs[0] = ip;
state->addrs++;
state->count--;
return _URC_NO_REASON;
}
}
/*
* If we run out of space to record the address or 0 has been seen, stop
* unwinding the stack.
*/
return _URC_END_OF_STACK;
}
__LIBC_HIDDEN__
int get_backtrace(intptr_t* addrs, size_t max_entries)
{
stack_crawl_state_t state;
state.count = max_entries;
state.addrs = (intptr_t*)addrs;
_Unwind_Backtrace(trace_function, (void*)&state);
return max_entries - state.count;
}

File diff suppressed because it is too large Load Diff

903
libc/bionic/pthread_debug.c Normal file
View File

@@ -0,0 +1,903 @@
/*
* 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.
*/
#include <sys/types.h>
#include <sys/atomics.h>
#include <sys/system_properties.h>
#include <sys/mman.h>
#if HAVE_DLADDR
#include <dlfcn.h>
#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <pthread.h>
#include <unwind.h>
#include <unistd.h>
#include "logd.h"
#include "bionic_tls.h"
/*
* ===========================================================================
* Deadlock prediction
* ===========================================================================
*/
/*
The idea is to predict the possibility of deadlock by recording the order
in which locks are acquired. If we see an attempt to acquire a lock
out of order, we can identify the locks and offending code.
To make this work, we need to keep track of the locks held by each thread,
and create history trees for each lock. When a thread tries to acquire
a new lock, we walk through the "history children" of the lock, looking
for a match with locks the thread already holds. If we find a match,
it means the thread has made a request that could result in a deadlock.
To support recursive locks, we always allow re-locking a currently-held
lock, and maintain a recursion depth count.
An ASCII-art example, where letters represent locks:
A
/|\
/ | \
B | D
\ |
\|
C
The above is the tree we'd have after handling lock synchronization
sequences "ABC", "AC", "AD". A has three children, {B, C, D}. C is also
a child of B. (The lines represent pointers between parent and child.
Every node can have multiple parents and multiple children.)
If we hold AC, and want to lock B, we recursively search through B's
children to see if A or C appears. It does, so we reject the attempt.
(A straightforward way to implement it: add a link from C to B, then
determine whether the graph starting at B contains a cycle.)
If we hold AC and want to lock D, we would succeed, creating a new link
from C to D.
Updates to MutexInfo structs are only allowed for the thread that holds
the lock, so we actually do most of our deadlock prediction work after
the lock has been acquired.
*/
// =============================================================================
// log functions
// =============================================================================
#define LOGD(format, ...) \
__libc_android_log_print(ANDROID_LOG_DEBUG, \
"pthread_debug", (format), ##__VA_ARGS__ )
#define LOGW(format, ...) \
__libc_android_log_print(ANDROID_LOG_WARN, \
"pthread_debug", (format), ##__VA_ARGS__ )
#define LOGE(format, ...) \
__libc_android_log_print(ANDROID_LOG_ERROR, \
"pthread_debug", (format), ##__VA_ARGS__ )
#define LOGI(format, ...) \
__libc_android_log_print(ANDROID_LOG_INFO, \
"pthread_debug", (format), ##__VA_ARGS__ )
static const char* const kStartBanner =
"===============================================================";
static const char* const kEndBanner =
"===============================================================";
extern char* __progname;
// =============================================================================
// map info functions
// =============================================================================
typedef struct mapinfo {
struct mapinfo *next;
unsigned start;
unsigned end;
char name[];
} mapinfo;
static mapinfo* sMapInfo = NULL;
static mapinfo *parse_maps_line(char *line)
{
mapinfo *mi;
int len = strlen(line);
if(len < 1) return 0;
line[--len] = 0;
if(len < 50) return 0;
if(line[20] != 'x') return 0;
mi = malloc(sizeof(mapinfo) + (len - 47));
if(mi == 0) return 0;
mi->start = strtoul(line, 0, 16);
mi->end = strtoul(line + 9, 0, 16);
/* To be filled in parse_elf_info if the mapped section starts with
* elf_header
*/
mi->next = 0;
strcpy(mi->name, line + 49);
return mi;
}
static mapinfo *init_mapinfo(int pid)
{
struct mapinfo *milist = NULL;
char data[1024];
sprintf(data, "/proc/%d/maps", pid);
FILE *fp = fopen(data, "r");
if(fp) {
while(fgets(data, sizeof(data), fp)) {
mapinfo *mi = parse_maps_line(data);
if(mi) {
mi->next = milist;
milist = mi;
}
}
fclose(fp);
}
return milist;
}
static void deinit_mapinfo(mapinfo *mi)
{
mapinfo *del;
while(mi) {
del = mi;
mi = mi->next;
free(del);
}
}
/* Find the containing map info for the pc */
static const mapinfo *pc_to_mapinfo(mapinfo *mi, unsigned pc, unsigned *rel_pc)
{
*rel_pc = pc;
while(mi) {
if((pc >= mi->start) && (pc < mi->end)){
// Only calculate the relative offset for shared libraries
if (strstr(mi->name, ".so")) {
*rel_pc -= mi->start;
}
return mi;
}
mi = mi->next;
}
return NULL;
}
// =============================================================================
// stack trace functions
// =============================================================================
#define STACK_TRACE_DEPTH 16
typedef struct
{
size_t count;
intptr_t* addrs;
} stack_crawl_state_t;
/* depends how the system includes define this */
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
typedef struct _Unwind_Context __unwind_context;
#else
typedef _Unwind_Context __unwind_context;
#endif
static _Unwind_Reason_Code trace_function(__unwind_context *context, void *arg)
{
stack_crawl_state_t* state = (stack_crawl_state_t*)arg;
if (state->count) {
intptr_t ip = (intptr_t)_Unwind_GetIP(context);
if (ip) {
state->addrs[0] = ip;
state->addrs++;
state->count--;
return _URC_NO_REASON;
}
}
/*
* If we run out of space to record the address or 0 has been seen, stop
* unwinding the stack.
*/
return _URC_END_OF_STACK;
}
static inline
int get_backtrace(intptr_t* addrs, size_t max_entries)
{
stack_crawl_state_t state;
state.count = max_entries;
state.addrs = (intptr_t*)addrs;
_Unwind_Backtrace(trace_function, (void*)&state);
return max_entries - state.count;
}
static void log_backtrace(intptr_t* addrs, size_t c)
{
int index = 0;
size_t i;
for (i=0 ; i<c; i++) {
unsigned int relpc;
void* offset = 0;
const char* symbol = NULL;
#if HAVE_DLADDR
Dl_info info;
if (dladdr((void*)addrs[i], &info)) {
offset = info.dli_saddr;
symbol = info.dli_sname;
}
#endif
if (symbol || index>0 || !HAVE_DLADDR) {
/*
* this test is a bit sketchy, but it allows us to skip the
* stack trace entries due to this debugging code. it works
* because those don't have a symbol (they're not exported)
*/
mapinfo const* mi = pc_to_mapinfo(sMapInfo, addrs[i], &relpc);
char const* soname = mi ? mi->name : NULL;
#if HAVE_DLADDR
if (!soname)
soname = info.dli_fname;
#endif
if (!soname)
soname = "unknown";
if (symbol) {
LOGW(" "
"#%02d pc %08lx %s (%s+0x%x)",
index, relpc, soname, symbol,
addrs[i] - (intptr_t)offset);
} else {
LOGW(" "
"#%02d pc %08lx %s",
index, relpc, soname);
}
index++;
}
}
}
/****************************************************************************/
/*
* level <= 0 : deadlock prediction disabled
* level 1 : deadlock prediction enabled, w/o call stacks
* level 2 : deadlock prediction enabled w/ call stacks
*/
#define CAPTURE_CALLSTACK 2
static int sPthreadDebugLevel = 0;
static pid_t sPthreadDebugDisabledThread = -1;
static pthread_mutex_t sDbgLock = PTHREAD_MUTEX_INITIALIZER;
/****************************************************************************/
/* some simple/lame malloc replacement
* NOT thread-safe and leaks everything
*/
#define DBG_ALLOC_BLOCK_SIZE PAGESIZE
static size_t sDbgAllocOffset = DBG_ALLOC_BLOCK_SIZE;
static char* sDbgAllocPtr = NULL;
static void* DbgAllocLocked(size_t size) {
if ((sDbgAllocOffset + size) > DBG_ALLOC_BLOCK_SIZE) {
sDbgAllocOffset = 0;
sDbgAllocPtr = mmap(NULL, DBG_ALLOC_BLOCK_SIZE, PROT_READ|PROT_WRITE,
MAP_ANON | MAP_PRIVATE, 0, 0);
if (sDbgAllocPtr == MAP_FAILED) {
return NULL;
}
}
void* addr = sDbgAllocPtr + sDbgAllocOffset;
sDbgAllocOffset += size;
return addr;
}
static void* debug_realloc(void *ptr, size_t size, size_t old_size) {
void* addr = mmap(NULL, size, PROT_READ|PROT_WRITE,
MAP_ANON | MAP_PRIVATE, 0, 0);
if (addr != MAP_FAILED) {
if (ptr) {
memcpy(addr, ptr, old_size);
munmap(ptr, old_size);
}
} else {
addr = NULL;
}
return addr;
}
/*****************************************************************************/
struct MutexInfo;
typedef struct CallStack {
intptr_t depth;
intptr_t* addrs;
} CallStack;
typedef struct MutexInfo* MutexInfoListEntry;
typedef struct CallStack CallStackListEntry;
typedef struct GrowingList {
int alloc;
int count;
union {
void* data;
MutexInfoListEntry* list;
CallStackListEntry* stack;
};
} GrowingList;
typedef GrowingList MutexInfoList;
typedef GrowingList CallStackList;
typedef struct MutexInfo {
// thread currently holding the lock or 0
pid_t owner;
// most-recently-locked doubly-linked list
struct MutexInfo* prev;
struct MutexInfo* next;
// for reentrant locks
int lockCount;
// when looking for loops in the graph, marks visited nodes
int historyMark;
// the actual mutex
pthread_mutex_t* mutex;
// list of locks directly acquired AFTER this one in the same thread
MutexInfoList children;
// list of locks directly acquired BEFORE this one in the same thread
MutexInfoList parents;
// list of call stacks when a new link is established to this lock form its parent
CallStackList stacks;
// call stack when this lock was acquired last
int stackDepth;
intptr_t stackTrace[STACK_TRACE_DEPTH];
} MutexInfo;
static void growingListInit(GrowingList* list) {
list->alloc = 0;
list->count = 0;
list->data = NULL;
}
static void growingListAdd(GrowingList* pList, size_t objSize) {
if (pList->count == pList->alloc) {
size_t oldsize = pList->alloc * objSize;
pList->alloc += PAGESIZE / objSize;
size_t size = pList->alloc * objSize;
pList->data = debug_realloc(pList->data, size, oldsize);
}
pList->count++;
}
static void initMutexInfo(MutexInfo* object, pthread_mutex_t* mutex) {
object->owner = 0;
object->prev = 0;
object->next = 0;
object->lockCount = 0;
object->historyMark = 0;
object->mutex = mutex;
growingListInit(&object->children);
growingListInit(&object->parents);
growingListInit(&object->stacks);
object->stackDepth = 0;
}
typedef struct ThreadInfo {
pid_t pid;
MutexInfo* mrl;
} ThreadInfo;
static void initThreadInfo(ThreadInfo* object, pid_t pid) {
object->pid = pid;
object->mrl = NULL;
}
/****************************************************************************/
static MutexInfo* get_mutex_info(pthread_mutex_t *mutex);
static void mutex_lock_checked(MutexInfo* mrl, MutexInfo* object);
static void mutex_unlock_checked(MutexInfo* object);
/****************************************************************************/
extern int pthread_mutex_lock_impl(pthread_mutex_t *mutex);
extern int pthread_mutex_unlock_impl(pthread_mutex_t *mutex);
static int pthread_mutex_lock_unchecked(pthread_mutex_t *mutex) {
return pthread_mutex_lock_impl(mutex);
}
static int pthread_mutex_unlock_unchecked(pthread_mutex_t *mutex) {
return pthread_mutex_unlock_impl(mutex);
}
/****************************************************************************/
static void dup_backtrace(CallStack* stack, int count, intptr_t const* addrs) {
stack->depth = count;
stack->addrs = DbgAllocLocked(count * sizeof(intptr_t));
memcpy(stack->addrs, addrs, count * sizeof(intptr_t));
}
/****************************************************************************/
static int historyListHas(
const MutexInfoList* list, MutexInfo const * obj) {
int i;
for (i=0; i<list->count; i++) {
if (list->list[i] == obj) {
return i;
}
}
return -1;
}
static void historyListAdd(MutexInfoList* pList, MutexInfo* obj) {
growingListAdd(pList, sizeof(MutexInfoListEntry));
pList->list[pList->count - 1] = obj;
}
static int historyListRemove(MutexInfoList* pList, MutexInfo* obj) {
int i;
for (i = pList->count-1; i >= 0; i--) {
if (pList->list[i] == obj) {
break;
}
}
if (i < 0) {
// not found!
return 0;
}
if (i != pList->count-1) {
// copy the last entry to the new free slot
pList->list[i] = pList->list[pList->count-1];
}
pList->count--;
memset(&pList->list[pList->count], 0, sizeof(MutexInfoListEntry));
return 1;
}
static void linkParentToChild(MutexInfo* parent, MutexInfo* child) {
historyListAdd(&parent->children, child);
historyListAdd(&child->parents, parent);
}
static void unlinkParentFromChild(MutexInfo* parent, MutexInfo* child) {
historyListRemove(&parent->children, child);
historyListRemove(&child->parents, parent);
}
/****************************************************************************/
static void callstackListAdd(CallStackList* pList,
int count, intptr_t const* addrs) {
growingListAdd(pList, sizeof(CallStackListEntry));
dup_backtrace(&pList->stack[pList->count - 1], count, addrs);
}
/****************************************************************************/
/*
* Recursively traverse the object hierarchy starting at "obj". We mark
* ourselves on entry and clear the mark on exit. If we ever encounter
* a marked object, we have a cycle.
*
* Returns "true" if all is well, "false" if we found a cycle.
*/
static int traverseTree(MutexInfo* obj, MutexInfo const* objParent)
{
/*
* Have we been here before?
*/
if (obj->historyMark) {
int stackDepth;
intptr_t addrs[STACK_TRACE_DEPTH];
/* Turn off prediction temporarily in this thread while logging */
sPthreadDebugDisabledThread = gettid();
if (sMapInfo == NULL) {
// note: we're protected by sDbgLock
sMapInfo = init_mapinfo(getpid());
}
LOGW("%s\n", kStartBanner);
LOGW("pid: %d, tid: %d >>> %s <<<", getpid(), gettid(), __progname);
LOGW("Illegal lock attempt:\n");
LOGW("--- pthread_mutex_t at %p\n", obj->mutex);
stackDepth = get_backtrace(addrs, STACK_TRACE_DEPTH);
log_backtrace(addrs, stackDepth);
LOGW("+++ Currently held locks in this thread (in reverse order):");
MutexInfo* cur = obj;
pid_t ourtid = gettid();
int i;
for (i=0 ; i<cur->parents.count ; i++) {
MutexInfo* parent = cur->parents.list[i];
if (parent->owner == ourtid) {
LOGW("--- pthread_mutex_t at %p\n", parent->mutex);
if (sPthreadDebugLevel >= CAPTURE_CALLSTACK) {
log_backtrace(parent->stackTrace, parent->stackDepth);
}
cur = parent;
break;
}
}
LOGW("+++ Earlier, the following lock order (from last to first) was established\n");
return 0;
}
obj->historyMark = 1;
MutexInfoList* pList = &obj->children;
int result = 1;
int i;
for (i = pList->count-1; i >= 0; i--) {
MutexInfo* child = pList->list[i];
if (!traverseTree(child, obj)) {
LOGW("--- pthread_mutex_t at %p\n", obj->mutex);
if (sPthreadDebugLevel >= CAPTURE_CALLSTACK) {
int index = historyListHas(&obj->parents, objParent);
if ((size_t)index < (size_t)obj->stacks.count) {
log_backtrace(
obj->stacks.stack[index].addrs,
obj->stacks.stack[index].depth);
} else {
log_backtrace(
obj->stackTrace,
obj->stackDepth);
}
}
result = 0;
break;
}
}
obj->historyMark = 0;
return result;
}
/****************************************************************************/
static void mutex_lock_checked(MutexInfo* mrl, MutexInfo* object)
{
pid_t tid = gettid();
if (object->owner == tid) {
object->lockCount++;
return;
}
object->owner = tid;
object->lockCount = 0;
if (sPthreadDebugLevel >= CAPTURE_CALLSTACK) {
// always record the call stack when acquiring a lock.
// it's not efficient, but is useful during diagnostics
object->stackDepth = get_backtrace(object->stackTrace, STACK_TRACE_DEPTH);
}
// no other locks held in this thread -- no deadlock possible!
if (mrl == NULL)
return;
// check if the lock we're trying to acquire is a direct descendant of
// the most recently locked mutex in this thread, in which case we're
// in a good situation -- no deadlock possible
if (historyListHas(&mrl->children, object) >= 0)
return;
pthread_mutex_lock_unchecked(&sDbgLock);
linkParentToChild(mrl, object);
if (!traverseTree(object, mrl)) {
deinit_mapinfo(sMapInfo);
sMapInfo = NULL;
LOGW("%s\n", kEndBanner);
unlinkParentFromChild(mrl, object);
// reenable pthread debugging for this thread
sPthreadDebugDisabledThread = -1;
} else {
// record the call stack for this link
// NOTE: the call stack is added at the same index
// as mrl in object->parents[]
// ie: object->parents.count == object->stacks.count, which is
// also the index.
if (sPthreadDebugLevel >= CAPTURE_CALLSTACK) {
callstackListAdd(&object->stacks,
object->stackDepth, object->stackTrace);
}
}
pthread_mutex_unlock_unchecked(&sDbgLock);
}
static void mutex_unlock_checked(MutexInfo* object)
{
pid_t tid = gettid();
if (object->owner == tid) {
if (object->lockCount == 0) {
object->owner = 0;
} else {
object->lockCount--;
}
}
}
// =============================================================================
// Hash Table functions
// =============================================================================
/****************************************************************************/
#define HASHTABLE_SIZE 256
typedef struct HashEntry HashEntry;
struct HashEntry {
size_t slot;
HashEntry* prev;
HashEntry* next;
void* data;
};
typedef struct HashTable HashTable;
struct HashTable {
HashEntry* slots[HASHTABLE_SIZE];
};
static HashTable sMutexMap;
static HashTable sThreadMap;
/****************************************************************************/
static uint32_t get_hashcode(void const * key, size_t keySize)
{
uint32_t h = keySize;
char const* data = (char const*)key;
size_t i;
for (i = 0; i < keySize; i++) {
h = h * 31 + *data;
data++;
}
return (uint32_t)h;
}
static size_t get_index(uint32_t h)
{
// We apply this secondary hashing discovered by Doug Lea to defend
// against bad hashes.
h += ~(h << 9);
h ^= (((unsigned int) h) >> 14);
h += (h << 4);
h ^= (((unsigned int) h) >> 10);
return (size_t)h & (HASHTABLE_SIZE - 1);
}
/****************************************************************************/
static void hashmap_init(HashTable* table) {
memset(table, 0, sizeof(HashTable));
}
static void hashmap_removeEntry(HashTable* table, HashEntry* entry)
{
HashEntry* prev = entry->prev;
HashEntry* next = entry->next;
if (prev != NULL) entry->prev->next = next;
if (next != NULL) entry->next->prev = prev;
if (prev == NULL) {
// we are the head of the list. set the head to be next
table->slots[entry->slot] = entry->next;
}
}
static HashEntry* hashmap_lookup(HashTable* table,
void const* key, size_t ksize,
int (*equals)(void const* data, void const* key))
{
const uint32_t hash = get_hashcode(key, ksize);
const size_t slot = get_index(hash);
HashEntry* entry = table->slots[slot];
while (entry) {
if (equals(entry->data, key)) {
break;
}
entry = entry->next;
}
if (entry == NULL) {
// create a new entry
entry = (HashEntry*)DbgAllocLocked(sizeof(HashEntry));
entry->data = NULL;
entry->slot = slot;
entry->prev = NULL;
entry->next = table->slots[slot];
if (entry->next != NULL) {
entry->next->prev = entry;
}
table->slots[slot] = entry;
}
return entry;
}
/****************************************************************************/
static int MutexInfo_equals(void const* data, void const* key) {
return ((MutexInfo const *)data)->mutex == *(pthread_mutex_t **)key;
}
static MutexInfo* get_mutex_info(pthread_mutex_t *mutex)
{
pthread_mutex_lock_unchecked(&sDbgLock);
HashEntry* entry = hashmap_lookup(&sMutexMap,
&mutex, sizeof(mutex),
&MutexInfo_equals);
if (entry->data == NULL) {
entry->data = (MutexInfo*)DbgAllocLocked(sizeof(MutexInfo));
initMutexInfo(entry->data, mutex);
}
pthread_mutex_unlock_unchecked(&sDbgLock);
return (MutexInfo *)entry->data;
}
/****************************************************************************/
static int ThreadInfo_equals(void const* data, void const* key) {
return ((ThreadInfo const *)data)->pid == *(pid_t *)key;
}
static ThreadInfo* get_thread_info(pid_t pid)
{
pthread_mutex_lock_unchecked(&sDbgLock);
HashEntry* entry = hashmap_lookup(&sThreadMap,
&pid, sizeof(pid),
&ThreadInfo_equals);
if (entry->data == NULL) {
entry->data = (ThreadInfo*)DbgAllocLocked(sizeof(ThreadInfo));
initThreadInfo(entry->data, pid);
}
pthread_mutex_unlock_unchecked(&sDbgLock);
return (ThreadInfo *)entry->data;
}
static void push_most_recently_locked(MutexInfo* mrl) {
ThreadInfo* tinfo = get_thread_info(gettid());
mrl->next = NULL;
mrl->prev = tinfo->mrl;
tinfo->mrl = mrl;
}
static void remove_most_recently_locked(MutexInfo* mrl) {
ThreadInfo* tinfo = get_thread_info(gettid());
if (mrl->next) {
(mrl->next)->prev = mrl->prev;
}
if (mrl->prev) {
(mrl->prev)->next = mrl->next;
}
if (tinfo->mrl == mrl) {
tinfo->mrl = mrl->next;
}
}
static MutexInfo* get_most_recently_locked() {
ThreadInfo* tinfo = get_thread_info(gettid());
return tinfo->mrl;
}
/****************************************************************************/
/* pthread_debug_init() is called from libc_init_dynamic() just
* after system properties have been initialized
*/
__LIBC_HIDDEN__
void pthread_debug_init(void) {
char env[PROP_VALUE_MAX];
if (__system_property_get("debug.libc.pthread", env)) {
int level = atoi(env);
if (level) {
LOGI("pthread deadlock detection level %d enabled for pid %d (%s)",
level, getpid(), __progname);
hashmap_init(&sMutexMap);
sPthreadDebugLevel = level;
}
}
}
/*
* See if we were allowed to grab the lock at this time. We do it
* *after* acquiring the lock, rather than before, so that we can
* freely update the MutexInfo struct. This seems counter-intuitive,
* but our goal is deadlock *prediction* not deadlock *prevention*.
* (If we actually deadlock, the situation is easy to diagnose from
* a thread dump, so there's no point making a special effort to do
* the checks before the lock is held.)
*/
__LIBC_HIDDEN__
void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex)
{
if (sPthreadDebugLevel == 0) return;
// prediction disabled for this thread
if (sPthreadDebugDisabledThread == gettid())
return;
MutexInfo* object = get_mutex_info(mutex);
MutexInfo* mrl = get_most_recently_locked();
mutex_lock_checked(mrl, object);
push_most_recently_locked(object);
}
/*
* pthread_debug_mutex_unlock_check() must be called with the mutex
* still held (ie: before calling the real unlock)
*/
__LIBC_HIDDEN__
void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex)
{
if (sPthreadDebugLevel == 0) return;
// prediction disabled for this thread
if (sPthreadDebugDisabledThread == gettid())
return;
MutexInfo* object = get_mutex_info(mutex);
remove_most_recently_locked(object);
mutex_unlock_checked(object);
}

View File

@@ -47,6 +47,8 @@ typedef struct pthread_internal_t
} pthread_internal_t;
extern void _init_thread(pthread_internal_t * thread, pid_t kernel_id, pthread_attr_t * attr, void * stack_base);
void _pthread_internal_add( pthread_internal_t* thread );
pthread_internal_t* __get_thread(void);
/* needed by posix-timers.c */

View File

@@ -1,4 +1,3 @@
/* $OpenBSD: realpath.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
/*
* Copyright (c) 2003 Constantin S. Svintsoff <kostik@iclub.nsu.ru>
*
@@ -27,6 +26,12 @@
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: release/9.0.0/lib/libc/stdlib/realpath.c 217144 2011-01-08 11:04:30Z kib $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -36,23 +41,36 @@
#include <unistd.h>
/*
* char *realpath(const char *path, char resolved[PATH_MAX]);
*
* Find the real name of path, by removing all ".", ".." and symlink
* components. Returns (resolved) on success, or (NULL) on failure,
* in which case the path which caused trouble is left in (resolved).
*/
char *
realpath(const char *path, char resolved[PATH_MAX])
realpath(const char * __restrict path, char * __restrict resolved)
{
struct stat sb;
char *p, *q, *s;
size_t left_len, resolved_len;
unsigned symlinks;
int serrno, slen;
int m, serrno, slen;
char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
if (path == NULL) {
errno = EINVAL;
return (NULL);
}
if (path[0] == '\0') {
errno = ENOENT;
return (NULL);
}
serrno = errno;
if (resolved == NULL) {
resolved = malloc(PATH_MAX);
if (resolved == NULL)
return (NULL);
m = 1;
} else
m = 0;
symlinks = 0;
if (path[0] == '/') {
resolved[0] = '/';
@@ -63,13 +81,20 @@ realpath(const char *path, char resolved[PATH_MAX])
left_len = strlcpy(left, path + 1, sizeof(left));
} else {
if (getcwd(resolved, PATH_MAX) == NULL) {
strlcpy(resolved, ".", PATH_MAX);
if (m)
free(resolved);
else {
resolved[0] = '.';
resolved[1] = '\0';
}
return (NULL);
}
resolved_len = strlen(resolved);
left_len = strlcpy(left, path, sizeof(left));
}
if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -85,6 +110,8 @@ realpath(const char *path, char resolved[PATH_MAX])
p = strchr(left, '/');
s = p ? p : left + left_len;
if (s - left >= sizeof(next_token)) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -95,6 +122,8 @@ realpath(const char *path, char resolved[PATH_MAX])
memmove(left, s + 1, left_len + 1);
if (resolved[resolved_len - 1] != '/') {
if (resolved_len + 1 >= PATH_MAX) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -126,6 +155,8 @@ realpath(const char *path, char resolved[PATH_MAX])
*/
resolved_len = strlcat(resolved, next_token, PATH_MAX);
if (resolved_len >= PATH_MAX) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -134,16 +165,23 @@ realpath(const char *path, char resolved[PATH_MAX])
errno = serrno;
return (resolved);
}
if (m)
free(resolved);
return (NULL);
}
if (S_ISLNK(sb.st_mode)) {
if (symlinks++ > MAXSYMLINKS) {
if (m)
free(resolved);
errno = ELOOP;
return (NULL);
}
slen = readlink(resolved, symlink, sizeof(symlink) - 1);
if (slen < 0)
if (slen < 0) {
if (m)
free(resolved);
return (NULL);
}
symlink[slen] = '\0';
if (symlink[0] == '/') {
resolved[1] = 0;
@@ -164,6 +202,8 @@ realpath(const char *path, char resolved[PATH_MAX])
if (p != NULL) {
if (symlink[slen - 1] != '/') {
if (slen + 1 >= sizeof(symlink)) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}
@@ -172,6 +212,8 @@ realpath(const char *path, char resolved[PATH_MAX])
}
left_len = strlcat(symlink, left, sizeof(left));
if (left_len >= sizeof(left)) {
if (m)
free(resolved);
errno = ENAMETOOLONG;
return (NULL);
}

View File

@@ -174,7 +174,7 @@ __sem_dec(volatile unsigned int *pvalue)
new = SEMCOUNT_DECREMENT(old);
}
while (__atomic_cmpxchg((int)(old|shared),
while (__bionic_cmpxchg((int)(old|shared),
(int)(new|shared),
(volatile int *)pvalue) != 0);
return ret;
@@ -198,7 +198,7 @@ __sem_trydec(volatile unsigned int *pvalue)
new = SEMCOUNT_DECREMENT(old);
}
while (__atomic_cmpxchg((int)(old|shared),
while (__bionic_cmpxchg((int)(old|shared),
(int)(new|shared),
(volatile int *)pvalue) != 0);
@@ -235,7 +235,7 @@ __sem_inc(volatile unsigned int *pvalue)
else
new = SEMCOUNT_INCREMENT(old);
}
while ( __atomic_cmpxchg((int)(old|shared),
while ( __bionic_cmpxchg((int)(old|shared),
(int)(new|shared),
(volatile int*)pvalue) != 0);

View File

@@ -250,30 +250,58 @@ android_name_to_group( struct group *gr, const char *name )
static unsigned
app_id_from_name( const char* name )
{
unsigned long id;
unsigned long userid;
unsigned long appid;
char* end;
if (memcmp(name, "app_", 4) != 0 || !isdigit(name[4]))
if (name[0] != 'u' || !isdigit(name[1]))
goto FAIL;
id = strtoul(name+4, &end, 10);
if (*end != '\0')
userid = strtoul(name+1, &end, 10);
if (end[0] != '_' || end[1] == 0 || !isdigit(end[2]))
goto FAIL;
id += AID_APP;
/* check for overflow and that the value can be
* stored in our 32-bit uid_t/gid_t */
if (id < AID_APP || (unsigned)id != id)
if (end[1] == 'a')
appid = strtoul(end+2, &end, 10) + AID_APP;
else if (end[1] == 'i')
appid = strtoul(end+2, &end, 10) + AID_ISOLATED_START;
else
goto FAIL;
return (unsigned)id;
if (end[0] != 0)
goto FAIL;
/* check that user id won't overflow */
if (userid > 1000)
goto FAIL;
/* check that app id is within range */
if (appid < AID_APP || appid >= AID_USER)
goto FAIL;
return (unsigned)(appid + userid*AID_USER);
FAIL:
errno = ENOENT;
return 0;
}
static void
print_app_uid_name(uid_t uid, char* buffer, int bufferlen)
{
uid_t appid;
uid_t userid;
appid = uid % AID_USER;
userid = uid / AID_USER;
if (appid < AID_ISOLATED_START) {
snprintf(buffer, bufferlen, "u%u_a%u", userid, appid - AID_APP);
} else {
snprintf(buffer, bufferlen, "u%u_i%u", userid, appid - AID_ISOLATED_START);
}
}
/* translate a uid into the corresponding app_<uid>
* passwd structure (sets errno to ENOENT on failure)
*/
@@ -287,8 +315,7 @@ app_id_to_passwd(uid_t uid, stubs_state_t* state)
return NULL;
}
snprintf( state->app_name_buffer, sizeof state->app_name_buffer,
"app_%u", uid - AID_APP );
print_app_uid_name(uid, state->app_name_buffer, sizeof state->app_name_buffer);
pw->pw_name = state->app_name_buffer;
pw->pw_dir = "/data";
@@ -306,14 +333,15 @@ static struct group*
app_id_to_group(gid_t gid, stubs_state_t* state)
{
struct group* gr = &state->group;
int appid;
int userid;
if (gid < AID_APP) {
errno = ENOENT;
return NULL;
}
snprintf(state->group_name_buffer, sizeof state->group_name_buffer,
"app_%u", gid - AID_APP);
print_app_uid_name(gid, state->group_name_buffer, sizeof state->group_name_buffer);
gr->gr_name = state->group_name_buffer;
gr->gr_gid = gid;

71
libc/bionic/tdelete.c Normal file
View File

@@ -0,0 +1,71 @@
/* $NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
* the AT&T man page says.
*
* The node_t structure is for internal use only, lint doesn't grok it.
*
* Written by reading the System V Interface Definition, not the code.
*
* Totally public domain.
*/
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD: release/9.0.0/lib/libc/stdlib/tdelete.c 108694 2003-01-05 02:43:18Z tjr $");
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
/*
* delete node with given key
*
* vkey: key to be deleted
* vrootp: address of the root of the tree
* compar: function to carry out node comparisons
*/
void *
tdelete(const void * __restrict vkey, void ** __restrict vrootp,
int (*compar)(const void *, const void *))
{
node_t **rootp = (node_t **)vrootp;
node_t *p, *q, *r;
int cmp;
if (rootp == NULL || (p = *rootp) == NULL)
return NULL;
while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) {
p = *rootp;
rootp = (cmp < 0) ?
&(*rootp)->llink : /* follow llink branch */
&(*rootp)->rlink; /* follow rlink branch */
if (*rootp == NULL)
return NULL; /* key not found */
}
r = (*rootp)->rlink; /* D1: */
if ((q = (*rootp)->llink) == NULL) /* Left NULL? */
q = r;
else if (r != NULL) { /* Right link is NULL? */
if (r->llink == NULL) { /* D2: Find successor */
r->llink = q;
q = r;
} else { /* D3: Find NULL link */
for (q = r->llink; q->llink != NULL; q = r->llink)
r = q;
r->llink = q->rlink;
q->llink = (*rootp)->llink;
q->rlink = (*rootp)->rlink;
}
}
free(*rootp); /* D4: Free node */
*rootp = q; /* link parent to new node */
return p;
}

33
libc/bionic/tdestroy.c Normal file
View File

@@ -0,0 +1,33 @@
/*
* Copyright 2012, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
/* destroy a tree and free all allocated resources */
void
tdestroy(void *root, void (*destroy_func)(void *))
{
node_t *root_node = (node_t *) root;
if (root_node == NULL) return;
if (root_node->llink)
tdestroy(root_node->llink, destroy_func);
if (root_node->rlink)
tdestroy(root_node->rlink, destroy_func);
(*destroy_func)(root_node->key);
free(root);
}

48
libc/bionic/tfind.c Normal file
View File

@@ -0,0 +1,48 @@
/* $NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
* the AT&T man page says.
*
* The node_t structure is for internal use only, lint doesn't grok it.
*
* Written by reading the System V Interface Definition, not the code.
*
* Totally public domain.
*/
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD: release/9.0.0/lib/libc/stdlib/tfind.c 108694 2003-01-05 02:43:18Z tjr $");
#define _SEARCH_PRIVATE
#include <stdlib.h>
#include <search.h>
/* find a node, or return 0 */
void *
tfind(vkey, vrootp, compar)
const void *vkey; /* key to be found */
void * const *vrootp; /* address of the tree root */
int (*compar)(const void *, const void *);
{
node_t **rootp = (node_t **)vrootp;
if (rootp == NULL)
return NULL;
while (*rootp != NULL) { /* T1: */
int r;
if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
return *rootp; /* key found */
rootp = (r < 0) ?
&(*rootp)->llink : /* T3: follow left branch */
&(*rootp)->rlink; /* T4: follow right branch */
}
return NULL;
}

58
libc/bionic/tsearch.c Normal file
View File

@@ -0,0 +1,58 @@
/* $NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
* the AT&T man page says.
*
* The node_t structure is for internal use only, lint doesn't grok it.
*
* Written by reading the System V Interface Definition, not the code.
*
* Totally public domain.
*/
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD: release/9.0.0/lib/libc/stdlib/tsearch.c 108694 2003-01-05 02:43:18Z tjr $");
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
/* find or insert datum into search tree */
void *
tsearch(vkey, vrootp, compar)
const void *vkey; /* key to be located */
void **vrootp; /* address of tree root */
int (*compar)(const void *, const void *);
{
node_t *q;
node_t **rootp = (node_t **)vrootp;
if (rootp == NULL)
return NULL;
while (*rootp != NULL) { /* Knuth's T1: */
int r;
if ((r = (*compar)(vkey, (*rootp)->key)) == 0) /* T2: */
return *rootp; /* we found it! */
rootp = (r < 0) ?
&(*rootp)->llink : /* T3: follow left branch */
&(*rootp)->rlink; /* T4: follow right branch */
}
q = malloc(sizeof(node_t)); /* T5: key not found */
if (q != 0) { /* make new node */
*rootp = q; /* link new node to old */
/* LINTED const castaway ok */
q->key = (void *)vkey; /* initialize new node */
q->llink = q->rlink = NULL;
}
return q;
}

66
libc/include/ar.h Normal file
View File

@@ -0,0 +1,66 @@
/* $OpenBSD: ar.h,v 1.3 2003/06/02 19:34:12 millert Exp $ */
/* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* This code is derived from software contributed to Berkeley by
* Hugh Smith at The University of Guelph.
*
* 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.
*
* @(#)ar.h 8.2 (Berkeley) 1/21/94
*/
#ifndef _AR_H_
#define _AR_H_
/* Pre-4BSD archives had these magic numbers in them. */
#define OARMAG1 0177555
#define OARMAG2 0177545
#define ARMAG "!<arch>\n" /* ar "magic number" */
#define SARMAG 8 /* strlen(ARMAG); */
#define AR_EFMT1 "#1/" /* extended format #1 */
struct ar_hdr {
char ar_name[16]; /* name */
char ar_date[12]; /* modification time */
char ar_uid[6]; /* user id */
char ar_gid[6]; /* group id */
char ar_mode[8]; /* octal file permissions */
char ar_size[10]; /* size in bytes */
#define ARFMAG "`\n"
char ar_fmag[2]; /* consistency check */
};
#endif /* !_AR_H_ */

View File

@@ -42,9 +42,13 @@ typedef struct
int volatile value;
} pthread_mutex_t;
#define PTHREAD_MUTEX_INITIALIZER {0}
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {0x4000}
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {0x8000}
#define __PTHREAD_MUTEX_INIT_VALUE 0
#define __PTHREAD_RECURSIVE_MUTEX_INIT_VALUE 0x4000
#define __PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE 0x8000
#define PTHREAD_MUTEX_INITIALIZER {__PTHREAD_MUTEX_INIT_VALUE}
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {__PTHREAD_RECURSIVE_MUTEX_INIT_VALUE}
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {__PTHREAD_ERRORCHECK_MUTEX_INIT_VALUE}
enum {
PTHREAD_MUTEX_NORMAL = 0,

View File

@@ -50,21 +50,6 @@ extern struct __res_state *__res_state(void);
extern int b64_ntop(u_char const *, size_t, char *, size_t);
extern int b64_pton(char const *, u_char *, size_t);
/* Set name of default interface */
extern void _resolv_set_default_iface(const char* ifname);
/* set name servers for an interface */
extern void _resolv_set_nameservers_for_iface(const char* ifname, char** servers, int numservers);
/* tell resolver of the address of an interface */
extern void _resolv_set_addr_of_iface(const char* ifname, struct in_addr* addr);
/* flush the cache associated with the default interface */
extern void _resolv_flush_cache_for_default_iface();
/* flush the cache associated with a certain interface */
extern void _resolv_flush_cache_for_iface(const char* ifname);
__END_DECLS
#endif /* _RESOLV_H_ */

46
libc/include/search.h Normal file
View File

@@ -0,0 +1,46 @@
/*-
* Written by J.T. Conklin <jtc@netbsd.org>
* Public domain.
*
* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
* $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $
*/
#ifndef _SEARCH_H_
#define _SEARCH_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#if 0
#ifndef _SIZE_T_DECLARED
typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
#endif
typedef enum {
preorder,
postorder,
endorder,
leaf
} VISIT;
#ifdef _SEARCH_PRIVATE
typedef struct node {
char *key;
struct node *llink, *rlink;
} node_t;
#endif
__BEGIN_DECLS
void *tdelete(const void * __restrict, void ** __restrict,
int (*)(const void *, const void *));
void *tfind(const void *, void * const *,
int (*)(const void *, const void *));
void *tsearch(const void *, void **, int (*)(const void *, const void *));
void twalk(const void *, void (*)(const void *, VISIT, int));
void tdestroy(void *, void (*)(void *));
__END_DECLS
#endif /* !_SEARCH_H_ */

View File

@@ -452,8 +452,10 @@ extern int __isthreaded;
* fdprintf is a better name, and some programs that use fdprintf use a
* #define fdprintf dprintf for compatibility
*/
__BEGIN_DECLS
int fdprintf(int, const char*, ...);
int vfdprintf(int, const char*, __va_list);
__END_DECLS
#endif /* _GNU_SOURCE */
#endif /* _STDIO_H_ */

View File

@@ -67,6 +67,8 @@ extern unsigned long strtoul(const char *, char **, int);
extern unsigned long long strtoull(const char *, char **, int);
extern double strtod(const char *nptr, char **endptr);
extern int posix_memalign(void **memptr, size_t alignment, size_t size);
static __inline__ float strtof(const char *nptr, char **endptr)
{
return (float)strtod(nptr, endptr);

View File

@@ -35,54 +35,54 @@
__BEGIN_DECLS
extern void* memccpy(void *, const void *, int, size_t);
extern void* memchr(const void *, int, size_t);
extern void* memrchr(const void *, int, size_t);
extern int memcmp(const void *, const void *, size_t);
extern void* memchr(const void *, int, size_t) __purefunc;
extern void* memrchr(const void *, int, size_t) __purefunc;
extern int memcmp(const void *, const void *, size_t) __purefunc;
extern void* memcpy(void *, const void *, size_t);
extern void* memmove(void *, const void *, size_t);
extern void* memset(void *, int, size_t);
extern void* memmem(const void *, size_t, const void *, size_t);
extern void* memmem(const void *, size_t, const void *, size_t) __purefunc;
extern void memswap(void *, void *, size_t);
extern char* index(const char *, int);
extern char* rindex(const char *, int);
extern char* strchr(const char *, int);
extern char* strrchr(const char *, int);
extern char* index(const char *, int) __purefunc;
extern char* rindex(const char *, int) __purefunc;
extern char* strchr(const char *, int) __purefunc;
extern char* strrchr(const char *, int) __purefunc;
extern size_t strlen(const char *);
extern int strcmp(const char *, const char *);
extern size_t strlen(const char *) __purefunc;
extern int strcmp(const char *, const char *) __purefunc;
extern char* strcpy(char *, const char *);
extern char* strcat(char *, const char *);
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);
extern int strcasecmp(const char *, const char *) __purefunc;
extern int strncasecmp(const char *, const char *, size_t) __purefunc;
extern char* strdup(const char *);
extern char* strstr(const char *, const char *);
extern char* strcasestr(const char *haystack, const char *needle);
extern char* strstr(const char *, const char *) __purefunc;
extern char* strcasestr(const char *haystack, const char *needle) __purefunc;
extern char* strtok(char *, const char *);
extern char* strtok_r(char *, const char *, char**);
extern char* strerror(int);
extern int strerror_r(int errnum, char *buf, size_t n);
extern size_t strnlen(const char *, size_t);
extern size_t strnlen(const char *, size_t) __purefunc;
extern char* strncat(char *, const char *, size_t);
extern char* strndup(const char *, size_t);
extern int strncmp(const char *, const char *, size_t);
extern int strncmp(const char *, const char *, size_t) __purefunc;
extern char* strncpy(char *, const char *, size_t);
extern size_t strlcat(char *, const char *, size_t);
extern size_t strlcpy(char *, const char *, size_t);
extern size_t strcspn(const char *, const char *);
extern char* strpbrk(const char *, const char *);
extern size_t strcspn(const char *, const char *) __purefunc;
extern char* strpbrk(const char *, const char *) __purefunc;
extern char* strsep(char **, const char *);
extern size_t strspn(const char *, const char *);
extern char* strsignal(int sig);
extern int strcoll(const char *, const char *);
extern int strcoll(const char *, const char *) __purefunc;
extern size_t strxfrm(char *, const char *, size_t);
__END_DECLS

View File

@@ -33,10 +33,48 @@
__BEGIN_DECLS
extern int __atomic_cmpxchg(int old, int _new, volatile int *ptr);
extern int __atomic_swap(int _new, volatile int *ptr);
extern int __atomic_dec(volatile int *ptr);
extern int __atomic_inc(volatile int *ptr);
/* Note: atomic operations that were exported by the C library didn't
* provide any memory barriers, which created potential issues on
* multi-core devices. We now define them as inlined calls to
* GCC sync builtins, which always provide a full barrier.
*
* NOTE: The C library still exports atomic functions by the same
* name to ensure ABI stability for existing NDK machine code.
*
* If you are an NDK developer, we encourage you to rebuild your
* unmodified sources against this header as soon as possible.
*/
#define __ATOMIC_INLINE__ static __inline__ __attribute__((always_inline))
__ATOMIC_INLINE__ 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;
}
__ATOMIC_INLINE__ 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;
}
__ATOMIC_INLINE__ int
__atomic_dec(volatile int *ptr)
{
return __sync_fetch_and_sub (ptr, 1);
}
__ATOMIC_INLINE__ int
__atomic_inc(volatile int *ptr)
{
return __sync_fetch_and_add (ptr, 1);
}
int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout);
int __futex_wake(volatile void *ftx, int count);

View File

@@ -306,9 +306,11 @@
#if __GNUC_PREREQ__(2, 96)
#define __noreturn __attribute__((__noreturn__))
#define __mallocfunc __attribute__((malloc))
#define __purefunc __attribute__((pure))
#else
#define __noreturn
#define __mallocfunc
#define __purefunc
#endif
/*

View File

@@ -130,4 +130,6 @@
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
#define PT_GNU_RELRO 0x6474e552 /* Read-only post relocation */
#endif /* _SYS_EXEC_ELF_H_ */

View File

@@ -146,6 +146,7 @@
#define __NR_syslog (__NR_SYSCALL_BASE + 103)
#define __NR_sysinfo (__NR_SYSCALL_BASE + 116)
#define __NR_personality (__NR_SYSCALL_BASE + 136)
#define __NR_perf_event_open (__NR_SYSCALL_BASE + 364)
#define __NR_futex (__NR_SYSCALL_BASE + 240)
#define __NR_poll (__NR_SYSCALL_BASE + 168)
@@ -165,6 +166,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 333)
#define __NR_renameat (__NR_SYSCALL_BASE + 329)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 328)
#define __NR_faccessat (__NR_SYSCALL_BASE + 334)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 266)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 263)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 262)
@@ -212,6 +214,7 @@
#define __NR_waitid (__NR_SYSCALL_BASE + 284)
#define __NR_kill (__NR_SYSCALL_BASE + 37)
#define __NR_tkill (__NR_SYSCALL_BASE + 238)
#define __NR_tgkill (__NR_SYSCALL_BASE + 270)
#define __NR_set_thread_area (__NR_SYSCALL_BASE + 243)
#define __NR_openat (__NR_SYSCALL_BASE + 295)
#define __NR_madvise (__NR_SYSCALL_BASE + 219)
@@ -225,6 +228,7 @@
#define __NR_fchmodat (__NR_SYSCALL_BASE + 306)
#define __NR_renameat (__NR_SYSCALL_BASE + 302)
#define __NR_unlinkat (__NR_SYSCALL_BASE + 301)
#define __NR_faccessat (__NR_SYSCALL_BASE + 307)
#define __NR_statfs64 (__NR_SYSCALL_BASE + 268)
#define __NR_clock_gettime (__NR_SYSCALL_BASE + 265)
#define __NR_clock_settime (__NR_SYSCALL_BASE + 264)

View File

@@ -1,230 +0,0 @@
/* auto-generated by gensyscalls.py, do not touch */
#ifndef _BIONIC_LINUX_UNISTD_H_
#ifdef __cplusplus
extern "C" {
#endif
void _exit (int);
void _exit_thread (int);
pid_t __fork (void);
pid_t _waitpid (pid_t, int*, int, struct rusage*);
int __waitid (int, pid_t, struct siginfo_t*, int,void*);
pid_t __sys_clone (int, void*, int*, void*, int*);
int execve (const char*, char* const*, char* const*);
int __setuid (uid_t);
uid_t getuid (void);
gid_t getgid (void);
uid_t geteuid (void);
gid_t getegid (void);
uid_t getresuid (uid_t *ruid, uid_t *euid, uid_t *suid);
gid_t getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid);
pid_t gettid (void);
ssize_t readahead (int, off64_t, size_t);
int getgroups (int, gid_t *);
pid_t getpgid (pid_t);
pid_t getppid (void);
pid_t setsid (void);
int setgid (gid_t);
int seteuid (uid_t);
int __setreuid (uid_t, uid_t);
int __setresuid (uid_t, uid_t, uid_t);
int setresgid (gid_t, gid_t, gid_t);
void* __brk (void*);
int kill (pid_t, int);
int tkill (pid_t tid, int sig);
int __ptrace (int request, int pid, void* addr, void* data);
int __set_thread_area (void* user_desc);
int __getpriority (int, int);
int setpriority (int, int, int);
int setrlimit (int resource, const struct rlimit *rlp);
int getrlimit (int resource, struct rlimit *rlp);
int getrusage (int who, struct rusage* r_usage);
int setgroups (int, const gid_t *);
pid_t getpgrp (void);
int setpgid (pid_t, pid_t);
pid_t vfork (void);
int setregid (gid_t, gid_t);
int chroot (const char *);
int prctl (int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5);
int capget (cap_user_header_t header, cap_user_data_t data);
int capset (cap_user_header_t header, const cap_user_data_t data);
int sigaltstack (const stack_t*, stack_t*);
int acct (const char* filepath);
ssize_t read (int, void*, size_t);
ssize_t write (int, const void*, size_t);
ssize_t pread64 (int, void *, size_t, off64_t);
ssize_t pwrite64 (int, void *, size_t, off64_t);
int __open (const char*, int, mode_t);
int __openat (int, const char*, int, mode_t);
int close (int);
int creat (const char*, mode_t);
off_t lseek (int, off_t, int);
int __llseek (int, unsigned long, unsigned long, loff_t*, int);
pid_t getpid (void);
void * mmap (void *, size_t, int, int, int, long);
void * __mmap2 (void*, size_t, int, int, int, long);
int munmap (void *, size_t);
void * mremap (void *, size_t, size_t, unsigned long);
int msync (const void *, size_t, int);
int mprotect (const void *, size_t, int);
int madvise (const void *, size_t, int);
int mlock (const void *addr, size_t len);
int munlock (const void *addr, size_t len);
int mincore (void* start, size_t length, unsigned char* vec);
int __ioctl (int, int, void *);
int readv (int, const struct iovec *, int);
int writev (int, const struct iovec *, int);
int __fcntl (int, int, void*);
int flock (int, int);
int fchmod (int, mode_t);
int dup (int);
int pipe (int *);
int pipe2 (int *, int);
int dup2 (int, int);
int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
int ftruncate (int, off_t);
int ftruncate64 (int, off64_t);
int getdents (unsigned int, struct dirent *, unsigned int);
int fsync (int);
int fdatasync (int);
int fchown (int, uid_t, gid_t);
void sync (void);
int __fcntl64 (int, int, void *);
int __fstatfs64 (int, size_t, struct statfs *);
ssize_t sendfile (int out_fd, int in_fd, off_t *offset, size_t count);
int fstatat (int dirfd, const char *path, struct stat *buf, int flags);
int mkdirat (int dirfd, const char *pathname, mode_t mode);
int fchownat (int dirfd, const char *path, uid_t owner, gid_t group, int flags);
int fchmodat (int dirfd, const char *path, mode_t mode, int flags);
int renameat (int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
int fsetxattr (int, const char *, const void *, size_t, int);
ssize_t fgetxattr (int, const char *, void *, size_t);
ssize_t flistxattr (int, char *, size_t);
int fremovexattr (int, const char *);
int link (const char*, const char*);
int unlink (const char*);
int unlinkat (int, const char *, int);
int chdir (const char*);
int mknod (const char*, mode_t, dev_t);
int chmod (const char*,mode_t);
int chown (const char *, uid_t, gid_t);
int lchown (const char*, uid_t, gid_t);
int mount (const char*, const char*, const char*, unsigned long, const void*);
int umount (const char*);
int umount2 (const char*, int);
int fstat (int, struct stat*);
int stat (const char *, struct stat *);
int lstat (const char *, struct stat *);
int mkdir (const char *, mode_t);
int readlink (const char *, char *, size_t);
int rmdir (const char *);
int rename (const char *, const char *);
int __getcwd (char * buf, size_t size);
int access (const char *, int);
int symlink (const char *, const char *);
int fchdir (int);
int truncate (const char*, off_t);
int setxattr (const char *, const char *, const void *, size_t, int);
int lsetxattr (const char *, const char *, const void *, size_t, int);
ssize_t getxattr (const char *, const char *, void *, size_t);
ssize_t lgetxattr (const char *, const char *, void *, size_t);
ssize_t listxattr (const char *, char *, size_t);
ssize_t llistxattr (const char *, char *, size_t);
int removexattr (const char *, const char *);
int lremovexattr (const char *, const char *);
int __statfs64 (const char *, size_t, struct statfs *);
int pause (void);
int gettimeofday (struct timeval*, struct timezone*);
int settimeofday (const struct timeval*, const struct timezone*);
clock_t times (struct tms *);
int nanosleep (const struct timespec *, struct timespec *);
int clock_gettime (clockid_t clk_id, struct timespec *tp);
int clock_settime (clockid_t clk_id, const struct timespec *tp);
int clock_getres (clockid_t clk_id, struct timespec *res);
int clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem);
int getitimer (int, const struct itimerval *);
int setitimer (int, const struct itimerval *, struct itimerval *);
int __timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid);
int __timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*);
int __timer_gettime (timer_t, struct itimerspec*);
int __timer_getoverrun (timer_t);
int __timer_delete (timer_t);
int utimes (const char*, const struct timeval tvp[2]);
int utimensat (int, const char *, const struct timespec times[2], int);
int sigaction (int, const struct sigaction *, struct sigaction *);
int sigprocmask (int, const sigset_t *, sigset_t *);
int __sigsuspend (int unused1, int unused2, unsigned mask);
int __rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize);
int __rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize);
int __rt_sigtimedwait (const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size);
int sigpending (sigset_t *);
int socket (int, int, int);
int socketpair (int, int, int, int*);
int bind (int, struct sockaddr *, int);
int connect (int, struct sockaddr *, socklen_t);
int listen (int, int);
int accept (int, struct sockaddr *, socklen_t *);
int getsockname (int, struct sockaddr *, socklen_t *);
int getpeername (int, struct sockaddr *, socklen_t *);
int sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
int recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *);
int shutdown (int, int);
int setsockopt (int, int, int, const void *, socklen_t);
int getsockopt (int, int, int, void *, socklen_t *);
int sendmsg (int, const struct msghdr *, unsigned int);
int recvmsg (int, struct msghdr *, unsigned int);
int socket (int, int, int);
int bind (int, struct sockaddr *, int);
int connect (int, struct sockaddr *, socklen_t);
int listen (int, int);
int accept (int, struct sockaddr *, socklen_t *);
int getsockname (int, struct sockaddr *, socklen_t *);
int getpeername (int, struct sockaddr *, socklen_t *);
int socketpair (int, int, int, int*);
int sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
int recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *);
int shutdown (int, int);
int setsockopt (int, int, int, const void *, socklen_t);
int getsockopt (int, int, int, void *, socklen_t *);
int sendmsg (int, const struct msghdr *, unsigned int);
int recvmsg (int, struct msghdr *, unsigned int);
int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
int sched_getscheduler (pid_t pid);
int sched_yield (void);
int sched_setparam (pid_t pid, const struct sched_param *param);
int sched_getparam (pid_t pid, struct sched_param *param);
int sched_get_priority_max (int policy);
int sched_get_priority_min (int policy);
int sched_rr_get_interval (pid_t pid, struct timespec *interval);
int sched_setaffinity (pid_t pid, size_t setsize, const cpu_set_t* set);
int __sched_getaffinity (pid_t pid, size_t setsize, cpu_set_t* set);
int __getcpu (unsigned *cpu, unsigned *node, void *unused);
int ioprio_set (int which, int who, int ioprio);
int ioprio_get (int which, int who);
int uname (struct utsname *);
pid_t __wait4 (pid_t pid, int *status, int options, struct rusage *rusage);
mode_t umask (mode_t);
int __reboot (int, int, int, void *);
int __syslog (int, char *, int);
int init_module (void *, unsigned long, const char *);
int delete_module (const char*, unsigned int);
int klogctl (int, char *, int);
int sysinfo (struct sysinfo *);
int personality (unsigned long);
int futex (void *, int, int, void *, void *, int);
int epoll_create (int size);
int epoll_ctl (int epfd, int op, int fd, struct epoll_event *event);
int epoll_wait (int epfd, struct epoll_event *events, int max, int timeout);
int inotify_init (void);
int inotify_add_watch (int, const char *, unsigned int);
int inotify_rm_watch (int, unsigned int);
int poll (struct pollfd *, unsigned int, long);
int eventfd (unsigned int, int);
int __set_tls (void*);
int cacheflush (long start, long end, long flags);
#ifdef __cplusplus
}
#endif
#endif /* _BIONIC_LINUX_UNISTD_H_ */

View File

@@ -29,56 +29,10 @@
#ifndef _SYS_PERSONALITY_H_
#define _SYS_PERSONALITY_H_
#include <linux/personality.h>
__BEGIN_DECLS
/* constants taken from linux-3.0.4/include/linux/personality.h */
enum {
UNAME26 = 0x0020000,
ADDR_NO_RANDOMIZE = 0x0040000,
FDPIC_FUNCPTRS = 0x0080000,
MMAP_PAGE_ZERO = 0x0100000,
ADDR_COMPAT_LAYOUT = 0x0200000,
READ_IMPLIES_EXEC = 0x0400000,
ADDR_LIMIT_32BIT = 0x0800000,
SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000,
STICKY_TIMEOUTS = 0x4000000,
ADDR_LIMIT_3GB = 0x8000000,
};
#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \
ADDR_NO_RANDOMIZE | \
ADDR_COMPAT_LAYOUT | \
MMAP_PAGE_ZERO)
enum {
PER_LINUX = 0x0000,
PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS |
WHOLE_SECONDS | SHORT_INODE,
PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
PER_BSD = 0x0006,
PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
PER_LINUX32 = 0x0008,
PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,
PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,
PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,
PER_RISCOS = 0x000c,
PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
PER_OSF4 = 0x000f,
PER_HPUX = 0x0010,
PER_MASK = 0x00ff,
};
extern int personality (unsigned long persona);
__END_DECLS

View File

@@ -79,24 +79,6 @@ extern struct tm* gmtime_r(const time_t *timep, struct tm *result);
extern char* strptime(const char *buf, const char *fmt, struct tm *tm);
extern size_t strftime(char *s, size_t max, const char *format, const struct tm *tm);
/* ANDROID-BEGIN */
struct strftime_locale {
const char * mon[12];
const char * month[12];
const char * standalone_month[12];
const char * wday[7];
const char * weekday[7];
const char * X_fmt;
const char * x_fmt;
const char * c_fmt;
const char * am;
const char * pm;
const char * date_fmt;
};
extern size_t strftime_tz(char *s, size_t max, const char *format, const struct tm *tm, const struct strftime_locale* lc);
/* ANDROID-END */
extern char *ctime(const time_t *timep);
extern char *ctime_r(const time_t *timep, char *buf);

View File

@@ -107,6 +107,7 @@ extern void endusershell(void);
#define F_OK 0 /* Existence */
extern int access(const char *, int);
extern int faccessat(int, const char *, int, int);
extern int link(const char *, const char *);
extern int unlink(const char *);
extern int chdir(const char *);

View File

@@ -17,26 +17,27 @@ they can be also included before or after any Bionic C library header.
the generation process works as follows:
* 'bionic/kernel/original/'
* 'external/kernel-headers/original/'
contains a set of kernel headers as normally found in the 'include'
directory of a normal Linux kernel source tree. note that this should
only contain the files that are really needed by Android (use
'find_headers.py' to find these automatically).
* 'bionic/kernel/common'
* 'bionic/libc/kernel/common'
contains the non-arch-specific clean headers and directories
(e.g. linux, asm-generic and mtd)
*'bionic/kernel/arch-arm/'
* 'bionic/libc/kernel/arch-arm/'
contains the ARM-specific directory tree of clean headers.
* 'bionic/kernel/arch-arm/asm'
* 'bionic/libc/kernel/arch-arm/asm'
contains the real ARM-specific headers
* 'bionic/kernel/arch-x86'
* 'bionic/libc/kernel/arch-x86'
'bionic/libc/kernel/arch-x86/asm'
similarly contains all headers and symlinks to be used on x86
* 'bionic/kernel/tools' contains various Python and shell scripts used
* 'bionic/libc/kernel/tools' contains various Python and shell scripts used
to manage and re-generate the headers
the tools you can use are:
@@ -56,7 +57,7 @@ the tools you can use are:
* tools/update_all.py
automatically update all clean headers from the content of
'bionic/kernel/original'. this is the script you're likely going to
'external/kernel-headers/original'. this is the script you're likely going to
run whenever you update the original headers.
NOTE:

View File

@@ -7,36 +7,42 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ARM_A_OUT_H__
#define __ARM_A_OUT_H__
#include <linux/personality.h>
#include <asm/types.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct exec
{
__u32 a_info;
__u32 a_text;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 a_data;
__u32 a_bss;
__u32 a_syms;
__u32 a_entry;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 a_trsize;
__u32 a_drsize;
};
#define N_TXTADDR(a) (0x00008000)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define N_TRSIZE(a) ((a).a_trsize)
#define N_DRSIZE(a) ((a).a_drsize)
#define N_SYMSIZE(a) ((a).a_syms)
#define M_ARM 103
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef LIBRARY_START_TEXT
#define LIBRARY_START_TEXT (0x00c00000)
#endif
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,21 +7,25 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_PERSEUS2_H
#define __ASM_ARCH_OMAP_PERSEUS2_H
#include <asm/arch/fpga.h>
#ifndef OMAP_SDRAM_DEVICE
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_SDRAM_DEVICE D256M_1X16_4B
#endif
#define MAXIRQNUM IH_BOARD_BASE
#define MAXFIQNUM MAXIRQNUM
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MAXSWINUM MAXIRQNUM
#define NR_IRQS (MAXIRQNUM + 1)
#endif

View File

@@ -7,157 +7,159 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _OMAP_BOARD_H
#define _OMAP_BOARD_H
#include <linux/types.h>
#include <asm/arch/gpio-switch.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_TAG_CLOCK 0x4f01
#define OMAP_TAG_MMC 0x4f02
#define OMAP_TAG_SERIAL_CONSOLE 0x4f03
#define OMAP_TAG_USB 0x4f04
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_TAG_LCD 0x4f05
#define OMAP_TAG_GPIO_SWITCH 0x4f06
#define OMAP_TAG_UART 0x4f07
#define OMAP_TAG_FBMEM 0x4f08
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_TAG_STI_CONSOLE 0x4f09
#define OMAP_TAG_CAMERA_SENSOR 0x4f0a
#define OMAP_TAG_BT 0x4f0b
#define OMAP_TAG_BOOT_REASON 0x4f80
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_TAG_FLASH_PART 0x4f81
#define OMAP_TAG_VERSION_STR 0x4f82
struct omap_clock_config {
u8 system_clock_type;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_mmc_conf {
unsigned enabled:1;
unsigned nomux:1;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned cover:1;
unsigned wire4:1;
s16 power_pin;
s16 switch_pin;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
s16 wp_pin;
};
struct omap_mmc_config {
struct omap_mmc_conf mmc[2];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_serial_console_config {
u8 console_uart;
u32 console_speed;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_sti_console_config {
unsigned enable:1;
u8 channel;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_camera_sensor_config {
u16 reset_gpio;
int (*power_on)(void * data);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int (*power_off)(void * data);
};
struct omap_usb_config {
unsigned register_host:1;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned register_dev:1;
u8 otg;
u8 hmc_mode;
u8 rwc;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u8 pins[3];
};
struct omap_lcd_config {
char panel_name[16];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
char ctrl_name[16];
s16 nreset_gpio;
u8 data_lines;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct device;
struct fb_info;
struct omap_backlight_config {
int default_intensity;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int (*set_power)(struct device *dev, int state);
int (*check_fb)(struct fb_info *fb);
};
struct omap_fbmem_config {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u32 start;
u32 size;
};
struct omap_pwm_led_platform_data {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const char *name;
int intensity_timer;
int blink_timer;
void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_gpio_switch_config {
char name[12];
u16 gpio;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int flags:4;
int type:4;
int key_code:24;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct omap_uart_config {
unsigned int enabled_uarts;
};
struct omap_flash_part_config {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
char part_table[0];
};
struct omap_boot_reason_config {
char reason_str[12];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_version_config {
char component[12];
char version[12];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct omap_board_config_entry {
u16 tag;
u16 len;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u8 data[0];
};
struct omap_board_config_kernel {
u16 tag;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const void *data;
};
struct omap_bluetooth_config {
u8 chip_type;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u8 bt_uart;
u8 bd_addr[6];
u8 bt_sysclk;
int bt_wakeup_gpio;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int host_wakeup_gpio;
int reset_gpio;
};
#define omap_get_config(tag, type) ((const type *) __omap_get_config((tag), sizeof(type), 0))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define omap_get_nr_config(tag, type, nr) ((const type *) __omap_get_config((tag), sizeof(type), (nr)))
#endif

View File

@@ -7,51 +7,60 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_CPU_H
#define __ASM_ARCH_OMAP_CPU_H
#define omap2_cpu_rev() ((system_rev >> 8) & 0x0f)
#undef MULTI_OMAP1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#undef MULTI_OMAP2
#undef OMAP_NAME
#define GET_OMAP_CLASS (system_rev & 0xff)
#define IS_OMAP_CLASS(class, id) static inline int is_omap ##class (void) { return (GET_OMAP_CLASS == (id)) ? 1 : 0; }
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define GET_OMAP_SUBCLASS ((system_rev >> 20) & 0x0fff)
#define IS_OMAP_SUBCLASS(subclass, id) static inline int is_omap ##subclass (void) { return (GET_OMAP_SUBCLASS == (id)) ? 1 : 0; }
#define cpu_is_omap7xx() 0
#define cpu_is_omap15xx() 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_is_omap16xx() 0
#define cpu_is_omap24xx() 0
#define cpu_is_omap242x() 0
#define cpu_is_omap243x() 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifdef MULTI_OMAP1
#else
#endif
#define GET_OMAP_TYPE ((system_rev >> 16) & 0xffff)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IS_OMAP_TYPE(type, id) static inline int is_omap ##type (void) { return (GET_OMAP_TYPE == (id)) ? 1 : 0; }
#define cpu_is_omap310() 0
#define cpu_is_omap730() 0
#define cpu_is_omap1510() 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_is_omap1610() 0
#define cpu_is_omap5912() 0
#define cpu_is_omap1611() 0
#define cpu_is_omap1621() 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_is_omap1710() 0
#define cpu_is_omap2420() 0
#define cpu_is_omap2422() 0
#define cpu_is_omap2423() 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_is_omap2430() 0
#ifdef MULTI_OMAP1
#else
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_class_is_omap1() (cpu_is_omap730() || cpu_is_omap15xx() || cpu_is_omap16xx())
#define cpu_class_is_omap2() cpu_is_omap24xx()
#endif

View File

@@ -7,312 +7,362 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_DMA_H
#define __ASM_ARCH_DMA_H
#define OMAP_DMA_BASE (0xfffed800)
#define OMAP_DMA_GCR (OMAP_DMA_BASE + 0x400)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_GSCR (OMAP_DMA_BASE + 0x404)
#define OMAP_DMA_GRST (OMAP_DMA_BASE + 0x408)
#define OMAP_DMA_HW_ID (OMAP_DMA_BASE + 0x442)
#define OMAP_DMA_PCH2_ID (OMAP_DMA_BASE + 0x444)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_PCH0_ID (OMAP_DMA_BASE + 0x446)
#define OMAP_DMA_PCH1_ID (OMAP_DMA_BASE + 0x448)
#define OMAP_DMA_PCHG_ID (OMAP_DMA_BASE + 0x44a)
#define OMAP_DMA_PCHD_ID (OMAP_DMA_BASE + 0x44c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CAPS_0_U (OMAP_DMA_BASE + 0x44e)
#define OMAP_DMA_CAPS_0_L (OMAP_DMA_BASE + 0x450)
#define OMAP_DMA_CAPS_1_U (OMAP_DMA_BASE + 0x452)
#define OMAP_DMA_CAPS_1_L (OMAP_DMA_BASE + 0x454)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CAPS_2 (OMAP_DMA_BASE + 0x456)
#define OMAP_DMA_CAPS_3 (OMAP_DMA_BASE + 0x458)
#define OMAP_DMA_CAPS_4 (OMAP_DMA_BASE + 0x45a)
#define OMAP_DMA_PCH2_SR (OMAP_DMA_BASE + 0x460)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_PCH0_SR (OMAP_DMA_BASE + 0x480)
#define OMAP_DMA_PCH1_SR (OMAP_DMA_BASE + 0x482)
#define OMAP_DMA_PCHD_SR (OMAP_DMA_BASE + 0x4c0)
#define OMAP24XX_DMA_BASE (L4_24XX_BASE + 0x56000)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA4_REVISION (OMAP24XX_DMA_BASE + 0x00)
#define OMAP_DMA4_GCR_REG (OMAP24XX_DMA_BASE + 0x78)
#define OMAP_DMA4_IRQSTATUS_L0 (OMAP24XX_DMA_BASE + 0x08)
#define OMAP_DMA4_IRQSTATUS_L1 (OMAP24XX_DMA_BASE + 0x0c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA4_IRQSTATUS_L2 (OMAP24XX_DMA_BASE + 0x10)
#define OMAP_DMA4_IRQSTATUS_L3 (OMAP24XX_DMA_BASE + 0x14)
#define OMAP_DMA4_IRQENABLE_L0 (OMAP24XX_DMA_BASE + 0x18)
#define OMAP_DMA4_IRQENABLE_L1 (OMAP24XX_DMA_BASE + 0x1c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA4_IRQENABLE_L2 (OMAP24XX_DMA_BASE + 0x20)
#define OMAP_DMA4_IRQENABLE_L3 (OMAP24XX_DMA_BASE + 0x24)
#define OMAP_DMA4_SYSSTATUS (OMAP24XX_DMA_BASE + 0x28)
#define OMAP_DMA4_CAPS_0 (OMAP24XX_DMA_BASE + 0x64)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA4_CAPS_2 (OMAP24XX_DMA_BASE + 0x6c)
#define OMAP_DMA4_CAPS_3 (OMAP24XX_DMA_BASE + 0x70)
#define OMAP_DMA4_CAPS_4 (OMAP24XX_DMA_BASE + 0x74)
#define OMAP_LOGICAL_DMA_CH_COUNT 32
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CCR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x80)
#define OMAP_DMA_CLNK_CTRL_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x84)
#define OMAP_DMA_CICR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x88)
#define OMAP_DMA_CSR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x8c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CSDP_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x90)
#define OMAP_DMA_CEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x94)
#define OMAP_DMA_CFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x98)
#define OMAP_DMA_CSEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CSFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa8)
#define OMAP_DMA_CDEI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xac)
#define OMAP_DMA_CDFI_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb0)
#define OMAP_DMA_CSAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CDAC_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xb8)
#define OMAP1_DMA_CSSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x08)
#define OMAP1_DMA_CSSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0a)
#define OMAP1_DMA_CDSA_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1_DMA_CDSA_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x0e)
#define OMAP1_DMA_COLOR_L_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x20)
#define OMAP1_DMA_CCR2_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x24)
#define OMAP1_DMA_COLOR_U_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x22)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1_DMA_LCH_CTRL_REG(n) __REG16(OMAP_DMA_BASE + 0x40 * (n) + 0x2a)
#define OMAP2_DMA_CSSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0x9c)
#define OMAP2_DMA_CDSA_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xa0)
#define OMAP2_DMA_CCEN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xbc)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP2_DMA_CCFN_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc0)
#define OMAP2_DMA_COLOR_REG(n) __REG32(OMAP24XX_DMA_BASE + 0x60 * (n) + 0xc4)
#define OMAP_DMA_NO_DEVICE 0
#define OMAP_DMA_MCSI1_TX 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_MCSI1_RX 2
#define OMAP_DMA_I2C_RX 3
#define OMAP_DMA_I2C_TX 4
#define OMAP_DMA_EXT_NDMA_REQ 5
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_EXT_NDMA_REQ2 6
#define OMAP_DMA_UWIRE_TX 7
#define OMAP_DMA_MCBSP1_TX 8
#define OMAP_DMA_MCBSP1_RX 9
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_MCBSP3_TX 10
#define OMAP_DMA_MCBSP3_RX 11
#define OMAP_DMA_UART1_TX 12
#define OMAP_DMA_UART1_RX 13
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_UART2_TX 14
#define OMAP_DMA_UART2_RX 15
#define OMAP_DMA_MCBSP2_TX 16
#define OMAP_DMA_MCBSP2_RX 17
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_UART3_TX 18
#define OMAP_DMA_UART3_RX 19
#define OMAP_DMA_CAMERA_IF_RX 20
#define OMAP_DMA_MMC_TX 21
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_MMC_RX 22
#define OMAP_DMA_NAND 23
#define OMAP_DMA_IRQ_LCD_LINE 24
#define OMAP_DMA_MEMORY_STICK 25
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_USB_W2FC_RX0 26
#define OMAP_DMA_USB_W2FC_RX1 27
#define OMAP_DMA_USB_W2FC_RX2 28
#define OMAP_DMA_USB_W2FC_TX0 29
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_USB_W2FC_TX1 30
#define OMAP_DMA_USB_W2FC_TX2 31
#define OMAP_DMA_CRYPTO_DES_IN 32
#define OMAP_DMA_SPI_TX 33
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_SPI_RX 34
#define OMAP_DMA_CRYPTO_HASH 35
#define OMAP_DMA_CCP_ATTN 36
#define OMAP_DMA_CCP_FIFO_NOT_EMPTY 37
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CMT_APE_TX_CHAN_0 38
#define OMAP_DMA_CMT_APE_RV_CHAN_0 39
#define OMAP_DMA_CMT_APE_TX_CHAN_1 40
#define OMAP_DMA_CMT_APE_RV_CHAN_1 41
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CMT_APE_TX_CHAN_2 42
#define OMAP_DMA_CMT_APE_RV_CHAN_2 43
#define OMAP_DMA_CMT_APE_TX_CHAN_3 44
#define OMAP_DMA_CMT_APE_RV_CHAN_3 45
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CMT_APE_TX_CHAN_4 46
#define OMAP_DMA_CMT_APE_RV_CHAN_4 47
#define OMAP_DMA_CMT_APE_TX_CHAN_5 48
#define OMAP_DMA_CMT_APE_RV_CHAN_5 49
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_CMT_APE_TX_CHAN_6 50
#define OMAP_DMA_CMT_APE_RV_CHAN_6 51
#define OMAP_DMA_CMT_APE_TX_CHAN_7 52
#define OMAP_DMA_CMT_APE_RV_CHAN_7 53
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_MMC2_TX 54
#define OMAP_DMA_MMC2_RX 55
#define OMAP_DMA_CRYPTO_DES_OUT 56
#define OMAP24XX_DMA_NO_DEVICE 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_XTI_DMA 1
#define OMAP24XX_DMA_EXT_DMAREQ0 2
#define OMAP24XX_DMA_EXT_DMAREQ1 3
#define OMAP24XX_DMA_GPMC 4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_GFX 5
#define OMAP24XX_DMA_DSS 6
#define OMAP24XX_DMA_VLYNQ_TX 7
#define OMAP24XX_DMA_CWT 8
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_AES_TX 9
#define OMAP24XX_DMA_AES_RX 10
#define OMAP24XX_DMA_DES_TX 11
#define OMAP24XX_DMA_DES_RX 12
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_SHA1MD5_RX 13
#define OMAP24XX_DMA_EXT_DMAREQ2 14
#define OMAP24XX_DMA_EXT_DMAREQ3 15
#define OMAP24XX_DMA_EXT_DMAREQ4 16
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_EAC_AC_RD 17
#define OMAP24XX_DMA_EAC_AC_WR 18
#define OMAP24XX_DMA_EAC_MD_UL_RD 19
#define OMAP24XX_DMA_EAC_MD_UL_WR 20
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_EAC_MD_DL_RD 21
#define OMAP24XX_DMA_EAC_MD_DL_WR 22
#define OMAP24XX_DMA_EAC_BT_UL_RD 23
#define OMAP24XX_DMA_EAC_BT_UL_WR 24
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_EAC_BT_DL_RD 25
#define OMAP24XX_DMA_EAC_BT_DL_WR 26
#define OMAP24XX_DMA_I2C1_TX 27
#define OMAP24XX_DMA_I2C1_RX 28
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_I2C2_TX 29
#define OMAP24XX_DMA_I2C2_RX 30
#define OMAP24XX_DMA_MCBSP1_TX 31
#define OMAP24XX_DMA_MCBSP1_RX 32
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_MCBSP2_TX 33
#define OMAP24XX_DMA_MCBSP2_RX 34
#define OMAP24XX_DMA_SPI1_TX0 35
#define OMAP24XX_DMA_SPI1_RX0 36
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_SPI1_TX1 37
#define OMAP24XX_DMA_SPI1_RX1 38
#define OMAP24XX_DMA_SPI1_TX2 39
#define OMAP24XX_DMA_SPI1_RX2 40
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_SPI1_TX3 41
#define OMAP24XX_DMA_SPI1_RX3 42
#define OMAP24XX_DMA_SPI2_TX0 43
#define OMAP24XX_DMA_SPI2_RX0 44
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_SPI2_TX1 45
#define OMAP24XX_DMA_SPI2_RX1 46
#define OMAP24XX_DMA_UART1_TX 49
#define OMAP24XX_DMA_UART1_RX 50
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_UART2_TX 51
#define OMAP24XX_DMA_UART2_RX 52
#define OMAP24XX_DMA_UART3_TX 53
#define OMAP24XX_DMA_UART3_RX 54
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_USB_W2FC_TX0 55
#define OMAP24XX_DMA_USB_W2FC_RX0 56
#define OMAP24XX_DMA_USB_W2FC_TX1 57
#define OMAP24XX_DMA_USB_W2FC_RX1 58
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_USB_W2FC_TX2 59
#define OMAP24XX_DMA_USB_W2FC_RX2 60
#define OMAP24XX_DMA_MMC1_TX 61
#define OMAP24XX_DMA_MMC1_RX 62
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_DMA_MS 63
#define OMAP24XX_DMA_EXT_DMAREQ5 64
#define OMAP1510_DMA_LCD_BASE (0xfffedb00)
#define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02)
#define OMAP1510_DMA_LCD_TOP_F1_U (OMAP1510_DMA_LCD_BASE + 0x04)
#define OMAP1510_DMA_LCD_BOT_F1_L (OMAP1510_DMA_LCD_BASE + 0x06)
#define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_DMA_LCD_BASE (0xfffee300)
#define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0)
#define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2)
#define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8)
#define OMAP1610_DMA_LCD_TOP_B1_U (OMAP1610_DMA_LCD_BASE + 0xca)
#define OMAP1610_DMA_LCD_BOT_B1_L (OMAP1610_DMA_LCD_BASE + 0xcc)
#define OMAP1610_DMA_LCD_BOT_B1_U (OMAP1610_DMA_LCD_BASE + 0xce)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_DMA_LCD_TOP_B2_L (OMAP1610_DMA_LCD_BASE + 0xd0)
#define OMAP1610_DMA_LCD_TOP_B2_U (OMAP1610_DMA_LCD_BASE + 0xd2)
#define OMAP1610_DMA_LCD_BOT_B2_L (OMAP1610_DMA_LCD_BASE + 0xd4)
#define OMAP1610_DMA_LCD_BOT_B2_U (OMAP1610_DMA_LCD_BASE + 0xd6)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_DMA_LCD_SRC_EI_B1 (OMAP1610_DMA_LCD_BASE + 0xd8)
#define OMAP1610_DMA_LCD_SRC_FI_B1_L (OMAP1610_DMA_LCD_BASE + 0xda)
#define OMAP1610_DMA_LCD_SRC_EN_B1 (OMAP1610_DMA_LCD_BASE + 0xe0)
#define OMAP1610_DMA_LCD_SRC_FN_B1 (OMAP1610_DMA_LCD_BASE + 0xe4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
#define OMAP1_DMA_TOUT_IRQ (1 << 0)
#define OMAP_DMA_DROP_IRQ (1 << 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_HALF_IRQ (1 << 2)
#define OMAP_DMA_FRAME_IRQ (1 << 3)
#define OMAP_DMA_LAST_IRQ (1 << 4)
#define OMAP_DMA_BLOCK_IRQ (1 << 5)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1_DMA_SYNC_IRQ (1 << 6)
#define OMAP2_DMA_PKT_IRQ (1 << 7)
#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8)
#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
#define OMAP_DMA_DATA_TYPE_S8 0x00
#define OMAP_DMA_DATA_TYPE_S16 0x01
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_DATA_TYPE_S32 0x02
#define OMAP_DMA_SYNC_ELEMENT 0x00
#define OMAP_DMA_SYNC_FRAME 0x01
#define OMAP_DMA_SYNC_BLOCK 0x02
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_PORT_EMIFF 0x00
#define OMAP_DMA_PORT_EMIFS 0x01
#define OMAP_DMA_PORT_OCP_T1 0x02
#define OMAP_DMA_PORT_TIPB 0x03
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_PORT_OCP_T2 0x04
#define OMAP_DMA_PORT_MPUI 0x05
#define OMAP_DMA_AMODE_CONSTANT 0x00
#define OMAP_DMA_AMODE_POST_INC 0x01
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_DMA_AMODE_SINGLE_IDX 0x02
#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03
enum {
OMAP_LCD_DMA_B1_TOP,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_LCD_DMA_B1_BOTTOM,
OMAP_LCD_DMA_B2_TOP,
OMAP_LCD_DMA_B2_BOTTOM
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
enum omap_dma_burst_mode {
OMAP_DMA_DATA_BURST_DIS = 0,
OMAP_DMA_DATA_BURST_4,
OMAP_DMA_DATA_BURST_8,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_DMA_DATA_BURST_16,
};
enum omap_dma_color_mode {
OMAP_DMA_COLOR_DIS = 0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_DMA_CONSTANT_FILL,
OMAP_DMA_TRANSPARENT_COPY
};
enum omap_dma_write_mode {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_DMA_WRITE_NON_POSTED = 0,
OMAP_DMA_WRITE_POSTED,
OMAP_DMA_WRITE_LAST_NON_POSTED
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct omap_dma_channel_params {
int data_type;
int elem_count;
int frame_count;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int src_port;
int src_amode;
unsigned long src_start;
int src_ei;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int src_fi;
int dst_port;
int dst_amode;
unsigned long dst_start;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int dst_ei;
int dst_fi;
int trigger;
int sync_mode;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int src_or_dst_synch;
int ie;
};
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,154 +7,162 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_FPGA_H
#define __ASM_ARCH_OMAP_FPGA_H
#define omap1510_fpga_init_irq() (0)
#define fpga_read(reg) __raw_readb(reg)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define fpga_write(val, reg) __raw_writeb(val, reg)
#define H2P2_DBG_FPGA_BASE 0xE8000000
#define H2P2_DBG_FPGA_SIZE SZ_4K
#define H2P2_DBG_FPGA_START 0x04000000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define H2P2_DBG_FPGA_ETHR_START (H2P2_DBG_FPGA_START + 0x300)
#define H2P2_DBG_FPGA_FPGA_REV (H2P2_DBG_FPGA_BASE + 0x10)
#define H2P2_DBG_FPGA_BOARD_REV (H2P2_DBG_FPGA_BASE + 0x12)
#define H2P2_DBG_FPGA_GPIO (H2P2_DBG_FPGA_BASE + 0x14)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define H2P2_DBG_FPGA_LEDS (H2P2_DBG_FPGA_BASE + 0x16)
#define H2P2_DBG_FPGA_MISC_INPUTS (H2P2_DBG_FPGA_BASE + 0x18)
#define H2P2_DBG_FPGA_LAN_STATUS (H2P2_DBG_FPGA_BASE + 0x1A)
#define H2P2_DBG_FPGA_LAN_RESET (H2P2_DBG_FPGA_BASE + 0x1C)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct h2p2_dbg_fpga {
u16 smc91x[8];
u16 fpga_rev;
u16 board_rev;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 gpio_outputs;
u16 leds;
u16 misc_inputs;
u16 lan_status;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 lan_reset;
u16 reserved0;
u16 ps2_data;
u16 ps2_ctrl;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#define H2P2_DBG_FPGA_LED_GREEN (1 << 15)
#define H2P2_DBG_FPGA_LED_AMBER (1 << 14)
#define H2P2_DBG_FPGA_LED_RED (1 << 13)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define H2P2_DBG_FPGA_LED_BLUE (1 << 12)
#define H2P2_DBG_FPGA_LOAD_METER (1 << 0)
#define H2P2_DBG_FPGA_LOAD_METER_SIZE 11
#define H2P2_DBG_FPGA_LOAD_METER_MASK ((1 << H2P2_DBG_FPGA_LOAD_METER_SIZE) - 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define H2P2_DBG_FPGA_P2_LED_TIMER (1 << 0)
#define H2P2_DBG_FPGA_P2_LED_IDLE (1 << 1)
#define OMAP1510_FPGA_BASE 0xE8000000
#define OMAP1510_FPGA_SIZE SZ_4K
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_START 0x08000000
#define OMAP1510_FPGA_REV_LOW (OMAP1510_FPGA_BASE + 0x0)
#define OMAP1510_FPGA_REV_HIGH (OMAP1510_FPGA_BASE + 0x1)
#define OMAP1510_FPGA_LCD_PANEL_CONTROL (OMAP1510_FPGA_BASE + 0x2)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_LED_DIGIT (OMAP1510_FPGA_BASE + 0x3)
#define INNOVATOR_FPGA_HID_SPI (OMAP1510_FPGA_BASE + 0x4)
#define OMAP1510_FPGA_POWER (OMAP1510_FPGA_BASE + 0x5)
#define OMAP1510_FPGA_ISR_LO (OMAP1510_FPGA_BASE + 0x6)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_ISR_HI (OMAP1510_FPGA_BASE + 0x7)
#define OMAP1510_FPGA_IMR_LO (OMAP1510_FPGA_BASE + 0x8)
#define OMAP1510_FPGA_IMR_HI (OMAP1510_FPGA_BASE + 0x9)
#define OMAP1510_FPGA_HOST_RESET (OMAP1510_FPGA_BASE + 0xa)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_RST (OMAP1510_FPGA_BASE + 0xb)
#define OMAP1510_FPGA_AUDIO (OMAP1510_FPGA_BASE + 0xc)
#define OMAP1510_FPGA_DIP (OMAP1510_FPGA_BASE + 0xe)
#define OMAP1510_FPGA_FPGA_IO (OMAP1510_FPGA_BASE + 0xf)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_UART1 (OMAP1510_FPGA_BASE + 0x14)
#define OMAP1510_FPGA_UART2 (OMAP1510_FPGA_BASE + 0x15)
#define OMAP1510_FPGA_OMAP1510_STATUS (OMAP1510_FPGA_BASE + 0x16)
#define OMAP1510_FPGA_BOARD_REV (OMAP1510_FPGA_BASE + 0x18)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510P1_PPT_DATA (OMAP1510_FPGA_BASE + 0x100)
#define OMAP1510P1_PPT_STATUS (OMAP1510_FPGA_BASE + 0x101)
#define OMAP1510P1_PPT_CONTROL (OMAP1510_FPGA_BASE + 0x102)
#define OMAP1510_FPGA_TOUCHSCREEN (OMAP1510_FPGA_BASE + 0x204)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INNOVATOR_FPGA_INFO (OMAP1510_FPGA_BASE + 0x205)
#define INNOVATOR_FPGA_LCD_BRIGHT_LO (OMAP1510_FPGA_BASE + 0x206)
#define INNOVATOR_FPGA_LCD_BRIGHT_HI (OMAP1510_FPGA_BASE + 0x207)
#define INNOVATOR_FPGA_LED_GRN_LO (OMAP1510_FPGA_BASE + 0x208)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INNOVATOR_FPGA_LED_GRN_HI (OMAP1510_FPGA_BASE + 0x209)
#define INNOVATOR_FPGA_LED_RED_LO (OMAP1510_FPGA_BASE + 0x20a)
#define INNOVATOR_FPGA_LED_RED_HI (OMAP1510_FPGA_BASE + 0x20b)
#define INNOVATOR_FPGA_CAM_USB_CONTROL (OMAP1510_FPGA_BASE + 0x20c)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INNOVATOR_FPGA_EXP_CONTROL (OMAP1510_FPGA_BASE + 0x20d)
#define INNOVATOR_FPGA_ISR2 (OMAP1510_FPGA_BASE + 0x20e)
#define INNOVATOR_FPGA_IMR2 (OMAP1510_FPGA_BASE + 0x210)
#define OMAP1510_FPGA_ETHR_START (OMAP1510_FPGA_START + 0x300)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_RESET_VALUE 0x42
#define OMAP1510_FPGA_PCR_IF_PD0 (1 << 7)
#define OMAP1510_FPGA_PCR_COM2_EN (1 << 6)
#define OMAP1510_FPGA_PCR_COM1_EN (1 << 5)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_PCR_EXP_PD0 (1 << 4)
#define OMAP1510_FPGA_PCR_EXP_PD1 (1 << 3)
#define OMAP1510_FPGA_PCR_48MHZ_CLK (1 << 2)
#define OMAP1510_FPGA_PCR_4MHZ_CLK (1 << 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_PCR_RSRVD_BIT0 (1 << 0)
#define OMAP1510_FPGA_HID_SCLK (1<<0)
#define OMAP1510_FPGA_HID_MOSI (1<<1)
#define OMAP1510_FPGA_HID_nSS (1<<2)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_HID_nHSUS (1<<3)
#define OMAP1510_FPGA_HID_MISO (1<<4)
#define OMAP1510_FPGA_HID_ATN (1<<5)
#define OMAP1510_FPGA_HID_rsrvd (1<<6)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_FPGA_HID_RESETn (1<<7)
#define OMAP1510_INT_FPGA (IH_GPIO_BASE + 13)
#define OMAP1510_IH_FPGA_BASE IH_BOARD_BASE
#define OMAP1510_INT_FPGA_ATN (OMAP1510_IH_FPGA_BASE + 0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_FPGA_ACK (OMAP1510_IH_FPGA_BASE + 1)
#define OMAP1510_INT_FPGA2 (OMAP1510_IH_FPGA_BASE + 2)
#define OMAP1510_INT_FPGA3 (OMAP1510_IH_FPGA_BASE + 3)
#define OMAP1510_INT_FPGA4 (OMAP1510_IH_FPGA_BASE + 4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_FPGA5 (OMAP1510_IH_FPGA_BASE + 5)
#define OMAP1510_INT_FPGA6 (OMAP1510_IH_FPGA_BASE + 6)
#define OMAP1510_INT_FPGA7 (OMAP1510_IH_FPGA_BASE + 7)
#define OMAP1510_INT_FPGA8 (OMAP1510_IH_FPGA_BASE + 8)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_FPGA9 (OMAP1510_IH_FPGA_BASE + 9)
#define OMAP1510_INT_FPGA10 (OMAP1510_IH_FPGA_BASE + 10)
#define OMAP1510_INT_FPGA11 (OMAP1510_IH_FPGA_BASE + 11)
#define OMAP1510_INT_FPGA12 (OMAP1510_IH_FPGA_BASE + 12)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_ETHER (OMAP1510_IH_FPGA_BASE + 13)
#define OMAP1510_INT_FPGAUART1 (OMAP1510_IH_FPGA_BASE + 14)
#define OMAP1510_INT_FPGAUART2 (OMAP1510_IH_FPGA_BASE + 15)
#define OMAP1510_INT_FPGA_TS (OMAP1510_IH_FPGA_BASE + 16)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_FPGA17 (OMAP1510_IH_FPGA_BASE + 17)
#define OMAP1510_INT_FPGA_CAM (OMAP1510_IH_FPGA_BASE + 18)
#define OMAP1510_INT_FPGA_RTC_A (OMAP1510_IH_FPGA_BASE + 19)
#define OMAP1510_INT_FPGA_RTC_B (OMAP1510_IH_FPGA_BASE + 20)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1510_INT_FPGA_CD (OMAP1510_IH_FPGA_BASE + 21)
#define OMAP1510_INT_FPGA22 (OMAP1510_IH_FPGA_BASE + 22)
#define OMAP1510_INT_FPGA23 (OMAP1510_IH_FPGA_BASE + 23)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,31 +7,35 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
#define __ASM_ARCH_OMAP_GPIO_SWITCH_H
#include <linux/types.h>
#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct omap_gpio_switch {
const char *name;
s16 gpio;
unsigned flags:4;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned type:4;
u16 debounce_rising;
u16 debounce_falling;
void (* notify)(void *data, int state);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
void *notify_data;
};
#endif

View File

@@ -7,43 +7,49 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_GPIO_H
#define __ASM_ARCH_OMAP_GPIO_H
#include <asm/hardware.h>
#include <asm/arch/irqs.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/io.h>
#define OMAP_MPUIO_BASE (void __iomem *)0xfffb5000
#define OMAP_MPUIO_INPUT_LATCH 0x00
#define OMAP_MPUIO_OUTPUT 0x04
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_MPUIO_IO_CNTL 0x08
#define OMAP_MPUIO_KBR_LATCH 0x10
#define OMAP_MPUIO_KBC 0x14
#define OMAP_MPUIO_GPIO_EVENT_MODE 0x18
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_MPUIO_GPIO_INT_EDGE 0x1c
#define OMAP_MPUIO_KBD_INT 0x20
#define OMAP_MPUIO_GPIO_INT 0x24
#define OMAP_MPUIO_KBD_MASKIT 0x28
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_MPUIO_GPIO_MASKIT 0x2c
#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30
#define OMAP_MPUIO_LATCH 0x34
#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
#define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? IH_MPUIO_BASE + ((nr) & 0x0f) : IH_GPIO_BASE + (nr))
struct omap_machine_gpio_bank {
int start;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
int end;
void (*set_gpio_direction)(int gpio, int is_input);
void (*set_gpio_dataout)(int gpio, int enable);
int (*get_gpio_datain)(int gpio);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
#endif

View File

@@ -7,151 +7,169 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_HARDWARE_H
#define __ASM_ARCH_OMAP_HARDWARE_H
#include <asm/sizes.h>
#ifndef __ASSEMBLER__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/types.h>
#include <asm/arch/cpu.h>
#endif
#include <asm/arch/io.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/arch/serial.h>
#define OMAP_MPU_TIMER1_BASE (0xfffec500)
#define OMAP_MPU_TIMER2_BASE (0xfffec600)
#define OMAP_MPU_TIMER3_BASE (0xfffec700)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MPU_TIMER_FREE (1 << 6)
#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
#define MPU_TIMER_AR (1 << 1)
#define MPU_TIMER_ST (1 << 0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLKGEN_REG_BASE (0xfffece00)
#define ARM_CKCTL (CLKGEN_REG_BASE + 0x0)
#define ARM_IDLECT1 (CLKGEN_REG_BASE + 0x4)
#define ARM_IDLECT2 (CLKGEN_REG_BASE + 0x8)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ARM_EWUPCT (CLKGEN_REG_BASE + 0xC)
#define ARM_RSTCT1 (CLKGEN_REG_BASE + 0x10)
#define ARM_RSTCT2 (CLKGEN_REG_BASE + 0x14)
#define ARM_SYSST (CLKGEN_REG_BASE + 0x18)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ARM_IDLECT3 (CLKGEN_REG_BASE + 0x24)
#define CK_RATEF 1
#define CK_IDLEF 2
#define CK_ENABLEF 4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CK_SELECTF 8
#define SETARM_IDLE_SHIFT
#define DPLL_CTL (0xfffecf00)
#define DSP_CONFIG_REG_BASE (0xe1008000)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DSP_CKCTL (DSP_CONFIG_REG_BASE + 0x0)
#define DSP_IDLECT1 (DSP_CONFIG_REG_BASE + 0x4)
#define DSP_IDLECT2 (DSP_CONFIG_REG_BASE + 0x8)
#define DSP_RSTCT2 (DSP_CONFIG_REG_BASE + 0x14)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ULPD_REG_BASE (0xfffe0800)
#define ULPD_IT_STATUS (ULPD_REG_BASE + 0x14)
#define ULPD_SETUP_ANALOG_CELL_3 (ULPD_REG_BASE + 0x24)
#define ULPD_CLOCK_CTRL (ULPD_REG_BASE + 0x30)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DIS_USB_PVCI_CLK (1 << 5)
#define USB_MCLK_EN (1 << 4)
#define ULPD_SOFT_REQ (ULPD_REG_BASE + 0x34)
#define SOFT_UDC_REQ (1 << 4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SOFT_USB_CLK_REQ (1 << 3)
#define SOFT_DPLL_REQ (1 << 0)
#define ULPD_DPLL_CTRL (ULPD_REG_BASE + 0x3c)
#define ULPD_STATUS_REQ (ULPD_REG_BASE + 0x40)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ULPD_APLL_CTRL (ULPD_REG_BASE + 0x4c)
#define ULPD_POWER_CTRL (ULPD_REG_BASE + 0x50)
#define ULPD_SOFT_DISABLE_REQ_REG (ULPD_REG_BASE + 0x68)
#define DIS_MMC2_DPLL_REQ (1 << 11)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DIS_MMC1_DPLL_REQ (1 << 10)
#define DIS_UART3_DPLL_REQ (1 << 9)
#define DIS_UART2_DPLL_REQ (1 << 8)
#define DIS_UART1_DPLL_REQ (1 << 7)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DIS_USB_HOST_DPLL_REQ (1 << 6)
#define ULPD_SDW_CLK_DIV_CTRL_SEL (ULPD_REG_BASE + 0x74)
#define ULPD_CAM_CLK_CTRL (ULPD_REG_BASE + 0x7c)
#define OMAP_MPU_WATCHDOG_BASE (0xfffec800)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_WDT_TIMER (OMAP_MPU_WATCHDOG_BASE + 0x0)
#define OMAP_WDT_LOAD_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
#define OMAP_WDT_READ_TIM (OMAP_MPU_WATCHDOG_BASE + 0x4)
#define OMAP_WDT_TIMER_MODE (OMAP_MPU_WATCHDOG_BASE + 0x8)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MOD_CONF_CTRL_0 0xfffe1080
#define MOD_CONF_CTRL_1 0xfffe1110
#define FUNC_MUX_CTRL_0 0xfffe1000
#define FUNC_MUX_CTRL_1 0xfffe1004
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FUNC_MUX_CTRL_2 0xfffe1008
#define COMP_MODE_CTRL_0 0xfffe100c
#define FUNC_MUX_CTRL_3 0xfffe1010
#define FUNC_MUX_CTRL_4 0xfffe1014
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FUNC_MUX_CTRL_5 0xfffe1018
#define FUNC_MUX_CTRL_6 0xfffe101C
#define FUNC_MUX_CTRL_7 0xfffe1020
#define FUNC_MUX_CTRL_8 0xfffe1024
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FUNC_MUX_CTRL_9 0xfffe1028
#define FUNC_MUX_CTRL_A 0xfffe102C
#define FUNC_MUX_CTRL_B 0xfffe1030
#define FUNC_MUX_CTRL_C 0xfffe1034
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FUNC_MUX_CTRL_D 0xfffe1038
#define PULL_DWN_CTRL_0 0xfffe1040
#define PULL_DWN_CTRL_1 0xfffe1044
#define PULL_DWN_CTRL_2 0xfffe1048
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PULL_DWN_CTRL_3 0xfffe104c
#define PULL_DWN_CTRL_4 0xfffe10ac
#define FUNC_MUX_CTRL_E 0xfffe1090
#define FUNC_MUX_CTRL_F 0xfffe1094
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FUNC_MUX_CTRL_10 0xfffe1098
#define FUNC_MUX_CTRL_11 0xfffe109c
#define FUNC_MUX_CTRL_12 0xfffe10a0
#define PU_PD_SEL_0 0xfffe10b4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PU_PD_SEL_1 0xfffe10b8
#define PU_PD_SEL_2 0xfffe10bc
#define PU_PD_SEL_3 0xfffe10c0
#define PU_PD_SEL_4 0xfffe10c4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_TIMER32K_BASE 0xFFFBC400
#define TIPB_PUBLIC_CNTL_BASE 0xfffed300
#define MPU_PUBLIC_TIPB_CNTL (TIPB_PUBLIC_CNTL_BASE + 0x8)
#define TIPB_PRIVATE_CNTL_BASE 0xfffeca00
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MPU_PRIVATE_TIPB_CNTL (TIPB_PRIVATE_CNTL_BASE + 0x8)
#define MPUI_BASE (0xfffec900)
#define MPUI_CTRL (MPUI_BASE + 0x0)
#define MPUI_DEBUG_ADDR (MPUI_BASE + 0x4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MPUI_DEBUG_DATA (MPUI_BASE + 0x8)
#define MPUI_DEBUG_FLAG (MPUI_BASE + 0xc)
#define MPUI_STATUS_REG (MPUI_BASE + 0x10)
#define MPUI_DSP_STATUS (MPUI_BASE + 0x14)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MPUI_DSP_BOOT_CONFIG (MPUI_BASE + 0x18)
#define MPUI_DSP_API_CONFIG (MPUI_BASE + 0x1c)
#define OMAP_LPG1_BASE 0xfffbd000
#define OMAP_LPG2_BASE 0xfffbd800
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_LPG1_LCR (OMAP_LPG1_BASE + 0x00)
#define OMAP_LPG1_PMR (OMAP_LPG1_BASE + 0x04)
#define OMAP_LPG2_LCR (OMAP_LPG2_BASE + 0x00)
#define OMAP_LPG2_PMR (OMAP_LPG2_BASE + 0x04)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_PWL_BASE 0xfffb5800
#define OMAP_PWL_ENABLE (OMAP_PWL_BASE + 0x00)
#define OMAP_PWL_CLK_ENABLE (OMAP_PWL_BASE + 0x04)
#include "omap730.h"
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include "omap1510.h"
#include "omap24xx.h"
#include "omap16xx.h"
#ifndef __ASSEMBLER__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#endif

View File

@@ -7,48 +7,48 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
#include <asm/hardware.h>
#define IO_SPACE_LIMIT 0xffffffff
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
#define __mem_pci(a) (a)
#define PCIO_BASE 0
#ifndef __ASSEMBLER__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define omap_readb(a) (*(volatile unsigned char *)IO_ADDRESS(a))
#define omap_readw(a) (*(volatile unsigned short *)IO_ADDRESS(a))
#define omap_readl(a) (*(volatile unsigned int *)IO_ADDRESS(a))
#define omap_writeb(v,a) (*(volatile unsigned char *)IO_ADDRESS(a) = (v))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define omap_writew(v,a) (*(volatile unsigned short *)IO_ADDRESS(a) = (v))
#define omap_writel(v,a) (*(volatile unsigned int *)IO_ADDRESS(a) = (v))
typedef struct { volatile u16 offset[256]; } __regbase16;
#define __REGV16(vaddr) ((__regbase16 *)((vaddr)&~0xff)) ->offset[((vaddr)&0xff)>>1]
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __REG16(paddr) __REGV16(io_p2v(paddr))
typedef struct { volatile u8 offset[4096]; } __regbase8;
#define __REGV8(vaddr) ((__regbase8 *)((vaddr)&~4095)) ->offset[((vaddr)&4095)>>0]
#define __REG8(paddr) __REGV8(io_p2v(paddr))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef struct { volatile u32 offset[4096]; } __regbase32;
#define __REGV32(vaddr) ((__regbase32 *)((vaddr)&~4095)) ->offset[((vaddr)&4095)>>2]
#define __REG32(paddr) __REGV32(io_p2v(paddr))
#else
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __REG8(paddr) io_p2v(paddr)
#define __REG16(paddr) io_p2v(paddr)
#define __REG32(paddr) io_p2v(paddr)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,236 +7,279 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP15XX_IRQS_H
#define __ASM_ARCH_OMAP15XX_IRQS_H
#define INT_CAMERA 1
#define INT_FIQ 3
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_RTDX 6
#define INT_DSP_MMU_ABORT 7
#define INT_HOST 8
#define INT_ABORT 9
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_DSP_MAILBOX1 10
#define INT_DSP_MAILBOX2 11
#define INT_BRIDGE_PRIV 13
#define INT_GPIO_BANK1 14
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_UART3 15
#define INT_TIMER3 16
#define INT_DMA_CH0_6 19
#define INT_DMA_CH1_7 20
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_DMA_CH2_8 21
#define INT_DMA_CH3 22
#define INT_DMA_CH4 23
#define INT_DMA_CH5 24
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_DMA_LCD 25
#define INT_TIMER1 26
#define INT_WD_TIMER 27
#define INT_BRIDGE_PUB 28
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_TIMER2 30
#define INT_LCD_CTRL 31
#define INT_1510_IH2_IRQ 0
#define INT_1510_RES2 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1510_SPI_TX 4
#define INT_1510_SPI_RX 5
#define INT_1510_RES12 12
#define INT_1510_LB_MMU 17
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1510_RES18 18
#define INT_1510_LOCAL_BUS 29
#define INT_1610_IH2_IRQ 0
#define INT_1610_IH2_FIQ 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_McBSP2_TX 4
#define INT_1610_McBSP2_RX 5
#define INT_1610_LCD_LINE 12
#define INT_1610_GPTIMER1 17
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_GPTIMER2 18
#define INT_1610_SSR_FIFO_0 29
#define INT_730_IH2_FIQ 0
#define INT_730_IH2_IRQ 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_USB_NON_ISO 2
#define INT_730_USB_ISO 3
#define INT_730_ICR 4
#define INT_730_EAC 5
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_GPIO_BANK1 6
#define INT_730_GPIO_BANK2 7
#define INT_730_GPIO_BANK3 8
#define INT_730_McBSP2TX 10
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_McBSP2RX 11
#define INT_730_McBSP2RX_OVF 12
#define INT_730_LCD_LINE 14
#define INT_730_GSM_PROTECT 15
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_TIMER3 16
#define INT_730_GPIO_BANK5 17
#define INT_730_GPIO_BANK6 18
#define INT_730_SPGIO_WR 29
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IH2_BASE 32
#define INT_KEYBOARD (1 + IH2_BASE)
#define INT_uWireTX (2 + IH2_BASE)
#define INT_uWireRX (3 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_I2C (4 + IH2_BASE)
#define INT_MPUIO (5 + IH2_BASE)
#define INT_USB_HHC_1 (6 + IH2_BASE)
#define INT_McBSP3TX (10 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_McBSP3RX (11 + IH2_BASE)
#define INT_McBSP1TX (12 + IH2_BASE)
#define INT_McBSP1RX (13 + IH2_BASE)
#define INT_UART2 (14 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_UART1 (15 + IH2_BASE)
#define INT_BT_MCSI1TX (16 + IH2_BASE)
#define INT_BT_MCSI1RX (17 + IH2_BASE)
#define INT_USB_W2FC (20 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1WIRE (21 + IH2_BASE)
#define INT_OS_TIMER (22 + IH2_BASE)
#define INT_MMC (23 + IH2_BASE)
#define INT_GAUGE_32K (24 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_RTC_TIMER (25 + IH2_BASE)
#define INT_RTC_ALARM (26 + IH2_BASE)
#define INT_MEM_STICK (27 + IH2_BASE)
#define INT_DSP_MMU (28 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1510_COM_SPI_RO (31 + IH2_BASE)
#define INT_1610_FAC (0 + IH2_BASE)
#define INT_1610_USB_HHC_2 (7 + IH2_BASE)
#define INT_1610_USB_OTG (8 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_SoSSI (9 + IH2_BASE)
#define INT_1610_SoSSI_MATCH (19 + IH2_BASE)
#define INT_1610_McBSP2RX_OF (31 + IH2_BASE)
#define INT_1610_STI (32 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_STI_WAKEUP (33 + IH2_BASE)
#define INT_1610_GPTIMER3 (34 + IH2_BASE)
#define INT_1610_GPTIMER4 (35 + IH2_BASE)
#define INT_1610_GPTIMER5 (36 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_GPTIMER6 (37 + IH2_BASE)
#define INT_1610_GPTIMER7 (38 + IH2_BASE)
#define INT_1610_GPTIMER8 (39 + IH2_BASE)
#define INT_1610_GPIO_BANK2 (40 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_GPIO_BANK3 (41 + IH2_BASE)
#define INT_1610_MMC2 (42 + IH2_BASE)
#define INT_1610_CF (43 + IH2_BASE)
#define INT_1610_WAKE_UP_REQ (46 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_GPIO_BANK4 (48 + IH2_BASE)
#define INT_1610_SPI (49 + IH2_BASE)
#define INT_1610_DMA_CH6 (53 + IH2_BASE)
#define INT_1610_DMA_CH7 (54 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_DMA_CH8 (55 + IH2_BASE)
#define INT_1610_DMA_CH9 (56 + IH2_BASE)
#define INT_1610_DMA_CH10 (57 + IH2_BASE)
#define INT_1610_DMA_CH11 (58 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_DMA_CH12 (59 + IH2_BASE)
#define INT_1610_DMA_CH13 (60 + IH2_BASE)
#define INT_1610_DMA_CH14 (61 + IH2_BASE)
#define INT_1610_DMA_CH15 (62 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_1610_NAND (63 + IH2_BASE)
#define INT_730_HW_ERRORS (0 + IH2_BASE)
#define INT_730_NFIQ_PWR_FAIL (1 + IH2_BASE)
#define INT_730_CFCD (2 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_CFIREQ (3 + IH2_BASE)
#define INT_730_I2C (4 + IH2_BASE)
#define INT_730_PCC (5 + IH2_BASE)
#define INT_730_MPU_EXT_NIRQ (6 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_SPI_100K_1 (7 + IH2_BASE)
#define INT_730_SYREN_SPI (8 + IH2_BASE)
#define INT_730_VLYNQ (9 + IH2_BASE)
#define INT_730_GPIO_BANK4 (10 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_McBSP1TX (11 + IH2_BASE)
#define INT_730_McBSP1RX (12 + IH2_BASE)
#define INT_730_McBSP1RX_OF (13 + IH2_BASE)
#define INT_730_UART_MODEM_IRDA_2 (14 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_UART_MODEM_1 (15 + IH2_BASE)
#define INT_730_MCSI (16 + IH2_BASE)
#define INT_730_uWireTX (17 + IH2_BASE)
#define INT_730_uWireRX (18 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_SMC_CD (19 + IH2_BASE)
#define INT_730_SMC_IREQ (20 + IH2_BASE)
#define INT_730_HDQ_1WIRE (21 + IH2_BASE)
#define INT_730_TIMER32K (22 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_MMC_SDIO (23 + IH2_BASE)
#define INT_730_UPLD (24 + IH2_BASE)
#define INT_730_USB_HHC_1 (27 + IH2_BASE)
#define INT_730_USB_HHC_2 (28 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_USB_GENI (29 + IH2_BASE)
#define INT_730_USB_OTG (30 + IH2_BASE)
#define INT_730_CAMERA_IF (31 + IH2_BASE)
#define INT_730_RNG (32 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_DUAL_MODE_TIMER (33 + IH2_BASE)
#define INT_730_DBB_RF_EN (34 + IH2_BASE)
#define INT_730_MPUIO_KEYPAD (35 + IH2_BASE)
#define INT_730_SHA1_MD5 (36 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_SPI_100K_2 (37 + IH2_BASE)
#define INT_730_RNG_IDLE (38 + IH2_BASE)
#define INT_730_MPUIO (39 + IH2_BASE)
#define INT_730_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_LLPC_OE_FALLING (41 + IH2_BASE)
#define INT_730_LLPC_OE_RISING (42 + IH2_BASE)
#define INT_730_LLPC_VSYNC (43 + IH2_BASE)
#define INT_730_WAKE_UP_REQ (46 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_DMA_CH6 (53 + IH2_BASE)
#define INT_730_DMA_CH7 (54 + IH2_BASE)
#define INT_730_DMA_CH8 (55 + IH2_BASE)
#define INT_730_DMA_CH9 (56 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_DMA_CH10 (57 + IH2_BASE)
#define INT_730_DMA_CH11 (58 + IH2_BASE)
#define INT_730_DMA_CH12 (59 + IH2_BASE)
#define INT_730_DMA_CH13 (60 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_730_DMA_CH14 (61 + IH2_BASE)
#define INT_730_DMA_CH15 (62 + IH2_BASE)
#define INT_730_NAND (63 + IH2_BASE)
#define INT_24XX_SYS_NIRQ 7
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_SDMA_IRQ0 12
#define INT_24XX_SDMA_IRQ1 13
#define INT_24XX_SDMA_IRQ2 14
#define INT_24XX_SDMA_IRQ3 15
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_CAM_IRQ 24
#define INT_24XX_DSS_IRQ 25
#define INT_24XX_GPIO_BANK1 29
#define INT_24XX_GPIO_BANK2 30
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_GPIO_BANK3 31
#define INT_24XX_GPIO_BANK4 32
#define INT_24XX_GPTIMER1 37
#define INT_24XX_GPTIMER2 38
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_GPTIMER3 39
#define INT_24XX_GPTIMER4 40
#define INT_24XX_GPTIMER5 41
#define INT_24XX_GPTIMER6 42
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_GPTIMER7 43
#define INT_24XX_GPTIMER8 44
#define INT_24XX_GPTIMER9 45
#define INT_24XX_GPTIMER10 46
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_GPTIMER11 47
#define INT_24XX_GPTIMER12 48
#define INT_24XX_MCBSP1_IRQ_TX 59
#define INT_24XX_MCBSP1_IRQ_RX 60
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_MCBSP2_IRQ_TX 62
#define INT_24XX_MCBSP2_IRQ_RX 63
#define INT_24XX_UART1_IRQ 72
#define INT_24XX_UART2_IRQ 73
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INT_24XX_UART3_IRQ 74
#define INT_24XX_MMC_IRQ 83
#define OMAP_MAX_GPIO_LINES 192
#define IH_GPIO_BASE (128 + IH2_BASE)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE)
#define IH_BOARD_BASE (16 + IH_MPUIO_BASE)
#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
#ifndef __ASSEMBLY__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#include <asm/hardware.h>
#ifndef NR_IRQS
#define NR_IRQS IH_BOARD_BASE
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#endif

View File

@@ -7,179 +7,195 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_MCBSP_H
#define __ASM_ARCH_OMAP_MCBSP_H
#include <asm/hardware.h>
#define OMAP730_MCBSP1_BASE 0xfffb1000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP730_MCBSP2_BASE 0xfffb1800
#define OMAP1510_MCBSP1_BASE 0xe1011800
#define OMAP1510_MCBSP2_BASE 0xfffb1000
#define OMAP1510_MCBSP3_BASE 0xe1017000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP1610_MCBSP1_BASE 0xe1011800
#define OMAP1610_MCBSP2_BASE 0xfffb1000
#define OMAP1610_MCBSP3_BASE 0xe1017000
#define OMAP24XX_MCBSP1_BASE 0x48074000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_MCBSP2_BASE 0x48076000
#define OMAP_MCBSP_READ(base, reg) __raw_readw((base) + OMAP_MCBSP_REG_##reg)
#define OMAP_MCBSP_WRITE(base, reg, val) __raw_writew((val), (base) + OMAP_MCBSP_REG_##reg)
#define RRST 0x0001
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define RRDY 0x0002
#define RFULL 0x0004
#define RSYNC_ERR 0x0008
#define RINTM(value) ((value)<<4)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ABIS 0x0040
#define DXENA 0x0080
#define CLKSTP(value) ((value)<<11)
#define RJUST(value) ((value)<<13)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DLB 0x8000
#define XRST 0x0001
#define XRDY 0x0002
#define XEMPTY 0x0004
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define XSYNC_ERR 0x0008
#define XINTM(value) ((value)<<4)
#define GRST 0x0040
#define FRST 0x0080
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define SOFT 0x0100
#define FREE 0x0200
#define CLKRP 0x0001
#define CLKXP 0x0002
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FSRP 0x0004
#define FSXP 0x0008
#define DR_STAT 0x0010
#define DX_STAT 0x0020
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define CLKS_STAT 0x0040
#define SCLKME 0x0080
#define CLKRM 0x0100
#define CLKXM 0x0200
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FSRM 0x0400
#define FSXM 0x0800
#define RIOEN 0x1000
#define XIOEN 0x2000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IDLE_EN 0x4000
#define RWDLEN1(value) ((value)<<5)
#define RFRLEN1(value) ((value)<<8)
#define XWDLEN1(value) ((value)<<5)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define XFRLEN1(value) ((value)<<8)
#define RDATDLY(value) (value)
#define RFIG 0x0004
#define RCOMPAND(value) ((value)<<3)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define RWDLEN2(value) ((value)<<5)
#define RFRLEN2(value) ((value)<<8)
#define RPHASE 0x8000
#define XDATDLY(value) (value)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define XFIG 0x0004
#define XCOMPAND(value) ((value)<<3)
#define XWDLEN2(value) ((value)<<5)
#define XFRLEN2(value) ((value)<<8)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define XPHASE 0x8000
#define CLKGDV(value) (value)
#define FWID(value) ((value)<<8)
#define FPER(value) (value)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FSGM 0x1000
#define CLKSM 0x2000
#define CLKSP 0x4000
#define GSYNC 0x8000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define RMCM 0x0001
#define RCBLK(value) ((value)<<2)
#define RPABLK(value) ((value)<<5)
#define RPBBLK(value) ((value)<<7)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define XMCM(value) (value)
#define XCBLK(value) ((value)<<2)
#define XPABLK(value) ((value)<<5)
#define XPBBLK(value) ((value)<<7)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct omap_mcbsp_reg_cfg {
u16 spcr2;
u16 spcr1;
u16 rcr2;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 rcr1;
u16 xcr2;
u16 xcr1;
u16 srgr2;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 srgr1;
u16 mcr2;
u16 mcr1;
u16 pcr0;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 rcerc;
u16 rcerd;
u16 xcerc;
u16 xcerd;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 rcere;
u16 rcerf;
u16 xcere;
u16 xcerf;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u16 rcerg;
u16 rcerh;
u16 xcerg;
u16 xcerh;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
typedef enum {
OMAP_MCBSP1 = 0,
OMAP_MCBSP2,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_MCBSP3,
} omap_mcbsp_id;
typedef int __bitwise omap_mcbsp_io_type_t;
#define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2)
typedef enum {
OMAP_MCBSP_WORD_8 = 0,
OMAP_MCBSP_WORD_12,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_MCBSP_WORD_16,
OMAP_MCBSP_WORD_20,
OMAP_MCBSP_WORD_24,
OMAP_MCBSP_WORD_32,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} omap_mcbsp_word_length;
typedef enum {
OMAP_MCBSP_CLK_RISING = 0,
OMAP_MCBSP_CLK_FALLING,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} omap_mcbsp_clk_polarity;
typedef enum {
OMAP_MCBSP_FS_ACTIVE_HIGH = 0,
OMAP_MCBSP_FS_ACTIVE_LOW,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} omap_mcbsp_fs_polarity;
typedef enum {
OMAP_MCBSP_CLK_STP_MODE_NO_DELAY = 0,
OMAP_MCBSP_CLK_STP_MODE_DELAY,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} omap_mcbsp_clk_stp_mode;
typedef enum {
OMAP_MCBSP_SPI_MASTER = 0,
OMAP_MCBSP_SPI_SLAVE,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} omap_mcbsp_spi_mode;
struct omap_mcbsp_spi_cfg {
omap_mcbsp_spi_mode spi_mode;
omap_mcbsp_clk_polarity rx_clock_polarity;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
omap_mcbsp_clk_polarity tx_clock_polarity;
omap_mcbsp_fs_polarity fsx_polarity;
u8 clk_div;
omap_mcbsp_clk_stp_mode clk_stp_mode;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
omap_mcbsp_word_length word_length;
};
#endif

View File

@@ -7,13 +7,18 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,25 +7,32 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ARCH_OMAP_MTD_XIP_H__
#define __ARCH_OMAP_MTD_XIP_H__
#include <asm/hardware.h>
#define OMAP_MPU_TIMER_BASE (0xfffec500)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP_MPU_TIMER_OFFSET 0x100
typedef struct {
u32 cntl;
u32 load_tim;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
u32 read_tim;
} xip_omap_mpu_timer_regs_t;
#define xip_omap_mpu_timer_base(n) ((volatile xip_omap_mpu_timer_regs_t*)IO_ADDRESS(OMAP_MPU_TIMER_BASE + (n)*OMAP_MPU_TIMER_OFFSET))
#define xip_irqpending() (omap_readl(OMAP_IH1_ITR) & ~omap_readl(OMAP_IH1_MIR))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define xip_currtime() (~xip_omap_mpu_timer_read(0))
#define xip_elapsed_since(x) (signed)((~xip_omap_mpu_timer_read(0) - (x)) / 6)
#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (1))
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,385 +7,402 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_MUX_H
#define __ASM_ARCH_MUX_H
#define PU_PD_SEL_NA 0
#define PULL_DWN_CTRL_NA 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MUX_REG(reg, mode_offset, mode) .mux_reg = FUNC_MUX_CTRL_##reg, .mask_offset = mode_offset, .mask = mode,
#define PULL_REG(reg, bit, status) .pull_reg = PULL_DWN_CTRL_##reg, .pull_bit = bit, .pull_val = status,
#define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, .pu_pd_val = status,
#define MUX_REG_730(reg, mode_offset, mode) .mux_reg = OMAP730_IO_CONF_##reg, .mask_offset = mode_offset, .mask = mode,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PULL_REG_730(reg, bit, status) .pull_reg = OMAP730_IO_CONF_##reg, .pull_bit = bit, .pull_val = status,
#define MUX_CFG(desc, mux_reg, mode_offset, mode, pull_reg, pull_bit, pull_status, pu_pd_reg, pu_pd_status, debug_status) { .name = desc, .debug = debug_status, MUX_REG(mux_reg, mode_offset, mode) PULL_REG(pull_reg, pull_bit, !pull_status) PU_PD_REG(pu_pd_reg, pu_pd_status) },
#define MUX_CFG_730(desc, mux_reg, mode_offset, mode, pull_bit, pull_status, debug_status) { .name = desc, .debug = debug_status, MUX_REG_730(mux_reg, mode_offset, mode) PULL_REG_730(mux_reg, pull_bit, pull_status) PU_PD_REG(NA, 0) },
#define MUX_CFG_24XX(desc, reg_offset, mode, pull_en, pull_mode, dbg) { .name = desc, .debug = dbg, .mux_reg = reg_offset, .mask = mode, .pull_val = pull_en, .pu_pd_val = pull_mode, },
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PULL_DISABLED 0
#define PULL_ENABLED 1
#define PULL_DOWN 0
#define PULL_UP 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct pin_config {
char *name;
unsigned char busy;
unsigned char debug;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const char *mux_reg_name;
const unsigned int mux_reg;
const unsigned char mask_offset;
const unsigned char mask;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const char *pull_name;
const unsigned int pull_reg;
const unsigned char pull_val;
const unsigned char pull_bit;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
const char *pu_pd_name;
const unsigned int pu_pd_reg;
const unsigned char pu_pd_val;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
enum omap730_index {
E2_730_KBR0,
J7_730_KBR1,
E1_730_KBR2,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
F3_730_KBR3,
D2_730_KBR4,
AA20_730_KBR5,
V17_730_KBR6,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
C2_730_KBC0,
D3_730_KBC1,
E4_730_KBC2,
F4_730_KBC3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
E3_730_KBC4,
AA17_730_USB_DM,
W16_730_USB_PU_EN,
W17_730_USB_VBUSI,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V19_730_GPIO_15,
M19_730_GPIO_77,
C21_730_GPIO_121_122,
K19_730_GPIO_126,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
K15_730_GPIO_127,
P15_730_GPIO_16_17,
M15_730_GPIO_83,
N20_730_GPIO_82,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
N18_730_GPIO_81,
N19_730_GPIO_80,
L15_730_GPIO_76,
UART1_CTS_RTS,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
OMAP_730_GPIOS_42_43,
UART1_TX_RX,
OMAP_730_GPIOS_40_41,
UART1_USB_RX_TX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
UART1_USB_RTS,
UART1_USB_CTS
};
enum omap1xxx_index {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
UART1_TX = 0,
UART1_RTS,
UART2_TX,
UART2_RX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
UART2_CTS,
UART2_RTS,
UART3_TX,
UART3_RX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
UART3_CTS,
UART3_RTS,
UART3_CLKREQ,
UART3_BCLK,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Y15_1610_UART3_RTS,
PWT,
PWL,
R18_USB_VBUS,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R18_1510_USB_GPIO0,
W4_USB_PUEN,
W4_USB_CLKO,
W4_USB_HIGHZ,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W4_GPIO58,
USB1_SUSP,
USB1_SEO,
W13_1610_USB1_SE0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
USB1_TXEN,
USB1_TXD,
USB1_VP,
USB1_VM,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
USB1_RCV,
USB1_SPEED,
R13_1610_USB1_SPEED,
R13_1710_USB1_SE0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
USB2_SUSP,
USB2_VP,
USB2_TXEN,
USB2_VM,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
USB2_RCV,
USB2_SEO,
USB2_TXD,
R18_1510_GPIO0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R19_1510_GPIO1,
M14_1510_GPIO2,
P18_1610_GPIO3,
Y15_1610_GPIO17,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R18_1710_GPIO0,
V2_1710_GPIO10,
N21_1710_GPIO14,
W15_1710_GPIO40,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
MPUIO2,
N15_1610_MPUIO2,
MPUIO4,
MPUIO5,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
T20_1610_MPUIO5,
W11_1610_MPUIO6,
V10_1610_MPUIO7,
W11_1610_MPUIO9,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V10_1610_MPUIO10,
W10_1610_MPUIO11,
E20_1610_MPUIO13,
U20_1610_MPUIO14,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
E19_1610_MPUIO15,
MCBSP2_CLKR,
MCBSP2_CLKX,
MCBSP2_DR,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
MCBSP2_DX,
MCBSP2_FSR,
MCBSP2_FSX,
MCBSP3_CLKX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
BALLOUT_V8_ARMIO3,
N20_HDQ,
W8_1610_MMC2_DAT0,
V8_1610_MMC2_DAT1,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W15_1610_MMC2_DAT2,
R10_1610_MMC2_DAT3,
Y10_1610_MMC2_CLK,
Y8_1610_MMC2_CMD,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V9_1610_MMC2_CMDDIR,
V5_1610_MMC2_DATDIR0,
W19_1610_MMC2_DATDIR1,
R18_1610_MMC2_CLKIN,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
M19_1610_ETM_PSTAT0,
L15_1610_ETM_PSTAT1,
L18_1610_ETM_PSTAT2,
L19_1610_ETM_D0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
J19_1610_ETM_D6,
J18_1610_ETM_D7,
P20_1610_GPIO4,
V9_1610_GPIO7,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W8_1610_GPIO9,
N20_1610_GPIO11,
N19_1610_GPIO13,
P10_1610_GPIO22,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V5_1610_GPIO24,
AA20_1610_GPIO_41,
W19_1610_GPIO48,
M7_1610_GPIO62,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V14_16XX_GPIO37,
R9_16XX_GPIO18,
L14_16XX_GPIO49,
V19_1610_UWIRE_SCLK,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
U18_1610_UWIRE_SDI,
W21_1610_UWIRE_SDO,
N14_1610_UWIRE_CS0,
P15_1610_UWIRE_CS3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
N15_1610_UWIRE_CS1,
U19_1610_SPIF_SCK,
U18_1610_SPIF_DIN,
P20_1610_SPIF_DIN,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W21_1610_SPIF_DOUT,
R18_1610_SPIF_DOUT,
N14_1610_SPIF_CS0,
N15_1610_SPIF_CS1,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
T19_1610_SPIF_CS2,
P15_1610_SPIF_CS3,
L3_1610_FLASH_CS2B_OE,
M8_1610_FLASH_CS2B_WE,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
MMC_CMD,
MMC_DAT1,
MMC_DAT2,
MMC_DAT0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
MMC_CLK,
MMC_DAT3,
M15_1710_MMC_CLKI,
P19_1710_MMC_CMDDIR,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
P20_1710_MMC_DATDIR0,
W9_USB0_TXEN,
AA9_USB0_VP,
Y5_USB0_RCV,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R9_USB0_VM,
V6_USB0_TXD,
W5_USB0_SE0,
V9_USB0_SPEED,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V9_USB0_SUSP,
W9_USB2_TXEN,
AA9_USB2_VP,
Y5_USB2_RCV,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R9_USB2_VM,
V6_USB2_TXD,
W5_USB2_SE0,
R13_1610_UART1_TX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V14_16XX_UART1_RX,
R14_1610_UART1_CTS,
AA15_1610_UART1_RTS,
R9_16XX_UART2_RX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
L14_16XX_UART3_RX,
I2C_SCL,
I2C_SDA,
F18_1610_KBC0,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
D20_1610_KBC1,
D19_1610_KBC2,
E18_1610_KBC3,
C21_1610_KBC4,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
G18_1610_KBR0,
F19_1610_KBR1,
H14_1610_KBR2,
E20_1610_KBR3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
E19_1610_KBR4,
N19_1610_KBR5,
T20_1610_LOW_PWR,
V5_1710_MCLK_ON,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V5_1710_MCLK_OFF,
R10_1610_MCLK_ON,
R10_1610_MCLK_OFF,
P11_1610_CF_CD2,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R11_1610_CF_IOIS16,
V10_1610_CF_IREQ,
W10_1610_CF_RESET,
W11_1610_CF_CD1,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
enum omap24xx_index {
M19_24XX_I2C1_SCL,
L15_24XX_I2C1_SDA,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
J15_24XX_I2C2_SCL,
H19_24XX_I2C2_SDA,
W19_24XX_SYS_NIRQ,
W14_24XX_SYS_CLKOUT,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
L3_GPMC_WAIT0,
N7_GPMC_WAIT1,
M1_GPMC_WAIT2,
P1_GPMC_WAIT3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Y15_24XX_MCBSP2_CLKX,
R14_24XX_MCBSP2_FSX,
W15_24XX_MCBSP2_DR,
V15_24XX_MCBSP2_DX,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
M21_242X_GPIO11,
AA10_242X_GPIO13,
AA6_242X_GPIO14,
AA4_242X_GPIO15,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Y11_242X_GPIO16,
AA12_242X_GPIO17,
AA8_242X_GPIO58,
Y20_24XX_GPIO60,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W4__24XX_GPIO74,
M15_24XX_GPIO92,
V14_24XX_GPIO117,
V4_242X_GPIO49,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
W2_242X_GPIO50,
U4_242X_GPIO51,
V3_242X_GPIO52,
V2_242X_GPIO53,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V6_242X_GPIO53,
T4_242X_GPIO54,
Y4_242X_GPIO54,
T3_242X_GPIO55,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
U2_242X_GPIO56,
AA10_242X_DMAREQ0,
AA6_242X_DMAREQ1,
E4_242X_DMAREQ2,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
G4_242X_DMAREQ3,
D3_242X_DMAREQ4,
E3_242X_DMAREQ5,
P20_24XX_TSC_IRQ,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
K15_24XX_UART3_TX,
K14_24XX_UART3_RX,
G19_24XX_MMC_CLKO,
H18_24XX_MMC_CMD,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
F20_24XX_MMC_DAT0,
H14_24XX_MMC_DAT1,
E19_24XX_MMC_DAT2,
D19_24XX_MMC_DAT3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
F19_24XX_MMC_DAT_DIR0,
E20_24XX_MMC_DAT_DIR1,
F18_24XX_MMC_DAT_DIR2,
E18_24XX_MMC_DAT_DIR3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
G18_24XX_MMC_CMD_DIR,
H15_24XX_MMC_CLKI,
T19_24XX_KBR0,
R19_24XX_KBR1,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
V18_24XX_KBR2,
M21_24XX_KBR3,
E5__24XX_KBR4,
M18_24XX_KBR5,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
R20_24XX_KBC0,
M14_24XX_KBC1,
H19_24XX_KBC2,
V17_24XX_KBC3,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
P21_24XX_KBC4,
L14_24XX_KBC5,
N19_24XX_KBC6,
B3__24XX_KBR5,
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
AA4_24XX_KBC2,
B13_24XX_KBC6,
};
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,24 +7,28 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP24XX_H
#define __ASM_ARCH_OMAP24XX_H
#define L4_24XX_BASE 0x48000000
#define L3_24XX_BASE 0x68000000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_IC_BASE (L4_24XX_BASE + 0xfe000)
#define VA_IC_BASE IO_ADDRESS(OMAP24XX_IC_BASE)
#define OMAP24XX_IVA_INTC_BASE 0x40000000
#define IRQ_SIR_IRQ 0x0040
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP24XX_32KSYNCT_BASE (L4_24XX_BASE + 0x4000)
#define OMAP24XX_PRCM_BASE (L4_24XX_BASE + 0x8000)
#define OMAP24XX_SDRC_BASE (L3_24XX_BASE + 0x9000)
#define OMAP242X_CONTROL_STATUS (L4_24XX_BASE + 0x2f8)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,15 +7,20 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_SERIAL_H
#define __ASM_ARCH_SERIAL_H
#define OMAP_MAX_NR_PORTS 3
#define OMAP1510_BASE_BAUD (12000000/16)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define OMAP16XX_BASE_BAUD (48000000/16)
#define is_omap_port(p) ({int __ret = 0; if (p == IO_ADDRESS(OMAP_UART1_BASE) || p == IO_ADDRESS(OMAP_UART2_BASE) || p == IO_ADDRESS(OMAP_UART3_BASE)) __ret = 1; __ret; })
#endif

View File

@@ -7,11 +7,17 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARCH_OMAP_TIMEX_H
#define __ASM_ARCH_OMAP_TIMEX_H
#define CLOCK_TICK_RATE (HZ * 100000UL)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,7 +7,13 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#define VMALLOC_END (PAGE_OFFSET + 0x10000000)

View File

@@ -7,15 +7,19 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_ATOMIC_H
#define __ASM_ARM_ATOMIC_H
#include <linux/compiler.h>
typedef struct { volatile int counter; } atomic_t;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ATOMIC_INIT(i) { (i) }
#endif

View File

@@ -7,9 +7,15 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASMARM_AUXVEC_H
#define __ASMARM_AUXVEC_H
#endif

View File

@@ -7,9 +7,15 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_BITOPS_H
#define __ASM_ARM_BITOPS_H
#endif

View File

@@ -7,45 +7,48 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_BYTEORDER_H
#define __ASM_ARM_BYTEORDER_H
#include <linux/compiler.h>
#include <asm/types.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
{
__u32 t;
#ifndef __thumb__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
if (!__builtin_constant_p(x)) {
__asm__ ("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x));
} else
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
t = x ^ ((x << 16) | (x >> 16));
x = (x << 24) | (x >> 8);
t &= ~0x00FF0000;
x ^= (t >> 8);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
return x;
}
#define __arch__swab32(x) ___arch__swab32(x)
#ifndef __STRICT_ANSI__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __BYTEORDER_HAS_U64__
#define __SWAB_64_THRU_32__
#endif
#ifdef __ARMEB__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <linux/byteorder/big_endian.h>
#else
#include <linux/byteorder/little_endian.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,12 +7,18 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASMARM_CACHE_H
#define __ASMARM_CACHE_H
#define L1_CACHE_SHIFT 5
#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,101 +7,95 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _ASMARM_CACHEFLUSH_H
#define _ASMARM_CACHEFLUSH_H
#include <linux/sched.h>
#include <linux/mm.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/glue.h>
#include <asm/shmparam.h>
#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
#undef _CACHE
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#undef MULTI_CACHE
#if !defined(_CACHE) && !defined(MULTI_CACHE)
#error Unknown cache maintainence model
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PG_dcache_dirty PG_arch_1
struct cpu_cache_fns {
void (*flush_kern_all)(void);
void (*flush_user_all)(void);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
void (*flush_user_range)(unsigned long, unsigned long, unsigned int);
void (*coherent_kern_range)(unsigned long, unsigned long);
void (*coherent_user_range)(unsigned long, unsigned long);
void (*flush_kern_dcache_page)(void *);
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
void (*dma_inv_range)(unsigned long, unsigned long);
void (*dma_clean_range)(unsigned long, unsigned long);
void (*dma_flush_range)(unsigned long, unsigned long);
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifdef MULTI_CACHE
#define __cpuc_flush_kern_all cpu_cache.flush_kern_all
#define __cpuc_flush_user_all cpu_cache.flush_user_all
#define __cpuc_flush_user_range cpu_cache.flush_user_range
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __cpuc_coherent_kern_range cpu_cache.coherent_kern_range
#define __cpuc_coherent_user_range cpu_cache.coherent_user_range
#define __cpuc_flush_dcache_page cpu_cache.flush_kern_dcache_page
#define dmac_inv_range cpu_cache.dma_inv_range
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define dmac_clean_range cpu_cache.dma_clean_range
#define dmac_flush_range cpu_cache.dma_flush_range
#else
#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __cpuc_flush_dcache_page __glue(_CACHE,_flush_kern_dcache_page)
#define dmac_inv_range __glue(_CACHE,_dma_inv_range)
#define dmac_clean_range __glue(_CACHE,_dma_clean_range)
#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#define flush_cache_vmap(start, end) flush_cache_all()
#define flush_cache_vunmap(start, end) flush_cache_all()
#define copy_to_user_page(vma, page, vaddr, dst, src, len) do { memcpy(dst, src, len); flush_ptrace_access(vma, page, vaddr, dst, len, 1); } while (0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define copy_from_user_page(vma, page, vaddr, dst, src, len) do { memcpy(dst, src, len); } while (0)
#define flush_cache_all() __cpuc_flush_kern_all()
#define flush_cache_user_range(vma,start,end) __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
#define flush_icache_range(s,e) __cpuc_coherent_kern_range(s,e)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define clean_dcache_area(start,size) cpu_dcache_clean_area(start, size)
#define flush_dcache_mmap_lock(mapping) write_lock_irq(&(mapping)->tree_lock)
#define flush_dcache_mmap_unlock(mapping) write_unlock_irq(&(mapping)->tree_lock)
#define flush_icache_user_range(vma,page,addr,len) flush_dcache_page(page)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define flush_icache_page(vma,page) do { } while (0)
#define __cacheid_present(val) (val != read_cpuid(CPUID_ID))
#define __cacheid_vivt(val) ((val & (15 << 25)) != (14 << 25))
#define __cacheid_vipt(val) ((val & (15 << 25)) == (14 << 25))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __cacheid_vipt_nonaliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25))
#define __cacheid_vipt_aliasing(val) ((val & (15 << 25 | 1 << 23)) == (14 << 25 | 1 << 23))
#define cache_is_vivt() ({ unsigned int __val = read_cpuid(CPUID_CACHETYPE); (!__cacheid_present(__val)) || __cacheid_vivt(__val); })
#define cache_is_vipt() ({ unsigned int __val = read_cpuid(CPUID_CACHETYPE); __cacheid_present(__val) && __cacheid_vipt(__val); })
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cache_is_vipt_nonaliasing() ({ unsigned int __val = read_cpuid(CPUID_CACHETYPE); __cacheid_present(__val) && __cacheid_vipt_nonaliasing(__val); })
#define cache_is_vipt_aliasing() ({ unsigned int __val = read_cpuid(CPUID_CACHETYPE); __cacheid_present(__val) && __cacheid_vipt_aliasing(__val); })
#endif

View File

@@ -7,11 +7,17 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ARM_CPUTIME_H
#define __ARM_CPUTIME_H
#include <asm-generic/cputime.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,16 +7,19 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_DELAY_H
#define __ASM_ARM_DELAY_H
#include <asm/param.h>
#define MAX_UDELAY_MS 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define udelay(n) (__builtin_constant_p(n) ? ((n) > (MAX_UDELAY_MS * 1000) ? __bad_udelay() : __const_udelay((n) * ((2199023U*HZ)>>11))) : __udelay(n))
#endif

View File

@@ -7,21 +7,27 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_DIV64
#define __ASM_ARM_DIV64
#include <asm/system.h>
#ifdef __ARMEB__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __xh "r0"
#define __xl "r1"
#else
#define __xl "r0"
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __xh "r1"
#endif
#define do_div(n,base) ({ register unsigned int __base asm("r4") = base; register unsigned long long __n asm("r0") = n; register unsigned long long __res asm("r2"); register unsigned int __rem asm(__xh); asm( __asmeq("%0", __xh) __asmeq("%1", "r2") __asmeq("%2", "r0") __asmeq("%3", "r4") "bl __do_div64" : "=r" (__rem), "=r" (__res) : "r" (__n), "r" (__base) : "ip", "lr", "cc"); n = __res; __rem; })
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,9 +7,15 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef ASMARM_DMA_MAPPING_H
#define ASMARM_DMA_MAPPING_H
#endif

View File

@@ -7,39 +7,40 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_DMA_H
#define __ASM_ARM_DMA_H
typedef unsigned int dmach_t;
#include <linux/spinlock.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/system.h>
#include <asm/scatterlist.h>
#include <asm/arch/dma.h>
#ifndef MAX_DMA_ADDRESS
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define MAX_DMA_ADDRESS 0xffffffff
#endif
typedef unsigned int dmamode_t;
#define DMA_MODE_MASK 3
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DMA_MODE_READ 0
#define DMA_MODE_WRITE 1
#define DMA_MODE_CASCADE 2
#define DMA_AUTOINIT 4
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define clear_dma_ff(channel)
#define set_dma_addr(channel, addr) __set_dma_addr(channel, bus_to_virt(addr))
#ifndef NO_DMA
#define NO_DMA 255
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#define isa_dma_bridge_buggy (0)
#endif

View File

@@ -7,26 +7,30 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_PROC_DOMAIN_H
#define __ASM_PROC_DOMAIN_H
#define DOMAIN_KERNEL 0
#define DOMAIN_TABLE 0
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DOMAIN_USER 1
#define DOMAIN_IO 2
#define DOMAIN_NOACCESS 0
#define DOMAIN_CLIENT 1
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define DOMAIN_MANAGER 3
#define domain_val(dom,type) ((type) << (2*(dom)))
#ifndef __ASSEMBLY__
#define set_domain(x) do { } while (0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define modify_domain(dom,type) do { } while (0)
#endif
#endif

View File

@@ -7,11 +7,17 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _ASMARM_DYNTICK_H
#define _ASMARM_DYNTICK_H
#include <asm/mach/time.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,57 +7,58 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASMARM_ELF_H
#define __ASMARM_ELF_H
#include <asm/ptrace.h>
#include <asm/user.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifdef __KERNEL
#include <asm/procinfo.h>
#endif
typedef unsigned long elf_greg_t;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef unsigned long elf_freg_t[3];
#define EM_ARM 40
#define EF_ARM_APCS26 0x08
#define EF_ARM_SOFT_FLOAT 0x200
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_ARM_EABI_MASK 0xFF000000
#define R_ARM_NONE 0
#define R_ARM_PC24 1
#define R_ARM_ABS32 2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define R_ARM_CALL 28
#define R_ARM_JUMP24 29
#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef struct user_fp elf_fpregset_t;
#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
#define ELF_CLASS ELFCLASS32
#ifdef __ARMEB__
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_DATA ELFDATA2MSB
#else
#define ELF_DATA ELFDATA2LSB
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_ARCH EM_ARM
#define USE_ELF_CORE_DUMP
#define ELF_EXEC_PAGESIZE 4096
#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0
#define ELF_HWCAP (elf_hwcap)
#define ELF_PLATFORM_SIZE 8
#define ELF_PLATFORM (elf_platform)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,11 +7,17 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _ARM_ERRNO_H
#define _ARM_ERRNO_H
#include <asm-generic/errno.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,16 +7,22 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _ARM_FCNTL_H
#define _ARM_FCNTL_H
#define O_DIRECTORY 040000
#define O_NOFOLLOW 0100000
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define O_DIRECT 0200000
#define O_LARGEFILE 0400000
#include <asm-generic/fcntl.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,62 +7,63 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_ARM_FPSTATE_H
#define __ASM_ARM_FPSTATE_H
#ifndef __ASSEMBLY__
struct vfp_hard_struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u64 fpregs[16];
#if __LINUX_ARM_ARCH__ < 6
__u32 fpmx_state;
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
__u32 fpexc;
__u32 fpscr;
__u32 fpinst;
__u32 fpinst2;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
union vfp_state {
struct vfp_hard_struct hard;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FP_HARD_SIZE 35
struct fp_hard_struct {
unsigned int save[FP_HARD_SIZE];
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FP_SOFT_SIZE 35
struct fp_soft_struct {
unsigned int save[FP_SOFT_SIZE];
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IWMMXT_SIZE 0x98
struct iwmmxt_struct {
unsigned int save[IWMMXT_SIZE / sizeof(unsigned int)];
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
union fp_state {
struct fp_hard_struct hard;
struct fp_soft_struct soft;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FP_SIZE (sizeof(union fp_state) / sizeof(int))
struct crunch_state {
unsigned int mvdx[16][2];
unsigned int mvax[4][3];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned int dspsc[2];
};
#define CRUNCH_SIZE sizeof(struct crunch_state)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif

View File

@@ -7,5 +7,12 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/

View File

@@ -7,32 +7,37 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_HARDIRQ_H
#define __ASM_HARDIRQ_H
#include <linux/cache.h>
#include <linux/threads.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm/irq.h>
typedef struct {
unsigned int __softirq_pending;
unsigned int local_timer_irqs;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
} ____cacheline_aligned irq_cpustat_t;
#include <linux/irq_cpustat.h>
#if NR_IRQS > 256
#define HARDIRQ_BITS 9
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#else
#define HARDIRQ_BITS 8
#endif
#if 1 << HARDIRQ_BITS < NR_IRQS
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#error HARDIRQ_BITS is too low!
#endif
#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

View File

@@ -7,11 +7,17 @@
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_HARDWARE_H
#define __ASM_HARDWARE_H
#include <asm/arch/hardware.h>
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

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