From owner-freebsd-emulation Tue Aug 24 6:23:18 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from mail.scc.nl (node1374.a2000.nl [62.108.19.116]) by hub.freebsd.org (Postfix) with ESMTP id 3F02714CA5 for ; Tue, 24 Aug 1999 06:23:11 -0700 (PDT) (envelope-from freebsd-emulation@scc.nl) Received: (from daemon@localhost) by mail.scc.nl (8.9.3/8.9.3) id PAA93030 for emulation@FreeBSD.ORG; Tue, 24 Aug 1999 15:00:02 +0200 (CEST) (envelope-from freebsd-emulation@scc.nl) Received: from GATEWAY by dwarf.hq.scc.nl with netnews for emulation@FreeBSD.ORG (emulation@FreeBSD.ORG) To: emulation@FreeBSD.ORG Date: Tue, 24 Aug 1999 15:00:00 +0200 From: Marcel Moolenaar Message-ID: <37C2974F.60536A3C@scc.nl> Organization: SCC vof Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: SIGBUS for threaded Linux binaries (glibc2.1) [PSL_AC related?] Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, I'm having a problem (well, multiple :-), but this one is related to threaded Linux binaries, using glibc2.1 libraries. Let's pick such a binary: StarOffice 5.1 When SO5.1 is run with glibc2, all is fine. But when run with glibc2.1 SO5.1 SIGBUSes. A gdb(1) session reveals that the SIGBUS occurs in pthread_initialize(). A fragment is given below: 0x28118f4b : pushf 0x28118f4c : popl %edx 0x28118f4d : movl %edx,%eax 0x28118f4f : xorl $0x40000,%eax 0x28118f54 : pushl %eax 0x28118f55 : popf 0x28118f56 : pushf 0x28118f57 : popl %eax 0x28118f58 : xorl %edx,%eax 0x28118f5a : andl $0x40000,%eax 0x28118f5f : pushl %edx 0x28118f60 : popf 0x28118f61 : testl %eax,%eax 0x28118f63 : setne %dl gdb(1) tells me: Program terminated with signal 10, Bus error. #0 0x28118f56 in ?? () What this piece of code does (IINM) is toggle the AC (Alignment Check) bit in the flags register and verifies that it has changed and sets %dl to reflect that. From looking at /sys/i386/psl.h I conclude that AC is off by default and that the piece of code sets the bit. The comment in psl.h says: [snip] Changes to PSL_AC are silently ignored on 386's. Which tends me to think that they are not ignored on 486 and up. Am I correct in concluding that changing PSL_AC is responsible for the SIGBUS? [if not, then skip to end of mail] IINM then Linux has PSL_AC set by default (see arch/i386/kernel/vm86.c) for 486 and up. This means that the code fragment given above clears that bit. This doesn't seem to give any problems, because SO5.1 works on Linux (duh :-) Is the SIGBUS avoided if we also have PSL_AC in FreeBSD by default? Are there any reasons why we couldn't set PSL_AC in FreeBSD by default? Thoughts? -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ Amsterdam, The Netherlands tel: +31 20 4200655 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message