From owner-svn-src-all@FreeBSD.ORG Sat Dec 12 20:11:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 987D11065672; Sat, 12 Dec 2009 20:11:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DCFD8FC1F; Sat, 12 Dec 2009 20:11:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBCKBV8F062245; Sat, 12 Dec 2009 20:11:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBCKBV5K062242; Sat, 12 Dec 2009 20:11:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912122011.nBCKBV5K062242@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 12 Dec 2009 20:11:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200444 - in head/sys/amd64: amd64 ia32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Dec 2009 20:11:31 -0000 Author: kib Date: Sat Dec 12 20:11:31 2009 New Revision: 200444 URL: http://svn.freebsd.org/changeset/base/200444 Log: For ia32 syscall(), call cpu_set_syscall_retval(). Update comment inside cpu_set_syscall_retval() accordingly. MFC after: 1 week Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/ia32/ia32_syscall.c Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Sat Dec 12 20:06:25 2009 (r200443) +++ head/sys/amd64/amd64/vm_machdep.c Sat Dec 12 20:11:31 2009 (r200444) @@ -330,10 +330,14 @@ cpu_set_syscall_retval(struct thread *td case ERESTART: /* - * Reconstruct pc, we know that 'syscall' is 2 bytes. + * Reconstruct pc, we know that 'syscall' is 2 bytes, + * lcall $X,y is 7 bytes, int 0x80 is 2 bytes. + * We saved this in tf_err. * We have to do a full context restore so that %r10 * (which was holding the value of %rcx) is restored * for the next iteration. + * r10 restore is only required for freebsd/amd64 processes, + * but shall be innocent for any ia32 ABI. */ td->td_frame->tf_rip -= td->td_frame->tf_err; td->td_frame->tf_r10 = td->td_frame->tf_rcx; Modified: head/sys/amd64/ia32/ia32_syscall.c ============================================================================== --- head/sys/amd64/ia32/ia32_syscall.c Sat Dec 12 20:06:25 2009 (r200443) +++ head/sys/amd64/ia32/ia32_syscall.c Sat Dec 12 20:11:31 2009 (r200444) @@ -183,35 +183,7 @@ ia32_syscall(struct trapframe *frame) AUDIT_SYSCALL_EXIT(error, td); } - switch (error) { - case 0: - frame->tf_rax = td->td_retval[0]; - frame->tf_rdx = td->td_retval[1]; - frame->tf_rflags &= ~PSL_C; - break; - - case ERESTART: - /* - * Reconstruct pc, assuming lcall $X,y is 7 bytes, - * int 0x80 is 2 bytes. We saved this in tf_err. - */ - frame->tf_rip -= frame->tf_err; - break; - - case EJUSTRETURN: - break; - - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - frame->tf_rax = error; - frame->tf_rflags |= PSL_C; - break; - } + cpu_set_syscall_retval(td, error); /* * Traced syscall.