From owner-freebsd-bugs Thu Apr 23 23:19:36 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA00393 for freebsd-bugs-outgoing; Thu, 23 Apr 1998 23:19:36 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from ghpc8.ihf.rwth-aachen.de (ghpc8.ihf.RWTH-Aachen.DE [134.130.90.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA00387 for ; Thu, 23 Apr 1998 23:19:34 -0700 (PDT) (envelope-from tg@ghpc8.ihf.rwth-aachen.de) Received: from ghpc6.ihf.rwth-aachen.de (ghpc6.ihf.rwth-aachen.de [134.130.90.6]) by ghpc8.ihf.rwth-aachen.de (8.8.7/8.8.6) with ESMTP id IAA04790; Fri, 24 Apr 1998 08:19:14 +0200 (CEST) Received: (from tg@localhost) by ghpc6.ihf.rwth-aachen.de (8.8.8/8.8.5) id IAA00768; Fri, 24 Apr 1998 08:19:13 +0200 (CEST) To: Mike Smith Cc: freebsd-bugs@hub.freebsd.org Subject: Re: kern/6389: Need to be able to access trap-to-signal mapping to for Linux emulation to allow Allegro Common Lisp (and maybe other apps) to run. References: <199804231920.MAA09253@hub.freebsd.org> From: Thomas Gellekum Date: 24 Apr 1998 08:19:12 +0200 In-Reply-To: Mike Smith's message of "Thu, 23 Apr 1998 12:20:01 -0700 (PDT)" Message-ID: <8767jzvj1b.fsf@ghpc6.ihf.rwth-aachen.de> Lines: 72 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Mike Smith writes: > > Index: i386/linux/linux_sysvec.c > > =================================================================== > > RCS file: /home/ncvs/src/sys/i386/linux/linux_sysvec.c,v > > retrieving revision 1.27 Apart from minor formatting changes, my version of linux_sysvec.c looks like this (relative to 2.2.6-STABLE): Index: i386/linux/linux_sysvec.c =================================================================== RCS file: /usr/local/cvs/src/sys/i386/linux/linux_sysvec.c,v retrieving revision 1.9 diff -u -r1.9 linux_sysvec.c --- linux_sysvec.c 1996/10/16 17:51:07 1.9 +++ linux_sysvec.c 1998/04/23 18:07:45 @@ -103,6 +103,32 @@ SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, SIGWINCH, SIGURG, SIGURG, 0 }; +/* + * If FreeBSD & Linux have a difference of opinion about what a trap + * means, deal with it here. + */ +static int +translate_traps(int signal, int trap_code) +{ + switch (signal) { + case SIGBUS: + switch (trap_code) { + case T_PROTFLT: + case T_TSSFLT: + case T_DOUBLEFLT: + case T_PAGEFLT: + return SIGSEGV; + break; + default: + return signal; + break; + } + default: + return signal; + break; + } +} + int linux_fixup(int **stack_base, struct image_params *imgp) { int *argv, *envp; @@ -378,6 +404,7 @@ bsd_to_linux_signal, ELAST, bsd_to_linux_errno, + translate_traps, linux_fixup, linux_sendsig, linux_sigcode, @@ -394,6 +421,7 @@ bsd_to_linux_signal, ELAST, bsd_to_linux_errno, + translate_traps, elf_linux_fixup, linux_sendsig, linux_sigcode, I needed the `case T_PAGEFLT:' to get spicecad to run. The other traps come from my (limited) understanding of Linux' trap.c and handling them may or may not be of practical use. tg To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message