Commit graph

38 commits

Author SHA1 Message Date
Duane Sand
61d9ae5ab1 [MIPS] Invalidate cached pid in vfork.
Bug: http://b/23008979
Change-Id: I43e0c7db42602441313af4607a992caa8c7d6221
2015-08-12 02:28:05 +00:00
Elliott Hughes
469b418784 Fix two accidentally leaked mips64 symbols.
Bug: http://b/21857154
Change-Id: Ie1fb63f54c6c527b8c1172e8f6ce48f23fca9b41
2015-06-15 17:49:54 -07:00
Dmitriy Ivanov
f327fae69c Include pthread_atfork.h to mips64 crtbegin
Bug: http://b/20339788
Change-Id: I2a8c7881f90a05ca768cb9b4c2f8b07c74c64469
2015-04-25 11:59:32 -07:00
Nikola Veljkovic
daf8911079 [MIPS64] Fix mips64 build.
Build was broken by:
https://android-review.googlesource.com/133834

Use <unistd.h> to get syscall().
Remove <asm/unistd.h>, it gets included through <sys/syscall.h>.

Change-Id: Id762f6dea5f9538c19b79cdd46deda978efd50fe
2015-02-23 16:21:31 +01:00
Raghu Gandham
86d2feef9f Modify MIPS64 stat structure to match a generic one in AOSP.
The kernel version of the stat structure is used during the syscalls. After the syscall,
the kernel stat structure is converted to match the generic one. Eventually we would like
the generic stat structure and related syscalls be added to MIPS64 kernel, removing the
thunks added to AOSP.

Change-Id: I7764e80278c1cc8254754c3531ec2dda7544a8ec
2015-01-28 16:12:17 -08:00
Elliott Hughes
d27ae2f8d7 Merge mips setjmp/longjmp family.
Bug: 16918359
Change-Id: I9033a7d178d431ddb09f1cfa6e4bf95ae02346e9
2014-12-08 17:07:53 -08:00
Duane Sand
3a4786348e [MIPS] Rewrite of setjmp/longjmp for mips64 and mipsr6
Change-Id: Idcd13413520dd503bc9cf782553675313e500a83
2014-11-25 17:33:10 -08:00
Dmitriy Ivanov
4ae178f81d Mips: remove arch-specific atexit.h
Change-Id: I687ff4ead6c5e81db44782bf851cb84f87bfe085
2014-11-21 14:42:53 -08:00
Dmitriy Ivanov
e3e8d15f23 Mips: Remove unused files
Change-Id: If98b832ee32f6dcd9f5d7ae21c601c210adfad6b
2014-11-21 14:29:43 -08:00
Dmitriy Ivanov
c619603a31 Mips: Reuse atexit.h from libc/arch-common
Change-Id: Ica1670e6d3d1b6b0c64df93720efa65586e67727
2014-11-21 13:07:36 -08:00
Elliott Hughes
011e111d29 Ensure __set_errno is still visible on LP32.
The use of the .hidden directive to avoid going via the PLT for
__set_errno had the side-effect of actually making __set_errno
hidden (which is odd because assembler directives don't usually
affect symbols defined in a different file --- you can't even
create a weak reference to a symbol that's defined in a different
file).

This change switches the system call stubs over to a new always-hidden
__set_errno_internal and has a visible __set_errno on LP32 just for
binary compatibility with old NDK apps.

(cherry-pick of 7efad83d430f4d824f2aaa75edea5106f6ff8aae.)

Bug: 17423135
Change-Id: I6b6d7a05dda85f923d22e5ffd169a91e23499b7b
2014-09-08 16:46:50 -07:00
Dmitriy Ivanov
4b41555ba5 Revert "Register __libc_fini as early as possible."
This reverts commit e880c736d6.

Change-Id: Ide83e442eb5dbfef5298a15bc602c3fe1dda1862
2014-09-04 21:54:34 +00:00
Dmitriy Ivanov
e880c736d6 Register __libc_fini as early as possible.
We want __libc_fini to be called after all the destructors.

Bug: 14611536
Change-Id: Ibb83a94436795ec178fd605fa531ac29608f4a3e
2014-09-03 15:27:29 -07:00
Chris Dearman
296895f1a9 MIPS64 syscall() arguments
The seventh argument for syscall is passed in a register, not on the stack

