|  | @@ -134,3 +134,159 @@ asmlinkage notrace void trap_c(struct pt_regs *fp)
 | 
	
		
			
				|  |  |  		goto traps_done;
 | 
	
		
			
				|  |  |  #endif
 | 
	
		
			
				|  |  |  	/* 0x04 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x05 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x06 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x07 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x08 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x09 - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0A - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0B - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0C - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0D - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0E - User Defined */
 | 
	
		
			
				|  |  | +	/* 0x0F - User Defined */
 | 
	
		
			
				|  |  | +	/* If we got here, it is most likely that someone was trying to use a
 | 
	
		
			
				|  |  | +	 * custom exception handler, and it is not actually installed properly
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	case VEC_EXCPT04 ... VEC_EXCPT15:
 | 
	
		
			
				|  |  | +		info.si_code = ILL_ILLPARAOP;
 | 
	
		
			
				|  |  | +		sig = SIGILL;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x04(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x10 HW Single step, handled here */
 | 
	
		
			
				|  |  | +	case VEC_STEP:
 | 
	
		
			
				|  |  | +		info.si_code = TRAP_STEP;
 | 
	
		
			
				|  |  | +		sig = SIGTRAP;
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		/* Check if this is a single step in kernel space */
 | 
	
		
			
				|  |  | +		if (kernel_mode_regs(fp))
 | 
	
		
			
				|  |  | +			goto traps_done;
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			break;
 | 
	
		
			
				|  |  | +	/* 0x11 - Trace Buffer Full, handled here */
 | 
	
		
			
				|  |  | +	case VEC_OVFLOW:
 | 
	
		
			
				|  |  | +		info.si_code = TRAP_TRACEFLOW;
 | 
	
		
			
				|  |  | +		sig = SIGTRAP;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x11(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x12 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x13 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x14 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x15 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x16 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x17 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x18 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x19 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1A - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1B - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1C - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1D - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1E - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x1F - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x20 - Reserved, Caught by default */
 | 
	
		
			
				|  |  | +	/* 0x21 - Undefined Instruction, handled here */
 | 
	
		
			
				|  |  | +	case VEC_UNDEF_I:
 | 
	
		
			
				|  |  | +#ifdef CONFIG_BUG
 | 
	
		
			
				|  |  | +		if (kernel_mode_regs(fp)) {
 | 
	
		
			
				|  |  | +			switch (report_bug(fp->pc, fp)) {
 | 
	
		
			
				|  |  | +			case BUG_TRAP_TYPE_NONE:
 | 
	
		
			
				|  |  | +				break;
 | 
	
		
			
				|  |  | +			case BUG_TRAP_TYPE_WARN:
 | 
	
		
			
				|  |  | +				dump_bfin_trace_buffer();
 | 
	
		
			
				|  |  | +				fp->pc += 2;
 | 
	
		
			
				|  |  | +				goto traps_done;
 | 
	
		
			
				|  |  | +			case BUG_TRAP_TYPE_BUG:
 | 
	
		
			
				|  |  | +				/* call to panic() will dump trace, and it is
 | 
	
		
			
				|  |  | +				 * off at this point, so it won't be clobbered
 | 
	
		
			
				|  |  | +				 */
 | 
	
		
			
				|  |  | +				panic("BUG()");
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +#ifdef CONFIG_BFIN_PSEUDODBG_INSNS
 | 
	
		
			
				|  |  | +		/*
 | 
	
		
			
				|  |  | +		 * Support for the fake instructions, if the instruction fails,
 | 
	
		
			
				|  |  | +		 * then just execute a illegal opcode failure (like normal).
 | 
	
		
			
				|  |  | +		 * Don't support these instructions inside the kernel
 | 
	
		
			
				|  |  | +		 */
 | 
	
		
			
				|  |  | +		if (!kernel_mode_regs(fp) && get_instruction(&opcode, (unsigned short *)fp->pc)) {
 | 
	
		
			
				|  |  | +			if (execute_pseudodbg_assert(fp, opcode))
 | 
	
		
			
				|  |  | +				goto traps_done;
 | 
	
		
			
				|  |  | +			if (execute_pseudodbg(fp, opcode))
 | 
	
		
			
				|  |  | +				goto traps_done;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		info.si_code = ILL_ILLOPC;
 | 
	
		
			
				|  |  | +		sig = SIGILL;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x21(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x22 - Illegal Instruction Combination, handled here */
 | 
	
		
			
				|  |  | +	case VEC_ILGAL_I:
 | 
	
		
			
				|  |  | +		info.si_code = ILL_ILLPARAOP;
 | 
	
		
			
				|  |  | +		sig = SIGILL;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x22(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x23 - Data CPLB protection violation, handled here */
 | 
	
		
			
				|  |  | +	case VEC_CPLB_VL:
 | 
	
		
			
				|  |  | +		info.si_code = ILL_CPLB_VI;
 | 
	
		
			
				|  |  | +		sig = SIGSEGV;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x23(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x24 - Data access misaligned, handled here */
 | 
	
		
			
				|  |  | +	case VEC_MISALI_D:
 | 
	
		
			
				|  |  | +		info.si_code = BUS_ADRALN;
 | 
	
		
			
				|  |  | +		sig = SIGBUS;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x24(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x25 - Unrecoverable Event, handled here */
 | 
	
		
			
				|  |  | +	case VEC_UNCOV:
 | 
	
		
			
				|  |  | +		info.si_code = ILL_ILLEXCPT;
 | 
	
		
			
				|  |  | +		sig = SIGILL;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x25(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
 | 
	
		
			
				|  |  | +		error case is handled here */
 | 
	
		
			
				|  |  | +	case VEC_CPLB_M:
 | 
	
		
			
				|  |  | +		info.si_code = BUS_ADRALN;
 | 
	
		
			
				|  |  | +		sig = SIGBUS;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE EXC_0x26(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
 | 
	
		
			
				|  |  | +	case VEC_CPLB_MHIT:
 | 
	
		
			
				|  |  | +		info.si_code = ILL_CPLB_MULHIT;
 | 
	
		
			
				|  |  | +		sig = SIGSEGV;
 | 
	
		
			
				|  |  | +#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
 | 
	
		
			
				|  |  | +		if (cpu_pda[cpu].dcplb_fault_addr < FIXED_CODE_START)
 | 
	
		
			
				|  |  | +			strerror = KERN_NOTICE "NULL pointer access\n";
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +			strerror = KERN_NOTICE EXC_0x27(KERN_NOTICE);
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +	/* 0x28 - Emulation Watchpoint, handled here */
 | 
	
		
			
				|  |  | +	case VEC_WATCH:
 | 
	
		
			
				|  |  | +		info.si_code = TRAP_WATCHPT;
 | 
	
		
			
				|  |  | +		sig = SIGTRAP;
 | 
	
		
			
				|  |  | +		pr_debug(EXC_0x28(KERN_DEBUG));
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		/* Check if this is a watchpoint in kernel space */
 | 
	
		
			
				|  |  | +		if (kernel_mode_regs(fp))
 | 
	
		
			
				|  |  | +			goto traps_done;
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			break;
 | 
	
		
			
				|  |  | +#ifdef CONFIG_BF535
 | 
	
		
			
				|  |  | +	/* 0x29 - Instruction fetch access error (535 only) */
 | 
	
		
			
				|  |  | +	case VEC_ISTRU_VL:      /* ADSP-BF535 only (MH) */
 | 
	
		
			
				|  |  | +		info.si_code = BUS_OPFETCH;
 | 
	
		
			
				|  |  | +		sig = SIGBUS;
 | 
	
		
			
				|  |  | +		strerror = KERN_NOTICE "BF535: VEC_ISTRU_VL\n";
 | 
	
		
			
				|  |  | +		CHK_DEBUGGER_TRAP_MAYBE();
 | 
	
		
			
				|  |  | +		break;
 | 
	
		
			
				|  |  | +#else
 |