summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorpb <pb@FreeBSD.org>2001-11-20 09:39:31 +0000
committerpb <pb@FreeBSD.org>2001-11-20 09:39:31 +0000
commitdc2b3d61ed05a6e9e2c4e6c40ee79544d8b6c06b (patch)
tree23476fd8f377cb4963c5f63db8225243051e1779 /sys/i386
parent7d5b8c2066583505f34798cd467777204053efe0 (diff)
downloadFreeBSD-src-dc2b3d61ed05a6e9e2c4e6c40ee79544d8b6c06b.zip
FreeBSD-src-dc2b3d61ed05a6e9e2c4e6c40ee79544d8b6c06b.tar.gz
Convert BSD trap codes to i386.
Submitted by: F. Gouget <fgouget@free.fr>
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/linux/linux_sysvec.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 70ea5bd..0247c58 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -138,6 +138,45 @@ int linux_to_bsd_signal[LINUX_SIGTBLSZ] = {
SIGIO, SIGURG, 0
};
+#define LINUX_T_UNKNOWN 255
+static int _bsd_to_linux_trapcode[] = {
+ LINUX_T_UNKNOWN, /* 0 */
+ 6, /* 1 T_PRIVINFLT */
+ LINUX_T_UNKNOWN, /* 2 */
+ 3, /* 3 T_BPTFLT */
+ LINUX_T_UNKNOWN, /* 4 */
+ LINUX_T_UNKNOWN, /* 5 */
+ 16, /* 6 T_ARITHTRAP */
+ 254, /* 7 T_ASTFLT */
+ LINUX_T_UNKNOWN, /* 8 */
+ 13, /* 9 T_PROTFLT */
+ 1, /* 10 T_TRCTRAP */
+ LINUX_T_UNKNOWN, /* 11 */
+ 14, /* 12 T_PAGEFLT */
+ LINUX_T_UNKNOWN, /* 13 */
+ 17, /* 14 T_ALIGNFLT */
+ LINUX_T_UNKNOWN, /* 15 */
+ LINUX_T_UNKNOWN, /* 16 */
+ LINUX_T_UNKNOWN, /* 17 */
+ 0, /* 18 T_DIVIDE */
+ 2, /* 19 T_NMI */
+ 4, /* 20 T_OFLOW */
+ 5, /* 21 T_BOUND */
+ 7, /* 22 T_DNA */
+ 8, /* 23 T_DOUBLEFLT */
+ 9, /* 24 T_FPOPFLT */
+ 10, /* 25 T_TSSFLT */
+ 11, /* 26 T_SEGNPFLT */
+ 12, /* 27 T_STKFLT */
+ 18, /* 28 T_MCHK */
+ 19, /* 29 T_XMMFLT */
+ 15 /* 30 T_RESERVED */
+};
+#define bsd_to_linux_trapcode(code) \
+ ((code)<sizeof(_bsd_to_linux_trapcode)/sizeof(*_bsd_to_linux_trapcode)? \
+ _bsd_to_linux_trapcode[(code)]: \
+ LINUX_T_UNKNOWN)
+
/*
* If FreeBSD & Linux have a difference of opinion about what a trap
* means, deal with it here.
@@ -321,7 +360,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
frame.sf_sc.uc_mcontext.sc_esp_at_signal = regs->tf_esp;
frame.sf_sc.uc_mcontext.sc_ss = regs->tf_ss;
frame.sf_sc.uc_mcontext.sc_err = regs->tf_err;
- frame.sf_sc.uc_mcontext.sc_trapno = code; /* XXX ???? */
+ frame.sf_sc.uc_mcontext.sc_trapno = bsd_to_linux_trapcode(code);
#ifdef DEBUG
if (ldebug(rt_sendsig))
@@ -458,7 +497,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
frame.sf_sc.sc_esp_at_signal = regs->tf_esp;
frame.sf_sc.sc_ss = regs->tf_ss;
frame.sf_sc.sc_err = regs->tf_err;
- frame.sf_sc.sc_trapno = code; /* XXX ???? */
+ frame.sf_sc.sc_trapno = bsd_to_linux_trapcode(code);
bzero(&frame.sf_fpstate, sizeof(struct l_fpstate));
OpenPOWER on IntegriCloud