Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Apr 2012 21:29:58 +0000 (UTC)
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r234071 - projects/armv6/libexec/rtld-elf/arm
Message-ID:  <201204092129.q39LTwQX079296@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204092129.q39LTwQX079296>