From owner-svn-src-all@freebsd.org Sun Aug 23 19:43:51 2020 Return-Path: Delivered-To: svn-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 6F9E53C6B23; Sun, 23 Aug 2020 19:43:50 +0000 (UTC) (envelope-from kib@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BZQfs2PRKz49FD; Sun, 23 Aug 2020 19:43:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87E80C98F; Sun, 23 Aug 2020 19:43:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07NJhmRC087125; Sun, 23 Aug 2020 19:43:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NJhmcX087123; Sun, 23 Aug 2020 19:43:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008231943.07NJhmcX087123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Aug 2020 19:43:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364513 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 364513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2020 19:43:52 -0000 Author: kib Date: Sun Aug 23 19:43:47 2020 New Revision: 364513 URL: https://svnweb.freebsd.org/changeset/base/364513 Log: kern_sharedpage.c: Add exec_sysvec_init_secondary() helper. It allows a sysent to share existing usermode data in shared page with other sysent, assuming ABI differences are not in the layout of the page. Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D25273 Modified: head/sys/kern/kern_sharedpage.c head/sys/sys/sysent.h Modified: head/sys/kern/kern_sharedpage.c ============================================================================== --- head/sys/kern/kern_sharedpage.c Sun Aug 23 19:42:48 2020 (r364512) +++ head/sys/kern/kern_sharedpage.c Sun Aug 23 19:43:47 2020 (r364513) @@ -288,3 +288,21 @@ exec_sysvec_init(void *param) #endif } } + +void +exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2) +{ + MPASS((sv2->sv_flags & SV_ABI_MASK) == (sv->sv_flags & SV_ABI_MASK)); + MPASS((sv2->sv_flags & SV_TIMEKEEP) == (sv->sv_flags & SV_TIMEKEEP)); + MPASS((sv2->sv_flags & SV_SHP) != 0 && (sv->sv_flags & SV_SHP) != 0); + + sv2->sv_shared_page_obj = sv->sv_shared_page_obj; + sv2->sv_sigcode_base = sv2->sv_shared_page_base + + (sv->sv_sigcode_base - sv->sv_shared_page_base); + if ((sv2->sv_flags & SV_ABI_MASK) != SV_ABI_FREEBSD) + return; + if ((sv2->sv_flags & SV_TIMEKEEP) != 0) { + sv2->sv_timekeep_base = sv2->sv_shared_page_base + + (sv->sv_timekeep_base - sv->sv_shared_page_base); + } +} Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Sun Aug 23 19:42:48 2020 (r364512) +++ head/sys/sys/sysent.h Sun Aug 23 19:43:47 2020 (r364513) @@ -321,6 +321,7 @@ int shared_page_alloc(int size, int align); int shared_page_fill(int size, int align, const void *data); void shared_page_write(int base, int size, const void *data); void exec_sysvec_init(void *param); +void exec_sysvec_init_secondary(struct sysentvec *sv, struct sysentvec *sv2); void exec_inittk(void); #define INIT_SYSENTVEC(name, sv) \