svn commit: r234071 - projects/armv6/libexec/rtld-elf/arm

Olivier Houchard cognet at FreeBSD.org
Mon Apr 9 21:29:58 UTC 2012


Author: cognet
Date: Mon Apr  9 21:29:58 2012
New Revision: 234071
URL: http://svn.freebsd.org/changeset/base/234071

Log:
  I forgot this file when committing the new TLS bits for arm, so implement both
  the old and the new method here too.

Modified:
  projects/armv6/libexec/rtld-elf/arm/reloc.c

Modified: projects/armv6/libexec/rtld-elf/arm/reloc.c
==============================================================================
--- projects/armv6/libexec/rtld-elf/arm/reloc.c	Mon Apr  9 20:59:14 2012	(r234070)
+++ projects/armv6/libexec/rtld-elf/arm/reloc.c	Mon Apr  9 21:29:58 2012	(r234071)
@@ -429,7 +429,9 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 void
 allocate_initial_tls(Obj_Entry *objs)
 {
+#ifdef ARM_TP_ADDRESS
 	void **_tp = (void **)ARM_TP_ADDRESS;
+#endif
 
 	/*
 	* Fix the size of the static TLS block by using the maximum
@@ -439,16 +441,27 @@ allocate_initial_tls(Obj_Entry *objs)
 
 	tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
 
+#ifdef ARM_TP_ADDRESS
 	(*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8);
+#else
+	sysarch(ARM_SET_TP, allocate_tls(objs, NULL, TLS_TCB_SIZE, 8));
+#endif
 }
 
 void *
 __tls_get_addr(tls_index* ti)
 {
-	void **_tp = (void **)ARM_TP_ADDRESS;
 	char *p;
+#ifdef ARM_TP_ADDRESS
+	void **_tp = (void **)ARM_TP_ADDRESS;
 
 	p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset);
+#else
+	void *_tp;
+	__asm __volatile("mrc  p15, 0, %0, c13, c0, 3"		\
+	    : "=r" (_tp));
+	p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset);
+#endif
 
 	return (p);
 }


More information about the svn-src-projects mailing list