Home | History | Annotate | Line # | Download | only in 060sp
netbsd060sp.S revision 1.5.8.1
      1  1.5.8.1  bouyer /*
      2      1.1      is #
      3  1.5.8.1  bouyer # $NetBSD: netbsd060sp.S,v 1.5.8.1 2000/12/08 09:28:15 bouyer Exp $
      4      1.1      is #
      5      1.1      is #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      6      1.1      is # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
      7      1.1      is # M68000 Hi-Performance Microprocessor Division
      8      1.1      is # M68060 Software Package Production Release
      9      1.1      is #
     10      1.1      is # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
     11      1.1      is # All rights reserved.
     12      1.1      is #
     13      1.1      is # THE SOFTWARE is provided on an "AS IS" basis and without warranty.
     14      1.1      is # To the maximum extent permitted by applicable law,
     15      1.1      is # MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
     16      1.1      is # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
     17      1.1      is # FOR A PARTICULAR PURPOSE and any warranty against infringement with
     18      1.1      is # regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
     19      1.1      is # and any accompanying written materials.
     20      1.1      is #
     21      1.1      is # To the maximum extent permitted by applicable law,
     22      1.1      is # IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
     23      1.1      is # (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
     24      1.1      is # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
     25      1.1      is # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
     26      1.1      is #
     27      1.1      is # Motorola assumes no responsibility for the maintenance and support
     28      1.1      is # of the SOFTWARE.
     29      1.1      is #
     30      1.1      is # You are hereby granted a copyright license to use, modify, and distribute the
     31      1.1      is # SOFTWARE so long as this entire notice is retained without alteration
     32      1.1      is # in any modified and/or redistributed versions, and that such modified
     33      1.1      is # versions are clearly identified as such.
     34      1.1      is # No licenses are granted by implication, estoppel or otherwise under any
     35      1.1      is # patents or trademarks of Motorola, Inc.
     36      1.1      is #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     37      1.1      is #
     38      1.1      is # Derived from:
     39      1.1      is # os.s
     40      1.1      is #
     41      1.1      is # This file contains:
     42      1.1      is #	- example "Call-Out"s required by both the ISP and FPSP.
     43      1.1      is #
     44  1.5.8.1  bouyer */
     45      1.1      is 
     46  1.5.8.1  bouyer #include <machine/asm.h>
     47  1.5.8.1  bouyer 
     48  1.5.8.1  bouyer /*
     49      1.1      is #
     50      1.1      is # make the copyright notice appear in the binary:
     51      1.1      is #
     52  1.5.8.1  bouyer */
     53  1.5.8.1  bouyer #include "copyright.S"
     54      1.1      is 
     55  1.5.8.1  bouyer /*
     56      1.1      is #################################
     57      1.1      is # EXAMPLE CALL-OUTS 		#
     58      1.1      is # 				#
     59      1.1      is # _060_dmem_write()		#
     60      1.1      is # _060_dmem_read()		#
     61      1.1      is # _060_imem_read()		#
     62      1.1      is # _060_dmem_read_byte()		#
     63      1.1      is # _060_dmem_read_word()		#
     64      1.1      is # _060_dmem_read_long()		#
     65      1.1      is # _060_imem_read_word()		#
     66      1.1      is # _060_imem_read_long()		#
     67      1.1      is # _060_dmem_write_byte()	#
     68      1.1      is # _060_dmem_write_word()	#
     69      1.1      is # _060_dmem_write_long()	#
     70      1.1      is #				#
     71      1.1      is # _060_real_trace()		#
     72      1.1      is # _060_real_access()		#
     73      1.1      is #################################
     74  1.5.8.1  bouyer */
     75      1.1      is 
     76  1.5.8.1  bouyer /*
     77      1.1      is #
     78      1.1      is # Each IO routine checks to see if the memory write/read is to/from user
     79      1.1      is # or supervisor application space. The examples below use simple "move"
     80      1.1      is # instructions for supervisor mode applications and call _copyin()/_copyout()
     81      1.1      is # for user mode applications.
     82      1.1      is # When installing the 060SP, the _copyin()/_copyout() equivalents for a
     83      1.1      is # given operating system should be substituted.
     84      1.1      is #
     85      1.1      is # The addresses within the 060SP are guaranteed to be on the stack.
     86      1.1      is # The result is that Unix processes are allowed to sleep as a consequence
     87      1.1      is # of a page fault during a _copyout.
     88      1.1      is #
     89  1.5.8.1  bouyer */
     90      1.1      is 
     91  1.5.8.1  bouyer /*
     92      1.1      is #
     93      1.1      is # _060_dmem_write():
     94      1.1      is #
     95      1.1      is # Writes to data memory while in supervisor mode.
     96      1.1      is #
     97      1.1      is # INPUTS:
     98      1.1      is #	a0 - supervisor source address
     99      1.1      is #	a1 - user destination address
    100      1.1      is #	d0 - number of bytes to write
    101      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    102      1.1      is # OUTPUTS:
    103      1.1      is #	d1 - 0 = success, !0 = failure
    104      1.1      is #
    105  1.5.8.1  bouyer */
    106  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_write)
    107  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)	|# check for supervisor state
    108      1.1      is 	beqs	user_write
    109      1.1      is super_write:
    110  1.5.8.1  bouyer 	moveb	%a0@+,%a1@+	|# copy 1 byte
    111  1.5.8.1  bouyer 	subql	#0x1,%d0	|# decr byte counter
    112      1.2      is 	bnes	super_write	|# quit if ctr = 0
    113  1.5.8.1  bouyer 	clrl	%d1		|# return success
    114      1.1      is 	rts
    115      1.1      is user_write:
    116  1.5.8.1  bouyer 	movel	%d0,%sp@-	|# pass: counter
    117  1.5.8.1  bouyer 	movel	%a1,%sp@-	|# pass: user dst
    118  1.5.8.1  bouyer 	movel	%a0,%sp@-	|# pass: supervisor src
    119  1.5.8.1  bouyer 	bsrl	_C_LABEL(copyout)	|# write byte to user mem
    120  1.5.8.1  bouyer 	movel	%d0,%d1		|# return success
    121  1.5.8.1  bouyer 	addl	#0xc,%sp	|# clear 3 lw params
    122      1.1      is 	rts
    123      1.1      is 
    124  1.5.8.1  bouyer /*
    125      1.1      is #
    126      1.1      is # _060_imem_read(), _060_dmem_read():
    127      1.1      is #
    128      1.1      is # Reads from data/instruction memory while in supervisor mode.
    129      1.1      is #
    130      1.1      is # INPUTS:
    131      1.1      is #	a0 - user source address
    132      1.1      is #	a1 - supervisor destination address
    133      1.1      is #	d0 - number of bytes to read
    134      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    135      1.1      is # OUTPUTS:
    136      1.1      is #	d1 - 0 = success, !0 = failure
    137      1.1      is #
    138  1.5.8.1  bouyer */
    139  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_imem_read)
    140  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_read)
    141  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)	|# check for supervisor state
    142      1.1      is 	beqs	user_read
    143      1.1      is super_read:
    144  1.5.8.1  bouyer 	moveb	%a0@+,%a1@+	|# copy 1 byte
    145  1.5.8.1  bouyer 	subql	#0x1,%d0	|# decr byte counter
    146      1.2      is 	bnes	super_read	|# quit if ctr = 0
    147  1.5.8.1  bouyer 	clrl	%d1		|# return success
    148      1.1      is 	rts
    149      1.1      is user_read:
    150  1.5.8.1  bouyer 	movel	%d0,%sp@-	|# pass: counter
    151  1.5.8.1  bouyer 	movel	%a1,%sp@-	|# pass: super dst
    152  1.5.8.1  bouyer 	movel	%a0,%sp@-	|# pass: user src
    153  1.5.8.1  bouyer 	bsrl	_C_LABEL(copyin)	|# read byte from user mem
    154  1.5.8.1  bouyer 	movel	%d0,%d1		|# return success
    155  1.5.8.1  bouyer 	addl	#0xc,%sp	|# clear 3 lw params
    156      1.1      is 	rts
    157      1.1      is 
    158  1.5.8.1  bouyer /*
    159      1.1      is #
    160      1.1      is # _060_dmem_read_byte():
    161      1.1      is #
    162      1.1      is # Read a data byte from user memory.
    163      1.1      is #
    164      1.1      is # INPUTS:
    165      1.1      is #	a0 - user source address
    166      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    167      1.1      is # OUTPUTS:
    168      1.1      is #	d0 - data byte in d0
    169      1.1      is #	d1 - 0 = success, !0 = failure
    170      1.1      is #
    171  1.5.8.1  bouyer */
    172  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_read_byte)
    173  1.5.8.1  bouyer 	clrl	%d1			|# return success
    174  1.5.8.1  bouyer 	clrl	%d0			|# clear whole longword
    175  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    176      1.4      is 	bnes	dmrbs			|# supervisor
    177      1.1      is dmrbu:
    178  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    179  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    180  1.5.8.1  bouyer 	movsb	%a0@,%d0
    181      1.4      is 	bra	Lfdone
    182      1.4      is 
    183      1.1      is dmrbs:
    184  1.5.8.1  bouyer 	moveb	%a0@,%d0		|# fetch super byte
    185      1.1      is 	rts
    186      1.1      is 
    187  1.5.8.1  bouyer /*
    188      1.1      is #
    189      1.1      is # _060_imem_read_word():
    190      1.1      is # Read an instruction word from user memory.
    191      1.1      is #
    192      1.1      is # _060_dmem_read_word():
    193      1.1      is # Read a data word from user memory.
    194      1.1      is #
    195      1.1      is # INPUTS:
    196      1.1      is #	a0 - user source address
    197      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    198      1.1      is # OUTPUTS:
    199      1.1      is #	d0 - data word in d0
    200      1.1      is #	d1 - 0 = success, !0 = failure
    201      1.1      is #
    202  1.5.8.1  bouyer */
    203  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_imem_read_word)
    204  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_read_word)
    205  1.5.8.1  bouyer 	clrl	%d1			|# return success
    206  1.5.8.1  bouyer 	clrl	%d0			|# clear whole longword
    207  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    208      1.4      is 	bnes	dmrws			|# supervisor
    209      1.1      is dmrwu:
    210  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    211  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    212  1.5.8.1  bouyer 	movsw	%a0@,%d0
    213      1.4      is 	bra	Lfdone
    214      1.1      is dmrws:
    215  1.5.8.1  bouyer 	movew	%a0@,%d0		|# fetch super word
    216      1.1      is 	rts
    217      1.1      is 
    218  1.5.8.1  bouyer /*
    219      1.1      is #
    220      1.1      is # _060_imem_read_long():
    221      1.1      is # Read an instruction longword from user memory.
    222      1.1      is #
    223      1.1      is # _060_dmem_read_long():
    224      1.1      is # Read an data longword from user memory.
    225      1.1      is #
    226      1.1      is #
    227      1.1      is # INPUTS:
    228      1.1      is #	a0 - user source address
    229      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    230      1.1      is # OUTPUTS:
    231      1.1      is #	d0 - data longword in d0
    232      1.1      is #	d1 - 0 = success, !0 = failure
    233      1.1      is #
    234  1.5.8.1  bouyer */
    235  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_imem_read_long)
    236  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_read_long)
    237  1.5.8.1  bouyer 	clrl	%d1			|# return success
    238  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    239      1.4      is 	bnes	dmrls			|# supervisor
    240      1.1      is dmrlu:
    241  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    242  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    243  1.5.8.1  bouyer 	movsl	%a0@,%d0
    244      1.4      is 	bra	Lfdone
    245      1.1      is dmrls:
    246  1.5.8.1  bouyer 	movel	%a0@,%d0		|# fetch super longword
    247      1.1      is 	rts
    248      1.1      is 
    249  1.5.8.1  bouyer /*
    250      1.1      is #
    251      1.1      is # _060_dmem_write_byte():
    252      1.1      is #
    253      1.1      is # Write a data byte to user memory.
    254      1.1      is #
    255      1.1      is # INPUTS:
    256      1.1      is #	a0 - user destination address
    257      1.1      is # 	d0 - data byte in d0
    258      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    259      1.1      is # OUTPUTS:
    260      1.1      is #	d1 - 0 = success, !0 = failure
    261      1.1      is #
    262  1.5.8.1  bouyer */
    263  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_write_byte)
    264  1.5.8.1  bouyer 	clrl	%d1			|# return success
    265  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    266      1.4      is 	bnes	dmwbs			|# supervisor
    267      1.1      is dmwbu:
    268  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    269  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    270  1.5.8.1  bouyer 	movsb	%d0,%a0@
    271      1.4      is 	bra	Lfdone
    272      1.1      is dmwbs:
    273  1.5.8.1  bouyer 	moveb	%d0,%a0@		|# store super byte
    274      1.1      is 	rts
    275      1.1      is 
    276  1.5.8.1  bouyer /*
    277      1.1      is #
    278      1.1      is # _060_dmem_write_word():
    279      1.1      is #
    280      1.1      is # Write a data word to user memory.
    281      1.1      is #
    282      1.1      is # INPUTS:
    283      1.1      is #	a0 - user destination address
    284      1.1      is # 	d0 - data word in d0
    285      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    286      1.1      is # OUTPUTS:
    287      1.1      is #	d1 - 0 = success, !0 = failure
    288      1.1      is #
    289  1.5.8.1  bouyer */
    290  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_write_word)
    291  1.5.8.1  bouyer 	clrl	%d1			|# return success
    292  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    293      1.4      is 	bnes	dmwws			|# supervisor
    294      1.1      is dmwwu:
    295  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    296  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    297  1.5.8.1  bouyer 	movsw	%d0,%a0@
    298      1.4      is 	bra	Lfdone
    299      1.1      is dmwws:
    300  1.5.8.1  bouyer 	movew	%d0,%a0@		|# store super word
    301      1.1      is 	rts
    302      1.1      is 
    303  1.5.8.1  bouyer /*
    304      1.1      is #
    305      1.1      is # _060_dmem_write_long():
    306      1.1      is #
    307      1.1      is # Write a data longword to user memory.
    308      1.1      is #
    309      1.1      is # INPUTS:
    310      1.1      is #	a0 - user destination address
    311      1.1      is # 	d0 - data longword in d0
    312      1.1      is # 	a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
    313      1.1      is # OUTPUTS:
    314      1.1      is #	d1 - 0 = success, !0 = failure
    315      1.1      is #
    316  1.5.8.1  bouyer */
    317  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_dmem_write_long)
    318  1.5.8.1  bouyer 	clrl	%d1			|# return success
    319  1.5.8.1  bouyer 	btst	#0x5,%a6@(0x4)		|# check for supervisor state
    320      1.4      is 	bnes	dmwls			|# supervisor
    321      1.1      is dmwlu:
    322  1.5.8.1  bouyer 	movl	_C_LABEL(curpcb),%a1	| fault handler
    323  1.5.8.1  bouyer 	movl	#Lferr,%a1@(64)		| set it
    324  1.5.8.1  bouyer 	movsl	%d0,%a0@
    325      1.4      is 	bra	Lfdone
    326      1.4      is dmwls:
    327  1.5.8.1  bouyer 	movel	%d0,%a0@		|# store super longword
    328      1.1      is 	rts
    329      1.4      is 
    330  1.5.8.1  bouyer |############################################################################
    331      1.4      is Lferr:
    332  1.5.8.1  bouyer 	moveq	#-1,%d1
    333      1.4      is Lfdone:
    334  1.5.8.1  bouyer 	clrl	%a1@(64)		| clear fault handler
    335      1.1      is 	rts
    336      1.1      is 
    337  1.5.8.1  bouyer |############################################################################
    338      1.1      is 
    339  1.5.8.1  bouyer /*
    340      1.1      is #
    341      1.1      is # _060_real_trace():
    342      1.1      is #
    343      1.1      is # This is the exit point for the 060FPSP when an instruction is being traced
    344      1.1      is # and there are no other higher priority exceptions pending for this instruction
    345      1.1      is # or they have already been processed.
    346      1.1      is #
    347      1.1      is # The sample code below simply executes an "rte".
    348      1.1      is #
    349  1.5.8.1  bouyer */
    350  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_real_trace)
    351  1.5.8.1  bouyer 	jra	_C_LABEL(trace)
    352      1.1      is 
    353  1.5.8.1  bouyer /*
    354      1.1      is #
    355      1.1      is # _060_real_access():
    356      1.1      is #
    357      1.1      is # This is the exit point for the 060FPSP when an access error exception
    358      1.1      is # is encountered. The routine below should point to the operating system
    359      1.1      is # handler for access error exceptions. The exception stack frame is an
    360      1.1      is # 8-word access error frame.
    361      1.1      is #
    362      1.2      is # We jump directly to the 68060 buserr handler.
    363      1.2      is # If we had a sane ld, we could use use that entry point directly...
    364      1.1      is #
    365  1.5.8.1  bouyer */
    366  1.5.8.1  bouyer ASENTRY_NOPROFILE(_060_real_access)
    367  1.5.8.1  bouyer 	jra	_C_LABEL(buserr60)
    368      1.1      is 
    369  1.5.8.1  bouyer #include "inetbsd.S"
    370  1.5.8.1  bouyer #include "fnetbsd.S"
    371