[BACK]Return to netbsd.S CVS log [TXT][DIR] Up to [local] / sys / arch / m68k / 060sp

Annotation of sys/arch/m68k/060sp/netbsd.S, Revision 1.1

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

CVSweb