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

📄 windalib.s

📁 vxworks的源代码
💻 S
📖 第 1 页 / 共 4 页
字号:
/* windALib.s - internal VxWorks kernel assembly library *//* Copyright 1984-2001 Wind River Systems, Inc. */	.data	.globl	copyright_wind_river/* * This file has been developed or significantly modified by the * MIPS Center of Excellence Dedicated Engineering Staff. * This notice is as per the MIPS Center of Excellence Master Partner * Agreement, do not remove this notice without checking first with * WR/Platforms MIPS Center of Excellence engineering management. *//*modification history--------------------03i,16jan02,agf  SPR 28519: use eret to start a task after context is loaded                 so ll/sc internal bit gets cleared03h,01aug01,mem  Diab integration.03g,16jul01,ros  add CofE comment03f,12jun01,mem  Update for new coding standard.03e,13feb01,tlc  Perform HAZARD review.03d,03jan01,mem  Fix load of SR register from TCB in portable version.03c,19dec00,pes  Adapt to MIPS32/MIPS64 CPU architectures03b,19jun00,dra  work around 5432 branch bug03a,11may00,tpw  Make it work for CW4000 again.02z,10sep99,myz  added CW4000_16 support.02x,19jan99,dra  addwd CW4000, CW4011, VR4100, VR5000 and VR5400 support.02w,01apr99,nps  removed inclusion of obsolete evtBufferLib.h02v,30jul98,am   registers change in trgCheckInst402u,08jul98,cjtc bug fix - priority inheritance stipple never appears in                 WindView log (SPR 21672)02t,16may98,pr   replaced lhu with lw for evtAction. 02s,16apr98,pr   added WindView 20 support.02r,14oct96,kkk  added R4650 support.02q,30jul96,kkk  did too much in 02p.02p,30jul96,kkk  fixed windExitInit to unlock int in branch delay correctly.02o,23jul96,pr   added windview instrumentation.02n,12oct94,caf  corrected size of .extern readyQHead (now 16, was 4).02m,19oct93,cd   added R4000 support02l,29sep92,ajm  made taskSrDefault accessible through the gp, 		  expanded stacks past minimum allowed.02k,04jul92,jcf  scalable/ANSI/cleanup effort.02j,05jun92,ajm  5.0.5 merge, note mod history changes02i,26may92,rrr  the tree shuffle02h,28apr92,ajm   now use taskSrDefault for SR instead of macro02g,05nov91,ajm   now use areWeNested for interrupt nesting, this allows		   intCnt to be used for watchDogs02f,29oct91,ajm   fixed switch/swap hook parameters02e,15oct91,ajm   pulled in optimizations02d,14oct91,ajm   reordered .set noreorder section for kernelState bug02c,09oct91,ajm   put save of errno to tcb in saveIntContext02b,01aug91,ajm   removed assembler .set noreorder macros. They tend to screw 		   up assembler02a,18jun91,jcf	  SPECIAL VERSION FOR 5.0.2 RELEASE.  windExitInt empties work q01b,28may91,ajm   now use esf.h defines for passed stack01a,26feb91,ajm   written from 68k v5.0 and mips v4.02 source*//*DESCRIPTIONThis module contains internals to the VxWorks kernel.These routines have been coded in assembler because they are eitherspecific to this processor, or they have been optimized for performance.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "private/eventP.h"#include "private/taskLibP.h"#include "private/workQLibP.h"#include "esf.h"	.text	.set	reorder	.globl	windExit		/* routine to exit mutual exclusion */	.globl	vxTaskEntry		/* task entry wrapper */#if FALSE /* no longer required */	.globl	intEnt			/* interrupt entrance routine */#endif	.globl	intExit			/* interrupt exit routine */	.globl	windIntStackSet		/* interrupt stack set routine */#ifdef PORTABLE		.globl	windLoadContext		/* needed by portable reschedule () */#else	.globl	reschedule		/* optimized reschedule () routine */#endif /* PORTABLE */	/* external */	.extern	intCnt			/* interrupt depth */	.extern	areWeNested		/* nesting boolean */	.extern	errno			/* unix like errno */	.extern	workQIsEmpty		/* work to do ? */	.extern	kernelState		/* in kernel ? */	.extern	taskIdCurrent		/* running task */	.extern	readyQHead		/* head of ready Q */	.extern	kernelIsIdle		/* are we idle ? */	.extern	taskSrDefault		/* default task status reg. */#ifdef WV_INSTRUMENTATION	.extern _func_evtLogTSched	/* timestamp function pointer */	.extern _func_trgCheck		/* timestamp function pointer */	.extern _func_evtLogT0		/* timestamp function pointer */	.extern evtAction	    	.extern wvEvtClass	    	.extern trgEvtClass	    #endif /* WV_INSTRUMENTATION */#ifndef PORTABLE    /* This !(PORTABLE) section is the optimized windExit () *//********************************************************************************* windExitInt - exit kernel routine from interrupt level** windExit branches here if exiting kernel routine from int level* No rescheduling is necessary because the ISR will exit via intExit, and* intExit does the necessary rescheduling.*/windExitIntWork:	SETFRAME(windExitIntWork,0)	subu	sp, FRAMESZ(windExitIntWork)	/* need some stack */	SW	ra, FRAMERA(windExitIntWork)(sp) /* save ra */	HAZARD_VR5400	mtc0    t2, C0_SR        		/* UNLOCK INTS in BD slot */	jal	workQDoWork			/* empty the work queue */	LW	ra, FRAMERA(windExitIntWork)(sp) /* restore ra */	addu	sp, FRAMESZ(windExitIntWork)	/* restore stack */	.ent 	windExitIntwindExitInt:	HAZARD_VR5400	mfc0	t2, C0_SR	li	t1, ~SR_INT_ENABLE	and	t1, t1, t2	mtc0	t1, C0_SR			/* LOCK INTERRUPTS */	HAZARD_INTERRUPT	lw	t0, workQIsEmpty		/* test for work to do */	beq	zero, t0, windExitIntWork	/* workQueue is not empty */#ifdef WV_INSTRUMENTATION        /*         * windview instrumentation - BEGIN         * exit windExit with no dispatch; point 1 in the windExit diagram.         */        lw      t0, evtAction                   /* is instrumentation on? */        beqz    t0, noInst1        lw      t0, wvEvtClass                   /* is instrumentation on? */        li      t4, WV_CLASS_1_ON                   /* is instrumentation on? */	and     t0, t0, t4        bne     t4, t0, trgCheckInst1        SETFRAME(windExitInt,1)        subu    sp, FRAMESZ(windExitInt)        /* need some stack */        SW      ra, FRAMERA(windExitInt)(sp)    /* save ra */        SW      t2, FRAMER0(windExitInt)(sp)    /* save old sr */        lw      a1, taskIdCurrent        lw      a2, WIND_TCB_PRIORITY(a1)        /*         * Determine if the task is running at an inherited priority         */        lw      t4, WIND_TCB_PRI_NORMAL(a1)        li      a0, EVENT_WIND_EXIT_NODISPATCH        bge     a2, t4, noInst1Inheritance      /* no inheritance */        li      a0, EVENT_WIND_EXIT_NODISPATCH_PInoInst1Inheritance:        lw      t1, _func_evtLogTSched        jal     t1                              /* call evtsched routine */        LW      t2, FRAMER0(windExitInt)(sp)    /* restore sr */        LW      ra, FRAMERA(windExitInt)(sp)    /* restore ra */        addu    sp, FRAMESZ(windExitInt)        /* restore stack */trgCheckInst1:        lw      t0, trgEvtClass                           li      t4, TRG_CLASS_1_ON                	and     t0, t0, t4        bne     t4, t0, noInst1        SETFRAME(windExitInt,1)        subu    sp, FRAMESZ(windExitInt)        /* need some stack */        SW      ra, FRAMERA(windExitInt)(sp)    /* save ra */        SW      t2, FRAMER0(windExitInt)(sp)    /* save old sr */        lw      a3, taskIdCurrent        lw      s0, WIND_TCB_PRIORITY(a3)        /*         * Determine if the task is running at an inherited priority         */        lw      t4, WIND_TCB_PRI_NORMAL(a3)        li      a0, EVENT_WIND_EXIT_NODISPATCH        bge     s0, t4, trgNoInst1Inheritance   /* no inheritance */        li      a0, EVENT_WIND_EXIT_NODISPATCH_PItrgNoInst1Inheritance:        li      a1, TRG_CLASS1_INDEX        li      a2, 0x0        lw      t1, _func_trgCheck        jal     t1                              /* call trgCheck routine */        LW      t2, FRAMER0(windExitInt)(sp)    /* restore sr */        LW      ra, FRAMERA(windExitInt)(sp)    /* restore ra */        addu    sp, FRAMESZ(windExitInt)        /* restore stack */noInst1:        /* windview instrumentation - END */#endif /* WV_INSTRUMENTATION */	HAZARD_VR5400	sw      zero, kernelState 		/* else release exclusion */	move	v0, zero			/* return OK */	mtc0    t2, C0_SR        		/* UNLOCK INTERRUPTS */	j       ra		 		/* back to calling task */	.end	windExitInt/********************************************************************************* checkTaskReady - check that taskIdCurrent is ready to run** This code branched to by windExit when it finds preemption is disabled.* It is possible that even though preemption is disabled, a context switch* must occur.  This situation arrises when a task blocks during a preemption* lock.  So this routine checks if taskIdCurrent is ready to run, if not it* branches to save the context of taskIdCurrent, otherwise it falls thru to* check the work queue for any pending work.*/checkTaskReady:	/* taskIdCurrent in t0  */	lw	t1, WIND_TCB_STATUS(t0)	/* is task ready to run */	bne	zero,t1,saveTaskContext /* if no, we blocked with preempt off */	/* FALL THRU TO CHECK WORK QUEUE *//********************************************************************************* checkWorkQ -	check the work queue for any work to do** This code is branched to by windExit.  Currently taskIdCurrent is highest* priority ready task, but before we can return to it we must check the work* queue.  If there is work we empty it via doWorkPreSave, otherwise we unlock* interrupts, clear v0, and return to taskIdCurrent.*/checkWorkQ:	HAZARD_VR5400	mfc0	t2, C0_SR	li	t1, ~SR_INT_ENABLE	and	t1, t1, t2	mtc0	t1, C0_SR		/* LOCK INTERRUPTS */	HAZARD_INTERRUPT	lw	t0, workQIsEmpty	/* test for work to do */	beq	zero, t0, doWorkPreSave	/* workQueue is not empty */#ifdef WV_INSTRUMENTATION        /*         * windview instrumentation - BEGIN         * exit windExit with no dispatch; point 4 in the windExit diagram.         */        lw      t0, evtAction                   /* is instrumentation on? */        beqz    t0, noInst4        lw      t0, wvEvtClass                   /* is instrumentation on? */        li      t4, WV_CLASS_1_ON                   /* is instrumentation on? */        and     t0, t0, t4        bne     t4, t0, trgCheckInst4        SETFRAME(checkWorkQ,1)        subu    sp, FRAMESZ(checkWorkQ)         /* need some stack */        SW      ra, FRAMERA(checkWorkQ)(sp)     /* save ra */        SW      t2, FRAMER0(checkWorkQ)(sp)     /* save old sr */        lw      a1, taskIdCurrent        lw      a2, WIND_TCB_PRIORITY(a1)        /*         * Determine if the task is running at an inherited priority         */        lw      t4, WIND_TCB_PRI_NORMAL(a1)        li      a0, EVENT_WIND_EXIT_NODISPATCH        bge     a2, t4, noInst4Inheritance      /* no inheritance */        li      a0, EVENT_WIND_EXIT_NODISPATCH_PInoInst4Inheritance:        lw      t1, _func_evtLogTSched        jal     t1                              /* call evtsched routine */restoreInst4:        LW      t2, FRAMER0(checkWorkQ)(sp)        LW      ra, FRAMERA(checkWorkQ)(sp)        addu    sp, FRAMESZ(checkWorkQ)trgCheckInst4:        lw      t0, trgEvtClass        li      t4, TRG_CLASS_1_ON        and     t0, t0, t4        bne     t4, t0, noInst4        SETFRAME(checkWorkQ,1)        subu    sp, FRAMESZ(checkWorkQ)         /* need some stack */        SW      ra, FRAMERA(checkWorkQ)(sp)     /* save ra */        SW      t2, FRAMER0(checkWorkQ)(sp)     /* save old sr */        lw      a1, taskIdCurrent        lw      a2, WIND_TCB_PRIORITY(a1)        /*         * Determine if the task is running at an inherited priority         */        lw      t4, WIND_TCB_PRI_NORMAL(a1)        li      a0, EVENT_WIND_EXIT_NODISPATCH        bge     a2, t4, trgNoInst4Inheritance   /* no inheritance */        li      a0, EVENT_WIND_EXIT_NODISPATCH_PItrgNoInst4Inheritance:        li      a1, TRG_CLASS1_INDEX        li      a2, 0x0        lw      t1, _func_trgCheck        jal     t1                              /* call trgCheck routine */        LW      t2, FRAMER0(checkWorkQ)(sp)        LW      ra, FRAMERA(checkWorkQ)(sp)        addu    sp, FRAMESZ(checkWorkQ)noInst4:        /* windview instrumentation - END */

⌨️ 快捷键说明

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