Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch SA_SIGINFO support for m68k (port specific changes)



details:   https://anonhg.NetBSD.org/src/rev/83de58d78aae
branches:  trunk
changeset: 552254:83de58d78aae
user:      cl <cl%NetBSD.org@localhost>
date:      Mon Sep 22 14:26:57 2003 +0000

description:
SA_SIGINFO support for m68k (port specific changes)

diffstat:

 sys/arch/amiga/amiga/genassym.cf     |    4 +-
 sys/arch/amiga/amiga/trap.c          |   84 +++++++++++++++++---------
 sys/arch/amiga/amiga/vectors.s       |    8 +-
 sys/arch/atari/atari/genassym.cf     |    4 +-
 sys/arch/atari/atari/trap.c          |   81 +++++++++++++++++---------
 sys/arch/atari/atari/vectors.s       |    8 +-
 sys/arch/cesfic/cesfic/genassym.cf   |    4 +-
 sys/arch/cesfic/cesfic/machdep.c     |   14 +---
 sys/arch/cesfic/cesfic/trap.c        |  100 ++++++++++++++++++++------------
 sys/arch/cesfic/cesfic/vectors.s     |    8 +-
 sys/arch/hp300/hp300/genassym.cf     |    4 +-
 sys/arch/hp300/hp300/trap.c          |  100 ++++++++++++++++++++------------
 sys/arch/hp300/hp300/vectors.s       |    8 +-
 sys/arch/luna68k/luna68k/genassym.cf |    4 +-
 sys/arch/luna68k/luna68k/trap.c      |   90 ++++++++++++++++++----------
 sys/arch/luna68k/luna68k/vectors.s   |    8 +-
 sys/arch/mac68k/include/reg.h        |    3 +-
 sys/arch/mac68k/mac68k/genassym.cf   |    4 +-
 sys/arch/mac68k/mac68k/trap.c        |   83 +++++++++++++++++---------
 sys/arch/mac68k/mac68k/vectors.s     |    8 +-
 sys/arch/mvme68k/mvme68k/genassym.cf |    4 +-
 sys/arch/mvme68k/mvme68k/trap.c      |  100 ++++++++++++++++++++------------
 sys/arch/mvme68k/mvme68k/vectors.s   |    8 +-
 sys/arch/news68k/news68k/genassym.cf |    4 +-
 sys/arch/news68k/news68k/trap.c      |  100 ++++++++++++++++++++------------
 sys/arch/news68k/news68k/vectors.s   |    8 +-
 sys/arch/next68k/next68k/genassym.cf |    4 +-
 sys/arch/next68k/next68k/trap.c      |  100 ++++++++++++++++++++------------
 sys/arch/next68k/next68k/vectors.s   |    8 +-
 sys/arch/sun2/sun2/genassym.cf       |    4 +-
 sys/arch/sun2/sun2/machdep.h         |    4 +-
 sys/arch/sun2/sun2/trap.c            |   74 ++++++++++++++----------
 sys/arch/sun3/sun3/genassym.cf       |    4 +-
 sys/arch/sun3/sun3/machdep.h         |    4 +-
 sys/arch/sun3/sun3/trap.c            |   74 ++++++++++++++----------
 sys/arch/sun3/sun3/vector.c          |   10 ++-
 sys/arch/sun68k/sun68k/vector.c      |    8 +-
 sys/arch/x68k/x68k/genassym.cf       |    4 +-
 sys/arch/x68k/x68k/trap.c            |  107 +++++++++++++++++++++-------------
 sys/arch/x68k/x68k/vectors.s         |    8 +-
 40 files changed, 782 insertions(+), 482 deletions(-)

diffs (truncated from 3282 to 300 lines):

diff -r 4e51e3457dff -r 83de58d78aae sys/arch/amiga/amiga/genassym.cf
--- a/sys/arch/amiga/amiga/genassym.cf  Mon Sep 22 14:18:33 2003 +0000
+++ b/sys/arch/amiga/amiga/genassym.cf  Mon Sep 22 14:26:57 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.18 2003/04/08 22:57:54 thorpej Exp $
+#      $NetBSD: genassym.cf,v 1.19 2003/09/22 14:27:00 cl Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -198,7 +198,7 @@
 
 # system calls
 define SYS_exit        SYS_exit
-define SYS___sigreturn14 SYS___sigreturn14
+define SYS_compat_16___sigreturn14     SYS_compat_16___sigreturn14
 define SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13
 
 # miscellaneous custom chip register offsets
