Date: 24 Apr 1998 08:19:12 +0200 From: Thomas Gellekum <tg@ihf.rwth-aachen.de> To: Mike Smith <mike@smith.net.au> 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. Message-ID: <8767jzvj1b.fsf@ghpc6.ihf.rwth-aachen.de> In-Reply-To: Mike Smith's message of "Thu, 23 Apr 1998 12:20:01 -0700 (PDT)" References: <199804231920.MAA09253@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith <mike@smith.net.au> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8767jzvj1b.fsf>