inetbsd.S revision 1.3 1 #
2 # $NetBSD: inetbsd.S,v 1.3 1997/07/28 19:01:13 is Exp $
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 # Derived from:
37 # iskeleton.s
38 #
39 # This file contains:
40 # (1) example "Call-out"s
41 # (2) example package entry code
42 # (3) example "Call-out" table
43 #
44
45
46 #################################
47 # (1) EXAMPLE CALL-OUTS #
48 # #
49 # _060_isp_done() #
50 # _060_real_chk() #
51 # _060_real_divbyzero() #
52 # #
53 # _060_real_cas() #
54 # _060_real_cas2() #
55 # _060_real_lock_page() #
56 # _060_real_unlock_page() #
57 #################################
58
59 #
60 # _060_isp_done():
61 #
62 # This is and example main exit point for the Unimplemented Integer
63 # Instruction exception handler. For a normal exit, the
64 # _isp_unimp() branches to here so that the operating system
65 # can do any clean-up desired. The stack frame is the
66 # Unimplemented Integer Instruction stack frame with
67 # the PC pointing to the instruction following the instruction
68 # just emulated.
69 # To simply continue execution at the next instruction, just
70 # do an "rte".
71 #
72 .global _060_isp_done
73 _060_isp_done:
74 rte
75
76 #
77 # _060_real_chk():
78 #
79 # This is an alternate exit point for the Unimplemented Integer
80 # Instruction exception handler. If the instruction was a "chk2"
81 # and the operand was out of bounds, then _isp_unimp() creates
82 # a CHK exception stack frame from the Unimplemented Integer Instrcution
83 # stack frame and branches to this routine.
84 #
85 .global _060_real_chk
86 _060_real_chk:
87 tstb sp@ |# is tracing enabled?
88 bpls real_chk_end |# no
89
90 #
91 # CHK FRAME TRACE FRAME
92 # ***************** *****************
93 # * Current PC * * Current PC *
94 # ***************** *****************
95 # * 0x2 * 0x018 * * 0x2 * 0x024 *
96 # ***************** *****************
97 # * Next * * Next *
98 # * PC * * PC *
99 # ***************** *****************
100 # * SR * * SR *
101 # ***************** *****************
102 #
103 moveb #0x24,sp@(0x7) |# set trace vecno
104 bral _060_real_trace
105
106 real_chk_end:
107 jmp _chkinst
108
109 #
110 # _060_real_divbyzero:
111 #
112 # This is an alternate exit point for the Unimplemented Integer
113 # Instruction exception handler isp_unimp(). If the instruction is a 64-bit
114 # integer divide where the source operand is a zero, then the _isp_unimp()
115 # creates a Divide-by-zero exception stack frame from the Unimplemented
116 # Integer Instruction stack frame and branches to this routine.
117 #
118 # Remember that a trace exception may be pending. The code below performs
119 # no action associated with the "chk" exception. If tracing is enabled,
120 # then it create a Trace exception stack frame from the "chk" exception
121 # stack frame and branches to the _real_trace() entry point.
122 #
123 .global _060_real_divbyzero
124 _060_real_divbyzero:
125 tstb sp@ |# is tracing enabled?
126 bpls real_divbyzero_end |# no
127
128 #
129 # DIVBYZERO FRAME TRACE FRAME
130 # ***************** *****************
131 # * Current PC * * Current PC *
132 # ***************** *****************
133 # * 0x2 * 0x014 * * 0x2 * 0x024 *
134 # ***************** *****************
135 # * Next * * Next *
136 # * PC * * PC *
137 # ***************** *****************
138 # * SR * * SR *
139 # ***************** *****************
140 #
141 moveb #0x24,sp@(0x7) |# set trace vecno
142 bral _060_real_trace
143
144 real_divbyzero_end:
145 jmp _zerodiv
146
147 ###########################
148
149 #
150 # _060_real_cas():
151 #
152 # Entry point for the selected cas emulation code implementation.
153 # If the implementation provided by the 68060ISP is sufficient,
154 # then this routine simply re-enters the package through _isp_cas.
155 #
156 .global _060_real_cas
157 _060_real_cas:
158 bral _I_CALL_TOP+0x80+0x08
159
160 #
161 # _060_real_cas2():
162 #
163 # Entry point for the selected cas2 emulation code implementation.
164 # If the implementation provided by the 68060ISP is sufficient,
165 # then this routine simply re-enters the package through _isp_cas2.
166 #
167 .global _060_real_cas2
168 _060_real_cas2:
169 bral _I_CALL_TOP+0x80+0x10
170
171 #
172 # _060_lock_page():
173 #
174 # Entry point for the operating system's routine to "lock" a page
175 # from being paged out. This routine is needed by the cas/cas2
176 # algorithms so that no page faults occur within the "core" code
177 # region. Note: the routine must lock two pages if the operand
178 # spans two pages.
179 # NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
180 # SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
181 # Arguments:
182 # a0 = operand address
183 # d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
184 # d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
185 # Expected outputs:
186 # d0 = 0 -> success| non-zero -> failure
187 #
188 .global _060_real_lock_page
189 _060_real_lock_page:
190 clrl d0
191 rts
192
193 #
194 # _060_unlock_page():
195 #
196 # Entry point for the operating system's routine to "unlock" a
197 # page that has been "locked" previously with _real_lock_page.
198 # Note: the routine must unlock two pages if the operand spans
199 # two pages.
200 # Arguments:
201 # a0 = operand address
202 # d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
203 # d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
204 #
205 .global _060_real_unlock_page
206 _060_real_unlock_page:
207 clrl d0
208 rts
209
210 ############################################################################
211
212 ##################################
213 # (2) EXAMPLE PACKAGE ENTRY CODE #
214 ##################################
215
216 .global _060_isp_unimp
217 _060_isp_unimp:
218 bral _I_CALL_TOP+0x80+0x00
219
220 .global _060_isp_cas
221 _060_isp_cas:
222 bral _I_CALL_TOP+0x80+0x08
223
224 .global _060_isp_cas2
225 _060_isp_cas2:
226 bral _I_CALL_TOP+0x80+0x10
227
228 .global _060_isp_cas_finish
229 _060_isp_cas_finish:
230 bral _I_CALL_TOP+0x80+0x18
231
232 .global _060_isp_cas2_finish
233 _060_isp_cas2_finish:
234 bral _I_CALL_TOP+0x80+0x20
235
236 .global _060_isp_cas_inrange
237 _060_isp_cas_inrange:
238 bral _I_CALL_TOP+0x80+0x28
239
240 .global _060_isp_cas_terminate
241 _060_isp_cas_terminate:
242 bral _I_CALL_TOP+0x80+0x30
243
244 .global _060_isp_cas_restart
245 _060_isp_cas_restart:
246 bral _I_CALL_TOP+0x80+0x38
247
248 ############################################################################
249
250 ################################
251 # (3) EXAMPLE CALL-OUT SECTION #
252 ################################
253
254 # The size of this section MUST be 128 bytes!!!
255
256 .global _I_CALL_TOP
257 _I_CALL_TOP:
258 .long _060_real_chk-_I_CALL_TOP
259 .long _060_real_divbyzero-_I_CALL_TOP
260 .long _060_real_trace-_I_CALL_TOP
261 .long _060_real_access-_I_CALL_TOP
262 .long _060_isp_done-_I_CALL_TOP
263
264 .long _060_real_cas-_I_CALL_TOP
265 .long _060_real_cas2-_I_CALL_TOP
266 .long _060_real_lock_page-_I_CALL_TOP
267 .long _060_real_unlock_page-_I_CALL_TOP
268
269 .long 0x00000000,0x00000000,0x00000000,0x00000000
270 .long 0x00000000,0x00000000,0x00000000
271
272 .long _060_imem_read-_I_CALL_TOP
273 .long _060_dmem_read-_I_CALL_TOP
274 .long _060_dmem_write-_I_CALL_TOP
275 .long _060_imem_read_word-_I_CALL_TOP
276 .long _060_imem_read_long-_I_CALL_TOP
277 .long _060_dmem_read_byte-_I_CALL_TOP
278 .long _060_dmem_read_word-_I_CALL_TOP
279 .long _060_dmem_read_long-_I_CALL_TOP
280 .long _060_dmem_write_byte-_I_CALL_TOP
281 .long _060_dmem_write_word-_I_CALL_TOP
282 .long _060_dmem_write_long-_I_CALL_TOP
283
284 .long 0x00000000
285 .long 0x00000000,0x00000000,0x00000000,0x00000000
286
287 ############################################################################
288
289 # 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
290
291 .include "isp.S"
292