svn commit: r190617 - head/sys/i386/i386

Konstantin Belousov kib at FreeBSD.org
Wed Apr 1 05:46:06 PDT 2009


Author: kib
Date: Wed Apr  1 12:46:05 2009
New Revision: 190617
URL: http://svn.freebsd.org/changeset/base/190617

Log:
  Fill the fsbase and gsbase fields of the mcontext structure on i386.
  
  In collaboration with:	pho
  Discussed with:	peter
  Reviewed by:	jhb

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

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Wed Apr  1 12:44:17 2009	(r190616)
+++ head/sys/i386/i386/machdep.c	Wed Apr  1 12:46:05 2009	(r190617)
@@ -589,6 +589,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	struct sigacts *psp;
 	char *sp;
 	struct trapframe *regs;
+	struct segment_descriptor *sdp;
 	int sig;
 	int oonstack;
 
@@ -625,6 +626,15 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
 	sf.sf_uc.uc_mcontext.mc_len = sizeof(sf.sf_uc.uc_mcontext); /* magic */
 	get_fpcontext(td, &sf.sf_uc.uc_mcontext);
 	fpstate_drop(td);
+	/*
+	 * Unconditionally fill the fsbase and gsbase into the mcontext.
+	 */
+	sdp = &td->td_pcb->pcb_gsd;
+	sf.sf_uc.uc_mcontext.mc_fsbase = sdp->sd_hibase << 24 |
+	    sdp->sd_lobase;
+	sdp = &td->td_pcb->pcb_fsd;
+	sf.sf_uc.uc_mcontext.mc_gsbase = sdp->sd_hibase << 24 |
+	    sdp->sd_lobase;
 
 	/* Allocate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
@@ -3078,6 +3088,7 @@ int
 get_mcontext(struct thread *td, mcontext_t *mcp, int flags)
 {
 	struct trapframe *tp;
+	struct segment_descriptor *sdp;
 
 	tp = td->td_frame;
 
@@ -3109,6 +3120,11 @@ get_mcontext(struct thread *td, mcontext
 	mcp->mc_ss = tp->tf_ss;
 	mcp->mc_len = sizeof(*mcp);
 	get_fpcontext(td, mcp);
+	sdp = &td->td_pcb->pcb_gsd;
+	mcp->mc_fsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
+	sdp = &td->td_pcb->pcb_fsd;
+	mcp->mc_gsbase = sdp->sd_hibase << 24 | sdp->sd_lobase;
+
 	return (0);
 }
 


More information about the svn-src-head mailing list