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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to