Date: Mon, 31 Jan 2005 17:55:00 -0500 From: John Baldwin <jhb@FreeBSD.org> To: freebsd-amd64@FreeBSD.org, Joseph Koshy <joseph.koshy@gmail.com> Cc: Rob Watt <rob@hudson-trading.com> Subject: Re: 32-bit binary compatibility on 5.3-amd64 Message-ID: <200501311755.00391.jhb@FreeBSD.org> In-Reply-To: <84dead72050128204479414c88@mail.gmail.com> References: <20050127100818.M46092@daemon.mistermishap.net> <20050128105930.V54223@daemon.mistermishap.net> <84dead72050128204479414c88@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 28 January 2005 11:44 pm, Joseph Koshy wrote: > rw> a ktrace is attached for this sample code: > > Here is the culprit: > > src/lib/libc/i386/gen/_set_tp.c: > > sel = i386_set_ldt(LDT_AUTO_ALLOC, &ldt, 1); > __asm __volatile("movl %0,%%gs" : : "rm" ((sel << 3) | 7)); > > i386_set_ldt() will return -1 on the AMD64 since this > function is not supported there. The lack of error checking > means that -1 will be attempted to be loaded into %gs by the > movl instruction, leading to a processor protection fault and > a process SIGSEGV. > > Compiling your sample program with '-static' under a 4.X > environment yields an executable that runs on the AMD64. > > On 5.X both statically linked and dynamically linked > executables appear to call _init_tls() and _set_tp() > and are consequently not usable in IA32 emulation > mode. > > Clearly our IA32 emulation needs work. I've no idea > why we don't support a sysarch(I386_{GET,SET}_LDT) operation > for IA32 executables. Because amd64 doesn't have LDTs. Peter has hacks in place in the dynamic 32-bit libraries that amd64 uses to use the different backing methods for implementing TLS on amd64, but that stuff wasn't in 5.3. It might be in 5.3-STABLE. -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501311755.00391.jhb>