Re: __tls_get_addr problem with recent current

From: Artem Belevich <fbsdlist_at_src.cx>
Date: Tue, 2 Sep 2008 12:02:20 -0700
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
>  _at__at_ -249,6 +249,12 _at__at_ 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
>  _at__at_ -734,6 +734,7 _at__at_ 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
>  _at__at_ -742,5 +742,6 _at__at_ 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
Received on Tue Sep 02 2008 - 17:02:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:34 UTC