inetbsd.S revision 1.3 1 1.1 is #
2 1.3 is # $NetBSD: inetbsd.S,v 1.3 1997/07/28 19:01:13 is Exp $
3 1.1 is #
4 1.1 is #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 1.1 is # MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
6 1.1 is # M68000 Hi-Performance Microprocessor Division
7 1.1 is # M68060 Software Package Production Release
8 1.1 is #
9 1.1 is # M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
10 1.1 is # All rights reserved.
11 1.1 is #
12 1.1 is # THE SOFTWARE is provided on an "AS IS" basis and without warranty.
13 1.1 is # To the maximum extent permitted by applicable law,
14 1.1 is # MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
15 1.1 is # INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
16 1.1 is # FOR A PARTICULAR PURPOSE and any warranty against infringement with
17 1.1 is # regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
18 1.1 is # and any accompanying written materials.
19 1.1 is #
20 1.1 is # To the maximum extent permitted by applicable law,
21 1.1 is # IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
22 1.1 is # (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
23 1.1 is # BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
24 1.1 is # ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
25 1.1 is #
26 1.1 is # Motorola assumes no responsibility for the maintenance and support
27 1.1 is # of the SOFTWARE.
28 1.1 is #
29 1.1 is # You are hereby granted a copyright license to use, modify, and distribute the
30 1.1 is # SOFTWARE so long as this entire notice is retained without alteration
31 1.1 is # in any modified and/or redistributed versions, and that such modified
32 1.1 is # versions are clearly identified as such.
33 1.1 is # No licenses are granted by implication, estoppel or otherwise under any
34 1.1 is # patents or trademarks of Motorola, Inc.
35 1.1 is #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 1.1 is # Derived from:
37 1.1 is # iskeleton.s
38 1.1 is #
39 1.1 is # This file contains:
40 1.1 is # (1) example "Call-out"s
41 1.1 is # (2) example package entry code
42 1.1 is # (3) example "Call-out" table
43 1.1 is #
44 1.1 is
45 1.1 is
46 1.1 is #################################
47 1.1 is # (1) EXAMPLE CALL-OUTS #
48 1.1 is # #
49 1.1 is # _060_isp_done() #
50 1.1 is # _060_real_chk() #
51 1.1 is # _060_real_divbyzero() #
52 1.1 is # #
53 1.1 is # _060_real_cas() #
54 1.1 is # _060_real_cas2() #
55 1.1 is # _060_real_lock_page() #
56 1.1 is # _060_real_unlock_page() #
57 1.1 is #################################
58 1.1 is
59 1.1 is #
60 1.1 is # _060_isp_done():
61 1.1 is #
62 1.1 is # This is and example main exit point for the Unimplemented Integer
63 1.1 is # Instruction exception handler. For a normal exit, the
64 1.1 is # _isp_unimp() branches to here so that the operating system
65 1.1 is # can do any clean-up desired. The stack frame is the
66 1.1 is # Unimplemented Integer Instruction stack frame with
67 1.1 is # the PC pointing to the instruction following the instruction
68 1.1 is # just emulated.
69 1.1 is # To simply continue execution at the next instruction, just
70 1.1 is # do an "rte".
71 1.1 is #
72 1.1 is .global _060_isp_done
73 1.1 is _060_isp_done:
74 1.1 is rte
75 1.1 is
76 1.1 is #
77 1.1 is # _060_real_chk():
78 1.1 is #
79 1.1 is # This is an alternate exit point for the Unimplemented Integer
80 1.1 is # Instruction exception handler. If the instruction was a "chk2"
81 1.1 is # and the operand was out of bounds, then _isp_unimp() creates
82 1.1 is # a CHK exception stack frame from the Unimplemented Integer Instrcution
83 1.1 is # stack frame and branches to this routine.
84 1.1 is #
85 1.1 is .global _060_real_chk
86 1.1 is _060_real_chk:
87 1.1 is tstb sp@ |# is tracing enabled?
88 1.1 is bpls real_chk_end |# no
89 1.1 is
90 1.1 is #
91 1.1 is # CHK FRAME TRACE FRAME
92 1.1 is # ***************** *****************
93 1.1 is # * Current PC * * Current PC *
94 1.1 is # ***************** *****************
95 1.1 is # * 0x2 * 0x018 * * 0x2 * 0x024 *
96 1.1 is # ***************** *****************
97 1.1 is # * Next * * Next *
98 1.1 is # * PC * * PC *
99 1.1 is # ***************** *****************
100 1.1 is # * SR * * SR *
101 1.1 is # ***************** *****************
102 1.1 is #
103 1.1 is moveb #0x24,sp@(0x7) |# set trace vecno
104 1.1 is bral _060_real_trace
105 1.1 is
106 1.1 is real_chk_end:
107 1.1 is jmp _chkinst
108 1.1 is
109 1.1 is #
110 1.1 is # _060_real_divbyzero:
111 1.1 is #
112 1.1 is # This is an alternate exit point for the Unimplemented Integer
113 1.1 is # Instruction exception handler isp_unimp(). If the instruction is a 64-bit
114 1.1 is # integer divide where the source operand is a zero, then the _isp_unimp()
115 1.1 is # creates a Divide-by-zero exception stack frame from the Unimplemented
116 1.1 is # Integer Instruction stack frame and branches to this routine.
117 1.1 is #
118 1.1 is # Remember that a trace exception may be pending. The code below performs
119 1.1 is # no action associated with the "chk" exception. If tracing is enabled,
120 1.1 is # then it create a Trace exception stack frame from the "chk" exception
121 1.1 is # stack frame and branches to the _real_trace() entry point.
122 1.1 is #
123 1.1 is .global _060_real_divbyzero
124 1.1 is _060_real_divbyzero:
125 1.3 is tstb sp@ |# is tracing enabled?
126 1.3 is bpls real_divbyzero_end |# no
127 1.1 is
128 1.1 is #
129 1.1 is # DIVBYZERO FRAME TRACE FRAME
130 1.1 is # ***************** *****************
131 1.1 is # * Current PC * * Current PC *
132 1.1 is # ***************** *****************
133 1.1 is # * 0x2 * 0x014 * * 0x2 * 0x024 *
134 1.1 is # ***************** *****************
135 1.1 is # * Next * * Next *
136 1.1 is # * PC * * PC *
137 1.1 is # ***************** *****************
138 1.1 is # * SR * * SR *
139 1.1 is # ***************** *****************
140 1.1 is #
141 1.1 is moveb #0x24,sp@(0x7) |# set trace vecno
142 1.1 is bral _060_real_trace
143 1.1 is
144 1.1 is real_divbyzero_end:
145 1.1 is jmp _zerodiv
146 1.1 is
147 1.1 is ###########################
148 1.1 is
149 1.1 is #
150 1.1 is # _060_real_cas():
151 1.1 is #
152 1.1 is # Entry point for the selected cas emulation code implementation.
153 1.1 is # If the implementation provided by the 68060ISP is sufficient,
154 1.1 is # then this routine simply re-enters the package through _isp_cas.
155 1.1 is #
156 1.1 is .global _060_real_cas
157 1.1 is _060_real_cas:
158 1.1 is bral _I_CALL_TOP+0x80+0x08
159 1.1 is
160 1.1 is #
161 1.1 is # _060_real_cas2():
162 1.1 is #
163 1.1 is # Entry point for the selected cas2 emulation code implementation.
164 1.1 is # If the implementation provided by the 68060ISP is sufficient,
165 1.1 is # then this routine simply re-enters the package through _isp_cas2.
166 1.1 is #
167 1.1 is .global _060_real_cas2
168 1.1 is _060_real_cas2:
169 1.1 is bral _I_CALL_TOP+0x80+0x10
170 1.1 is
171 1.1 is #
172 1.1 is # _060_lock_page():
173 1.1 is #
174 1.1 is # Entry point for the operating system's routine to "lock" a page
175 1.1 is # from being paged out. This routine is needed by the cas/cas2
176 1.1 is # algorithms so that no page faults occur within the "core" code
177 1.1 is # region. Note: the routine must lock two pages if the operand
178 1.1 is # spans two pages.
179 1.1 is # NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
180 1.1 is # SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
181 1.1 is # Arguments:
182 1.1 is # a0 = operand address
183 1.1 is # d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
184 1.1 is # d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
185 1.1 is # Expected outputs:
186 1.1 is # d0 = 0 -> success| non-zero -> failure
187 1.1 is #
188 1.1 is .global _060_real_lock_page
189 1.1 is _060_real_lock_page:
190 1.1 is clrl d0
191 1.1 is rts
192 1.1 is
193 1.1 is #
194 1.1 is # _060_unlock_page():
195 1.1 is #
196 1.1 is # Entry point for the operating system's routine to "unlock" a
197 1.1 is # page that has been "locked" previously with _real_lock_page.
198 1.1 is # Note: the routine must unlock two pages if the operand spans
199 1.1 is # two pages.
200 1.1 is # Arguments:
201 1.1 is # a0 = operand address
202 1.1 is # d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
203 1.1 is # d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
204 1.1 is #
205 1.1 is .global _060_real_unlock_page
206 1.1 is _060_real_unlock_page:
207 1.1 is clrl d0
208 1.1 is rts
209 1.1 is
210 1.1 is ############################################################################
211 1.1 is
212 1.1 is ##################################
213 1.1 is # (2) EXAMPLE PACKAGE ENTRY CODE #
214 1.1 is ##################################
215 1.1 is
216 1.1 is .global _060_isp_unimp
217 1.1 is _060_isp_unimp:
218 1.1 is bral _I_CALL_TOP+0x80+0x00
219 1.1 is
220 1.1 is .global _060_isp_cas
221 1.1 is _060_isp_cas:
222 1.1 is bral _I_CALL_TOP+0x80+0x08
223 1.1 is
224 1.1 is .global _060_isp_cas2
225 1.1 is _060_isp_cas2:
226 1.1 is bral _I_CALL_TOP+0x80+0x10
227 1.1 is
228 1.1 is .global _060_isp_cas_finish
229 1.1 is _060_isp_cas_finish:
230 1.1 is bral _I_CALL_TOP+0x80+0x18
231 1.1 is
232 1.1 is .global _060_isp_cas2_finish
233 1.1 is _060_isp_cas2_finish:
234 1.1 is bral _I_CALL_TOP+0x80+0x20
235 1.1 is
236 1.1 is .global _060_isp_cas_inrange
237 1.1 is _060_isp_cas_inrange:
238 1.1 is bral _I_CALL_TOP+0x80+0x28
239 1.1 is
240 1.1 is .global _060_isp_cas_terminate
241 1.1 is _060_isp_cas_terminate:
242 1.1 is bral _I_CALL_TOP+0x80+0x30
243 1.1 is
244 1.1 is .global _060_isp_cas_restart
245 1.1 is _060_isp_cas_restart:
246 1.1 is bral _I_CALL_TOP+0x80+0x38
247 1.1 is
248 1.1 is ############################################################################
249 1.1 is
250 1.1 is ################################
251 1.1 is # (3) EXAMPLE CALL-OUT SECTION #
252 1.1 is ################################
253 1.1 is
254 1.1 is # The size of this section MUST be 128 bytes!!!
255 1.1 is
256 1.1 is .global _I_CALL_TOP
257 1.1 is _I_CALL_TOP:
258 1.1 is .long _060_real_chk-_I_CALL_TOP
259 1.1 is .long _060_real_divbyzero-_I_CALL_TOP
260 1.1 is .long _060_real_trace-_I_CALL_TOP
261 1.1 is .long _060_real_access-_I_CALL_TOP
262 1.1 is .long _060_isp_done-_I_CALL_TOP
263 1.1 is
264 1.1 is .long _060_real_cas-_I_CALL_TOP
265 1.1 is .long _060_real_cas2-_I_CALL_TOP
266 1.1 is .long _060_real_lock_page-_I_CALL_TOP
267 1.1 is .long _060_real_unlock_page-_I_CALL_TOP
268 1.1 is
269 1.1 is .long 0x00000000,0x00000000,0x00000000,0x00000000
270 1.1 is .long 0x00000000,0x00000000,0x00000000
271 1.1 is
272 1.1 is .long _060_imem_read-_I_CALL_TOP
273 1.1 is .long _060_dmem_read-_I_CALL_TOP
274 1.1 is .long _060_dmem_write-_I_CALL_TOP
275 1.1 is .long _060_imem_read_word-_I_CALL_TOP
276 1.1 is .long _060_imem_read_long-_I_CALL_TOP
277 1.1 is .long _060_dmem_read_byte-_I_CALL_TOP
278 1.1 is .long _060_dmem_read_word-_I_CALL_TOP
279 1.1 is .long _060_dmem_read_long-_I_CALL_TOP
280 1.1 is .long _060_dmem_write_byte-_I_CALL_TOP
281 1.1 is .long _060_dmem_write_word-_I_CALL_TOP
282 1.1 is .long _060_dmem_write_long-_I_CALL_TOP
283 1.1 is
284 1.1 is .long 0x00000000
285 1.1 is .long 0x00000000,0x00000000,0x00000000,0x00000000
286 1.1 is
287 1.1 is ############################################################################
288 1.1 is
289 1.1 is # 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
290 1.1 is
291 1.2 is .include "isp.S"
292