Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2005 13:10:25 GMT
From:      David Xu <davidxu@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 75479 for review
Message-ID:  <200504181310.j3IDAPoL095498@repoman.freebsd.org>

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

Change 75479 by davidxu@davidxu_alona on 2005/04/18 13:09:48

	cleanup tls code a bit.

Affected files ...

.. //depot/projects/davidxu_thread/src/sys/alpha/alpha/vm_machdep.c#7 edit
.. //depot/projects/davidxu_thread/src/sys/arm/arm/vm_machdep.c#8 edit
.. //depot/projects/davidxu_thread/src/sys/i386/i386/vm_machdep.c#9 edit
.. //depot/projects/davidxu_thread/src/sys/ia64/ia64/vm_machdep.c#7 edit
.. //depot/projects/davidxu_thread/src/sys/kern/kern_thr.c#16 edit
.. //depot/projects/davidxu_thread/src/sys/powerpc/powerpc/vm_machdep.c#7 edit
.. //depot/projects/davidxu_thread/src/sys/sparc64/sparc64/vm_machdep.c#8 edit
.. //depot/projects/davidxu_thread/src/sys/sys/proc.h#14 edit

Differences ...

==== //depot/projects/davidxu_thread/src/sys/alpha/alpha/vm_machdep.c#7 (text+ko) ====

@@ -361,9 +361,9 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-        int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
+
 	if (td != curthread)
 		td->td_pcb->pcb_hw.apcb_unique = (unsigned long)tls_base;
 	else

==== //depot/projects/davidxu_thread/src/sys/arm/arm/vm_machdep.c#8 (text+ko) ====

@@ -53,6 +53,7 @@
 #include <sys/sf_buf.h>
 #include <machine/cpu.h>
 #include <machine/pcb.h>
+#include <machine/sysarch.h>
 #include <vm/vm.h>
 #include <vm/pmap.h>
 #include <sys/lock.h>
@@ -292,10 +293,16 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-        int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
-	td->td_md.md_tp = tls_base;
+
+	if (td != curthread)
+		td->td_md.md_tp = tls_base;
+	else {
+		critical_enter();
+		*(void **)ARM_TP_ADDRESS = tls_base;
+		critical_exit();
+	}
 }
 
 void

==== //depot/projects/davidxu_thread/src/sys/i386/i386/vm_machdep.c#9 (text+ko) ====

@@ -470,8 +470,7 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-	int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
 	struct segment_descriptor sd;
 	uint32_t base;
@@ -493,14 +492,14 @@
 	sd.sd_xx    = 0;
 	sd.sd_def32 = 1;
 	sd.sd_gran  = 1;
-	mtx_lock_spin(&sched_lock);
-	/* current only uses %gs */
+	critical_enter();
+	/* set %gs */
 	td->td_pcb->pcb_gsd = sd;
 	if (td == curthread) {
 		PCPU_GET(fsgs_gdt)[1] = sd;
 		load_gs(GSEL(GUGS_SEL, SEL_UPL));
 	}
-	mtx_unlock_spin(&sched_lock);
+	critical_exit();
 }
 
 /*

==== //depot/projects/davidxu_thread/src/sys/ia64/ia64/vm_machdep.c#7 (text+ko) ====

@@ -210,8 +210,7 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-        int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
 	td->td_frame->tf_special.tp = (unsigned long)tls_base;
 }

==== //depot/projects/davidxu_thread/src/sys/kern/kern_thr.c#16 (text+ko) ====

@@ -248,7 +248,7 @@
 	/* Set upcall address to user thread entry function. */
 	cpu_set_upcall_kse(newtd, param.start_func, param.arg, &stack);
 	/* Setup user TLS address and TLS pointer register. */
-	cpu_set_user_tls(newtd, param.tls_base, param.tls_size, param.tls_seg);
+	cpu_set_user_tls(newtd, param.tls_base);
 	if ((td->td_proc->p_flag & P_HADTHREADS) == 0) {
 		/* Treat initial thread as it has PTHREAD_SCOPE_PROCESS. */
 		p->p_procscopegrp = kg;

==== //depot/projects/davidxu_thread/src/sys/powerpc/powerpc/vm_machdep.c#7 (text+ko) ====

@@ -356,8 +356,8 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-        int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
+
 	td->td_frame->fixreg[2] = (register_t)tls_base;
 }

==== //depot/projects/davidxu_thread/src/sys/sparc64/sparc64/vm_machdep.c#8 (text+ko) ====

@@ -197,9 +197,9 @@
 }
 
 void
-cpu_set_user_tls(struct thread *td, void *tls_base, size_t tls_size,
-        int tls_seg __unused)
+cpu_set_user_tls(struct thread *td, void *tls_base)
 {
+
 	if (td == curthread)
 		flushw();
 	td->td_frame->tf_global[7] = tls_base;

==== //depot/projects/davidxu_thread/src/sys/sys/proc.h#14 (text+ko) ====

@@ -893,7 +893,7 @@
 void	kseinit(void);
 void	cpu_set_upcall(struct thread *td, struct thread *td0);
 void	cpu_set_upcall_kse(struct thread *, void (*)(void *), void *, stack_t *);
-void	cpu_set_user_tls(struct thread *, void *tls_base, size_t tls_size, int tls_seg);
+void	cpu_set_user_tls(struct thread *, void *tls_base);
 void	cpu_thread_clean(struct thread *);
 void	cpu_thread_exit(struct thread *);
 void	cpu_thread_setup(struct thread *td);



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