Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) |	x_snan.sa 3.3 7/1/91
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) | fpsp_snan --- FPSP handler for signalling NAN exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) | SNAN for float -> integer conversions (integer conversion of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) | an SNAN) is a non-maskable run-time exception.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) | For trap disabled the 040 does the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) | If the dest data format is s, d, or x, then the SNAN bit in the NAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) | is set to one and the resulting non-signaling NAN (truncated if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) | necessary) is transferred to the dest.  If the dest format is b, w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) | or l, then garbage is written to the dest (actually the upper 32 bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) | of the mantissa are sent to the integer unit).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) | For trap enabled the 040 does the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) | If the inst is move_out, then the results are the same as for trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) | disabled with the exception posted.  If the instruction is not move_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) | out, the dest. is not modified, and the exception is posted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) |		Copyright (C) Motorola, Inc. 1990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) |			All Rights Reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) |       For details on the license for this file, please see the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) |       file, README, in this same directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) X_SNAN:	|idnt    2,1 | Motorola 040 Floating Point Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	|section	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "fpsp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	|xref	get_fline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	|xref	mem_write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	|xref	real_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	|xref	real_inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	|xref	fpsp_done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	|xref	reg_dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	.global	fpsp_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) fpsp_snan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	link		%a6,#-LOCAL_SIZE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	fsave		-(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	moveml		%d0-%d1/%a0-%a1,USER_DA(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	fmovemx	%fp0-%fp3,USER_FP0(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	fmoveml	%fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) | Check if trap enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	btstb		#snan_bit,FPCR_ENABLE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	bnes		ena		|If enabled, then branch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	bsrl		move_out	|else SNAN disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) | It is possible to have an inex1 exception with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) | snan.  If the inex enable bit is set in the FPCR, and either
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) | inex2 or inex1 occurred, we must clean up and branch to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) | real inex handler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) ck_inex:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	moveb	FPCR_ENABLE(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	andb	FPSR_EXCEPT(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	andib	#0x3,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	beq	end_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) | Inexact enabled and reported, and we must take an inexact exception.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) take_inex:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	moveb		#INEX_VEC,EXC_VEC+1(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	moveml		USER_DA(%a6),%d0-%d1/%a0-%a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	fmovemx	USER_FP0(%a6),%fp0-%fp3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	fmoveml	USER_FPCR(%a6),%fpcr/%fpsr/%fpiar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	frestore	(%a7)+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	unlk		%a6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	bral		real_inex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) | SNAN is enabled.  Check if inst is move_out.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) | Make any corrections to the 040 output as necessary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) ena:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	btstb		#5,CMDREG1B(%a6) |if set, inst is move out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	beq		not_out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	bsrl		move_out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) report_snan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	moveb		(%a7),VER_TMP(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	cmpib		#VER_40,(%a7)	|test for orig unimp frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	bnes		ck_rev
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	moveql		#13,%d0		|need to zero 14 lwords
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	bras		rep_con
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) ck_rev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	moveql		#11,%d0		|need to zero 12 lwords
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) rep_con:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	clrl		(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) loop1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	clrl		-(%a7)		|clear and dec a7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	dbra		%d0,loop1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	moveb		VER_TMP(%a6),(%a7) |format a busy frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	moveb		#BUSY_SIZE-4,1(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	movel		USER_FPSR(%a6),FPSR_SHADOW(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	orl		#sx_mask,E_BYTE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	moveml		USER_DA(%a6),%d0-%d1/%a0-%a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	fmovemx	USER_FP0(%a6),%fp0-%fp3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	fmoveml	USER_FPCR(%a6),%fpcr/%fpsr/%fpiar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	frestore	(%a7)+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	unlk		%a6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	bral		real_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) | Exit snan handler by expanding the unimp frame into a busy frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) end_snan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	bclrb		#E1,E_BYTE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	moveb		(%a7),VER_TMP(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	cmpib		#VER_40,(%a7)	|test for orig unimp frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	bnes		ck_rev2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	moveql		#13,%d0		|need to zero 14 lwords
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	bras		rep_con2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ck_rev2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	moveql		#11,%d0		|need to zero 12 lwords
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) rep_con2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	clrl		(%a7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) loop2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	clrl		-(%a7)		|clear and dec a7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	dbra		%d0,loop2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	moveb		VER_TMP(%a6),(%a7) |format a busy frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	moveb		#BUSY_SIZE-4,1(%a7) |write busy size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	movel		USER_FPSR(%a6),FPSR_SHADOW(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	orl		#sx_mask,E_BYTE(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	moveml		USER_DA(%a6),%d0-%d1/%a0-%a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	fmovemx	USER_FP0(%a6),%fp0-%fp3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	fmoveml	USER_FPCR(%a6),%fpcr/%fpsr/%fpiar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	frestore	(%a7)+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	unlk		%a6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	bral		fpsp_done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) | Move_out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) move_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	movel		EXC_EA(%a6),%a0	|get <ea> from exc frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	bfextu		CMDREG1B(%a6){#3:#3},%d0 |move rx field to d0{2:0}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	cmpil		#0,%d0		|check for long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	beqs		sto_long	|branch if move_out long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	cmpil		#4,%d0		|check for word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	beqs		sto_word	|branch if move_out word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	cmpil		#6,%d0		|check for byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	beqs		sto_byte	|branch if move_out byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) | Not byte, word or long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) | Get the 32 most significant bits of etemp mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) sto_long:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	movel		ETEMP_HI(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	movel		#4,%d0		|load byte count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) | Set signalling nan bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	bsetl		#30,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) | Store to the users destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	tstl		%a0		|check if <ea> is 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	beqs		wrt_dn		|destination is a data register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	movel		%d1,-(%a7)	|move the snan onto the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	movel		%a0,%a1		|load dest addr into a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	movel		%a7,%a0		|load src addr of snan into a0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	bsrl		mem_write	|write snan to user memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	movel		(%a7)+,%d1	|clear off stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) | Get the 16 most significant bits of etemp mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) sto_word:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	movel		ETEMP_HI(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	movel		#2,%d0		|load byte count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) | Set signalling nan bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	bsetl		#30,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) | Store to the users destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	tstl		%a0		|check if <ea> is 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	beqs		wrt_dn		|destination is a data register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	movel		%d1,-(%a7)	|move the snan onto the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	movel		%a0,%a1		|load dest addr into a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	movel		%a7,%a0		|point to low word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	bsrl		mem_write	|write snan to user memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	movel		(%a7)+,%d1	|clear off stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) | Get the 8 most significant bits of etemp mantissa
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) sto_byte:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	movel		ETEMP_HI(%a6),%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	movel		#1,%d0		|load byte count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) | Set signalling nan bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	bsetl		#30,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) | Store to the users destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	tstl		%a0		|check if <ea> is 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	beqs		wrt_dn		|destination is a data register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	movel		%d1,-(%a7)	|move the snan onto the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	movel		%a0,%a1		|load dest addr into a1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	movel		%a7,%a0		|point to source byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	bsrl		mem_write	|write snan to user memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	movel		(%a7)+,%d1	|clear off stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) |	wrt_dn --- write to a data register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) |	We get here with D1 containing the data to write and D0 the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) |	number of bytes to write: 1=byte,2=word,4=long.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) wrt_dn:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	movel		%d1,L_SCR1(%a6)	|data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	movel		%d0,-(%a7)	|size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	bsrl		get_fline	|returns fline word in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	movel		%d0,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	andil		#0x7,%d1		|d1 now holds register number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	movel		(%sp)+,%d0	|get original size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	cmpil		#4,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	beqs		wrt_long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	cmpil		#2,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	bnes		wrt_byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) wrt_word:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	orl		#0x8,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	bral		reg_dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) wrt_long:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	orl		#0x10,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	bral		reg_dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) wrt_byte:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	bral		reg_dest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) | Check if it is a src nan or dst nan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) not_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	movel		DTAG(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	bfextu		%d0{#0:#3},%d0	|isolate dtag in lsbs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	cmpib		#3,%d0		|check for nan in destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	bnes		issrc		|destination nan has priority
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) dst_nan:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	btstb		#6,FPTEMP_HI(%a6) |check if dest nan is an snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	bnes		issrc		|no, so check source for snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	movew		FPTEMP_EX(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	bras		cont
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) issrc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	movew		ETEMP_EX(%a6),%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) cont:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	btstl		#15,%d0		|test for sign of snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	beqs		clr_neg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	bsetb		#neg_bit,FPSR_CC(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	bra		report_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) clr_neg:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	bclrb		#neg_bit,FPSR_CC(%a6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	bra		report_snan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	|end