kernels/linux-2.4.0/arch/alpha/kernel/traps.c
/*
 * The purpose here is to provide useful clues about a kernel crash, so
 * less likely instructions, e.g. floating point, aren't fully decoded.
 */
The purpose here is to provide useful clues about a kernel crash, so
less likely instructions, e.g. floating point, aren't fully decoded.
The purpose here is to provide useful clues about a kernel crash so less likely instructions e . g . floating point aren ' t fully decoded .
static void
disassemble(unsigned int instr)
{
	int optype = instr >> 26;
	char buf[40], *s = buf;
	s += sprintf(buf, "%08x  %s ", instr, iname(instr));
	switch (iformat(optype)) {
		default:
		case NOT_INST:
		case MISC:
			break;
		case PAL:
			s += sprintf(s, "%d", instr);
			break;
		case BRANCH: {
			int reg = (instr >> 21) & 0x1f;
			int offset = instr & 0x1fffff;
			if (offset >= 0x100000)
				offset -= 0x200000;
			if (((optype & 3) == 0) || (optype >= 0x38)) {
				if ((optype != 0x30) || (reg != 0x1f))
					s += sprintf(s, "%s,", ireg_name[reg]);
			} else
				s += sprintf(s, "f%d,", reg);
			s += sprintf(s, ".%+d", (offset + 1) << 2);
			break;
		}
		case MEMORY: {
			int addr_reg = (instr >> 16) & 0x1f;
			int value_reg = (instr >> 21) & 0x1f;
			int offset = instr & 0xffff;
			if (offset >= 0x8000)
				offset -= 0x10000;
			if ((optype >= 0x20) && (optype < 0x28))
				s += sprintf(s, "f%d", value_reg);
			else
				s += sprintf(s, "%s", ireg_name[value_reg]);
			s += sprintf(s, ",%d(%s)", offset, ireg_name[addr_reg]);
			break;
		}
		case JUMP: {
			int target_reg = (instr >> 16) & 0x1f;
			int return_reg = (instr >> 21) & 0x1f;
			s += sprintf(s, "%s,", ireg_name[return_reg]);
			s += sprintf(s, "(%s)", ireg_name[target_reg]);
			break;
		}
		case OPERATE: {
			int areg = (instr >> 21) & 0x1f;
			int breg = (instr >> 16) & 0x1f;
			int creg = instr & 0x1f;
			int litflag = instr & (1<<12);
			int lit = (instr >> 13) & 0xff;
			s += sprintf(s, "%s,", ireg_name[areg]);
			if (litflag)
				s += sprintf(s, "%d", lit);
			else
				s += sprintf(s, "%s", ireg_name[breg]);
			s += sprintf(s, ",%s", ireg_name[creg]);
			break;
		}
		case FOPERATE: {
			int areg = (instr >> 21) & 0x1f;
			int breg = (instr >> 16) & 0x1f;
			int creg = instr & 0x1f;
			s += sprintf(s, "f%d,f%d,f%d", areg, breg, creg);
			break;
		}
	}
	buf[s-buf] = 0;
	printk("%s\n", buf);
}
static void disassemble ( unsigned int instr ) { int optype = instr >> 26 ; char buf [ 40 ] , * s = buf ; s += sprintf ( buf , " " , instr , iname ( instr ) ) ; switch ( iformat ( optype ) ) { default : case NOT_INST : case MISC : break ; case PAL : s += sprintf ( s , " " , instr ) ; break ; case BRANCH : { int reg = ( instr >> 21 ) & 0x1f ; int offset = instr & 0x1fffff ; if ( offset >= 0x100000 ) offset -= 0x200000 ; if ( ( ( optype & 3 ) == 0 ) || ( optype >= 0x38 ) ) { if ( ( optype != 0x30 ) || ( reg != 0x1f ) ) s += sprintf ( s , " " , ireg_name [ reg ] ) ; } else s += sprintf ( s , " " , reg ) ; s += sprintf ( s , " " , ( offset + 1 ) << 2 ) ; break ; } case MEMORY : { int addr_reg = ( instr >> 16 ) & 0x1f ; int value_reg = ( instr >> 21 ) & 0x1f ; int offset = instr & 0xffff ; if ( offset >= 0x8000 ) offset -= 0x10000 ; if ( ( optype >= 0x20 ) && ( optype < 0x28 ) ) s += sprintf ( s , " " , value_reg ) ; else s += sprintf ( s , " " , ireg_name [ value_reg ] ) ; s += sprintf ( s , " " , offset , ireg_name [ addr_reg ] ) ; break ; } case JUMP : { int target_reg = ( instr >> 16 ) & 0x1f ; int return_reg = ( instr >> 21 ) & 0x1f ; s += sprintf ( s , " " , ireg_name [ return_reg ] ) ; s += sprintf ( s , " " , ireg_name [ target_reg ] ) ; break ; } case OPERATE : { int areg = ( instr >> 21 ) & 0x1f ; int breg = ( instr >> 16 ) & 0x1f ; int creg = instr & 0x1f ; int litflag = instr & ( 1 << 12 ) ; int lit = ( instr >> 13 ) & 0xff ; s += sprintf ( s , " " , ireg_name [ areg ] ) ; if ( litflag ) s += sprintf ( s , " " , lit ) ; else s += sprintf ( s , " " , ireg_name [ breg ] ) ; s += sprintf ( s , " " , ireg_name [ creg ] ) ; break ; } case FOPERATE : { int areg = ( instr >> 21 ) & 0x1f ; int breg = ( instr >> 16 ) & 0x1f ; int creg = instr & 0x1f ; s += sprintf ( s , " " , areg , breg , creg ) ; break ; } } buf [ s - buf ] = 0 ; printk ( " \n " , buf ) ; }
The purpose here is to provide useful clues about a kernel crash, so
 less likely instructions, e.g.
The purpose here is to provide useful clues about a kernel crash so less likely instructions e . g .