aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/hpux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/parisc/hpux
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/parisc/hpux')
-rw-r--r--arch/parisc/hpux/Makefile5
-rw-r--r--arch/parisc/hpux/entry_hpux.S547
-rw-r--r--arch/parisc/hpux/fs.c199
-rw-r--r--arch/parisc/hpux/gate.S116
-rw-r--r--arch/parisc/hpux/ioctl.c73
-rw-r--r--arch/parisc/hpux/sys_hpux.c985
-rw-r--r--arch/parisc/hpux/wrappers.S257
7 files changed, 2182 insertions, 0 deletions
diff --git a/arch/parisc/hpux/Makefile b/arch/parisc/hpux/Makefile
new file mode 100644
index 000000000000..1048fb69f06d
--- /dev/null
+++ b/arch/parisc/hpux/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for HPUX emulation
3#
4
5obj-y := entry_hpux.o gate.o wrappers.o fs.o ioctl.o sys_hpux.o
diff --git a/arch/parisc/hpux/entry_hpux.S b/arch/parisc/hpux/entry_hpux.S
new file mode 100644
index 000000000000..fa9bf38787e7
--- /dev/null
+++ b/arch/parisc/hpux/entry_hpux.S
@@ -0,0 +1,547 @@
1/* syscall table for HPUX specific syscalls
2 *
3 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
4 * Copyright (C) 1999 Matthew Wilcox <willy at debian . org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/sys.h>
22#include <linux/linkage.h>
23#include <asm/unistd.h>
24
25 .text
26
27#define ENTRY_NAME(_name_) .word _name_
28
29 .align 4
30 .export hpux_call_table
31 .import hpux_unimplemented_wrapper
32hpux_call_table:
33 ENTRY_NAME(sys_ni_syscall) /* 0 */
34 ENTRY_NAME(sys_exit)
35 ENTRY_NAME(hpux_fork_wrapper)
36 ENTRY_NAME(sys_read)
37 ENTRY_NAME(sys_write)
38 ENTRY_NAME(sys_open) /* 5 */
39 ENTRY_NAME(sys_close)
40 ENTRY_NAME(hpux_wait)
41 ENTRY_NAME(sys_creat)
42 ENTRY_NAME(sys_link)
43 ENTRY_NAME(sys_unlink) /* 10 */
44 ENTRY_NAME(hpux_execv_wrapper)
45 ENTRY_NAME(sys_chdir)
46 ENTRY_NAME(sys_time)
47 ENTRY_NAME(sys_mknod)
48 ENTRY_NAME(sys_chmod) /* 15 */
49 ENTRY_NAME(sys_chown)
50 ENTRY_NAME(hpux_brk)
51 ENTRY_NAME(hpux_unimplemented_wrapper)
52 ENTRY_NAME(sys_lseek)
53 ENTRY_NAME(sys_getpid) /* 20 */
54 ENTRY_NAME(hpux_mount)
55 ENTRY_NAME(sys_oldumount)
56 ENTRY_NAME(sys_setuid)
57 ENTRY_NAME(sys_getuid)
58 ENTRY_NAME(sys_stime) /* 25 */
59 ENTRY_NAME(hpux_ptrace)
60 ENTRY_NAME(sys_alarm)
61 ENTRY_NAME(hpux_unimplemented_wrapper)
62 ENTRY_NAME(sys_pause)
63 ENTRY_NAME(sys_utime) /* 30 */
64 ENTRY_NAME(hpux_unimplemented_wrapper)
65 ENTRY_NAME(hpux_unimplemented_wrapper)
66 ENTRY_NAME(sys_access)
67 ENTRY_NAME(hpux_nice)
68 ENTRY_NAME(hpux_unimplemented_wrapper) /* 35 */
69 ENTRY_NAME(sys_sync)
70 ENTRY_NAME(hpux_unimplemented_wrapper)
71 ENTRY_NAME(sys_newstat)
72 ENTRY_NAME(hpux_setpgrp3)
73 ENTRY_NAME(sys_newlstat) /* 40 */
74 ENTRY_NAME(sys_dup)
75 ENTRY_NAME(hpux_pipe_wrapper)
76 ENTRY_NAME(sys_times)
77 ENTRY_NAME(hpux_unimplemented_wrapper)
78 ENTRY_NAME(hpux_unimplemented_wrapper) /* 45 */
79 ENTRY_NAME(sys_setgid)
80 ENTRY_NAME(sys_getgid)
81 ENTRY_NAME(hpux_unimplemented_wrapper)
82 ENTRY_NAME(hpux_unimplemented_wrapper)
83 ENTRY_NAME(hpux_unimplemented_wrapper) /* 50 */
84 ENTRY_NAME(hpux_unimplemented_wrapper)
85 ENTRY_NAME(hpux_unimplemented_wrapper)
86 ENTRY_NAME(hpux_unimplemented_wrapper)
87 ENTRY_NAME(hpux_ioctl)
88 ENTRY_NAME(hpux_unimplemented_wrapper) /* 55 */
89 ENTRY_NAME(sys_symlink)
90 ENTRY_NAME(hpux_utssys)
91 ENTRY_NAME(sys_readlink)
92 ENTRY_NAME(hpux_execve_wrapper)
93 ENTRY_NAME(sys_umask) /* 60 */
94 ENTRY_NAME(sys_chroot)
95 ENTRY_NAME(sys_fcntl)
96 ENTRY_NAME(hpux_unimplemented_wrapper)
97 ENTRY_NAME(hpux_unimplemented_wrapper)
98 ENTRY_NAME(hpux_unimplemented_wrapper) /* 65 */
99 ENTRY_NAME(hpux_unimplemented_wrapper)
100 ENTRY_NAME(hpux_unimplemented_wrapper)
101 ENTRY_NAME(hpux_unimplemented_wrapper)
102 ENTRY_NAME(hpux_sbrk)
103 ENTRY_NAME(hpux_unimplemented_wrapper) /* 70 */
104 ENTRY_NAME(sys_mmap)
105 ENTRY_NAME(hpux_unimplemented_wrapper)
106 ENTRY_NAME(hpux_unimplemented_wrapper)
107 ENTRY_NAME(hpux_unimplemented_wrapper)
108 ENTRY_NAME(hpux_unimplemented_wrapper) /* 75 */
109 ENTRY_NAME(hpux_unimplemented_wrapper)
110 ENTRY_NAME(hpux_unimplemented_wrapper)
111 ENTRY_NAME(hpux_unimplemented_wrapper)
112 ENTRY_NAME(hpux_unimplemented_wrapper)
113 ENTRY_NAME(hpux_unimplemented_wrapper) /* 80 */
114 ENTRY_NAME(sys_getpgid)
115 ENTRY_NAME(sys_setpgid)
116 ENTRY_NAME(sys_setitimer)
117 ENTRY_NAME(hpux_unimplemented_wrapper)
118 ENTRY_NAME(hpux_unimplemented_wrapper) /* 85 */
119 ENTRY_NAME(sys_getitimer)
120 ENTRY_NAME(hpux_unimplemented_wrapper)
121 ENTRY_NAME(hpux_unimplemented_wrapper)
122 ENTRY_NAME(hpux_unimplemented_wrapper)
123 ENTRY_NAME(sys_dup2) /* 90 */
124 ENTRY_NAME(hpux_unimplemented_wrapper)
125 ENTRY_NAME(sys_newfstat)
126 ENTRY_NAME(sys_select)
127 ENTRY_NAME(hpux_unimplemented_wrapper)
128 ENTRY_NAME(hpux_unimplemented_wrapper) /* 95 */
129 ENTRY_NAME(hpux_unimplemented_wrapper)
130 ENTRY_NAME(hpux_unimplemented_wrapper)
131 ENTRY_NAME(hpux_unimplemented_wrapper)
132 ENTRY_NAME(hpux_unimplemented_wrapper)
133 ENTRY_NAME(hpux_unimplemented_wrapper) /* 100 */
134 ENTRY_NAME(hpux_unimplemented_wrapper)
135 ENTRY_NAME(hpux_unimplemented_wrapper)
136 ENTRY_NAME(hpux_unimplemented_wrapper)
137 ENTRY_NAME(hpux_unimplemented_wrapper)
138 ENTRY_NAME(hpux_unimplemented_wrapper) /* 105 */
139 ENTRY_NAME(hpux_unimplemented_wrapper)
140 ENTRY_NAME(hpux_unimplemented_wrapper)
141 ENTRY_NAME(hpux_unimplemented_wrapper)
142 ENTRY_NAME(hpux_unimplemented_wrapper)
143 ENTRY_NAME(hpux_unimplemented_wrapper) /* 110 */
144 ENTRY_NAME(hpux_unimplemented_wrapper)
145 ENTRY_NAME(hpux_unimplemented_wrapper)
146 ENTRY_NAME(hpux_unimplemented_wrapper)
147 ENTRY_NAME(hpux_unimplemented_wrapper)
148 ENTRY_NAME(hpux_unimplemented_wrapper) /* 115 */
149 ENTRY_NAME(sys_gettimeofday)
150 ENTRY_NAME(hpux_unimplemented_wrapper)
151 ENTRY_NAME(hpux_unimplemented_wrapper)
152 ENTRY_NAME(hpux_unimplemented_wrapper)
153 ENTRY_NAME(hpux_unimplemented_wrapper) /* 120 */
154 ENTRY_NAME(hpux_unimplemented_wrapper)
155 ENTRY_NAME(hpux_unimplemented_wrapper)
156 ENTRY_NAME(sys_fchown)
157 ENTRY_NAME(sys_fchmod)
158 ENTRY_NAME(hpux_unimplemented_wrapper) /* 125 */
159 ENTRY_NAME(hpux_unimplemented_wrapper)
160 ENTRY_NAME(hpux_unimplemented_wrapper)
161 ENTRY_NAME(sys_rename)
162 ENTRY_NAME(hpux_unimplemented_wrapper)
163 ENTRY_NAME(hpux_unimplemented_wrapper) /* 130 */
164 ENTRY_NAME(hpux_unimplemented_wrapper)
165 ENTRY_NAME(hpux_sysconf)
166 ENTRY_NAME(hpux_unimplemented_wrapper)
167 ENTRY_NAME(hpux_unimplemented_wrapper)
168 ENTRY_NAME(hpux_unimplemented_wrapper) /* 135 */
169 ENTRY_NAME(sys_mkdir)
170 ENTRY_NAME(sys_rmdir)
171 ENTRY_NAME(hpux_unimplemented_wrapper)
172 ENTRY_NAME(hpux_unimplemented_wrapper)
173 ENTRY_NAME(hpux_unimplemented_wrapper) /* 140 */
174 ENTRY_NAME(hpux_unimplemented_wrapper)
175 ENTRY_NAME(hpux_unimplemented_wrapper)
176 ENTRY_NAME(hpux_unimplemented_wrapper)
177 ENTRY_NAME(sys_getrlimit)
178 ENTRY_NAME(sys_setrlimit) /* 145 */
179 ENTRY_NAME(hpux_unimplemented_wrapper)
180 ENTRY_NAME(hpux_unimplemented_wrapper)
181 ENTRY_NAME(hpux_unimplemented_wrapper)
182 ENTRY_NAME(hpux_unimplemented_wrapper)
183 ENTRY_NAME(hpux_unimplemented_wrapper) /* 150 */
184 ENTRY_NAME(hpux_unimplemented_wrapper)
185 ENTRY_NAME(hpux_unimplemented_wrapper)
186 ENTRY_NAME(hpux_unimplemented_wrapper)
187 ENTRY_NAME(hpux_unimplemented_wrapper)
188 ENTRY_NAME(hpux_lockf) /* 155 */
189 ENTRY_NAME(hpux_unimplemented_wrapper)
190 ENTRY_NAME(hpux_unimplemented_wrapper)
191 ENTRY_NAME(hpux_unimplemented_wrapper)
192 ENTRY_NAME(hpux_unimplemented_wrapper)
193 ENTRY_NAME(hpux_unimplemented_wrapper) /* 160 */
194 ENTRY_NAME(hpux_unimplemented_wrapper)
195 ENTRY_NAME(hpux_unimplemented_wrapper)
196 ENTRY_NAME(hpux_unimplemented_wrapper)
197 ENTRY_NAME(hpux_unimplemented_wrapper)
198 ENTRY_NAME(hpux_unimplemented_wrapper) /* 165 */
199 ENTRY_NAME(hpux_unimplemented_wrapper)
200 ENTRY_NAME(hpux_unimplemented_wrapper)
201 ENTRY_NAME(hpux_unimplemented_wrapper)
202 ENTRY_NAME(hpux_unimplemented_wrapper)
203 ENTRY_NAME(hpux_unimplemented_wrapper) /* 170 */
204 ENTRY_NAME(hpux_unimplemented_wrapper)
205 ENTRY_NAME(hpux_unimplemented_wrapper)
206 ENTRY_NAME(hpux_unimplemented_wrapper)
207 ENTRY_NAME(hpux_unimplemented_wrapper)
208 ENTRY_NAME(hpux_unimplemented_wrapper) /* 175 */
209 ENTRY_NAME(hpux_unimplemented_wrapper)
210 ENTRY_NAME(hpux_unimplemented_wrapper)
211 ENTRY_NAME(hpux_unimplemented_wrapper)
212 ENTRY_NAME(hpux_unimplemented_wrapper)
213 ENTRY_NAME(hpux_unimplemented_wrapper) /* 180 */
214 ENTRY_NAME(hpux_unimplemented_wrapper)
215 ENTRY_NAME(hpux_unimplemented_wrapper)
216 ENTRY_NAME(hpux_unimplemented_wrapper)
217 ENTRY_NAME(hpux_unimplemented_wrapper)
218 ENTRY_NAME(sys_sigprocmask) /* 185 */
219 ENTRY_NAME(hpux_unimplemented_wrapper)
220 ENTRY_NAME(hpux_unimplemented_wrapper)
221 ENTRY_NAME(hpux_unimplemented_wrapper)
222 ENTRY_NAME(hpux_unimplemented_wrapper)
223 ENTRY_NAME(hpux_unimplemented_wrapper) /* 190 */
224 ENTRY_NAME(hpux_unimplemented_wrapper)
225 ENTRY_NAME(hpux_getdomainname)
226 ENTRY_NAME(hpux_unimplemented_wrapper)
227 ENTRY_NAME(hpux_unimplemented_wrapper)
228 ENTRY_NAME(hpux_unimplemented_wrapper) /* 195 */
229 ENTRY_NAME(hpux_statfs)
230 ENTRY_NAME(hpux_fstatfs)
231 ENTRY_NAME(hpux_unimplemented_wrapper)
232 ENTRY_NAME(hpux_unimplemented_wrapper)
233 ENTRY_NAME(sys_waitpid) /* 200 */
234 ENTRY_NAME(hpux_unimplemented_wrapper)
235 ENTRY_NAME(hpux_unimplemented_wrapper)
236 ENTRY_NAME(hpux_unimplemented_wrapper)
237 ENTRY_NAME(hpux_unimplemented_wrapper)
238 ENTRY_NAME(hpux_unimplemented_wrapper) /* 205 */
239 ENTRY_NAME(hpux_unimplemented_wrapper)
240 ENTRY_NAME(hpux_unimplemented_wrapper)
241 ENTRY_NAME(hpux_unimplemented_wrapper)
242 ENTRY_NAME(hpux_unimplemented_wrapper)
243 ENTRY_NAME(hpux_unimplemented_wrapper) /* 210 */
244 ENTRY_NAME(hpux_unimplemented_wrapper)
245 ENTRY_NAME(hpux_unimplemented_wrapper)
246 ENTRY_NAME(hpux_unimplemented_wrapper)
247 ENTRY_NAME(hpux_unimplemented_wrapper)
248 ENTRY_NAME(hpux_unimplemented_wrapper) /* 215 */
249 ENTRY_NAME(hpux_unimplemented_wrapper)
250 ENTRY_NAME(hpux_unimplemented_wrapper)
251 ENTRY_NAME(hpux_unimplemented_wrapper)
252 ENTRY_NAME(hpux_unimplemented_wrapper)
253 ENTRY_NAME(hpux_unimplemented_wrapper) /* 220 */
254 ENTRY_NAME(hpux_unimplemented_wrapper)
255 ENTRY_NAME(hpux_unimplemented_wrapper)
256 ENTRY_NAME(hpux_unimplemented_wrapper)
257 ENTRY_NAME(hpux_unimplemented_wrapper)
258 ENTRY_NAME(hpux_unimplemented_wrapper) /* 225 */
259 ENTRY_NAME(hpux_unimplemented_wrapper)
260 ENTRY_NAME(hpux_unimplemented_wrapper)
261 ENTRY_NAME(hpux_unimplemented_wrapper)
262 ENTRY_NAME(hpux_unimplemented_wrapper)
263 ENTRY_NAME(hpux_unimplemented_wrapper) /* 230 */
264 ENTRY_NAME(hpux_unimplemented_wrapper)
265 ENTRY_NAME(hpux_unimplemented_wrapper)
266 ENTRY_NAME(hpux_unimplemented_wrapper)
267 ENTRY_NAME(hpux_unimplemented_wrapper)
268 ENTRY_NAME(hpux_unimplemented_wrapper) /* 235 */
269 ENTRY_NAME(hpux_unimplemented_wrapper)
270 ENTRY_NAME(hpux_unimplemented_wrapper)
271 ENTRY_NAME(hpux_unimplemented_wrapper)
272 ENTRY_NAME(hpux_unimplemented_wrapper)
273 ENTRY_NAME(hpux_unimplemented_wrapper) /* 240 */
274 ENTRY_NAME(hpux_unimplemented_wrapper)
275 ENTRY_NAME(hpux_unimplemented_wrapper)
276 ENTRY_NAME(hpux_unimplemented_wrapper)
277 ENTRY_NAME(hpux_unimplemented_wrapper)
278 ENTRY_NAME(hpux_unimplemented_wrapper) /* 245 */
279 ENTRY_NAME(hpux_unimplemented_wrapper)
280 ENTRY_NAME(hpux_unimplemented_wrapper)
281 ENTRY_NAME(hpux_unimplemented_wrapper)
282 ENTRY_NAME(hpux_unimplemented_wrapper)
283 ENTRY_NAME(hpux_unimplemented_wrapper) /* 250 */
284 ENTRY_NAME(hpux_unimplemented_wrapper)
285 ENTRY_NAME(hpux_unimplemented_wrapper)
286 ENTRY_NAME(hpux_unimplemented_wrapper)
287 ENTRY_NAME(hpux_unimplemented_wrapper)
288 ENTRY_NAME(hpux_unimplemented_wrapper) /* 255 */
289 ENTRY_NAME(hpux_unimplemented_wrapper)
290 ENTRY_NAME(hpux_unimplemented_wrapper)
291 ENTRY_NAME(hpux_unimplemented_wrapper)
292 ENTRY_NAME(hpux_unimplemented_wrapper)
293 ENTRY_NAME(hpux_unimplemented_wrapper) /* 260 */
294 ENTRY_NAME(hpux_unimplemented_wrapper)
295 ENTRY_NAME(hpux_unimplemented_wrapper)
296 ENTRY_NAME(hpux_unimplemented_wrapper)
297 ENTRY_NAME(hpux_unimplemented_wrapper)
298 ENTRY_NAME(hpux_unimplemented_wrapper) /* 265 */
299 ENTRY_NAME(hpux_unimplemented_wrapper)
300 ENTRY_NAME(hpux_unimplemented_wrapper)
301 ENTRY_NAME(hpux_unimplemented_wrapper)
302 ENTRY_NAME(hpux_unimplemented_wrapper)
303 ENTRY_NAME(hpux_unimplemented_wrapper) /* 270 */
304 ENTRY_NAME(hpux_unimplemented_wrapper)
305 ENTRY_NAME(sys_fchdir)
306 ENTRY_NAME(hpux_unimplemented_wrapper)
307 ENTRY_NAME(hpux_unimplemented_wrapper)
308 ENTRY_NAME(sys_accept) /* 275 */
309 ENTRY_NAME(sys_bind)
310 ENTRY_NAME(sys_connect)
311 ENTRY_NAME(sys_getpeername)
312 ENTRY_NAME(sys_getsockname)
313 ENTRY_NAME(sys_getsockopt) /* 280 */
314 ENTRY_NAME(sys_listen)
315 ENTRY_NAME(sys_recv)
316 ENTRY_NAME(sys_recvfrom)
317 ENTRY_NAME(sys_recvmsg)
318 ENTRY_NAME(sys_send) /* 285 */
319 ENTRY_NAME(sys_sendmsg)
320 ENTRY_NAME(sys_sendto)
321 ENTRY_NAME(sys_setsockopt)
322 ENTRY_NAME(sys_shutdown)
323 ENTRY_NAME(sys_socket) /* 290 */
324 ENTRY_NAME(hpux_unimplemented_wrapper)
325 ENTRY_NAME(hpux_unimplemented_wrapper)
326 ENTRY_NAME(hpux_unimplemented_wrapper)
327 ENTRY_NAME(hpux_unimplemented_wrapper)
328 ENTRY_NAME(hpux_unimplemented_wrapper) /* 295 */
329 ENTRY_NAME(hpux_unimplemented_wrapper)
330 ENTRY_NAME(hpux_unimplemented_wrapper)
331 ENTRY_NAME(hpux_unimplemented_wrapper)
332 ENTRY_NAME(hpux_unimplemented_wrapper)
333 ENTRY_NAME(hpux_unimplemented_wrapper) /* 300 */
334 ENTRY_NAME(hpux_unimplemented_wrapper)
335 ENTRY_NAME(hpux_unimplemented_wrapper)
336 ENTRY_NAME(hpux_unimplemented_wrapper)
337 ENTRY_NAME(hpux_unimplemented_wrapper)
338 ENTRY_NAME(hpux_unimplemented_wrapper) /* 305 */
339 ENTRY_NAME(hpux_unimplemented_wrapper)
340 ENTRY_NAME(hpux_unimplemented_wrapper)
341 ENTRY_NAME(hpux_unimplemented_wrapper)
342 ENTRY_NAME(hpux_unimplemented_wrapper)
343 ENTRY_NAME(hpux_unimplemented_wrapper) /* 310 */
344 ENTRY_NAME(hpux_unimplemented_wrapper)
345 ENTRY_NAME(hpux_unimplemented_wrapper)
346 ENTRY_NAME(hpux_unimplemented_wrapper)
347 ENTRY_NAME(hpux_unimplemented_wrapper)
348 ENTRY_NAME(hpux_unimplemented_wrapper) /* 315 */
349 ENTRY_NAME(hpux_unimplemented_wrapper)
350 ENTRY_NAME(hpux_unimplemented_wrapper)
351 ENTRY_NAME(hpux_unimplemented_wrapper)
352 ENTRY_NAME(hpux_unimplemented_wrapper)
353 ENTRY_NAME(hpux_unimplemented_wrapper) /* 320 */
354 ENTRY_NAME(hpux_unimplemented_wrapper)
355 ENTRY_NAME(hpux_unimplemented_wrapper)
356 ENTRY_NAME(hpux_unimplemented_wrapper)
357 ENTRY_NAME(hpux_unimplemented_wrapper)
358 ENTRY_NAME(hpux_unimplemented_wrapper) /* 325 */
359 ENTRY_NAME(hpux_unimplemented_wrapper)
360 ENTRY_NAME(hpux_unimplemented_wrapper)
361 ENTRY_NAME(hpux_unimplemented_wrapper)
362 ENTRY_NAME(hpux_unimplemented_wrapper)
363 ENTRY_NAME(hpux_unimplemented_wrapper) /* 330 */
364 ENTRY_NAME(hpux_unimplemented_wrapper)
365 ENTRY_NAME(sys_lchown)
366 ENTRY_NAME(hpux_unimplemented_wrapper)
367 ENTRY_NAME(hpux_sysfs)
368 ENTRY_NAME(hpux_unimplemented_wrapper) /* 335 */
369 ENTRY_NAME(hpux_unimplemented_wrapper)
370 ENTRY_NAME(hpux_unimplemented_wrapper)
371 ENTRY_NAME(hpux_unimplemented_wrapper)
372 ENTRY_NAME(hpux_unimplemented_wrapper)
373 ENTRY_NAME(hpux_unimplemented_wrapper) /* 340 */
374 ENTRY_NAME(hpux_unimplemented_wrapper)
375 ENTRY_NAME(hpux_unimplemented_wrapper)
376 ENTRY_NAME(hpux_unimplemented_wrapper)
377 ENTRY_NAME(hpux_unimplemented_wrapper)
378 ENTRY_NAME(hpux_unimplemented_wrapper) /* 345 */
379 ENTRY_NAME(hpux_unimplemented_wrapper)
380 ENTRY_NAME(hpux_unimplemented_wrapper)
381 ENTRY_NAME(hpux_unimplemented_wrapper)
382 ENTRY_NAME(hpux_unimplemented_wrapper)
383 ENTRY_NAME(hpux_unimplemented_wrapper) /* 350 */
384 ENTRY_NAME(hpux_unimplemented_wrapper)
385 ENTRY_NAME(hpux_unimplemented_wrapper)
386 ENTRY_NAME(sys_nanosleep)
387 ENTRY_NAME(hpux_unimplemented_wrapper)
388 ENTRY_NAME(hpux_unimplemented_wrapper) /* 355 */
389 ENTRY_NAME(hpux_getdents)
390 ENTRY_NAME(hpux_unimplemented_wrapper)
391 ENTRY_NAME(hpux_unimplemented_wrapper)
392 ENTRY_NAME(hpux_unimplemented_wrapper)
393 ENTRY_NAME(hpux_unimplemented_wrapper) /* 360 */
394 ENTRY_NAME(hpux_fstat64)
395 ENTRY_NAME(hpux_unimplemented_wrapper)
396 ENTRY_NAME(hpux_unimplemented_wrapper)
397 ENTRY_NAME(hpux_unimplemented_wrapper)
398 ENTRY_NAME(hpux_unimplemented_wrapper) /* 365 */
399 ENTRY_NAME(hpux_lstat64)
400 ENTRY_NAME(hpux_unimplemented_wrapper)
401 ENTRY_NAME(hpux_unimplemented_wrapper)
402 ENTRY_NAME(hpux_stat64)
403 ENTRY_NAME(hpux_unimplemented_wrapper) /* 370 */
404 ENTRY_NAME(hpux_unimplemented_wrapper)
405 ENTRY_NAME(hpux_unimplemented_wrapper)
406 ENTRY_NAME(hpux_unimplemented_wrapper)
407 ENTRY_NAME(hpux_unimplemented_wrapper)
408 ENTRY_NAME(hpux_unimplemented_wrapper) /* 375 */
409 ENTRY_NAME(hpux_unimplemented_wrapper)
410 ENTRY_NAME(hpux_unimplemented_wrapper)
411 ENTRY_NAME(hpux_unimplemented_wrapper)
412 ENTRY_NAME(hpux_unimplemented_wrapper)
413 ENTRY_NAME(hpux_unimplemented_wrapper) /* 380 */
414 ENTRY_NAME(hpux_unimplemented_wrapper)
415 ENTRY_NAME(hpux_unimplemented_wrapper)
416 ENTRY_NAME(hpux_setpgrp)
417 ENTRY_NAME(hpux_unimplemented_wrapper)
418 ENTRY_NAME(hpux_unimplemented_wrapper) /* 385 */
419 ENTRY_NAME(hpux_unimplemented_wrapper)
420 ENTRY_NAME(hpux_unimplemented_wrapper)
421 ENTRY_NAME(hpux_unimplemented_wrapper)
422 ENTRY_NAME(hpux_unimplemented_wrapper)
423 ENTRY_NAME(hpux_unimplemented_wrapper) /* 390 */
424 ENTRY_NAME(hpux_unimplemented_wrapper)
425 ENTRY_NAME(hpux_unimplemented_wrapper)
426 ENTRY_NAME(hpux_unimplemented_wrapper)
427 ENTRY_NAME(hpux_unimplemented_wrapper)
428 ENTRY_NAME(hpux_unimplemented_wrapper) /* 395 */
429 ENTRY_NAME(hpux_unimplemented_wrapper)
430 ENTRY_NAME(hpux_unimplemented_wrapper)
431 ENTRY_NAME(hpux_unimplemented_wrapper)
432 ENTRY_NAME(hpux_unimplemented_wrapper)
433 ENTRY_NAME(hpux_unimplemented_wrapper) /* 400 */
434 ENTRY_NAME(hpux_unimplemented_wrapper)
435 ENTRY_NAME(hpux_unimplemented_wrapper)
436 ENTRY_NAME(hpux_unimplemented_wrapper)
437 ENTRY_NAME(hpux_unimplemented_wrapper)
438 ENTRY_NAME(hpux_unimplemented_wrapper) /* 405 */
439 ENTRY_NAME(hpux_unimplemented_wrapper)
440 ENTRY_NAME(hpux_unimplemented_wrapper)
441 ENTRY_NAME(hpux_unimplemented_wrapper)
442 ENTRY_NAME(hpux_unimplemented_wrapper)
443 ENTRY_NAME(hpux_unimplemented_wrapper) /* 410 */
444 ENTRY_NAME(hpux_unimplemented_wrapper)
445 ENTRY_NAME(hpux_unimplemented_wrapper)
446 ENTRY_NAME(hpux_unimplemented_wrapper)
447 ENTRY_NAME(hpux_unimplemented_wrapper)
448 ENTRY_NAME(hpux_unimplemented_wrapper) /* 415 */
449 ENTRY_NAME(hpux_unimplemented_wrapper)
450 ENTRY_NAME(hpux_unimplemented_wrapper)
451 ENTRY_NAME(hpux_unimplemented_wrapper)
452 ENTRY_NAME(hpux_unimplemented_wrapper)
453 ENTRY_NAME(hpux_unimplemented_wrapper) /* 420 */
454 ENTRY_NAME(hpux_unimplemented_wrapper)
455 ENTRY_NAME(hpux_unimplemented_wrapper)
456 ENTRY_NAME(hpux_unimplemented_wrapper)
457 ENTRY_NAME(hpux_unimplemented_wrapper)
458 ENTRY_NAME(hpux_unimplemented_wrapper) /* 425 */
459 ENTRY_NAME(hpux_unimplemented_wrapper)
460 ENTRY_NAME(hpux_unimplemented_wrapper)
461 ENTRY_NAME(hpux_unimplemented_wrapper)
462 ENTRY_NAME(hpux_unimplemented_wrapper)
463 ENTRY_NAME(hpux_unimplemented_wrapper) /* 430 */
464 ENTRY_NAME(hpux_unimplemented_wrapper)
465 ENTRY_NAME(hpux_unimplemented_wrapper)
466 ENTRY_NAME(hpux_unimplemented_wrapper)
467 ENTRY_NAME(hpux_unimplemented_wrapper)
468 ENTRY_NAME(hpux_unimplemented_wrapper) /* 435 */
469 ENTRY_NAME(hpux_unimplemented_wrapper)
470 ENTRY_NAME(hpux_unimplemented_wrapper)
471 ENTRY_NAME(hpux_unimplemented_wrapper)
472 ENTRY_NAME(hpux_unimplemented_wrapper)
473 ENTRY_NAME(hpux_unimplemented_wrapper) /* 440 */
474 ENTRY_NAME(hpux_unimplemented_wrapper)
475 ENTRY_NAME(hpux_unimplemented_wrapper)
476 ENTRY_NAME(hpux_unimplemented_wrapper)
477 ENTRY_NAME(hpux_unimplemented_wrapper)
478 ENTRY_NAME(hpux_unimplemented_wrapper) /* 445 */
479 ENTRY_NAME(hpux_unimplemented_wrapper)
480 ENTRY_NAME(hpux_unimplemented_wrapper)
481 ENTRY_NAME(hpux_unimplemented_wrapper)
482 ENTRY_NAME(hpux_unimplemented_wrapper)
483 ENTRY_NAME(hpux_unimplemented_wrapper) /* 450 */
484 ENTRY_NAME(hpux_unimplemented_wrapper)
485 ENTRY_NAME(hpux_unimplemented_wrapper)
486 ENTRY_NAME(hpux_unimplemented_wrapper)
487 ENTRY_NAME(hpux_unimplemented_wrapper)
488 ENTRY_NAME(hpux_unimplemented_wrapper) /* 455 */
489 ENTRY_NAME(hpux_unimplemented_wrapper)
490 ENTRY_NAME(hpux_unimplemented_wrapper)
491 ENTRY_NAME(hpux_unimplemented_wrapper)
492 ENTRY_NAME(hpux_unimplemented_wrapper)
493 ENTRY_NAME(hpux_unimplemented_wrapper) /* 460 */
494 ENTRY_NAME(hpux_unimplemented_wrapper)
495 ENTRY_NAME(hpux_unimplemented_wrapper)
496 ENTRY_NAME(hpux_unimplemented_wrapper)
497 ENTRY_NAME(hpux_unimplemented_wrapper)
498 ENTRY_NAME(hpux_unimplemented_wrapper) /* 465 */
499 ENTRY_NAME(hpux_unimplemented_wrapper)
500 ENTRY_NAME(hpux_unimplemented_wrapper)
501 ENTRY_NAME(hpux_unimplemented_wrapper)
502 ENTRY_NAME(hpux_unimplemented_wrapper)
503 ENTRY_NAME(hpux_unimplemented_wrapper) /* 470 */
504 ENTRY_NAME(hpux_unimplemented_wrapper)
505 ENTRY_NAME(hpux_unimplemented_wrapper)
506 ENTRY_NAME(hpux_unimplemented_wrapper)
507 ENTRY_NAME(hpux_unimplemented_wrapper)
508 ENTRY_NAME(hpux_unimplemented_wrapper) /* 475 */
509 ENTRY_NAME(hpux_unimplemented_wrapper)
510 ENTRY_NAME(hpux_unimplemented_wrapper)
511 ENTRY_NAME(hpux_unimplemented_wrapper)
512 ENTRY_NAME(hpux_unimplemented_wrapper)
513 ENTRY_NAME(hpux_unimplemented_wrapper) /* 480 */
514 ENTRY_NAME(hpux_unimplemented_wrapper)
515 ENTRY_NAME(hpux_unimplemented_wrapper)
516 ENTRY_NAME(hpux_unimplemented_wrapper)
517 ENTRY_NAME(hpux_unimplemented_wrapper)
518 ENTRY_NAME(hpux_unimplemented_wrapper) /* 485 */
519 ENTRY_NAME(hpux_unimplemented_wrapper)
520 ENTRY_NAME(hpux_unimplemented_wrapper)
521 ENTRY_NAME(hpux_unimplemented_wrapper)
522 ENTRY_NAME(hpux_unimplemented_wrapper)
523 ENTRY_NAME(hpux_unimplemented_wrapper) /* 490 */
524 ENTRY_NAME(hpux_unimplemented_wrapper)
525 ENTRY_NAME(hpux_unimplemented_wrapper)
526 ENTRY_NAME(hpux_unimplemented_wrapper)
527 ENTRY_NAME(hpux_unimplemented_wrapper)
528 ENTRY_NAME(hpux_unimplemented_wrapper) /* 495 */
529 ENTRY_NAME(hpux_unimplemented_wrapper)
530 ENTRY_NAME(hpux_unimplemented_wrapper)
531 ENTRY_NAME(hpux_unimplemented_wrapper)
532 ENTRY_NAME(hpux_unimplemented_wrapper)
533 ENTRY_NAME(hpux_unimplemented_wrapper) /* 500 */
534 ENTRY_NAME(hpux_unimplemented_wrapper)
535 ENTRY_NAME(hpux_unimplemented_wrapper)
536 ENTRY_NAME(hpux_unimplemented_wrapper)
537 ENTRY_NAME(hpux_unimplemented_wrapper)
538 ENTRY_NAME(hpux_unimplemented_wrapper) /* 505 */
539 ENTRY_NAME(hpux_unimplemented_wrapper)
540 ENTRY_NAME(hpux_unimplemented_wrapper)
541 ENTRY_NAME(hpux_unimplemented_wrapper)
542 ENTRY_NAME(hpux_unimplemented_wrapper)
543 ENTRY_NAME(hpux_unimplemented_wrapper) /* 510 */
544 ENTRY_NAME(hpux_unimplemented_wrapper)
545 ENTRY_NAME(hpux_unimplemented_wrapper)
546.end
547
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
new file mode 100644
index 000000000000..d7c80edf4489
--- /dev/null
+++ b/arch/parisc/hpux/fs.c
@@ -0,0 +1,199 @@
1/*
2 * Implements HPUX syscalls.
3 *
4 * Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org>
5 * Copyright (C) 2000 Michael Ang <mang with subcarrier.org>
6 * Copyright (C) 2000 John Marvin <jsm with parisc-linux.org>
7 * Copyright (C) 2000 Philipp Rumpf
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/mm.h>
25#include <linux/sched.h>
26#include <linux/file.h>
27#include <linux/smp_lock.h>
28#include <linux/slab.h>
29#include <linux/ptrace.h>
30#include <asm/errno.h>
31#include <asm/uaccess.h>
32
33int hpux_execve(struct pt_regs *regs)
34{
35 int error;
36 char *filename;
37
38 filename = getname((char *) regs->gr[26]);
39 error = PTR_ERR(filename);
40 if (IS_ERR(filename))
41 goto out;
42
43 error = do_execve(filename, (char **) regs->gr[25],
44 (char **)regs->gr[24], regs);
45
46 if (error == 0) {
47 task_lock(current);
48 current->ptrace &= ~PT_DTRACE;
49 task_unlock(current);
50 }
51 putname(filename);
52
53out:
54 return error;
55}
56
57struct hpux_dirent {
58 loff_t d_off;
59 ino_t d_ino;
60 short d_reclen;
61 short d_namlen;
62 char d_name[1];
63};
64
65struct getdents_callback {
66 struct hpux_dirent *current_dir;
67 struct hpux_dirent *previous;
68 int count;
69 int error;
70};
71
72#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
73#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
74
75static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
76 ino_t ino, unsigned d_type)
77{
78 struct hpux_dirent * dirent;
79 struct getdents_callback * buf = (struct getdents_callback *) __buf;
80 int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
81
82 buf->error = -EINVAL; /* only used if we fail.. */
83 if (reclen > buf->count)
84 return -EINVAL;
85 dirent = buf->previous;
86 if (dirent)
87 put_user(offset, &dirent->d_off);
88 dirent = buf->current_dir;
89 buf->previous = dirent;
90 put_user(ino, &dirent->d_ino);
91 put_user(reclen, &dirent->d_reclen);
92 put_user(namlen, &dirent->d_namlen);
93 copy_to_user(dirent->d_name, name, namlen);
94 put_user(0, dirent->d_name + namlen);
95 ((char *) dirent) += reclen;
96 buf->current_dir = dirent;
97 buf->count -= reclen;
98 return 0;
99}
100
101#undef NAME_OFFSET
102#undef ROUND_UP
103
104int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count)
105{
106 struct file * file;
107 struct hpux_dirent * lastdirent;
108 struct getdents_callback buf;
109 int error = -EBADF;
110
111 file = fget(fd);
112 if (!file)
113 goto out;
114
115 buf.current_dir = dirent;
116 buf.previous = NULL;
117 buf.count = count;
118 buf.error = 0;
119
120 error = vfs_readdir(file, filldir, &buf);
121 if (error < 0)
122 goto out_putf;
123 error = buf.error;
124 lastdirent = buf.previous;
125 if (lastdirent) {
126 put_user(file->f_pos, &lastdirent->d_off);
127 error = count - buf.count;
128 }
129
130out_putf:
131 fput(file);
132out:
133 return error;
134}
135
136int hpux_mount(const char *fs, const char *path, int mflag,
137 const char *fstype, const char *dataptr, int datalen)
138{
139 return -ENOSYS;
140}
141
142static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 *statbuf)
143{
144 struct hpux_stat64 tmp;
145
146 /* we probably want a different split here - is hpux 12:20? */
147
148 if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
149 return -EOVERFLOW;
150
151 memset(&tmp, 0, sizeof(tmp));
152 tmp.st_dev = new_encode_dev(stat->dev);
153 tmp.st_ino = stat->ino;
154 tmp.st_mode = stat->mode;
155 tmp.st_nlink = stat->nlink;
156 tmp.st_uid = stat->uid;
157 tmp.st_gid = stat->gid;
158 tmp.st_rdev = new_encode_dev(stat->rdev);
159 tmp.st_size = stat->size;
160 tmp.st_atime = stat->atime.tv_sec;
161 tmp.st_mtime = stat->mtime.tv_sec;
162 tmp.st_ctime = stat->ctime.tv_sec;
163 tmp.st_blocks = stat->blocks;
164 tmp.st_blksize = stat->blksize;
165 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
166}
167
168long hpux_stat64(char *filename, struct hpux_stat64 *statbuf)
169{
170 struct kstat stat;
171 int error = vfs_stat(filename, &stat);
172
173 if (!error)
174 error = cp_hpux_stat(&stat, statbuf);
175
176 return error;
177}
178
179long hpux_fstat64(unsigned int fd, struct hpux_stat64 *statbuf)
180{
181 struct kstat stat;
182 int error = vfs_fstat(fd, &stat);
183
184 if (!error)
185 error = cp_hpux_stat(&stat, statbuf);
186
187 return error;
188}
189
190long hpux_lstat64(char *filename, struct hpux_stat64 *statbuf)
191{
192 struct kstat stat;
193 int error = vfs_lstat(filename, &stat);
194
195 if (!error)
196 error = cp_hpux_stat(&stat, statbuf);
197
198 return error;
199}
diff --git a/arch/parisc/hpux/gate.S b/arch/parisc/hpux/gate.S
new file mode 100644
index 000000000000..2680a1c0fa77
--- /dev/null
+++ b/arch/parisc/hpux/gate.S
@@ -0,0 +1,116 @@
1/*
2 *
3 * Linux/PARISC Project (http://www.parisc-linux.org/)
4 *
5 * System call entry code Copyright (c) Matthew Wilcox 1999 <willy@bofh.ai>
6 * Licensed under the GNU GPL.
7 * thanks to Philipp Rumpf, Mike Shaver and various others
8 * sorry about the wall, puffin..
9 */
10
11#include <asm/assembly.h>
12#include <asm/offsets.h>
13#include <asm/unistd.h>
14#include <asm/errno.h>
15
16#ifdef __LP64__
17 .level 2.0w
18#else
19 .level 1.1
20#endif
21 .text
22
23#ifdef __LP64__
24#define FRAME_SIZE 128
25#else
26#define FRAME_SIZE 64
27#endif
28 .import hpux_call_table
29 .import hpux_syscall_exit,code
30 .export hpux_gateway_page
31
32 .align 4096
33hpux_gateway_page:
34 nop
35#ifdef __LP64__
36#warning NEEDS WORK for 64-bit
37#endif
38 ldw -64(%r30), %r29 ;! 8th argument
39 ldw -60(%r30), %r19 ;! 7th argument
40 ldw -56(%r30), %r20 ;! 6th argument
41 ldw -52(%r30), %r21 ;! 5th argument
42 gate .+8, %r0 /* become privileged */
43 mtsp %r0,%sr4 /* get kernel space into sr4 */
44 mtsp %r0,%sr5 /* get kernel space into sr5 */
45 mtsp %r0,%sr6 /* get kernel space into sr6 */
46 mfsp %sr7,%r1 /* save user sr7 */
47 mtsp %r1,%sr3 /* and store it in sr3 */
48
49 mtctl %r30,%cr28
50 mfctl %cr30,%r1
51 xor %r1,%r30,%r30 /* ye olde xor trick */
52 xor %r1,%r30,%r1
53 xor %r1,%r30,%r30
54 ldo TASK_SZ_ALGN+FRAME_SIZE(%r30),%r30 /* set up kernel stack */
55
56 /* N.B.: It is critical that we don't set sr7 to 0 until r30
57 * contains a valid kernel stack pointer. It is also
58 * critical that we don't start using the kernel stack
59 * until after sr7 has been set to 0.
60 */
61
62 mtsp %r0,%sr7 /* get kernel space into sr7 */
63 STREG %r1,TASK_PT_GR30-TASK_SZ_ALGN-FRAME_SIZE(%r30) /* save usp */
64 ldo -TASK_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr in %r1 */
65
66 /* Save some registers for sigcontext and potential task
67 switch (see entry.S for the details of which ones are
68 saved/restored). TASK_PT_PSW is zeroed so we can see whether
69 a process is on a syscall or not. For an interrupt the real
70 PSW value is stored. This is needed for gdb and sys_ptrace. */
71 STREG %r0, TASK_PT_PSW(%r1)
72 STREG %r2, TASK_PT_GR2(%r1) /* preserve rp */
73 STREG %r19, TASK_PT_GR19(%r1) /* 7th argument */
74 STREG %r20, TASK_PT_GR20(%r1) /* 6th argument */
75 STREG %r21, TASK_PT_GR21(%r1) /* 5th argument */
76 STREG %r22, TASK_PT_GR22(%r1) /* syscall # */
77 STREG %r23, TASK_PT_GR23(%r1) /* 4th argument */
78 STREG %r24, TASK_PT_GR24(%r1) /* 3rd argument */
79 STREG %r25, TASK_PT_GR25(%r1) /* 2nd argument */
80 STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */
81 STREG %r27, TASK_PT_GR27(%r1) /* user dp */
82 STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */
83 STREG %r28, TASK_PT_ORIG_R28(%r1) /* return value 0 (saved for signals) */
84 STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */
85 STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */
86
87 ldo TASK_PT_FR0(%r1), %r27 /* save fpregs from the kernel */
88 save_fp %r27 /* or potential task switch */
89
90 mfctl %cr11, %r27 /* i.e. SAR */
91 STREG %r27, TASK_PT_SAR(%r1)
92
93 loadgp
94
95 stw %r21, -52(%r30) ;! 5th argument
96 stw %r20, -56(%r30) ;! 6th argument
97 stw %r19, -60(%r30) ;! 7th argument
98 stw %r29, -64(%r30) ;! 8th argument
99
100 ldil L%hpux_call_table, %r21
101 ldo R%hpux_call_table(%r21), %r21
102 comiclr,>>= __NR_HPUX_syscalls, %r22, %r0
103 b,n syscall_nosys
104 ldwx,s %r22(%r21), %r21
105 ldil L%hpux_syscall_exit,%r2
106 be 0(%sr7,%r21)
107 ldo R%hpux_syscall_exit(%r2),%r2
108
109syscall_nosys:
110 ldil L%hpux_syscall_exit,%r1
111 be R%hpux_syscall_exit(%sr7,%r1)
112 ldo -ENOSYS(%r0),%r28
113
114 .align 4096
115 .export end_hpux_gateway_page
116end_hpux_gateway_page:
diff --git a/arch/parisc/hpux/ioctl.c b/arch/parisc/hpux/ioctl.c
new file mode 100644
index 000000000000..b34b4f3c60ec
--- /dev/null
+++ b/arch/parisc/hpux/ioctl.c
@@ -0,0 +1,73 @@
1/*
2 * Implements some necessary HPUX ioctls.
3 *
4 * Copyright (C) 1999-2002 Matthew Wilcox <willy with parisc-linux.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/*
22 * Supported ioctls:
23 * TCGETA
24 * TCSETA
25 * TCSETAW
26 * TCSETAF
27 * TCSBRK
28 * TCXONC
29 * TCFLSH
30 * TIOCGWINSZ
31 * TIOCSWINSZ
32 * TIOCGPGRP
33 * TIOCSPGRP
34 */
35
36#include <linux/sched.h>
37#include <linux/smp_lock.h>
38#include <linux/syscalls.h>
39#include <asm/errno.h>
40#include <asm/ioctl.h>
41#include <asm/termios.h>
42#include <asm/uaccess.h>
43
44static int hpux_ioctl_t(int fd, unsigned long cmd, unsigned long arg)
45{
46 int result = -EOPNOTSUPP;
47 int nr = _IOC_NR(cmd);
48 switch (nr) {
49 case 106:
50 result = sys_ioctl(fd, TIOCSWINSZ, arg);
51 break;
52 case 107:
53 result = sys_ioctl(fd, TIOCGWINSZ, arg);
54 break;
55 }
56 return result;
57}
58
59int hpux_ioctl(int fd, unsigned long cmd, unsigned long arg)
60{
61 int result = -EOPNOTSUPP;
62 int type = _IOC_TYPE(cmd);
63 switch (type) {
64 case 'T':
65 /* Our structures are now compatible with HPUX's */
66 result = sys_ioctl(fd, cmd, arg);
67 break;
68 case 't':
69 result = hpux_ioctl_t(fd, cmd, arg);
70 break;
71 }
72 return result;
73}
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
new file mode 100644
index 000000000000..a64fd48fbfb5
--- /dev/null
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -0,0 +1,985 @@
1/*
2 * Implements HPUX syscalls.
3 *
4 * Copyright (C) 1999 Matthew Wilcox <willy with parisc-linux.org>
5 * Copyright (C) 2000 Philipp Rumpf
6 * Copyright (C) 2000 John Marvin <jsm with parisc-linux.org>
7 * Copyright (C) 2000 Michael Ang <mang with subcarrier.org>
8 * Copyright (C) 2001 Nathan Neulinger <nneul at umr.edu>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <linux/file.h>
26#include <linux/fs.h>
27#include <linux/namei.h>
28#include <linux/sched.h>
29#include <linux/slab.h>
30#include <linux/smp_lock.h>
31#include <linux/syscalls.h>
32#include <linux/utsname.h>
33#include <linux/vfs.h>
34#include <linux/vmalloc.h>
35
36#include <asm/errno.h>
37#include <asm/pgalloc.h>
38#include <asm/uaccess.h>
39
40unsigned long hpux_brk(unsigned long addr)
41{
42 /* Sigh. Looks like HP/UX libc relies on kernel bugs. */
43 return sys_brk(addr + PAGE_SIZE);
44}
45
46int hpux_sbrk(void)
47{
48 return -ENOSYS;
49}
50
51/* Random other syscalls */
52
53int hpux_nice(int priority_change)
54{
55 return -ENOSYS;
56}
57
58int hpux_ptrace(void)
59{
60 return -ENOSYS;
61}
62
63int hpux_wait(int *stat_loc)
64{
65 return sys_waitpid(-1, stat_loc, 0);
66}
67
68int hpux_setpgrp(void)
69{
70 return sys_setpgid(0,0);
71}
72
73int hpux_setpgrp3(void)
74{
75 return hpux_setpgrp();
76}
77
78#define _SC_CPU_VERSION 10001
79#define _SC_OPEN_MAX 4
80#define CPU_PA_RISC1_1 0x210
81
82int hpux_sysconf(int which)
83{
84 switch (which) {
85 case _SC_CPU_VERSION:
86 return CPU_PA_RISC1_1;
87 case _SC_OPEN_MAX:
88 return INT_MAX;
89 default:
90 return -EINVAL;
91 }
92}
93
94/*****************************************************************************/
95
96#define HPUX_UTSLEN 9
97#define HPUX_SNLEN 15
98
99struct hpux_utsname {
100 char sysname[HPUX_UTSLEN];
101 char nodename[HPUX_UTSLEN];
102 char release[HPUX_UTSLEN];
103 char version[HPUX_UTSLEN];
104 char machine[HPUX_UTSLEN];
105 char idnumber[HPUX_SNLEN];
106} ;
107
108struct hpux_ustat {
109 int32_t f_tfree; /* total free (daddr_t) */
110 u_int32_t f_tinode; /* total inodes free (ino_t) */
111 char f_fname[6]; /* filsys name */
112 char f_fpack[6]; /* filsys pack name */
113 u_int32_t f_blksize; /* filsys block size (int) */
114};
115
116/*
117 * HPUX's utssys() call. It's a collection of miscellaneous functions,
118 * alas, so there's no nice way of splitting them up.
119 */
120
121/* This function is called from hpux_utssys(); HP-UX implements
122 * ustat() as an option to utssys().
123 *
124 * Now, struct ustat on HP-UX is exactly the same as on Linux, except
125 * that it contains one addition field on the end, int32_t f_blksize.
126 * So, we could have written this function to just call the Linux
127 * sys_ustat(), (defined in linux/fs/super.c), and then just
128 * added this additional field to the user's structure. But I figure
129 * if we're gonna be digging through filesystem structures to get
130 * this, we might as well just do the whole enchilada all in one go.
131 *
132 * So, most of this function is almost identical to sys_ustat().
133 * I have placed comments at the few lines changed or added, to
134 * aid in porting forward if and when sys_ustat() is changed from
135 * its form in kernel 2.2.5.
136 */
137static int hpux_ustat(dev_t dev, struct hpux_ustat __user *ubuf)
138{
139 struct super_block *s;
140 struct hpux_ustat tmp; /* Changed to hpux_ustat */
141 struct kstatfs sbuf;
142 int err = -EINVAL;
143
144 s = user_get_super(dev);
145 if (s == NULL)
146 goto out;
147 err = vfs_statfs(s, &sbuf);
148 drop_super(s);
149 if (err)
150 goto out;
151
152 memset(&tmp,0,sizeof(tmp));
153
154 tmp.f_tfree = (int32_t)sbuf.f_bfree;
155 tmp.f_tinode = (u_int32_t)sbuf.f_ffree;
156 tmp.f_blksize = (u_int32_t)sbuf.f_bsize; /* Added this line */
157
158 err = copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
159out:
160 return err;
161}
162
163/*
164 * Wrapper for hpux statfs call. At the moment, just calls the linux native one
165 * and ignores the extra fields at the end of the hpux statfs struct.
166 *
167 */
168
169typedef int32_t hpux_fsid_t[2]; /* file system ID type */
170typedef uint16_t hpux_site_t;
171
172struct hpux_statfs {
173 int32_t f_type; /* type of info, zero for now */
174 int32_t f_bsize; /* fundamental file system block size */
175 int32_t f_blocks; /* total blocks in file system */
176 int32_t f_bfree; /* free block in fs */
177 int32_t f_bavail; /* free blocks avail to non-superuser */
178 int32_t f_files; /* total file nodes in file system */
179 int32_t f_ffree; /* free file nodes in fs */
180 hpux_fsid_t f_fsid; /* file system ID */
181 int32_t f_magic; /* file system magic number */
182 int32_t f_featurebits; /* file system features */
183 int32_t f_spare[4]; /* spare for later */
184 hpux_site_t f_cnode; /* cluster node where mounted */
185 int16_t f_pad;
186};
187
188static int vfs_statfs_hpux(struct super_block *sb, struct hpux_statfs *buf)
189{
190 struct kstatfs st;
191 int retval;
192
193 retval = vfs_statfs(sb, &st);
194 if (retval)
195 return retval;
196
197 memset(buf, 0, sizeof(*buf));
198 buf->f_type = st.f_type;
199 buf->f_bsize = st.f_bsize;
200 buf->f_blocks = st.f_blocks;
201 buf->f_bfree = st.f_bfree;
202 buf->f_bavail = st.f_bavail;
203 buf->f_files = st.f_files;
204 buf->f_ffree = st.f_ffree;
205 buf->f_fsid[0] = st.f_fsid.val[0];
206 buf->f_fsid[1] = st.f_fsid.val[1];
207
208 return 0;
209}
210
211/* hpux statfs */
212asmlinkage long hpux_statfs(const char __user *path,
213 struct hpux_statfs __user *buf)
214{
215 struct nameidata nd;
216 int error;
217
218 error = user_path_walk(path, &nd);
219 if (!error) {
220 struct hpux_statfs tmp;
221 error = vfs_statfs_hpux(nd.dentry->d_inode->i_sb, &tmp);
222 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
223 error = -EFAULT;
224 path_release(&nd);
225 }
226 return error;
227}
228
229asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf)
230{
231 struct file *file;
232 struct hpux_statfs tmp;
233 int error;
234
235 error = -EBADF;
236 file = fget(fd);
237 if (!file)
238 goto out;
239 error = vfs_statfs_hpux(file->f_dentry->d_inode->i_sb, &tmp);
240 if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
241 error = -EFAULT;
242 fput(file);
243 out:
244 return error;
245}
246
247
248/* This function is called from hpux_utssys(); HP-UX implements
249 * uname() as an option to utssys().
250 *
251 * The form of this function is pretty much copied from sys_olduname(),
252 * defined in linux/arch/i386/kernel/sys_i386.c.
253 */
254/* TODO: Are these put_user calls OK? Should they pass an int?
255 * (I copied it from sys_i386.c like this.)
256 */
257static int hpux_uname(struct hpux_utsname *name)
258{
259 int error;
260
261 if (!name)
262 return -EFAULT;
263 if (!access_ok(VERIFY_WRITE,name,sizeof(struct hpux_utsname)))
264 return -EFAULT;
265
266 down_read(&uts_sem);
267
268 error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1);
269 error |= __put_user(0,name->sysname+HPUX_UTSLEN-1);
270 error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1);
271 error |= __put_user(0,name->nodename+HPUX_UTSLEN-1);
272 error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1);
273 error |= __put_user(0,name->release+HPUX_UTSLEN-1);
274 error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1);
275 error |= __put_user(0,name->version+HPUX_UTSLEN-1);
276 error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1);
277 error |= __put_user(0,name->machine+HPUX_UTSLEN-1);
278
279 up_read(&uts_sem);
280
281 /* HP-UX utsname has no domainname field. */
282
283 /* TODO: Implement idnumber!!! */
284#if 0
285 error |= __put_user(0,name->idnumber);
286 error |= __put_user(0,name->idnumber+HPUX_SNLEN-1);
287#endif
288
289 error = error ? -EFAULT : 0;
290
291 return error;
292}
293
294/* Note: HP-UX just uses the old suser() function to check perms
295 * in this system call. We'll use capable(CAP_SYS_ADMIN).
296 */
297int hpux_utssys(char *ubuf, int n, int type)
298{
299 int len;
300 int error;
301 switch( type ) {
302 case 0:
303 /* uname(): */
304 return( hpux_uname( (struct hpux_utsname *)ubuf ) );
305 break ;
306 case 1:
307 /* Obsolete (used to be umask().) */
308 return -EFAULT ;
309 break ;
310 case 2:
311 /* ustat(): */
312 return( hpux_ustat(new_decode_dev(n), (struct hpux_ustat *)ubuf) );
313 break ;
314 case 3:
315 /* setuname():
316 *
317 * On linux (unlike HP-UX), utsname.nodename
318 * is the same as the hostname.
319 *
320 * sys_sethostname() is defined in linux/kernel/sys.c.
321 */
322 if (!capable(CAP_SYS_ADMIN))
323 return -EPERM;
324 /* Unlike Linux, HP-UX returns an error if n==0: */
325 if ( n <= 0 )
326 return -EINVAL ;
327 /* Unlike Linux, HP-UX truncates it if n is too big: */
328 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
329 return( sys_sethostname(ubuf, len) );
330 break ;
331 case 4:
332 /* sethostname():
333 *
334 * sys_sethostname() is defined in linux/kernel/sys.c.
335 */
336 if (!capable(CAP_SYS_ADMIN))
337 return -EPERM;
338 /* Unlike Linux, HP-UX returns an error if n==0: */
339 if ( n <= 0 )
340 return -EINVAL ;
341 /* Unlike Linux, HP-UX truncates it if n is too big: */
342 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
343 return( sys_sethostname(ubuf, len) );
344 break ;
345 case 5:
346 /* gethostname():
347 *
348 * sys_gethostname() is defined in linux/kernel/sys.c.
349 */
350 /* Unlike Linux, HP-UX returns an error if n==0: */
351 if ( n <= 0 )
352 return -EINVAL ;
353 return( sys_gethostname(ubuf, n) );
354 break ;
355 case 6:
356 /* Supposedly called from setuname() in libc.
357 * TODO: When and why is this called?
358 * Is it ever even called?
359 *
360 * This code should look a lot like sys_sethostname(),
361 * defined in linux/kernel/sys.c. If that gets updated,
362 * update this code similarly.
363 */
364 if (!capable(CAP_SYS_ADMIN))
365 return -EPERM;
366 /* Unlike Linux, HP-UX returns an error if n==0: */
367 if ( n <= 0 )
368 return -EINVAL ;
369 /* Unlike Linux, HP-UX truncates it if n is too big: */
370 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
371 /**/
372 /* TODO: print a warning about using this? */
373 down_write(&uts_sem);
374 error = -EFAULT;
375 if (!copy_from_user(system_utsname.sysname, ubuf, len)) {
376 system_utsname.sysname[len] = 0;
377 error = 0;
378 }
379 up_write(&uts_sem);
380 return error;
381 break ;
382 case 7:
383 /* Sets utsname.release, if you're allowed.
384 * Undocumented. Used by swinstall to change the
385 * OS version, during OS updates. Yuck!!!
386 *
387 * This code should look a lot like sys_sethostname()
388 * in linux/kernel/sys.c. If that gets updated, update
389 * this code similarly.
390 */
391 if (!capable(CAP_SYS_ADMIN))
392 return -EPERM;
393 /* Unlike Linux, HP-UX returns an error if n==0: */
394 if ( n <= 0 )
395 return -EINVAL ;
396 /* Unlike Linux, HP-UX truncates it if n is too big: */
397 len = (n <= __NEW_UTS_LEN) ? n : __NEW_UTS_LEN ;
398 /**/
399 /* TODO: print a warning about this? */
400 down_write(&uts_sem);
401 error = -EFAULT;
402 if (!copy_from_user(system_utsname.release, ubuf, len)) {
403 system_utsname.release[len] = 0;
404 error = 0;
405 }
406 up_write(&uts_sem);
407 return error;
408 break ;
409 default:
410 /* This system call returns -EFAULT if given an unknown type.
411 * Why not -EINVAL? I don't know, it's just not what they did.
412 */
413 return -EFAULT ;
414 }
415}
416
417int hpux_getdomainname(char *name, int len)
418{
419 int nlen;
420 int err = -EFAULT;
421
422 down_read(&uts_sem);
423
424 nlen = strlen(system_utsname.domainname) + 1;
425
426 if (nlen < len)
427 len = nlen;
428 if(len > __NEW_UTS_LEN)
429 goto done;
430 if(copy_to_user(name, system_utsname.domainname, len))
431 goto done;
432 err = 0;
433done:
434 up_read(&uts_sem);
435 return err;
436
437}
438
439int hpux_pipe(int *kstack_fildes)
440{
441 int error;
442
443 lock_kernel();
444 error = do_pipe(kstack_fildes);
445 unlock_kernel();
446 return error;
447}
448
449/* lies - says it works, but it really didn't lock anything */
450int hpux_lockf(int fildes, int function, off_t size)
451{
452 return 0;
453}
454
455int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2)
456{
457 char *fsname = NULL;
458 int len = 0;
459 int fstype;
460
461/*Unimplemented HP-UX syscall emulation. Syscall #334 (sysfs)
462 Args: 1 80057bf4 0 400179f0 0 0 0 */
463 printk(KERN_DEBUG "in hpux_sysfs\n");
464 printk(KERN_DEBUG "hpux_sysfs called with opcode = %d\n", opcode);
465 printk(KERN_DEBUG "hpux_sysfs called with arg1='%lx'\n", arg1);
466
467 if ( opcode == 1 ) { /* GETFSIND */
468 len = strlen_user((char *)arg1);
469 printk(KERN_DEBUG "len of arg1 = %d\n", len);
470
471 fsname = (char *) kmalloc(len+1, GFP_KERNEL);
472 if ( !fsname ) {
473 printk(KERN_DEBUG "failed to kmalloc fsname\n");
474 return 0;
475 }
476
477 if ( copy_from_user(fsname, (char *)arg1, len+1) ) {
478 printk(KERN_DEBUG "failed to copy_from_user fsname\n");
479 kfree(fsname);
480 return 0;
481 }
482
483 printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname);
484 if ( !strcmp(fsname, "hfs") ) {
485 fstype = 0;
486 } else {
487 fstype = 0;
488 };
489
490 kfree(fsname);
491
492 printk(KERN_DEBUG "returning fstype=%d\n", fstype);
493 return fstype; /* something other than default */
494 }
495
496
497 return 0;
498}
499
500
501/* Table of syscall names and handle for unimplemented routines */
502static const char *syscall_names[] = {
503 "nosys", /* 0 */
504 "exit",
505 "fork",
506 "read",
507 "write",
508 "open", /* 5 */
509 "close",
510 "wait",
511 "creat",
512 "link",
513 "unlink", /* 10 */
514 "execv",
515 "chdir",
516 "time",
517 "mknod",
518 "chmod", /* 15 */
519 "chown",
520 "brk",
521 "lchmod",
522 "lseek",
523 "getpid", /* 20 */
524 "mount",
525 "umount",
526 "setuid",
527 "getuid",
528 "stime", /* 25 */
529 "ptrace",
530 "alarm",
531 NULL,
532 "pause",
533 "utime", /* 30 */
534 "stty",
535 "gtty",
536 "access",
537 "nice",
538 "ftime", /* 35 */
539 "sync",
540 "kill",
541 "stat",
542 "setpgrp3",
543 "lstat", /* 40 */
544 "dup",
545 "pipe",
546 "times",
547 "profil",
548 "ki_call", /* 45 */
549 "setgid",
550 "getgid",
551 NULL,
552 NULL,
553 NULL, /* 50 */
554 "acct",
555 "set_userthreadid",
556 NULL,
557 "ioctl",
558 "reboot", /* 55 */
559 "symlink",
560 "utssys",
561 "readlink",
562 "execve",
563 "umask", /* 60 */
564 "chroot",
565 "fcntl",
566 "ulimit",
567 NULL,
568 NULL, /* 65 */
569 "vfork",
570 NULL,
571 NULL,
572 NULL,
573 NULL, /* 70 */
574 "mmap",
575 NULL,
576 "munmap",
577 "mprotect",
578 "madvise", /* 75 */
579 "vhangup",
580 "swapoff",
581 NULL,
582 "getgroups",
583 "setgroups", /* 80 */
584 "getpgrp2",
585 "setpgid/setpgrp2",
586 "setitimer",
587 "wait3",
588 "swapon", /* 85 */
589 "getitimer",
590 NULL,
591 NULL,
592 NULL,
593 "dup2", /* 90 */
594 NULL,
595 "fstat",
596 "select",
597 NULL,
598 "fsync", /* 95 */
599 "setpriority",
600 NULL,
601 NULL,
602 NULL,
603 "getpriority", /* 100 */
604 NULL,
605 NULL,
606 NULL,
607 NULL,
608 NULL, /* 105 */
609 NULL,
610 NULL,
611 "sigvector",
612 "sigblock",
613 "sigsetmask", /* 110 */
614 "sigpause",
615 "sigstack",
616 NULL,
617 NULL,
618 NULL, /* 115 */
619 "gettimeofday",
620 "getrusage",
621 NULL,
622 NULL,
623 "readv", /* 120 */
624 "writev",
625 "settimeofday",
626 "fchown",
627 "fchmod",
628 NULL, /* 125 */
629 "setresuid",
630 "setresgid",
631 "rename",
632 "truncate",
633 "ftruncate", /* 130 */
634 NULL,
635 "sysconf",
636 NULL,
637 NULL,
638 NULL, /* 135 */
639 "mkdir",
640 "rmdir",
641 NULL,
642 "sigcleanup",
643 "setcore", /* 140 */
644 NULL,
645 "gethostid",
646 "sethostid",
647 "getrlimit",
648 "setrlimit", /* 145 */
649 NULL,
650 NULL,
651 "quotactl",
652 "get_sysinfo",
653 NULL, /* 150 */
654 "privgrp",
655 "rtprio",
656 "plock",
657 NULL,
658 "lockf", /* 155 */
659 "semget",
660 NULL,
661 "semop",
662 "msgget",
663 NULL, /* 160 */
664 "msgsnd",
665 "msgrcv",
666 "shmget",
667 NULL,
668 "shmat", /* 165 */
669 "shmdt",
670 NULL,
671 "csp/nsp_init",
672 "cluster",
673 "mkrnod", /* 170 */
674 "test",
675 "unsp_open",
676 NULL,
677 "getcontext",
678 "osetcontext", /* 175 */
679 "bigio",
680 "pipenode",
681 "lsync",
682 "getmachineid",
683 "cnodeid/mysite", /* 180 */
684 "cnodes/sitels",
685 "swapclients",
686 "rmtprocess",
687 "dskless_stats",
688 "sigprocmask", /* 185 */
689 "sigpending",
690 "sigsuspend",
691 "sigaction",
692 NULL,
693 "nfssvc", /* 190 */
694 "getfh",
695 "getdomainname",
696 "setdomainname",
697 "async_daemon",
698 "getdirentries", /* 195 */
699 NULL,
700 NULL,
701 "vfsmount",
702 NULL,
703 "waitpid", /* 200 */
704 NULL,
705 NULL,
706 NULL,
707 NULL,
708 NULL, /* 205 */
709 NULL,
710 NULL,
711 NULL,
712 NULL,
713 NULL, /* 210 */
714 NULL,
715 NULL,
716 NULL,
717 NULL,
718 NULL, /* 215 */
719 NULL,
720 NULL,
721 NULL,
722 NULL,
723 NULL, /* 220 */
724 NULL,
725 NULL,
726 NULL,
727 "sigsetreturn",
728 "sigsetstatemask", /* 225 */
729 "bfactl",
730 "cs",
731 "cds",
732 NULL,
733 "pathconf", /* 230 */
734 "fpathconf",
735 NULL,
736 NULL,
737 "nfs_fcntl",
738 "ogetacl", /* 235 */
739 "ofgetacl",
740 "osetacl",
741 "ofsetacl",
742 "pstat",
743 "getaudid", /* 240 */
744 "setaudid",
745 "getaudproc",
746 "setaudproc",
747 "getevent",
748 "setevent", /* 245 */
749 "audwrite",
750 "audswitch",
751 "audctl",
752 "ogetaccess",
753 "fsctl", /* 250 */
754 "ulconnect",
755 "ulcontrol",
756 "ulcreate",
757 "uldest",
758 "ulrecv", /* 255 */
759 "ulrecvcn",
760 "ulsend",
761 "ulshutdown",
762 "swapfs",
763 "fss", /* 260 */
764 NULL,
765 NULL,
766 NULL,
767 NULL,
768 NULL, /* 265 */
769 NULL,
770 "tsync",
771 "getnumfds",
772 "poll",
773 "getmsg", /* 270 */
774 "putmsg",
775 "fchdir",
776 "getmount_cnt",
777 "getmount_entry",
778 "accept", /* 275 */
779 "bind",
780 "connect",
781 "getpeername",
782 "getsockname",
783 "getsockopt", /* 280 */
784 "listen",
785 "recv",
786 "recvfrom",
787 "recvmsg",
788 "send", /* 285 */
789 "sendmsg",
790 "sendto",
791 "setsockopt",
792 "shutdown",
793 "socket", /* 290 */
794 "socketpair",
795 "proc_open",
796 "proc_close",
797 "proc_send",
798 "proc_recv", /* 295 */
799 "proc_sendrecv",
800 "proc_syscall",
801 "ipccreate",
802 "ipcname",
803 "ipcnamerase", /* 300 */
804 "ipclookup",
805 "ipcselect",
806 "ipcconnect",
807 "ipcrecvcn",
808 "ipcsend", /* 305 */
809 "ipcrecv",
810 "ipcgetnodename",
811 "ipcsetnodename",
812 "ipccontrol",
813 "ipcshutdown", /* 310 */
814 "ipcdest",
815 "semctl",
816 "msgctl",
817 "shmctl",
818 "mpctl", /* 315 */
819 "exportfs",
820 "getpmsg",
821 "putpmsg",
822 "strioctl",
823 "msync", /* 320 */
824 "msleep",
825 "mwakeup",
826 "msem_init",
827 "msem_remove",
828 "adjtime", /* 325 */
829 "kload",
830 "fattach",
831 "fdetach",
832 "serialize",
833 "statvfs", /* 330 */
834 "fstatvfs",
835 "lchown",
836 "getsid",
837 "sysfs",
838 NULL, /* 335 */
839 NULL,
840 "sched_setparam",
841 "sched_getparam",
842 "sched_setscheduler",
843 "sched_getscheduler", /* 340 */
844 "sched_yield",
845 "sched_get_priority_max",
846 "sched_get_priority_min",
847 "sched_rr_get_interval",
848 "clock_settime", /* 345 */
849 "clock_gettime",
850 "clock_getres",
851 "timer_create",
852 "timer_delete",
853 "timer_settime", /* 350 */
854 "timer_gettime",
855 "timer_getoverrun",
856 "nanosleep",
857 "toolbox",
858 NULL, /* 355 */
859 "getdents",
860 "getcontext",
861 "sysinfo",
862 "fcntl64",
863 "ftruncate64", /* 360 */
864 "fstat64",
865 "getdirentries64",
866 "getrlimit64",
867 "lockf64",
868 "lseek64", /* 365 */
869 "lstat64",
870 "mmap64",
871 "setrlimit64",
872 "stat64",
873 "truncate64", /* 370 */
874 "ulimit64",
875 NULL,
876 NULL,
877 NULL,
878 NULL, /* 375 */
879 NULL,
880 NULL,
881 NULL,
882 NULL,
883 "setcontext", /* 380 */
884 "sigaltstack",
885 "waitid",
886 "setpgrp",
887 "recvmsg2",
888 "sendmsg2", /* 385 */
889 "socket2",
890 "socketpair2",
891 "setregid",
892 "lwp_create",
893 "lwp_terminate", /* 390 */
894 "lwp_wait",
895 "lwp_suspend",
896 "lwp_resume",
897 "lwp_self",
898 "lwp_abort_syscall", /* 395 */
899 "lwp_info",
900 "lwp_kill",
901 "ksleep",
902 "kwakeup",
903 "ksleep_abort", /* 400 */
904 "lwp_proc_info",
905 "lwp_exit",
906 "lwp_continue",
907 "getacl",
908 "fgetacl", /* 405 */
909 "setacl",
910 "fsetacl",
911 "getaccess",
912 "lwp_mutex_init",
913 "lwp_mutex_lock_sys", /* 410 */
914 "lwp_mutex_unlock",
915 "lwp_cond_init",
916 "lwp_cond_signal",
917 "lwp_cond_broadcast",
918 "lwp_cond_wait_sys", /* 415 */
919 "lwp_getscheduler",
920 "lwp_setscheduler",
921 "lwp_getprivate",
922 "lwp_setprivate",
923 "lwp_detach", /* 420 */
924 "mlock",
925 "munlock",
926 "mlockall",
927 "munlockall",
928 "shm_open", /* 425 */
929 "shm_unlink",
930 "sigqueue",
931 "sigwaitinfo",
932 "sigtimedwait",
933 "sigwait", /* 430 */
934 "aio_read",
935 "aio_write",
936 "lio_listio",
937 "aio_error",
938 "aio_return", /* 435 */
939 "aio_cancel",
940 "aio_suspend",
941 "aio_fsync",
942 "mq_open",
943 "mq_unlink", /* 440 */
944 "mq_send",
945 "mq_receive",
946 "mq_notify",
947 "mq_setattr",
948 "mq_getattr", /* 445 */
949 "ksem_open",
950 "ksem_unlink",
951 "ksem_close",
952 "ksem_destroy",
953 "lw_sem_incr", /* 450 */
954 "lw_sem_decr",
955 "lw_sem_read",
956 "mq_close",
957};
958static const int syscall_names_max = 453;
959
960int
961hpux_unimplemented(unsigned long arg1,unsigned long arg2,unsigned long arg3,
962 unsigned long arg4,unsigned long arg5,unsigned long arg6,
963 unsigned long arg7,unsigned long sc_num)
964{
965 /* NOTE: sc_num trashes arg8 for the few syscalls that actually
966 * have a valid 8th argument.
967 */
968 const char *name = NULL;
969 if ( sc_num <= syscall_names_max && sc_num >= 0 ) {
970 name = syscall_names[sc_num];
971 }
972
973 if ( name ) {
974 printk(KERN_DEBUG "Unimplemented HP-UX syscall emulation. Syscall #%lu (%s)\n",
975 sc_num, name);
976 } else {
977 printk(KERN_DEBUG "Unimplemented unknown HP-UX syscall emulation. Syscall #%lu\n",
978 sc_num);
979 }
980
981 printk(KERN_DEBUG " Args: %lx %lx %lx %lx %lx %lx %lx\n",
982 arg1, arg2, arg3, arg4, arg5, arg6, arg7);
983
984 return -ENOSYS;
985}
diff --git a/arch/parisc/hpux/wrappers.S b/arch/parisc/hpux/wrappers.S
new file mode 100644
index 000000000000..1aa936dfe147
--- /dev/null
+++ b/arch/parisc/hpux/wrappers.S
@@ -0,0 +1,257 @@
1/*
2 * Linux/PARISC Project (http://www.parisc-linux.org/)
3 *
4 * HP-UX System Call Wrapper routines and System Call Return Path
5 *
6 * Copyright (C) 2000 Hewlett-Packard (John Marvin)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifdef __LP64__
24#warning PA64 support needs more work...did first cut
25#endif
26
27#include <asm/offsets.h>
28#include <asm/assembly.h>
29#include <asm/signal.h>
30
31#ifdef __LP64__
32 .level 2.0w
33#else
34 .level 1.1
35#endif
36 .text
37
38 /* These should probably go in a header file somewhere.
39 * They are duplicated in kernel/wrappers.S
40 * Possibly we should consider consolidating these
41 * register save/restore macros.
42 */
43 .macro reg_save regs
44#ifdef __LP64__
45#warning NEEDS WORK for 64-bit
46#endif
47 STREG %r3, PT_GR3(\regs)
48 STREG %r4, PT_GR4(\regs)
49 STREG %r5, PT_GR5(\regs)
50 STREG %r6, PT_GR6(\regs)
51 STREG %r7, PT_GR7(\regs)
52 STREG %r8, PT_GR8(\regs)
53 STREG %r9, PT_GR9(\regs)
54 STREG %r10,PT_GR10(\regs)
55 STREG %r11,PT_GR11(\regs)
56 STREG %r12,PT_GR12(\regs)
57 STREG %r13,PT_GR13(\regs)
58 STREG %r14,PT_GR14(\regs)
59 STREG %r15,PT_GR15(\regs)
60 STREG %r16,PT_GR16(\regs)
61 STREG %r17,PT_GR17(\regs)
62 STREG %r18,PT_GR18(\regs)
63 .endm
64
65 .macro reg_restore regs
66 LDREG PT_GR3(\regs), %r3
67 LDREG PT_GR4(\regs), %r4
68 LDREG PT_GR5(\regs), %r5
69 LDREG PT_GR6(\regs), %r6
70 LDREG PT_GR7(\regs), %r7
71 LDREG PT_GR8(\regs), %r8
72 LDREG PT_GR9(\regs), %r9
73 LDREG PT_GR10(\regs),%r10
74 LDREG PT_GR11(\regs),%r11
75 LDREG PT_GR12(\regs),%r12
76 LDREG PT_GR13(\regs),%r13
77 LDREG PT_GR14(\regs),%r14
78 LDREG PT_GR15(\regs),%r15
79 LDREG PT_GR16(\regs),%r16
80 LDREG PT_GR17(\regs),%r17
81 LDREG PT_GR18(\regs),%r18
82 .endm
83
84
85 .export hpux_fork_wrapper
86 .export hpux_child_return
87 .import sys_fork
88
89hpux_fork_wrapper:
90 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
91 ;! pointer in task
92 reg_save %r1
93
94 STREG %r2,-20(%r30)
95 ldo 64(%r30),%r30
96 STREG %r2,PT_GR19(%r1) ;! save for child
97 STREG %r30,PT_GR21(%r1) ;! save for child
98
99 LDREG PT_GR30(%r1),%r25
100 mtctl %r25,%cr29
101 copy %r1,%r24
102 bl sys_clone,%r2
103 ldi SIGCHLD,%r26
104
105 LDREG -84(%r30),%r2
106fork_return:
107 ldo -64(%r30),%r30
108 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
109
110 reg_restore %r1
111
112 /*
113 * HP-UX wants pid (child gets parent pid, parent gets child pid)
114 * in r28 and a flag in r29 (r29 == 1 for child, 0 for parent).
115 * Linux fork returns 0 for child, pid for parent. Since HP-UX
116 * libc stub throws away parent pid and returns 0 for child,
117 * we'll just return 0 for parent pid now. Only applications
118 * that jump directly to the gateway page (not supported) will
119 * know the difference. We can fix this later if necessary.
120 */
121
122 ldo -1024(%r0),%r1
123 comb,>>=,n %r28,%r1,fork_exit /* just let the syscall exit handle it */
124 or,= %r28,%r0,%r0
125 or,tr %r0,%r0,%r29 /* r28 <> 0, we are parent, set r29 to 0 */
126 ldo 1(%r0),%r29 /* r28 == 0, we are child, set r29 to 1 */
127
128fork_exit:
129 bv %r0(%r2)
130 nop
131
132 /* Set the return value for the child */
133
134hpux_child_return:
135#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
136 bl schedule_tail, %r2
137 nop
138#endif
139
140 LDREG TASK_PT_GR19-TASK_SZ_ALGN-128(%r30),%r2
141 b fork_return
142 copy %r0,%r28
143
144 .export hpux_execve_wrapper
145 .export hpux_execv_wrapper
146 .import hpux_execve
147
148hpux_execv_wrapper:
149 copy %r0,%r24 /* NULL environment */
150
151hpux_execve_wrapper:
152
153 ldo TASK_REGS-TASK_SZ_ALGN-64(%r30),%r1 ;! get pt regs
154
155 /*
156 * Do we need to save/restore r3-r18 here?
157 * I don't think so. why would new thread need old
158 * threads registers?
159 */
160
161 /* Store arg0, arg1 and arg2 so that hpux_execve will find them */
162
163 STREG %r26,PT_GR26(%r1)
164 STREG %r25,PT_GR25(%r1)
165 STREG %r24,PT_GR24(%r1)
166
167 STREG %r2,-20(%r30)
168 ldo 64(%r30),%r30
169 bl hpux_execve,%r2
170 copy %r1,%arg0
171
172 ldo -64(%r30),%r30
173 LDREG -20(%r30),%r2
174
175 /* If exec succeeded we need to load the args */
176
177 ldo -1024(%r0),%r1
178 comb,>>= %r28,%r1,exec_error
179 copy %r2,%r19
180 ldo -TASK_SZ_ALGN-64(%r30),%r1 ;! get task ptr
181 LDREG TASK_PT_GR26(%r1),%r26
182 LDREG TASK_PT_GR25(%r1),%r25
183 LDREG TASK_PT_GR24(%r1),%r24
184 LDREG TASK_PT_GR23(%r1),%r23
185 copy %r0,%r2 /* Flag to syscall_exit not to clear args */
186
187exec_error:
188 bv %r0(%r19)
189 nop
190
191 .export hpux_pipe_wrapper
192 .import hpux_pipe
193
194 /* HP-UX expects pipefd's returned in r28 & r29 */
195
196hpux_pipe_wrapper:
197 STREG %r2,-20(%r30)
198 ldo 64(%r30),%r30
199 bl hpux_pipe,%r2
200 ldo -56(%r30),%r26 /* pass local array to hpux_pipe */
201
202
203 ldo -1024(%r0),%r1
204 comb,>>= %r28,%r1,pipe_exit /* let syscall exit handle it */
205 LDREG -84(%r30),%r2
206
207 /* if success, load fd's from stack array */
208
209 LDREG -56(%r30),%r28
210 LDREG -52(%r30),%r29
211
212pipe_exit:
213 bv %r0(%r2)
214 ldo -64(%r30),%r30
215
216 .export hpux_syscall_exit
217 .import syscall_exit
218
219hpux_syscall_exit:
220
221 /*
222 *
223 * HP-UX call return conventions:
224 *
225 * if error:
226 * r22 = 1
227 * r28 = errno value
228 * r29 = secondary return value
229 * else
230 * r22 = 0
231 * r28 = return value
232 * r29 = secondary return value
233 *
234 * For now, we'll just check to see if r28 is < (unsigned long)-1024
235 * (to handle addresses > 2 Gb) and if so set r22 to zero. If not,
236 * we'll complement r28 and set r22 to 1. Wrappers will be
237 * needed for syscalls that care about the secondary return value.
238 * The wrapper may also need a way of avoiding the following code,
239 * but we'll deal with that when it becomes necessary.
240 */
241
242 ldo -1024(%r0),%r1
243 comb,<< %r28,%r1,no_error
244 copy %r0,%r22
245 subi 0,%r28,%r28
246 ldo 1(%r0),%r22
247
248no_error:
249 b syscall_exit
250 nop
251
252 .export hpux_unimplemented_wrapper
253 .import hpux_unimplemented
254
255hpux_unimplemented_wrapper:
256 b hpux_unimplemented
257 STREG %r22,-64(%r30) /* overwrite arg8 with syscall number */