Date: Mon, 19 Aug 2002 11:11:52 -0700 (PDT) From: Jonathan Mini <mini@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 16285 for review Message-ID: <200208191811.g7JIBqTO017335@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=16285 Change 16285 by mini@mini_stylus on 2002/08/19 11:10:57 Deal with the kind of mcontext_t that userland is going to give us. Affected files ... .. //depot/projects/kse/sys/i386/i386/machdep.c#52 edit .. //depot/projects/kse/sys/kern/kern_thread.c#90 edit Differences ... ==== //depot/projects/kse/sys/i386/i386/machdep.c#52 (text+ko) ==== @@ -2047,6 +2047,9 @@ return (0); } +/* + * Get machine context. + */ void get_mcontext(struct thread *td, mcontext_t *mcp) { @@ -2076,20 +2079,25 @@ get_fpcontext(td, mcp); } +/* + * Set machine context. + * + * However, we don't set any but the user modifyable flags, and + * we we won't touch the cs selector. + */ int set_mcontext(struct thread *td, const mcontext_t *mcp) { struct trapframe *tp; int ret; + int eflags; tp = td->td_frame; - - if (!EFL_SECURE(mcp->mc_eflags, tp->tf_eflags) || - !CS_SECURE(mcp->mc_cs)) - ret = EINVAL; - else if (mcp->mc_len != sizeof(*mcp)) - ret = EINVAL; - else if ((ret = set_fpcontext(td, mcp)) == 0) { + if (mcp->mc_len != sizeof(*mcp)) + return (EINVAL); + eflags = (mcp->mc_eflags & PSL_USERCHANGE) | + (tp->tf_eflags & ~PSL_USERCHANGE); + if ((ret = set_fpcontext(td, mcp)) == 0) { tp->tf_fs = mcp->mc_fs; tp->tf_es = mcp->mc_es; tp->tf_ds = mcp->mc_ds; @@ -2101,8 +2109,7 @@ tp->tf_ecx = mcp->mc_ecx; tp->tf_eax = mcp->mc_eax; tp->tf_eip = mcp->mc_eip; - tp->tf_cs = mcp->mc_cs; - tp->tf_eflags = mcp->mc_eflags; + tp->tf_eflags = eflags; tp->tf_esp = mcp->mc_esp; tp->tf_ss = mcp->mc_ss; td->td_pcb->pcb_gs = mcp->mc_gs; ==== //depot/projects/kse/sys/kern/kern_thread.c#90 (text+ko) ==== To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208191811.g7JIBqTO017335>