Date: Sat, 29 Jan 2005 04:44:29 +0000 From: Joseph Koshy <joseph.koshy@gmail.com> To: Rob Watt <rob@hudson-trading.com> Cc: freebsd-amd64@freebsd.org Subject: Re: 32-bit binary compatibility on 5.3-amd64 Message-ID: <84dead72050128204479414c88@mail.gmail.com> In-Reply-To: <20050128105930.V54223@daemon.mistermishap.net> References: <20050127100818.M46092@daemon.mistermishap.net> <84dead72050127201552e14c04@mail.gmail.com> <20050128105930.V54223@daemon.mistermishap.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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. -- FreeBSD Volunteer, http://people.freebsd.org/~jkoshy
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?84dead72050128204479414c88>