18c2ecf20Sopenharmony_ci|
28c2ecf20Sopenharmony_ci|	x_unimp.sa 3.3 7/1/91
38c2ecf20Sopenharmony_ci|
48c2ecf20Sopenharmony_ci|	fpsp_unimp --- FPSP handler for unimplemented instruction
58c2ecf20Sopenharmony_ci|	exception.
68c2ecf20Sopenharmony_ci|
78c2ecf20Sopenharmony_ci| Invoked when the user program encounters a floating-point
88c2ecf20Sopenharmony_ci| op-code that hardware does not support.  Trap vector# 11
98c2ecf20Sopenharmony_ci| (See table 8-1 MC68030 User's Manual).
108c2ecf20Sopenharmony_ci|
118c2ecf20Sopenharmony_ci|
128c2ecf20Sopenharmony_ci| Note: An fsave for an unimplemented inst. will create a short
138c2ecf20Sopenharmony_ci| fsave stack.
148c2ecf20Sopenharmony_ci|
158c2ecf20Sopenharmony_ci|  Input: 1. Six word stack frame for unimplemented inst, four word
168c2ecf20Sopenharmony_ci|            for illegal
178c2ecf20Sopenharmony_ci|            (See table 8-7 MC68030 User's Manual).
188c2ecf20Sopenharmony_ci|         2. Unimp (short) fsave state frame created here by fsave
198c2ecf20Sopenharmony_ci|            instruction.
208c2ecf20Sopenharmony_ci|
218c2ecf20Sopenharmony_ci|
228c2ecf20Sopenharmony_ci|		Copyright (C) Motorola, Inc. 1990
238c2ecf20Sopenharmony_ci|			All Rights Reserved
248c2ecf20Sopenharmony_ci|
258c2ecf20Sopenharmony_ci|       For details on the license for this file, please see the
268c2ecf20Sopenharmony_ci|       file, README, in this same directory.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciX_UNIMP:	|idnt    2,1 | Motorola 040 Floating Point Software Package
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	|section	8
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include "fpsp.h"
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	|xref	get_op
358c2ecf20Sopenharmony_ci	|xref	do_func
368c2ecf20Sopenharmony_ci	|xref	sto_res
378c2ecf20Sopenharmony_ci	|xref	gen_except
388c2ecf20Sopenharmony_ci	|xref	fpsp_fmt_error
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	.global	fpsp_unimp
418c2ecf20Sopenharmony_ci	.global	uni_2
428c2ecf20Sopenharmony_cifpsp_unimp:
438c2ecf20Sopenharmony_ci	link		%a6,#-LOCAL_SIZE
448c2ecf20Sopenharmony_ci	fsave		-(%a7)
458c2ecf20Sopenharmony_ciuni_2:
468c2ecf20Sopenharmony_ci	moveml		%d0-%d1/%a0-%a1,USER_DA(%a6)
478c2ecf20Sopenharmony_ci	fmovemx	%fp0-%fp3,USER_FP0(%a6)
488c2ecf20Sopenharmony_ci	fmoveml	%fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
498c2ecf20Sopenharmony_ci	moveb		(%a7),%d0		|test for valid version num
508c2ecf20Sopenharmony_ci	andib		#0xf0,%d0		|test for $4x
518c2ecf20Sopenharmony_ci	cmpib		#VER_4,%d0	|must be $4x or exit
528c2ecf20Sopenharmony_ci	bnel		fpsp_fmt_error
538c2ecf20Sopenharmony_ci|
548c2ecf20Sopenharmony_ci|	Temporary D25B Fix
558c2ecf20Sopenharmony_ci|	The following lines are used to ensure that the FPSR
568c2ecf20Sopenharmony_ci|	exception byte and condition codes are clear before proceeding
578c2ecf20Sopenharmony_ci|
588c2ecf20Sopenharmony_ci	movel		USER_FPSR(%a6),%d0
598c2ecf20Sopenharmony_ci	andl		#0xFF00FF,%d0	|clear all but accrued exceptions
608c2ecf20Sopenharmony_ci	movel		%d0,USER_FPSR(%a6)
618c2ecf20Sopenharmony_ci	fmovel		#0,%FPSR |clear all user bits
628c2ecf20Sopenharmony_ci	fmovel		#0,%FPCR	|clear all user exceptions for FPSP
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	clrb		UFLG_TMP(%a6)	|clr flag for unsupp data
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci	bsrl		get_op		|go get operand(s)
678c2ecf20Sopenharmony_ci	clrb		STORE_FLG(%a6)
688c2ecf20Sopenharmony_ci	bsrl		do_func		|do the function
698c2ecf20Sopenharmony_ci	fsave		-(%a7)		|capture possible exc state
708c2ecf20Sopenharmony_ci	tstb		STORE_FLG(%a6)
718c2ecf20Sopenharmony_ci	bnes		no_store	|if STORE_FLG is set, no store
728c2ecf20Sopenharmony_ci	bsrl		sto_res		|store the result in user space
738c2ecf20Sopenharmony_cino_store:
748c2ecf20Sopenharmony_ci	bral		gen_except	|post any exceptions and return
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	|end
77