From nobody Fri Jul 15 18:03:53 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lkzkf02wwz4TGcf; Fri, 15 Jul 2022 18:03:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lkzkd6MlSz3Qnv; Fri, 15 Jul 2022 18:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=beIkEo4ISW1Y8Z20ycmjHXBPMRrYHtQ2ClrS2jQ8H2w=; b=SIIeW9X9ViMrpFr8aH/Bc0Ey5MPF8W3LMcioc+3FFe9h16KrBLLYo5kKkgaowm0Nv5ReeM /BN37vZD+pgMkStwl5otEJw9nFxg3tFPK7GaqXsPcjiSG+hOhUgkjqbtgctN1Ms9+dUDWN F3TH5fsidd4H44fRQqseYpSJSuS1je4gdmXHHAdUqZ8QcG8V9IaCzh8dpZnLcViypG15ji vwZ4UI52o1X5K+jWWbaIPbFFeyL/frjicObAqF8tDcgjVKBgpZPNskgeaOQBif6be7OihN +nm2FW5hJG03AjphR/C/dhZDb0TrENX3/Z19kkqbiYTSeWBeNAF0Tvk69tZPsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lkzkd5NJ2zr4S; Fri, 15 Jul 2022 18:03:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26FI3rlu060109; Fri, 15 Jul 2022 18:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26FI3rmH060108; Fri, 15 Jul 2022 18:03:53 GMT (envelope-from git) Date: Fri, 15 Jul 2022 18:03:53 GMT Message-Id: <202207151803.26FI3rmH060108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: edc23ddf9cf3 - main - kboot: Reimplement older system calls in terms of newer ones List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: edc23ddf9cf35d7ea9baf72d14449e04508d2314 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657908233; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=beIkEo4ISW1Y8Z20ycmjHXBPMRrYHtQ2ClrS2jQ8H2w=; b=Q8n4NSsHPtTi7r3nhk+f9aBoMvixdU9de1wtejtQoCAgjoc00UsF/0u9B2nW9xRRx8njTS RGwXPmzQJ1G8Nrj07GyqrODbkDvKQZgPsBCZvouEppCiV2QnJutmDtseaDgZwfovpXJ6nc z5xKPfDed8p/er4+f0HSYE0aPd+rK05Hnsb0TcboQzAosBcY2ObzULGVKOW4c/f6Bjko2I OZ14o3MoG6Bbh/jYvKWx9awblbfZj0E5ofUaGMHZ/tTQY2J5joj/n4KeKjuOJtlKWE5Man ZwXf4u/fTOm/ZE9C2SlWQfX7xikZoa3v/axO7ISdQo1Nj4BwuPw/a7pKsZ152Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657908233; a=rsa-sha256; cv=none; b=USWEnZiQ9Buoo+g9MgAtW0WdOmLIrk/tDAgOYX/BmCfI32w/tEC0ozuLAjzY2AtLv+vECg 0H9HdeRiwrmMgqYrZbC6igVT0rb9Tk1xjjBR6WGFXo/7Fbn81AKlVYLvNdUeQ0UtdjkOU6 VyBBM2WF33DGFzLL39JayYsH/ztO777oi3aerQQeEOU213IB00/N9WFTQszJDVdjCv5FbQ K8+P64TldQApoZJ/fv61mtKmVmayxVMqJZNwCWtRE9eVzf+yuSeziAUnyo915GODnDCOMI tfUXW5qDtHjBTktCSoI8g/b8kC4CKXHfixQi62T9IMkNdiasnEzEbXa8YDXYpw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=edc23ddf9cf35d7ea9baf72d14449e04508d2314 commit edc23ddf9cf35d7ea9baf72d14449e04508d2314 Author: Warner Losh AuthorDate: 2022-07-07 22:58:27 +0000 Commit: Warner Losh CommitDate: 2022-07-15 18:00:49 +0000 kboot: Reimplement older system calls in terms of newer ones aarch64 doesn't have open, just openat, etc. Cope. Sponsored by: Netflix --- stand/kboot/arch/amd64/syscall_nr.h | 6 +++--- stand/kboot/arch/powerpc64/syscall_nr.h | 4 ++-- stand/kboot/host_syscall.h | 2 ++ stand/kboot/host_syscalls.c | 12 ++++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h index 9c4fb1024319..506f85b3e731 100644 --- a/stand/kboot/arch/amd64/syscall_nr.h +++ b/stand/kboot/arch/amd64/syscall_nr.h @@ -1,13 +1,13 @@ #define SYS_close 3 #define SYS_getdents 78 #define SYS_gettimeofday 96 -#define SYS_lseek 8 #define SYS_kexec_load 246 +#define SYS_lseek 8 #define SYS_mmap 9 -#define SYS_open 2 +#define SYS_openat 257 +#define SYS_pselect6 270 #define SYS_read 0 #define SYS_reboot 169 -#define SYS_select 23 #define SYS_uname 63 #define SYS_write 1 diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h index 187c434a13d7..592f3d6a7631 100644 --- a/stand/kboot/arch/powerpc64/syscall_nr.h +++ b/stand/kboot/arch/powerpc64/syscall_nr.h @@ -4,10 +4,10 @@ #define SYS_kexec_load 268 #define SYS_llseek 140 #define SYS_mmap 90 -#define SYS_open 5 +#define SYS_openat 286 +#define SYS_pselect6 280 #define SYS_read 3 #define SYS_reboot 88 -#define SYS_select 142 #define SYS_uname 120 #define SYS_write 4 diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 3a640af30565..b13829e4d05b 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -48,6 +48,8 @@ struct host_timeval { long tv_usec; }; +#define HOST_AT_FDCWD -100 /* Relative to current directory */ + /* * System Calls */ diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c index 66014462ccdd..3db066acb781 100644 --- a/stand/kboot/host_syscalls.c +++ b/stand/kboot/host_syscalls.c @@ -54,7 +54,7 @@ host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) int host_open(const char *path, int flags, int mode) { - return host_syscall(SYS_open, (uintptr_t)path, flags, mode); + return host_syscall(SYS_openat, HOST_AT_FDCWD, (uintptr_t)path, flags, mode); /* XXX original overrode errors */ } @@ -75,7 +75,15 @@ int host_select(int nfds, long *readfds, long *writefds, long *exceptfds, struct host_timeval *timeout) { - return host_syscall(SYS_select, nfds, (uintptr_t)readfds, (uintptr_t)writefds, (uintptr_t)exceptfds, (uintptr_t)timeout, 0); + struct timespec ts = { .tv_sec = timeout->tv_sec, .tv_nsec = timeout->tv_usec * 1000 }; + + /* + * Note, final arg is a sigset_argpack since most arch can only have 6 + * syscall args. Since we're not masking signals, though, we can just + * pass a NULL. + */ + return host_syscall(SYS_pselect6, nfds, (uintptr_t)readfds, (uintptr_t)writefds, + (uintptr_t)exceptfds, (uintptr_t)&ts, (uintptr_t)NULL); } int