[BACK]Return to netbsd060sp.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / m68k / 060sp

Annotation of src/sys/arch/m68k/060sp/netbsd060sp.S, Revision 1.5

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

CVSweb <webmaster@jp.NetBSD.org>