xref: /OK3568_Linux_fs/kernel/arch/m68k/fpsp040/x_unimp.S (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun|
2*4882a593Smuzhiyun|	x_unimp.sa 3.3 7/1/91
3*4882a593Smuzhiyun|
4*4882a593Smuzhiyun|	fpsp_unimp --- FPSP handler for unimplemented instruction
5*4882a593Smuzhiyun|	exception.
6*4882a593Smuzhiyun|
7*4882a593Smuzhiyun| Invoked when the user program encounters a floating-point
8*4882a593Smuzhiyun| op-code that hardware does not support.  Trap vector# 11
9*4882a593Smuzhiyun| (See table 8-1 MC68030 User's Manual).
10*4882a593Smuzhiyun|
11*4882a593Smuzhiyun|
12*4882a593Smuzhiyun| Note: An fsave for an unimplemented inst. will create a short
13*4882a593Smuzhiyun| fsave stack.
14*4882a593Smuzhiyun|
15*4882a593Smuzhiyun|  Input: 1. Six word stack frame for unimplemented inst, four word
16*4882a593Smuzhiyun|            for illegal
17*4882a593Smuzhiyun|            (See table 8-7 MC68030 User's Manual).
18*4882a593Smuzhiyun|         2. Unimp (short) fsave state frame created here by fsave
19*4882a593Smuzhiyun|            instruction.
20*4882a593Smuzhiyun|
21*4882a593Smuzhiyun|
22*4882a593Smuzhiyun|		Copyright (C) Motorola, Inc. 1990
23*4882a593Smuzhiyun|			All Rights Reserved
24*4882a593Smuzhiyun|
25*4882a593Smuzhiyun|       For details on the license for this file, please see the
26*4882a593Smuzhiyun|       file, README, in this same directory.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunX_UNIMP:	|idnt    2,1 | Motorola 040 Floating Point Software Package
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun	|section	8
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun#include "fpsp.h"
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun	|xref	get_op
35*4882a593Smuzhiyun	|xref	do_func
36*4882a593Smuzhiyun	|xref	sto_res
37*4882a593Smuzhiyun	|xref	gen_except
38*4882a593Smuzhiyun	|xref	fpsp_fmt_error
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun	.global	fpsp_unimp
41*4882a593Smuzhiyun	.global	uni_2
42*4882a593Smuzhiyunfpsp_unimp:
43*4882a593Smuzhiyun	link		%a6,#-LOCAL_SIZE
44*4882a593Smuzhiyun	fsave		-(%a7)
45*4882a593Smuzhiyununi_2:
46*4882a593Smuzhiyun	moveml		%d0-%d1/%a0-%a1,USER_DA(%a6)
47*4882a593Smuzhiyun	fmovemx	%fp0-%fp3,USER_FP0(%a6)
48*4882a593Smuzhiyun	fmoveml	%fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
49*4882a593Smuzhiyun	moveb		(%a7),%d0		|test for valid version num
50*4882a593Smuzhiyun	andib		#0xf0,%d0		|test for $4x
51*4882a593Smuzhiyun	cmpib		#VER_4,%d0	|must be $4x or exit
52*4882a593Smuzhiyun	bnel		fpsp_fmt_error
53*4882a593Smuzhiyun|
54*4882a593Smuzhiyun|	Temporary D25B Fix
55*4882a593Smuzhiyun|	The following lines are used to ensure that the FPSR
56*4882a593Smuzhiyun|	exception byte and condition codes are clear before proceeding
57*4882a593Smuzhiyun|
58*4882a593Smuzhiyun	movel		USER_FPSR(%a6),%d0
59*4882a593Smuzhiyun	andl		#0xFF00FF,%d0	|clear all but accrued exceptions
60*4882a593Smuzhiyun	movel		%d0,USER_FPSR(%a6)
61*4882a593Smuzhiyun	fmovel		#0,%FPSR |clear all user bits
62*4882a593Smuzhiyun	fmovel		#0,%FPCR	|clear all user exceptions for FPSP
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun	clrb		UFLG_TMP(%a6)	|clr flag for unsupp data
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun	bsrl		get_op		|go get operand(s)
67*4882a593Smuzhiyun	clrb		STORE_FLG(%a6)
68*4882a593Smuzhiyun	bsrl		do_func		|do the function
69*4882a593Smuzhiyun	fsave		-(%a7)		|capture possible exc state
70*4882a593Smuzhiyun	tstb		STORE_FLG(%a6)
71*4882a593Smuzhiyun	bnes		no_store	|if STORE_FLG is set, no store
72*4882a593Smuzhiyun	bsrl		sto_res		|store the result in user space
73*4882a593Smuzhiyunno_store:
74*4882a593Smuzhiyun	bral		gen_except	|post any exceptions and return
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	|end
77