Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Fix siginfo support for amiga, mac68k, and sun3:
details: https://anonhg.NetBSD.org/src/rev/15599ceece5c
branches: trunk
changeset: 937169:15599ceece5c
user: rin <rin%NetBSD.org@localhost>
date: Mon Aug 10 10:51:21 2020 +0000
description:
Fix siginfo support for amiga, mac68k, and sun3:
- T_ZERODIV is integer divide by zero. Therefore, ksi_code should be
FPE_INTDIV, not FPE_FLTDIV.
- Set ksi_addr for SIGTRAP. Also, set TRAP_BRKPT or TRAP_TRACE to
ksi_code appropriately.
This fixes some tests in lib/libc/sys and lib/libc/gen.
XXX
Apply similar fixes to other m68k ports.
diffstat:
sys/arch/amiga/amiga/trap.c | 11 ++++++++---
sys/arch/mac68k/mac68k/trap.c | 13 +++++++++----
sys/arch/sun3/sun3/trap.c | 13 +++++++++----
3 files changed, 26 insertions(+), 11 deletions(-)
diffs (124 lines):
diff -r 90f078647954 -r 15599ceece5c sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c Mon Aug 10 10:42:10 2020 +0000
+++ b/sys/arch/amiga/amiga/trap.c Mon Aug 10 10:51:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.138 2019/11/21 19:23:58 ad Exp $ */
+/* $NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
#include "opt_m68k_arch.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.138 2019/11/21 19:23:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -573,7 +573,7 @@
* divde by zero, CHK/TRAPV inst
*/
case T_ZERODIV|T_USER:
- ksi.ksi_code = FPE_FLTDIV;
+ ksi.ksi_code = FPE_INTDIV;
case T_CHKINST|T_USER:
case T_TRAPVINST|T_USER:
ksi.ksi_addr = (void *)(int)fp->f_format;
@@ -674,7 +674,12 @@
}
#endif
fp->f_sr &= ~PSL_T;
+ ksi.ksi_addr = (void *)fp->f_pc;
ksi.ksi_signo = SIGTRAP;
+ if (type == (T_TRAP15|T_USER))
+ ksi.ksi_code = TRAP_BRKPT;
+ else
+ ksi.ksi_code = TRAP_TRACE;
break;
/*
* Kernel AST (should not happen)
diff -r 90f078647954 -r 15599ceece5c sys/arch/mac68k/mac68k/trap.c
--- a/sys/arch/mac68k/mac68k/trap.c Mon Aug 10 10:42:10 2020 +0000
+++ b/sys/arch/mac68k/mac68k/trap.c Mon Aug 10 10:51:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.150 2019/11/21 19:24:00 ad Exp $ */
+/* $NetBSD: trap.c,v 1.151 2020/08/10 10:51:21 rin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2019/11/21 19:24:00 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.151 2020/08/10 10:51:21 rin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -332,8 +332,8 @@
/*
* divde by zero, CHK/TRAPV inst
*/
- case T_ZERODIV|T_USER: /* Divide by zero trap */
- ksi.ksi_code = FPE_FLTDIV;
+ case T_ZERODIV|T_USER: /* Integer divide by zero trap */
+ ksi.ksi_code = FPE_INTDIV;
case T_CHKINST|T_USER: /* CHK instruction trap */
case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
ksi.ksi_addr = (void *)(int)fp->f_format;
@@ -457,7 +457,12 @@
case T_TRACE: /* tracing a trap instruction */
case T_TRAP15|T_USER: /* SUN user trace trap */
fp->f_sr &= ~PSL_T;
+ ksi.ksi_addr = (void *)fp->f_pc;
ksi.ksi_signo = SIGTRAP;
+ if (type == (T_TRAP15|T_USER))
+ ksi.ksi_code = TRAP_BRKPT;
+ else
+ ksi.ksi_code = TRAP_TRACE;
break;
case T_ASTFLT: /* System async trap, cannot happen */
diff -r 90f078647954 -r 15599ceece5c sys/arch/sun3/sun3/trap.c
--- a/sys/arch/sun3/sun3/trap.c Mon Aug 10 10:42:10 2020 +0000
+++ b/sys/arch/sun3/sun3/trap.c Mon Aug 10 10:51:21 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.146 2019/11/21 19:24:01 ad Exp $ */
+/* $NetBSD: trap.c,v 1.147 2020/08/10 10:51:21 rin Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.146 2019/11/21 19:24:01 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.147 2020/08/10 10:51:21 rin Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -404,8 +404,8 @@
ILL_PRVOPC : ILL_ILLOPC;
break;
- case T_ZERODIV|T_USER: /* Divide by zero */
- ksi.ksi_code = FPE_FLTDIV;
+ case T_ZERODIV|T_USER: /* Integer divide by zero */
+ ksi.ksi_code = FPE_INTDIV;
case T_CHKINST|T_USER: /* CHK instruction trap */
case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
ksi.ksi_addr = (void *)(int)tf->tf_format;
@@ -450,7 +450,12 @@
case T_TRACE: /* tracing a trap instruction */
case T_TRAP15|T_USER: /* SUN user trace trap */
tf->tf_sr &= ~PSL_T;
+ ksi.ksi_addr = (void *)tf->tf_pc;
ksi.ksi_signo = SIGTRAP;
+ if (type == (T_TRAP15|T_USER))
+ ksi.ksi_code = TRAP_BRKPT;
+ else
+ ksi.ksi_code = TRAP_TRACE;
break;
case T_ASTFLT: /* system async trap, cannot happen */
Home |
Main Index |
Thread Index |
Old Index