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