Retire sv_transtrap

Call translate_traps directly from sendsig().

MFC after:		2 weeks
This commit is contained in:
Dmitry Chagin 2022-05-20 14:54:03 +03:00
parent f34a9180ae
commit eca368ecb6
19 changed files with 5 additions and 36 deletions

View File

@ -59,7 +59,6 @@ extern char _binary_elf_vdso_so_1_size;
struct sysentvec elf64_freebsd_sysvec_la48 = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = _binary_elf_vdso_so_1_start,
@ -103,7 +102,6 @@ struct sysentvec elf64_freebsd_sysvec_la48 = {
struct sysentvec elf64_freebsd_sysvec_la57 = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = _binary_elf_vdso_so_1_start,

View File

@ -620,10 +620,6 @@ trap(struct trapframe *frame)
return;
}
/* Translate fault for emulators (e.g. Linux) */
if (*p->p_sysent->sv_transtrap != NULL)
signo = (*p->p_sysent->sv_transtrap)(signo, type);
ksiginfo_init_trap(&ksi);
ksi.ksi_signo = signo;
ksi.ksi_code = ucode;

View File

@ -627,7 +627,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
td = curthread;
p = td->td_proc;
PROC_LOCK_ASSERT(p, MA_OWNED);
sig = ksi->ksi_signo;
sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno);
psp = p->p_sigacts;
code = ksi->ksi_code;
mtx_assert(&psp->ps_mtx, MA_OWNED);
@ -763,7 +763,6 @@ linux_vsyscall(struct thread *td)
struct sysentvec elf_linux_sysvec = {
.sv_size = LINUX_SYS_MAXSYSCALL,
.sv_table = linux_sysent,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_rt_sendsig,
.sv_sigcode = &_binary_linux_vdso_so_o_start,

View File

@ -294,7 +294,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int sig;
int code;
sig = ksi->ksi_signo;
sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno);
code = ksi->ksi_code;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
@ -404,7 +404,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int oonstack;
int sig, code;
sig = ksi->ksi_signo;
sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno);
code = ksi->ksi_code;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
@ -924,7 +924,6 @@ linux32_fixlimit(struct rlimit *rl, int which)
struct sysentvec elf_linux_sysvec = {
.sv_size = LINUX32_SYS_MAXSYSCALL,
.sv_table = linux32_sysent,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_sendsig,
.sv_sigcode = &_binary_linux32_vdso_so_o_start,

View File

@ -66,7 +66,6 @@ u_long elf_hwcap2;
struct sysentvec elf32_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode,

View File

@ -84,7 +84,6 @@ u_long __read_frequently elf32_hwcap2;
static struct sysentvec elf32_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = freebsd32_sysent,
.sv_transtrap = NULL,
.sv_fixup = elf32_freebsd_fixup,
.sv_sendsig = freebsd32_sendsig,
.sv_sigcode = aarch32_sigcode,

View File

@ -64,7 +64,6 @@ struct arm64_addr_mask elf64_addr_mask;
static struct sysentvec elf64_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode,

View File

@ -544,7 +544,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
struct sysentvec elf_linux_sysvec = {
.sv_size = LINUX_SYS_MAXSYSCALL,
.sv_table = linux_sysent,
.sv_transtrap = NULL,
.sv_fixup = linux_elf_fixup,
.sv_sendsig = linux_rt_sendsig,
.sv_sigcode = &_binary_linux_vdso_so_o_start,

View File

@ -106,7 +106,6 @@ SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxvmem, CTLFLAG_RWTUN, &ia32_maxvmem, 0, "
struct sysentvec ia32_freebsd_sysvec = {
.sv_size = FREEBSD32_SYS_MAXSYSCALL,
.sv_table = freebsd32_sysent,
.sv_transtrap = NULL,
.sv_fixup = elf32_freebsd_fixup,
.sv_sendsig = ia32_sendsig,
.sv_sigcode = _binary_elf_vdso32_so_1_start,

View File

@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
struct sysentvec elf32_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode,

View File

@ -685,10 +685,6 @@ trap(struct trapframe *frame)
return;
}
/* Translate fault for emulators (e.g. Linux) */
if (*p->p_sysent->sv_transtrap != NULL)
signo = (*p->p_sysent->sv_transtrap)(signo, type);
ksiginfo_init_trap(&ksi);
ksi.ksi_signo = signo;
ksi.ksi_code = ucode;

View File

@ -402,7 +402,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
int sig, code;
int oonstack;
sig = ksi->ksi_signo;
sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno);
code = ksi->ksi_code;
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
@ -509,7 +509,7 @@ linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
PROC_LOCK_ASSERT(p, MA_OWNED);
psp = p->p_sigacts;
sig = ksi->ksi_signo;
sig = linux_translate_traps(ksi->ksi_signo, ksi->ksi_trapno);
mtx_assert(&psp->ps_mtx, MA_OWNED);
if (SIGISMEMBER(psp->ps_siginfo, sig)) {
/* Signal handler installed with SA_SIGINFO. */
@ -827,7 +827,6 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp,
struct sysentvec linux_sysvec = {
.sv_size = LINUX_SYS_MAXSYSCALL,
.sv_table = linux_sysent,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup,
.sv_sendsig = linux_sendsig,
.sv_sigcode = &_binary_linux_vdso_so_o_start,
@ -865,7 +864,6 @@ INIT_SYSENTVEC(aout_sysvec, &linux_sysvec);
struct sysentvec elf_linux_sysvec = {
.sv_size = LINUX_SYS_MAXSYSCALL,
.sv_table = linux_sysent,
.sv_transtrap = linux_translate_traps,
.sv_fixup = linux_fixup_elf,
.sv_sendsig = linux_sendsig,
.sv_sigcode = &_binary_linux_vdso_so_o_start,

View File

@ -76,7 +76,6 @@ static int aout_fixup(uintptr_t *stack_base, struct image_params *imgp);
struct sysentvec aout_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = aout_fixup,
.sv_sendsig = sendsig,
.sv_sigcode = sigcode,
@ -127,7 +126,6 @@ static int aout_szsigcode;
struct sysentvec aout_sysvec = {
.sv_size = FREEBSD32_SYS_MAXSYSCALL,
.sv_table = freebsd32_sysent,
.sv_transtrap = NULL,
.sv_fixup = aout_fixup,
.sv_sendsig = ia32_sendsig,
.sv_sigcode = _binary_elf_vdso32_so_1_start,

View File

@ -416,7 +416,6 @@ null_set_fork_retval(struct thread *td __unused)
struct sysentvec null_sysvec = {
.sv_size = 0,
.sv_table = NULL,
.sv_transtrap = NULL,
.sv_fixup = NULL,
.sv_sendsig = NULL,
.sv_sigcode = NULL,

View File

@ -90,7 +90,6 @@ struct sysentvec elf32_freebsd_sysvec = {
#else
.sv_table = sysent,
#endif
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs),
.sv_sendsig = sendsig,

View File

@ -64,7 +64,6 @@ static void exec_setregs_funcdesc(struct thread *td, struct image_params *imgp,
struct sysentvec elf64_freebsd_sysvec_v1 = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode64,
@ -108,7 +107,6 @@ struct sysentvec elf64_freebsd_sysvec_v1 = {
struct sysentvec elf64_freebsd_sysvec_v2 = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode64, /* Fixed up in ppc64_init_sysvecs(). */

View File

@ -495,8 +495,6 @@ trap(struct trapframe *frame)
}
if (sig != 0) {
if (p->p_sysent->sv_transtrap != NULL)
sig = (p->p_sysent->sv_transtrap)(sig, type);
ksiginfo_init_trap(&ksi);
ksi.ksi_signo = sig;
ksi.ksi_code = (int) ucode; /* XXX, not POSIX */

View File

@ -66,7 +66,6 @@ u_long elf_hwcap;
static struct sysentvec elf64_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
.sv_fixup = __elfN(freebsd_fixup),
.sv_sendsig = sendsig,
.sv_sigcode = sigcode,

View File

@ -103,8 +103,6 @@ struct note_info_list;
struct sysentvec {
int sv_size; /* number of entries */
struct sysent *sv_table; /* pointer to sysent */
int (*sv_transtrap)(int, int);
/* translate trap-to-signal mapping */
int (*sv_fixup)(uintptr_t *, struct image_params *);
/* stack fixup function */
void (*sv_sendsig)(void (*)(int), struct ksiginfo *, struct __sigset *);