Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/arch/m68k/fpe pullup 1.7->1.8 (briggs): fix FPE



details:   https://anonhg.NetBSD.org/src/rev/810d12372563
branches:  netbsd-1-4
changeset: 468797:810d12372563
user:      perry <perry%NetBSD.org@localhost>
date:      Mon Jun 21 15:17:54 1999 +0000

description:
pullup 1.7->1.8 (briggs): fix FPE

diffstat:

 sys/arch/m68k/fpe/fpu_calcea.c |  494 +++++++++++++++++++++++-----------------
 1 files changed, 280 insertions(+), 214 deletions(-)

diffs (truncated from 761 to 300 lines):

diff -r 578939bf721a -r 810d12372563 sys/arch/m68k/fpe/fpu_calcea.c
--- a/sys/arch/m68k/fpe/fpu_calcea.c    Mon Jun 21 15:17:36 1999 +0000
+++ b/sys/arch/m68k/fpe/fpu_calcea.c    Mon Jun 21 15:17:54 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_calcea.c,v 1.7 1996/10/16 06:27:05 scottr Exp $    */
+/*     $NetBSD: fpu_calcea.c,v 1.7.22.1 1999/06/21 15:17:54 perry Exp $        */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -77,104 +77,125 @@
     /* Set the most common value here. */
     ea->ea_regnum = 8 + (modreg & 7);
 
-    switch (modreg & 070) {
-    case 0:                    /* Dn */
-       ea->ea_regnum &= 7;
-    case 010:                  /* An */
+    if ((modreg & 060) == 0) {
+       /* register direct */
+       ea->ea_regnum = modreg & 0xf;
        ea->ea_flags = EA_DIRECT;
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea: register direct reg=%d\n", ea->ea_regnum);
+#ifdef DEBUG_FPE
+       printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
+#endif
+    } else if (modreg == 074) {
+       /* immediate */
+       ea->ea_flags = EA_IMMED;
+       sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
+#ifdef DEBUG_FPE
+       printf("decode_ea: immediate size=%d\n", insn->is_datasize);
+#endif
+    }
+    /*
+     * rest of the address modes need to be separately
+     * handled for the LC040 and the others.
+     */
+    else if (frame->f_format == 4) {
+       /* LC040 */
+       ea->ea_flags = EA_FRAME_EA;
+       ea->ea_fea = frame->f_fmt4.f_fa;
+#ifdef DEBUG_FPE
+       printf("decode_ea: 68LC040 - in-frame EA (%p)\n", (void *)ea->ea_fea);
+#endif
+       if ((modreg & 070) == 030) {
+           /* postincrement mode */
+           ea->ea_flags |= EA_POSTINCR;
+       } else if ((modreg & 070) == 040) {
+           /* predecrement mode */
+           ea->ea_flags |= EA_PREDECR;
        }
-       break;
-
-    case 020:                  /* (An) */
-       ea->ea_flags = 0;
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea: register indirect reg=%d\n", ea->ea_regnum);
-       }
-       break;
-
-    case 030:                  /* (An)+ */
-       ea->ea_flags = EA_POSTINCR;
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea: reg indirect postincrement reg=%d\n",
-                  ea->ea_regnum);
-       }
-       break;
+    } else {
+       /* 020/030 */
+       switch (modreg & 070) {
 
-    case 040:                  /* -(An) */
-       ea->ea_flags = EA_PREDECR;
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea: reg indirect predecrement reg=%d\n",
-                  ea->ea_regnum);
-       }
-       break;
-
-    case 050:                  /* (d16,An) */
-       ea->ea_flags = EA_OFFSET;
-       sig = fetch_disp(frame, insn, 1, &ea->ea_offset);
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea: reg indirect with displacement reg=%d\n",
-                  ea->ea_regnum);
-       }
-       break;
-
-    case 060:                  /* (d8,An,Xn) */
-       ea->ea_flags = EA_INDEXED;
-       sig = decode_ea6(frame, insn, ea, modreg);
-       break;
-
-    case 070:                  /* misc. */
-       ea->ea_regnum = (modreg & 7);
-       switch (modreg & 7) {
-
-       case 0:                 /* (xxxx).W */
-           ea->ea_flags = EA_ABS;
-           sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
-           if (fpu_debug_level & DL_DECODEEA) {
-               printf("  decode_ea: absolute address (word)\n");
-           }
+       case 020:                       /* (An) */
+           ea->ea_flags = 0;
+#ifdef DEBUG_FPE
+           printf("decode_ea: register indirect reg=%d\n", ea->ea_regnum);
+#endif
            break;
 
-       case 1:                 /* (xxxxxxxx).L */
-           ea->ea_flags = EA_ABS;
-           sig = fetch_disp(frame, insn, 2, &ea->ea_absaddr);
-           if (fpu_debug_level & DL_DECODEEA) {
-               printf("  decode_ea: absolute address (long)\n");
-           }
+       case 030:                       /* (An)+ */
+           ea->ea_flags = EA_POSTINCR;
+#ifdef DEBUG_FPE
+           printf("decode_ea: reg indirect postincrement reg=%d\n",
+                  ea->ea_regnum);
+#endif
            break;
 
-       case 2:                 /* (d16,PC) */
-           ea->ea_flags = EA_PC_REL | EA_OFFSET;
-           sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
-           if (fpu_debug_level & DL_DECODEEA) {
-               printf("  decode_ea: pc relative word displacement\n");
-           }
+       case 040:                       /* -(An) */
+           ea->ea_flags = EA_PREDECR;
+#ifdef DEBUG_FPE
+           printf("decode_ea: reg indirect predecrement reg=%d\n",
+                  ea->ea_regnum);
+#endif
            break;
 
-       case 3:                 /* (d8,PC,Xn) */
-           ea->ea_flags = EA_PC_REL | EA_INDEXED;
+       case 050:                       /* (d16,An) */
+           ea->ea_flags = EA_OFFSET;
+           sig = fetch_disp(frame, insn, 1, &ea->ea_offset);
+#ifdef DEBUG_FPE
+           printf("decode_ea: reg indirect with displacement reg=%d\n",
+                  ea->ea_regnum);
+#endif
+           break;
+
+       case 060:                       /* (d8,An,Xn) */
+           ea->ea_flags = EA_INDEXED;
            sig = decode_ea6(frame, insn, ea, modreg);
            break;
 
-       case 4:                 /* #data */
-           ea->ea_flags = EA_IMMED;
-           sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
-           if (fpu_debug_level & DL_DECODEEA) {
-               printf("  decode_ea: immediate size=%d\n", insn->is_datasize);
-           }
-           break;
+       case 070:                       /* misc. */
+           ea->ea_regnum = (modreg & 7);
+           switch (modreg & 7) {
+
+           case 0:                     /* (xxxx).W */
+               ea->ea_flags = EA_ABS;
+               sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
+#ifdef DEBUG_FPE
+               printf("decode_ea: absolute address (word)\n");
+#endif
+               break;
+
+           case 1:                     /* (xxxxxxxx).L */
+               ea->ea_flags = EA_ABS;
+               sig = fetch_disp(frame, insn, 2, &ea->ea_absaddr);
+#ifdef DEBUG_FPE
+               printf("decode_ea: absolute address (long)\n");
+#endif
+               break;
 
-       default:
-           if (fpu_debug_level & DL_DECODEEA) {
-               printf("  decode_ea: invalid addr mode (7,%d)\n", modreg & 7);
-           }
-           return SIGILL;
-       } /* switch for mode 7 */
-       break;
-    } /* switch mode */
+           case 2:                     /* (d16,PC) */
+               ea->ea_flags = EA_PC_REL | EA_OFFSET;
+               sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
+#ifdef DEBUG_FPE
+               printf("decode_ea: pc relative word displacement\n");
+#endif
+               break;
+
+           case 3:                     /* (d8,PC,Xn) */
+               ea->ea_flags = EA_PC_REL | EA_INDEXED;
+               sig = decode_ea6(frame, insn, ea, modreg);
+               break;
 
