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. No binary change.
details: https://anonhg.NetBSD.org/src/rev/25cbfbd8604b
branches: trunk
changeset: 765405:25cbfbd8604b
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Wed May 25 15:17:21 2011 +0000
description:
KNF. No binary change.
diffstat:
sys/arch/m68k/fpe/fpu_calcea.c | 1076 +++++++++++++++++++--------------------
1 files changed, 535 insertions(+), 541 deletions(-)
diffs (truncated from 1268 to 300 lines):
diff -r e555a1afef15 -r 25cbfbd8604b sys/arch/m68k/fpe/fpu_calcea.c
--- a/sys/arch/m68k/fpe/fpu_calcea.c Wed May 25 15:15:55 2011 +0000
+++ b/sys/arch/m68k/fpe/fpu_calcea.c Wed May 25 15:17:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_calcea.c,v 1.22 2010/06/06 04:50:07 mrg Exp $ */
+/* $NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@@ -34,7 +34,7 @@
#include "opt_m68k_arch.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.22 2010/06/06 04:50:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_calcea.c,v 1.23 2011/05/25 15:17:21 tsutsui Exp $");
#include <sys/param.h>
#include <sys/signal.h>
@@ -47,13 +47,11 @@
/*
* Prototypes of static functions
*/
-static int decode_ea6(struct frame *frame, struct instruction *insn,
- struct insn_ea *ea, int modreg);
-static int fetch_immed(struct frame *frame, struct instruction *insn,
- int *dst);
-static int fetch_disp(struct frame *frame, struct instruction *insn,
- int size, int *res);
-static int calc_ea(struct insn_ea *ea, char *ptr, char **eaddr);
+static int decode_ea6(struct frame *, struct instruction *,
+ struct insn_ea *, int);
+static int fetch_immed(struct frame *, struct instruction *, int *);
+static int fetch_disp(struct frame *, struct instruction *, int, int *);
+static int calc_ea(struct insn_ea *, char *, char **);
/*
* Helper routines for dealing with "effective address" values.
@@ -64,248 +62,253 @@
* Returns zero on success, else signal number.
*/
int
-fpu_decode_ea(struct frame *frame, struct instruction *insn, struct insn_ea *ea, int modreg)
+fpu_decode_ea(struct frame *frame, struct instruction *insn,
+ struct insn_ea *ea, int modreg)
{
- int sig;
+ int sig;
#ifdef DEBUG
- if (insn->is_datasize < 0) {
- panic("decode_ea: called with uninitialized datasize");
- }
+ if (insn->is_datasize < 0)
+ panic("decode_ea: called with uninitialized datasize");
#endif
- sig = 0;
+ sig = 0;
- /* Set the most common value here. */
- ea->ea_regnum = 8 + (modreg & 7);
+ /* Set the most common value here. */
+ ea->ea_regnum = 8 + (modreg & 7);
- if ((modreg & 060) == 0) {
- /* register direct */
- ea->ea_regnum = modreg & 0xf;
- ea->ea_flags = EA_DIRECT;
+ if ((modreg & 060) == 0) {
+ /* register direct */
+ ea->ea_regnum = modreg & 0xf;
+ ea->ea_flags = EA_DIRECT;
#ifdef DEBUG_FPE
- printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
+ printf("decode_ea: register direct reg=%d\n", ea->ea_regnum);
#endif
- } else if ((modreg & 077) == 074) {
- /* immediate */
- ea->ea_flags = EA_IMMED;
- sig = fetch_immed(frame, insn, &ea->ea_immed[0]);
+ } else if ((modreg & 077) == 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);
+ 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.
- */
+ }
+ /*
+ * rest of the address modes need to be separately
+ * handled for the LC040 and the others.
+ */
#if 0 /* XXX */
- else if (frame->f_format == 4 && frame->f_fmt4.f_fa) {
- /* LC040 */
- ea->ea_flags = EA_FRAME_EA;
- ea->ea_fea = frame->f_fmt4.f_fa;
+ else if (frame->f_format == 4 && frame->f_fmt4.f_fa) {
+ /* 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) size %d\n",
- (void *)ea->ea_fea, insn->is_datasize);
+ printf("decode_ea: 68LC040 - in-frame EA (%p) size %d\n",
+ (void *)ea->ea_fea, insn->is_datasize);
#endif
- if ((modreg & 070) == 030) {
- /* postincrement mode */
- ea->ea_flags |= EA_POSTINCR;
- } else if ((modreg & 070) == 040) {
- /* predecrement mode */
- ea->ea_flags |= EA_PREDECR;
+ if ((modreg & 070) == 030) {
+ /* postincrement mode */
+ ea->ea_flags |= EA_POSTINCR;
+ } else if ((modreg & 070) == 040) {
+ /* predecrement mode */
+ ea->ea_flags |= EA_PREDECR;
#ifdef M68060
#if defined(M68020) || defined(M68030) || defined(M68040)
- if (cputype == CPU_68060)
+ if (cputype == CPU_68060)
#endif
- if (insn->is_datasize == 12)
- ea->ea_fea -= 8;
+ if (insn->is_datasize == 12)
+ ea->ea_fea -= 8;
#endif
+ }
}
- }
#endif /* XXX */
- else {
- /* 020/030 */
- switch (modreg & 070) {
+ else {
+ /* 020/030 */
+ switch (modreg & 070) {
- case 020: /* (An) */
- ea->ea_flags = 0;
+ case 020: /* (An) */
+ ea->ea_flags = 0;
#ifdef DEBUG_FPE
- printf("decode_ea: register indirect reg=%d\n", ea->ea_regnum);
+ printf("decode_ea: register indirect reg=%d\n",
+ ea->ea_regnum);
#endif
- break;
-
- 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;
+ break;
- case 040: /* -(An) */
- ea->ea_flags = EA_PREDECR;
+ case 030: /* (An)+ */
+ ea->ea_flags = EA_POSTINCR;
#ifdef DEBUG_FPE
- printf("decode_ea: reg indirect predecrement reg=%d\n",
- ea->ea_regnum);
-#endif
- break;
-
- 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);
+ printf("decode_ea: reg indirect postincrement 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;
+ break;
- case 070: /* misc. */
- ea->ea_regnum = (modreg & 7);
- switch (modreg & 7) {
+ 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 0: /* (xxxx).W */
- ea->ea_flags = EA_ABS;
- sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
+ case 050: /* (d16,An) */
+ ea->ea_flags = EA_OFFSET;
+ sig = fetch_disp(frame, insn, 1, &ea->ea_offset);
#ifdef DEBUG_FPE
- printf("decode_ea: absolute address (word)\n");
+ printf("decode_ea: reg indirect with displacement "
+ "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);
-#ifdef DEBUG_FPE
- printf("decode_ea: absolute address (long)\n");
-#endif
- 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 2: /* (d16,PC) */
- ea->ea_flags = EA_PC_REL | EA_OFFSET;
- sig = fetch_disp(frame, insn, 1, &ea->ea_absaddr);
+ case 0: /* (xxxx).W */
+ ea->ea_flags = EA_ABS;
+ sig = fetch_disp(frame, insn, 1,
+ &ea->ea_absaddr);
#ifdef DEBUG_FPE
- printf("decode_ea: pc relative word displacement\n");
+ printf("decode_ea: absolute address (word)\n");
#endif
- break;
+ 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;
- case 3: /* (d8,PC,Xn) */
- ea->ea_flags = EA_PC_REL | EA_INDEXED;
- sig = decode_ea6(frame, insn, ea, modreg);
- break;
-
- case 4: /* #data */
- /* it should have been taken care of earlier */
- default:
+ 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: invalid addr mode (7,%d)\n", modreg & 7);
+ printf("decode_ea: pc relative word "
+ "displacement\n");
#endif
- return SIGILL;
- } /* switch for mode 7 */
- break;
- } /* switch mode */
- }
- ea->ea_moffs = 0;
+ break;
+
+ case 3: /* (d8,PC,Xn) */
+ ea->ea_flags = EA_PC_REL | EA_INDEXED;
+ sig = decode_ea6(frame, insn, ea, modreg);
+ break;
- return sig;
+ 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;
+ }
+ break;
+ }
+ }
+ ea->ea_moffs = 0;
Home |
Main Index |
Thread Index |
Old Index