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

📄 wdbdbgalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* wdbDbgALib.s - i80x86 debugging aids assembly interface *//* Copyright 1984-1998 Wind River Systems, Inc. */	.data	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01d,08jan98,dbt  modified for new breakpoint scheme. Added hardware		 breakpoints support01c,01jun93,hdn  updated to 5.1.		  - fixed #else and #endif		  - changed VOID to void		  - changed ASMLANGUAGE to _ASMLANGUAGE		  - changed copyright notice01b,13oct92,hdn  debugged.01a,08jul92,hdn  written based on TRON version.*//*DESCRIPTIONThis module contains assembly language routines needed for the debugpackage and the i80x86 exception vectors. .ne 24PICTURE OF STACK GROWING.CS  							 sp_5 ---------								sp_1(pointer to ESF0)							 sp_4 ---------								sp_2(pointer to REGS)							---------							0 or 1			  fp/sp_3 ---------		 ---------				     fp			 fp			     sp_2 ---------		 ---------				db0			db0				 |			  |				db7			db7				    edi			edi				     |			  |				    eax			eax  sp_1 ---------		 ---------		 ---------	 EIP			EIP			EIP	---------		 ---------		 ---------	 CS			 CS			 CS	---------		 ---------		 ---------	 EFLAGS		    EFLAGS		    EFLAGS	---------		 ---------		 ---------       fig.1		     fig.2		     fig.3.CE   SEE ALSO: dbgLib(1), "Debugging"*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "wdb/wdbDbgLib.h"	/* internal */	.globl	_wdbDbgBpStub		/* breakpoint exceptions handler */	.globl	_wdbDbgTraceStub	/* trace exceptions handler */	.globl	_wdbDbgRegsSet		/* set Debug Registers */#if 0	.globl	_wdbDbgCacheClear	/* Purge all cache except TLB */#endif	/* external */	.globl	_wdbDbgBreakpoint	/* breakpoint processing routine */	.globl	_wdbDbgTrace		/* trace processing routine */	.text	.align 4/****************************************************************************** wdbDbgBpStub - software breakpoint handling** This routine is attached to the breakpoint trap (default int $3).  It* saves the entire task context on the stack and calls wdbDbgBreakpoint () to * handle the event.** NOMANUAL*/_wdbDbgBpStub:				/* sp_1: breakpoint trap driver */	pushal				/* sp_2: save regs */	movl	%db7,%eax	pushl	%eax	movl	%db6,%eax	pushl	%eax	movl	%db3,%eax	pushl	%eax	movl	%db2,%eax	pushl	%eax	movl	%db1,%eax	pushl	%eax	movl	%db0,%eax	pushl	%eax	movl	%esp,%eax		/*     : sp points to saved regs */	pushl	%ebp			/*     : save a frame-pointer */	movl	%esp,%ebp		/* sp_3: make a frame-pointer */	decl	SAVED_REGS+0x4(%ebp)	/*     : adjust saved program counter */	pushl	$0			/*     : push FALSE is hardware break */	pushl	%eax			/* sp_4: push pointer to saved regs */	leal	SAVED_REGS+0x4(%ebp),%eax	pushl	%eax			/* sp_5: push pointer to saved info */	call	_wdbDbgPreBreakpoint	/*     : do breakpoint handling */	/* we only return if the breakpoint was hit at interrupt level */	addl	$0x10,%esp		/* sp_2: pop the params,frame-pointer */	addl	SAVED_DBGREGS,%esp	/*     : pop saved debug registers */	popal				/* sp_1: restore regs */	iret/**************************************************************************** _wdbDbgTraceStub - hardware breakpoint and trace exception handling** This routine is attached to the i80x86 trace exception vector.  It saves the* entire task context on the stack and calls wdbDbgTrace () to handle the event.* This handler is for any of these situations:*     (1) Single step.				Trap	BS=1*     (2) Hardware instruction breakpoint.	Falt	Bn=1*     (3) Hardware data breakpoint.		Trap	Bn=1** NOMANUAL*/	.align 4,0x90_wdbDbgTraceStub:			/* sp_1: trace trap driver */	andl	$0xfffffeff,0x8(%esp)	/* clear TraceFlag  in saved EFLAGS */	pushal				/* sp_2: save regs */	movl	%db7,%eax	pushl	%eax	movl	%db6,%eax	pushl	%eax	movl	%db3,%eax	pushl	%eax	movl	%db2,%eax	pushl	%eax	movl	%db1,%eax	pushl	%eax	movl	%db0,%eax	pushl	%eax	movl	%esp,%eax		/*     : sp points to saved regs */	pushl	%ebp			/*     : save a frame-pointer */	movl	%esp,%ebp		/* sp_3: make a frame-pointer */	pushl	$1			/*     : push TRUE is hardware break */	pushl	%eax			/* sp_4: push pointer to saved regs */	leal	SAVED_REGS+0x4(%ebp),%eax	pushl	%eax			/* sp_5: push pointer to saved info */	movl	%db6,%eax		/* get DR6 debug status reg */	movl	%db6,%eax		/* get DR6 debug status reg */	xorl	%edx,%edx	movl	%edx,%db7		/* clear DR7 debug control reg */	movl	%edx,%db6		/* clear DR6 debug status reg */	movl	%edx,%db3		/* clear DR3 debug reg */	movl	%edx,%db2		/* clear DR2 debug reg */	movl	%edx,%db1		/* clear DR1 debug reg */	movl	%edx,%db0		/* clear DR0 debug reg */	btl	$14,%eax		/* is it a trace-exception ? */	jc	wdbDbgTrace0		/* if yes, jump wdbDbgTrace0 */	orl	$0x00010000,SAVED_REGS+0xc(%ebp)	/* set ResumeFlag */	call	_wdbDbgPreBreakpoint		/* do breakpoint handling */	jmp	wdbDbgTrace1	.align 4,0x90wdbDbgTrace0:	call	_wdbDbgPreTrace		/* do trace handling */wdbDbgTrace1:	/* we returned from wdbDbgTrace if this was a CONTINUE or the break	 * was hit at interrupt level	 */	addl	$0x10,%esp		/* sp_2: pop the params,frame-pointer */	popl	%eax	movl	%eax,%db0	popl	%eax	movl	%eax,%db1	popl	%eax	movl	%eax,%db2	popl	%eax	movl	%eax,%db3	popl	%eax	xorl	%eax,%eax	movl	%eax,%db6		/* clear status bits in DR6 */	popl	%eax	movl	%eax,%db7	popal				/* sp_1: restore regs */	iret/**************************************************************************** wdbDbgRegsSet - set the debug registers** This routine set hardware breakpoint registers.** SEE ALSO: "i80x86 32-Bit Microprocessor User's Manual"* void _wdbDbgRegsSet (pReg)*     int *pReg;		/* pointer to saved registers **/	.align 4,0x90_wdbDbgRegsSet:	pushl	%ebp	movl	%esp,%ebp	movl	ARG1(%ebp),%edx	movl	0(%edx),%eax	movl	%eax,%db0	movl	4(%edx),%eax	movl	%eax,%db1	movl	8(%edx),%eax	movl	%eax,%db2	movl	12(%edx),%eax	movl	%eax,%db3	movl	16(%edx),%eax	movl	%eax,%db6	movl	20(%edx),%eax	movl	%eax,%db7	leave	ret#if 0	.align 4,0x90_wdbDbgCacheClear:	ret#endif

⌨️ 快捷键说明

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