Port-m68k archive

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

Re: CVS commit: src/sys/arch/mac68k/mac68k



On Mon, Jan 19, 2009 at 08:45:21AM +0100, Ignatios Souvatzis wrote:
> Your support function should be somehwere in arch/m68k/m68k/, and
> called from every m68k port (well, at least Amiga, too ;-) Can you
> do this?
> 
> [Is there a PR?]

No PR that I'm aware of - just run "make regress" in
regress/lib/libc/ieeefp.

Attached patch does what you suggested - but I can't test on anything
but mac68k.

Martin
Index: ./m68k/include/signal.h
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/include/signal.h,v
retrieving revision 1.24
diff -c -u -p -r1.24 signal.h
--- ./m68k/include/signal.h     19 Nov 2008 18:35:59 -0000      1.24
+++ ./m68k/include/signal.h     25 Jan 2009 01:47:49 -0000
@@ -92,6 +92,9 @@ struct sigstate {
 #define        SS_RTEFRAME     0x01
 #define        SS_FPSTATE      0x02
 #define        SS_USERREGS     0x04
+
+u_int fpsr2siginfocode(u_int fpsr);
+
 #endif
 
 #if defined(__M68K_SIGNAL_PRIVATE)
Index: ./m68k/m68k/sig_machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/m68k/sig_machdep.c,v
retrieving revision 1.40
diff -c -u -p -r1.40 sig_machdep.c
--- ./m68k/m68k/sig_machdep.c   19 Nov 2008 18:35:59 -0000      1.40
+++ ./m68k/m68k/sig_machdep.c   25 Jan 2009 01:47:49 -0000
@@ -135,6 +135,23 @@ int sigpid = 0;
            (((struct fpframe060 *)(fp))->fpf6_frmfmt == FPF6_FMT_NULL)
 #endif
 
+/* convert 68881 %fpsr code into siginfo ksi_code */
+u_int
+fpsr2siginfocode(u_int fpsr)
+{
+       if (fpsr & (1 << 10))
+               return FPE_FLTDIV;
+       if (fpsr & (1 << 11))
+               return FPE_FLTUND;
+       if (fpsr & (1 << 12))
+               return FPE_FLTOVF;
+       if (fpsr & (1 << 13))
+               return FPE_FLTINV;
+       if (fpsr & (1 << 9))
+               return FPE_FLTRES;
+       return 0;
+}
+
 void *
 getframe(struct lwp *l, int sig, int *onstack)
 {
Index: ./amiga/amiga/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/amiga/trap.c,v
retrieving revision 1.121
diff -c -u -p -r1.121 trap.c
--- ./amiga/amiga/trap.c        16 Dec 2008 22:35:22 -0000      1.121
+++ ./amiga/amiga/trap.c        25 Jan 2009 01:47:49 -0000
@@ -658,16 +658,10 @@ trap(fp, type, code, v)
        case T_FPERR|T_USER:
                /*
                 * We pass along the 68881 status register which locore
-                * stashed in code for us.  Note that there is a
-                * possibility that the bit pattern of this register
-                * will conflict with one of the FPE_* codes defined
-                * in signal.h.  Fortunately for us, the only such
-                * codes we use are all in the range 1-7 and the low
-                * 3 bits of the status register are defined as 0 so
-                * there is no clash.
+                * stashed in code for us.
                 */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
        /*
         * Kernel coprocessor violation
Index: ./atari/atari/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/trap.c,v
retrieving revision 1.98
diff -c -u -p -r1.98 trap.c
--- ./atari/atari/trap.c        15 Oct 2008 06:51:17 -0000      1.98
+++ ./atari/atari/trap.c        25 Jan 2009 01:47:49 -0000
@@ -472,16 +472,10 @@ trap(fp, type, code, v)
        case T_FPERR|T_USER:
                /*
                 * We pass along the 68881 status register which locore
-                * stashed in code for us.  Note that there is a
-                * possibility that the bit pattern of this register
-                * will conflict with one of the FPE_* codes defined
-                * in signal.h.  Fortunately for us, the only such
-                * codes we use are all in the range 1-7 and the low
-                * 3 bits of the status register are defined as 0 so
-                * there is no clash.
+                * stashed in code for us.
                 */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
        /*
Index: ./cesfic/cesfic/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cesfic/cesfic/trap.c,v
retrieving revision 1.42
diff -c -u -p -r1.42 trap.c
--- ./cesfic/cesfic/trap.c      15 Oct 2008 06:51:17 -0000      1.42
+++ ./cesfic/cesfic/trap.c      25 Jan 2009 01:47:49 -0000
@@ -430,15 +430,10 @@ trap(fp, type, code, v)
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
 #ifdef M68040
Index: ./hp300/hp300/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/hp300/trap.c,v
retrieving revision 1.139
diff -c -u -p -r1.139 trap.c
--- ./hp300/hp300/trap.c        15 Oct 2008 06:51:17 -0000      1.139
+++ ./hp300/hp300/trap.c        25 Jan 2009 01:47:49 -0000
@@ -410,15 +410,10 @@ trap(struct frame *fp, int type, u_int c
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status register which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this register will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status register are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
 #ifdef M68040
Index: ./luna68k/luna68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/luna68k/luna68k/trap.c,v
retrieving revision 1.54
diff -c -u -p -r1.54 trap.c
--- ./luna68k/luna68k/trap.c    19 Dec 2008 15:20:10 -0000      1.54
+++ ./luna68k/luna68k/trap.c    25 Jan 2009 01:47:49 -0000
@@ -398,15 +398,10 @@ trap(fp, type, code, v)
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status register which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this register will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status register are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
 #ifdef M68040
Index: ./mac68k/mac68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/trap.c,v
retrieving revision 1.135
diff -c -u -p -r1.135 trap.c
--- ./mac68k/mac68k/trap.c      11 Jan 2009 21:09:13 -0000      1.135
+++ ./mac68k/mac68k/trap.c      25 Jan 2009 01:47:49 -0000
@@ -271,22 +271,6 @@ machine_userret(struct lwp *l, struct fr
        userret(l, f, t, 0, 0);
 }
 
-static u_int
-fpsr2siginfocode(u_int fpsr)
-{
-       if (fpsr & (1 << 10))
-               return FPE_FLTDIV;
-       if (fpsr & (1 << 11))
-               return FPE_FLTUND;
-       if (fpsr & (1 << 12))
-               return FPE_FLTOVF;
-       if (fpsr & (1 << 13))
-               return FPE_FLTINV;
-       if (fpsr & (1 << 9))
-               return FPE_FLTRES;
-       return 0;
-}
-
 /*
  * Trap is called from locore to handle most types of processor traps,
  * including events such as simulated software interrupts/AST's.
Index: ./mvme68k/mvme68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mvme68k/mvme68k/trap.c,v
retrieving revision 1.97
diff -c -u -p -r1.97 trap.c
--- ./mvme68k/mvme68k/trap.c    15 Oct 2008 06:51:18 -0000      1.97
+++ ./mvme68k/mvme68k/trap.c    25 Jan 2009 01:47:49 -0000
@@ -438,15 +438,10 @@ trap(struct frame *fp, int type, unsigne
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status register which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this register will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status register are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
        /*
Index: ./news68k/news68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/news68k/news68k/trap.c,v
retrieving revision 1.59
diff -c -u -p -r1.59 trap.c
--- ./news68k/news68k/trap.c    15 Oct 2008 06:51:18 -0000      1.59
+++ ./news68k/news68k/trap.c    25 Jan 2009 01:47:49 -0000
@@ -407,15 +407,10 @@ trap(struct frame *fp, int type, u_int c
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status register which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this register will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status register are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
 #ifdef M68040
Index: ./next68k/next68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/next68k/next68k/trap.c,v
retrieving revision 1.74
diff -c -u -p -r1.74 trap.c
--- ./next68k/next68k/trap.c    15 Oct 2008 06:51:18 -0000      1.74
+++ ./next68k/next68k/trap.c    25 Jan 2009 01:47:49 -0000
@@ -425,15 +425,10 @@ trap(struct frame *fp, int type, unsigne
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status register which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this register will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status register are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
 #ifdef M68040
Index: ./sun2/sun2/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun2/sun2/trap.c,v
retrieving revision 1.36
diff -c -u -p -r1.36 trap.c
--- ./sun2/sun2/trap.c  15 Oct 2008 06:51:19 -0000      1.36
+++ ./sun2/sun2/trap.c  25 Jan 2009 01:47:49 -0000
@@ -368,15 +368,10 @@ trap(struct trapframe *tf, int type, u_i
        case T_FPERR|T_USER:    /* 68881 exceptions */
                /*
                 * We pass along the 68881 status register which locore stashed
-                * in code for us.  Note that there is a possibility that the
-                * bit pattern of this register will conflict with one of the
-                * FPE_* codes defined in signal.h.  Fortunately for us, the
-                * only such codes we use are all in the range 1-7 and the low
-                * 3 bits of the status register are defined as 0 so there is
-                * no clash.
+                * in code for us.
                 */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
        case T_FPEMULI:         /* FPU faults in supervisor mode */
Index: ./sun3/sun3/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sun3/sun3/trap.c,v
retrieving revision 1.135
diff -c -u -p -r1.135 trap.c
--- ./sun3/sun3/trap.c  15 Oct 2008 06:51:19 -0000      1.135
+++ ./sun3/sun3/trap.c  25 Jan 2009 01:47:49 -0000
@@ -377,15 +377,10 @@ trap(struct trapframe *tf, int type, u_i
        case T_FPERR|T_USER:    /* 68881 exceptions */
                /*
                 * We pass along the 68881 status register which locore stashed
-                * in code for us.  Note that there is a possibility that the
-                * bit pattern of this register will conflict with one of the
-                * FPE_* codes defined in signal.h.  Fortunately for us, the
-                * only such codes we use are all in the range 1-7 and the low
-                * 3 bits of the status register are defined as 0 so there is
-                * no clash.
+                * in code for us.
                 */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
        case T_FPEMULI:         /* FPU faults in supervisor mode */
Index: ./x68k/x68k/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x68k/x68k/trap.c,v
retrieving revision 1.96
diff -c -u -p -r1.96 trap.c
--- ./x68k/x68k/trap.c  15 Oct 2008 06:51:19 -0000      1.96
+++ ./x68k/x68k/trap.c  25 Jan 2009 01:47:49 -0000
@@ -417,15 +417,10 @@ trap(struct frame *fp, int type, unsigne
        case T_FPERR|T_USER:    /* 68881 exceptions */
        /*
         * We pass along the 68881 status which locore stashed
-        * in code for us.  Note that there is a possibility that the
-        * bit pattern of this will conflict with one of the
-        * FPE_* codes defined in signal.h.  Fortunately for us, the
-        * only such codes we use are all in the range 1-7 and the low
-        * 3 bits of the status are defined as 0 so there is
-        * no clash.
+        * in code for us.
         */
                ksi.ksi_signo = SIGFPE;
-               ksi.ksi_addr = (void *)code;
+               ksi.ksi_code = fpsr2siginfocode(code);
                break;
 
        /*


Home | Main Index | Thread Index | Old Index