From owner-dev-commits-src-all@freebsd.org Tue Jul 20 07:10:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D7FA666448; Tue, 20 Jul 2021 07:10:23 +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 4GTVGl0x0Xz3st5; Tue, 20 Jul 2021 07:10:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 08FF92631D; Tue, 20 Jul 2021 07:10:23 +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 16K7AMXN030206; Tue, 20 Jul 2021 07:10:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16K7AMeY030205; Tue, 20 Jul 2021 07:10:22 GMT (envelope-from git) Date: Tue, 20 Jul 2021 07:10:22 GMT Message-Id: <202107200710.16K7AMeY030205@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 21629e2a4564 - main - Modify exec_sysvec_init() to allow non-native abi to setup their sysentvecs. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21629e2a456446bff101813a16f8cba046f44176 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 07:10:23 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=21629e2a456446bff101813a16f8cba046f44176 commit 21629e2a456446bff101813a16f8cba046f44176 Author: Dmitry Chagin AuthorDate: 2021-07-20 06:53:21 +0000 Commit: Dmitry Chagin CommitDate: 2021-07-20 06:53:21 +0000 Modify exec_sysvec_init() to allow non-native abi to setup their sysentvecs. For future use in the Linux emulation layer modify the exec_sysvec_init() to allow non-native abi to fill sv_timekeep_base and sv_shared_page_obj. Reviewed by: kib Differential revision: https://reviews.freebsd.org/D30898 MFC after: 2 weeks --- sys/kern/kern_sharedpage.c | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_sharedpage.c b/sys/kern/kern_sharedpage.c index 6f14117abf39..335f49b7a9f6 100644 --- a/sys/kern/kern_sharedpage.c +++ b/sys/kern/kern_sharedpage.c @@ -308,27 +308,43 @@ exec_sysvec_init(void *param) #ifdef RANDOM_FENESTRASX ptrdiff_t base; #endif + u_int flags; sv = (struct sysentvec *)param; - if ((sv->sv_flags & SV_SHP) == 0) + flags = sv->sv_flags; + if ((flags & SV_SHP) == 0) return; + MPASS(sv->sv_shared_page_obj == NULL); + MPASS(sv->sv_shared_page_base != 0); + sv->sv_shared_page_obj = shared_page_obj; - sv->sv_sigcode_base = sv->sv_shared_page_base + - shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); - if ((sv->sv_flags & SV_ABI_MASK) != SV_ABI_FREEBSD) - return; - if ((sv->sv_flags & SV_TIMEKEEP) != 0) { + if ((flags & SV_ABI_MASK) == SV_ABI_FREEBSD) { + sv->sv_sigcode_base = sv->sv_shared_page_base + + shared_page_fill(*(sv->sv_szsigcode), 16, sv->sv_sigcode); + } + if ((flags & SV_TIMEKEEP) != 0) { #ifdef COMPAT_FREEBSD32 - if ((sv->sv_flags & SV_ILP32) != 0) { - KASSERT(compat32_svtk == NULL, - ("Compat32 already registered")); - compat32_svtk = alloc_sv_tk_compat32(); + if ((flags & SV_ILP32) != 0) { + if ((flags & SV_ABI_MASK) == SV_ABI_FREEBSD) { + KASSERT(compat32_svtk == NULL, + ("Compat32 already registered")); + compat32_svtk = alloc_sv_tk_compat32(); + } else { + KASSERT(compat32_svtk != NULL, + ("Compat32 not registered")); + } sv->sv_timekeep_base = sv->sv_shared_page_base + compat32_svtk->sv_timekeep_off; } else { #endif - KASSERT(host_svtk == NULL, ("Host already registered")); - host_svtk = alloc_sv_tk(); + if ((flags & SV_ABI_MASK) == SV_ABI_FREEBSD) { + KASSERT(host_svtk == NULL, + ("Host already registered")); + host_svtk = alloc_sv_tk(); + } else { + KASSERT(host_svtk != NULL, + ("Host not registered")); + } sv->sv_timekeep_base = sv->sv_shared_page_base + host_svtk->sv_timekeep_off; #ifdef COMPAT_FREEBSD32 @@ -336,7 +352,8 @@ exec_sysvec_init(void *param) #endif } #ifdef RANDOM_FENESTRASX - if ((sv->sv_flags & SV_RNG_SEED_VER) != 0) { + if ((flags & (SV_ABI_MASK | SV_RNG_SEED_VER)) == + (SV_ABI_FREEBSD | SV_RNG_SEED_VER)) { /* * Only allocate a single VDSO entry for multiple sysentvecs, * i.e., native and COMPAT32.