FreeBSD/sys/mips/mips/db_interface.c
/*
 *	Decode instruction and figure out type.
 */
Decode instruction and figure out type.
Decode instruction and figure out type .
int
db_inst_type(int ins)
{
	InstFmt inst;
	int	ityp = 0;
	inst.word = ins;
	switch ((int)inst.JType.op) {
	case OP_SPECIAL:
		switch ((int)inst.RType.func) {
		case OP_JR:
			ityp = IT_BRANCH;
			break;
		case OP_JALR:
		case OP_SYSCALL:
			ityp = IT_CALL;
			break;
		}
		break;
	case OP_BCOND:
		switch ((int)inst.IType.rt) {
		case OP_BLTZ:
		case OP_BLTZL:
		case OP_BGEZ:
		case OP_BGEZL:
			ityp = IT_BRANCH;
			break;
		case OP_BLTZAL:
		case OP_BLTZALL:
		case OP_BGEZAL:
		case OP_BGEZALL:
			ityp = IT_CALL;
			break;
		}
		break;
	case OP_JAL:
		ityp = IT_CALL;
		break;
	case OP_J:
	case OP_BEQ:
	case OP_BEQL:
	case OP_BNE:
	case OP_BNEL:
	case OP_BLEZ:
	case OP_BLEZL:
	case OP_BGTZ:
	case OP_BGTZL:
		ityp = IT_BRANCH;
		break;
	case OP_COP1:
		switch (inst.RType.rs) {
		case OP_BCx:
		case OP_BCy:
			ityp = IT_BRANCH;
			break;
		}
		break;
	case OP_LB:
	case OP_LH:
	case OP_LW:
	case OP_LD:
	case OP_LBU:
	case OP_LHU:
	case OP_LWU:
	case OP_LWC1:
		ityp = IT_LOAD;
		break;
	case OP_SB:
	case OP_SH:
	case OP_SW:
	case OP_SD:  
	case OP_SWC1:
		ityp = IT_STORE;
		break;
	}
	return (ityp);
}
int db_inst_type ( int ins ) { InstFmt inst ; int ityp = 0 ; inst . word = ins ; switch ( ( int ) inst . JType . op ) { case OP_SPECIAL : switch ( ( int ) inst . RType . func ) { case OP_JR : ityp = IT_BRANCH ; break ; case OP_JALR : case OP_SYSCALL : ityp = IT_CALL ; break ; } break ; case OP_BCOND : switch ( ( int ) inst . IType . rt ) { case OP_BLTZ : case OP_BLTZL : case OP_BGEZ : case OP_BGEZL : ityp = IT_BRANCH ; break ; case OP_BLTZAL : case OP_BLTZALL : case OP_BGEZAL : case OP_BGEZALL : ityp = IT_CALL ; break ; } break ; case OP_JAL : ityp = IT_CALL ; break ; case OP_J : case OP_BEQ : case OP_BEQL : case OP_BNE : case OP_BNEL : case OP_BLEZ : case OP_BLEZL : case OP_BGTZ : case OP_BGTZL : ityp = IT_BRANCH ; break ; case OP_COP1 : switch ( inst . RType . rs ) { case OP_BCx : case OP_BCy : ityp = IT_BRANCH ; break ; } break ; case OP_LB : case OP_LH : case OP_LW : case OP_LD : case OP_LBU : case OP_LHU : case OP_LWU : case OP_LWC1 : ityp = IT_LOAD ; break ; case OP_SB : case OP_SH : case OP_SW : case OP_SD : case OP_SWC1 : ityp = IT_STORE ; break ; } return ( ityp ) ; }
Decode instruction and figure out type.
Decode instruction and figure out type .