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) |MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) |M68000 Hi-Performance Microprocessor Division
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) |M68060 Software Package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) |Production Release P1.00 -- October 10, 1994
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) |M68060 Software Package Copyright © 1993, 1994 Motorola Inc.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) |THE SOFTWARE is provided on an "AS IS" basis and without warranty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) |To the maximum extent permitted by applicable law,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) |MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) |INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) |and any warranty against infringement with regard to the SOFTWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) |(INCLUDING ANY MODIFIED VERSIONS THEREOF) and any accompanying written materials.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) |To the maximum extent permitted by applicable law,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) |IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) |(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) |BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) |ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) |Motorola assumes no responsibility for the maintenance and support of the SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) |You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) |so long as this entire notice is retained without alteration in any modified and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) |redistributed versions, and that such modified versions are clearly identified as such.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) |No licenses are granted by implication, estoppel or otherwise under any patents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) |or trademarks of Motorola, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) | os.s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) | This file contains:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) |	- example "Call-Out"s required by both the ISP and FPSP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) |################################
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) | EXAMPLE CALL-OUTS		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) |				#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) | _060_dmem_write()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) | _060_dmem_read()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) | _060_imem_read()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) | _060_dmem_read_byte()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) | _060_dmem_read_word()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) | _060_dmem_read_long()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) | _060_imem_read_word()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) | _060_imem_read_long()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) | _060_dmem_write_byte()	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) | _060_dmem_write_word()	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) | _060_dmem_write_long()	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) |				#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) | _060_real_trace()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) | _060_real_access()		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) |################################
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) | Each IO routine checks to see if the memory write/read is to/from user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) | or supervisor application space. The examples below use simple "move"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) | instructions for supervisor mode applications and call _copyin()/_copyout()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) | for user mode applications.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) | When installing the 060SP, the _copyin()/_copyout() equivalents for a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) | given operating system should be substituted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) | The addresses within the 060SP are guaranteed to be on the stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) | The result is that Unix processes are allowed to sleep as a consequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) | of a page fault during a _copyout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) | Linux/68k: The _060_[id]mem_{read,write}_{byte,word,long} functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) | (i.e. all the known length <= 4) are implemented by single moves
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) | statements instead of (more expensive) copy{in,out} calls, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) | working in user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) | _060_dmem_write():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) | Writes to data memory while in supervisor mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) |	a0 - supervisor source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) |	a1 - user destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) |	d0 - number of bytes to write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.global		_060_dmem_write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) _060_dmem_write:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	subq.l		#1,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	beqs		user_write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) super_write:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	move.b		(%a0)+,(%a1)+		| copy 1 byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	dbra		%d0,super_write		| quit if --ctr < 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	clr.l		%d1			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) user_write:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	move.b		(%a0)+,%d1		| copy 1 byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) copyoutae:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	movs.b		%d1,(%a1)+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	dbra		%d0,user_write		| quit if --ctr < 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	clr.l		%d1			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) | _060_imem_read(), _060_dmem_read():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) | Reads from data/instruction memory while in supervisor mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) |	a1 - supervisor destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) |	d0 - number of bytes to read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.global		_060_imem_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.global		_060_dmem_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) _060_imem_read:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) _060_dmem_read:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	subq.l		#1,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	beqs		user_read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) super_read:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	move.b		(%a0)+,(%a1)+		| copy 1 byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	dbra		%d0,super_read		| quit if --ctr < 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	clr.l		%d1			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) user_read:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) copyinae:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	movs.b		(%a0)+,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	move.b		%d1,(%a1)+		| copy 1 byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	dbra		%d0,user_read		| quit if --ctr < 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	clr.l		%d1			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) | _060_dmem_read_byte():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) | Read a data byte from user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) |	d0 - data byte in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	.global		_060_dmem_read_byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) _060_dmem_read_byte:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	clr.l		%d0			| clear whole longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	bnes		dmrbs			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) dmrbuae:movs.b		(%a0),%d0		| fetch user byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) dmrbs:	move.b		(%a0),%d0		| fetch super byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) | _060_dmem_read_word():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) | Read a data word from user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) |	d0 - data word in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) | _060_imem_read_word():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) | Read an instruction word from user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) |	d0 - instruction word in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	.global		_060_dmem_read_word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	.global		_060_imem_read_word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) _060_dmem_read_word:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) _060_imem_read_word:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	clr.l		%d0			| clear whole longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	bnes		dmrws			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) dmrwuae:movs.w		(%a0), %d0		| fetch user word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) dmrws:	move.w		(%a0), %d0		| fetch super word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) | _060_dmem_read_long():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) |	d0 - data longword in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) | _060_imem_read_long():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) | Read an instruction longword from user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) |	a0 - user source address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) |	d0 - instruction longword in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	.global		_060_dmem_read_long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	.global		_060_imem_read_long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) _060_dmem_read_long:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) _060_imem_read_long:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	bnes		dmrls			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) dmrluae:movs.l		(%a0),%d0		| fetch user longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) dmrls:	move.l		(%a0),%d0		| fetch super longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) | _060_dmem_write_byte():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) | Write a data byte to user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) |	a0 - user destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) |	d0 - data byte in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	.global		_060_dmem_write_byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) _060_dmem_write_byte:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 	bnes		dmwbs			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) dmwbuae:movs.b		%d0,(%a0)		| store user byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) dmwbs:	move.b		%d0,(%a0)		| store super byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) | _060_dmem_write_word():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) | Write a data word to user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) |	a0 - user destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) |	d0 - data word in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	.global		_060_dmem_write_word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) _060_dmem_write_word:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	bnes		dmwws			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) dmwwu:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) dmwwuae:movs.w		%d0,(%a0)		| store user word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	bras		dmwwr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) dmwws:	move.w		%d0,(%a0)		| store super word
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) dmwwr:	clr.l		%d1			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) | _060_dmem_write_long():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) | Write a data longword to user memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) | INPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) |	a0 - user destination address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) |	d0 - data longword in d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) |	0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) | OUTPUTS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) |	d1 - 0 = success, !0 = failure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	.global		_060_dmem_write_long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) _060_dmem_write_long:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	clr.l		%d1			| assume success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	btst		#0x5,0x4(%a6)		| check for supervisor state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	bnes		dmwls			| supervisor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) dmwluae:movs.l		%d0,(%a0)		| store user longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) dmwls:	move.l		%d0,(%a0)		| store super longword
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) |###############################################
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) | Use these routines if your kernel doesn't have _copyout/_copyin equivalents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) | Assumes that D0/D1/A0/A1 are scratch registers. The _copyin/_copyout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) | below assume that the SFC/DFC have been set previously.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) | Linux/68k: These are basically non-inlined versions of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) | memcpy_{to,from}fs, but without long-transfer optimization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) | Note: Assumed that SFC/DFC are pointing correctly to user data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) | space... Should be right, or are there any exceptions?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) | int _copyout(supervisor_addr, user_addr, nbytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	.global		_copyout
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) _copyout:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 	move.l		4(%sp),%a0		| source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	move.l		8(%sp),%a1		| destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	move.l		12(%sp),%d0		| count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	subq.l		#1,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) moreout:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	move.b		(%a0)+,%d1		| fetch supervisor byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) copyoutae:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 	movs.b		%d1,(%a1)+		| store user byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	dbra		%d0,moreout		| are we through yet?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	moveq		#0,%d0			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) | int _copyin(user_addr, supervisor_addr, nbytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	.global		_copyin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) _copyin:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	move.l		4(%sp),%a0		| source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	move.l		8(%sp),%a1		| destination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	move.l		12(%sp),%d0		| count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)     subq.l      #1,%d0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) morein:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) copyinae:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 	movs.b		(%a0)+,%d1		| fetch user byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	move.b		%d1,(%a1)+		| write supervisor byte
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	dbra		%d0,morein		| are we through yet?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 	moveq		#0,%d0			| return success
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) |###########################################################################
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) | _060_real_trace():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) | This is the exit point for the 060FPSP when an instruction is being traced
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) | and there are no other higher priority exceptions pending for this instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) | or they have already been processed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) | The sample code below simply executes an "rte".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	.global		_060_real_trace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) _060_real_trace:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	bral	trap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) | _060_real_access():
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) | This is the exit point for the 060FPSP when an access error exception
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) | is encountered. The routine below should point to the operating system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) | handler for access error exceptions. The exception stack frame is an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) | 8-word access error frame.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) | The sample routine below simply executes an "rte" instruction which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) | is most likely the incorrect thing to do and could put the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) | into an infinite loop.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 	.global		_060_real_access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) _060_real_access:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	bral	buserr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) | Execption handling for movs access to illegal memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	.section .fixup,#alloc,#execinstr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	.even
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 1:	moveq		#-1,%d1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	rts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) .section __ex_table,#alloc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 	.align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	.long	dmrbuae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 	.long	dmrwuae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 	.long	dmrluae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	.long	dmwbuae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	.long	dmwwuae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 	.long	dmwluae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	.long	copyoutae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	.long	copyinae,1b
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	.text