1 /* $NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $ */
2
3 /*
4 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.235 2023/07/30 05:30:45 rin Exp $");
31
32 /*
33 * below are all the standard NetBSD system calls, in the 32bit
34 * environment, with the necessary conversions to 64bit before calling
35 * the real syscall. anything that needs special attention is handled
36 * elsewhere - this file should only contain structure assignment and
37 * calls to the original function.
38 */
39
40 /*
41 * below are all the standard NetBSD system calls, in the 32bit
42 * environment, with the necessary conversions to 64bit before calling
43 * the real syscall. anything that needs special attention is handled
44 * elsewhere - this file should only contain structure assignment and
45 * calls to the original function.
46 */
47
48 #if defined(_KERNEL_OPT)
49 #include "opt_compat_43.h"
50 #include "opt_compat_netbsd.h"
51 #include "opt_ddb.h"
52 #include "opt_ktrace.h"
53 #include "opt_ntp.h"
54 #include "opt_quota.h"
55 #include "opt_syscall_debug.h"
56 #include "opt_sysv.h"
57 #endif
58
59 #include <sys/param.h>
60 #include <sys/acct.h>
61 #include <sys/dirent.h>
62 #include <sys/exec.h>
63 #include <sys/file.h>
64 #include <sys/filedesc.h>
65 #include <sys/kernel.h>
66 #include <sys/ktrace.h>
67 #include <sys/mbuf.h>
68 #include <sys/mman.h>
69 #include <sys/mount.h>
70 #include <sys/namei.h>
71 #include <sys/pool.h>
72 #include <sys/proc.h>
73 #include <sys/ptrace.h>
74 #include <sys/quotactl.h>
75 #include <sys/resourcevar.h>
76 #include <sys/signalvar.h>
77 #include <sys/socket.h>
78 #include <sys/socketvar.h>
79 #include <sys/sockio.h>
80 #include <sys/stat.h>
81 #include <sys/swap.h>
82 #include <sys/syscallargs.h>
83 #include <sys/systm.h>
84 #include <sys/time.h>
85 #include <sys/trace.h>
86 #include <sys/vfs_syscalls.h>
87
88 #include <uvm/uvm_extern.h>
89 #include <uvm/uvm_swap.h>
90
91 #include <net/if.h>
92
93 #include <compat/netbsd32/netbsd32.h>
94 #include <compat/netbsd32/netbsd32_conv.h>
95 #include <compat/netbsd32/netbsd32_exec.h>
96 #include <compat/netbsd32/netbsd32_syscall.h>
97 #include <compat/netbsd32/netbsd32_syscallargs.h>
98
99 #include <compat/sys/mman.h>
100
101 #if defined(DDB)
102 #include <ddb/ddbvar.h>
103 #endif
104
105 #ifdef __HAVE_SYSCALL_INTERN
106 void netbsd32_syscall_intern(struct proc *);
107 #else
108 void syscall(void);
109 #endif
110
111 #ifdef MODULAR
112 #include <compat/netbsd32/netbsd32_syscalls_autoload.c>
113 #endif
114
115 struct emul emul_netbsd32 = {
116 .e_name = "netbsd32",
117 .e_path = "/emul/netbsd32",
118 #ifndef __HAVE_MINIMAL_EMUL
119 .e_flags = 0,
120 .e_errno = NULL,
121 .e_nosys = NETBSD32_SYS_netbsd32_syscall,
122 .e_nsysent = NETBSD32_SYS_NSYSENT,
123 #endif
124 .e_sysent = netbsd32_sysent,
125 .e_nomodbits = netbsd32_sysent_nomodbits,
126 #ifdef SYSCALL_DEBUG
127 .e_syscallnames = netbsd32_syscallnames,
128 #else
129 .e_syscallnames = NULL,
130 #endif
131 #ifdef MODULAR
132 .e_sc_autoload = netbsd32_syscalls_autoload,
133 #endif
134 .e_sendsig = netbsd32_sendsig,
135 .e_trapsignal = trapsignal,
136 .e_sigcode = NULL,
137 .e_esigcode = NULL,
138 .e_sigobject = NULL,
139 .e_setregs = netbsd32_setregs,
140 .e_proc_exec = NULL,
141 .e_proc_fork = NULL,
142 .e_proc_exit = NULL,
143 .e_lwp_fork = NULL,
144 .e_lwp_exit = NULL,
145 #ifdef __HAVE_SYSCALL_INTERN
146 .e_syscall_intern = netbsd32_syscall_intern,
147 #else
148 .e_syscall = syscall,
149 #endif
150 .e_sysctlovly = &netbsd32_sysctl_root,
151 .e_vm_default_addr = netbsd32_vm_default_addr,
152 .e_usertrap = NULL,
153 .e_ucsize = sizeof(ucontext32_t),
154 .e_startlwp = startlwp32,
155 #ifdef notyet
156 .e_ktrpsig = netbsd32_ktrpsig,
157 #else
158 .e_ktrpsig = NULL,
159 #endif
160 };
161
162 int
netbsd32_exit(struct lwp * l,const struct netbsd32_exit_args * uap,register_t * retval)163 netbsd32_exit(struct lwp *l, const struct netbsd32_exit_args *uap, register_t *retval)
164 {
165 /* {
166 syscallarg(int) rval;
167 } */
168 struct sys_exit_args ua;
169
170 NETBSD32TO64_UAP(rval);
171 return sys_exit(l, &ua, retval);
172 }
173
174 int
netbsd32_read(struct lwp * l,const struct netbsd32_read_args * uap,register_t * retval)175 netbsd32_read(struct lwp *l, const struct netbsd32_read_args *uap, register_t *retval)
176 {
177 /* {
178 syscallarg(int) fd;
179 syscallarg(netbsd32_voidp) buf;
180 syscallarg(netbsd32_size_t) nbyte;
181 } */
182 struct sys_read_args ua;
183
184 if (SCARG(uap, nbyte) > NETBSD32_SSIZE_MAX)
185 return EINVAL;
186
187 NETBSD32TO64_UAP(fd);
188 NETBSD32TOP_UAP(buf, void *);
189 NETBSD32TOX_UAP(nbyte, size_t);
190 return sys_read(l, &ua, retval);
191 }
192
193 int
netbsd32_write(struct lwp * l,const struct netbsd32_write_args * uap,register_t * retval)194 netbsd32_write(struct lwp *l, const struct netbsd32_write_args *uap, register_t *retval)
195 {
196 /* {
197 syscallarg(int) fd;
198 syscallarg(const netbsd32_voidp) buf;
199 syscallarg(netbsd32_size_t) nbyte;
200 } */
201 struct sys_write_args ua;
202
203 if (SCARG(uap, nbyte) > NETBSD32_SSIZE_MAX)
204 return EINVAL;
205
206 NETBSD32TO64_UAP(fd);
207 NETBSD32TOP_UAP(buf, void *);
208 NETBSD32TOX_UAP(nbyte, size_t);
209 return sys_write(l, &ua, retval);
210 }
211
212 int
netbsd32_close(struct lwp * l,const struct netbsd32_close_args * uap,register_t * retval)213 netbsd32_close(struct lwp *l, const struct netbsd32_close_args *uap, register_t *retval)
214 {
215 /* {
216 syscallarg(int) fd;
217 } */
218 struct sys_close_args ua;
219
220 NETBSD32TO64_UAP(fd);
221 return sys_close(l, &ua, retval);
222 }
223
224 int
netbsd32_open(struct lwp * l,const struct netbsd32_open_args * uap,register_t * retval)225 netbsd32_open(struct lwp *l, const struct netbsd32_open_args *uap, register_t *retval)
226 {
227 /* {
228 syscallarg(const netbsd32_charp) path;
229 syscallarg(int) flags;
230 syscallarg(mode_t) mode;
231 } */
232 struct sys_open_args ua;
233
234 NETBSD32TOP_UAP(path, const char);
235 NETBSD32TO64_UAP(flags);
236 NETBSD32TO64_UAP(mode);
237
238 return sys_open(l, &ua, retval);
239 }
240
241 int
netbsd32_link(struct lwp * l,const struct netbsd32_link_args * uap,register_t * retval)242 netbsd32_link(struct lwp *l, const struct netbsd32_link_args *uap, register_t *retval)
243 {
244 /* {
245 syscallarg(const netbsd32_charp) path;
246 syscallarg(const netbsd32_charp) link;
247 } */
248 struct sys_link_args ua;
249
250 NETBSD32TOP_UAP(path, const char);
251 NETBSD32TOP_UAP(link, const char);
252 return sys_link(l, &ua, retval);
253 }
254
255 int
netbsd32_unlink(struct lwp * l,const struct netbsd32_unlink_args * uap,register_t * retval)256 netbsd32_unlink(struct lwp *l, const struct netbsd32_unlink_args *uap, register_t *retval)
257 {
258 /* {
259 syscallarg(const netbsd32_charp) path;
260 } */
261 struct sys_unlink_args ua;
262
263 NETBSD32TOP_UAP(path, const char);
264
265 return sys_unlink(l, &ua, retval);
266 }
267
268 int
netbsd32_chdir(struct lwp * l,const struct netbsd32_chdir_args * uap,register_t * retval)269 netbsd32_chdir(struct lwp *l, const struct netbsd32_chdir_args *uap, register_t *retval)
270 {
271 /* {
272 syscallarg(const netbsd32_charp) path;
273 } */
274 struct sys_chdir_args ua;
275
276 NETBSD32TOP_UAP(path, const char);
277
278 return sys_chdir(l, &ua, retval);
279 }
280
281 int
netbsd32_fchdir(struct lwp * l,const struct netbsd32_fchdir_args * uap,register_t * retval)282 netbsd32_fchdir(struct lwp *l, const struct netbsd32_fchdir_args *uap, register_t *retval)
283 {
284 /* {
285 syscallarg(int) fd;
286 } */
287 struct sys_fchdir_args ua;
288
289 NETBSD32TO64_UAP(fd);
290
291 return sys_fchdir(l, &ua, retval);
292 }
293
294 int
netbsd32___mknod50(struct lwp * l,const struct netbsd32___mknod50_args * uap,register_t * retval)295 netbsd32___mknod50(struct lwp *l, const struct netbsd32___mknod50_args *uap, register_t *retval)
296 {
297 /* {
298 syscallarg(const netbsd32_charp) path;
299 syscallarg(mode_t) mode;
300 syscallarg(netbsd32_dev_t) dev;
301 } */
302
303 return do_posix_mknodat(l, AT_FDCWD, SCARG_P32(uap, path),
304 SCARG(uap, mode), SCARG(uap, dev));
305 }
306
307 int
netbsd32_chmod(struct lwp * l,const struct netbsd32_chmod_args * uap,register_t * retval)308 netbsd32_chmod(struct lwp *l, const struct netbsd32_chmod_args *uap, register_t *retval)
309 {
310 /* {
311 syscallarg(const netbsd32_charp) path;
312 syscallarg(mode_t) mode;
313 } */
314 struct sys_chmod_args ua;
315
316 NETBSD32TOP_UAP(path, const char);
317 NETBSD32TO64_UAP(mode);
318
319 return sys_chmod(l, &ua, retval);
320 }
321
322 int
netbsd32_chown(struct lwp * l,const struct netbsd32_chown_args * uap,register_t * retval)323 netbsd32_chown(struct lwp *l, const struct netbsd32_chown_args *uap, register_t *retval)
324 {
325 /* {
326 syscallarg(const netbsd32_charp) path;
327 syscallarg(uid_t) uid;
328 syscallarg(gid_t) gid;
329 } */
330 struct sys_chown_args ua;
331
332 NETBSD32TOP_UAP(path, const char);
333 NETBSD32TO64_UAP(uid);
334 NETBSD32TO64_UAP(gid);
335
336 return sys_chown(l, &ua, retval);
337 }
338
339 int
netbsd32_break(struct lwp * l,const struct netbsd32_break_args * uap,register_t * retval)340 netbsd32_break(struct lwp *l, const struct netbsd32_break_args *uap, register_t *retval)
341 {
342 /* {
343 syscallarg(netbsd32_charp) nsize;
344 } */
345 struct sys_obreak_args ua;
346
347 NETBSD32TOP_UAP(nsize, char);
348
349 return sys_obreak(l, &ua, retval);
350 }
351
352 int
netbsd32_unmount(struct lwp * l,const struct netbsd32_unmount_args * uap,register_t * retval)353 netbsd32_unmount(struct lwp *l, const struct netbsd32_unmount_args *uap, register_t *retval)
354 {
355 /* {
356 syscallarg(const netbsd32_charp) path;
357 syscallarg(int) flags;
358 } */
359 struct sys_unmount_args ua;
360
361 NETBSD32TOP_UAP(path, const char);
362 NETBSD32TO64_UAP(flags);
363
364 return sys_unmount(l, &ua, retval);
365 }
366
367 int
netbsd32_setuid(struct lwp * l,const struct netbsd32_setuid_args * uap,register_t * retval)368 netbsd32_setuid(struct lwp *l, const struct netbsd32_setuid_args *uap, register_t *retval)
369 {
370 /* {
371 syscallarg(uid_t) uid;
372 } */
373 struct sys_setuid_args ua;
374
375 NETBSD32TO64_UAP(uid);
376
377 return sys_setuid(l, &ua, retval);
378 }
379
380 int
netbsd32_accept(struct lwp * l,const struct netbsd32_accept_args * uap,register_t * retval)381 netbsd32_accept(struct lwp *l, const struct netbsd32_accept_args *uap, register_t *retval)
382 {
383 /* {
384 syscallarg(int) s;
385 syscallarg(netbsd32_sockaddrp_t) name;
386 syscallarg(netbsd32_intp) anamelen;
387 } */
388 struct sys_accept_args ua;
389
390 NETBSD32TO64_UAP(s);
391 NETBSD32TOP_UAP(name, struct sockaddr);
392 NETBSD32TOP_UAP(anamelen, socklen_t);
393
394 return sys_accept(l, &ua, retval);
395 }
396
397 int
netbsd32_getpeername(struct lwp * l,const struct netbsd32_getpeername_args * uap,register_t * retval)398 netbsd32_getpeername(struct lwp *l, const struct netbsd32_getpeername_args *uap, register_t *retval)
399 {
400 /* {
401 syscallarg(int) fdes;
402 syscallarg(netbsd32_sockaddrp_t) asa;
403 syscallarg(netbsd32_intp) alen;
404 } */
405 struct sys_getpeername_args ua;
406
407 NETBSD32TO64_UAP(fdes);
408 NETBSD32TOP_UAP(asa, struct sockaddr);
409 NETBSD32TOP_UAP(alen, socklen_t);
410 /* NB: do the protocol specific sockaddrs need to be converted? */
411
412 return sys_getpeername(l, &ua, retval);
413 }
414
415 int
netbsd32_getsockname(struct lwp * l,const struct netbsd32_getsockname_args * uap,register_t * retval)416 netbsd32_getsockname(struct lwp *l, const struct netbsd32_getsockname_args *uap, register_t *retval)
417 {
418 /* {
419 syscallarg(int) fdes;
420 syscallarg(netbsd32_sockaddrp_t) asa;
421 syscallarg(netbsd32_intp) alen;
422 } */
423 struct sys_getsockname_args ua;
424
425 NETBSD32TO64_UAP(fdes);
426 NETBSD32TOP_UAP(asa, struct sockaddr);
427 NETBSD32TOP_UAP(alen, socklen_t);
428
429 return sys_getsockname(l, &ua, retval);
430 }
431
432 int
netbsd32_access(struct lwp * l,const struct netbsd32_access_args * uap,register_t * retval)433 netbsd32_access(struct lwp *l, const struct netbsd32_access_args *uap, register_t *retval)
434 {
435 /* {
436 syscallarg(const netbsd32_charp) path;
437 syscallarg(int) flags;
438 } */
439 struct sys_access_args ua;
440
441 NETBSD32TOP_UAP(path, const char);
442 NETBSD32TO64_UAP(flags);
443
444 return sys_access(l, &ua, retval);
445 }
446
447 int
netbsd32_chflags(struct lwp * l,const struct netbsd32_chflags_args * uap,register_t * retval)448 netbsd32_chflags(struct lwp *l, const struct netbsd32_chflags_args *uap, register_t *retval)
449 {
450 /* {
451 syscallarg(const netbsd32_charp) path;
452 syscallarg(netbsd32_u_long) flags;
453 } */
454 struct sys_chflags_args ua;
455
456 NETBSD32TOP_UAP(path, const char);
457 NETBSD32TO64_UAP(flags);
458
459 return sys_chflags(l, &ua, retval);
460 }
461
462 int
netbsd32_fchflags(struct lwp * l,const struct netbsd32_fchflags_args * uap,register_t * retval)463 netbsd32_fchflags(struct lwp *l, const struct netbsd32_fchflags_args *uap, register_t *retval)
464 {
465 /* {
466 syscallarg(int) fd;
467 syscallarg(netbsd32_u_long) flags;
468 } */
469 struct sys_fchflags_args ua;
470
471 NETBSD32TO64_UAP(fd);
472 NETBSD32TO64_UAP(flags);
473
474 return sys_fchflags(l, &ua, retval);
475 }
476
477 int
netbsd32_lchflags(struct lwp * l,const struct netbsd32_lchflags_args * uap,register_t * retval)478 netbsd32_lchflags(struct lwp *l, const struct netbsd32_lchflags_args *uap, register_t *retval)
479 {
480 /* {
481 syscallarg(const char *) path;
482 syscallarg(netbsd32_u_long) flags;
483 } */
484 struct sys_lchflags_args ua;
485
486 NETBSD32TOP_UAP(path, const char);
487 NETBSD32TO64_UAP(flags);
488
489 return sys_lchflags(l, &ua, retval);
490 }
491
492 int
netbsd32_kill(struct lwp * l,const struct netbsd32_kill_args * uap,register_t * retval)493 netbsd32_kill(struct lwp *l, const struct netbsd32_kill_args *uap, register_t *retval)
494 {
495 /* {
496 syscallarg(int) pid;
497 syscallarg(int) signum;
498 } */
499 struct sys_kill_args ua;
500
501 NETBSD32TO64_UAP(pid);
502 NETBSD32TO64_UAP(signum);
503
504 return sys_kill(l, &ua, retval);
505 }
506
507 int
netbsd32_dup(struct lwp * l,const struct netbsd32_dup_args * uap,register_t * retval)508 netbsd32_dup(struct lwp *l, const struct netbsd32_dup_args *uap, register_t *retval)
509 {
510 /* {
511 syscallarg(int) fd;
512 } */
513 struct sys_dup_args ua;
514
515 NETBSD32TO64_UAP(fd);
516
517 return sys_dup(l, &ua, retval);
518 }
519
520 int
netbsd32_profil(struct lwp * l,const struct netbsd32_profil_args * uap,register_t * retval)521 netbsd32_profil(struct lwp *l, const struct netbsd32_profil_args *uap, register_t *retval)
522 {
523 /* {
524 syscallarg(netbsd32_voidp) samples;
525 syscallarg(netbsd32_size_t) size;
526 syscallarg(netbsd32_u_long) offset;
527 syscallarg(u_int) scale;
528 } */
529 struct sys_profil_args ua;
530
531 NETBSD32TOP_UAP(samples, void *);
532 NETBSD32TOX_UAP(size, size_t);
533 NETBSD32TOX_UAP(offset, u_long);
534 NETBSD32TO64_UAP(scale);
535
536 return sys_profil(l, &ua, retval);
537 }
538
539 int
netbsd32_ktrace(struct lwp * l,const struct netbsd32_ktrace_args * uap,register_t * retval)540 netbsd32_ktrace(struct lwp *l, const struct netbsd32_ktrace_args *uap, register_t *retval)
541 {
542 /* {
543 syscallarg(const netbsd32_charp) fname;
544 syscallarg(int) ops;
545 syscallarg(int) facs;
546 syscallarg(int) pid;
547 } */
548 struct sys_ktrace_args ua;
549
550 NETBSD32TOP_UAP(fname, const char);
551 NETBSD32TO64_UAP(ops);
552 NETBSD32TO64_UAP(facs);
553 NETBSD32TO64_UAP(pid);
554
555 return sys_ktrace(l, &ua, retval);
556 }
557
558 int
netbsd32_utrace(struct lwp * l,const struct netbsd32_utrace_args * uap,register_t * retval)559 netbsd32_utrace(struct lwp *l, const struct netbsd32_utrace_args *uap, register_t *retval)
560 {
561 /* {
562 syscallarg(const netbsd32_charp) label;
563 syscallarg(netbsd32_voidp) addr;
564 syscallarg(netbsd32_size_t) len;
565 } */
566 struct sys_utrace_args ua;
567
568 NETBSD32TOP_UAP(label, const char);
569 NETBSD32TOP_UAP(addr, void);
570 NETBSD32TO64_UAP(len);
571
572 return sys_utrace(l, &ua, retval);
573 }
574
575 int
netbsd32___getlogin(struct lwp * l,const struct netbsd32___getlogin_args * uap,register_t * retval)576 netbsd32___getlogin(struct lwp *l, const struct netbsd32___getlogin_args *uap, register_t *retval)
577 {
578 /* {
579 syscallarg(netbsd32_charp) namebuf;
580 syscallarg(u_int) namelen;
581 } */
582 struct sys___getlogin_args ua;
583
584 NETBSD32TOP_UAP(namebuf, char);
585 NETBSD32TO64_UAP(namelen);
586
587 return sys___getlogin(l, &ua, retval);
588 }
589
590 int
netbsd32_setlogin(struct lwp * l,const struct netbsd32_setlogin_args * uap,register_t * retval)591 netbsd32_setlogin(struct lwp *l, const struct netbsd32_setlogin_args *uap, register_t *retval)
592 {
593 /* {
594 syscallarg(const netbsd32_charp) namebuf;
595 } */
596 struct sys___setlogin_args ua;
597
598 NETBSD32TOP_UAP(namebuf, char);
599
600 return sys___setlogin(l, &ua, retval);
601 }
602
603 int
netbsd32_acct(struct lwp * l,const struct netbsd32_acct_args * uap,register_t * retval)604 netbsd32_acct(struct lwp *l, const struct netbsd32_acct_args *uap, register_t *retval)
605 {
606 /* {
607 syscallarg(const netbsd32_charp) path;
608 } */
609 struct sys_acct_args ua;
610
611 NETBSD32TOP_UAP(path, const char);
612
613 return sys_acct(l, &ua, retval);
614 }
615
616 int
netbsd32_revoke(struct lwp * l,const struct netbsd32_revoke_args * uap,register_t * retval)617 netbsd32_revoke(struct lwp *l, const struct netbsd32_revoke_args *uap, register_t *retval)
618 {
619 /* {
620 syscallarg(const netbsd32_charp) path;
621 } */
622 struct sys_revoke_args ua;
623
624 NETBSD32TOP_UAP(path, const char);
625
626 return sys_revoke(l, &ua, retval);
627 }
628
629 int
netbsd32_symlink(struct lwp * l,const struct netbsd32_symlink_args * uap,register_t * retval)630 netbsd32_symlink(struct lwp *l, const struct netbsd32_symlink_args *uap, register_t *retval)
631 {
632 /* {
633 syscallarg(const netbsd32_charp) path;
634 syscallarg(const netbsd32_charp) link;
635 } */
636 struct sys_symlink_args ua;
637
638 NETBSD32TOP_UAP(path, const char);
639 NETBSD32TOP_UAP(link, const char);
640
641 return sys_symlink(l, &ua, retval);
642 }
643
644 int
netbsd32_readlink(struct lwp * l,const struct netbsd32_readlink_args * uap,register_t * retval)645 netbsd32_readlink(struct lwp *l, const struct netbsd32_readlink_args *uap, register_t *retval)
646 {
647 /* {
648 syscallarg(const netbsd32_charp) path;
649 syscallarg(netbsd32_charp) buf;
650 syscallarg(netbsd32_size_t) count;
651 } */
652 struct sys_readlink_args ua;
653
654 NETBSD32TOP_UAP(path, const char);
655 NETBSD32TOP_UAP(buf, char);
656 NETBSD32TOX_UAP(count, size_t);
657
658 return sys_readlink(l, &ua, retval);
659 }
660
661 int
netbsd32_umask(struct lwp * l,const struct netbsd32_umask_args * uap,register_t * retval)662 netbsd32_umask(struct lwp *l, const struct netbsd32_umask_args *uap, register_t *retval)
663 {
664 /* {
665 syscallarg(mode_t) newmask;
666 } */
667 struct sys_umask_args ua;
668
669 NETBSD32TO64_UAP(newmask);
670
671 return sys_umask(l, &ua, retval);
672 }
673
674 int
netbsd32_chroot(struct lwp * l,const struct netbsd32_chroot_args * uap,register_t * retval)675 netbsd32_chroot(struct lwp *l, const struct netbsd32_chroot_args *uap, register_t *retval)
676 {
677 /* {
678 syscallarg(const netbsd32_charp) path;
679 } */
680 struct sys_chroot_args ua;
681
682 NETBSD32TOP_UAP(path, const char);
683
684 return sys_chroot(l, &ua, retval);
685 }
686
687 int
netbsd32_munmap(struct lwp * l,const struct netbsd32_munmap_args * uap,register_t * retval)688 netbsd32_munmap(struct lwp *l, const struct netbsd32_munmap_args *uap, register_t *retval)
689 {
690 /* {
691 syscallarg(netbsd32_voidp) addr;
692 syscallarg(netbsd32_size_t) len;
693 } */
694 struct sys_munmap_args ua;
695
696 NETBSD32TOP_UAP(addr, void);
697 NETBSD32TOX_UAP(len, size_t);
698
699 return sys_munmap(l, &ua, retval);
700 }
701
702 int
netbsd32_mprotect(struct lwp * l,const struct netbsd32_mprotect_args * uap,register_t * retval)703 netbsd32_mprotect(struct lwp *l, const struct netbsd32_mprotect_args *uap, register_t *retval)
704 {
705 /* {
706 syscallarg(netbsd32_voidp) addr;
707 syscallarg(netbsd32_size_t) len;
708 syscallarg(int) prot;
709 } */
710 struct sys_mprotect_args ua;
711
712 NETBSD32TOP_UAP(addr, void);
713 NETBSD32TOX_UAP(len, size_t);
714 NETBSD32TO64_UAP(prot);
715
716 return sys_mprotect(l, &ua, retval);
717 }
718
719 int
netbsd32_madvise(struct lwp * l,const struct netbsd32_madvise_args * uap,register_t * retval)720 netbsd32_madvise(struct lwp *l, const struct netbsd32_madvise_args *uap, register_t *retval)
721 {
722 /* {
723 syscallarg(netbsd32_voidp) addr;
724 syscallarg(netbsd32_size_t) len;
725 syscallarg(int) behav;
726 } */
727 struct sys_madvise_args ua;
728
729 NETBSD32TOP_UAP(addr, void);
730 NETBSD32TOX_UAP(len, size_t);
731 NETBSD32TO64_UAP(behav);
732
733 return sys_madvise(l, &ua, retval);
734 }
735
736 int
netbsd32_mincore(struct lwp * l,const struct netbsd32_mincore_args * uap,register_t * retval)737 netbsd32_mincore(struct lwp *l, const struct netbsd32_mincore_args *uap, register_t *retval)
738 {
739 /* {
740 syscallarg(netbsd32_voidp) addr;
741 syscallarg(netbsd32_size_t) len;
742 syscallarg(netbsd32_charp) vec;
743 } */
744 struct sys_mincore_args ua;
745
746 NETBSD32TOP_UAP(addr, void *);
747 NETBSD32TOX_UAP(len, size_t);
748 NETBSD32TOP_UAP(vec, char);
749
750 return sys_mincore(l, &ua, retval);
751 }
752
753 int
netbsd32_getgroups(struct lwp * l,const struct netbsd32_getgroups_args * uap,register_t * retval)754 netbsd32_getgroups(struct lwp *l, const struct netbsd32_getgroups_args *uap, register_t *retval)
755 {
756 /* {
757 syscallarg(int) gidsetsize;
758 syscallarg(netbsd32_gid_tp) gidset;
759 } */
760 struct sys_getgroups_args ua;
761
762 /* Since sizeof (gid_t) == sizeof (netbsd32_gid_t) ... */
763
764 NETBSD32TO64_UAP(gidsetsize);
765 NETBSD32TOP_UAP(gidset, gid_t);
766
767 return sys_getgroups(l, &ua, retval);
768 }
769
770 int
netbsd32_setgroups(struct lwp * l,const struct netbsd32_setgroups_args * uap,register_t * retval)771 netbsd32_setgroups(struct lwp *l, const struct netbsd32_setgroups_args *uap, register_t *retval)
772 {
773 /* {
774 syscallarg(int) gidsetsize;
775 syscallarg(const netbsd32_gid_tp) gidset;
776 } */
777 struct sys_setgroups_args ua;
778
779 NETBSD32TO64_UAP(gidsetsize);
780 NETBSD32TOP_UAP(gidset, gid_t);
781
782 return sys_setgroups(l, &ua, retval);
783 }
784
785 int
netbsd32_setpgid(struct lwp * l,const struct netbsd32_setpgid_args * uap,register_t * retval)786 netbsd32_setpgid(struct lwp *l, const struct netbsd32_setpgid_args *uap, register_t *retval)
787 {
788 /* {
789 syscallarg(int) pid;
790 syscallarg(int) pgid;
791 } */
792 struct sys_setpgid_args ua;
793
794 NETBSD32TO64_UAP(pid);
795 NETBSD32TO64_UAP(pgid);
796
797 return sys_setpgid(l, &ua, retval);
798 }
799
800 int
netbsd32_fcntl(struct lwp * l,const struct netbsd32_fcntl_args * uap,register_t * retval)801 netbsd32_fcntl(struct lwp *l, const struct netbsd32_fcntl_args *uap, register_t *retval)
802 {
803 /* {
804 syscallarg(int) fd;
805 syscallarg(int) cmd;
806 syscallarg(netbsd32_voidp) arg;
807 } */
808 struct sys_fcntl_args ua;
809
810 NETBSD32TO64_UAP(fd);
811 NETBSD32TO64_UAP(cmd);
812 /* we can do this because `struct flock' doesn't change */
813 NETBSD32TOP_UAP(arg, void);
814
815 return sys_fcntl(l, &ua, retval);
816 }
817
818 int
netbsd32_dup2(struct lwp * l,const struct netbsd32_dup2_args * uap,register_t * retval)819 netbsd32_dup2(struct lwp *l, const struct netbsd32_dup2_args *uap, register_t *retval)
820 {
821 /* {
822 syscallarg(int) from;
823 syscallarg(int) to;
824 } */
825 struct sys_dup2_args ua;
826
827 NETBSD32TO64_UAP(from);
828 NETBSD32TO64_UAP(to);
829
830 return sys_dup2(l, &ua, retval);
831 }
832
833 int
netbsd32_fsync(struct lwp * l,const struct netbsd32_fsync_args * uap,register_t * retval)834 netbsd32_fsync(struct lwp *l, const struct netbsd32_fsync_args *uap, register_t *retval)
835 {
836 /* {
837 syscallarg(int) fd;
838 } */
839 struct sys_fsync_args ua;
840
841 NETBSD32TO64_UAP(fd);
842
843 return sys_fsync(l, &ua, retval);
844 }
845
846 int
netbsd32_setpriority(struct lwp * l,const struct netbsd32_setpriority_args * uap,register_t * retval)847 netbsd32_setpriority(struct lwp *l, const struct netbsd32_setpriority_args *uap, register_t *retval)
848 {
849 /* {
850 syscallarg(int) which;
851 syscallarg(int) who;
852 syscallarg(int) prio;
853 } */
854 struct sys_setpriority_args ua;
855
856 NETBSD32TO64_UAP(which);
857 NETBSD32TO64_UAP(who);
858 NETBSD32TO64_UAP(prio);
859
860 return sys_setpriority(l, &ua, retval);
861 }
862
863 int
netbsd32___socket30(struct lwp * l,const struct netbsd32___socket30_args * uap,register_t * retval)864 netbsd32___socket30(struct lwp *l, const struct netbsd32___socket30_args *uap, register_t *retval)
865 {
866 /* {
867 syscallarg(int) domain;
868 syscallarg(int) type;
869 syscallarg(int) protocol;
870 } */
871 struct sys___socket30_args ua;
872
873 NETBSD32TO64_UAP(domain);
874 NETBSD32TO64_UAP(type);
875 NETBSD32TO64_UAP(protocol);
876
877 return sys___socket30(l, &ua, retval);
878 }
879
880 int
netbsd32_connect(struct lwp * l,const struct netbsd32_connect_args * uap,register_t * retval)881 netbsd32_connect(struct lwp *l, const struct netbsd32_connect_args *uap, register_t *retval)
882 {
883 /* {
884 syscallarg(int) s;
885 syscallarg(const netbsd32_sockaddrp_t) name;
886 syscallarg(int) namelen;
887 } */
888 struct sys_connect_args ua;
889
890 NETBSD32TO64_UAP(s);
891 NETBSD32TOP_UAP(name, struct sockaddr);
892 NETBSD32TO64_UAP(namelen);
893
894 return sys_connect(l, &ua, retval);
895 }
896
897 int
netbsd32_getpriority(struct lwp * l,const struct netbsd32_getpriority_args * uap,register_t * retval)898 netbsd32_getpriority(struct lwp *l, const struct netbsd32_getpriority_args *uap, register_t *retval)
899 {
900 /* {
901 syscallarg(int) which;
902 syscallarg(int) who;
903 } */
904 struct sys_getpriority_args ua;
905
906 NETBSD32TO64_UAP(which);
907 NETBSD32TO64_UAP(who);
908
909 return sys_getpriority(l, &ua, retval);
910 }
911
912 int
netbsd32_bind(struct lwp * l,const struct netbsd32_bind_args * uap,register_t * retval)913 netbsd32_bind(struct lwp *l, const struct netbsd32_bind_args *uap, register_t *retval)
914 {
915 /* {
916 syscallarg(int) s;
917 syscallarg(const netbsd32_sockaddrp_t) name;
918 syscallarg(int) namelen;
919 } */
920 struct sys_bind_args ua;
921
922 NETBSD32TO64_UAP(s);
923 NETBSD32TOP_UAP(name, struct sockaddr);
924 NETBSD32TO64_UAP(namelen);
925
926 return sys_bind(l, &ua, retval);
927 }
928
929 int
netbsd32_setsockopt(struct lwp * l,const struct netbsd32_setsockopt_args * uap,register_t * retval)930 netbsd32_setsockopt(struct lwp *l, const struct netbsd32_setsockopt_args *uap, register_t *retval)
931 {
932 /* {
933 syscallarg(int) s;
934 syscallarg(int) level;
935 syscallarg(int) name;
936 syscallarg(const netbsd32_voidp) val;
937 syscallarg(int) valsize;
938 } */
939 struct sys_setsockopt_args ua;
940
941 NETBSD32TO64_UAP(s);
942 NETBSD32TO64_UAP(level);
943 NETBSD32TO64_UAP(name);
944 NETBSD32TOP_UAP(val, void);
945 NETBSD32TO64_UAP(valsize);
946 /* may be more efficient to do this inline. */
947
948 return sys_setsockopt(l, &ua, retval);
949 }
950
951 int
netbsd32_listen(struct lwp * l,const struct netbsd32_listen_args * uap,register_t * retval)952 netbsd32_listen(struct lwp *l, const struct netbsd32_listen_args *uap, register_t *retval)
953 {
954 /* {
955 syscallarg(int) s;
956 syscallarg(int) backlog;
957 } */
958 struct sys_listen_args ua;
959
960 NETBSD32TO64_UAP(s);
961 NETBSD32TO64_UAP(backlog);
962
963 return sys_listen(l, &ua, retval);
964 }
965
966 int
netbsd32_fchown(struct lwp * l,const struct netbsd32_fchown_args * uap,register_t * retval)967 netbsd32_fchown(struct lwp *l, const struct netbsd32_fchown_args *uap, register_t *retval)
968 {
969 /* {
970 syscallarg(int) fd;
971 syscallarg(uid_t) uid;
972 syscallarg(gid_t) gid;
973 } */
974 struct sys_fchown_args ua;
975
976 NETBSD32TO64_UAP(fd);
977 NETBSD32TO64_UAP(uid);
978 NETBSD32TO64_UAP(gid);
979
980 return sys_fchown(l, &ua, retval);
981 }
982
983 int
netbsd32_fchmod(struct lwp * l,const struct netbsd32_fchmod_args * uap,register_t * retval)984 netbsd32_fchmod(struct lwp *l, const struct netbsd32_fchmod_args *uap, register_t *retval)
985 {
986 /* {
987 syscallarg(int) fd;
988 syscallarg(mode_t) mode;
989 } */
990 struct sys_fchmod_args ua;
991
992 NETBSD32TO64_UAP(fd);
993 NETBSD32TO64_UAP(mode);
994
995 return sys_fchmod(l, &ua, retval);
996 }
997
998 int
netbsd32_setreuid(struct lwp * l,const struct netbsd32_setreuid_args * uap,register_t * retval)999 netbsd32_setreuid(struct lwp *l, const struct netbsd32_setreuid_args *uap, register_t *retval)
1000 {
1001 /* {
1002 syscallarg(uid_t) ruid;
1003 syscallarg(uid_t) euid;
1004 } */
1005 struct sys_setreuid_args ua;
1006
1007 NETBSD32TO64_UAP(ruid);
1008 NETBSD32TO64_UAP(euid);
1009 return sys_setreuid(l, &ua, retval);
1010 }
1011
1012 int
netbsd32_setregid(struct lwp * l,const struct netbsd32_setregid_args * uap,register_t * retval)1013 netbsd32_setregid(struct lwp *l, const struct netbsd32_setregid_args *uap, register_t *retval)
1014 {
1015 /* {
1016 syscallarg(gid_t) rgid;
1017 syscallarg(gid_t) egid;
1018 } */
1019 struct sys_setregid_args ua;
1020
1021 NETBSD32TO64_UAP(rgid);
1022 NETBSD32TO64_UAP(egid);
1023
1024 return sys_setregid(l, &ua, retval);
1025 }
1026
1027 int
netbsd32_getsockopt(struct lwp * l,const struct netbsd32_getsockopt_args * uap,register_t * retval)1028 netbsd32_getsockopt(struct lwp *l, const struct netbsd32_getsockopt_args *uap, register_t *retval)
1029 {
1030 /* {
1031 syscallarg(int) s;
1032 syscallarg(int) level;
1033 syscallarg(int) name;
1034 syscallarg(netbsd32_voidp) val;
1035 syscallarg(netbsd32_intp) avalsize;
1036 } */
1037 struct sys_getsockopt_args ua;
1038
1039 NETBSD32TO64_UAP(s);
1040 NETBSD32TO64_UAP(level);
1041 NETBSD32TO64_UAP(name);
1042 NETBSD32TOP_UAP(val, void);
1043 NETBSD32TOP_UAP(avalsize, socklen_t);
1044
1045 return sys_getsockopt(l, &ua, retval);
1046 }
1047
1048 int
netbsd32_getsockopt2(struct lwp * l,const struct netbsd32_getsockopt2_args * uap,register_t * retval)1049 netbsd32_getsockopt2(struct lwp *l, const struct netbsd32_getsockopt2_args *uap, register_t *retval)
1050 {
1051 /* {
1052 syscallarg(int) s;
1053 syscallarg(int) level;
1054 syscallarg(int) name;
1055 syscallarg(netbsd32_voidp) val;
1056 syscallarg(netbsd32_intp) avalsize;
1057 } */
1058 struct sys_getsockopt2_args ua;
1059
1060 NETBSD32TO64_UAP(s);
1061 NETBSD32TO64_UAP(level);
1062 NETBSD32TO64_UAP(name);
1063 NETBSD32TOP_UAP(val, void);
1064 NETBSD32TOP_UAP(avalsize, socklen_t);
1065
1066 return sys_getsockopt2(l, &ua, retval);
1067 }
1068
1069 int
netbsd32_rename(struct lwp * l,const struct netbsd32_rename_args * uap,register_t * retval)1070 netbsd32_rename(struct lwp *l, const struct netbsd32_rename_args *uap, register_t *retval)
1071 {
1072 /* {
1073 syscallarg(const netbsd32_charp) from;
1074 syscallarg(const netbsd32_charp) to;
1075 } */
1076 struct sys_rename_args ua;
1077
1078 NETBSD32TOP_UAP(from, const char);
1079 NETBSD32TOP_UAP(to, const char);
1080
1081 return sys_rename(l, &ua, retval);
1082 }
1083
1084 int
netbsd32_flock(struct lwp * l,const struct netbsd32_flock_args * uap,register_t * retval)1085 netbsd32_flock(struct lwp *l, const struct netbsd32_flock_args *uap, register_t *retval)
1086 {
1087 /* {
1088 syscallarg(int) fd;
1089 syscallarg(int) how;
1090 } */
1091 struct sys_flock_args ua;
1092
1093 NETBSD32TO64_UAP(fd);
1094 NETBSD32TO64_UAP(how);
1095
1096 return sys_flock(l, &ua, retval);
1097 }
1098
1099 int
netbsd32_mkfifo(struct lwp * l,const struct netbsd32_mkfifo_args * uap,register_t * retval)1100 netbsd32_mkfifo(struct lwp *l, const struct netbsd32_mkfifo_args *uap, register_t *retval)
1101 {
1102 /* {
1103 syscallarg(const netbsd32_charp) path;
1104 syscallarg(mode_t) mode;
1105 } */
1106 struct sys_mkfifo_args ua;
1107
1108 NETBSD32TOP_UAP(path, const char);
1109 NETBSD32TO64_UAP(mode);
1110
1111 return sys_mkfifo(l, &ua, retval);
1112 }
1113
1114 int
netbsd32_shutdown(struct lwp * l,const struct netbsd32_shutdown_args * uap,register_t * retval)1115 netbsd32_shutdown(struct lwp *l, const struct netbsd32_shutdown_args *uap, register_t *retval)
1116 {
1117 /* {
1118 syscallarg(int) s;
1119 syscallarg(int) how;
1120 } */
1121 struct sys_shutdown_args ua;
1122
1123 NETBSD32TO64_UAP(s);
1124 NETBSD32TO64_UAP(how);
1125
1126 return sys_shutdown(l, &ua, retval);
1127 }
1128
1129 int
netbsd32_socketpair(struct lwp * l,const struct netbsd32_socketpair_args * uap,register_t * retval)1130 netbsd32_socketpair(struct lwp *l, const struct netbsd32_socketpair_args *uap, register_t *retval)
1131 {
1132 /* {
1133 syscallarg(int) domain;
1134 syscallarg(int) type;
1135 syscallarg(int) protocol;
1136 syscallarg(netbsd32_intp) rsv;
1137 } */
1138 struct sys_socketpair_args ua;
1139
1140 NETBSD32TO64_UAP(domain);
1141 NETBSD32TO64_UAP(type);
1142 NETBSD32TO64_UAP(protocol);
1143 NETBSD32TOP_UAP(rsv, int);
1144
1145 /* Since we're just copying out two `int's we can do this */
1146 return sys_socketpair(l, &ua, retval);
1147 }
1148
1149 int
netbsd32_mkdir(struct lwp * l,const struct netbsd32_mkdir_args * uap,register_t * retval)1150 netbsd32_mkdir(struct lwp *l, const struct netbsd32_mkdir_args *uap, register_t *retval)
1151 {
1152 /* {
1153 syscallarg(const netbsd32_charp) path;
1154 syscallarg(mode_t) mode;
1155 } */
1156 struct sys_mkdir_args ua;
1157
1158 NETBSD32TOP_UAP(path, const char);
1159 NETBSD32TO64_UAP(mode);
1160
1161 return sys_mkdir(l, &ua, retval);
1162 }
1163
1164 int
netbsd32_rmdir(struct lwp * l,const struct netbsd32_rmdir_args * uap,register_t * retval)1165 netbsd32_rmdir(struct lwp *l, const struct netbsd32_rmdir_args *uap, register_t *retval)
1166 {
1167 /* {
1168 syscallarg(const netbsd32_charp) path;
1169 } */
1170 struct sys_rmdir_args ua;
1171
1172 NETBSD32TOP_UAP(path, const char);
1173
1174 return sys_rmdir(l, &ua, retval);
1175 }
1176
1177 int
netbsd32_pread(struct lwp * l,const struct netbsd32_pread_args * uap,register_t * retval)1178 netbsd32_pread(struct lwp *l, const struct netbsd32_pread_args *uap, register_t *retval)
1179 {
1180 /* {
1181 syscallarg(int) fd;
1182 syscallarg(netbsd32_voidp) buf;
1183 syscallarg(netbsd32_size_t) nbyte;
1184 syscallarg(int) PAD;
1185 syscallarg(netbsd32_off_t) offset;
1186 } */
1187 struct sys_pread_args ua;
1188
1189 if (SCARG(uap, nbyte) > NETBSD32_SSIZE_MAX)
1190 return EINVAL;
1191
1192 NETBSD32TO64_UAP(fd);
1193 NETBSD32TOP_UAP(buf, void);
1194 NETBSD32TOX_UAP(nbyte, size_t);
1195 NETBSD32TO64_UAP(PAD);
1196 NETBSD32TO64_UAP(offset);
1197
1198 return sys_pread(l, &ua, retval);
1199 }
1200
1201 int
netbsd32_pwrite(struct lwp * l,const struct netbsd32_pwrite_args * uap,register_t * retval)1202 netbsd32_pwrite(struct lwp *l, const struct netbsd32_pwrite_args *uap, register_t *retval)
1203 {
1204 /* {
1205 syscallarg(int) fd;
1206 syscallarg(const netbsd32_voidp) buf;
1207 syscallarg(netbsd32_size_t) nbyte;
1208 syscallarg(int) PAD;
1209 syscallarg(netbsd32_off_t) offset;
1210 } */
1211 struct sys_pwrite_args ua;
1212
1213 if (SCARG(uap, nbyte) > NETBSD32_SSIZE_MAX)
1214 return EINVAL;
1215
1216 NETBSD32TO64_UAP(fd);
1217 NETBSD32TOP_UAP(buf, void);
1218 NETBSD32TOX_UAP(nbyte, size_t);
1219 NETBSD32TO64_UAP(PAD);
1220 NETBSD32TO64_UAP(offset);
1221
1222 return sys_pwrite(l, &ua, retval);
1223 }
1224
1225 int
netbsd32_setgid(struct lwp * l,const struct netbsd32_setgid_args * uap,register_t * retval)1226 netbsd32_setgid(struct lwp *l, const struct netbsd32_setgid_args *uap, register_t *retval)
1227 {
1228 /* {
1229 syscallarg(gid_t) gid;
1230 } */
1231 struct sys_setgid_args ua;
1232
1233 NETBSD32TO64_UAP(gid);
1234
1235 return sys_setgid(l, &ua, retval);
1236 }
1237
1238 int
netbsd32_setegid(struct lwp * l,const struct netbsd32_setegid_args * uap,register_t * retval)1239 netbsd32_setegid(struct lwp *l, const struct netbsd32_setegid_args *uap, register_t *retval)
1240 {
1241 /* {
1242 syscallarg(gid_t) egid;
1243 } */
1244 struct sys_setegid_args ua;
1245
1246 NETBSD32TO64_UAP(egid);
1247
1248 return sys_setegid(l, &ua, retval);
1249 }
1250
1251 int
netbsd32_seteuid(struct lwp * l,const struct netbsd32_seteuid_args * uap,register_t * retval)1252 netbsd32_seteuid(struct lwp *l, const struct netbsd32_seteuid_args *uap, register_t *retval)
1253 {
1254 /* {
1255 syscallarg(gid_t) euid;
1256 } */
1257 struct sys_seteuid_args ua;
1258
1259 NETBSD32TO64_UAP(euid);
1260
1261 return sys_seteuid(l, &ua, retval);
1262 }
1263
1264 int
netbsd32_lpathconf(struct lwp * l,const struct netbsd32_lpathconf_args * uap,register_t * retval)1265 netbsd32_lpathconf(struct lwp *l, const struct netbsd32_lpathconf_args *uap, register_t *retval)
1266 {
1267 /* {
1268 syscallarg(netbsd32_charp) path;
1269 syscallarg(int) name;
1270 } */
1271 struct sys_lpathconf_args ua;
1272
1273 NETBSD32TOP_UAP(path, const char);
1274 NETBSD32TO64_UAP(name);
1275
1276 return sys_lpathconf(l, &ua, retval);
1277 }
1278
1279 int
netbsd32_pathconf(struct lwp * l,const struct netbsd32_pathconf_args * uap,register_t * retval)1280 netbsd32_pathconf(struct lwp *l, const struct netbsd32_pathconf_args *uap, register_t *retval)
1281 {
1282 /* {
1283 syscallarg(netbsd32_charp) path;
1284 syscallarg(int) name;
1285 } */
1286 struct sys_pathconf_args ua;
1287
1288 NETBSD32TOP_UAP(path, const char);
1289 NETBSD32TO64_UAP(name);
1290
1291 return sys_pathconf(l, &ua, retval);
1292 }
1293
1294 int
netbsd32_fpathconf(struct lwp * l,const struct netbsd32_fpathconf_args * uap,register_t * retval)1295 netbsd32_fpathconf(struct lwp *l, const struct netbsd32_fpathconf_args *uap, register_t *retval)
1296 {
1297 /* {
1298 syscallarg(int) fd;
1299 syscallarg(int) name;
1300 } */
1301 struct sys_fpathconf_args ua;
1302
1303 NETBSD32TO64_UAP(fd);
1304 NETBSD32TO64_UAP(name);
1305
1306 return sys_fpathconf(l, &ua, retval);
1307 }
1308
1309 int
netbsd32_mremap(struct lwp * l,const struct netbsd32_mremap_args * uap,register_t * retval)1310 netbsd32_mremap(struct lwp *l, const struct netbsd32_mremap_args *uap, register_t *retval)
1311 {
1312 /* {
1313 syscallarg(void *) old_address;
1314 syscallarg(size_t) old_size;
1315 syscallarg(void *) new_address;
1316 syscallarg(size_t) new_size;
1317 syscallarg(int) flags;
1318 } */
1319 struct sys_mremap_args ua;
1320
1321 NETBSD32TOP_UAP(old_address, void);
1322 NETBSD32TOX_UAP(old_size, size_t);
1323 NETBSD32TOP_UAP(new_address, void);
1324 NETBSD32TOX_UAP(new_size, size_t);
1325 NETBSD32TO64_UAP(flags);
1326
1327 return sys_mremap(l, &ua, retval);
1328 }
1329
1330 int
netbsd32_lseek(struct lwp * l,const struct netbsd32_lseek_args * uap,register_t * retval)1331 netbsd32_lseek(struct lwp *l, const struct netbsd32_lseek_args *uap, register_t *retval)
1332 {
1333 /* {
1334 syscallarg(int) fd;
1335 syscallarg(int) PAD;
1336 syscallarg(netbsd32_off_t) offset;
1337 syscallarg(int) whence;
1338 } */
1339 struct sys_lseek_args ua;
1340 union {
1341 register_t retval64[2];
1342 register32_t retval32[4];
1343 } newpos;
1344 int rv;
1345
1346 NETBSD32TO64_UAP(fd);
1347 NETBSD32TO64_UAP(PAD);
1348 NETBSD32TO64_UAP(offset);
1349 NETBSD32TO64_UAP(whence);
1350 rv = sys_lseek(l, &ua, newpos.retval64);
1351
1352 /*
1353 * We have to split the 64 bit value into 2 halves which will
1354 * end up in separate 32 bit registers.
1355 * This should DTRT on big and little-endian systems provided that
1356 * gcc's 'strict aliasing' tests don't decide that the retval32[]
1357 * entries can't have been assigned to, so need not be read!
1358 */
1359 retval[0] = newpos.retval32[0];
1360 retval[1] = newpos.retval32[1];
1361
1362 return rv;
1363 }
1364
1365 int
netbsd32_truncate(struct lwp * l,const struct netbsd32_truncate_args * uap,register_t * retval)1366 netbsd32_truncate(struct lwp *l, const struct netbsd32_truncate_args *uap, register_t *retval)
1367 {
1368 /* {
1369 syscallarg(const netbsd32_charp) path;
1370 syscallarg(int) PAD;
1371 syscallarg(netbsd32_off_t) length;
1372 } */
1373 struct sys_truncate_args ua;
1374
1375 NETBSD32TOP_UAP(path, const char);
1376 NETBSD32TO64_UAP(PAD);
1377 NETBSD32TO64_UAP(length);
1378
1379 return sys_truncate(l, &ua, retval);
1380 }
1381
1382 int
netbsd32_ftruncate(struct lwp * l,const struct netbsd32_ftruncate_args * uap,register_t * retval)1383 netbsd32_ftruncate(struct lwp *l, const struct netbsd32_ftruncate_args *uap, register_t *retval)
1384 {
1385 /* {
1386 syscallarg(int) fd;
1387 syscallarg(int) PAD;
1388 syscallarg(netbsd32_off_t) length;
1389 } */
1390 struct sys_ftruncate_args ua;
1391
1392 NETBSD32TO64_UAP(fd);
1393 NETBSD32TO64_UAP(PAD);
1394 NETBSD32TO64_UAP(length);
1395
1396 return sys_ftruncate(l, &ua, retval);
1397 }
1398
1399 int
netbsd32_mlock(struct lwp * l,const struct netbsd32_mlock_args * uap,register_t * retval)1400 netbsd32_mlock(struct lwp *l, const struct netbsd32_mlock_args *uap, register_t *retval)
1401 {
1402 /* {
1403 syscallarg(const netbsd32_voidp) addr;
1404 syscallarg(netbsd32_size_t) len;
1405 } */
1406 struct sys_mlock_args ua;
1407
1408 NETBSD32TOP_UAP(addr, const void);
1409 NETBSD32TO64_UAP(len);
1410
1411 return sys_mlock(l, &ua, retval);
1412 }
1413
1414 int
netbsd32_munlock(struct lwp * l,const struct netbsd32_munlock_args * uap,register_t * retval)1415 netbsd32_munlock(struct lwp *l, const struct netbsd32_munlock_args *uap, register_t *retval)
1416 {
1417 /* {
1418 syscallarg(const netbsd32_voidp) addr;
1419 syscallarg(netbsd32_size_t) len;
1420 } */
1421 struct sys_munlock_args ua;
1422
1423 NETBSD32TOP_UAP(addr, const void);
1424 NETBSD32TO64_UAP(len);
1425
1426 return sys_munlock(l, &ua, retval);
1427 }
1428
1429 int
netbsd32_undelete(struct lwp * l,const struct netbsd32_undelete_args * uap,register_t * retval)1430 netbsd32_undelete(struct lwp *l, const struct netbsd32_undelete_args *uap, register_t *retval)
1431 {
1432 /* {
1433 syscallarg(const netbsd32_charp) path;
1434 } */
1435 struct sys_undelete_args ua;
1436
1437 NETBSD32TOP_UAP(path, const char);
1438
1439 return sys_undelete(l, &ua, retval);
1440 }
1441
1442 int
netbsd32_getpgid(struct lwp * l,const struct netbsd32_getpgid_args * uap,register_t * retval)1443 netbsd32_getpgid(struct lwp *l, const struct netbsd32_getpgid_args *uap, register_t *retval)
1444 {
1445 /* {
1446 syscallarg(pid_t) pid;
1447 } */
1448 struct sys_getpgid_args ua;
1449
1450 NETBSD32TO64_UAP(pid);
1451
1452 return sys_getpgid(l, &ua, retval);
1453 }
1454
1455 int
netbsd32_reboot(struct lwp * l,const struct netbsd32_reboot_args * uap,register_t * retval)1456 netbsd32_reboot(struct lwp *l, const struct netbsd32_reboot_args *uap, register_t *retval)
1457 {
1458 /* {
1459 syscallarg(int) opt;
1460 syscallarg(netbsd32_charp) bootstr;
1461 } */
1462 struct sys_reboot_args ua;
1463
1464 NETBSD32TO64_UAP(opt);
1465 NETBSD32TOP_UAP(bootstr, char);
1466
1467 return sys_reboot(l, &ua, retval);
1468 }
1469
1470 #include <sys/poll.h>
1471 int
netbsd32_poll(struct lwp * l,const struct netbsd32_poll_args * uap,register_t * retval)1472 netbsd32_poll(struct lwp *l, const struct netbsd32_poll_args *uap, register_t *retval)
1473 {
1474 /* {
1475 syscallarg(netbsd32_pollfdp_t) fds;
1476 syscallarg(u_int) nfds;
1477 syscallarg(int) timeout;
1478 } */
1479 struct sys_poll_args ua;
1480
1481 NETBSD32TOP_UAP(fds, struct pollfd);
1482 NETBSD32TO64_UAP(nfds);
1483 NETBSD32TO64_UAP(timeout);
1484
1485 return sys_poll(l, &ua, retval);
1486 }
1487
1488 int
netbsd32_fdatasync(struct lwp * l,const struct netbsd32_fdatasync_args * uap,register_t * retval)1489 netbsd32_fdatasync(struct lwp *l, const struct netbsd32_fdatasync_args *uap, register_t *retval)
1490 {
1491 /* {
1492 syscallarg(int) fd;
1493 } */
1494 struct sys_fdatasync_args ua;
1495
1496 NETBSD32TO64_UAP(fd);
1497
1498 return sys_fdatasync(l, &ua, retval);
1499 }
1500
1501 int
netbsd32___posix_rename(struct lwp * l,const struct netbsd32___posix_rename_args * uap,register_t * retval)1502 netbsd32___posix_rename(struct lwp *l, const struct netbsd32___posix_rename_args *uap, register_t *retval)
1503 {
1504 /* {
1505 syscallarg(const netbsd32_charp) from;
1506 syscallarg(const netbsd32_charp) to;
1507 } */
1508 struct sys___posix_rename_args ua;
1509
1510 NETBSD32TOP_UAP(from, const char);
1511 NETBSD32TOP_UAP(to, const char);
1512
1513 return sys___posix_rename(l, &ua, retval);
1514 }
1515
1516 static void
swapent32_cvt(void * p,const struct swapent * se)1517 swapent32_cvt(void *p, const struct swapent *se)
1518 {
1519 struct netbsd32_swapent *se32 = p;
1520
1521 se32->se_dev = se->se_dev;
1522 se32->se_flags = se->se_flags;
1523 se32->se_nblks = se->se_nblks;
1524 se32->se_inuse = se->se_inuse;
1525 se32->se_priority = se->se_priority;
1526 KASSERT(sizeof(se->se_path) <= sizeof(se32->se_path));
1527 strcpy(se32->se_path, se->se_path);
1528 }
1529
1530 int
netbsd32_swapctl(struct lwp * l,const struct netbsd32_swapctl_args * uap,register_t * retval)1531 netbsd32_swapctl(struct lwp *l, const struct netbsd32_swapctl_args *uap,
1532 register_t *retval)
1533 {
1534 /* {
1535 syscallarg(int) cmd;
1536 syscallarg(const netbsd32_voidp) arg;
1537 syscallarg(int) misc;
1538 } */
1539 struct sys_swapctl_args ua;
1540
1541 NETBSD32TO64_UAP(cmd);
1542 NETBSD32TOP_UAP(arg, void);
1543 NETBSD32TO64_UAP(misc);
1544
1545 /* SWAP_STATS50 and SWAP_STATS13 structures need no translation */
1546 if (SCARG(&ua, cmd) == SWAP_STATS) {
1547 swapsys_lock(RW_READER);
1548 int error = uvm_swap_stats(SCARG(&ua, arg), SCARG(&ua, misc),
1549 swapent32_cvt, sizeof(struct netbsd32_swapent), retval);
1550 swapsys_unlock();
1551 return error;
1552 }
1553
1554 return sys_swapctl(l, &ua, retval);
1555 }
1556
1557 int
netbsd32_minherit(struct lwp * l,const struct netbsd32_minherit_args * uap,register_t * retval)1558 netbsd32_minherit(struct lwp *l, const struct netbsd32_minherit_args *uap, register_t *retval)
1559 {
1560 /* {
1561 syscallarg(netbsd32_voidp) addr;
1562 syscallarg(netbsd32_size_t) len;
1563 syscallarg(int) inherit;
1564 } */
1565 struct sys_minherit_args ua;
1566
1567 NETBSD32TOP_UAP(addr, void);
1568 NETBSD32TOX_UAP(len, size_t);
1569 NETBSD32TO64_UAP(inherit);
1570
1571 return sys_minherit(l, &ua, retval);
1572 }
1573
1574 int
netbsd32_lchmod(struct lwp * l,const struct netbsd32_lchmod_args * uap,register_t * retval)1575 netbsd32_lchmod(struct lwp *l, const struct netbsd32_lchmod_args *uap, register_t *retval)
1576 {
1577 /* {
1578 syscallarg(const netbsd32_charp) path;
1579 syscallarg(mode_t) mode;
1580 } */
1581 struct sys_lchmod_args ua;
1582
1583 NETBSD32TOP_UAP(path, const char);
1584 NETBSD32TO64_UAP(mode);
1585
1586 return sys_lchmod(l, &ua, retval);
1587 }
1588
1589 int
netbsd32_lchown(struct lwp * l,const struct netbsd32_lchown_args * uap,register_t * retval)1590 netbsd32_lchown(struct lwp *l, const struct netbsd32_lchown_args *uap, register_t *retval)
1591 {
1592 /* {
1593 syscallarg(const netbsd32_charp) path;
1594 syscallarg(uid_t) uid;
1595 syscallarg(gid_t) gid;
1596 } */
1597 struct sys_lchown_args ua;
1598
1599 NETBSD32TOP_UAP(path, const char);
1600 NETBSD32TO64_UAP(uid);
1601 NETBSD32TO64_UAP(gid);
1602
1603 return sys_lchown(l, &ua, retval);
1604 }
1605
1606 int
netbsd32___msync13(struct lwp * l,const struct netbsd32___msync13_args * uap,register_t * retval)1607 netbsd32___msync13(struct lwp *l, const struct netbsd32___msync13_args *uap, register_t *retval)
1608 {
1609 /* {
1610 syscallarg(netbsd32_voidp) addr;
1611 syscallarg(netbsd32_size_t) len;
1612 syscallarg(int) flags;
1613 } */
1614 struct sys___msync13_args ua;
1615
1616 NETBSD32TOP_UAP(addr, void);
1617 NETBSD32TOX_UAP(len, size_t);
1618 NETBSD32TO64_UAP(flags);
1619
1620 return sys___msync13(l, &ua, retval);
1621 }
1622
1623 int
netbsd32___posix_chown(struct lwp * l,const struct netbsd32___posix_chown_args * uap,register_t * retval)1624 netbsd32___posix_chown(struct lwp *l, const struct netbsd32___posix_chown_args *uap, register_t *retval)
1625 {
1626 /* {
1627 syscallarg(const netbsd32_charp) path;
1628 syscallarg(uid_t) uid;
1629 syscallarg(gid_t) gid;
1630 } */
1631 struct sys___posix_chown_args ua;
1632
1633 NETBSD32TOP_UAP(path, const char);
1634 NETBSD32TO64_UAP(uid);
1635 NETBSD32TO64_UAP(gid);
1636
1637 return sys___posix_chown(l, &ua, retval);
1638 }
1639
1640 int
netbsd32___posix_fchown(struct lwp * l,const struct netbsd32___posix_fchown_args * uap,register_t * retval)1641 netbsd32___posix_fchown(struct lwp *l, const struct netbsd32___posix_fchown_args *uap, register_t *retval)
1642 {
1643 /* {
1644 syscallarg(int) fd;
1645 syscallarg(uid_t) uid;
1646 syscallarg(gid_t) gid;
1647 } */
1648 struct sys___posix_fchown_args ua;
1649
1650 NETBSD32TO64_UAP(fd);
1651 NETBSD32TO64_UAP(uid);
1652 NETBSD32TO64_UAP(gid);
1653
1654 return sys___posix_fchown(l, &ua, retval);
1655 }
1656
1657 int
netbsd32___posix_lchown(struct lwp * l,const struct netbsd32___posix_lchown_args * uap,register_t * retval)1658 netbsd32___posix_lchown(struct lwp *l, const struct netbsd32___posix_lchown_args *uap, register_t *retval)
1659 {
1660 /* {
1661 syscallarg(const netbsd32_charp) path;
1662 syscallarg(uid_t) uid;
1663 syscallarg(gid_t) gid;
1664 } */
1665 struct sys___posix_lchown_args ua;
1666
1667 NETBSD32TOP_UAP(path, const char);
1668 NETBSD32TO64_UAP(uid);
1669 NETBSD32TO64_UAP(gid);
1670
1671 return sys___posix_lchown(l, &ua, retval);
1672 }
1673
1674 int
netbsd32_getsid(struct lwp * l,const struct netbsd32_getsid_args * uap,register_t * retval)1675 netbsd32_getsid(struct lwp *l, const struct netbsd32_getsid_args *uap, register_t *retval)
1676 {
1677 /* {
1678 syscallarg(pid_t) pid;
1679 } */
1680 struct sys_getsid_args ua;
1681
1682 NETBSD32TO64_UAP(pid);
1683
1684 return sys_getsid(l, &ua, retval);
1685 }
1686
1687 int
netbsd32_fktrace(struct lwp * l,const struct netbsd32_fktrace_args * uap,register_t * retval)1688 netbsd32_fktrace(struct lwp *l, const struct netbsd32_fktrace_args *uap, register_t *retval)
1689 {
1690 /* {
1691 syscallarg(int) fd;
1692 syscallarg(int) ops;
1693 syscallarg(int) facs;
1694 syscallarg(int) pid;
1695 } */
1696 struct sys_fktrace_args ua;
1697
1698 NETBSD32TOX_UAP(fd, int);
1699 NETBSD32TO64_UAP(ops);
1700 NETBSD32TO64_UAP(facs);
1701 NETBSD32TO64_UAP(pid);
1702
1703 return sys_fktrace(l, &ua, retval);
1704 }
1705
1706 int
netbsd32___sigpending14(struct lwp * l,const struct netbsd32___sigpending14_args * uap,register_t * retval)1707 netbsd32___sigpending14(struct lwp *l, const struct netbsd32___sigpending14_args *uap, register_t *retval)
1708 {
1709 /* {
1710 syscallarg(sigset_t *) set;
1711 } */
1712 struct sys___sigpending14_args ua;
1713
1714 NETBSD32TOP_UAP(set, sigset_t);
1715
1716 return sys___sigpending14(l, &ua, retval);
1717 }
1718
1719 int
netbsd32___sigprocmask14(struct lwp * l,const struct netbsd32___sigprocmask14_args * uap,register_t * retval)1720 netbsd32___sigprocmask14(struct lwp *l, const struct netbsd32___sigprocmask14_args *uap, register_t *retval)
1721 {
1722 /* {
1723 syscallarg(int) how;
1724 syscallarg(const sigset_t *) set;
1725 syscallarg(sigset_t *) oset;
1726 } */
1727 struct sys___sigprocmask14_args ua;
1728
1729 NETBSD32TO64_UAP(how);
1730 NETBSD32TOP_UAP(set, sigset_t);
1731 NETBSD32TOP_UAP(oset, sigset_t);
1732
1733 return sys___sigprocmask14(l, &ua, retval);
1734 }
1735
1736 int
netbsd32___sigsuspend14(struct lwp * l,const struct netbsd32___sigsuspend14_args * uap,register_t * retval)1737 netbsd32___sigsuspend14(struct lwp *l, const struct netbsd32___sigsuspend14_args *uap, register_t *retval)
1738 {
1739 /* {
1740 syscallarg(const sigset_t *) set;
1741 } */
1742 struct sys___sigsuspend14_args ua;
1743
1744 NETBSD32TOP_UAP(set, sigset_t);
1745
1746 return sys___sigsuspend14(l, &ua, retval);
1747 }
1748
1749 int
netbsd32_fchroot(struct lwp * l,const struct netbsd32_fchroot_args * uap,register_t * retval)1750 netbsd32_fchroot(struct lwp *l, const struct netbsd32_fchroot_args *uap, register_t *retval)
1751 {
1752 /* {
1753 syscallarg(int) fd;
1754 } */
1755 struct sys_fchroot_args ua;
1756
1757 NETBSD32TO64_UAP(fd);
1758
1759 return sys_fchroot(l, &ua, retval);
1760 }
1761
1762 /*
1763 * Open a file given a file handle.
1764 *
1765 * Check permissions, allocate an open file structure,
1766 * and call the device open routine if any.
1767 */
1768 int
netbsd32___fhopen40(struct lwp * l,const struct netbsd32___fhopen40_args * uap,register_t * retval)1769 netbsd32___fhopen40(struct lwp *l, const struct netbsd32___fhopen40_args *uap, register_t *retval)
1770 {
1771 /* {
1772 syscallarg(const netbsd32_pointer_t *) fhp;
1773 syscallarg(netbsd32_size_t) fh_size;
1774 syscallarg(int) flags;
1775 } */
1776 struct sys___fhopen40_args ua;
1777
1778 NETBSD32TOP_UAP(fhp, fhandle_t);
1779 NETBSD32TO64_UAP(fh_size);
1780 NETBSD32TO64_UAP(flags);
1781
1782 return sys___fhopen40(l, &ua, retval);
1783 }
1784
1785 /* virtual memory syscalls */
1786 int
netbsd32_ovadvise(struct lwp * l,const struct netbsd32_ovadvise_args * uap,register_t * retval)1787 netbsd32_ovadvise(struct lwp *l, const struct netbsd32_ovadvise_args *uap, register_t *retval)
1788 {
1789 /* {
1790 syscallarg(int) anom;
1791 } */
1792 struct sys_ovadvise_args ua;
1793
1794 NETBSD32TO64_UAP(anom);
1795
1796 return sys_ovadvise(l, &ua, retval);
1797 }
1798
1799 int
netbsd32_uuidgen(struct lwp * l,const struct netbsd32_uuidgen_args * uap,register_t * retval)1800 netbsd32_uuidgen(struct lwp *l, const struct netbsd32_uuidgen_args *uap, register_t *retval)
1801 {
1802 /* {
1803 syscallarg(netbsd32_uuidp_t) store;
1804 syscallarg(int) count;
1805 } */
1806 struct sys_uuidgen_args ua;
1807
1808 NETBSD32TOP_UAP(store, struct uuid);
1809 NETBSD32TO64_UAP(count);
1810
1811 return sys_uuidgen(l, &ua, retval);
1812 }
1813
1814 int
netbsd32_extattrctl(struct lwp * l,const struct netbsd32_extattrctl_args * uap,register_t * retval)1815 netbsd32_extattrctl(struct lwp *l, const struct netbsd32_extattrctl_args *uap, register_t *retval)
1816 {
1817 /* {
1818 syscallarg(const netbsd32_charp) path;
1819 syscallarg(int) cmd;
1820 syscallarg(const netbsd32_charp) filename;
1821 syscallarg(int) attrnamespace;
1822 syscallarg(const netbsd32_charp) attrname;
1823 } */
1824 struct sys_extattrctl_args ua;
1825
1826 NETBSD32TOP_UAP(path, const char);
1827 NETBSD32TO64_UAP(cmd);
1828 NETBSD32TOP_UAP(filename, const char);
1829 NETBSD32TO64_UAP(attrnamespace);
1830 NETBSD32TOP_UAP(attrname, const char);
1831
1832 return sys_extattrctl(l, &ua, retval);
1833 }
1834
1835 int
netbsd32_extattr_set_fd(struct lwp * l,const struct netbsd32_extattr_set_fd_args * uap,register_t * retval)1836 netbsd32_extattr_set_fd(struct lwp *l, const struct netbsd32_extattr_set_fd_args *uap, register_t *retval)
1837 {
1838 /* {
1839 syscallarg(int) fd;
1840 syscallarg(int) attrnamespace;
1841 syscallarg(const netbsd32_charp) attrname;
1842 syscallarg(const netbsd32_voidp) data;
1843 syscallarg(netbsd32_size_t) nbytes;
1844 } */
1845 struct sys_extattr_set_fd_args ua;
1846
1847 NETBSD32TO64_UAP(fd);
1848 NETBSD32TO64_UAP(attrnamespace);
1849 NETBSD32TOP_UAP(attrname, const char);
1850 NETBSD32TOP_UAP(data, const void);
1851 NETBSD32TOX_UAP(nbytes, size_t);
1852
1853 return sys_extattr_set_fd(l, &ua, retval);
1854 }
1855
1856 int
netbsd32_extattr_set_file(struct lwp * l,const struct netbsd32_extattr_set_file_args * uap,register_t * retval)1857 netbsd32_extattr_set_file(struct lwp *l, const struct netbsd32_extattr_set_file_args *uap, register_t *retval)
1858 {
1859 /* {
1860 syscallarg(const netbsd32_charp) path;
1861 syscallarg(int) attrnamespace;
1862 syscallarg(const netbsd32_charp) attrname;
1863 syscallarg(const netbsd32_voidp) data;
1864 syscallarg(netbsd32_size_t) nbytes;
1865 } */
1866 struct sys_extattr_set_file_args ua;
1867
1868 NETBSD32TOP_UAP(path, const char);
1869 NETBSD32TO64_UAP(attrnamespace);
1870 NETBSD32TOP_UAP(attrname, const char);
1871 NETBSD32TOP_UAP(data, const void);
1872 NETBSD32TOX_UAP(nbytes, size_t);
1873
1874 return sys_extattr_set_file(l, &ua, retval);
1875 }
1876
1877 int
netbsd32_extattr_set_link(struct lwp * l,const struct netbsd32_extattr_set_link_args * uap,register_t * retval)1878 netbsd32_extattr_set_link(struct lwp *l, const struct netbsd32_extattr_set_link_args *uap, register_t *retval)
1879 {
1880 /* {
1881 syscallarg(const netbsd32_charp) path;
1882 syscallarg(int) attrnamespace;
1883 syscallarg(const netbsd32_charp) attrname;
1884 syscallarg(const netbsd32_voidp) data;
1885 syscallarg(netbsd32_size_t) nbytes;
1886 } */
1887 struct sys_extattr_set_link_args ua;
1888
1889 NETBSD32TOP_UAP(path, const char);
1890 NETBSD32TO64_UAP(attrnamespace);
1891 NETBSD32TOP_UAP(attrname, const char);
1892 NETBSD32TOP_UAP(data, const void);
1893 NETBSD32TOX_UAP(nbytes, size_t);
1894
1895 return sys_extattr_set_link(l, &ua, retval);
1896 }
1897
1898 int
netbsd32_extattr_get_fd(struct lwp * l,const struct netbsd32_extattr_get_fd_args * uap,register_t * retval)1899 netbsd32_extattr_get_fd(struct lwp *l, const struct netbsd32_extattr_get_fd_args *uap, register_t *retval)
1900 {
1901 /* {
1902 syscallarg(int) fd;
1903 syscallarg(int) attrnamespace;
1904 syscallarg(const netbsd32_charp) attrname;
1905 syscallarg(netbsd32_voidp) data;
1906 syscallarg(netbsd32_size_t) nbytes;
1907 } */
1908 struct sys_extattr_get_fd_args ua;
1909
1910 NETBSD32TO64_UAP(fd);
1911 NETBSD32TO64_UAP(attrnamespace);
1912 NETBSD32TOP_UAP(attrname, const char);
1913 NETBSD32TOP_UAP(data, void);
1914 NETBSD32TOX_UAP(nbytes, size_t);
1915
1916 return sys_extattr_get_fd(l, &ua, retval);
1917 }
1918
1919 int
netbsd32_extattr_get_file(struct lwp * l,const struct netbsd32_extattr_get_file_args * uap,register_t * retval)1920 netbsd32_extattr_get_file(struct lwp *l, const struct netbsd32_extattr_get_file_args *uap, register_t *retval)
1921 {
1922 /* {
1923 syscallarg(const netbsd32_charp) path;
1924 syscallarg(int) attrnamespace;
1925 syscallarg(const netbsd32_charp) attrname;
1926 syscallarg(netbsd32_voidp) data;
1927 syscallarg(netbsd32_size_t) nbytes;
1928 } */
1929 struct sys_extattr_get_file_args ua;
1930
1931 NETBSD32TOP_UAP(path, const char);
1932 NETBSD32TO64_UAP(attrnamespace);
1933 NETBSD32TOP_UAP(attrname, const char);
1934 NETBSD32TOP_UAP(data, void);
1935 NETBSD32TOX_UAP(nbytes, size_t);
1936
1937 return sys_extattr_get_file(l, &ua, retval);
1938 }
1939
1940 int
netbsd32_extattr_get_link(struct lwp * l,const struct netbsd32_extattr_get_link_args * uap,register_t * retval)1941 netbsd32_extattr_get_link(struct lwp *l, const struct netbsd32_extattr_get_link_args *uap, register_t *retval)
1942 {
1943 /* {
1944 syscallarg(const netbsd32_charp) path;
1945 syscallarg(int) attrnamespace;
1946 syscallarg(const netbsd32_charp) attrname;
1947 syscallarg(netbsd32_voidp) data;
1948 syscallarg(netbsd32_size_t) nbytes;
1949 } */
1950 struct sys_extattr_get_link_args ua;
1951
1952 NETBSD32TOP_UAP(path, const char);
1953 NETBSD32TO64_UAP(attrnamespace);
1954 NETBSD32TOP_UAP(attrname, const char);
1955 NETBSD32TOP_UAP(data, void);
1956 NETBSD32TOX_UAP(nbytes, size_t);
1957
1958 return sys_extattr_get_link(l, &ua, retval);
1959 }
1960
1961 int
netbsd32_extattr_delete_fd(struct lwp * l,const struct netbsd32_extattr_delete_fd_args * uap,register_t * retval)1962 netbsd32_extattr_delete_fd(struct lwp *l, const struct netbsd32_extattr_delete_fd_args *uap, register_t *retval)
1963 {
1964 /* {
1965 syscallarg(int) fd;
1966 syscallarg(int) attrnamespace;
1967 syscallarg(const netbsd32_charp) attrname;
1968 } */
1969 struct sys_extattr_delete_fd_args ua;
1970
1971 NETBSD32TO64_UAP(fd);
1972 NETBSD32TO64_UAP(attrnamespace);
1973 NETBSD32TOP_UAP(attrname, const char);
1974
1975 return sys_extattr_delete_fd(l, &ua, retval);
1976 }
1977
1978 int
netbsd32_extattr_delete_file(struct lwp * l,const struct netbsd32_extattr_delete_file_args * uap,register_t * retval)1979 netbsd32_extattr_delete_file(struct lwp *l, const struct netbsd32_extattr_delete_file_args *uap, register_t *retval)
1980 {
1981 /* {
1982 syscallarg(const netbsd32_charp) path;
1983 syscallarg(int) attrnamespace;
1984 syscallarg(const netbsd32_charp) attrname;
1985 } */
1986 struct sys_extattr_delete_file_args ua;
1987
1988 NETBSD32TOP_UAP(path, const char);
1989 NETBSD32TO64_UAP(attrnamespace);
1990 NETBSD32TOP_UAP(attrname, const char);
1991
1992 return sys_extattr_delete_file(l, &ua, retval);
1993 }
1994
1995 int
netbsd32_extattr_delete_link(struct lwp * l,const struct netbsd32_extattr_delete_link_args * uap,register_t * retval)1996 netbsd32_extattr_delete_link(struct lwp *l, const struct netbsd32_extattr_delete_link_args *uap, register_t *retval)
1997 {
1998 /* {
1999 syscallarg(const netbsd32_charp) path;
2000 syscallarg(int) attrnamespace;
2001 syscallarg(const netbsd32_charp) attrname;
2002 } */
2003 struct sys_extattr_delete_link_args ua;
2004
2005 NETBSD32TOP_UAP(path, const char);
2006 NETBSD32TO64_UAP(attrnamespace);
2007 NETBSD32TOP_UAP(attrname, const char);
2008
2009 return sys_extattr_delete_link(l, &ua, retval);
2010 }
2011
2012 int
netbsd32_extattr_list_fd(struct lwp * l,const struct netbsd32_extattr_list_fd_args * uap,register_t * retval)2013 netbsd32_extattr_list_fd(struct lwp *l, const struct netbsd32_extattr_list_fd_args *uap, register_t *retval)
2014 {
2015 /* {
2016 syscallarg(int) fd;
2017 syscallarg(int) attrnamespace;
2018 syscallarg(netbsd32_voidp) data;
2019 syscallarg(netbsd32_size_t) nbytes;
2020 } */
2021 struct sys_extattr_list_fd_args ua;
2022
2023 NETBSD32TO64_UAP(fd);
2024 NETBSD32TO64_UAP(attrnamespace);
2025 NETBSD32TOP_UAP(data, void);
2026 NETBSD32TOX_UAP(nbytes, size_t);
2027
2028 return sys_extattr_list_fd(l, &ua, retval);
2029 }
2030
2031 int
netbsd32_extattr_list_file(struct lwp * l,const struct netbsd32_extattr_list_file_args * uap,register_t * retval)2032 netbsd32_extattr_list_file(struct lwp *l, const struct netbsd32_extattr_list_file_args *uap, register_t *retval)
2033 {
2034 /* {
2035 syscallarg(const netbsd32_charp) path;
2036 syscallarg(int) attrnamespace;
2037 syscallarg(netbsd32_voidp) data;
2038 syscallarg(netbsd32_size_t) nbytes;
2039 } */
2040 struct sys_extattr_list_file_args ua;
2041
2042 NETBSD32TOP_UAP(path, const char);
2043 NETBSD32TO64_UAP(attrnamespace);
2044 NETBSD32TOP_UAP(data, void);
2045 NETBSD32TOX_UAP(nbytes, size_t);
2046
2047 return sys_extattr_list_file(l, &ua, retval);
2048 }
2049
2050 int
netbsd32_extattr_list_link(struct lwp * l,const struct netbsd32_extattr_list_link_args * uap,register_t * retval)2051 netbsd32_extattr_list_link(struct lwp *l, const struct netbsd32_extattr_list_link_args *uap, register_t *retval)
2052 {
2053 /* {
2054 syscallarg(const netbsd32_charp) path;
2055 syscallarg(int) attrnamespace;
2056 syscallarg(netbsd32_voidp) data;
2057 syscallarg(netbsd32_size_t) nbytes;
2058 } */
2059 struct sys_extattr_list_link_args ua;
2060
2061 NETBSD32TOP_UAP(path, const char);
2062 NETBSD32TO64_UAP(attrnamespace);
2063 NETBSD32TOP_UAP(data, void);
2064 NETBSD32TOX_UAP(nbytes, size_t);
2065
2066 return sys_extattr_list_link(l, &ua, retval);
2067 }
2068
2069 int
netbsd32_mlockall(struct lwp * l,const struct netbsd32_mlockall_args * uap,register_t * retval)2070 netbsd32_mlockall(struct lwp *l, const struct netbsd32_mlockall_args *uap, register_t *retval)
2071 {
2072 /* {
2073 syscallarg(int) flags;
2074 } */
2075 struct sys_mlockall_args ua;
2076
2077 NETBSD32TO64_UAP(flags);
2078
2079 return sys_mlockall(l, &ua, retval);
2080 }
2081
2082 int
netbsd32___clone(struct lwp * l,const struct netbsd32___clone_args * uap,register_t * retval)2083 netbsd32___clone(struct lwp *l, const struct netbsd32___clone_args *uap, register_t *retval)
2084 {
2085 /* {
2086 syscallarg(int) flags;
2087 syscallarg(netbsd32_voidp) stack;
2088 } */
2089 struct sys___clone_args ua;
2090
2091 NETBSD32TO64_UAP(flags);
2092 NETBSD32TOP_UAP(stack, void);
2093
2094 return sys___clone(l, &ua, retval);
2095 }
2096
2097 int
netbsd32_fsync_range(struct lwp * l,const struct netbsd32_fsync_range_args * uap,register_t * retval)2098 netbsd32_fsync_range(struct lwp *l, const struct netbsd32_fsync_range_args *uap, register_t *retval)
2099 {
2100 /* {
2101 syscallarg(int) fd;
2102 syscallarg(int) flags;
2103 syscallarg(off_t) start;
2104 syscallarg(off_t) length;
2105 } */
2106 struct sys_fsync_range_args ua;
2107
2108 NETBSD32TO64_UAP(fd);
2109 NETBSD32TO64_UAP(flags);
2110 NETBSD32TO64_UAP(start);
2111 NETBSD32TO64_UAP(length);
2112
2113 return sys_fsync_range(l, &ua, retval);
2114 }
2115
2116 int
netbsd32_rasctl(struct lwp * l,const struct netbsd32_rasctl_args * uap,register_t * retval)2117 netbsd32_rasctl(struct lwp *l, const struct netbsd32_rasctl_args *uap, register_t *retval)
2118 {
2119 /* {
2120 syscallarg(netbsd32_voidp) addr;
2121 syscallarg(netbsd32_size_t) len;
2122 syscallarg(int) op;
2123 } */
2124 struct sys_rasctl_args ua;
2125
2126 NETBSD32TOP_UAP(addr, void *);
2127 NETBSD32TOX_UAP(len, size_t);
2128 NETBSD32TO64_UAP(op);
2129
2130 return sys_rasctl(l, &ua, retval);
2131 }
2132
2133 int
netbsd32_setxattr(struct lwp * l,const struct netbsd32_setxattr_args * uap,register_t * retval)2134 netbsd32_setxattr(struct lwp *l, const struct netbsd32_setxattr_args *uap, register_t *retval)
2135 {
2136 /* {
2137 syscallarg(const netbsd32_charp) path;
2138 syscallarg(const netbsd32_charp) name;
2139 syscallarg(netbsd32_voidp) value;
2140 syscallarg(netbsd32_size_t) size;
2141 syscallarg(int) flags;
2142 } */
2143 struct sys_setxattr_args ua;
2144
2145 NETBSD32TOP_UAP(path, const char);
2146 NETBSD32TOP_UAP(name, const char);
2147 NETBSD32TOP_UAP(value, void);
2148 NETBSD32TOX_UAP(size, size_t);
2149 NETBSD32TO64_UAP(flags);
2150
2151 return sys_setxattr(l, &ua, retval);
2152 }
2153
2154 int
netbsd32_lsetxattr(struct lwp * l,const struct netbsd32_lsetxattr_args * uap,register_t * retval)2155 netbsd32_lsetxattr(struct lwp *l, const struct netbsd32_lsetxattr_args *uap, register_t *retval)
2156 {
2157 /* {
2158 syscallarg(const netbsd32_charp) path;
2159 syscallarg(const netbsd32_charp) name;
2160 syscallarg(netbsd32_voidp) value;
2161 syscallarg(netbsd32_size_t) size;
2162 syscallarg(int) flags;
2163 } */
2164 struct sys_lsetxattr_args ua;
2165
2166 NETBSD32TOP_UAP(path, const char);
2167 NETBSD32TOP_UAP(name, const char);
2168 NETBSD32TOP_UAP(value, void);
2169 NETBSD32TOX_UAP(size, size_t);
2170 NETBSD32TO64_UAP(flags);
2171
2172 return sys_lsetxattr(l, &ua, retval);
2173 }
2174
2175 int
netbsd32_fsetxattr(struct lwp * l,const struct netbsd32_fsetxattr_args * uap,register_t * retval)2176 netbsd32_fsetxattr(struct lwp *l, const struct netbsd32_fsetxattr_args *uap, register_t *retval)
2177 {
2178 /* {
2179 syscallarg(int) fd;
2180 syscallarg(const netbsd32_charp) name;
2181 syscallarg(netbsd32_voidp) value;
2182 syscallarg(netbsd32_size_t) size;
2183 syscallarg(int) flags;
2184 } */
2185 struct sys_fsetxattr_args ua;
2186
2187 NETBSD32TO64_UAP(fd);
2188 NETBSD32TOP_UAP(name, const char);
2189 NETBSD32TOP_UAP(value, void);
2190 NETBSD32TOX_UAP(size, size_t);
2191 NETBSD32TO64_UAP(flags);
2192
2193 return sys_fsetxattr(l, &ua, retval);
2194 }
2195
2196 int
netbsd32_getxattr(struct lwp * l,const struct netbsd32_getxattr_args * uap,register_t * retval)2197 netbsd32_getxattr(struct lwp *l, const struct netbsd32_getxattr_args *uap, register_t *retval)
2198 {
2199 /* {
2200 syscallarg(const netbsd32_charp) path;
2201 syscallarg(const netbsd32_charp) name;
2202 syscallarg(netbsd32_voidp) value;
2203 syscallarg(netbsd32_size_t) size;
2204 } */
2205 struct sys_getxattr_args ua;
2206
2207 NETBSD32TOP_UAP(path, const char);
2208 NETBSD32TOP_UAP(name, const char);
2209 NETBSD32TOP_UAP(value, void);
2210 NETBSD32TOX_UAP(size, size_t);
2211
2212 return sys_getxattr(l, &ua, retval);
2213 }
2214
2215 int
netbsd32_lgetxattr(struct lwp * l,const struct netbsd32_lgetxattr_args * uap,register_t * retval)2216 netbsd32_lgetxattr(struct lwp *l, const struct netbsd32_lgetxattr_args *uap, register_t *retval)
2217 {
2218 /* {
2219 syscallarg(const netbsd32_charp) path;
2220 syscallarg(const netbsd32_charp) name;
2221 syscallarg(netbsd32_voidp) value;
2222 syscallarg(netbsd32_size_t) size;
2223 } */
2224 struct sys_lgetxattr_args ua;
2225
2226 NETBSD32TOP_UAP(path, const char);
2227 NETBSD32TOP_UAP(name, const char);
2228 NETBSD32TOP_UAP(value, void);
2229 NETBSD32TOX_UAP(size, size_t);
2230
2231 return sys_lgetxattr(l, &ua, retval);
2232 }
2233
2234 int
netbsd32_fgetxattr(struct lwp * l,const struct netbsd32_fgetxattr_args * uap,register_t * retval)2235 netbsd32_fgetxattr(struct lwp *l, const struct netbsd32_fgetxattr_args *uap, register_t *retval)
2236 {
2237 /* {
2238 syscallarg(int) fd;
2239 syscallarg(const netbsd32_charp) name;
2240 syscallarg(netbsd32_voidp) value;
2241 syscallarg(netbsd32_size_t) size;
2242 } */
2243 struct sys_fgetxattr_args ua;
2244
2245 NETBSD32TO64_UAP(fd);
2246 NETBSD32TOP_UAP(name, const char);
2247 NETBSD32TOP_UAP(value, void);
2248 NETBSD32TOX_UAP(size, size_t);
2249
2250 return sys_fgetxattr(l, &ua, retval);
2251 }
2252
2253 int
netbsd32_listxattr(struct lwp * l,const struct netbsd32_listxattr_args * uap,register_t * retval)2254 netbsd32_listxattr(struct lwp *l, const struct netbsd32_listxattr_args *uap, register_t *retval)
2255 {
2256 /* {
2257 syscallarg(const netbsd32_charp) path;
2258 syscallarg(netbsd32_charp) list;
2259 syscallarg(netbsd32_size_t) size;
2260 } */
2261 struct sys_listxattr_args ua;
2262
2263 NETBSD32TOP_UAP(path, const char);
2264 NETBSD32TOP_UAP(list, char);
2265 NETBSD32TOX_UAP(size, size_t);
2266
2267 return sys_listxattr(l, &ua, retval);
2268 }
2269
2270 int
netbsd32_llistxattr(struct lwp * l,const struct netbsd32_llistxattr_args * uap,register_t * retval)2271 netbsd32_llistxattr(struct lwp *l, const struct netbsd32_llistxattr_args *uap, register_t *retval)
2272 {
2273 /* {
2274 syscallarg(const netbsd32_charp) path;
2275 syscallarg(netbsd32_charp) list;
2276 syscallarg(netbsd32_size_t) size;
2277 } */
2278 struct sys_llistxattr_args ua;
2279
2280 NETBSD32TOP_UAP(path, const char);
2281 NETBSD32TOP_UAP(list, char);
2282 NETBSD32TOX_UAP(size, size_t);
2283
2284 return sys_llistxattr(l, &ua, retval);
2285 }
2286
2287 int
netbsd32_flistxattr(struct lwp * l,const struct netbsd32_flistxattr_args * uap,register_t * retval)2288 netbsd32_flistxattr(struct lwp *l, const struct netbsd32_flistxattr_args *uap, register_t *retval)
2289 {
2290 /* {
2291 syscallarg(int) fd;
2292 syscallarg(netbsd32_charp) list;
2293 syscallarg(netbsd32_size_t) size;
2294 } */
2295 struct sys_flistxattr_args ua;
2296
2297 NETBSD32TO64_UAP(fd);
2298 NETBSD32TOP_UAP(list, char);
2299 NETBSD32TOX_UAP(size, size_t);
2300
2301 return sys_flistxattr(l, &ua, retval);
2302 }
2303
2304 int
netbsd32_removexattr(struct lwp * l,const struct netbsd32_removexattr_args * uap,register_t * retval)2305 netbsd32_removexattr(struct lwp *l, const struct netbsd32_removexattr_args *uap, register_t *retval)
2306 {
2307 /* {
2308 syscallarg(const netbsd32_charp) path;
2309 syscallarg(const netbsd32_charp) name;
2310 } */
2311 struct sys_removexattr_args ua;
2312
2313 NETBSD32TOP_UAP(path, const char);
2314 NETBSD32TOP_UAP(name, const char);
2315
2316 return sys_removexattr(l, &ua, retval);
2317 }
2318
2319 int
netbsd32_lremovexattr(struct lwp * l,const struct netbsd32_lremovexattr_args * uap,register_t * retval)2320 netbsd32_lremovexattr(struct lwp *l, const struct netbsd32_lremovexattr_args *uap, register_t *retval)
2321 {
2322 /* {
2323 syscallarg(const netbsd32_charp) path;
2324 syscallarg(const netbsd32_charp) name;
2325 } */
2326 struct sys_lremovexattr_args ua;
2327 NETBSD32TOP_UAP(path, const char);
2328 NETBSD32TOP_UAP(name, const char);
2329 return sys_lremovexattr(l, &ua, retval);
2330 }
2331
2332 int
netbsd32_fremovexattr(struct lwp * l,const struct netbsd32_fremovexattr_args * uap,register_t * retval)2333 netbsd32_fremovexattr(struct lwp *l, const struct netbsd32_fremovexattr_args *uap, register_t *retval)
2334 {
2335 /* {
2336 syscallarg(int) fd;
2337 syscallarg(const netbsd32_charp) name;
2338 } */
2339 struct sys_fremovexattr_args ua;
2340
2341 NETBSD32TO64_UAP(fd);
2342 NETBSD32TOP_UAP(name, const char);
2343
2344 return sys_fremovexattr(l, &ua, retval);
2345 }
2346
2347 int
netbsd32___posix_fadvise50(struct lwp * l,const struct netbsd32___posix_fadvise50_args * uap,register_t * retval)2348 netbsd32___posix_fadvise50(struct lwp *l,
2349 const struct netbsd32___posix_fadvise50_args *uap, register_t *retval)
2350 {
2351 /* {
2352 syscallarg(int) fd;
2353 syscallarg(int) PAD;
2354 syscallarg(netbsd32_off_t) offset;
2355 syscallarg(netbsd32_off_t) len;
2356 syscallarg(int) advice;
2357 } */
2358
2359 *retval = do_posix_fadvise(SCARG(uap, fd), SCARG(uap, offset),
2360 SCARG(uap, len), SCARG(uap, advice));
2361
2362 return 0;
2363 }
2364
2365 int
netbsd32__sched_setparam(struct lwp * l,const struct netbsd32__sched_setparam_args * uap,register_t * retval)2366 netbsd32__sched_setparam(struct lwp *l,
2367 const struct netbsd32__sched_setparam_args *uap,
2368 register_t *retval)
2369 {
2370 /* {
2371 syscallarg(pid_t) pid;
2372 syscallarg(lwpid_t) lid;
2373 syscallarg(int) policy;
2374 syscallarg(const netbsd32_sched_paramp_t) params;
2375 } */
2376 struct sys__sched_setparam_args ua;
2377
2378 NETBSD32TO64_UAP(pid);
2379 NETBSD32TO64_UAP(lid);
2380 NETBSD32TO64_UAP(policy);
2381 NETBSD32TOP_UAP(params, const struct sched_param *);
2382
2383 return sys__sched_setparam(l, &ua, retval);
2384 }
2385
2386 int
netbsd32__sched_getparam(struct lwp * l,const struct netbsd32__sched_getparam_args * uap,register_t * retval)2387 netbsd32__sched_getparam(struct lwp *l,
2388 const struct netbsd32__sched_getparam_args *uap,
2389 register_t *retval)
2390 {
2391 /* {
2392 syscallarg(pid_t) pid;
2393 syscallarg(lwpid_t) lid;
2394 syscallarg(netbsd32_intp) policy;
2395 syscallarg(netbsd32_sched_paramp_t) params;
2396 } */
2397 struct sys__sched_getparam_args ua;
2398
2399 NETBSD32TO64_UAP(pid);
2400 NETBSD32TO64_UAP(lid);
2401 NETBSD32TOP_UAP(policy, int *);
2402 NETBSD32TOP_UAP(params, struct sched_param *);
2403
2404 return sys__sched_getparam(l, &ua, retval);
2405 }
2406
2407 int
netbsd32__sched_setaffinity(struct lwp * l,const struct netbsd32__sched_setaffinity_args * uap,register_t * retval)2408 netbsd32__sched_setaffinity(struct lwp *l,
2409 const struct netbsd32__sched_setaffinity_args *uap,
2410 register_t *retval)
2411 {
2412 /* {
2413 syscallarg(pid_t) pid;
2414 syscallarg(lwpid_t) lid;
2415 syscallarg(netbsd_size_t) size;
2416 syscallarg(const netbsd32_cpusetp_t) cpuset;
2417 } */
2418 struct sys__sched_setaffinity_args ua;
2419
2420 NETBSD32TO64_UAP(pid);
2421 NETBSD32TO64_UAP(lid);
2422 NETBSD32TOX_UAP(size, size_t);
2423 NETBSD32TOP_UAP(cpuset, const cpuset_t *);
2424
2425 return sys__sched_setaffinity(l, &ua, retval);
2426 }
2427
2428 int
netbsd32__sched_getaffinity(struct lwp * l,const struct netbsd32__sched_getaffinity_args * uap,register_t * retval)2429 netbsd32__sched_getaffinity(struct lwp *l,
2430 const struct netbsd32__sched_getaffinity_args *uap,
2431 register_t *retval)
2432 {
2433 /* {
2434 syscallarg(pid_t) pid;
2435 syscallarg(lwpid_t) lid;
2436 syscallarg(netbsd_size_t) size;
2437 syscallarg(netbsd32_cpusetp_t) cpuset;
2438 } */
2439 struct sys__sched_getaffinity_args ua;
2440
2441 NETBSD32TO64_UAP(pid);
2442 NETBSD32TO64_UAP(lid);
2443 NETBSD32TOX_UAP(size, size_t);
2444 NETBSD32TOP_UAP(cpuset, cpuset_t *);
2445
2446 return sys__sched_getaffinity(l, &ua, retval);
2447 }
2448
2449 int
netbsd32__sched_protect(struct lwp * l,const struct netbsd32__sched_protect_args * uap,register_t * retval)2450 netbsd32__sched_protect(struct lwp *l,
2451 const struct netbsd32__sched_protect_args *uap,
2452 register_t *retval)
2453 {
2454 /* {
2455 syscallarg(int) priority;
2456 } */
2457 struct sys__sched_protect_args ua;
2458
2459 NETBSD32TO64_UAP(priority);
2460
2461 return sys__sched_protect(l, &ua, retval);
2462 }
2463
2464 int
netbsd32_dup3(struct lwp * l,const struct netbsd32_dup3_args * uap,register_t * retval)2465 netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap,
2466 register_t *retval)
2467 {
2468 /* {
2469 syscallarg(int) from;
2470 syscallarg(int) to;
2471 syscallarg(int) flags;
2472 } */
2473 struct sys_dup3_args ua;
2474
2475 NETBSD32TO64_UAP(from);
2476 NETBSD32TO64_UAP(to);
2477 NETBSD32TO64_UAP(flags);
2478
2479 return sys_dup3(l, &ua, retval);
2480 }
2481
2482 int
netbsd32_kqueue1(struct lwp * l,const struct netbsd32_kqueue1_args * uap,register_t * retval)2483 netbsd32_kqueue1(struct lwp *l, const struct netbsd32_kqueue1_args *uap,
2484 register_t *retval)
2485 {
2486 /* {
2487 syscallarg(int) flags;
2488 } */
2489 struct sys_kqueue1_args ua;
2490
2491 NETBSD32TO64_UAP(flags);
2492
2493 return sys_kqueue1(l, &ua, retval);
2494 }
2495
2496 int
netbsd32_paccept(struct lwp * l,const struct netbsd32_paccept_args * uap,register_t * retval)2497 netbsd32_paccept(struct lwp *l, const struct netbsd32_paccept_args *uap,
2498 register_t *retval)
2499 {
2500 /* {
2501 syscallarg(int) s;
2502 syscallarg(netbsd32_sockaddrp_t) name;
2503 syscallarg(netbsd32_socklenp_t) anamelen;
2504 syscallarg(const netbsd32_sigsetp_t) mask;
2505 syscallarg(int) flags;
2506 } */
2507 struct sys_paccept_args ua;
2508
2509 NETBSD32TO64_UAP(s);
2510 NETBSD32TOP_UAP(name, struct sockaddr *);
2511 NETBSD32TOP_UAP(anamelen, socklen_t *);
2512 NETBSD32TOP_UAP(mask, const sigset_t *);
2513 NETBSD32TO64_UAP(flags);
2514
2515 return sys_paccept(l, &ua, retval);
2516 }
2517
2518 int
netbsd32_fdiscard(struct lwp * l,const struct netbsd32_fdiscard_args * uap,register_t * retval)2519 netbsd32_fdiscard(struct lwp *l, const struct netbsd32_fdiscard_args *uap,
2520 register_t *retval)
2521 {
2522 /* {
2523 syscallarg(int) fd;
2524 syscallarg(netbsd32_off_t) pos;
2525 syscallarg(netbsd32_off_t) len;
2526 } */
2527 struct sys_fdiscard_args ua;
2528
2529 NETBSD32TO64_UAP(fd);
2530 NETBSD32TO64_UAP(pos);
2531 NETBSD32TO64_UAP(len);
2532
2533 return sys_fdiscard(l, &ua, retval);
2534 }
2535
2536 int
netbsd32_posix_fallocate(struct lwp * l,const struct netbsd32_posix_fallocate_args * uap,register_t * retval)2537 netbsd32_posix_fallocate(struct lwp *l, const struct netbsd32_posix_fallocate_args *uap,
2538 register_t *retval)
2539 {
2540 /* {
2541 syscallarg(int) fd;
2542 syscallarg(netbsd32_off_t) pos;
2543 syscallarg(netbsd32_off_t) len;
2544 } */
2545 struct sys_posix_fallocate_args ua;
2546
2547 NETBSD32TO64_UAP(fd);
2548 NETBSD32TO64_UAP(pos);
2549 NETBSD32TO64_UAP(len);
2550
2551 return sys_posix_fallocate(l, &ua, retval);
2552 }
2553
2554 int
netbsd32_pset_create(struct lwp * l,const struct netbsd32_pset_create_args * uap,register_t * retval)2555 netbsd32_pset_create(struct lwp *l,
2556 const struct netbsd32_pset_create_args *uap, register_t *retval)
2557 {
2558 /* {
2559 syscallarg(netbsd32_psetidp_t) psid;
2560 }; */
2561 struct sys_pset_create_args ua;
2562
2563 NETBSD32TOP_UAP(psid, psetid_t);
2564
2565 return sys_pset_create(l, &ua, retval);
2566 }
2567
2568 int
netbsd32_pset_destroy(struct lwp * l,const struct netbsd32_pset_destroy_args * uap,register_t * retval)2569 netbsd32_pset_destroy(struct lwp *l,
2570 const struct netbsd32_pset_destroy_args *uap, register_t *retval)
2571 {
2572 /* {
2573 syscallarg(psetid_t) psid;
2574 }; */
2575
2576 return sys_pset_destroy(l, (const void *)uap, retval);
2577 }
2578
2579 int
netbsd32_pset_assign(struct lwp * l,const struct netbsd32_pset_assign_args * uap,register_t * retval)2580 netbsd32_pset_assign(struct lwp *l,
2581 const struct netbsd32_pset_assign_args *uap, register_t *retval)
2582 {
2583 /* {
2584 syscallarg(psetid_t) psid;
2585 syscallarg(cpuid_t) cpuid;
2586 syscallarg(netbsd32_psetidp_t) opsid;
2587 }; */
2588 struct sys_pset_assign_args ua;
2589
2590 SCARG(&ua, psid) = SCARG(uap, psid);
2591 NETBSD32TO64_UAP(cpuid);
2592 NETBSD32TOP_UAP(opsid, psetid_t);
2593
2594 return sys_pset_assign(l, &ua, retval);
2595 }
2596
2597 int
netbsd32__pset_bind(struct lwp * l,const struct netbsd32__pset_bind_args * uap,register_t * retval)2598 netbsd32__pset_bind(struct lwp *l,
2599 const struct netbsd32__pset_bind_args *uap, register_t *retval)
2600 {
2601 /* {
2602 syscallarg(idtype_t) idtype;
2603 syscallarg(id_t) first_id;
2604 syscallarg(id_t) second_id;
2605 syscallarg(psetid_t) psid;
2606 syscallarg(netbsd32_psetidp_t) opsid;
2607 }; */
2608 struct sys__pset_bind_args ua;
2609
2610 SCARG(&ua, idtype) = SCARG(uap, idtype);
2611 SCARG(&ua, first_id) = SCARG(uap, first_id);
2612 SCARG(&ua, second_id) = SCARG(uap, second_id);
2613 SCARG(&ua, psid) = SCARG(uap, psid);
2614 NETBSD32TOP_UAP(opsid, psetid_t);
2615
2616 return sys__pset_bind(l, &ua, retval);
2617 }
2618
2619 int
netbsd32_getrandom(struct lwp * l,const struct netbsd32_getrandom_args * uap,register_t * retval)2620 netbsd32_getrandom(struct lwp *l, const struct netbsd32_getrandom_args *uap,
2621 register_t *retval)
2622 {
2623 /* {
2624 syscallarg(netbsd32_voidp) buf;
2625 syscallarg(netbsd32_size_t) buflen;
2626 syscallarg(unsigned) flags;
2627 } */
2628 struct sys_getrandom_args ua;
2629
2630 NETBSD32TOP_UAP(buf, void *);
2631 NETBSD32TOX_UAP(buflen, size_t);
2632 NETBSD32TO64_UAP(flags);
2633 return sys_getrandom(l, &ua, retval);
2634 }
2635
2636 int
netbsd32_eventfd(struct lwp * l,const struct netbsd32_eventfd_args * uap,register_t * retval)2637 netbsd32_eventfd(struct lwp *l,
2638 const struct netbsd32_eventfd_args *uap, register_t *retval)
2639 {
2640 /* {
2641 syscallarg(unsigned int) val;
2642 syscallarg(int) flags;
2643 } */
2644 struct sys_eventfd_args ua;
2645
2646 NETBSD32TO64_UAP(val);
2647 NETBSD32TO64_UAP(flags);
2648 return sys_eventfd(l, &ua, retval);
2649 }
2650
2651 int
netbsd32_memfd_create(struct lwp * l,const struct netbsd32_memfd_create_args * uap,register_t * retval)2652 netbsd32_memfd_create(struct lwp *l,
2653 const struct netbsd32_memfd_create_args *uap, register_t *retval)
2654 {
2655 /* {
2656 syscallarg(const netbsd32_charp) name;
2657 syscallarg(unsigned int) flags;
2658 } */
2659 struct sys_memfd_create_args ua;
2660
2661 NETBSD32TOP_UAP(name, const char);
2662 NETBSD32TO64_UAP(flags);
2663 return sys_memfd_create(l, &ua, retval);
2664 }
2665
2666 /*
2667 * MI indirect system call support.
2668 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.
2669 */
2670
2671 #define NETBSD32_SYSCALL
2672 #undef SYS_NSYSENT
2673 #define SYS_NSYSENT NETBSD32_SYS_NSYSENT
2674
2675 #define SYS_SYSCALL netbsd32_syscall
2676 #include "../../kern/sys_syscall.c"
2677 #undef SYS_SYSCALL
2678
2679 #define SYS_SYSCALL netbsd32____syscall
2680 #include "../../kern/sys_syscall.c"
2681 #undef SYS_SYSCALL
2682