Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Aug 2020 19:43:48 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364513 - in head/sys: kern sys
Message-ID:  <202008231943.07NJhmcX087123@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)					\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008231943.07NJhmcX087123>