diff -r 4e51e3457dff -r 83de58d78aae sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c       Mon Sep 22 14:18:33 2003 +0000
+++ b/sys/arch/amiga/amiga/trap.c       Mon Sep 22 14:26:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.94 2003/09/17 23:17:39 cl Exp $     */
+/*     $NetBSD: trap.c,v 1.95 2003/09/22 14:27:00 cl Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -83,7 +83,7 @@
 #include "opt_fpu_emulate.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.94 2003/09/17 23:17:39 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2003/09/22 14:27:00 cl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -342,9 +342,13 @@
        vm_prot_t ftype;
        vaddr_t va;
        struct vm_map *map;
+       ksiginfo_t ksi;
        u_int nss;
        int rv;
 
+       (void)memset(&ksi, 0, sizeof(ksi));
+       ksi.ksi_trap = type & ~T_USER;
+
        /*
         * It is only a kernel address space fault iff:
         *      1. (type & T_USER) == 0  and
@@ -529,8 +533,7 @@
                        nss = btoc(USRSTACK-(unsigned)va);
                        if (nss > vm->vm_ssize)
                                vm->vm_ssize = nss;
-               } else if (rv == EACCES)
-                       rv = EFAULT;
+               }
        }
 
        if (rv == 0) {
@@ -555,6 +558,11 @@
        }
 nogo:
 #endif
+       if (rv == EACCES) {
+               ksi.ksi_code = SEGV_ACCERR;
+               rv = EFAULT;
+       } else
+               ksi.ksi_code = SEGV_MAPERR;
        if (type == T_MMUFLT) {
                if (l->l_addr->u_pcb.pcb_onfault) {
                        trapcpfault(l, fp);
@@ -566,14 +574,16 @@
                       type, code);
                panictrap(type, code, v, fp);
        }
+       ksi.ksi_addr = (void *)v;
        if (rv == ENOMEM) {
                printf("UVM: pid %d (%s), uid %d killed: out of swap\n",
                       p->p_pid, p->p_comm,
                       p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1);
-               trapsignal(l, SIGKILL, v);
+               ksi.ksi_signo = SIGKILL;
        } else {
-               trapsignal(l, SIGSEGV, v);
+               ksi.ksi_signo = SIGSEGV;
        }
+       trapsignal(l, &ksi);
        if ((type & T_USER) == 0)
                return;
        l->l_flag &= ~L_SA_PAGEFAULT;
@@ -593,14 +603,15 @@
 {
        struct lwp *l;
        struct proc *p;
-       u_int ucode;
+       ksiginfo_t ksi;
        u_quad_t sticks = 0;
-       int i;
 
        l = curlwp;
-       ucode = 0;
        uvmexp.traps++;
 
+       (void)memset(&ksi, 0, sizeof(ksi));
+       ksi.ksi_trap = type & ~T_USER;
+
        /* I have verified that this DOES happen! -gwr */
        if (l == NULL)
                l = &lwp0;
@@ -640,34 +651,43 @@
         */
        case T_BUSERR|T_USER:
        case T_ADDRERR|T_USER:
-               i = SIGBUS;
+               ksi.ksi_addr = (void *)v;
+               ksi.ksi_signo = SIGBUS;
+               ksi.ksi_code = (type == (T_BUSERR|T_USER)) ?
+                       BUS_OBJERR : BUS_ADRERR;
                break;
        /*
         * User illegal/privleged inst fault
         */
        case T_ILLINST|T_USER:
        case T_PRIVINST|T_USER:
-               ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
-               i = SIGILL;
+               ksi.ksi_addr = (void *)(int)frame.f_format;
+                               /* XXX was ILL_PRIVIN_FAULT */
+               ksi.ksi_signo = SIGILL;
+               ksi.ksi_code = (type == (T_PRIVINST|T_USER)) ?
+                       ILL_PRVOPC : ILL_ILLOPC;
                break;
        /*
         * divde by zero, CHK/TRAPV inst
         */
        case T_ZERODIV|T_USER:
+               ksi.ksi_code = FPE_FLTDIV;
        case T_CHKINST|T_USER:
        case T_TRAPVINST|T_USER:
-               ucode = frame.f_format;
-               i = SIGFPE;
+               ksi.ksi_addr = (void *)(int)frame.f_format;
+               ksi.ksi_signo = SIGFPE;
                break;
 
        case T_FPEMULI|T_USER:
        case T_FPEMULD|T_USER:
 #ifdef FPU_EMULATE
-               i = fpu_emulate(&frame, &l->l_addr->u_pcb.pcb_fpregs);
-               /* XXX - Deal with tracing? (frame.f_sr & PSL_T) */
+               if (fpu_emulate(&frame, &l->l_addr->u_pcb.pcb_fpregs,
+                       &ksi) == 0)
+                       ; /* XXX - Deal with tracing? (frame.f_sr & PSL_T) */
 #else
                printf("pid %d killed: no floating point support\n", p->p_pid);
-               i = SIGILL;
+               ksi.ksi_signo = SIGILL;
+               ksi.ksi_code = ILL_ILLOPC;
 #endif
                break;
 
@@ -676,8 +696,9 @@
         * User coprocessor violation
         */
        case T_COPERR|T_USER:
-               ucode = 0;
-               i = SIGFPE;     /* XXX What is a proper response here? */
+       /* XXX What is a proper response here? */
+               ksi.ksi_signo = SIGFPE;
+               ksi.ksi_code = FPE_FLTINV;
                break;
        /*
         * 6888x exceptions
@@ -693,8 +714,8 @@
                 * 3 bits of the status register are defined as 0 so
                 * there is no clash.
                 */