-    ea->ea_tdisp = 0;
+           case 4:                     /* #data */
+               /* it should have been taken care of earlier */
+           default:
+#ifdef DEBUG_FPE
+               printf("decode_ea: invalid addr mode (7,%d)\n", modreg & 7);
+#endif
+               return SIGILL;
+           } /* switch for mode 7 */
+           break;
+       } /* switch mode */
+    }
+    ea->ea_moffs = 0;
 
     return sig;
 }
@@ -194,7 +215,7 @@
     int bd_size, od_size;
     int sig;
 
-    extword = fusword((void *) (frame->f_pc + insn->is_advance));
+    extword = fusword((void *) (insn->is_pc + insn->is_advance));
     if (extword < 0) {
        return SIGSEGV;
     }
@@ -222,10 +243,10 @@
 
        ea->ea_basedisp = idx + basedisp;
        ea->ea_outerdisp = 0;
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea6: brief ext word idxreg=%d, basedisp=%08x\n",
-                  ea->ea_idxreg, ea->ea_basedisp);
-       }
+#if DEBUG_FPE
+       printf("decode_ea6: brief ext word idxreg=%d, basedisp=%08x\n",
+              ea->ea_idxreg, ea->ea_basedisp);
+#endif
     } else {
        /* full extention word */
        if (extword & 0x80) {
@@ -260,21 +281,21 @@
            break;
        default:
 #ifdef DEBUG
-           printf("  decode_ea6: invalid indirect mode: ext word %04x\n",
+           printf("decode_ea6: invalid indirect mode: ext word %04x\n",
                   extword);
 #endif
            return SIGILL;
            break;
        }
-       if (fpu_debug_level & DL_DECODEEA) {
-           printf("  decode_ea6: full ext idxreg=%d, basedisp=%x, outerdisp=%x\n",
-                  ea->ea_idxreg, ea->ea_basedisp, ea->ea_outerdisp);
-       }
+#if DEBUG_FPE
+       printf("decode_ea6: full ext idxreg=%d, basedisp=%x, outerdisp=%x\n",
+              ea->ea_idxreg, ea->ea_basedisp, ea->ea_outerdisp);
+#endif
     }
-    if (fpu_debug_level & DL_DECODEEA) {
-       printf("  decode_ea6: regnum=%d, flags=%x\n",
-              ea->ea_regnum, ea->ea_flags);
-    }
+#if DEBUG_FPE
+    printf("decode_ea6: regnum=%d, flags=%x\n",
+          ea->ea_regnum, ea->ea_flags);
+#endif
     return 0;
 }
 
@@ -294,32 +315,56 @@
     int len, step;
     int sig;
 
-#ifdef DIAGNOSTIC
+#ifdef DIAGNOSTIC
     if (ea->ea_regnum & ~0xF) {
-       panic("  load_ea: bad regnum");
+       panic("load_ea: bad regnum");
     }
 #endif
 
-    if (fpu_debug_level & DL_LOADEA) {
-       printf("  load_ea: frame at %p\n", frame);
-    }
-    /* The dst is always int or larger. */
+#ifdef DEBUG_FPE
+    printf("load_ea: frame at %p\n", frame);
+#endif
+    /* dst is always int or larger. */
     len = insn->is_datasize;
     if (len < 4) {
        dst += (4 - len);
     }
     step = (len == 1 && ea->ea_regnum == 15 /* sp */) ? 2 : len;
 



Home | Main Index | Thread Index | Old Index