| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: linux32_misc.c,v 1.30.2.2 2020/12/17 03:02:06 thorpej Exp $ */ | | 1 | /* $NetBSD: linux32_misc.c,v 1.30.2.3 2021/01/03 16:12:44 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Frank van der Linden and Eric Haszlakiewicz; by Jason R. Thorpe | | 8 | * by Frank van der Linden and Eric Haszlakiewicz; by Jason R. Thorpe |
9 | * of the Numerical Aerospace Simulation Facility, NASA Ames Research Center; | | 9 | * of the Numerical Aerospace Simulation Facility, NASA Ames Research Center; |
10 | * by Edgar Fu\ss, Mathematisches Institut der Uni Bonn. | | 10 | * by Edgar Fu\ss, Mathematisches Institut der Uni Bonn. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | * POSSIBILITY OF SUCH DAMAGE. | | 31 | * POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.30.2.2 2020/12/17 03:02:06 thorpej Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.30.2.3 2021/01/03 16:12:44 thorpej Exp $"); |
36 | | | 36 | |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/proc.h> | | 38 | #include <sys/proc.h> |
39 | #include <sys/time.h> | | 39 | #include <sys/time.h> |
40 | #include <sys/types.h> | | 40 | #include <sys/types.h> |
41 | #include <sys/fstypes.h> | | 41 | #include <sys/fstypes.h> |
42 | #include <sys/vfs_syscalls.h> | | 42 | #include <sys/vfs_syscalls.h> |
43 | #include <sys/ptrace.h> | | 43 | #include <sys/ptrace.h> |
44 | #include <sys/syscall.h> | | 44 | #include <sys/syscall.h> |
45 | #include <sys/poll.h> | | 45 | #include <sys/poll.h> |
46 | #include <sys/futex.h> | | 46 | #include <sys/futex.h> |
47 | | | 47 | |
48 | #include <compat/netbsd32/netbsd32.h> | | 48 | #include <compat/netbsd32/netbsd32.h> |
| @@ -370,13 +370,63 @@ linux32_sys_eventfd2(struct lwp *l, cons | | | @@ -370,13 +370,63 @@ linux32_sys_eventfd2(struct lwp *l, cons |
370 | register_t *retval) | | 370 | register_t *retval) |
371 | { | | 371 | { |
372 | /* { | | 372 | /* { |
373 | syscallarg(unsigned int) initval; | | 373 | syscallarg(unsigned int) initval; |
374 | syscallarg(int) flags; | | 374 | syscallarg(int) flags; |
375 | } */ | | 375 | } */ |
376 | struct linux_sys_eventfd2_args ua; | | 376 | struct linux_sys_eventfd2_args ua; |
377 | | | 377 | |
378 | NETBSD32TO64_UAP(initval); | | 378 | NETBSD32TO64_UAP(initval); |
379 | NETBSD32TO64_UAP(flags); | | 379 | NETBSD32TO64_UAP(flags); |
380 | | | 380 | |
381 | return linux_sys_eventfd2(l, &ua, retval); | | 381 | return linux_sys_eventfd2(l, &ua, retval); |
382 | } | | 382 | } |
| | | 383 | |
| | | 384 | static inline off_t |
| | | 385 | linux32_hilo_to_off_t(unsigned long hi, unsigned long lo) |
| | | 386 | { |
| | | 387 | return (((off_t)hi) << 32) | lo; |
| | | 388 | } |
| | | 389 | |
| | | 390 | int |
| | | 391 | linux32_sys_preadv(struct lwp *l, const struct linux32_sys_preadv_args *uap, |
| | | 392 | register_t *retval) |
| | | 393 | { |
| | | 394 | /* { |
| | | 395 | syscallarg(int) fd; |
| | | 396 | syscallarg(const netbsd32_iovecp_t) iovp; |
| | | 397 | syscallarg(int) iovcnt; |
| | | 398 | syscallarg(netbsd32_u_long) off_lo; |
| | | 399 | syscallarg(netbsd32_u_long) off_hi; |
| | | 400 | } */ |
| | | 401 | struct netbsd32_preadv_args ua; |
| | | 402 | |
| | | 403 | SCARG(&ua, fd) = SCARG(uap, fd); |
| | | 404 | SCARG(&ua, iovp) = SCARG(uap, iovp); |
| | | 405 | SCARG(&ua, iovcnt) = SCARG(uap, iovcnt); |
| | | 406 | SCARG(&ua, PAD) = 0; |
| | | 407 | SCARG(&ua, offset) = linux32_hilo_to_off_t(SCARG(uap, off_hi), |
| | | 408 | SCARG(uap, off_lo)); |
| | | 409 | return netbsd32_preadv(l, &ua, retval); |
| | | 410 | } |
| | | 411 | |
| | | 412 | int |
| | | 413 | linux32_sys_pwritev(struct lwp *l, const struct linux32_sys_pwritev_args *uap, |
| | | 414 | register_t *retval) |
| | | 415 | { |
| | | 416 | /* { |
| | | 417 | syscallarg(int) fd; |
| | | 418 | syscallarg(const netbsd32_iovecp_t) iovp; |
| | | 419 | syscallarg(int) iovcnt; |
| | | 420 | syscallarg(netbsd32_u_long) off_lo; |
| | | 421 | syscallarg(netbsd32_u_long) off_hi; |
| | | 422 | } */ |
| | | 423 | struct netbsd32_pwritev_args ua; |
| | | 424 | |
| | | 425 | SCARG(&ua, fd) = SCARG(uap, fd); |
| | | 426 | SCARG(&ua, iovp) = SCARG(uap, iovp); |
| | | 427 | SCARG(&ua, iovcnt) = SCARG(uap, iovcnt); |
| | | 428 | SCARG(&ua, PAD) = 0; |
| | | 429 | SCARG(&ua, offset) = linux32_hilo_to_off_t(SCARG(uap, off_hi), |
| | | 430 | SCARG(uap, off_lo)); |
| | | 431 | return netbsd32_pwritev(l, &ua, retval); |
| | | 432 | } |