Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 2004 16:09:46 GMT
From:      Doug Rabson <dfr@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 57930 for review
Message-ID:  <200407221609.i6MG9kDX006911@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=57930

Change 57930 by dfr@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;
 };
 



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