Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Sep 2008 12:02:20 -0700
From:      "Artem Belevich" <fbsdlist@src.cx>
To:        "Kostik Belousov" <kostikbel@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: __tls_get_addr problem with recent current
Message-ID:  <ed91d4a80809021202o18b242b9j3fc19bb191f5dbf7@mail.gmail.com>
In-Reply-To: <20080902153135.GZ2038@deviant.kiev.zoral.com.ua>
References:  <ed91d4a80808300946s49ff076dw64b57f8e9058f2d@mail.gmail.com> <20080830183804.GG2038@deviant.kiev.zoral.com.ua> <ed91d4a80808301250j1a4802d4o412c6b5e30979079@mail.gmail.com> <20080830195844.GI2038@deviant.kiev.zoral.com.ua> <ed91d4a80808301403t5b776d10ubd184bc1ff01215@mail.gmail.com> <20080831071618.GK2038@deviant.kiev.zoral.com.ua> <20080831091639.GM2038@deviant.kiev.zoral.com.ua> <ed91d4a80808311143y73167803y4b3e8e32200116c5@mail.gmail.com> <20080902153135.GZ2038@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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



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