The following reply was made to PR amd64/182740; it has been noted by GNATS.

From: [email protected] (dfilter service)
To: [email protected]
Cc:  
Subject: Re: amd64/182740: commit references a PR
Date: Thu, 10 Oct 2013 19:51:45 +0000 (UTC)

 Author: jhb
 Date: Thu Oct 10 19:51:38 2013
 New Revision: 256293
 URL: http://svnweb.freebsd.org/changeset/base/256293
 
 Log:
   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
   Reported by: Julian Pidancet <[email protected]>
   Approved by: re (gjb)
   MFC after:   1 week
 
 Modified:
   head/sys/boot/i386/btx/btx/btx.S
 
 Modified: head/sys/boot/i386/btx/btx/btx.S
 ==============================================================================
 --- head/sys/boot/i386/btx/btx/btx.S   Thu Oct 10 19:48:43 2013        
(r256292)
 +++ head/sys/boot/i386/btx/btx/btx.S   Thu Oct 10 19:51:38 2013        
(r256293)
 @@ -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
 _______________________________________________
 [email protected] mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "[email protected]"
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-amd64
To unsubscribe, send any mail to "[email protected]"

Reply via email to