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

📄 semcalib.s

📁 vxworks源码源码解读是学习vxworks的最佳途径
💻 S
字号:
/* semCALib.s - i80x86 internal VxWorks counting semaphore assembly library *//* Copyright 1984-1993 Wind River Systems, Inc. */	.data	.globl	_copyright_wind_river	.long	_copyright_wind_river/*modification history--------------------01c,29jul96,sbs  Made windview conditionally compile.01b,08aug94,hdn  added support for WindView.01a,02jun93,hdn  extracted from semALib.s.*//*DESCRIPTIONThis module contains internals to the VxWorks kernel.These routines have been coded in assembler because they are optimized forperformance.*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "private/taskLibP.h"#include "private/semLibP.h"#ifndef PORTABLE	/* globals */	.globl	_semCGive		/* optimized counting semaphore give */	.globl	_semCTake		/* optimized counting semaphore take */	.text	.align 4/********************************************************************************* semIsInvalid - unlock interupts and call semInvalid ().*/semIsInvalidUnlock:	sti				/* UNLOCK INTERRUPTS */semIsInvalid:	jmp	_semInvalid		/* let C rtn do work and ret *//********************************************************************************* semCGive - optimized give of a counting semaphore** STATUS semCGive*    (*    SEM_ID semId		/@ semaphore id to give @/*    )*/	.align 4,0x90_semCGive:				/* %ecx = semId! %eax = 0! */	cli				/* LOCK INTERRUPTS */	cmpl	$_semClass,(%ecx)	/* check validity */#ifdef WV_INSTRUMENTATION        je	objOkCGive	/* windview - check the validity of instrumented class */        cmpl    $_semInstClass,(%ecx)	/* check validity */        jne     semIsInvalidUnlock      /* invalid semaphore */objOkCGive:#else        jne     semIsInvalidUnlock      /* invalid semaphore */#endif  /* WV_INSTRUMENTATION */	movl	SEM_Q_HEAD(%ecx),%eax	/* test semaphore queue head */	cmpl	$0,%eax	jne	_semQGet		/* if not empty, get from q */	incl	SEM_STATE(%ecx)		/* decrement count */	sti				/* UNLOCK INTERRUPTS */	ret				/* %eax is still 0 for OK *//********************************************************************************* semCTake - optimized take of a counting semaphore** STATUS semCTake (semId)*    (*    SEM_ID semId;		/@ semaphore id to give @/*    )*/	.align 4,0x90_semCTake:				/* %ecx = semId! */	cli				/* LOCK INTERRUPTS */	cmpl	$_semClass,(%ecx)	/* check validity */#ifdef WV_INSTRUMENTATION        je	objOkCTake	/* windview - check the validity of instrumented class */        cmpl    $_semInstClass,(%ecx)	/* check validity */        jne     semIsInvalidUnlock      /* invalid semaphore */objOkCTake:#else        jne     semIsInvalidUnlock      /* invalid semaphore */#endif  /* WV_INSTRUMENTATION */	cmpl	$0,SEM_STATE(%ecx)	/* test count */	je	_semQPut		/* if sem is owned we block */	decl	SEM_STATE(%ecx)		/* decrement count */	sti				/* UNLOCK INTERRUPTS */	xorl	%eax,%eax			/* return OK */	ret#endif	/* !PORTABLE */

⌨️ 快捷键说明

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