From owner-svn-src-all@FreeBSD.ORG Tue Jan 20 12:07:50 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 372C810656EB; Tue, 20 Jan 2009 12:07:50 +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 1E2058FC0A; Tue, 20 Jan 2009 12:07:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0KC7noK044685; Tue, 20 Jan 2009 12:07:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0KC7n57044684; Tue, 20 Jan 2009 12:07:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200901201207.n0KC7n57044684@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 20 Jan 2009 12:07:49 +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: r187470 - head/sys/amd64/amd64 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: Tue, 20 Jan 2009 12:07:57 -0000 Author: kib Date: Tue Jan 20 12:07:49 2009 New Revision: 187470 URL: http://svn.freebsd.org/changeset/base/187470 Log: The context switch to the 32bit binary does not properly restore the fsbase value. The switch loads the fs segment register, that invalidates the value in fsbase msr, thus value in %r9 can not be considered the current value for fsbase anymore. Unconditionally reload fsbase when switching to 32bit binary. PR: 130526 MFC after: 3 weeks Modified: head/sys/amd64/amd64/cpu_switch.S Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Tue Jan 20 11:34:28 2009 (r187469) +++ head/sys/amd64/amd64/cpu_switch.S Tue Jan 20 12:07:49 2009 (r187470) @@ -199,6 +199,7 @@ done_load_seg: cmpq PCB_FSBASE(%r8),%r9 jz 1f /* Restore userland %fs */ +restore_fsbase: movl $MSR_FSBASE,%ecx movl PCB_FSBASE(%r8),%eax movl PCB_FSBASE+4(%r8),%edx @@ -281,7 +282,7 @@ load_seg: movl PCB_DS(%r8),%ds movl PCB_ES(%r8),%es movl PCB_FS(%r8),%fs - jmp done_load_seg + jmp restore_fsbase /* Restore userland %gs while preserving kernel gsbase */ 2: movq PCPU(GS32P),%rax movq PCB_GS32SD(%r8),%rcx