Annotation of src/sys/arch/m68k/060sp/netbsd060sp.S, Revision 1.6
1.6 ! scw 1: /*
1.1 is 2: #
1.6 ! scw 3: # $NetBSD: netbsd060sp.S,v 1.5 1999/01/30 21:54:49 is Exp $
1.1 is 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: #
1.6 ! scw 44: */
1.1 is 45:
1.6 ! scw 46: #include <machine/asm.h>
! 47:
! 48: /*
1.1 is 49: #
50: # make the copyright notice appear in the binary:
51: #
1.6 ! scw 52: */
! 53: #include "copyright.S"
1.1 is 54:
1.6 ! scw 55: /*
1.1 is 56: #################################
57: # EXAMPLE CALL-OUTS #
58: # #
59: # _060_dmem_write() #
60: # _060_dmem_read() #
61: # _060_imem_read() #
62: # _060_dmem_read_byte() #
63: # _060_dmem_read_word() #
64: # _060_dmem_read_long() #
65: # _060_imem_read_word() #
66: # _060_imem_read_long() #
67: # _060_dmem_write_byte() #
68: # _060_dmem_write_word() #
69: # _060_dmem_write_long() #
70: # #
71: # _060_real_trace() #
72: # _060_real_access() #
73: #################################
1.6 ! scw 74: */
1.1 is 75:
1.6 ! scw 76: /*
1.1 is 77: #
78: # Each IO routine checks to see if the memory write/read is to/from user
79: # or supervisor application space. The examples below use simple "move"
80: # instructions for supervisor mode applications and call _copyin()/_copyout()
81: # for user mode applications.
82: # When installing the 060SP, the _copyin()/_copyout() equivalents for a
83: # given operating system should be substituted.
84: #
85: # The addresses within the 060SP are guaranteed to be on the stack.
86: # The result is that Unix processes are allowed to sleep as a consequence
87: # of a page fault during a _copyout.
88: #
1.6 ! scw 89: */
1.1 is 90:
1.6 ! scw 91: /*
1.1 is 92: #
93: # _060_dmem_write():
94: #
95: # Writes to data memory while in supervisor mode.
96: #
97: # INPUTS:
98: # a0 - supervisor source address
99: # a1 - user destination address
100: # d0 - number of bytes to write
101: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
102: # OUTPUTS:
103: # d1 - 0 = success, !0 = failure
104: #
1.6 ! scw 105: */
! 106: ASENTRY_NOPROFILE(_060_dmem_write)
! 107: btst #0x5,%a6@(0x4) |# check for supervisor state
1.1 is 108: beqs user_write
109: super_write:
1.6 ! scw 110: moveb %a0@+,%a1@+ |# copy 1 byte
! 111: subql #0x1,%d0 |# decr byte counter
1.2 is 112: bnes super_write |# quit if ctr = 0
1.6 ! scw 113: clrl %d1 |# return success
1.1 is 114: rts
115: user_write:
1.6 ! scw 116: movel %d0,%sp@- |# pass: counter
! 117: movel %a1,%sp@- |# pass: user dst
! 118: movel %a0,%sp@- |# pass: supervisor src
! 119: bsrl _C_LABEL(copyout) |# write byte to user mem
! 120: movel %d0,%d1 |# return success
! 121: addl #0xc,%sp |# clear 3 lw params
1.1 is 122: rts
123:
1.6 ! scw 124: /*
1.1 is 125: #
126: # _060_imem_read(), _060_dmem_read():
127: #
128: # Reads from data/instruction memory while in supervisor mode.
129: #
130: # INPUTS:
131: # a0 - user source address
132: # a1 - supervisor destination address
133: # d0 - number of bytes to read
134: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
135: # OUTPUTS:
136: # d1 - 0 = success, !0 = failure
137: #
1.6 ! scw 138: */
! 139: ASENTRY_NOPROFILE(_060_imem_read)
! 140: ASENTRY_NOPROFILE(_060_dmem_read)
! 141: btst #0x5,%a6@(0x4) |# check for supervisor state
1.1 is 142: beqs user_read
143: super_read:
1.6 ! scw 144: moveb %a0@+,%a1@+ |# copy 1 byte
! 145: subql #0x1,%d0 |# decr byte counter
1.2 is 146: bnes super_read |# quit if ctr = 0
1.6 ! scw 147: clrl %d1 |# return success
1.1 is 148: rts
149: user_read:
1.6 ! scw 150: movel %d0,%sp@- |# pass: counter
! 151: movel %a1,%sp@- |# pass: super dst
! 152: movel %a0,%sp@- |# pass: user src
! 153: bsrl _C_LABEL(copyin) |# read byte from user mem
! 154: movel %d0,%d1 |# return success
! 155: addl #0xc,%sp |# clear 3 lw params
1.1 is 156: rts
157:
1.6 ! scw 158: /*
1.1 is 159: #
160: # _060_dmem_read_byte():
161: #
162: # Read a data byte from user memory.
163: #
164: # INPUTS:
165: # a0 - user source address
166: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
167: # OUTPUTS:
168: # d0 - data byte in d0
169: # d1 - 0 = success, !0 = failure
170: #
1.6 ! scw 171: */
! 172: ASENTRY_NOPROFILE(_060_dmem_read_byte)
! 173: clrl %d1 |# return success
! 174: clrl %d0 |# clear whole longword
! 175: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 176: bnes dmrbs |# supervisor
1.1 is 177: dmrbu:
1.6 ! scw 178: movl _C_LABEL(curpcb),%a1 | fault handler
! 179: movl #Lferr,%a1@(64) | set it
! 180: movsb %a0@,%d0
1.4 is 181: bra Lfdone
182:
1.1 is 183: dmrbs:
1.6 ! scw 184: moveb %a0@,%d0 |# fetch super byte
1.1 is 185: rts
186:
1.6 ! scw 187: /*
1.1 is 188: #
189: # _060_imem_read_word():
190: # Read an instruction word from user memory.
191: #
192: # _060_dmem_read_word():
193: # Read a data word from user memory.
194: #
195: # INPUTS:
196: # a0 - user source address
197: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
198: # OUTPUTS:
199: # d0 - data word in d0
200: # d1 - 0 = success, !0 = failure
201: #
1.6 ! scw 202: */
! 203: ASENTRY_NOPROFILE(_060_imem_read_word)
! 204: ASENTRY_NOPROFILE(_060_dmem_read_word)
! 205: clrl %d1 |# return success
! 206: clrl %d0 |# clear whole longword
! 207: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 208: bnes dmrws |# supervisor
1.1 is 209: dmrwu:
1.6 ! scw 210: movl _C_LABEL(curpcb),%a1 | fault handler
! 211: movl #Lferr,%a1@(64) | set it
! 212: movsw %a0@,%d0
1.4 is 213: bra Lfdone
1.1 is 214: dmrws:
1.6 ! scw 215: movew %a0@,%d0 |# fetch super word
1.1 is 216: rts
217:
1.6 ! scw 218: /*
1.1 is 219: #
220: # _060_imem_read_long():
221: # Read an instruction longword from user memory.
222: #
223: # _060_dmem_read_long():
224: # Read an data longword from user memory.
225: #
226: #
227: # INPUTS:
228: # a0 - user source address
229: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
230: # OUTPUTS:
231: # d0 - data longword in d0
232: # d1 - 0 = success, !0 = failure
233: #
1.6 ! scw 234: */
! 235: ASENTRY_NOPROFILE(_060_imem_read_long)
! 236: ASENTRY_NOPROFILE(_060_dmem_read_long)
! 237: clrl %d1 |# return success
! 238: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 239: bnes dmrls |# supervisor
1.1 is 240: dmrlu:
1.6 ! scw 241: movl _C_LABEL(curpcb),%a1 | fault handler
! 242: movl #Lferr,%a1@(64) | set it
! 243: movsl %a0@,%d0
1.4 is 244: bra Lfdone
1.1 is 245: dmrls:
1.6 ! scw 246: movel %a0@,%d0 |# fetch super longword
1.1 is 247: rts
248:
1.6 ! scw 249: /*
1.1 is 250: #
251: # _060_dmem_write_byte():
252: #
253: # Write a data byte to user memory.
254: #
255: # INPUTS:
256: # a0 - user destination address
257: # d0 - data byte in d0
258: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
259: # OUTPUTS:
260: # d1 - 0 = success, !0 = failure
261: #
1.6 ! scw 262: */
! 263: ASENTRY_NOPROFILE(_060_dmem_write_byte)
! 264: clrl %d1 |# return success
! 265: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 266: bnes dmwbs |# supervisor
1.1 is 267: dmwbu:
1.6 ! scw 268: movl _C_LABEL(curpcb),%a1 | fault handler
! 269: movl #Lferr,%a1@(64) | set it
! 270: movsb %d0,%a0@
1.4 is 271: bra Lfdone
1.1 is 272: dmwbs:
1.6 ! scw 273: moveb %d0,%a0@ |# store super byte
1.1 is 274: rts
275:
1.6 ! scw 276: /*
1.1 is 277: #
278: # _060_dmem_write_word():
279: #
280: # Write a data word to user memory.
281: #
282: # INPUTS:
283: # a0 - user destination address
284: # d0 - data word in d0
285: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
286: # OUTPUTS:
287: # d1 - 0 = success, !0 = failure
288: #
1.6 ! scw 289: */
! 290: ASENTRY_NOPROFILE(_060_dmem_write_word)
! 291: clrl %d1 |# return success
! 292: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 293: bnes dmwws |# supervisor
1.1 is 294: dmwwu:
1.6 ! scw 295: movl _C_LABEL(curpcb),%a1 | fault handler
! 296: movl #Lferr,%a1@(64) | set it
! 297: movsw %d0,%a0@
1.4 is 298: bra Lfdone
1.1 is 299: dmwws:
1.6 ! scw 300: movew %d0,%a0@ |# store super word
1.1 is 301: rts
302:
1.6 ! scw 303: /*
1.1 is 304: #
305: # _060_dmem_write_long():
306: #
307: # Write a data longword to user memory.
308: #
309: # INPUTS:
310: # a0 - user destination address
311: # d0 - data longword in d0
312: # a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
313: # OUTPUTS:
314: # d1 - 0 = success, !0 = failure
315: #
1.6 ! scw 316: */
! 317: ASENTRY_NOPROFILE(_060_dmem_write_long)
! 318: clrl %d1 |# return success
! 319: btst #0x5,%a6@(0x4) |# check for supervisor state
1.4 is 320: bnes dmwls |# supervisor
1.1 is 321: dmwlu:
1.6 ! scw 322: movl _C_LABEL(curpcb),%a1 | fault handler
! 323: movl #Lferr,%a1@(64) | set it
! 324: movsl %d0,%a0@
1.4 is 325: bra Lfdone
326: dmwls:
1.6 ! scw 327: movel %d0,%a0@ |# store super longword
1.1 is 328: rts
1.4 is 329:
1.6 ! scw 330: |############################################################################
1.4 is 331: Lferr:
1.6 ! scw 332: moveq #-1,%d1
1.4 is 333: Lfdone:
1.6 ! scw 334: clrl %a1@(64) | clear fault handler
1.1 is 335: rts
336:
1.6 ! scw 337: |############################################################################
1.1 is 338:
1.6 ! scw 339: /*
1.1 is 340: #
341: # _060_real_trace():
342: #
343: # This is the exit point for the 060FPSP when an instruction is being traced
344: # and there are no other higher priority exceptions pending for this instruction
345: # or they have already been processed.
346: #
347: # The sample code below simply executes an "rte".
348: #
1.6 ! scw 349: */
! 350: ASENTRY_NOPROFILE(_060_real_trace)
! 351: jra _C_LABEL(trace)
1.1 is 352:
1.6 ! scw 353: /*
1.1 is 354: #
355: # _060_real_access():
356: #
357: # This is the exit point for the 060FPSP when an access error exception
358: # is encountered. The routine below should point to the operating system
359: # handler for access error exceptions. The exception stack frame is an
360: # 8-word access error frame.
361: #
1.2 is 362: # We jump directly to the 68060 buserr handler.
363: # If we had a sane ld, we could use use that entry point directly...
1.1 is 364: #
1.6 ! scw 365: */
! 366: ASENTRY_NOPROFILE(_060_real_access)
! 367: jra _C_LABEL(buserr60)
1.1 is 368:
1.6 ! scw 369: #include "inetbsd.S"
! 370: #include "fnetbsd.S"
CVSweb <webmaster@jp.NetBSD.org>