Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/fpe KNF, mostly indent. No binary change.



details:   https://anonhg.NetBSD.org/src/rev/c1d9bb2183e6
branches:  trunk
changeset: 765250:c1d9bb2183e6
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon May 23 14:52:31 2011 +0000

description:
KNF, mostly indent. No binary change.

diffstat:

 sys/arch/m68k/fpe/fpu_emulate.c |  1844 +++++++++++++++++++-------------------
 1 files changed, 941 insertions(+), 903 deletions(-)

diffs (truncated from 2106 to 300 lines):

diff -r 8d7b88822c7b -r c1d9bb2183e6 sys/arch/m68k/fpe/fpu_emulate.c
--- a/sys/arch/m68k/fpe/fpu_emulate.c   Mon May 23 14:45:44 2011 +0000
+++ b/sys/arch/m68k/fpe/fpu_emulate.c   Mon May 23 14:52:31 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $ */
+/*     $NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $ */
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.31 2011/05/14 16:17:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emulate.c,v 1.32 2011/05/23 14:52:31 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -51,29 +51,29 @@
 
 #include "fpu_emulate.h"
 
-#define        fpe_abort(tfp, ksi, signo, code)                \
-    do {                                               \
-           (ksi)->ksi_signo = (signo);                 \
-           (ksi)->ksi_code = (code);                   \
-           (ksi)->ksi_addr = (void *)(frame)->f_pc;    \
-           return -1;                                  \
-    } while (/*CONSTCOND*/0)
+#define        fpe_abort(tfp, ksi, signo, code)                        \
+       do {                                                    \
+               (ksi)->ksi_signo = (signo);                     \
+               (ksi)->ksi_code = (code);                       \
+               (ksi)->ksi_addr = (void *)(frame)->f_pc;        \
+               return -1;                                      \
+       } while (/* CONSTCOND */ 0)
 
