PERFORCE change 57930 for review

Doug Rabson dfr at FreeBSD.org
Thu Jul 22 09:09:47 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=57930

Change 57930 by dfr at dfr_home on 2004/07/22 16:09:46

	Add support for amd64 TLS (untested).

Affected files ...

.. //depot/projects/kse/lib/libpthread/arch/amd64/amd64/pthread_md.c#2 edit
.. //depot/projects/kse/lib/libpthread/arch/amd64/include/pthread_md.h#3 edit

Differences ...

==== //depot/projects/kse/lib/libpthread/arch/amd64/amd64/pthread_md.c#2 (text+ko) ====

@@ -28,6 +28,7 @@
 
 #include <stdlib.h>
 #include <strings.h>
+#include "rtld_tls.h"
 #include "pthread_md.h"
 
 /*
@@ -38,19 +39,19 @@
 {
 	struct tcb *tcb;
 
-	if ((tcb = malloc(sizeof(struct tcb))) != NULL) {
-		bzero(tcb, sizeof(struct tcb));
+	tcb = _rtld_allocate_tls(sizeof(struct tcb), 16);
+	if (tcb) {
 		tcb->tcb_thread = thread;
-		/* Allocate TDV */
+		bzero(&tcb->tcb_tmbx, sizeof(tcb->tcb_tmbx));
 	}
+
 	return (tcb);
 }
 
 void
 _tcb_dtor(struct tcb *tcb)
 {
-	/* Free TDV */
-	free(tcb);
+	_rtld_free_tls(tcb, sizeof(struct tcb), 16);
 }
 
 struct kcb *

==== //depot/projects/kse/lib/libpthread/arch/amd64/include/pthread_md.h#3 (text+ko) ====

@@ -62,9 +62,10 @@
 };
 
 struct tcb {
-	struct tdv		*tcb_tdv;
+	struct tcb		*tcb_self;	/* required by rtld */
+	void			*tcb_dtv;	/* required by rtld */
 	struct pthread		*tcb_thread;
-	void			*tcb_spare[2];	/* align tcb_tmbx to 16 bytes */
+	void			*tcb_spare[1];	/* align tcb_tmbx to 16 bytes */
 	struct kse_thr_mailbox	tcb_tmbx;
 };
 


More information about the p4-projects mailing list