From owner-svn-src-all@FreeBSD.ORG Fri Nov 15 15:08:59 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6288B4F8; Fri, 15 Nov 2013 15:08:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5143F2F21; Fri, 15 Nov 2013 15:08:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAFF8xaC055249; Fri, 15 Nov 2013 15:08:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAFF8xlE055248; Fri, 15 Nov 2013 15:08:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201311151508.rAFF8xlE055248@svn.freebsd.org> From: John Baldwin Date: Fri, 15 Nov 2013 15:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r258172 - stable/8/sys/boot/i386/btx/btx X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.16 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: Fri, 15 Nov 2013 15:08:59 -0000 Author: jhb Date: Fri Nov 15 15:08:58 2013 New Revision: 258172 URL: http://svnweb.freebsd.org/changeset/base/258172 Log: MFC 256293: Sanitize the %eflags returned by BIOS routines. Some BIOS routines enter protected mode and may leave protected-mode-specific flags like PSL_NT set when they return to real mode. This can cause a fault when BTX re-enters protected mode after the BIOS mode returns. PR: amd64/182740 Modified: stable/8/sys/boot/i386/btx/btx/btx.S Directory Properties: stable/8/sys/ (props changed) stable/8/sys/boot/ (props changed) Modified: stable/8/sys/boot/i386/btx/btx/btx.S ============================================================================== --- stable/8/sys/boot/i386/btx/btx/btx.S Fri Nov 15 15:08:53 2013 (r258171) +++ stable/8/sys/boot/i386/btx/btx/btx.S Fri Nov 15 15:08:58 2013 (r258172) @@ -41,6 +41,8 @@ .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag + .set PSL_D,0x00000400 # String instruction direction + .set PSL_NT,0x00004000 # Nested task flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag .set PSL_AC,0x00040000 # Alignment check flag /* @@ -611,8 +613,8 @@ rret_tramp: movw $MEM_ESPR-0x08,%sp # R pushl %ds # regs pushl %es pushfl # Save %eflags - cli # Disable interrupts - std # String ops dec + pushl $PSL_RESERVED_DEFAULT|PSL_D # Use clean %eflags with + popfl # string ops dec xorw %ax,%ax # Reset seg movw %ax,%ds # regs movw %ax,%es # (%ss is already 0) @@ -675,6 +677,7 @@ rret_tramp.1: xorl %ecx,%ecx # Zero testl $V86F_FLAGS,%edx # User wants flags? jz rret_tramp.3 # No movl MEM_ESPR-0x3c,%eax # Read real mode flags + andl $~(PSL_T|PSL_NT),%eax # Clear unsafe flags movw %ax,-0x08(%esi) # Update user flags (low 16) /* * Return to the user task