FreeBSD/sys/powerpc/powerpc/interrupt.c
/*
 * A very short dispatch, to try and maximise assembler code use
 * between all exception types. Maybe 'true' interrupts should go
 * here, and the trap code can come in separately
 */
A very short dispatch, to try and maximise assembler code use
between all exception types. Maybe 'true' interrupts should go
here, and the trap code can come in separately
A very short dispatch to try and maximise assembler code use between all exception types . Maybe ' true ' interrupts should go here and the trap code can come in separately
void
powerpc_interrupt(struct trapframe *framep)
{
	struct thread *td;
	struct trapframe *oldframe;
	register_t ee;
	td = curthread;
	CTR2(KTR_INTR, "%s: EXC=%x", __func__, framep->exc);
	switch (framep->exc) {
	case EXC_EXI:
		critical_enter();
		PIC_DISPATCH(root_pic, framep);
		critical_exit();
		break;
	case EXC_DECR:
		critical_enter();
		atomic_add_int(&td->td_intr_nesting_level, 1);
		oldframe = td->td_intr_frame;
		td->td_intr_frame = framep;
		decr_intr(framep);
		td->td_intr_frame = oldframe;
		atomic_subtract_int(&td->td_intr_nesting_level, 1);
		critical_exit();
		break;
#ifdef HWPMC_HOOKS
	case EXC_PERF:
		critical_enter();
		KASSERT(pmc_intr != NULL, ("Performance exception, but no handler!"));
		(*pmc_intr)(PCPU_GET(cpuid), framep);
		if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
			pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep);
		critical_exit();
		break;
#endif
	default:
		ee = framep->srr1 & PSL_EE;
		if (ee != 0)
			mtmsr(mfmsr() | ee);
		trap(framep);
	}	        
}
void powerpc_interrupt ( struct trapframe * framep ) { struct thread * td ; struct trapframe * oldframe ; register_t ee ; td = curthread ; CTR2 ( KTR_INTR , " " , __func__ , framep -> exc ) ; switch ( framep -> exc ) { case EXC_EXI : critical_enter ( ) ; PIC_DISPATCH ( root_pic , framep ) ; critical_exit ( ) ; break ; case EXC_DECR : critical_enter ( ) ; atomic_add_int ( & td -> td_intr_nesting_level , 1 ) ; oldframe = td -> td_intr_frame ; td -> td_intr_frame = framep ; decr_intr ( framep ) ; td -> td_intr_frame = oldframe ; atomic_subtract_int ( & td -> td_intr_nesting_level , 1 ) ; critical_exit ( ) ; break ; #ifdef HWPMC_HOOKS case EXC_PERF : critical_enter ( ) ; KASSERT ( pmc_intr != NULL , ( " " ) ) ; ( * pmc_intr ) ( PCPU_GET ( cpuid ) , framep ) ; if ( pmc_hook && ( PCPU_GET ( curthread ) -> td_pflags & TDP_CALLCHAIN ) ) pmc_hook ( PCPU_GET ( curthread ) , PMC_FN_USER_CALLCHAIN , framep ) ; critical_exit ( ) ; break ; #endif default : ee = framep -> srr1 & PSL_EE ; if ( ee != 0 ) mtmsr ( mfmsr ( ) | ee ) ; trap ( framep ) ; } }
A very short dispatch, to try and maximise assembler code use
 between all exception types.
A very short dispatch to try and maximise assembler code use between all exception types .
/* Re-enable interrupts if applicable. */