__tls_get_addr problem with recent current

Kostik Belousov kostikbel at gmail.com
Sat Aug 30 19:58:51 UTC 2008

On Sat, Aug 30, 2008 at 12:50:04PM -0700, Artem Belevich wrote:
> Patch seems to have fixed the problem. The build that used to fail
> immediatelly has been going on for few minutes now with no crashes so
> far.
> Thanks a lot for the quick fix!

Hmm, after I sent the patch, I started thought that, in fact, we shall
reread the fsbase when switching from 32bit process, not when switching
to such process. Could you, please, retest with the following change
(against stock sources, not over the previous patch) ?

diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index f34b0cc..29ce2e1 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -249,6 +249,10 @@ store_seg:
 1:	movl	%ds,PCB_DS(%r8)
 	movl	%es,PCB_ES(%r8)
 	movl	%fs,PCB_FS(%r8)
+	movl	$MSR_FSBASE,%ecx
+	rdmsr
+	shlq	$32,%rdx
+	leaq	(%rax,%rdx),%r9
 	jmp	done_store_seg
 2:	movq	PCB_GS32P(%r8),%rax
 	movq	(%rax),%rax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20080830/e2c427f7/attachment.pgp

More information about the freebsd-current mailing list