Change-Id: Idb69fac77d1f710cff5a3ab4ae1259feb61ae69d
2014-09-02 12:41:01 -07:00
Elliott Hughes
57b7a6110e Fix pthread_getattr_np for the main thread.
On most architectures the kernel subtracts a random offset to the stack
pointer in create_elf_tables by calling arch_align_stack before writing
the auxval table and so on. On all but x86 this doesn't cause a problem
because the random offset is less than a page, but on x86 it's up to two
pages. This means that our old technique of rounding the stack pointer
doesn't work. (Our old implementation of that technique was wrong too.)

It's also incorrect to assume that the main thread's stack base and size
are constant. Likewise to assume that the main thread has a guard page.
The main thread is not like other threads.

This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK)
whenever we're asked.

Bug: 17111575
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
Change-Id: I1d4dbffe7bc7bda1d353c3a295dbf68d29f63158
2014-08-26 10:36:38 -07:00
Dan Albert
6a918870ba Revert "Replaces vfork() implementation with fork()"
We're getting cold feet on this one... let's put it back.

This reverts commit 210331d976.

Change-Id: I6b0d3c2b1dbf7f1dc9566979a91b7504c2189269
2014-08-05 14:11:38 -07:00
Duane Sand
dd37251c47 [MIPSR6] setjmp supports mips32r6 and FP64A/FPXX reg models
Save and restore floating point registers via 64-bit
load/stores when possible.  Use assembler's builtin macro
ops to generate pairs of 32-bit load/stores on Mips I cpus.

Some cpus or FR modes have only 16 even-numbered dp fp regs.
This is exposed by _MIPS_FPSET, defined by existing compilers.

Change-Id: I7f617a3ffea8da41c402ef3a68ab32c91d3d7622
2014-07-23 13:57:30 -07:00
Elliott Hughes
24614b4729 Remove __memcmp16 from bionic.
Change-Id: I2486d667d96c8900dd368d855f37c1327161efb7
2014-06-12 15:35:22 -07:00
Dan Albert
440bd6bcc3 Merge "Replaces vfork() implementation with fork()" 2014-06-10 22:08:45 +00:00
Dan Albert
210331d976 Replaces vfork() implementation with fork()
vfork() was removed from POSIX 2008, so this replaces its implementation
with a call to fork().

Bug: 13935372
Change-Id: I6d99ac9e52a2efc5ee9bda1cab908774b830cedc
2014-06-10 21:38:52 -07:00
Elliott Hughes
1c60f8080a Merge "Rename __bionic_clone_entry to __start_thread." 2014-06-06 22:24:44 +00:00
Elliott Hughes
ebc8cd117a Rename __bionic_clone_entry to __start_thread.
This seems a bit less obscure.

Change-Id: I7dc528c253b73c861694f67556ad8f919bf92136
2014-06-06 15:18:54 -07:00
Elliott Hughes
3d5cb30d23 Remove getdents from bionic.
Bug: 11156955
Change-Id: I6c306989801be552d85fba8a50dcdc79282fb9d2
2014-06-06 15:05:58 -07:00
Dan Albert
ce9ce28e5d Removes bcopy and bzero from bionic.
These symbols are still defined for LP32 for binary compatibility, but
the declarations have been replaced with the POSIX recommended #defines.

Bug: 13935372
Change-Id: Ief7e6ca012db374588ba5839f11e8f3a13a20467
2014-06-03 17:22:07 -07:00
Elliott Hughes
b30aff405a Revert "Revert "Lose the hand-written futex assembler.""
The problem with the original patch was that using syscall(3) means that
errno can be set, but pthread_create(3) was abusing the TLS errno slot as
a pthread_mutex_t for the thread startup handshake.

There was also a mistake in the check for syscall failures --- it should
have checked against -1 instead of 0 (not just because that's the default
idiom, but also here because futex(2) can legitimately return values > 0).

This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to
pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) >
sizeof(uintptr_t), so we could potentially clobber other TLS slots too.)

I've also rewritten the LP32 compatibility stubs to directly reuse the
code from the .h file.

