[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.2

1.1       is          1: #
1.2     ! is          2: # $NetBSD: netbsd.S,v 1.1 1996/05/15 21:06:24 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.2     ! is        161:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        162:        bnes    dmrbs           |# supervisor
                    163: dmrbu:
                    164:        clrl    sp@-            |# clear space on stack for result
1.2     ! is        165:        movel   #0x1,sp@-       |# pass: # bytes to copy
        !           166:        pea     sp@(0x7)        |# pass: dst addr (stack)
1.1       is        167:        movel   a0,sp@-         |# pass: src addr (user mem)
                    168:        bsrl    _copyin         |# "copy in" the data
                    169:        movel   d0,d1           |# return success
                    170:        addl    #0xc,sp         |# delete params
                    171:        movel   sp@+,d0         |# put answer in d0
                    172:        rts
                    173: dmrbs:
                    174:        clrl    d0              |# clear whole longword
                    175:        moveb   a0@,d0          |# fetch super byte
                    176:        clrl    d1              |# return success
                    177:        rts
                    178:
                    179: #
                    180: # _060_imem_read_word():
                    181: # Read an instruction word from user memory.
                    182: #
                    183: # _060_dmem_read_word():
                    184: # Read a data word from user memory.
                    185: #
                    186: # INPUTS:
                    187: #      a0 - user source address
                    188: #      a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
                    189: # OUTPUTS:
                    190: #      d0 - data word in d0
                    191: #      d1 - 0 = success, !0 = failure
                    192: #
                    193:        .global _060_imem_read_word
                    194:        .global _060_dmem_read_word
                    195:
                    196: _060_imem_read_word:
                    197: _060_dmem_read_word:
1.2     ! is        198:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        199:        bnes    dmrws           |# supervisor
                    200: dmrwu:
                    201:        clrl    sp@-            |# clear result space on stack
1.2     ! is        202:        movel   #0x2,sp@-       |# pass: # bytes to copy
        !           203:        pea     sp@(0x6)        |# pass: dst addr (stack)
1.1       is        204:        movel   a0,sp@-         |# pass: src addr (user mem)
                    205:        bsrl    _copyin         |# "copy in" the data
                    206:        movel   d0,d1           |# return success
                    207:        addl    #0xc,sp         |# delete params
                    208:        movel   sp@+,d0         |# put answer in d0
                    209:        rts
                    210: dmrws:
                    211:        clrl    d0              |# clear whole longword
                    212:        movew   a0@,d0          |# fetch super word
                    213:        clrl    d1              |# return success
                    214:        rts
                    215:
                    216: #
                    217: # _060_imem_read_long():
                    218: # Read an instruction longword from user memory.
                    219: #
                    220: # _060_dmem_read_long():
                    221: # Read an data longword from user memory.
                    222: #
                    223:
                    224: #
                    225: # INPUTS:
                    226: #      a0 - user source address
                    227: #      a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
                    228: # OUTPUTS:
                    229: #      d0 - data longword in d0
                    230: #      d1 - 0 = success, !0 = failure
                    231: #
                    232:
                    233:        .global _060_dmem_read_long
                    234:        .global _060_imem_read_long
                    235:
                    236: _060_imem_read_long:
                    237: _060_dmem_read_long:
1.2     ! is        238:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        239:        bnes    dmrls           |# supervisor
                    240: dmrlu:
                    241:        subql   #0x4,sp         |# clear result space on stack
1.2     ! is        242:        movel   #0x4,sp@-       |# pass: # bytes to copy
        !           243:        pea     sp@(0x4)        |# pass: dst addr (stack)
1.1       is        244:        movel   a0,sp@-         |# pass: src addr (user mem)
                    245:        bsrl    _copyin         |# "copy in" the data
                    246:        movel   d0,d1           |# return success
                    247:        addl    #0xc,sp         |# delete params
                    248:        movel   sp@+,d0         |# put answer in d0
                    249:        rts
                    250: dmrls:
                    251:        movel   a0@,d0          |# fetch super longword
                    252:        clrl    d1              |# return success
                    253:        rts
                    254:
                    255: #
                    256: # _060_dmem_write_byte():
                    257: #
                    258: # Write a data byte to user memory.
                    259: #
                    260: # INPUTS:
                    261: #      a0 - user destination address
                    262: #      d0 - data byte in d0
                    263: #      a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
                    264: # OUTPUTS:
                    265: #      d1 - 0 = success, !0 = failure
                    266: #
                    267:        .global _060_dmem_write_byte
                    268: _060_dmem_write_byte:
1.2     ! is        269:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        270:        bnes    dmwbs           |# supervisor
                    271: dmwbu:
                    272:        movel   d0,sp@-         |# put src on stack
1.2     ! is        273:        movel   #0x1,sp@-       |# pass: # bytes to copy
1.1       is        274:        movel   a0,sp@-         |# pass: dst addr (user mem)
1.2     ! is        275:        pea     sp@(0xb)        |# pass: src addr (stack)
        !           276:        bsrl    _copyout        |# "copy out" the data
1.1       is        277:        movel   d0,d1           |# return success
1.2     ! is        278:        addl    #0x10,sp        |# delete params + src
1.1       is        279:        rts
                    280: dmwbs:
                    281:        moveb   d0,a0@          |# store super byte
                    282:        clrl    d1              |# return success
                    283:        rts
                    284:
                    285: #
                    286: # _060_dmem_write_word():
                    287: #
                    288: # Write a data word to user memory.
                    289: #
                    290: # INPUTS:
                    291: #      a0 - user destination address
                    292: #      d0 - data word in d0
                    293: #      a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
                    294: # OUTPUTS:
                    295: #      d1 - 0 = success, !0 = failure
                    296: #
                    297:        .global _060_dmem_write_word
                    298: _060_dmem_write_word:
1.2     ! is        299:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        300:        bnes    dmwws           |# supervisor
                    301: dmwwu:
                    302:        movel   d0,sp@-         |# put src on stack
1.2     ! is        303:        movel   #0x2,sp@-       |# pass: # bytes to copy
1.1       is        304:        movel   a0,sp@-         |# pass: dst addr (user mem)
1.2     ! is        305:        pea     sp@(0xa)        |# pass: src addr (stack)
        !           306:        bsrl    _copyout        |# "copy out" the data
1.1       is        307:        movel   d0,d1           |# return success
1.2     ! is        308:        addl    #0x10,sp        |# delete params + src
1.1       is        309:        rts
                    310: dmwws:
                    311:        movew   d0,a0@          |# store super word
                    312:        clrl    d1              |# return success
                    313:        rts
                    314:
                    315: #
                    316: # _060_dmem_write_long():
                    317: #
                    318: # Write a data longword to user memory.
                    319: #
                    320: # INPUTS:
                    321: #      a0 - user destination address
                    322: #      d0 - data longword in d0
                    323: #      a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
                    324: # OUTPUTS:
                    325: #      d1 - 0 = success, !0 = failure
                    326: #
                    327:        .global _060_dmem_write_long
                    328: _060_dmem_write_long:
1.2     ! is        329:        btst    #0x5,a6@(0x4)   |# check for supervisor state
1.1       is        330:        bnes    dmwls           |# supervisor
                    331: dmwlu:
                    332:        movel   d0,sp@-         |# put src on stack
1.2     ! is        333:        movel   #0x4,sp@-       |# pass: # bytes to copy
1.1       is        334:        movel   a0,sp@-         |# pass: dst addr (user mem)
1.2     ! is        335:        pea     sp@(0x8)        |# pass: src addr (stack)
        !           336:        bsrl    _copyout        |# "copy out" the data
1.1       is        337:        movel   d0,d1           |# return success
1.2     ! is        338:        addl    #0x10,sp        |# delete params + src
1.1       is        339:        rts
                    340: dmwls:
                    341:        movel   d0,a0@          |# store super longword
                    342:        clrl    d1              |# return success
                    343:        rts
                    344:
                    345: ############################################################################
                    346:
                    347: #
                    348: # _060_real_trace():
                    349: #
                    350: # This is the exit point for the 060FPSP when an instruction is being traced
                    351: # and there are no other higher priority exceptions pending for this instruction
                    352: # or they have already been processed.
                    353: #
                    354: # The sample code below simply executes an "rte".
                    355: #
                    356:        .global _060_real_trace
                    357: _060_real_trace:
                    358:        rte
                    359:
                    360: #
                    361: # _060_real_access():
                    362: #
                    363: # This is the exit point for the 060FPSP when an access error exception
                    364: # is encountered. The routine below should point to the operating system
                    365: # handler for access error exceptions. The exception stack frame is an
                    366: # 8-word access error frame.
                    367: #
1.2     ! is        368: # We jump directly to the 68060 buserr handler.
        !           369: # If we had a sane ld, we could use use that entry point directly...
1.1       is        370: #
1.2     ! is        371:        .globl  _060_real_access,_buserr60
1.1       is        372: _060_real_access:
1.2     ! is        373:        jra     _buserr60
1.1       is        374:
                    375:        .include        "inetbsd.S"
                    376:        .include        "fnetbsd.S"

CVSweb <webmaster@jp.NetBSD.org>