162306a36Sopenharmony_ci|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262306a36Sopenharmony_ci|MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
362306a36Sopenharmony_ci|M68000 Hi-Performance Microprocessor Division
462306a36Sopenharmony_ci|M68060 Software Package
562306a36Sopenharmony_ci|Production Release P1.00 -- October 10, 1994
662306a36Sopenharmony_ci|
762306a36Sopenharmony_ci|M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
862306a36Sopenharmony_ci|
962306a36Sopenharmony_ci|THE SOFTWARE is provided on an "AS IS" basis and without warranty.
1062306a36Sopenharmony_ci|To the maximum extent permitted by applicable law,
1162306a36Sopenharmony_ci|MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
1262306a36Sopenharmony_ci|INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
1362306a36Sopenharmony_ci|and any warranty against infringement with regard to the SOFTWARE
1462306a36Sopenharmony_ci|(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
1562306a36Sopenharmony_ci|
1662306a36Sopenharmony_ci|To the maximum extent permitted by applicable law,
1762306a36Sopenharmony_ci|IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
1862306a36Sopenharmony_ci|(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
1962306a36Sopenharmony_ci|BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
2062306a36Sopenharmony_ci|ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
2162306a36Sopenharmony_ci|Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
2262306a36Sopenharmony_ci|
2362306a36Sopenharmony_ci|You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
2462306a36Sopenharmony_ci|so long as this entire notice is retained without alteration in any modified and/or
2562306a36Sopenharmony_ci|redistributed versions, and that such modified versions are clearly identified as such.
2662306a36Sopenharmony_ci|No licenses are granted by implication, estoppel or otherwise under any patents
2762306a36Sopenharmony_ci|or trademarks of Motorola, Inc.
2862306a36Sopenharmony_ci|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2962306a36Sopenharmony_ci| fskeleton.s
3062306a36Sopenharmony_ci|
3162306a36Sopenharmony_ci| This file contains:
3262306a36Sopenharmony_ci|	(1) example "Call-out"s
3362306a36Sopenharmony_ci|	(2) example package entry code
3462306a36Sopenharmony_ci|	(3) example "Call-out" table
3562306a36Sopenharmony_ci|
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#include <linux/linkage.h>
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci|################################
4062306a36Sopenharmony_ci| (1) EXAMPLE CALL-OUTS		#
4162306a36Sopenharmony_ci|				#
4262306a36Sopenharmony_ci| _060_fpsp_done()		#
4362306a36Sopenharmony_ci| _060_real_ovfl()		#
4462306a36Sopenharmony_ci| _060_real_unfl()		#
4562306a36Sopenharmony_ci| _060_real_operr()		#
4662306a36Sopenharmony_ci| _060_real_snan()		#
4762306a36Sopenharmony_ci| _060_real_dz()		#
4862306a36Sopenharmony_ci| _060_real_inex()		#
4962306a36Sopenharmony_ci| _060_real_bsun()		#
5062306a36Sopenharmony_ci| _060_real_fline()		#
5162306a36Sopenharmony_ci| _060_real_fpu_disabled()	#
5262306a36Sopenharmony_ci| _060_real_trap()		#
5362306a36Sopenharmony_ci|################################
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci|
5662306a36Sopenharmony_ci| _060_fpsp_done():
5762306a36Sopenharmony_ci|
5862306a36Sopenharmony_ci| This is the main exit point for the 68060 Floating-Point
5962306a36Sopenharmony_ci| Software Package. For a normal exit, all 060FPSP routines call this
6062306a36Sopenharmony_ci| routine. The operating system can do system dependent clean-up or
6162306a36Sopenharmony_ci| simply execute an "rte" as with the sample code below.
6262306a36Sopenharmony_ci|
6362306a36Sopenharmony_ci	.global		_060_fpsp_done
6462306a36Sopenharmony_ci_060_fpsp_done:
6562306a36Sopenharmony_ci	bral	 _060_isp_done	| do the same as isp_done
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci|
6862306a36Sopenharmony_ci| _060_real_ovfl():
6962306a36Sopenharmony_ci|
7062306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled overflow exception
7162306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
7262306a36Sopenharmony_ci| for enabled overflow conditions. The exception stack frame is an overflow
7362306a36Sopenharmony_ci| stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
7462306a36Sopenharmony_ci|
7562306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
7662306a36Sopenharmony_ci| does an "rte".
7762306a36Sopenharmony_ci|
7862306a36Sopenharmony_ci	.global		_060_real_ovfl
7962306a36Sopenharmony_ci_060_real_ovfl:
8062306a36Sopenharmony_ci	fsave		-(%sp)
8162306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
8262306a36Sopenharmony_ci	frestore	(%sp)+
8362306a36Sopenharmony_ci	bral		trap	| jump to trap handler
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci|
8762306a36Sopenharmony_ci| _060_real_unfl():
8862306a36Sopenharmony_ci|
8962306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled underflow exception
9062306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
9162306a36Sopenharmony_ci| for enabled underflow conditions. The exception stack frame is an underflow
9262306a36Sopenharmony_ci| stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
9362306a36Sopenharmony_ci|
9462306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
9562306a36Sopenharmony_ci| does an "rte".
9662306a36Sopenharmony_ci|
9762306a36Sopenharmony_ci	.global		_060_real_unfl
9862306a36Sopenharmony_ci_060_real_unfl:
9962306a36Sopenharmony_ci	fsave		-(%sp)
10062306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
10162306a36Sopenharmony_ci	frestore	(%sp)+
10262306a36Sopenharmony_ci	bral		trap	| jump to trap handler
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci|
10562306a36Sopenharmony_ci| _060_real_operr():
10662306a36Sopenharmony_ci|
10762306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled operand error exception
10862306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
10962306a36Sopenharmony_ci| for enabled operand error exceptions. The exception stack frame is an operand error
11062306a36Sopenharmony_ci| stack frame. The FP state frame holds the source operand of the faulting
11162306a36Sopenharmony_ci| instruction.
11262306a36Sopenharmony_ci|
11362306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
11462306a36Sopenharmony_ci| does an "rte".
11562306a36Sopenharmony_ci|
11662306a36Sopenharmony_ci	.global		_060_real_operr
11762306a36Sopenharmony_ci_060_real_operr:
11862306a36Sopenharmony_ci	fsave		-(%sp)
11962306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
12062306a36Sopenharmony_ci	frestore	(%sp)+
12162306a36Sopenharmony_ci	bral		trap	| jump to trap handler
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci|
12462306a36Sopenharmony_ci| _060_real_snan():
12562306a36Sopenharmony_ci|
12662306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled signalling NaN exception
12762306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
12862306a36Sopenharmony_ci| for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
12962306a36Sopenharmony_ci| stack frame. The FP state frame holds the source operand of the faulting
13062306a36Sopenharmony_ci| instruction.
13162306a36Sopenharmony_ci|
13262306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
13362306a36Sopenharmony_ci| does an "rte".
13462306a36Sopenharmony_ci|
13562306a36Sopenharmony_ci	.global		_060_real_snan
13662306a36Sopenharmony_ci_060_real_snan:
13762306a36Sopenharmony_ci	fsave		-(%sp)
13862306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
13962306a36Sopenharmony_ci	frestore	(%sp)+
14062306a36Sopenharmony_ci	bral		trap	| jump to trap handler
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci|
14362306a36Sopenharmony_ci| _060_real_dz():
14462306a36Sopenharmony_ci|
14562306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled divide-by-zero exception
14662306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
14762306a36Sopenharmony_ci| for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
14862306a36Sopenharmony_ci| stack frame. The FP state frame holds the source operand of the faulting
14962306a36Sopenharmony_ci| instruction.
15062306a36Sopenharmony_ci|
15162306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
15262306a36Sopenharmony_ci| does an "rte".
15362306a36Sopenharmony_ci|
15462306a36Sopenharmony_ci	.global		_060_real_dz
15562306a36Sopenharmony_ci_060_real_dz:
15662306a36Sopenharmony_ci	fsave		-(%sp)
15762306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
15862306a36Sopenharmony_ci	frestore	(%sp)+
15962306a36Sopenharmony_ci	bral		trap	| jump to trap handler
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci|
16262306a36Sopenharmony_ci| _060_real_inex():
16362306a36Sopenharmony_ci|
16462306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled inexact exception
16562306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
16662306a36Sopenharmony_ci| for enabled inexact exceptions. The exception stack frame is an inexact
16762306a36Sopenharmony_ci| stack frame. The FP state frame holds the source operand of the faulting
16862306a36Sopenharmony_ci| instruction.
16962306a36Sopenharmony_ci|
17062306a36Sopenharmony_ci| The sample routine below simply clears the exception status bit and
17162306a36Sopenharmony_ci| does an "rte".
17262306a36Sopenharmony_ci|
17362306a36Sopenharmony_ci	.global		_060_real_inex
17462306a36Sopenharmony_ci_060_real_inex:
17562306a36Sopenharmony_ci	fsave		-(%sp)
17662306a36Sopenharmony_ci	move.w		#0x6000,0x2(%sp)
17762306a36Sopenharmony_ci	frestore	(%sp)+
17862306a36Sopenharmony_ci	bral		trap	| jump to trap handler
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci|
18162306a36Sopenharmony_ci| _060_real_bsun():
18262306a36Sopenharmony_ci|
18362306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an enabled bsun exception
18462306a36Sopenharmony_ci| is present. The routine below should point to the operating system handler
18562306a36Sopenharmony_ci| for enabled bsun exceptions. The exception stack frame is a bsun
18662306a36Sopenharmony_ci| stack frame.
18762306a36Sopenharmony_ci|
18862306a36Sopenharmony_ci| The sample routine below clears the exception status bit, clears the NaN
18962306a36Sopenharmony_ci| bit in the FPSR, and does an "rte". The instruction that caused the
19062306a36Sopenharmony_ci| bsun will now be re-executed but with the NaN FPSR bit cleared.
19162306a36Sopenharmony_ci|
19262306a36Sopenharmony_ci	.global		_060_real_bsun
19362306a36Sopenharmony_ci_060_real_bsun:
19462306a36Sopenharmony_ci|	fsave		-(%sp)
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci	fmove.l		%fpsr,-(%sp)
19762306a36Sopenharmony_ci	andi.b		#0xfe,(%sp)
19862306a36Sopenharmony_ci	fmove.l		(%sp)+,%fpsr
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci	bral		trap	| jump to trap handler
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_ci|
20362306a36Sopenharmony_ci| _060_real_fline():
20462306a36Sopenharmony_ci|
20562306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an F-Line Illegal exception is
20662306a36Sopenharmony_ci| encountered. Three different types of exceptions can enter the F-Line exception
20762306a36Sopenharmony_ci| vector number 11: FP Unimplemented Instructions, FP implemented instructions when
20862306a36Sopenharmony_ci| the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
20962306a36Sopenharmony_ci| _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
21062306a36Sopenharmony_ci| Illegals branch here.
21162306a36Sopenharmony_ci|
21262306a36Sopenharmony_ci	.global		_060_real_fline
21362306a36Sopenharmony_ci_060_real_fline:
21462306a36Sopenharmony_ci	bral		trap	| jump to trap handler
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci|
21762306a36Sopenharmony_ci| _060_real_fpu_disabled():
21862306a36Sopenharmony_ci|
21962306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an FPU disabled exception is
22062306a36Sopenharmony_ci| encountered. Three different types of exceptions can enter the F-Line exception
22162306a36Sopenharmony_ci| vector number 11: FP Unimplemented Instructions, FP implemented instructions when
22262306a36Sopenharmony_ci| the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
22362306a36Sopenharmony_ci| _fpsp_fline() distinguishes between the three and acts appropriately. FPU disabled
22462306a36Sopenharmony_ci| exceptions branch here.
22562306a36Sopenharmony_ci|
22662306a36Sopenharmony_ci| The sample code below enables the FPU, sets the PC field in the exception stack
22762306a36Sopenharmony_ci| frame to the PC of the instruction causing the exception, and does an "rte".
22862306a36Sopenharmony_ci| The execution of the instruction then proceeds with an enabled floating-point
22962306a36Sopenharmony_ci| unit.
23062306a36Sopenharmony_ci|
23162306a36Sopenharmony_ci	.global		_060_real_fpu_disabled
23262306a36Sopenharmony_ci_060_real_fpu_disabled:
23362306a36Sopenharmony_ci	move.l		%d0,-(%sp)		| enabled the fpu
23462306a36Sopenharmony_ci	.long	0x4E7A0808			|movec		pcr,%d0
23562306a36Sopenharmony_ci	bclr		#0x1,%d0
23662306a36Sopenharmony_ci	.long	0x4E7B0808			|movec		%d0,pcr
23762306a36Sopenharmony_ci	move.l		(%sp)+,%d0
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci	move.l		0xc(%sp),0x2(%sp)	| set "Current PC"
24062306a36Sopenharmony_ci	rte
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci|
24362306a36Sopenharmony_ci| _060_real_trap():
24462306a36Sopenharmony_ci|
24562306a36Sopenharmony_ci| This is the exit point for the 060FPSP when an emulated "ftrapcc" instruction
24662306a36Sopenharmony_ci| discovers that the trap condition is true and it should branch to the operating
24762306a36Sopenharmony_ci| system handler for the trap exception vector number 7.
24862306a36Sopenharmony_ci|
24962306a36Sopenharmony_ci| The sample code below simply executes an "rte".
25062306a36Sopenharmony_ci|
25162306a36Sopenharmony_ci	.global		_060_real_trap
25262306a36Sopenharmony_ci_060_real_trap:
25362306a36Sopenharmony_ci	bral		trap	| jump to trap handler
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci|############################################################################
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci|#################################
25862306a36Sopenharmony_ci| (2) EXAMPLE PACKAGE ENTRY CODE #
25962306a36Sopenharmony_ci|#################################
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci	.global		_060_fpsp_snan
26262306a36Sopenharmony_ci_060_fpsp_snan:
26362306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x00
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	.global		_060_fpsp_operr
26662306a36Sopenharmony_ci_060_fpsp_operr:
26762306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x08
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci	.global		_060_fpsp_ovfl
27062306a36Sopenharmony_ci_060_fpsp_ovfl:
27162306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x10
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci	.global		_060_fpsp_unfl
27462306a36Sopenharmony_ci_060_fpsp_unfl:
27562306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x18
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci	.global		_060_fpsp_dz
27862306a36Sopenharmony_ci_060_fpsp_dz:
27962306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x20
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci	.global		_060_fpsp_inex
28262306a36Sopenharmony_ci_060_fpsp_inex:
28362306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x28
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci	.global		_060_fpsp_fline
28662306a36Sopenharmony_ci_060_fpsp_fline:
28762306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x30
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci	.global		_060_fpsp_unsupp
29062306a36Sopenharmony_ci_060_fpsp_unsupp:
29162306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x38
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci	.global		_060_fpsp_effadd
29462306a36Sopenharmony_ci_060_fpsp_effadd:
29562306a36Sopenharmony_ci	bra.l		_FP_CALL_TOP+0x80+0x40
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci|############################################################################
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci|###############################
30062306a36Sopenharmony_ci| (3) EXAMPLE CALL-OUT SECTION #
30162306a36Sopenharmony_ci|###############################
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci| The size of this section MUST be 128 bytes!!!
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci_FP_CALL_TOP:
30662306a36Sopenharmony_ci	.long	_060_real_bsun		- _FP_CALL_TOP
30762306a36Sopenharmony_ci	.long	_060_real_snan		- _FP_CALL_TOP
30862306a36Sopenharmony_ci	.long	_060_real_operr		- _FP_CALL_TOP
30962306a36Sopenharmony_ci	.long	_060_real_ovfl		- _FP_CALL_TOP
31062306a36Sopenharmony_ci	.long	_060_real_unfl		- _FP_CALL_TOP
31162306a36Sopenharmony_ci	.long	_060_real_dz		- _FP_CALL_TOP
31262306a36Sopenharmony_ci	.long	_060_real_inex		- _FP_CALL_TOP
31362306a36Sopenharmony_ci	.long	_060_real_fline		- _FP_CALL_TOP
31462306a36Sopenharmony_ci	.long	_060_real_fpu_disabled	- _FP_CALL_TOP
31562306a36Sopenharmony_ci	.long	_060_real_trap		- _FP_CALL_TOP
31662306a36Sopenharmony_ci	.long	_060_real_trace		- _FP_CALL_TOP
31762306a36Sopenharmony_ci	.long	_060_real_access	- _FP_CALL_TOP
31862306a36Sopenharmony_ci	.long	_060_fpsp_done		- _FP_CALL_TOP
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci	.long	0x00000000, 0x00000000, 0x00000000
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci	.long	_060_imem_read		- _FP_CALL_TOP
32362306a36Sopenharmony_ci	.long	_060_dmem_read		- _FP_CALL_TOP
32462306a36Sopenharmony_ci	.long	_060_dmem_write		- _FP_CALL_TOP
32562306a36Sopenharmony_ci	.long	_060_imem_read_word	- _FP_CALL_TOP
32662306a36Sopenharmony_ci	.long	_060_imem_read_long	- _FP_CALL_TOP
32762306a36Sopenharmony_ci	.long	_060_dmem_read_byte	- _FP_CALL_TOP
32862306a36Sopenharmony_ci	.long	_060_dmem_read_word	- _FP_CALL_TOP
32962306a36Sopenharmony_ci	.long	_060_dmem_read_long	- _FP_CALL_TOP
33062306a36Sopenharmony_ci	.long	_060_dmem_write_byte	- _FP_CALL_TOP
33162306a36Sopenharmony_ci	.long	_060_dmem_write_word	- _FP_CALL_TOP
33262306a36Sopenharmony_ci	.long	_060_dmem_write_long	- _FP_CALL_TOP
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci	.long	0x00000000
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci	.long	0x00000000, 0x00000000, 0x00000000, 0x00000000
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci|############################################################################
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci| 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci#include "fpsp.sa"
343