From owner-p4-projects Mon Aug 19 11:11:59 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7A4E537B401; Mon, 19 Aug 2002 11:11:53 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F01237B400 for ; Mon, 19 Aug 2002 11:11:53 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CEBBB43E4A for ; Mon, 19 Aug 2002 11:11:52 -0700 (PDT) (envelope-from mini@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7JIBqJU017338 for ; Mon, 19 Aug 2002 11:11:52 -0700 (PDT) (envelope-from mini@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7JIBqTO017335 for perforce@freebsd.org; Mon, 19 Aug 2002 11:11:52 -0700 (PDT) Date: Mon, 19 Aug 2002 11:11:52 -0700 (PDT) Message-Id: <200208191811.g7JIBqTO017335@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to mini@freebsd.org using -f From: Jonathan Mini Subject: PERFORCE change 16285 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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