Commit 7eb7f94c authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Convert some K&R-style functions to ANSI-style. From Steven Cole.

parent 9d0f5605
...@@ -394,18 +394,13 @@ const struct powerpc_operand powerpc_operands[] = ...@@ -394,18 +394,13 @@ const struct powerpc_operand powerpc_operands[] =
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_bat (insn, value, errmsg) insert_bat(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (((insn >> 21) & 0x1f) << 16); return insn | (((insn >> 21) & 0x1f) << 16);
} }
static long static long
extract_bat (insn, invalid) extract_bat(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL if (invalid != (int *) NULL
&& ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f)) && ((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
...@@ -421,18 +416,13 @@ extract_bat (insn, invalid) ...@@ -421,18 +416,13 @@ extract_bat (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_bba (insn, value, errmsg) insert_bba(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (((insn >> 16) & 0x1f) << 11); return insn | (((insn >> 16) & 0x1f) << 11);
} }
static long static long
extract_bba (insn, invalid) extract_bba(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL if (invalid != (int *) NULL
&& ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f)) && ((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
...@@ -445,19 +435,14 @@ extract_bba (insn, invalid) ...@@ -445,19 +435,14 @@ extract_bba (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_bd (insn, value, errmsg) insert_bd(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (value & 0xfffc); return insn | (value & 0xfffc);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_bd (insn, invalid) extract_bd(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if ((insn & 0x8000) != 0) if ((insn & 0x8000) != 0)
return (insn & 0xfffc) - 0x10000; return (insn & 0xfffc) - 0x10000;
...@@ -474,10 +459,7 @@ extract_bd (insn, invalid) ...@@ -474,10 +459,7 @@ extract_bd (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_bdm (insn, value, errmsg) insert_bdm(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if ((value & 0x8000) != 0) if ((value & 0x8000) != 0)
insn |= 1 << 21; insn |= 1 << 21;
...@@ -485,9 +467,7 @@ insert_bdm (insn, value, errmsg) ...@@ -485,9 +467,7 @@ insert_bdm (insn, value, errmsg)
} }
static long static long
extract_bdm (insn, invalid) extract_bdm(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL if (invalid != (int *) NULL
&& ((insn & (1 << 21)) == 0 && ((insn & (1 << 21)) == 0
...@@ -505,10 +485,7 @@ extract_bdm (insn, invalid) ...@@ -505,10 +485,7 @@ extract_bdm (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_bdp (insn, value, errmsg) insert_bdp(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if ((value & 0x8000) == 0) if ((value & 0x8000) == 0)
insn |= 1 << 21; insn |= 1 << 21;
...@@ -516,9 +493,7 @@ insert_bdp (insn, value, errmsg) ...@@ -516,9 +493,7 @@ insert_bdp (insn, value, errmsg)
} }
static long static long
extract_bdp (insn, invalid) extract_bdp(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL if (invalid != (int *) NULL
&& ((insn & (1 << 21)) == 0 && ((insn & (1 << 21)) == 0
...@@ -561,10 +536,7 @@ valid_bo (long value) ...@@ -561,10 +536,7 @@ valid_bo (long value)
the field to an illegal value. */ the field to an illegal value. */
static unsigned long static unsigned long
insert_bo (insn, value, errmsg) insert_bo(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (errmsg != (const char **) NULL if (errmsg != (const char **) NULL
&& ! valid_bo (value)) && ! valid_bo (value))
...@@ -573,9 +545,7 @@ insert_bo (insn, value, errmsg) ...@@ -573,9 +545,7 @@ insert_bo (insn, value, errmsg)
} }
static long static long
extract_bo (insn, invalid) extract_bo(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
long value; long value;
...@@ -591,10 +561,7 @@ extract_bo (insn, invalid) ...@@ -591,10 +561,7 @@ extract_bo (insn, invalid)
extracting it, we force it to be even. */ extracting it, we force it to be even. */
static unsigned long static unsigned long
insert_boe (insn, value, errmsg) insert_boe(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (errmsg != (const char **) NULL) if (errmsg != (const char **) NULL)
{ {
...@@ -607,9 +574,7 @@ insert_boe (insn, value, errmsg) ...@@ -607,9 +574,7 @@ insert_boe (insn, value, errmsg)
} }
static long static long
extract_boe (insn, invalid) extract_boe(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
long value; long value;
...@@ -625,19 +590,14 @@ extract_boe (insn, invalid) ...@@ -625,19 +590,14 @@ extract_boe (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_ds (insn, value, errmsg) insert_ds(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (value & 0xfffc); return insn | (value & 0xfffc);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_ds (insn, invalid) extract_ds(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if ((insn & 0x8000) != 0) if ((insn & 0x8000) != 0)
return (insn & 0xfffc) - 0x10000; return (insn & 0xfffc) - 0x10000;
...@@ -650,19 +610,14 @@ extract_ds (insn, invalid) ...@@ -650,19 +610,14 @@ extract_ds (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_li (insn, value, errmsg) insert_li(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (value & 0x3fffffc); return insn | (value & 0x3fffffc);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_li (insn, invalid) extract_li(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if ((insn & 0x2000000) != 0) if ((insn & 0x2000000) != 0)
return (insn & 0x3fffffc) - 0x4000000; return (insn & 0x3fffffc) - 0x4000000;
...@@ -676,10 +631,7 @@ extract_li (insn, invalid) ...@@ -676,10 +631,7 @@ extract_li (insn, invalid)
instruction which uses a field of this type. */ instruction which uses a field of this type. */
static unsigned long static unsigned long
insert_mbe (insn, value, errmsg) insert_mbe(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
unsigned long uval; unsigned long uval;
int mb, me; int mb, me;
...@@ -718,9 +670,7 @@ insert_mbe (insn, value, errmsg) ...@@ -718,9 +670,7 @@ insert_mbe (insn, value, errmsg)
} }
static long static long
extract_mbe (insn, invalid) extract_mbe(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
long ret; long ret;
int mb, me; int mb, me;
...@@ -742,19 +692,14 @@ extract_mbe (insn, invalid) ...@@ -742,19 +692,14 @@ extract_mbe (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_mb6 (insn, value, errmsg) insert_mb6(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | ((value & 0x1f) << 6) | (value & 0x20); return insn | ((value & 0x1f) << 6) | (value & 0x20);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_mb6 (insn, invalid) extract_mb6(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
return ((insn >> 6) & 0x1f) | (insn & 0x20); return ((insn >> 6) & 0x1f) | (insn & 0x20);
} }
...@@ -763,10 +708,7 @@ extract_mb6 (insn, invalid) ...@@ -763,10 +708,7 @@ extract_mb6 (insn, invalid)
0. */ 0. */
static unsigned long static unsigned long
insert_nb (insn, value, errmsg) insert_nb(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (value < 0 || value > 32) if (value < 0 || value > 32)
*errmsg = "value out of range"; *errmsg = "value out of range";
...@@ -777,9 +719,7 @@ insert_nb (insn, value, errmsg) ...@@ -777,9 +719,7 @@ insert_nb (insn, value, errmsg)
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_nb (insn, invalid) extract_nb(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
long ret; long ret;
...@@ -796,18 +736,13 @@ extract_nb (insn, invalid) ...@@ -796,18 +736,13 @@ extract_nb (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_nsi (insn, value, errmsg) insert_nsi(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | ((- value) & 0xffff); return insn | ((- value) & 0xffff);
} }
static long static long
extract_nsi (insn, invalid) extract_nsi(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL) if (invalid != (int *) NULL)
*invalid = 1; *invalid = 1;
...@@ -822,10 +757,7 @@ extract_nsi (insn, invalid) ...@@ -822,10 +757,7 @@ extract_nsi (insn, invalid)
equal the RT field. */ equal the RT field. */
static unsigned long static unsigned long
insert_ral (insn, value, errmsg) insert_ral(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (value == 0 if (value == 0
|| value == ((insn >> 21) & 0x1f)) || value == ((insn >> 21) & 0x1f))
...@@ -837,10 +769,7 @@ insert_ral (insn, value, errmsg) ...@@ -837,10 +769,7 @@ insert_ral (insn, value, errmsg)
restrictions. */ restrictions. */
static unsigned long static unsigned long
insert_ram (insn, value, errmsg) insert_ram(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (value >= ((insn >> 21) & 0x1f)) if (value >= ((insn >> 21) & 0x1f))
*errmsg = "index register in load range"; *errmsg = "index register in load range";
...@@ -852,10 +781,7 @@ insert_ram (insn, value, errmsg) ...@@ -852,10 +781,7 @@ insert_ram (insn, value, errmsg)
field may not be zero. */ field may not be zero. */
static unsigned long static unsigned long
insert_ras (insn, value, errmsg) insert_ras(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (value == 0) if (value == 0)
*errmsg = "invalid register operand when updating"; *errmsg = "invalid register operand when updating";
...@@ -870,18 +796,13 @@ insert_ras (insn, value, errmsg) ...@@ -870,18 +796,13 @@ insert_ras (insn, value, errmsg)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_rbs (insn, value, errmsg) insert_rbs(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | (((insn >> 21) & 0x1f) << 11); return insn | (((insn >> 21) & 0x1f) << 11);
} }
static long static long
extract_rbs (insn, invalid) extract_rbs(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
if (invalid != (int *) NULL if (invalid != (int *) NULL
&& ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f)) && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
...@@ -893,19 +814,14 @@ extract_rbs (insn, invalid) ...@@ -893,19 +814,14 @@ extract_rbs (insn, invalid)
/*ARGSUSED*/ /*ARGSUSED*/
static unsigned long static unsigned long
insert_sh6 (insn, value, errmsg) insert_sh6(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4); return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static long static long
extract_sh6 (insn, invalid) extract_sh6(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20); return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
} }
...@@ -914,18 +830,13 @@ extract_sh6 (insn, invalid) ...@@ -914,18 +830,13 @@ extract_sh6 (insn, invalid)
lower 5 bits are stored in the upper 5 and vice- versa. */ lower 5 bits are stored in the upper 5 and vice- versa. */
static unsigned long static unsigned long
insert_spr (insn, value, errmsg) insert_spr(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6); return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
} }
static long static long
extract_spr (insn, invalid) extract_spr(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0); return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
} }
...@@ -941,10 +852,7 @@ extract_spr (insn, invalid) ...@@ -941,10 +852,7 @@ extract_spr (insn, invalid)
#define TB (268) #define TB (268)
static unsigned long static unsigned long
insert_tbr (insn, value, errmsg) insert_tbr(unsigned long insn, long value, const char **errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ {
if (value == 0) if (value == 0)
value = TB; value = TB;
...@@ -952,9 +860,7 @@ insert_tbr (insn, value, errmsg) ...@@ -952,9 +860,7 @@ insert_tbr (insn, value, errmsg)
} }
static long static long
extract_tbr (insn, invalid) extract_tbr(unsigned long insn, int *invalid)
unsigned long insn;
int *invalid;
{ {
long ret; long ret;
......
...@@ -356,7 +356,7 @@ at_breakpoint(unsigned pc) ...@@ -356,7 +356,7 @@ at_breakpoint(unsigned pc)
} }
static void static void
insert_bpts() insert_bpts(void)
{ {
int i; int i;
struct bpt *bp; struct bpt *bp;
...@@ -382,7 +382,7 @@ insert_bpts() ...@@ -382,7 +382,7 @@ insert_bpts()
} }
static void static void
remove_bpts() remove_bpts(void)
{ {
int i; int i;
struct bpt *bp; struct bpt *bp;
...@@ -843,7 +843,7 @@ backtrace(struct pt_regs *excp) ...@@ -843,7 +843,7 @@ backtrace(struct pt_regs *excp)
} }
int int
getsp() getsp(void)
{ {
int x; int x;
...@@ -969,7 +969,7 @@ print_sysmap(void) ...@@ -969,7 +969,7 @@ print_sysmap(void)
} }
void void
super_regs() super_regs(void)
{ {
int i, cmd; int i, cmd;
unsigned val; unsigned val;
...@@ -1019,7 +1019,7 @@ super_regs() ...@@ -1019,7 +1019,7 @@ super_regs()
#ifndef CONFIG_PPC_STD_MMU #ifndef CONFIG_PPC_STD_MMU
static void static void
dump_hash_table() dump_hash_table(void)
{ {
printf("This CPU doesn't have a hash table.\n"); printf("This CPU doesn't have a hash table.\n");
} }
...@@ -1149,7 +1149,7 @@ static unsigned hash_start; ...@@ -1149,7 +1149,7 @@ static unsigned hash_start;
static unsigned hash_end; static unsigned hash_end;
static void static void
dump_hash_table() dump_hash_table(void)
{ {
int seg; int seg;
unsigned seg_start, seg_end; unsigned seg_start, seg_end;
...@@ -1271,7 +1271,7 @@ static int brev; ...@@ -1271,7 +1271,7 @@ static int brev;
static int mnoread; static int mnoread;
void void
memex() memex(void)
{ {
int cmd, inc, i, nslash; int cmd, inc, i, nslash;
unsigned n; unsigned n;
...@@ -1408,7 +1408,7 @@ memex() ...@@ -1408,7 +1408,7 @@ memex()
} }
int int
bsesc() bsesc(void)
{ {
int c; int c;
...@@ -1423,7 +1423,7 @@ bsesc() ...@@ -1423,7 +1423,7 @@ bsesc()
} }
void void
dump() dump(void)
{ {
int c; int c;
...@@ -1522,8 +1522,7 @@ ppc_inst_dump(unsigned adr, int count) ...@@ -1522,8 +1522,7 @@ ppc_inst_dump(unsigned adr, int count)
} }
void void
print_address(addr) print_address(unsigned addr)
unsigned addr;
{ {
printf("0x%x", addr); printf("0x%x", addr);
} }
...@@ -1582,7 +1581,7 @@ static unsigned mend; ...@@ -1582,7 +1581,7 @@ static unsigned mend;
static unsigned mask; static unsigned mask;
void void
memlocate() memlocate(void)
{ {
unsigned a, n; unsigned a, n;
unsigned char val[4]; unsigned char val[4];
...@@ -1615,7 +1614,7 @@ static unsigned mskip = 0x1000; ...@@ -1615,7 +1614,7 @@ static unsigned mskip = 0x1000;
static unsigned mlim = 0xffffffff; static unsigned mlim = 0xffffffff;
void void
memzcan() memzcan(void)
{ {
unsigned char v; unsigned char v;
unsigned a; unsigned a;
...@@ -1679,7 +1678,7 @@ void proccall(void) ...@@ -1679,7 +1678,7 @@ void proccall(void)
/* Input scanning routines */ /* Input scanning routines */
int int
skipbl() skipbl(void)
{ {
int c; int c;
...@@ -1704,8 +1703,7 @@ static char *regnames[N_PTREGS] = { ...@@ -1704,8 +1703,7 @@ static char *regnames[N_PTREGS] = {
}; };
int int
scanhex(vp) scanhex(unsigned *vp)
unsigned *vp;
{ {
int c, d; int c, d;
unsigned v; unsigned v;
...@@ -1776,7 +1774,7 @@ unsigned *vp; ...@@ -1776,7 +1774,7 @@ unsigned *vp;
} }
void void
scannl() scannl(void)
{ {
int c; int c;
...@@ -1786,8 +1784,7 @@ scannl() ...@@ -1786,8 +1784,7 @@ scannl()
c = inchar(); c = inchar();
} }
int int hexdigit(int c)
hexdigit(c)
{ {
if( '0' <= c && c <= '9' ) if( '0' <= c && c <= '9' )
return c - '0'; return c - '0';
...@@ -1819,13 +1816,13 @@ static char line[256]; ...@@ -1819,13 +1816,13 @@ static char line[256];
static char *lineptr; static char *lineptr;
void void
flush_input() flush_input(void)
{ {
lineptr = NULL; lineptr = NULL;
} }
int int
inchar() inchar(void)
{ {
if (lineptr == NULL || *lineptr == 0) { if (lineptr == NULL || *lineptr == 0) {
if (fgets(line, sizeof(line), stdin) == NULL) { if (fgets(line, sizeof(line), stdin) == NULL) {
...@@ -1838,8 +1835,7 @@ inchar() ...@@ -1838,8 +1835,7 @@ inchar()
} }
void void
take_input(str) take_input(char *str)
char *str;
{ {
lineptr = str; lineptr = str;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment