Mon Aug 10 10:51:21 2020 UTC ()
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.


(rin)
diff -r1.138 -r1.139 src/sys/arch/amiga/amiga/trap.c
diff -r1.150 -r1.151 src/sys/arch/mac68k/mac68k/trap.c
diff -r1.146 -r1.147 src/sys/arch/sun3/sun3/trap.c

cvs diff -r1.138 -r1.139 src/sys/arch/amiga/amiga/trap.c (expand / switch to unified diff)

--- src/sys/arch/amiga/amiga/trap.c 2019/11/21 19:23:58 1.138
+++ src/sys/arch/amiga/amiga/trap.c 2020/08/10 10:51:21 1.139
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.138 2019/11/21 19:23:58 ad Exp $ */ 1/* $NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 University of Utah. 4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 5 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer 9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department. 10 * Science Department.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -35,27 +35,27 @@ @@ -35,27 +35,27 @@
35 * 35 *
36 * from: Utah $Hdr: trap.c 1.32 91/04/06$ 36 * from: Utah $Hdr: trap.c 1.32 91/04/06$
37 * 37 *
38 * @(#)trap.c 7.15 (Berkeley) 8/2/91 38 * @(#)trap.c 7.15 (Berkeley) 8/2/91
39 */ 39 */
40 40
41#include "opt_ddb.h" 41#include "opt_ddb.h"
42#include "opt_execfmt.h" 42#include "opt_execfmt.h"
43#include "opt_compat_sunos.h" 43#include "opt_compat_sunos.h"
44#include "opt_fpu_emulate.h" 44#include "opt_fpu_emulate.h"
45#include "opt_m68k_arch.h" 45#include "opt_m68k_arch.h"
46 46
47#include <sys/cdefs.h> 47#include <sys/cdefs.h>
48__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.138 2019/11/21 19:23:58 ad Exp $"); 48__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.139 2020/08/10 10:51:21 rin Exp $");
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51#include <sys/systm.h> 51#include <sys/systm.h>
52#include <sys/proc.h> 52#include <sys/proc.h>
53#include <sys/acct.h> 53#include <sys/acct.h>
54#include <sys/kernel.h> 54#include <sys/kernel.h>
55#include <sys/signalvar.h> 55#include <sys/signalvar.h>
56#include <sys/resourcevar.h> 56#include <sys/resourcevar.h>
57#include <sys/syslog.h> 57#include <sys/syslog.h>
58#include <sys/syscall.h> 58#include <sys/syscall.h>
59#include <sys/userret.h> 59#include <sys/userret.h>
60#include <sys/kauth.h> 60#include <sys/kauth.h>
61 61
@@ -563,27 +563,27 @@ trap(struct frame *fp, int type, u_int c @@ -563,27 +563,27 @@ trap(struct frame *fp, int type, u_int c
563 */ 563 */
564 case T_ILLINST|T_USER: 564 case T_ILLINST|T_USER:
565 case T_PRIVINST|T_USER: 565 case T_PRIVINST|T_USER:
566 ksi.ksi_addr = (void *)(int)fp->f_format; 566 ksi.ksi_addr = (void *)(int)fp->f_format;
567 /* XXX was ILL_PRIVIN_FAULT */ 567 /* XXX was ILL_PRIVIN_FAULT */
568 ksi.ksi_signo = SIGILL; 568 ksi.ksi_signo = SIGILL;
569 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ? 569 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ?
570 ILL_PRVOPC : ILL_ILLOPC; 570 ILL_PRVOPC : ILL_ILLOPC;
571 break; 571 break;
572 /* 572 /*
573 * divde by zero, CHK/TRAPV inst 573 * divde by zero, CHK/TRAPV inst
574 */ 574 */
575 case T_ZERODIV|T_USER: 575 case T_ZERODIV|T_USER:
576 ksi.ksi_code = FPE_FLTDIV; 576 ksi.ksi_code = FPE_INTDIV;
577 case T_CHKINST|T_USER: 577 case T_CHKINST|T_USER:
578 case T_TRAPVINST|T_USER: 578 case T_TRAPVINST|T_USER:
579 ksi.ksi_addr = (void *)(int)fp->f_format; 579 ksi.ksi_addr = (void *)(int)fp->f_format;
580 ksi.ksi_signo = SIGFPE; 580 ksi.ksi_signo = SIGFPE;
581 break; 581 break;
582 582
583 case T_FPEMULI|T_USER: 583 case T_FPEMULI|T_USER:
584 case T_FPEMULD|T_USER: 584 case T_FPEMULD|T_USER:
585#ifdef FPU_EMULATE 585#ifdef FPU_EMULATE
586 if (fpu_emulate(fp, &pcb->pcb_fpregs, &ksi) == 0) 586 if (fpu_emulate(fp, &pcb->pcb_fpregs, &ksi) == 0)
587 ; /* XXX - Deal with tracing? (fp->f_sr & PSL_T) */ 587 ; /* XXX - Deal with tracing? (fp->f_sr & PSL_T) */
588#else 588#else
589 printf("pid %d killed: no floating point support\n", p->p_pid); 589 printf("pid %d killed: no floating point support\n", p->p_pid);
@@ -664,27 +664,32 @@ trap(struct frame *fp, int type, u_int c @@ -664,27 +664,32 @@ trap(struct frame *fp, int type, u_int c
664 case T_TRAP15|T_USER: 664 case T_TRAP15|T_USER:
665#ifdef COMPAT_SUNOS 665#ifdef COMPAT_SUNOS
666 /* 666 /*
667 * SunOS uses Trap #2 for a "CPU cache flush". 667 * SunOS uses Trap #2 for a "CPU cache flush".
668 * Just flush the on-chip caches and return. 668 * Just flush the on-chip caches and return.
669 */ 669 */
670 if (p->p_emul == &emul_sunos) { 670 if (p->p_emul == &emul_sunos) {
671 ICIA(); 671 ICIA();
672 DCIU(); 672 DCIU();
673 return; 673 return;
674 } 674 }
675#endif 675#endif
676 fp->f_sr &= ~PSL_T; 676 fp->f_sr &= ~PSL_T;
 677 ksi.ksi_addr = (void *)fp->f_pc;
677 ksi.ksi_signo = SIGTRAP; 678 ksi.ksi_signo = SIGTRAP;
 679 if (type == (T_TRAP15|T_USER))
 680 ksi.ksi_code = TRAP_BRKPT;
 681 else
 682 ksi.ksi_code = TRAP_TRACE;
678 break; 683 break;
679 /* 684 /*
680 * Kernel AST (should not happen) 685 * Kernel AST (should not happen)
681 */ 686 */
682 case T_ASTFLT: 687 case T_ASTFLT:
683 panictrap(type, code, v, fp); 688 panictrap(type, code, v, fp);
684 /* 689 /*
685 * User AST 690 * User AST
686 */ 691 */
687 case T_ASTFLT|T_USER: 692 case T_ASTFLT|T_USER:
688 astpending = 0; 693 astpending = 0;
689 spl0(); 694 spl0();
690 if (l->l_pflag & LP_OWEUPC) { 695 if (l->l_pflag & LP_OWEUPC) {

cvs diff -r1.150 -r1.151 src/sys/arch/mac68k/mac68k/trap.c (expand / switch to unified diff)

--- src/sys/arch/mac68k/mac68k/trap.c 2019/11/21 19:24:00 1.150
+++ src/sys/arch/mac68k/mac68k/trap.c 2020/08/10 10:51:21 1.151
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.150 2019/11/21 19:24:00 ad Exp $ */ 1/* $NetBSD: trap.c,v 1.151 2020/08/10 10:51:21 rin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 University of Utah. 4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1986, 1990, 1993 5 * Copyright (c) 1982, 1986, 1990, 1993
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer 9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department. 10 * Science Department.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * from: Utah $Hdr: trap.c 1.37 92/12/20$ 36 * from: Utah $Hdr: trap.c 1.37 92/12/20$
37 * 37 *
38 * @(#)trap.c 8.5 (Berkeley) 1/4/94 38 * @(#)trap.c 8.5 (Berkeley) 1/4/94
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.150 2019/11/21 19:24:00 ad Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.151 2020/08/10 10:51:21 rin Exp $");
43 43
44#include "opt_ddb.h" 44#include "opt_ddb.h"
45#include "opt_execfmt.h" 45#include "opt_execfmt.h"
46#include "opt_fpu_emulate.h" 46#include "opt_fpu_emulate.h"
47#include "opt_kgdb.h" 47#include "opt_kgdb.h"
48#include "opt_compat_sunos.h" 48#include "opt_compat_sunos.h"
49#include "opt_m68k_arch.h" 49#include "opt_m68k_arch.h"
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/systm.h> 52#include <sys/systm.h>
53#include <sys/proc.h> 53#include <sys/proc.h>
54#include <sys/acct.h> 54#include <sys/acct.h>
55#include <sys/kernel.h> 55#include <sys/kernel.h>
@@ -322,28 +322,28 @@ copyfault: @@ -322,28 +322,28 @@ copyfault:
322 break; 322 break;
323 323
324 case T_ILLINST|T_USER: /* Illegal instruction fault */ 324 case T_ILLINST|T_USER: /* Illegal instruction fault */
325 case T_PRIVINST|T_USER: /* Privileged instruction fault */ 325 case T_PRIVINST|T_USER: /* Privileged instruction fault */
326 ksi.ksi_addr = (void *)(int)fp->f_format; 326 ksi.ksi_addr = (void *)(int)fp->f_format;
327 /* XXX was ILL_PRIVIN_FAULT */ 327 /* XXX was ILL_PRIVIN_FAULT */
328 ksi.ksi_signo = SIGILL; 328 ksi.ksi_signo = SIGILL;
329 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ? 329 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ?
330 ILL_PRVOPC : ILL_ILLOPC; 330 ILL_PRVOPC : ILL_ILLOPC;
331 break; 331 break;
332 /* 332 /*
333 * divde by zero, CHK/TRAPV inst  333 * divde by zero, CHK/TRAPV inst
334 */ 334 */
335 case T_ZERODIV|T_USER: /* Divide by zero trap */ 335 case T_ZERODIV|T_USER: /* Integer divide by zero trap */
336 ksi.ksi_code = FPE_FLTDIV; 336 ksi.ksi_code = FPE_INTDIV;
337 case T_CHKINST|T_USER: /* CHK instruction trap */ 337 case T_CHKINST|T_USER: /* CHK instruction trap */
338 case T_TRAPVINST|T_USER: /* TRAPV instruction trap */ 338 case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
339 ksi.ksi_addr = (void *)(int)fp->f_format; 339 ksi.ksi_addr = (void *)(int)fp->f_format;
340 ksi.ksi_signo = SIGFPE; 340 ksi.ksi_signo = SIGFPE;
341 break; 341 break;
342 342
343 /*  343 /*
344 * User coprocessor violation 344 * User coprocessor violation
345 */ 345 */
346 case T_COPERR|T_USER: 346 case T_COPERR|T_USER:
347 /* XXX What is a proper response here? */ 347 /* XXX What is a proper response here? */
348 ksi.ksi_signo = SIGFPE; 348 ksi.ksi_signo = SIGFPE;
349 ksi.ksi_code = FPE_FLTINV; 349 ksi.ksi_code = FPE_FLTINV;
@@ -447,27 +447,32 @@ copyfault: @@ -447,27 +447,32 @@ copyfault:
447 * SunOS uses Trap #2 for a "CPU cache flush". 447 * SunOS uses Trap #2 for a "CPU cache flush".
448 * Just flush the on-chip caches and return. 448 * Just flush the on-chip caches and return.
449 */ 449 */
450 if (p->p_emul == &emul_sunos) { 450 if (p->p_emul == &emul_sunos) {
451 ICIA(); 451 ICIA();
452 DCIU(); 452 DCIU();
453 return; 453 return;
454 } 454 }
455#endif 455#endif
456 /* FALLTHROUGH */ 456 /* FALLTHROUGH */
457 case T_TRACE: /* tracing a trap instruction */ 457 case T_TRACE: /* tracing a trap instruction */
458 case T_TRAP15|T_USER: /* SUN user trace trap */ 458 case T_TRAP15|T_USER: /* SUN user trace trap */
459 fp->f_sr &= ~PSL_T; 459 fp->f_sr &= ~PSL_T;
 460 ksi.ksi_addr = (void *)fp->f_pc;
460 ksi.ksi_signo = SIGTRAP; 461 ksi.ksi_signo = SIGTRAP;
 462 if (type == (T_TRAP15|T_USER))
 463 ksi.ksi_code = TRAP_BRKPT;
 464 else
 465 ksi.ksi_code = TRAP_TRACE;
461 break; 466 break;
462 467
463 case T_ASTFLT: /* System async trap, cannot happen */ 468 case T_ASTFLT: /* System async trap, cannot happen */
464 goto dopanic; 469 goto dopanic;
465 470
466 case T_ASTFLT|T_USER: /* User async trap. */ 471 case T_ASTFLT|T_USER: /* User async trap. */
467 astpending = 0; 472 astpending = 0;
468 /* 473 /*
469 * We check for software interrupts first. This is because 474 * We check for software interrupts first. This is because
470 * they are at a higher level than ASTs, and on a VAX would 475 * they are at a higher level than ASTs, and on a VAX would
471 * interrupt the AST. We assume that if we are processing 476 * interrupt the AST. We assume that if we are processing
472 * an AST that we must be at IPL0 so we don't bother to 477 * an AST that we must be at IPL0 so we don't bother to
473 * check. Note that we ensure that we are at least at SIR 478 * check. Note that we ensure that we are at least at SIR

cvs diff -r1.146 -r1.147 src/sys/arch/sun3/sun3/trap.c (expand / switch to unified diff)

--- src/sys/arch/sun3/sun3/trap.c 2019/11/21 19:24:01 1.146
+++ src/sys/arch/sun3/sun3/trap.c 2020/08/10 10:51:21 1.147
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.146 2019/11/21 19:24:01 ad Exp $ */ 1/* $NetBSD: trap.c,v 1.147 2020/08/10 10:51:21 rin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1986, 1990, 1993 4 * Copyright (c) 1982, 1986, 1990, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer 8 * the Systems Programming Group of the University of Utah Computer
9 * Science Department. 9 * Science Department.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -68,27 +68,27 @@ @@ -68,27 +68,27 @@
68 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 68 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
70 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 70 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
71 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 71 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
72 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 72 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
73 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 73 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
74 * SUCH DAMAGE. 74 * SUCH DAMAGE.
75 * 75 *
76 * from: Utah Hdr: trap.c 1.37 92/12/20 76 * from: Utah Hdr: trap.c 1.37 92/12/20
77 * from: @(#)trap.c 8.5 (Berkeley) 1/4/94 77 * from: @(#)trap.c 8.5 (Berkeley) 1/4/94
78 */ 78 */
79 79
80#include <sys/cdefs.h> 80#include <sys/cdefs.h>
81__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.146 2019/11/21 19:24:01 ad Exp $"); 81__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.147 2020/08/10 10:51:21 rin Exp $");
82 82
83#include "opt_ddb.h" 83#include "opt_ddb.h"
84#include "opt_execfmt.h" 84#include "opt_execfmt.h"
85#include "opt_fpu_emulate.h" 85#include "opt_fpu_emulate.h"
86#include "opt_kgdb.h" 86#include "opt_kgdb.h"
87#include "opt_compat_aout_m68k.h" 87#include "opt_compat_aout_m68k.h"
88#include "opt_compat_sunos.h" 88#include "opt_compat_sunos.h"
89 89
90#include <sys/param.h> 90#include <sys/param.h>
91#include <sys/systm.h> 91#include <sys/systm.h>
92#include <sys/proc.h> 92#include <sys/proc.h>
93#include <sys/acct.h> 93#include <sys/acct.h>
94#include <sys/kernel.h> 94#include <sys/kernel.h>
@@ -394,28 +394,28 @@ trap(struct trapframe *tf, int type, u_i @@ -394,28 +394,28 @@ trap(struct trapframe *tf, int type, u_i
394 ksi.ksi_signo = SIGILL; 394 ksi.ksi_signo = SIGILL;
395 ksi.ksi_code = ILL_ILLOPC; 395 ksi.ksi_code = ILL_ILLOPC;
396#endif 396#endif
397 break; 397 break;
398 398
399 case T_ILLINST|T_USER: /* illegal instruction fault */ 399 case T_ILLINST|T_USER: /* illegal instruction fault */
400 case T_PRIVINST|T_USER: /* privileged instruction fault */ 400 case T_PRIVINST|T_USER: /* privileged instruction fault */
401 ksi.ksi_addr = (void *)(int)tf->tf_format; 401 ksi.ksi_addr = (void *)(int)tf->tf_format;
402 ksi.ksi_signo = SIGILL; 402 ksi.ksi_signo = SIGILL;
403 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ? 403 ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ?
404 ILL_PRVOPC : ILL_ILLOPC; 404 ILL_PRVOPC : ILL_ILLOPC;
405 break; 405 break;
406 406
407 case T_ZERODIV|T_USER: /* Divide by zero */ 407 case T_ZERODIV|T_USER: /* Integer divide by zero */
408 ksi.ksi_code = FPE_FLTDIV; 408 ksi.ksi_code = FPE_INTDIV;
409 case T_CHKINST|T_USER: /* CHK instruction trap */ 409 case T_CHKINST|T_USER: /* CHK instruction trap */
410 case T_TRAPVINST|T_USER: /* TRAPV instruction trap */ 410 case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
411 ksi.ksi_addr = (void *)(int)tf->tf_format; 411 ksi.ksi_addr = (void *)(int)tf->tf_format;
412 ksi.ksi_signo = SIGFPE; 412 ksi.ksi_signo = SIGFPE;
413 break; 413 break;
414 414
415 /* 415 /*
416 * XXX: Trace traps are a nightmare. 416 * XXX: Trace traps are a nightmare.
417 * 417 *
418 * HP-UX uses trap #1 for breakpoints, 418 * HP-UX uses trap #1 for breakpoints,
419 * NetBSD/m68k uses trap #2, 419 * NetBSD/m68k uses trap #2,
420 * SUN 3.x uses trap #15, 420 * SUN 3.x uses trap #15,
421 * DDB and KGDB uses trap #15 (for kernel breakpoints; 421 * DDB and KGDB uses trap #15 (for kernel breakpoints;
@@ -440,27 +440,32 @@ trap(struct trapframe *tf, int type, u_i @@ -440,27 +440,32 @@ trap(struct trapframe *tf, int type, u_i
440 * XXX - Too bad NetBSD uses trap 2... 440 * XXX - Too bad NetBSD uses trap 2...
441 */ 441 */
442 if (p->p_emul == &emul_sunos) { 442 if (p->p_emul == &emul_sunos) {
443 ICIA(); 443 ICIA();
444 DCIU(); 444 DCIU();
445 /* get out fast */ 445 /* get out fast */
446 goto done; 446 goto done;
447 } 447 }
448#endif 448#endif
449 /* FALLTHROUGH */ 449 /* FALLTHROUGH */
450 case T_TRACE: /* tracing a trap instruction */ 450 case T_TRACE: /* tracing a trap instruction */
451 case T_TRAP15|T_USER: /* SUN user trace trap */ 451 case T_TRAP15|T_USER: /* SUN user trace trap */
452 tf->tf_sr &= ~PSL_T; 452 tf->tf_sr &= ~PSL_T;
 453 ksi.ksi_addr = (void *)tf->tf_pc;
453 ksi.ksi_signo = SIGTRAP; 454 ksi.ksi_signo = SIGTRAP;
 455 if (type == (T_TRAP15|T_USER))
 456 ksi.ksi_code = TRAP_BRKPT;
 457 else
 458 ksi.ksi_code = TRAP_TRACE;
454 break; 459 break;
455 460
456 case T_ASTFLT: /* system async trap, cannot happen */ 461 case T_ASTFLT: /* system async trap, cannot happen */
457 goto dopanic; 462 goto dopanic;
458 463
459 case T_ASTFLT|T_USER: /* user async trap */ 464 case T_ASTFLT|T_USER: /* user async trap */
460 astpending = 0; 465 astpending = 0;
461 /* T_SSIR is not used on a Sun3. */ 466 /* T_SSIR is not used on a Sun3. */
462 if (l->l_pflag & LP_OWEUPC) { 467 if (l->l_pflag & LP_OWEUPC) {
463 l->l_pflag &= ~LP_OWEUPC; 468 l->l_pflag &= ~LP_OWEUPC;
464 ADDUPROF(l); 469 ADDUPROF(l);
465 } 470 }
466 goto douret; 471 goto douret;