⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excarchshow.c

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
    {_EXC_OFF_DECR, "decrementer"},    {_EXC_OFF_SYSCALL, "system call"},    {_EXC_OFF_TRACE, "trace"},    {_EXC_OFF_SW_EMUL, "Implementation Dependent Software Emulation"},    {_EXC_OFF_INST_MISS, "Implementation Dependent Instruction TLB Miss"},    {_EXC_OFF_DATA_MISS, "Implementation Dependent Data TLB Miss"},    {_EXC_OFF_INST_ERROR, "Implementation Dependent Instruction TLB Error"},    {_EXC_OFF_DATA_ERROR, "Implementation Dependent Data TLB Error"},    {_EXC_OFF_DATA_BKPT, "Implementation Dependent Data Breakpoint "},    {_EXC_OFF_INST_BKPT, "Implementation Dependent Instruction Breakpoint"},    {_EXC_OFF_PERI_BKPT, "Implementation Dependent Peripheral Breakpoint"},    {_EXC_OFF_NM_DEV_PORT, "Implementation Dependent Non Maskable Development Port"},#endif	/* (CPU == PPC860) */    {0, NULL}    };#ifdef	_PPC_MSR_FP/* * Floating Point Exception error messages.  * Exception numbers correspond to exception status bits in the FPSCR register.  */EXC_MSG_TBL fpExcMsgTbl [] = {    {_PPC_FPSCR_OX, "Floating point overflow"},    {_PPC_FPSCR_UX, "Floating point underflow"},    {_PPC_FPSCR_ZX, "Floating point divide by zero"},    {_PPC_FPSCR_XX, "Floating point inexact"},    {_PPC_FPSCR_VXSNAN, "Floating point invalid operation for SNAN"},    {_PPC_FPSCR_VXISI, "Floating point invalid operation for INF - INF"},    {_PPC_FPSCR_VXIDI, "Floating point invalid operation for INF / INF"},    {_PPC_FPSCR_VXZDZ, "Floating point invalid operation for 0 / 0"},    {_PPC_FPSCR_VXIMZ, "Floating point invalid operation for INF * 0"},    {_PPC_FPSCR_VXVC, "Floating point invalid operation for invalide compare"},    {_PPC_FPSCR_VXSOFT,"Floating point invalid operation for software request"},    {_PPC_FPSCR_VXSQRT, "Floating point invalid operation for square root"},    {_PPC_FPSCR_VXCVI, "Floating point invalid operation for interger convert"},    {0, NULL}    };#endif  /* _PPC_MSR_FP *//* forward declarations */LOCAL void excInfoShow (EXC_INFO *pExcInfo, BOOL doBell);/* XXX LOCAL void excIntInfoShow (int vecOff, ESFPPC *pEsf, USHORT eid); */LOCAL void excPanicShow (int vecOff, ESFPPC *pEsf, REG_SET *pRegs,			 EXC_INFO *pExcInfo);/********************************************************************************* excShowInit - initialize exception show facility** NOMANUAL*/STATUS excShowInit (void)    {    _func_excInfoShow	= (FUNCPTR) excInfoShow;/* XXX    _func_excIntHook	= (FUNCPTR) excIntInfoShow; */    _func_excPanicHook	= (FUNCPTR) excPanicShow;    return (OK);    }#ifdef	_PPC_MSR_FP/********************************************************************************* excFpCheck - check if a FP exception occured** This routine verifies if a floating point exception happened and displays* relevant exception messages according to the FPSCR status bits.** RETURNS: FALSE or TRUE if a floating point exception did occured** NOMANUAL*/LOCAL BOOL excFpCheck    (    UINT32 fpscrReg     /* Floating Point Status and Control register value */    )    {    int ix = 0;    UINT32 fpExc;    fpExc = fpscrReg & _PPC_FPSCR_EXC_MASK;    if (((fpscrReg & (_PPC_FPSCR_FX | _PPC_FPSCR_FEX | _PPC_FPSCR_VX)) == 0) ||        (fpExc == 0))        return (FALSE);    /*     * a floating point exception did occur: print messages according to      * FP exception types.     */    while (fpExcMsgTbl[ix].excMsg != NULL)        {        if ((fpExc & fpExcMsgTbl[ix].excVec) != 0)            printExc ("\n%s", (int) fpExcMsgTbl[ix].excMsg, 0, 0, 0, 0);        ix++;        }    printExc ("\n", 0, 0, 0, 0, 0);    return (TRUE);    }#endif  /* _PPC_MSR_FP *//********************************************************************************* excInfoShow - print exception info** NOMANUAL*/LOCAL void excInfoShow     (    EXC_INFO *	pExcInfo,    BOOL	doBell    )    {    FAST int valid  = pExcInfo->valid;    FAST int vecOff = pExcInfo->vecOff;    FAST int ix;#ifdef 	_PPC_MSR_FP    /* extra processing for hardware floating point exceptions */    if ((vecOff == _EXC_OFF_PROG) 			/* Program Excep. ? */# ifdef	_EXC_PROG_SRR1_FPU	&& ((pExcInfo->msr & _EXC_PROG_SRR1_FPU) == _EXC_PROG_SRR1_FPU)# endif	/* _EXC_PROG_SRR1_FPU */	&& excFpCheck (pExcInfo->fpcsr)			/* FP exc. conditions */	&& ((vxMsrGet() & _PPC_MSR_FP) != 0) 		/* MSR[FP] is set ? */	&& ((taskIdCurrent->options & VX_FP_TASK) != 0))        {        /* a floating point exception did occur: display FPSCR */        valid |= _EXC_INFO_FPCSR;        }    else			/* MMM: should this else be here? */#endif  /* _PPC_MSR_FP */    	if (valid & _EXC_INFO_VEC)	    {    	    /* print each piece of info if valid */	    for (ix = 0; excMsgTbl[ix].excVec != vecOff; ix ++)	    	{	    	if (excMsgTbl[ix].excMsg == NULL)	            break;	    	}	    if (excMsgTbl[ix].excMsg != NULL)	    	printExc ("\n%s\n", (int) excMsgTbl[ix].excMsg, 0, 0, 0, 0);		    else	    	printExc ("\nTrap to uninitialized vector number 0x%x.\n",		          vecOff, 0, 0, 0, 0);	    }    if (valid & _EXC_INFO_CIA)	printExc ("Exception current instruction address: 0x%08x\n", 		  (int) pExcInfo->cia, 0, 0, 0, 0);    if (valid & _EXC_INFO_NIA)	printExc ("Exception next instruction address: 0x%08x\n", 		  (int) pExcInfo->cia, 0, 0, 0, 0);    if (valid & _EXC_INFO_MSR)	printExc ("Machine Status Register: 0x%08x\n", 		  (int) pExcInfo->msr, 0, 0, 0, 0);#ifdef	_EXC_INFO_DAR    if (valid & _EXC_INFO_DAR)        printExc ("Data Access Register: 0x%08x\n", 		  (int) pExcInfo->dar, 0, 0, 0, 0);#endif	/* _EXC_INFO_DAR */#ifdef	_EXC_INFO_DEAR    if (valid & _EXC_INFO_DEAR)        printExc ("Data Exception Address Register: 0x%08x\n", 		  (int) pExcInfo->dear, 0, 0, 0, 0);#endif	/* _EXC_INFO_DEAR */    if (valid & _EXC_INFO_XER)        printExc ("Fixed Point Register: 0x%08x\n", 		  (int) pExcInfo->xer, 0, 0, 0, 0);    if (valid & _EXC_INFO_CR)        printExc ("Condition Register: 0x%08x\n", 		  (int) pExcInfo->cr, 0, 0, 0, 0);#ifdef	_EXC_INFO_FPCSR    if (valid & _EXC_INFO_FPCSR)        printExc ("Fp Control and Status Register: 0x%08x\n", 		  (int) pExcInfo->fpcsr, 0, 0, 0, 0);#endif	/* _EXC_INFO_FPCSR */#ifdef	_EXC_INFO_DSISR    if (valid & _EXC_INFO_DSISR)        printExc ("Data storage interrupt Register: 0x%08x\n", 		  (int) pExcInfo->dsisr, 0, 0, 0, 0);#endif	/* _EXC_INFO_DSISR */#ifdef	_EXC_INFO_BEAR    if (valid & _EXC_INFO_BEAR)        printExc ("Bus Error Address Register: 0x%08x\n", 		  (int) pExcInfo->bear, 0, 0, 0, 0);#endif	/* _EXC_INFO_BEAR */#ifdef	_EXC_INFO_BESR    if (valid & _EXC_INFO_BESR)        printExc ("Bus Error Syndrome Register: 0x%08x\n", 		  (int) pExcInfo->besr, 0, 0, 0, 0);#endif	/* _EXC_INFO_BESR */#ifdef	_EXC_INFO_SPEFSCR    if (valid & _EXC_INFO_SPEFSCR)        printExc ("SPE Floating-point Status and Control Register: 0x%08x\n", 		  (int) pExcInfo->spefscr, 0, 0, 0, 0);#endif	/* _EXC_INFO_SPEFSCR */#ifdef	_EXC_INFO_ESR    if (valid & _EXC_INFO_ESR)        printExc ("Exception Syndrome Register: 0x%08x\n", 		  (int) pExcInfo->mcesr, 0, 0, 0, 0);#endif	/* _EXC_INFO_ESR */#ifdef	_EXC_INFO_MCSR    if (valid & _EXC_INFO_MCSR)        {        printExc ("Machine Check Syndrome Register: 0x%08x\n", 		  (int) pExcInfo->mcesr, 0, 0, 0, 0);	/* print MCAR only if not caused by mchk input pin */        if (((pExcInfo->mcesr) & 0x80000000) == 0)            printExc ("Machine Check Address Register: 0x%08x\n", 		      (int) pExcInfo->dear, 0, 0, 0, 0);        }#endif	/* _EXC_INFO_MCSR */    if (doBell)	printExc ("Task: %#x \"%s\"\007\n", (int)taskIdCurrent, 		  (int)taskName ((int)taskIdCurrent), 0, 0, 0);    }/********************************************************************************* excPanicShow - exception at interrupt level** This routine is called if an exception is caused at interrupt* level.  We can't handle it in the usual way.  Instead, we save info in* sysExcMsg and trap to rom monitor.*/LOCAL void excPanicShow    (    int		vecOff,		/* exception vector number */    ESFPPC *	pEsf,		/* pointer to exception stack frame */    REG_SET *	pRegs,		/* pointer to register info on stack */    EXC_INFO *	pExcInfo	/* parsed exception information */    )    {    printExc (" \nException at interrupt level:\n", 0, 0, 0, 0, 0);    excInfoShow (pExcInfo, FALSE);	/* print the message into sysExcMsg */    printExc ("Regs at 0x%x\n", (int) pRegs, 0, 0, 0, 0);    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -