- Fix two bugs; inst_call() is supposed to check OP_SPECIAL opcode with

either OP_JR function code or *OP_JALR* function code (not OP_JAL opcode).
insn_unconditional_flow_transfer() was to read an unintialized variable.
Those MD DDB routines seems not useful work so far.
This commit is contained in:
nisimura 1998-11-25 01:14:48 +00:00
parent f53f6fbf73
commit 53ac67d9b1
1 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.c,v 1.6 1998/10/28 04:28:32 jonathan Exp $ */ /* $NetBSD: db_interface.c,v 1.7 1998/11/25 01:14:48 nisimura Exp $ */
/* /*
* Mach Operating System * Mach Operating System
@ -357,26 +357,26 @@ boolean_t
inst_call(inst) inst_call(inst)
int inst; int inst;
{ {
register int rv = 0;
InstFmt i; InstFmt i;
int call;
i.word = inst; i.word = inst;
if (i.JType.op == OP_SPECIAL
if (i.JType.op == OP_SPECIAL) { && (i.RType.func == OP_JR || i.RType.func == OP_JALR))
if (i.RType.func == OP_JR || i.RType.func == OP_JAL) call = 1;
rv = 1; else if (i.JType.op == OP_JAL)
} else if (i.JType.op == OP_JAL) call = 1;
rv = 1; else
call = 0;
#ifdef DEBUG_DDB #ifdef DEBUG_DDB
printf(" inst_call(0x%x) returns 0x%d\n", printf(" inst_call(0x%x) returns 0x%d\n", inst, call);
inst, rv); #endif
#endif return call;
return rv;
} }
/* /*
* inst_unctiondional_flow_transfer() * inst_unconditional_flow_transfer()
* return TRUE if the instruction is an unconditional * return TRUE if the instruction is an unconditional
* transter of flow (i.e. unconditional branch) * transter of flow (i.e. unconditional branch)
*/ */
@ -384,15 +384,15 @@ boolean_t
inst_unconditional_flow_transfer(int inst) inst_unconditional_flow_transfer(int inst)
{ {
InstFmt i; InstFmt i;
int rv = 0; int jump;
if (i.JType.op == OP_J) rv = 1;
i.word = inst;
jump = (i.JType.op == OP_J);
#ifdef DEBUG_DDB #ifdef DEBUG_DDB
printf(" insn_unconditional_flow_transfer(0x%x) returns %d\n", printf(" insn_unconditional_flow_transfer(0x%x) returns %d\n",
inst, rv); inst, jump);
#endif #endif
return rv; return jump;
} }
/* /*