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

📄 sigctxalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* sigCtxALib.s - software signal architecture support library *//* Copyright 1984-1993 Wind River Systems, Inc. */	.text	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01g,06apr98,hdn  fixed a bug in __sigCtxLoad (SPR-20903).01f,17jun96,hdn  changed CODE_SELECTOR to sysCodeSelector.01e,16may95,ms   made __sigCtxSave() save the interrupt mask.01d,24oct94,hdn  deleted cli in __sigCtxLoad.01c,17oct94,hdn  fixed a bug in __sigCtxLoad.01b,13sep93,hdn  added adding 4 bytes to sp before it is saved.01a,15jun93,hdn  written based on mc68k version.*//*This library provides the architecture specific support needed bysoftware signals.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "regs.h"	/* internals */	.globl	__sigCtxLoad	.globl	__sigCtxSave	.globl	_sigsetjmp	.globl	_setjmp	.text	.align 4/********************************************************************************* sigsetjmp - set non-local goto with option to save signal mask** This routine saves the current task context and program counter in <env>* for later use by siglongjmp().   It returns 0 when called.  However, when* program execution returns to the point at which sigsetjmp() was called and the* task context is restored by siglongjmp(), sigsetjmp() will then return the* value <val>, as specified in siglongjmp().** If the value of <savemask> argument is not zero, the sigsetjmp() function* shall save the current signal mask of the task as part of the calling* environment.** RETURNS: 0 or <val> if return is via siglongjmp().** SEE ALSO: longjmp()* int setjmp*    (*    jmp_buf env,       /@ where to save stack environment @/*    int     savemask	/@ whether or not to save the current signal mask @/*    )*/_sigsetjmp:	pushl	SP_ARG2(%esp)	pushl	SP_ARG1+4(%esp)	call	__setjmpSetup	addl	$8,%esp	jmp	__sigCtxSave/********************************************************************************* setjmp - set non-local goto** This routine saves the current task context and program counter in <env>* for later use by longjmp().   It returns 0 when called.  However, when* program execution returns to the point at which setjmp() was called and the* task context is restored by longjmp(), setjmp() will then return the value* <val>, as specified in longjmp().** RETURNS: 0 or <val> if return is via longjmp().** SEE ALSO: longjmp()* int setjmp*    (*    jmp_buf env        /@ where to save stack environment @/*    )*/	.align 4,0x90_setjmp:	pushl	$1	pushl	8(%esp)	call	__setjmpSetup	addl	$8,%esp	/* FALL THROUGH *//********************************************************************************* _sigCtxSave - Save the current context of the current task** This is just like setjmp except it doesn't worry about saving any sigmask.* It must also always return 0.** RETURNS: 0* int _sigCtxSave*     (*     REG_SET *pRegs		/@ Location to save current context @/*     )*/	.align 4,0x90__sigCtxSave:	movl	SP_ARG1(%esp),%eax	movl	(%esp),%edx	movl	%edx,0x24(%eax)		/* save pc */	pushfl	popl	0x20(%eax)		/* save eflags, set IF *//*	bts	$9,0x20(%eax) */	movl	%edi,0x00(%eax)		/* save all registers */	movl	%esi,0x04(%eax)	movl	%ebp,0x08(%eax)	movl	%ebx,0x10(%eax)	movl	%edx,0x14(%eax)	movl	%ecx,0x18(%eax)	movl	%eax,0x1c(%eax)	movl	%esp,%edx	addl	$4,%edx	movl	%edx,0x0c(%eax)	xorl	%eax,%eax		/* make return value 0 */	ret/********************************************************************************* _sigCtxLoad - Load a new context in the current task** This is just like longjmp, but every register must be loaded.* You could also look at this as half a context switch.** Be careful not to reset the stack pointer until you have read* all the data. Destroying stuff at the end of the stack seems to* be far game, this is very true of the debugger.** RETURNS: Never returns* void _sigCtxLoad*     (*     REG_SET *pRegs		/@ Context to load @/*     )*/	.align 4,0x90__sigCtxLoad:	movl	SP_ARG1(%esp),%eax	movl	0x0c(%eax),%edx		/* load the stack pointer */	subl	$4,%edx	movl	0x20(%eax),%ecx	movl	%ecx,(%edx)		/* push eflags */	subl	$4,%edx	movl	_sysCodeSelector,%ecx	movl	%ecx,(%edx)		/* push cs */	subl	$4,%edx	movl	0x24(%eax),%ecx	movl	%ecx,(%edx)		/* push pc */	movl	0x00(%eax),%edi		/* load rest of the registers */	movl	0x04(%eax),%esi	movl	0x08(%eax),%ebp	movl	0x10(%eax),%ebx	movl	0x18(%eax),%ecx	subl	$4,%edx	pushl	0x14(%eax)	popl	(%edx)			/* push %edx */	movl	0x1c(%eax),%eax		/* load %eax */	movl	%edx,%esp		/* load the stack pointer */	popl	%edx			/* load %edx */	iret

⌨️ 快捷键说明

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