Date: Thu, 23 Apr 1998 12:20:01 -0700 (PDT) From: Mike Smith <mike@smith.net.au> To: freebsd-bugs 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: <199804231920.MAA09253@hub.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR kern/6389; it has been noted by GNATS.
From: Mike Smith <mike@smith.net.au>
To: Eivind Eklund <eivind@yes.no>
Cc: gilham@csl.sri.com, freebsd-gnats-submit@FreeBSD.ORG, msmith@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.
Date: Thu, 23 Apr 1998 12:07:24 -0700
> I've gone through these changes and fixed style-problems; here are the
> changes as diffs against today's current with hopefully OK stule.
> This pass a LINT compile (I've not yet tested running with a new
> kernel on my own machine; I'll do this in a few minutes).
Just of curiosity, how does this handle the case where the traphandler
does:
psignal();
return;
ie. never gets to the trapsignal() call?
In particular, I thought this was the case with the T_PROTFLT trap...
> Index: i386/i386/trap.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/i386/i386/trap.c,v
> retrieving revision 1.126
> diff -u -r1.126 trap.c
> --- trap.c 1998/04/15 17:45:07 1.126
> +++ trap.c 1998/04/22 23:31:20
> @@ -545,6 +545,9 @@
> return;
> }
>
> + if (*p->p_sysent->sv_transtrap)
> + i = (*p->p_sysent->sv_transtrap)(i, type);
> +
> trapsignal(p, i, ucode);
>
> #ifdef DEBUG
> Index: i386/ibcs2/ibcs2_sysvec.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_sysvec.c,v
> retrieving revision 1.6
> diff -u -r1.6 ibcs2_sysvec.c
> --- ibcs2_sysvec.c 1997/02/22 09:33:28 1.6
> +++ ibcs2_sysvec.c 1998/04/22 02:59:52
> @@ -49,6 +49,7 @@
> bsd_to_ibcs2_sig,
> ELAST,
> bsd_to_ibcs2_errno,
> + 0, /* Trap-to-signal translation function */
> 0, /* fixup */
> sendsig,
> sigcode, /* use generic trampoline */
> Index: i386/linux/linux_sysvec.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/i386/linux/linux_sysvec.c,v
> retrieving revision 1.27
> diff -u -r1.27 linux_sysvec.c
> --- linux_sysvec.c 1998/04/13 17:49:51 1.27
> +++ linux_sysvec.c 1998/04/22 23:21:09
> @@ -98,6 +98,31 @@
> 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:
> + return SIGSEGV;
> +
> + default:
> + return signal;
> + }
> +
> + default:
> + return signal;
> + }
> +}
> +
> +
> static int
> linux_fixup(int **stack_base, struct image_params *imgp)
> {
> @@ -374,6 +399,7 @@
> bsd_to_linux_signal,
> ELAST,
> bsd_to_linux_errno,
> + translate_traps,
> linux_fixup,
> linux_sendsig,
> linux_sigcode,
> @@ -390,6 +416,7 @@
> bsd_to_linux_signal,
> ELAST,
> bsd_to_linux_errno,
> + translate_traps,
> elf_linux_fixup,
> linux_sendsig,
> linux_sigcode,
> Index: kern/imgact_elf.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/imgact_elf.c,v
> retrieving revision 1.23
> diff -u -r1.23 imgact_elf.c
> --- imgact_elf.c 1998/03/28 13:24:52 1.23
> +++ imgact_elf.c 1998/04/22 23:22:31
> @@ -78,6 +78,7 @@
> 0,
> 0,
> 0,
> + 0,
> elf_freebsd_fixup,
> sendsig,
> sigcode,
> Index: kern/init_sysvec.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/kern/init_sysvec.c,v
> retrieving revision 1.5
> diff -u -r1.5 init_sysvec.c
> --- init_sysvec.c 1997/08/02 14:31:26 1.5
> +++ init_sysvec.c 1998/04/22 02:57:51
> @@ -19,6 +19,7 @@
> 0,
> 0,
> 0,
> + 0,
> sendsig,
> sigcode,
> &szsigcode,
> Index: sys/sysent.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/sys/sysent.h,v
> retrieving revision 1.16
> diff -u -r1.16 sysent.h
> --- sysent.h 1998/02/03 21:51:57 1.16
> +++ sysent.h 1998/04/22 23:32:51
> @@ -58,6 +58,8 @@
> int *sv_sigtbl; /* signal translation table */
> int sv_errsize; /* size of errno translation table */
> int *sv_errtbl; /* errno translation table */
> + int (*sv_transtrap) __P((int, int));
> + /* translate trap-to-signal mapping */
> int (*sv_fixup) __P((int **, struct image_params *));
> /* stack fixup function */
> void (*sv_sendsig) __P((void (*)(int), int, int, u_long));
>
--
\\ Sometimes you're ahead, \\ Mike Smith
\\ sometimes you're behind. \\ mike@smith.net.au
\\ The race is long, and in the \\ msmith@freebsd.org
\\ end it's only with yourself. \\ msmith@cdrom.com
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804231920.MAA09253>
