summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/sysdep.h
diff options
context:
space:
mode:
authorWang Yufen <wangyufen@huawei.com>2014-09-05 15:19:21 +0800
committerWaldemar Brodkorb <wbx@openadk.org>2014-12-06 08:11:14 -0600
commita85df93f5542c04c884b69fcc1febcff6c2e7a39 (patch)
tree286ff04208a4b57338f3458b3c945c622c1fb4cc /libc/sysdeps/linux/arm/sysdep.h
parent6a528e846bc4bf773e7c19d298cfc30e8b50ca99 (diff)
arm: add RESET_PID in the clone impl
Called getpid() When creating a new process with clone(), getpid() returns the father_process's value. It should be child_process's value. The reason is missing a RESET_PID in the arm clone impl. Signed-off-by: Wang Yufen <wangyufen@huawei.com> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Diffstat (limited to 'libc/sysdeps/linux/arm/sysdep.h')
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 64f40407e..2d0a9cc41 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -213,6 +213,42 @@ __local_syscall_error: \
sees the right arguments.
*/
+#if __ARM_ARCH > 6 || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
+# define ARCH_HAS_HARD_TP
+#endif
+
+# ifdef __thumb2__
+# define NEGOFF_ADJ_BASE(R, OFF) add R, R, $OFF
+# define NEGOFF_ADJ_BASE2(D, S, OFF) add D, S, $OFF
+# define NEGOFF_OFF1(R, OFF) [R]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $((OFFA) - (OFFB))]
+# else
+# define NEGOFF_ADJ_BASE(R, OFF)
+# define NEGOFF_ADJ_BASE2(D, S, OFF) mov D, S
+# define NEGOFF_OFF1(R, OFF) [R, $OFF]
+# define NEGOFF_OFF2(R, OFFA, OFFB) [R, $OFFA]
+# endif
+
+# ifdef ARCH_HAS_HARD_TP
+/* If the cpu has cp15 available, use it. */
+# define GET_TLS(TMP) mrc p15, 0, r0, c13, c0, 3
+# else
+/* At this generic level we have no tricks to pull. Call the ABI routine. */
+# define GET_TLS(TMP) \
+ push { r1, r2, r3, lr }; \
+ cfi_remember_state; \
+ cfi_adjust_cfa_offset (16); \
+ cfi_rel_offset (r1, 0); \
+ cfi_rel_offset (r2, 4); \
+ cfi_rel_offset (r3, 8); \
+ cfi_rel_offset (lr, 12); \
+ bl __aeabi_read_tp; \
+ pop { r1, r2, r3, lr }; \
+ cfi_restore_state
+# endif /* ARCH_HAS_HARD_TP */
+
+
+
#undef DO_CALL
#if defined(__ARM_EABI__)