From owner-svn-src-head@freebsd.org Sat May 12 11:07:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE355FD4437; Sat, 12 May 2018 11:07:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E39A83BDB; Sat, 12 May 2018 11:07:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 447A31D806; Sat, 12 May 2018 11:07:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4CB701B093875; Sat, 12 May 2018 11:07:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4CB70pa093874; Sat, 12 May 2018 11:07:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805121107.w4CB70pa093874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 12 May 2018 11:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333526 - head/sys/i386/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/include X-SVN-Commit-Revision: 333526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2018 11:07:00 -0000 Author: kib Date: Sat May 12 11:06:59 2018 New Revision: 333526 URL: https://svnweb.freebsd.org/changeset/base/333526 Log: Kernel entry from vm86 mode, where PCB_VM86CALL pcb flag is not set, is executed on the right stack already. No copy from the entry stack to the kstack must be performed for vm86 bios call code to function. To access the pcb flags on kernel entry, unconditionally switch to kernel address space if vm86 mode is detected. This fixes very early vm86 bios calls, typically done when boot is performed by boot2 without loader, and kernel falls back to BIOS calls to get SMAP. Reported by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/i386/include/asmacros.h Modified: head/sys/i386/include/asmacros.h ============================================================================== --- head/sys/i386/include/asmacros.h Sat May 12 11:02:39 2018 (r333525) +++ head/sys/i386/include/asmacros.h Sat May 12 11:06:59 2018 (r333526) @@ -212,11 +212,17 @@ .macro KENTER testl $PSL_VM, TF_EFLAGS(%esp) - jnz 1f - testb $SEL_RPL_MASK, TF_CS(%esp) - jz 2f -1: MOVE_STACKS -2: + jz 1f + LOAD_KCR3 + movl PCPU(CURPCB), %eax + testl $PCB_VM86CALL, PCB_FLAGS(%eax) + jnz 3f + NMOVE_STACKS + jmp 2f +1: testb $SEL_RPL_MASK, TF_CS(%esp) + jz 3f +2: MOVE_STACKS +3: .endm #endif /* LOCORE */