1/* $NetBSD: libstubs.s,v 1.11 2023/03/25 20:14:26 abs Exp $ */
2
3/*-
4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Ignatios Souvatzis.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32/*
33 * Exec.library functions.
34 */
35#include <machine/asm.h>
36          .comm _C_LABEL(SysBase),4
37
38ENTRY_NOPROFILE(OpenLibrary)
39          movl      %a6,%sp@-
40          movl      %pc@(_C_LABEL(SysBase):w),%a6
41          movl      %sp@(8),%a1
42          movl      %sp@(12),%d0
43          jsr       %a6@(-0x228)
44          movl      %sp@+,%a6
45          movl      %d0,%a0                       | Comply with ELF ABI
46          rts
47
48#ifdef _PRIMARY_BOOT
49ENTRY_NOPROFILE(CloseLibrary)
50          movl      %a6,%sp@-
51          movl      %pc@(_C_LABEL(SysBase):w),%a6
52          movl      %sp@(8),%a1
53          jsr       %a6@(-0x19e)
54          movl      %sp@+,%a6
55          rts
56#endif
57ENTRY_NOPROFILE(CreateIORequest)
58          movl      %a6,%sp@-
59          movl      %pc@(_C_LABEL(SysBase):w),%a6
60          movl      %sp@(8),%a0
61          movl      %sp@(12),%d0
62          jsr       %a6@(-0x28e)
63          movl      %sp@+,%a6
64          movl      %d0,%a0                       | Comply with ELF ABI
65          rts
66
67ENTRY_NOPROFILE(CreateMsgPort)
68          movl      %a6,%sp@-
69          movl      %pc@(_C_LABEL(SysBase):w),%a6
70          jsr       %a6@(-0x29a)
71          movl      %sp@+,%a6
72          movl      %d0,%a0                       | Comply with ELF ABI
73          rts
74
75#ifdef _PRIMARY_BOOT
76ENTRY_NOPROFILE(DeleteMsgPort)
77          movl      %a6,%sp@-
78          movl      %pc@(_C_LABEL(SysBase):w),%a6
79          movl      %sp@(8),%a0
80          jsr       %a6@(-0x2a0)
81          movl      %sp@+,%a6
82          rts
83
84ENTRY_NOPROFILE(DeleteIORequest)
85          movl      %a6,%sp@-
86          movl      %pc@(_C_LABEL(SysBase):w),%a6
87          movl      %sp@(8),%a0
88          jsr       %a6@(-0x294)
89          movl      %sp@+,%a6
90          rts
91#endif
92
93ENTRY_NOPROFILE(OpenDevice)
94          movl      %a6,%sp@-
95          movl      %pc@(_C_LABEL(SysBase):w),%a6
96          movl      %sp@(8),%a0
97          movl      %sp@(12),%d0
98          movl      %sp@(16),%a1
99          movl      %sp@(20),%d1
100          jsr       %a6@(-0x1bc)
101          movl      %sp@+,%a6
102          rts
103
104#ifdef _PRIMARY_BOOT
105ENTRY_NOPROFILE(CloseDevice)
106          movl      %a6,%sp@-
107          movl      %pc@(_C_LABEL(SysBase):w),%a6
108          movl      %sp@(8),%a1
109          jsr       %a6@(-0x1c2)
110          movl      %sp@+,%a6
111          rts
112#endif
113
114ENTRY_NOPROFILE(DoIO)
115          movl      %a6,%sp@-
116          movl      %pc@(_C_LABEL(SysBase):w),%a6
117          movl      %sp@(8),%a1
118          jsr       %a6@(-0x1c8)
119          movl      %sp@+,%a6
120          rts
121#ifdef nomore
122ENTRY_NOPROFILE(CheckIO)
123          movl      %a6,%sp@-
124          movl      %pc@(_C_LABEL(SysBase):w),%a6
125          movl      %sp@(8),%a1
126          jsr       %a6@(-0x1d4)
127          movl      %sp@+,%a6
128          movl      %d0,%a0                       | Comply with ELF ABI
129          rts
130#endif
131ENTRY_NOPROFILE(WaitIO)
132          movl      %a6,%sp@-
133          movl      %pc@(_C_LABEL(SysBase):w),%a6
134          movl      %sp@(8),%a1
135          jsr       %a6@(-0x1da)
136          movl      %sp@+,%a6
137          rts
138
139ENTRY_NOPROFILE(SendIO)
140          movl      %a6,%sp@-
141          movl      %pc@(_C_LABEL(SysBase):w),%a6
142          movl      %sp@(8),%a1
143          jsr       %a6@(-0x1ce)
144          movl      %sp@+,%a6
145          rts
146
147ENTRY_NOPROFILE(AbortIO)
148          movl      %a6,%sp@-
149          movl      %pc@(_C_LABEL(SysBase):w),%a6
150          movl      %sp@(8),%a1
151          jsr       %a6@(-0x1e0)
152          movl      %sp@+,%a6
153          rts
154
155ENTRY_NOPROFILE(WaitPort)
156          movl      %a6,%sp@-
157          movl      %pc@(_C_LABEL(SysBase):w),%a6
158          movl      %sp@(8),%a0
159          jsr       %a6@(-0x180)
160          movl      %sp@+,%a6
161          movl      %d0,%a0                       | Comply with ELF ABI
162          rts
163
164ENTRY_NOPROFILE(RawIOInit)
165          movl      %a6,%sp@-
166          movl      %pc@(_C_LABEL(SysBase):w),%a6
167          jsr       %a6@(-0x1f8)
168          movl      %sp@+,%a6
169          rts
170ENTRY_NOPROFILE(RawPutChar)
171          movl      %a6,%sp@-
172          movl      %pc@(_C_LABEL(SysBase):w),%a6
173          movl      %sp@(8),%d0
174          jsr       %a6@(-0x204)
175          movl      %sp@+,%a6
176          rts
177ENTRY_NOPROFILE(RawMayGetChar)
178          movl      %a6,%sp@-
179          movl      %pc@(_C_LABEL(SysBase):w),%a6
180          jsr       %a6@(-0x1fe)
181          movl      %sp@+,%a6
182          rts
183
184#ifndef DOINLINES
185ENTRY_NOPROFILE(CacheClearU)
186          movl      %a6,%sp@-
187          movl      %pc@(_C_LABEL(SysBase):w),%a6
188          jsr       %a6@(-0x27c)
189          movl      %sp@+,%a6
190          rts
191#endif
192ENTRY_NOPROFILE(CachePreDMA)
193          movl      %a6,%sp@-
194          movl      %pc@(_C_LABEL(SysBase):w),%a6
195          movl      %sp@(8),%a0
196          movl      %sp@(12),%a1
197          movl      %sp@(16),%d0
198          jsr       %a6@(-0x2fa)
199          movl      %sp@+,%a6
200          rts
201
202ENTRY_NOPROFILE(FindResident)
203          movl      %a6,%sp@-
204          movl      %pc@(_C_LABEL(SysBase):w),%a6
205          movl      %sp@(8),%a1
206          jsr       %a6@(-0x60)
207          movl      %sp@+,%a6
208          movl      %d0,%a0                       | Comply with ELF ABI
209          rts
210
211ENTRY_NOPROFILE(InitResident)
212          movl      %a6,%sp@-
213          movl      %pc@(_C_LABEL(SysBase):w),%a6
214          movl      %sp@(8),%a1
215          movl      %sp@(12),%d1
216          jsr       %a6@(-0x66)
217          movl      %sp@+,%a6
218          movl      %d0,%a0                       | Comply with ELF ABI
219          rts
220
221ENTRY_NOPROFILE(OpenResource)
222          movl      %a6,%sp@-
223          movl      %pc@(_C_LABEL(SysBase):w),%a6
224          movl      %sp@(8),%a1
225          jsr       %a6@(-0x1f2)
226          movl      %sp@+,%a6
227          movl      %d0,%a0                       | Comply with ELF ABI
228          rts
229#ifdef notyet
230ENTRY_NOPROFILE(Forbid)
231          movl      %a6,%sp@-
232          movl      %pc@(_C_LABEL(SysBase):W),%a6
233          jsr       %a6@(-0x84)
234          movl      %sp@+,%a6
235          rts
236
237ENTRY_NOPROFILE(Permit)
238          movl      %a6,%sp@-
239          movl      %pc@(_C_LABEL(SysBase):W),%a6
240          jsr       %a6@(-0x8a)
241          movl      %sp@+,%a6
242          rts
243#endif
244
245/*
246 * Intuition.library functions.
247 */
248
249          .comm _C_LABEL(IntuitionBase),4
250
251ENTRY_NOPROFILE(OpenScreenTagList)
252          movl      %a6,%sp@-
253          movl      %pc@(_C_LABEL(IntuitionBase):w),%a6
254          movl      %sp@(8),%a0
255          movl      %sp@(12),%a1
256          jsr       %a6@(-0x264)
257          movl      %sp@+,%a6
258          movl      %d0,%a0                       | Comply with ELF ABI
259          rts
260
261#ifdef _PRIMARY_BOOT
262ENTRY_NOPROFILE(CloseScreen)
263          movl      %a6,%sp@-
264          movl      %pc@(_C_LABEL(IntuitionBase):w),%a6
265          movl      %sp@(8),%a0
266          jsr       %a6@(-0x42)
267          movl      %sp@+,%a6
268          rts
269#endif
270
271ENTRY_NOPROFILE(OpenWindowTagList)
272          movl      %a6,%sp@-
273          movl      %pc@(_C_LABEL(IntuitionBase):w),%a6
274          movl      %sp@(8),%a0
275          movl      %sp@(12),%a1
276          jsr       %a6@(-0x25e)
277          movl      %sp@+,%a6
278          movl      %d0,%a0                       | Comply with ELF ABI
279          rts
280
281#ifdef _PRIMARY_BOOT
282ENTRY_NOPROFILE(CloseWindow)
283          movl      %a6,%sp@-
284          movl      %pc@(_C_LABEL(IntuitionBase):w),%a6
285          movl      %sp@(8),%a0
286          jsr       %a6@(-0x48)
287          movl      %sp@+,%a6
288          rts
289#endif
290#ifdef nomore
291ENTRY_NOPROFILE(mytime)
292          movl      %a6,%sp@-
293          movl      %pc@(_C_LABEL(IntuitionBase):w),%a6
294          subql     #8,%sp
295          movl      %sp,%a0
296          lea       %sp@(4),%a1
297          jsr       %a6@(-0x54)
298          movl      %sp@+,%d0
299          addql     #4,%sp
300          movl      %sp@+,%a6
301          rts
302#endif
303          .comm _C_LABEL(ExpansionBase),4
304ENTRY_NOPROFILE(FindConfigDev)
305          movl      %a6,%sp@-
306          movl      %pc@(_C_LABEL(ExpansionBase):w),%a6
307          movl      %sp@(8),%a0
308          movl      %sp@(12),%d0
309          movl      %sp@(16),%d1
310          jsr       %a6@(-0x48)
311          movl      %sp@+,%a6
312          movl      %d0,%a0                       | Comply with ELF ABI
313          rts
314