162306a36Sopenharmony_ci|
262306a36Sopenharmony_ci|	x_unimp.sa 3.3 7/1/91
362306a36Sopenharmony_ci|
462306a36Sopenharmony_ci|	fpsp_unimp --- FPSP handler for unimplemented instruction
562306a36Sopenharmony_ci|	exception.
662306a36Sopenharmony_ci|
762306a36Sopenharmony_ci| Invoked when the user program encounters a floating-point
862306a36Sopenharmony_ci| op-code that hardware does not support.  Trap vector# 11
962306a36Sopenharmony_ci| (See table 8-1 MC68030 User's Manual).
1062306a36Sopenharmony_ci|
1162306a36Sopenharmony_ci|
1262306a36Sopenharmony_ci| Note: An fsave for an unimplemented inst. will create a short
1362306a36Sopenharmony_ci| fsave stack.
1462306a36Sopenharmony_ci|
1562306a36Sopenharmony_ci|  Input: 1. Six word stack frame for unimplemented inst, four word
1662306a36Sopenharmony_ci|            for illegal
1762306a36Sopenharmony_ci|            (See table 8-7 MC68030 User's Manual).
1862306a36Sopenharmony_ci|         2. Unimp (short) fsave state frame created here by fsave
1962306a36Sopenharmony_ci|            instruction.
2062306a36Sopenharmony_ci|
2162306a36Sopenharmony_ci|
2262306a36Sopenharmony_ci|		Copyright (C) Motorola, Inc. 1990
2362306a36Sopenharmony_ci|			All Rights Reserved
2462306a36Sopenharmony_ci|
2562306a36Sopenharmony_ci|       For details on the license for this file, please see the
2662306a36Sopenharmony_ci|       file, README, in this same directory.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciX_UNIMP:	|idnt    2,1 | Motorola 040 Floating Point Software Package
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci	|section	8
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#include "fpsp.h"
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	|xref	get_op
3562306a36Sopenharmony_ci	|xref	do_func
3662306a36Sopenharmony_ci	|xref	sto_res
3762306a36Sopenharmony_ci	|xref	gen_except
3862306a36Sopenharmony_ci	|xref	fpsp_fmt_error
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	.global	fpsp_unimp
4162306a36Sopenharmony_ci	.global	uni_2
4262306a36Sopenharmony_cifpsp_unimp:
4362306a36Sopenharmony_ci	link		%a6,#-LOCAL_SIZE
4462306a36Sopenharmony_ci	fsave		-(%a7)
4562306a36Sopenharmony_ciuni_2:
4662306a36Sopenharmony_ci	moveml		%d0-%d1/%a0-%a1,USER_DA(%a6)
4762306a36Sopenharmony_ci	fmovemx	%fp0-%fp3,USER_FP0(%a6)
4862306a36Sopenharmony_ci	fmoveml	%fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
4962306a36Sopenharmony_ci	moveb		(%a7),%d0		|test for valid version num
5062306a36Sopenharmony_ci	andib		#0xf0,%d0		|test for $4x
5162306a36Sopenharmony_ci	cmpib		#VER_4,%d0	|must be $4x or exit
5262306a36Sopenharmony_ci	bnel		fpsp_fmt_error
5362306a36Sopenharmony_ci|
5462306a36Sopenharmony_ci|	Temporary D25B Fix
5562306a36Sopenharmony_ci|	The following lines are used to ensure that the FPSR
5662306a36Sopenharmony_ci|	exception byte and condition codes are clear before proceeding
5762306a36Sopenharmony_ci|
5862306a36Sopenharmony_ci	movel		USER_FPSR(%a6),%d0
5962306a36Sopenharmony_ci	andl		#0xFF00FF,%d0	|clear all but accrued exceptions
6062306a36Sopenharmony_ci	movel		%d0,USER_FPSR(%a6)
6162306a36Sopenharmony_ci	fmovel		#0,%FPSR |clear all user bits
6262306a36Sopenharmony_ci	fmovel		#0,%FPCR	|clear all user exceptions for FPSP
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	clrb		UFLG_TMP(%a6)	|clr flag for unsupp data
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci	bsrl		get_op		|go get operand(s)
6762306a36Sopenharmony_ci	clrb		STORE_FLG(%a6)
6862306a36Sopenharmony_ci	bsrl		do_func		|do the function
6962306a36Sopenharmony_ci	fsave		-(%a7)		|capture possible exc state
7062306a36Sopenharmony_ci	tstb		STORE_FLG(%a6)
7162306a36Sopenharmony_ci	bnes		no_store	|if STORE_FLG is set, no store
7262306a36Sopenharmony_ci	bsrl		sto_res		|store the result in user space
7362306a36Sopenharmony_cino_store:
7462306a36Sopenharmony_ci	bral		gen_except	|post any exceptions and return
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci	|end
77