From 54e6e0deb4853dae7e97e7d5659c05e95bebac32 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 26 Jul 2022 17:30:30 -0600 Subject: [PATCH] kboot: Implement host_ioctl Sponsored by: Netflix --- stand/kboot/arch/aarch64/syscall_nr.h | 1 + stand/kboot/arch/amd64/syscall_nr.h | 1 + stand/kboot/arch/powerpc64/syscall_nr.h | 1 + stand/kboot/host_syscall.h | 1 + stand/kboot/host_syscalls.c | 6 ++++++ 5 files changed, 10 insertions(+) diff --git a/stand/kboot/arch/aarch64/syscall_nr.h b/stand/kboot/arch/aarch64/syscall_nr.h index 79bf22947e94..83069dd8dc76 100644 --- a/stand/kboot/arch/aarch64/syscall_nr.h +++ b/stand/kboot/arch/aarch64/syscall_nr.h @@ -5,6 +5,7 @@ #define SYS_getdents64 61 #define SYS_getpid 172 #define SYS_gettimeofday 169 +#define SYS_ioctl 29 #define SYS_lseek 62 #define SYS_kexec_load 104 #define SYS_mkdirat 34 diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h index 71469109a55e..2cf26d7ca4dc 100644 --- a/stand/kboot/arch/amd64/syscall_nr.h +++ b/stand/kboot/arch/amd64/syscall_nr.h @@ -4,6 +4,7 @@ #define SYS_getdents64 217 #define SYS_getpid 39 #define SYS_gettimeofday 96 +#define SYS_ioctl 16 #define SYS_kexec_load 246 #define SYS_lseek 8 #define SYS_mkdirat 258 diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h index 7b425e36c517..71f2452c9124 100644 --- a/stand/kboot/arch/powerpc64/syscall_nr.h +++ b/stand/kboot/arch/powerpc64/syscall_nr.h @@ -5,6 +5,7 @@ #define SYS_getdents64 202 #define SYS_getpid 20 #define SYS_gettimeofday 78 +#define SYS_ioctl 54 #define SYS_kexec_load 268 #define SYS_llseek 140 #define SYS_mkdirat 287 diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 09f5355e520d..0029004f675a 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -160,6 +160,7 @@ int host_fstat(int fd, struct host_kstat *sb); int host_getdents64(int fd, void *dirp, int count); int host_getpid(void); int host_gettimeofday(struct host_timeval *a, void *b); +int host_ioctl(int fd, unsigned long request, unsigned long arg); int host_kexec_load(unsigned long entry, unsigned long nsegs, struct host_kexec_segment *segs, unsigned long flags); ssize_t host_llseek(int fd, int32_t offset_high, int32_t offset_lo, uint64_t *result, int whence); int host_mkdir(const char *, host_mode_t); diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c index 8b364083b15c..1ffa04948fdf 100644 --- a/stand/kboot/host_syscalls.c +++ b/stand/kboot/host_syscalls.c @@ -54,6 +54,12 @@ host_gettimeofday(struct host_timeval *a, void *b) return host_syscall(SYS_gettimeofday, (uintptr_t)a, (uintptr_t)b); } +int +host_ioctl(int fd, unsigned long request, unsigned long arg) +{ + return host_syscall(SYS_ioctl, fd, request, arg); +} + int host_kexec_load(unsigned long entry, unsigned long nsegs, struct host_kexec_segment *segs, unsigned long flags) {