Home | History | Annotate | Line # | Download | only in fpsp
      1 *	$NetBSD: x_unimp.sa,v 1.2 1994/10/26 07:50:32 cgd Exp $
      2 
      3 *	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
      4 *	M68000 Hi-Performance Microprocessor Division
      5 *	M68040 Software Package 
      6 *
      7 *	M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
      8 *	All rights reserved.
      9 *
     10 *	THE SOFTWARE is provided on an "AS IS" basis and without warranty.
     11 *	To the maximum extent permitted by applicable law,
     12 *	MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
     13 *	INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
     14 *	PARTICULAR PURPOSE and any warranty against infringement with
     15 *	regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
     16 *	and any accompanying written materials. 
     17 *
     18 *	To the maximum extent permitted by applicable law,
     19 *	IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
     20 *	(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
     21 *	PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
     22 *	OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
     23 *	SOFTWARE.  Motorola assumes no responsibility for the maintenance
     24 *	and support of the SOFTWARE.  
     25 *
     26 *	You are hereby granted a copyright license to use, modify, and
     27 *	distribute the SOFTWARE so long as this entire notice is retained
     28 *	without alteration in any modified and/or redistributed versions,
     29 *	and that such modified versions are clearly identified as such.
     30 *	No licenses are granted by implication, estoppel or otherwise
     31 *	under any patents or trademarks of Motorola, Inc.
     32 
     33 *
     34 *	x_unimp.sa 3.3 7/1/91
     35 *
     36 *	fpsp_unimp --- FPSP handler for unimplemented instruction	
     37 *	exception.
     38 *
     39 * Invoked when the user program encounters a floating-point
     40 * op-code that hardware does not support.  Trap vector# 11
     41 * (See table 8-1 MC68030 User's Manual).
     42 *
     43 * 
     44 * Note: An fsave for an unimplemented inst. will create a short
     45 * fsave stack.
     46 *
     47 *  Input: 1. Six word stack frame for unimplemented inst, four word
     48 *            for illegal
     49 *            (See table 8-7 MC68030 User's Manual).
     50 *         2. Unimp (short) fsave state frame created here by fsave
     51 *            instruction.
     52 *
     53 
     54 X_UNIMP	IDNT    2,1 Motorola 040 Floating Point Software Package
     55 
     56 	section	8
     57 
     58 	include fpsp.h
     59 
     60 	xref	get_op
     61 	xref	do_func
     62 	xref	sto_res
     63 	xref	gen_except
     64 	xref	fpsp_fmt_error
     65 
     66 	xdef	fpsp_unimp
     67 	xdef	uni_2
     68 fpsp_unimp:
     69 	link		a6,#-LOCAL_SIZE
     70 	fsave		-(a7)
     71 uni_2:
     72 	movem.l		d0-d1/a0-a1,USER_DA(a6)
     73 	fmovem.x	fp0-fp3,USER_FP0(a6)
     74 	fmovem.l	fpcr/fpsr/fpiar,USER_FPCR(a6)
     75 	move.b		(a7),d0		;test for valid version num
     76 	andi.b		#$f0,d0		;test for $4x
     77 	cmpi.b		#VER_4,d0	;must be $4x or exit
     78 	bne.l		fpsp_fmt_error
     79 *
     80 *	Temporary D25B Fix
     81 *	The following lines are used to ensure that the FPSR
     82 *	exception byte and condition codes are clear before proceeding
     83 *
     84 	move.l		USER_FPSR(a6),d0
     85 	and.l		#$FF00FF,d0	;clear all but accrued exceptions
     86 	move.l		d0,USER_FPSR(a6)
     87 	fmove.l		#0,FPSR ;clear all user bits
     88 	fmove.l		#0,FPCR	;clear all user exceptions for FPSP
     89 
     90 	clr.b		UFLG_TMP(a6)	;clr flag for unsupp data
     91 
     92 	bsr.l		get_op		;go get operand(s)
     93 	clr.b		STORE_FLG(a6)
     94 	bsr.l		do_func		;do the function
     95 	fsave		-(a7)		;capture possible exc state
     96 	tst.b		STORE_FLG(a6)
     97 	bne.b		no_store	;if STORE_FLG is set, no store
     98 	bsr.l		sto_res		;store the result in user space
     99 no_store:
    100 	bra.l		gen_except	;post any exceptions and return
    101 
    102 	end
    103