-               ucode = code;
-               i = SIGFPE;
+               ksi.ksi_signo = SIGFPE;
+               ksi.ksi_addr = (void *)code;
                break;
        /*
         * Kernel coprocessor violation
@@ -719,8 +740,11 @@
                sigdelset(&p->p_sigctx.ps_sigignore, SIGILL);
                sigdelset(&p->p_sigctx.ps_sigcatch, SIGILL);
                sigdelset(&p->p_sigctx.ps_sigmask, SIGILL);
-               i = SIGILL;
-               ucode = frame.f_format; /* XXX was ILL_RESAD_FAULT */
+               ksi.ksi_signo = SIGILL;
+               ksi.ksi_addr = (void *)(int)frame.f_format;
+                               /* XXX was ILL_RESAD_FAULT */
+               ksi.ksi_code = (type == T_COPERR) ?
+                       ILL_COPROC : ILL_ILLOPC;
                break;
        /*
         * Trace traps.
@@ -736,7 +760,7 @@
        case T_TRACE:
        case T_TRAP15:
                frame.f_sr &= ~PSL_T;
-               i = SIGTRAP;
+               ksi.ksi_signo = SIGTRAP;
                break;
        case T_TRACE|T_USER:
        case T_TRAP15|T_USER:
@@ -752,7 +776,7 @@
                }
 #endif
                frame.f_sr &= ~PSL_T;
-               i = SIGTRAP;
+               ksi.ksi_signo = SIGTRAP;
                break;
        /*
         * Kernel AST (should not happen)
@@ -791,12 +815,12 @@
        }
 
 #ifdef DEBUG
-       if (i != SIGTRAP)
-               printf("trapsignal(%d, %d, %d, %x, %x)\n", p->p_pid, i,
-                   ucode, v, frame.f_pc);
+       if (ksi.ksi_signo != SIGTRAP)
+               printf("trapsignal(%d, %d, %d, %x, %x)\n", p->p_pid,
+                   ksi.ksi_signo, ksi.ksi_code, v, frame.f_pc);
 #endif
-       if (i)
-               trapsignal(l, i, ucode);
+       if (ksi.ksi_signo)
+               trapsignal(l, &ksi);
        if ((type & T_USER) == 0)
                return;
        userret(l, frame.f_pc, sticks);
diff -r 4e51e3457dff -r 83de58d78aae sys/arch/amiga/amiga/vectors.s
--- a/sys/arch/amiga/amiga/vectors.s    Mon Sep 22 14:18:33 2003 +0000
+++ b/sys/arch/amiga/amiga/vectors.s    Mon Sep 22 14:26:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vectors.s,v 1.15 2003/08/07 16:26:39 agc Exp $ */
+/*     $NetBSD: vectors.s,v 1.16 2003/09/22 14:27:03 cl Exp $  */
 
 /*
  * Copyright (c) 1990 Regents of the University of California.
@@ -105,7 +105,11 @@
        VECTOR(illinst)
 #endif
        VECTOR(trap2)           /* 34: trace */
-       VECTOR(trap3)           /* 35: sigreturn special syscall */
+#ifdef COMPAT_16
+       VECTOR(trap3)           /* 35: compat_16_sigreturn */
+#else
+       VECTOR(illinst) 
+#endif
        VECTOR(illinst)         /* 36: TRAP instruction vector */
        VECTOR(illinst)         /* 37: TRAP instruction vector */
        VECTOR(illinst)         /* 38: TRAP instruction vector */
diff -r 4e51e3457dff -r 83de58d78aae sys/arch/atari/atari/genassym.cf
--- a/sys/arch/atari/atari/genassym.cf  Mon Sep 22 14:18:33 2003 +0000
+++ b/sys/arch/atari/atari/genassym.cf  Mon Sep 22 14:26:57 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.20 2003/04/08 22:57:54 thorpej Exp $
+#      $NetBSD: genassym.cf,v 1.21 2003/09/22 14:27:03 cl Exp $
 
 #-
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -201,7 +201,7 @@
 # system calls
 define SYS_exit                SYS_exit
 define SYS_execve              SYS_execve
-define SYS___sigreturn14       SYS___sigreturn14
+define SYS_compat_16___sigreturn14     SYS_compat_16___sigreturn14
 define SYS_compat_13_sigreturn13 SYS_compat_13_sigreturn13
 
 # processor type from loader
diff -r 4e51e3457dff -r 83de58d78aae sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c       Mon Sep 22 14:18:33 2003 +0000
+++ b/sys/arch/atari/atari/trap.c       Mon Sep 22 14:26:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.70 2003/09/17 23:17:41 cl Exp $     */
+/*     $NetBSD: trap.c,v 1.71 2003/09/22 14:27:03 cl Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.70 2003/09/17 23:17:41 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.71 2003/09/22 14:27:03 cl Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -273,9 +273,14 @@
                                    p->p_pid, p->p_comm, fp->f_pc, faultaddr);
 #endif
                } else if ((sig = writeback(fp, fromtrap))) {
+                       ksiginfo_t ksi;
                        beenhere = 1;
                        oticks = p->p_sticks;



Home | Main Index | Thread Index | Old Index