Commit changes missed from r237435. Properly calculate the signal

trampoline addresses after the shared page is enabled.  Handle FreeBSD
ABIs without shared page support too.

Reported and tested by:	David Wolfskill <david catwhisker org>
	 (previous version)
Pointy hat to: kib
MFC after:   1 month
This commit is contained in:
Konstantin Belousov 2012-06-22 16:05:56 +00:00
parent afce448c1a
commit a30facd9c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=237445

View File

@ -469,7 +469,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
}
regs->tf_esp = (int)fp;
regs->tf_eip = PS_STRINGS - szosigcode;
if (p->p_sysent->sv_sigcode_base != 0) {
regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
szosigcode;
} else {
/* a.out sysentvec does not use shared page */
regs->tf_eip = p->p_sysent->sv_psstrings - szosigcode;
}
regs->tf_eflags &= ~(PSL_T | PSL_D);
regs->tf_cs = _ucodesel;
regs->tf_ds = _udatasel;
@ -596,7 +602,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
}
regs->tf_esp = (int)sfp;
regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode;
regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
szfreebsd4_sigcode;
regs->tf_eflags &= ~(PSL_T | PSL_D);
regs->tf_cs = _ucodesel;
regs->tf_ds = _udatasel;
@ -747,7 +754,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
}
regs->tf_esp = (int)sfp;
regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
regs->tf_eip = p->p_sysent->sv_sigcode_base;
regs->tf_eflags &= ~(PSL_T | PSL_D);
regs->tf_cs = _ucodesel;
regs->tf_ds = _udatasel;