__tls_get_addr problem with recent current
Artem Belevich
fbsdlist at src.cx
Tue Sep 2 19:02:24 UTC 2008
The latest patch works fine.
> Ok, below is the updated patch, that fixes additional problem with
> execution of 64bit binaries from 32bit processes. I am not sure whether
> your test load includes such operation, but it cannot hurt anyway.
Yes, my workload does include running 64-bit binaries from 32-bit ones.
--Artem
On 9/2/08, Kostik Belousov <kostikbel at gmail.com> wrote:
> On Sun, Aug 31, 2008 at 11:43:08AM -0700, Artem Belevich wrote:
> > I'll not be able to try it till Tuesday. I've been running these
> > experiments on a remote box without remotely accessible console. At
> > some point yesterday the box had failed to reboot, so no more
> > experiments untill I get back to work and restart the system.
>
>
> Ok, below is the updated patch, that fixes additional problem with
> execution of 64bit binaries from 32bit processes. I am not sure whether
> your test load includes such operation, but it cannot hurt anyway.
>
>
> diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
> index f34b0cc..03f0eca 100644
> --- a/sys/amd64/amd64/cpu_switch.S
> +++ b/sys/amd64/amd64/cpu_switch.S
> @@ -249,6 +249,12 @@ store_seg:
> 1: movl %ds,PCB_DS(%r8)
> movl %es,PCB_ES(%r8)
> movl %fs,PCB_FS(%r8)
> + movq %rdx,%r11
> + movl $MSR_FSBASE,%ecx
> + rdmsr
> + shlq $32,%rdx
> + leaq (%rax,%rdx),%r9
> + movq %r11,%rdx
> jmp done_store_seg
> 2: movq PCB_GS32P(%r8),%rax
> movq (%rax),%rax
>
> diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
> index 06c0803..f3c41f7 100644
> --- a/sys/amd64/amd64/machdep.c
> +++ b/sys/amd64/amd64/machdep.c
> @@ -734,6 +734,7 @@ exec_setregs(td, entry, stack, ps_strings)
> pcb->pcb_fsbase = 0;
> pcb->pcb_gsbase = 0;
> critical_exit();
> + pcb->pcb_flags &= ~(PCB_32BIT | PCB_GS32BIT);
> load_ds(_udatasel);
> load_es(_udatasel);
> load_fs(_udatasel);
> diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
> index 9e98656..162dcf9 100644
> --- a/sys/amd64/ia32/ia32_signal.c
> +++ b/sys/amd64/ia32/ia32_signal.c
> @@ -742,5 +742,6 @@ ia32_setregs(td, entry, stack, ps_strings)
>
> /* Return via doreti so that we can change to a different %cs */
> pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT;
> + pcb->pcb_flags &= ~PCB_GS32BIT;
> td->td_retval[1] = 0;
> }
>
>
--
--Artem
More information about the freebsd-current
mailing list