This reverts commit 75c55ff84e.

Bug: 15195455
Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
2014-05-28 18:31:15 -07:00
Narayan Kamath
52f74322b1 Merge "Revert "Lose the hand-written futex assembler."" 2014-05-28 18:04:26 +00:00
Narayan Kamath
75c55ff84e Revert "Lose the hand-written futex assembler."
This reverts commit ced906c849.

Causes issues on art / dalvik due to a broken return value
check and other undiagnosed issues.

bug: 15195455

Change-Id: I5d6bbb389ecefb0e33a5237421a9d56d32a9317c
2014-05-28 18:03:01 +00:00
Elliott Hughes
e7dccdf683 Clear the return address register in __bionic_clone.
The unwinder will end up on the parent thread's stack if the return
address register is not cleared.

Bug: 14270816
Bug: 15195760
Change-Id: Iebcdf5cc881cad245643bb193760de35eb7f8b19
2014-05-27 15:49:51 -07:00
Elliott Hughes
ced906c849 Lose the hand-written futex assembler.
Also stop exporting 'futex'.

Bug: 12250341
Change-Id: Icc4fa4296cd04dfe0d1061822c69e2eb40c3433a
2014-05-22 19:49:11 -07:00
Elliott Hughes
d5ed63a6a8 Hide most of the private futex functions.
Also hide part of the system properties compatibility code, since
we needed to touch that to keep it building.

I'll remove __futex_syscall4 and futex in a later patch.

Bug: 11156955
Change-Id: Ibbf42414c5bb07fb9f1c4a169922844778e4eeae
2014-05-21 18:30:00 -07:00
Elliott Hughes
c3705f6415 Hide __get_sp.
Bug: 11156955
Change-Id: I55d8d320521e80c2085af28933a18b00cf5c714e
2014-05-20 20:22:50 -07:00
Elliott Hughes
31d0398de6 Hide _exit_with_stack_teardown.
Bug: 11156955
Change-Id: Ida3020343c9975177dc324918cd1f10c455eb173
2014-05-16 16:17:44 -07:00
Elliott Hughes
dcbef06ce6 Remove the useless indirection in mips' __set_tls.
Change-Id: I12e9d6716c42ccbccc9a186441aca0736bb22d05
2014-05-12 16:11:06 -07:00
Elliott Hughes
954cf0d4e2 Hide the __bionic_clone and __bionic_clone_entry implementation details.
clone(2) is the public symbol.

Also switch a test from __bionic_clone to clone; testing public API
means the test now works on glibc too.

Change-Id: If59def26a00c3afadb8a6cf9442094c35a59ffde
2014-05-08 19:00:23 -07:00
Elliott Hughes
851e68a240 Unify our assembler macros.
Our <machine/asm.h> files were modified from upstream, to the extent
that no architecture was actually using the upstream ENTRY or END macros,
assuming that architecture even had such a macro upstream. This patch moves
everyone to the same macros, with just a few tweaks remaining in the
<machine/asm.h> files, which no one should now use directly.

I've removed most of the unused cruft from the <machine/asm.h> files, though
there's still rather a lot in the mips/mips64 ones.

Bug: 12229603
Change-Id: I2fff287dc571ac1087abe9070362fb9420d85d6d
2014-02-20 13:51:26 -08:00
Elliott Hughes
9abbbdc534 Make mips/mips64 syscall stubs more like the other architectures.
Change-Id: I55f8c1a95f643a6e484f12fbcc25e2c77e55b6b8
2014-02-19 14:54:31 -08:00
Elliott Hughes
a6ecba4d23 Clean up cacheflush.
No cacheflush for LP64; use the GCC builtin instead. Clean up the
32-bit MIPS implementation now we no longer need to worry about
old versions of GCC.

Bug: 12924756
Change-Id: Ie23955b3ec194e226c4b2bce35b11d5e061f4753
2014-02-11 10:24:40 -08:00
Chris Dearman
645d0312c2 [MIPS64] libc/libm support
libc/libm support for MIPS64 targets

Change-Id: I8271941d418612a286be55495f0e95822f90004f
Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Raghu Gandham <raghu.gandham@imgtec.com>
2014-02-06 16:22:20 -08:00