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