Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Jun 2012 16:05:56 +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: r237445 - head/sys/i386/i386
Message-ID:  <201206221605.q5MG5uJJ087327@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jun 22 16:05:56 2012
New Revision: 237445
URL: http://svn.freebsd.org/changeset/base/237445

Log:
  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

Modified:
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Fri Jun 22 14:58:40 2012	(r237444)
+++ head/sys/i386/i386/machdep.c	Fri Jun 22 16:05:56 2012	(r237445)
@@ -469,7 +469,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi,
 	}
 
 	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
 	}
 
 	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, 
 	}
 
 	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;



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