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

📄 emumainalib.s

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 S
📖 第 1 页 / 共 3 页
字号:
/* Copyright 1991-2002 Wind River Systems, Inc. *//*modification history--------------------01g,15nov02,max  Replacing .include by #include01f,28aug01,hdn  replaced .align with .balign		 replaced FUNC with GTEXT/GDATA macros for global symbols.		 added FUNC / FUNC_LABEL			 assembly syntax has become more stringent for		 indirect call instructions. '*' prefix now needed.01e,12feb97,hdn  fixed a bug in fxchs. (SPR#7920)01d,24oct96,yp   stuck in a # in USSC mailing addr so cpp will work 01c,26sep95,hdn  implemented USSW's latest emumain.s.01b,06sep95,hdn  changed .comm to .lcomm to make them contiguous.01a,24jan95,hdn  original US Software version.*/##* * * * * * * * * *##       Filename:   EMUMAIN.ASM####       Copyright (C) 1990,1991 By##       # United States Software Corporation##       # 14215 N.W. Science Park Drive##       # Portland, Oregon 97229####       This software is furnished under a license and may be used##       and copied only in accordance with the terms of such license##       and with the inclusion of the above copyright notice.##       This software or any other copies thereof may not be provided##       or otherwise made available to any other person.  No title to##       and ownership of the software is hereby transferred.####       The information in this software is subject to change without##       notice and should not be construed as a commitment by United##       States Software Corporation.####       Version:        See VSNLOG.TXT##       Released:       1 March 1991####* * * * * * * * * *#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"	.data	.globl	FUNC(copyright_wind_river)	.long	FUNC(copyright_wind_river)#include "emuIncALib.s"	.text	.globl	emuret,exret##       extrn   witoep:near,eptowi:near,sitoep:near,eptosi:near##       extrn   litoep:near,eptoli:near,pdtoep:near,eptopd:near##       extrn   fptoep:near,eptofp:near,dptoep:near,eptodp:near##       extrn   eptoep:near##       extrn   getqn:near##       extrn   epadd:near,epsub:near,epsubr:near,epmul:near##       extrn   epdiv:near,epdivr:near,eprem:near##       extrn   epcomp:near,epcomu:near,epexam:near,eptown:near,epsqrt:near##       extrn   rounde:near,roundx:near,exproc:near##       extrn   xtract:near,scale:near##       extrn   epf2xm1:near,epsin:near,epcos:near,eptan:near##       extrn   eplog:near,eplog1:near,epatan:near##       extrn   reduct:near##       extrn   exir_no:abs##       extrn   ENIRS:abs##DGROUP  GROUP   hwseg##CGROUP  GROUP   emuseg##hwseg   segment RW page public 'DATA'##        assume  ds:DGROUP, es:DGROUP, ss:DGROUP	 .globl	h_ctrl,h_stat,s_iptr,s_memp	 .lcomm	s_stk,256	 .lcomm	s_fpsp,4	 .lcomm	s_iptr,4	 .lcomm	s_memp,4	 .lcomm	h_ctrl,4	 .lcomm	h_stat,4	 .lcomm	h_tag,4##hwseg   ends				##emuseg  segment public USE32 'CODE'##        assume  cs:CGROUP## address tables for floating-point instructionsinstab:	.long	faddfp,fmulfp,fcomfp,fcompfp,fsubfp,fsubrfp,fdivfp,fdivrfp	.long	fldfp,NONE_,fstf,fstpf,fldenv_,fldcwc,fstenv_,fstcwc	.long	faddsi,fmulsi,fcomsi,fcompsi,fsubsi,fsubrsi,fdivsi,fdivrsi	.long	fldsi,NONE_,fisti,fistpi,NONE_,flde,NONE_,fstpe	.long	fadddp,fmuldp,fcomdp,fcompdp,fsubdp,fsubrdp,fdivdp,fdivrdp	.long	flddp,NONE_,fstd,fstpd,frstor_,NONE_,fsave_,fstsw_	.long	faddwi,fmulwi,fcomwi,fcompwi,fsubwi,fsubrwi,fdivwi,fdivrwi	.long	fldwi,NONE_,fistw,fistpw,fbldp,fildl,fbstpp,fistplinstas:	.long	fadds,fmuls,fcoms,fcomps,fsubs,fsubrs,fdivs,fdivrs	.long	flds,fxchs,fnop_,fstps,is1,is8,is2,is3	.long	NONE_,NONE_,NONE_,NONE_,NONE_,fucompps,NONE_,NONE_	.long	NONE_,NONE_,NONE_,NONE_,is5,NONE_,NONE_,NONE_	.long	faddx,fmulx,NONE_,NONE_,fsubx,fsubrx,fdivx,fdivrx	.long	ffree_,NONE_,fsts,fstps,fucoms,fucomps,NONE_,NONE_	.long	faddpx,fmulpx,NONE_,fcompps,fsubpx,fsubrpx,fdivrpx,fdivpx	.long	NONE_,NONE_,NONE_,NONE_,fstswax_,NONE_,NONE_,NONE_	.balign 16,0x90	.globl	GTEXT(emuInit)FUNC_LABEL(emuInit)	fninit	ret	.balign 16,0x90	.globl	GTEXT(emu387)FUNC_LABEL(emu387)##       test    byte ptr [esp+9],2 ;enable interrupts, unless they were	.word	ENIRS	.byte	0x24,0x09,0x02	jz	emu3		#   disabled initially	sti			emu3:	pusha			#save all general registers	subl	$s_len,%esp	#reserve a frame on the stack	movl	%esp,%ebp		cld				addl	$12,s_sp(%ebp)		movl	s_ip(%ebp),%esi	#address of FP instruction -> esiemu86:					.byte	0x2e #from cs: but assembler seems defective	lodsw			#pick up the instruction	cmpb	$0x0d8,%al		jc	emu84		emu11:	movl	%eax,%edx	#build 6-bit instruction index -> edx	shlb	$2,%dh			rolw	$3,%dx			andl	$0x3f,%edx		movb	%ah,%bl		#build R/M code	andl	$7,%ebx		#   and leave in bl for the following	cmpb	$0x0c0,%ah	#MOD 3 uses no memory addressing	jnc	emu50			xorl	%edi,%edi	#handle possible s-i-b	cmpb	$4,%bl			jnz	emu26			.byte	0x2e #from cs: 	lodsb				movb	%al,%bl			andb	$7,%bl			shldl	$31,%eax,%edi		andl	$7*4,%edi		subl	$4*4,%edi		jz	emu26			movb	%al,%cl		#scaled index	shrb	$6,%cl			negl	%edi			movl	s_di+28-16(%ebp,%edi),%edi		shll	%cl,%edi	emu26:	addb	%ah,%ah		#take displacement -> ax	js	emu24		#   MOD 01 reg+d8	jc	emu25		#   MOD 10 reg+d32	cmpb	$5,%bl		#   MOD 00 reg; reg5 = d32	jnz	emu27			.byte	0x2e #from cs:	lodsl				jmp	emu42		emu27:	xorl	%eax,%eax		jmp	emu29		emu25:					.byte	0x2e #from cs:	lodsl				jmp	emu29		emu24:					.byte	0x2e #from cs: 	lodsb				movsbl	%al,%eax	emu29:	negl	%ebx		#add the base register	addl	s_di+28(%ebp,%ebx,4),%eax	emu42:	addl	%edi,%eax	#possible scaled index	xchgl	%esi,s_ip(%ebp)	#update return address	call	*%cs:instab(,%edx,4)	#call instruction handleremu51:	movl	s_ip(%ebp),%esi	#if next instruction is ESC, repeat	.byte	0x2e #from cs: but assembler seems defective	lodsw				xorb	$0x0d8,%al		cmpb	$8,%al			jc	emu11			addl	$s_len,%esp	#free the stack frame	popa			#restore registersemuret:	iret			emu50:	xchgl	%esi,s_ip(%ebp)	#update return address	call	*%cs:instas(,%edx,4)	#call instruction handler	jmp	emu51		exret:	addl	$s_len,%esp	#exception return	popa				.byte	0x0cd,EXIRNO	#INT exception interrupt	iret			emu84:	decl	%esi		#illegal prefix, skip	jmp	emu86		##emu387  endpintrn:flddp:				#push from memory	andb	$0x0fd,h_stat+1		call	dptoep			##STPUSHP	movl	s_fpsp,%ebx		subb	$32,%bl			cmpb	$3,s_stk+10(%ebx)		jnz	stackof			movl	%ebx,s_fpsp		addl	$s_stk,%ebx		movl	%eax,(%ebx)		movl	%edx,4(%ebx)		movl	%ecx,8(%ebx)		ret			fstd:				#fetch as double-precision	##SAVEIX	movl	%eax,s_memp		xchgl	%esi,%eax		movl	%eax,s_iptr		##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		##GETEP   	movl	(%edi),%eax		movl	4(%edi),%edx		movl	8(%edi),%ecx		call	eptodp			movl	%eax,(%esi)		movl	%edx,4(%esi)		ret			fstpd:				#fetch as double-precision, pop	##SAVEIX	movl	%eax,s_memp		xchgl	%esi,%eax		movl	%eax,s_iptr		##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		##GETEP   	movl	(%edi),%eax		movl	4(%edi),%edx		movl	8(%edi),%ecx		call	eptodp			movl	%eax,(%esi)		movl	%edx,4(%esi)		##STPOPq	movb	$3,10(%edi)		addb	$32,s_fpsp		ret			fadddp:				#ST = ST + memory	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epadd			jmp	rounde		fsubdp:				#ST = ST - memory	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsubr			jmp	rounde		fmuldp:				#ST = ST * memory	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epmul			jmp	rounde		fdivdp:				#ST = ST / memory	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdivr			jmp	rounde		fsubrdp:			#ST = memory - ST	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsub			jmp	rounde		fdivrdp:			#ST = memory / ST	call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdiv			jmp	rounde		fsqrt_:				#square-root of ST	##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		##GETEP   	movl	(%edi),%eax		movl	4(%edi),%edx		movl	8(%edi),%ecx		call	epsqrt			jmp	rounde		fcomdp:				#ST - memory -> codes	orb	$0x45,h_stat+1		call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		jmp	epcomp		fcompdp:			#ST - memory -> codes, pop	orb	$0x45,h_stat+1		call	dptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epcomp			##STPOPq	movb	$3,10(%edi)		addb	$32,s_fpsp		ret			faddfp:				#ST = ST + memory	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epadd			jmp	rounde		faddwi:				#ST = ST + memory	call	witoep			jmp	.+7		faddsi:				#ST = ST + memory	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epadd			jmp	rounde		fmulfp:				#ST = ST * memory	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epmul			jmp	rounde		fmulwi:				#ST = ST * memory	call	witoep			jmp	.+7		fmulsi:				#ST = ST * memory	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epmul			jmp	rounde		fcomfp:				#ST - memory -> codes	orb	$0x45,h_stat+1		call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		jmp	epcomp		fcomsi:				#ST - memory -> codes	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		jmp	epcomp		fcomwi:				#ST - memory -> codes	call	witoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		jmp	epcomp		fcompfp:			#ST - memory -> codes, pop	orb	$0x45,h_stat+1		call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epcomp			##STPOPq	movb	$3,10(%edi)		addb	$32,s_fpsp		ret			fcompwi:			#ST - memory -> codes, pop	call	witoep			jmp	.+7		fcompsi:			#ST - memory -> codes, pop	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epcomp			##STPOPq	movb	$3,10(%edi)		addb	$32,s_fpsp		ret			fsubfp:				#ST = ST - memory	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsubr			jmp	rounde		fsubwi:				#ST = ST - memory	call	witoep			jmp	.+7		fsubsi:				#ST = ST - memory	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsubr			jmp	rounde		fsubrfp:			#ST = memory - ST	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsub			jmp	rounde		fsubrwi:			#ST = memory - ST	call	witoep			jmp	.+7		fsubrsi:			#ST = memory - ST	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epsub			jmp	rounde		fdivfp:				#ST = ST / memory	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdivr			jmp	rounde		fdivwi:				#ST = ST / memory	call	witoep			jmp	.+7		fdivsi:				#ST = ST / memory	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdivr			jmp	rounde		fdivrfp:			#ST = memory / ST	call	fptoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdiv			jmp	rounde		fdivrwi:			#ST = memory / ST	call	witoep			jmp	.+7		fdivrsi:			#ST = memory / ST	call	sitoep			##STTOP   	movl	s_fpsp,%edi		addl	$s_stk,%edi		call	epdiv			jmp	rounde		fadds:				#ST = ST + ST(i)	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epadd			jmp	rounde		fmuls:				#ST = ST * ST(i)	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epmul			jmp	rounde		fcoms:				#ST - ST(i) -> codes	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		jmp	epcomp		fcomps:				#ST - ST(i) -> codes, pop	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epcomp			##STPOPq	movb	$3,10(%edi)		addb	$32,s_fpsp		ret			fsubs:				#ST = ST - ST(i)	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epsubr			jmp	rounde		fsubrs:				#ST = ST(i) - ST	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epsub			jmp	rounde		fdivs:				#ST = ST / ST(i)	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epdivr			jmp	rounde		fdivrs:				#ST = ST(i) / ST	##SAVEIN	movl	%esi,s_iptr		##GETEPS  ebx	movl	s_fpsp,%eax		movl	%eax,%edi		addl	$s_stk,%edi		shll	$5,%ebx			addb	%bl,%al			addl	$s_stk,%eax		movl	8(%eax),%ecx		movl	4(%eax),%edx		movl	(%eax),%eax		call	epdiv			jmp	rounde		fldfp:				#push from memory	andb	$0x0fd,h_stat+1		call	fptoep			##STPUSHP	movl	s_fpsp,%ebx		subb	$32,%bl			cmpb	$3,s_stk+10(%ebx)		jnz	stackof			movl	%ebx,s_fpsp		addl	$s_stk,%ebx		movl	%eax,(%ebx)		movl	%edx,4(%ebx)		movl	%ecx,8(%ebx)	

⌨️ 快捷键说明

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