-static int fpu_emul_fmovmcr(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_fmovm(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_arith(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_type1(struct fpemu *fe, struct instruction *insn);
-static int fpu_emul_brcc(struct fpemu *fe, struct instruction *insn);
-static int test_cc(struct fpemu *fe, int pred);
-static struct fpn *fpu_cmp(struct fpemu *fe);
+static int fpu_emul_fmovmcr(struct fpemu *, struct instruction *);
+static int fpu_emul_fmovm(struct fpemu *, struct instruction *);
+static int fpu_emul_arith(struct fpemu *, struct instruction *);
+static int fpu_emul_type1(struct fpemu *, struct instruction *);
+static int fpu_emul_brcc(struct fpemu *, struct instruction *);
+static int test_cc(struct fpemu *, int);
+static struct fpn *fpu_cmp(struct fpemu *);
 
 #if DEBUG_FPE
-#  define DUMP_INSN(insn)                                              \
-    printf("fpu_emulate: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",      \
-          (insn)->is_advance, (insn)->is_datasize,                     \
-          (insn)->is_opcode, (insn)->is_word1)
+#define DUMP_INSN(insn)                                                        \
+       printf("fpu_emulate: insn={adv=%d,siz=%d,op=%04x,w1=%04x}\n",   \
+           (insn)->is_advance, (insn)->is_datasize,                    \
+           (insn)->is_opcode, (insn)->is_word1)
 #else
-#  define DUMP_INSN(insn)
+#define DUMP_INSN(insn)
 #endif
 
 /*
@@ -84,370 +84,378 @@
 int
 fpu_emulate(struct frame *frame, struct fpframe *fpf, ksiginfo_t *ksi)
 {
-    static struct instruction insn;
-    static struct fpemu fe;
-    int word, optype, sig;
+       static struct instruction insn;
+       static struct fpemu fe;
+       int word, optype, sig;
 
 
-    /* initialize insn.is_datasize to tell it is *not* initialized */
-    insn.is_datasize = -1;
+       /* initialize insn.is_datasize to tell it is *not* initialized */
+       insn.is_datasize = -1;
 
-    fe.fe_frame = frame;
-    fe.fe_fpframe = fpf;
-    fe.fe_fpsr = fpf->fpf_fpsr;
-    fe.fe_fpcr = fpf->fpf_fpcr;
+       fe.fe_frame = frame;
+       fe.fe_fpframe = fpf;
+       fe.fe_fpsr = fpf->fpf_fpsr;
+       fe.fe_fpcr = fpf->fpf_fpcr;
 
 #if DEBUG_FPE
-    printf("ENTERING fpu_emulate: FPSR=%08x, FPCR=%08x\n",
-          fe.fe_fpsr, fe.fe_fpcr);
+       printf("ENTERING fpu_emulate: FPSR=%08x, FPCR=%08x\n",
+           fe.fe_fpsr, fe.fe_fpcr);
 #endif
 
-    /* always set this (to avoid a warning) */
-    insn.is_pc = frame->f_pc;
-    insn.is_nextpc = 0;
-    if (frame->f_format == 4) {
-       /*
-        * A format 4 is generated by the 68{EC,LC}040.  The PC is
-        * already set to the instruction following the faulting
-        * instruction.  We need to calculate that, anyway.  The
-        * fslw is the PC of the faulted instruction, which is what
-        * we expect to be in f_pc.
-        *
-        * XXX - This is a hack; it assumes we at least know the
-        * sizes of all instructions we run across.
-        * XXX TODO: This may not be true, so we might want to save the PC
-        * in order to restore it later.
-        */
-       /* insn.is_nextpc = frame->f_pc; */
-       insn.is_pc = frame->f_fmt4.f_fslw;
-       frame->f_pc = insn.is_pc;
-    }
+       /* always set this (to avoid a warning) */
+       insn.is_pc = frame->f_pc;
+       insn.is_nextpc = 0;
+       if (frame->f_format == 4) {
+               /*
+                * A format 4 is generated by the 68{EC,LC}040.  The PC is
+                * already set to the instruction following the faulting
+                * instruction.  We need to calculate that, anyway.  The
+                * fslw is the PC of the faulted instruction, which is what
+                * we expect to be in f_pc.
+                *
+                * XXX - This is a hack; it assumes we at least know the
+                * sizes of all instructions we run across.
+                * XXX TODO: This may not be true, so we might want to save
+                * the PC in order to restore it later.
+                */
+#if 0
+               insn.is_nextpc = frame->f_pc;
+#endif
+               insn.is_pc = frame->f_fmt4.f_fslw;
+               frame->f_pc = insn.is_pc;
+       }
 
-    word = fusword((void *) (insn.is_pc));
-    if (word < 0) {
+       word = fusword((void *)(insn.is_pc));
+       if (word < 0) {
 #ifdef DEBUG
-       printf("fpu_emulate: fault reading opcode\n");
+               printf("fpu_emulate: fault reading opcode\n");
 #endif
-       fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
-    }
-
-    if ((word & 0xf000) != 0xf000) {
-#ifdef DEBUG
-       printf("fpu_emulate: not coproc. insn.: opcode=0x%x\n", word);
-#endif
-       fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
-    }
+               fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
+       }
 
-    if ((word & 0x0E00) != 0x0200) {
+       if ((word & 0xf000) != 0xf000) {
 #ifdef DEBUG
-       printf("fpu_emulate: bad coproc. id: opcode=0x%x\n", word);
+               printf("fpu_emulate: not coproc. insn.: opcode=0x%x\n", word);
 #endif
-       fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
-    }
+               fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
+       }
 
-    insn.is_opcode = word;
-    optype = (word & 0x01C0);
+       if ((word & 0x0E00) != 0x0200) {
+#ifdef DEBUG
+               printf("fpu_emulate: bad coproc. id: opcode=0x%x\n", word);
+#endif
+               fpe_abort(frame, ksi, SIGILL, ILL_ILLOPC);
+       }
 
-    word = fusword((void *) (insn.is_pc + 2));
-    if (word < 0) {
+       insn.is_opcode = word;
+       optype = (word & 0x01C0);
+
+       word = fusword((void *)(insn.is_pc + 2));
+       if (word < 0) {
 #ifdef DEBUG
-       printf("fpu_emulate: fault reading word1\n");
+               printf("fpu_emulate: fault reading word1\n");
 #endif
-       fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
-    }
-    insn.is_word1 = word;
-    /* all FPU instructions are at least 4-byte long */
-    insn.is_advance = 4;
+               fpe_abort(frame, ksi, SIGSEGV, SEGV_ACCERR);
+       }
+       insn.is_word1 = word;
+       /* all FPU instructions are at least 4-byte long */
+       insn.is_advance = 4;
 
-    DUMP_INSN(&insn);
+       DUMP_INSN(&insn);
 
-    /*
-     * Which family (or type) of opcode is it?
-     * Tests ordered by likelihood (hopefully).
-     * Certainly, type 0 is the most common.
-     */
-    if (optype == 0x0000) {
-       /* type=0: generic */
-       if ((word & 0xc000) == 0xc000) {
+       /*
+        * Which family (or type) of opcode is it?
+        * Tests ordered by likelihood (hopefully).
+        * Certainly, type 0 is the most common.
+        */
+       if (optype == 0x0000) {
+               /* type=0: generic */
+               if ((word & 0xc000) == 0xc000) {
 #if DEBUG_FPE
-           printf("fpu_emulate: fmovm FPr\n");
+                       printf("fpu_emulate: fmovm FPr\n");
 #endif
-           sig = fpu_emul_fmovm(&fe, &insn);
-       } else if ((word & 0xc000) == 0x8000) {
+                       sig = fpu_emul_fmovm(&fe, &insn);
+               } else if ((word & 0xc000) == 0x8000) {
 #if DEBUG_FPE
-           printf("fpu_emulate: fmovm FPcr\n");
+                       printf("fpu_emulate: fmovm FPcr\n");
 #endif
-           sig = fpu_emul_fmovmcr(&fe, &insn);
-       } else if ((word & 0xe000) == 0x6000) {
-           /* fstore = fmove FPn,mem */
+                       sig = fpu_emul_fmovmcr(&fe, &insn);
+               } else if ((word & 0xe000) == 0x6000) {
+                       /* fstore = fmove FPn,mem */
 #if DEBUG_FPE
-           printf("fpu_emulate: fmove to mem\n");
+                       printf("fpu_emulate: fmove to mem\n");
 #endif
-           sig = fpu_emul_fstore(&fe, &insn);
-       } else if ((word & 0xfc00) == 0x5c00) {
-           /* fmovecr */
+                       sig = fpu_emul_fstore(&fe, &insn);
+               } else if ((word & 0xfc00) == 0x5c00) {
+                       /* fmovecr */
 #if DEBUG_FPE
-           printf("fpu_emulate: fmovecr\n");
+                       printf("fpu_emulate: fmovecr\n");
 #endif
-           sig = fpu_emul_fmovecr(&fe, &insn);
-       } else if ((word & 0xa07f) == 0x26) {
-           /* fscale */
+                       sig = fpu_emul_fmovecr(&fe, &insn);
+               } else if ((word & 0xa07f) == 0x26) {
+                       /* fscale */
 #if DEBUG_FPE
-           printf("fpu_emulate: fscale\n");
+                       printf("fpu_emulate: fscale\n");
 #endif
-           sig = fpu_emul_fscale(&fe, &insn);
-       } else {
+                       sig = fpu_emul_fscale(&fe, &insn);
+               } else {
 #if DEBUG_FPE
-           printf("fpu_emulate: other type0\n");
+                       printf("fpu_emulate: other type0\n");
 #endif
-           /* all other type0 insns are arithmetic */
-           sig = fpu_emul_arith(&fe, &insn);
-       }
-       if (sig == 0) {
+                       /* all other type0 insns are arithmetic */
+                       sig = fpu_emul_arith(&fe, &insn);
+               }
+               if (sig == 0) {
 #if DEBUG_FPE
-           printf("fpu_emulate: type 0 returned 0\n");
+                       printf("fpu_emulate: type 0 returned 0\n");
 #endif
-           sig = fpu_upd_excp(&fe);
-       }
-    } else if (optype == 0x0080 || optype == 0x00C0) {
-       /* type=2 or 3: fbcc, short or long disp. */
+                       sig = fpu_upd_excp(&fe);
+               }
+       } else if (optype == 0x0080 || optype == 0x00C0) {
+               /* type=2 or 3: fbcc, short or long disp. */
 #if DEBUG_FPE
-       printf("fpu_emulate: fbcc %s\n",
-              (optype & 0x40) ? "long" : "short");
+               printf("fpu_emulate: fbcc %s\n",
+                   (optype & 0x40) ? "long" : "short");
 #endif



Home | Main Index | Thread Index | Old Index