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
This commit is contained in:
Konstantin Belousov 2020-08-23 19:43:47 +00:00
parent 3a3992fb86
commit 2b313da3bd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364513
2 changed files with 19 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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) \