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

📄 excalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* excALib.s - exception handling I80x86 assembly routines *//* Copyright 1984-1995 Wind River Systems, Inc. */	.data	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01d,26sep95,hdn  fixed a bug by incrementing _intCnt in excIntStub.01c,04jun93,hdn  updated to 5.1		  -overhauled		  -fixed #else and #endif		  -changed ASMLANGUAGE to _ASMLANGUAGE		  -changed copyright notice01b,13oct92,hdn  debugged.01a,28feb92,hdn  written based on TRON, 68k version.*//*DESCRIPTIONThis module contains the assembly language exception handling stub.It is connected directly to the 80x86 exception vectors.It sets up an appropriate environment and then calls a routinein excLib(1)..ne 26EXCEPTION STACK FRAME GROWTH.CS	   Exception/Trap               Interrupt                                     -----------------------                                      vector-number  sp_5 -----------------------       -----------------------	vector-number                 sp_1(pointer to ESFn)   sp_4 -----------------------       -----------------------        sp_1(pointer to ESFn)         sp_2(pointer to REGS)  sp_3 -----------------------       -----------------------        sp_2(pointer to REGS)         errno  sp_2 -----------------------       -----------------------        edi                           edi         |                             |        eax                           eax	eflags                        eflags	pc / return-address           pc / return-address  sp_1 -----------------------       -----------------------        EIP        ERROR              EIP  0x04 ---------  ---------          -----------------------        CS         EIP                CS  0x08 ---------  ---------          ---------        EFLAGS     CS                 EFLAGS  0x0c ---------  ---------          ---------                   EFLAGS    0x10            ---------        ESF0   or   ESF1              ESF0.CESEE ALSO: excLib(1)*/#define _ASMLANGUAGE#include "vxWorks.h"	/* internal */	.globl	_excCallTbl	/* Call table */	.globl	_excStub	/* uninitialized exception handler */	.globl	_excIntStub	/* uninitialized interrupt handler */	.text	.align 4/**************************************************************************** excCallTbl - table of Calls** NOMANUAL*/_excCallTbl:	call	_excStub	/* 0 */	/* divide error */	call	_excStub	/* debug */	call	_excStub	/* non-maskable interrupt */	call	_excStub	/* breakpoint */	call	_excStub	/* overflow */	call	_excStub	/* bound */	call	_excStub	/* invalid opcode */	call	_excStub	/* device not available */	call	_excStub	/* double fault */	call	_excStub	/* co-processor overrun */	call	_excStub	/* invalid TSS */	call	_excStub	/* segment not present */	call	_excStub	/* stack fault */	call	_excStub	/* general protection fault */	call	_excStub	/* page fault */	call	_excStub	/* reserved */	call	_excStub	/* 10 */ /* co-processor error */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub 	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excStub	/* unassigned reserved */	call	_excIntStub	/* 20 */ /* User Interrupts */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 30 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 40 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 50 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 60 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 70 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 80 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* 90 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* a0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* b0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* c0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* d0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* e0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	/* f0 */	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub	call	_excIntStub/*********************************************************************** excStub - exception handler** NOMANUAL*/	.align 4,0x90_excStub:	pushfl				/* save eflags */	pushal				/* save regs */	movl	%esp, %ebx		/* save pointer to regs */	/* compute vector offset from return address to Call in table */	movl	0x24(%esp), %eax	/* get Call return adrs */	subl	$4, %eax		/* adjust return adrs to be Call adrs */	subl	$_excCallTbl, %eax	/* get offset from start of Call table					 * (= vector offset) */	movl	$5, %ecx		/* turn vector offset into excep num */	cltd	idivl	%ecx			/* %eax has exception num */	/* check whether the exception stack frame is ESF0 or ESF1 */	cmpl	$8, %eax	jl	excStub1		/* vecNum < 8 , it is ESF0 */	cmpl	$14, %eax	jg	excStub1		/* vecNum > 14 , it is ESF0 */	cmpl	$9, %eax	je	excStub1		/* vecNum == 9 , it is ESF0 */	/* exception stack frame is ESF1 which has error-code */	movl	0x2c(%esp), %edx	/* get pc from ESF */	movl	%edx, 0x24(%esp)	/* replace a return addr by the pc */	pushl	%ebx			/* push pointer to REG_SET */	addl	$0x28, %ebx	pushl	%ebx			/* push pointer to ESF */	pushl	%eax			/* push exception number */	call	_excExcHandle	addl	$0xc, %esp		/* clean up pushed arguments */	popal				/* restore regs */	addl	$0xc, %esp		/* get pointer to ESF */	iret				/* retry the instruction */	.align 4,0x90excStub1:	/* exception stack frame is ESF0 */	movl	0x28(%esp), %edx	/* get pc from ESF */	movl	%edx, 0x24(%esp)	/* replace a return addr by the pc */	pushl	%ebx			/* push pointer to REG_SET */	addl	$0x28, %ebx	pushl	%ebx			/* push pointer to ESF */	pushl	%eax			/* push exception number */	call	_excExcHandle		/* do exception processing */	addl	$0xc, %esp		/* clean up pushed arguments */	popal				/* restore regs */	addl	$0x8, %esp		/* get pointer to ESF */	iret				/* retry the instruction *//*********************************************************************** excIntStub - uninitialized interrupt handler** NOMANUAL*/	.align 4,0x90_excIntStub:	incl	_intCnt			/* bump the counter */	pushfl				/* save eflags */	pushal				/* save regs */	movl	%esp, %ebx		/* save pointer to regs */	/* compute vector offset from return address to Call in table */	movl	0x24(%esp), %eax	/* get Call return adrs */	subl	$4, %eax		/* adjust return adrs to be Call adrs */	subl	$_excCallTbl, %eax	/* get offset from start of Call table					 * (= vector offset) */	movl	$5, %ecx		/* turn vector offset into excep num */	cltd	idivl	%ecx			/* %eax has exception num */	/* exception stack frame is ESF0 */	movl	0x28(%esp), %edx	/* get pc from ESF */	movl	%edx, 0x24(%esp)	/* replace a return addr by the pc */	pushl	_errno			/* save errno on the stack (intEnt()) */	pushl	%ebx			/* push pointer to REG_SET */	addl	$0x28, %ebx	pushl	%ebx			/* push pointer to ESF */	pushl	%eax			/* push exception number */	call	_excIntHandle		/* do exception processing */	addl	$0xc, %esp		/* clean up pushed arguments */	popl	_errno			/* restore errno */	popal				/* restore regs */	addl	$0x8, %esp		/* get pointer to ESF */	pushl	_errno	jmp	_intExit

⌨️ 快捷键说明

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