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

📄 intalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* intALib.s - I80x86 interrupt library assembly routines *//* Copyright 1984-1995 Wind River Systems, Inc. */	.data	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01f,04jun98,hdn  fixed intBoiExit()'s stack pop count.01e,28may98,hdn  added intBoiExit() for spurious/phantom int support.01d,26jan95,rhp  doc tweaks from architecture-independent man pages	01c,01jun93,hdn  updated to 5.1.		  - fixed #else and #endif		  - changed VOID to void		  - changed ASMLANGUAGE to _ASMLANGUAGE		  - changed copyright notice01c,18nov92,hdn  changed intLock and intUnlock.01b,13oct92,hdn  debugged.01a,28feb92,hdn  written based on TRON, 68k version.*//*DESCRIPTIONThis library supports various functions associated withinterrupts from C.  SEE ALSOintLib, intArchLibINTERNALSome routines in this module the "c" frame pointer (ebp) although they don't use it in any way!  This is only for the benefit ofthe stacktrace facility to allow it to properly trace tasks executing withinthese routines.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"	/* globals */	.globl	_intLevelSet	.globl	_intLock	.globl	_intUnlock	.globl	_intVBRSet	.globl	_intBoiExit	.text	.align 4/********************************************************************************* intLevelSet - set the interrupt level** An I80x86 doesn't have an interrupt level (unlike MC680x0, for example); * thus this routine is a no-op.	** RETURNS: 0.* int intLevelSet (level)*     int level;	/* new interrupt level mask **/_intLevelSet:	xorl	%eax, %eax	ret/********************************************************************************* intLock - lock out interrupts** This routine disables interrupts.* * For i386/i486 architectures, interrupts* are disabled at the level set by intLockLevelSet().  The default* lock-out level is the highest interrupt level (1).* * The routine returns the interrupt enagle flag (IF) bit from the* EFLAGS register as the lock-out key for the interrupt level prior to* the call, and this should be passed to intUnlock() to re-enable* interrupts.* * WARNINGS* Do not call VxWorks system routines with interrupts locked.* Violating this rule may re-enable interrupts unpredictably.** The routine intLock() can be called from either interrupt or task level.* When called from a task context, the interrupt lock level is part of the* task context.  Locking out interrupts does not prevent rescheduling.* Thus, if a task locks out interrupts and invokes kernel services that* cause the task to block (e.g., taskSuspend() or taskDelay()) or that cause a* higher priority task to be ready (e.g., semGive() or taskResume()), then* rescheduling will occur and interrupts will be unlocked while other tasks* run.  Rescheduling may be explicitly disabled with taskLock().* Traps must be enabled when calling this routine.* * EXAMPLE* .CS*     lockKey = intLock ();**         ...    /* work with interrupts locked out ***     intUnlock (lockKey);* .CE* ** To lock out interrupts and task scheduling as well (see WARNING above):* .CS*     if (taskLock() == OK)*         {*         lockKey = intLock ();**         ... (critical section)**         intUnlock (lockKey);*         taskUnlock();*         }*      else*         {*         ... (error message or recovery attempt)*         }* .CE** RETURNS* The interrupt enagle flag (IF) bit from the EFLAGS register, as the* lock-out key for the lock-out level prior to the call.* * SEE ALSO: intUnlock(), taskLock()* int intLock ()*/	.align 4,0x90_intLock:	pushf	popl	%eax	andl	$0x00000200,%eax	cli	ret/********************************************************************************* intUnlock - cancel interrupt locks* * This routine re-enables interrupts that have been disabled by intLock().* Use the lock-out key obtained from the preceding intLock() call.** RETURNS: N/A** SEE ALSO: intLock()* void intUnlock (oldSR)*    int oldSR;*/	.align 4,0x90_intUnlock:	movl	4(%esp),%eax	andl	$0x00000200,%eax	jz	intUnlock0	stiintUnlock0:	ret/********************************************************************************* intVBRSet - set the interrupt table descriptor register** This routine should only be called in supervisor mode.** NOMANUAL* void intVBRSet (baseAddr)*      char *baseAddr;	/* vector base address **/	.align 4,0x90_intVBRSet:	movl	4(%esp),%eax	lidt	(%eax)	ret/********************************************************************************* intBoiExit - exit the interrupt handler stub without sending EOI** This routine exits the interrupt handler stub without sending EOI.* It should be call from BOI routine attached by intConnect().* EOI should not be sent if it is the fantom/spurious interrupt,* such as IRQ7 or IRQ15 in PIC.** NOMANUAL* void intBoiExit (void)*/	.align 4,0x90_intBoiExit:	addl	$4, %esp	/* pop param */	popl	%ecx		/* restore regs */	popl	%edx	popl	%eax	jmp	_intExit	/* exit via kernel */

⌨️ 快捷键说明

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