2009-12-17 00:29:20 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
#*
|
2018-06-27 15:14:20 +02:00
|
|
|
#* Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 14:25:26 +02:00
|
|
|
#* This program and the accompanying materials
|
2009-12-17 00:29:20 +01:00
|
|
|
#* are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
#* which accompanies this distribution. The full text of the license may be found at
|
|
|
|
#* http://opensource.org/licenses/bsd-license.php
|
|
|
|
#*
|
|
|
|
#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
#*
|
|
|
|
#*
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
|
2009-11-25 05:25:02 +01:00
|
|
|
#
|
2018-06-27 15:14:20 +02:00
|
|
|
# Float control word initial value:
|
2009-11-25 05:25:02 +01:00
|
|
|
# all exceptions masked, double-precision, round-to-nearest
|
|
|
|
#
|
|
|
|
ASM_PFX(mFpuControlWord): .word 0x027F
|
|
|
|
#
|
|
|
|
# Multimedia-extensions control word:
|
|
|
|
# all exceptions masked, round-to-nearest, flush to zero for masked underflow
|
|
|
|
#
|
2009-12-17 00:29:20 +01:00
|
|
|
ASM_PFX(mMmxControlWord): .long 0x01F80
|
|
|
|
|
|
|
|
#
|
2009-11-25 05:25:02 +01:00
|
|
|
# Initializes floating point units for requirement of UEFI specification.
|
|
|
|
#
|
|
|
|
# This function initializes floating-point control word to 0x027F (all exceptions
|
|
|
|
# masked,double-precision, round-to-nearest) and multimedia-extensions control word
|
|
|
|
# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
|
2009-12-17 00:29:20 +01:00
|
|
|
# for masked underflow).
|
|
|
|
#
|
|
|
|
ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
|
|
|
|
ASM_PFX(InitializeFloatingPointUnits):
|
|
|
|
|
|
|
|
pushl %ebx
|
|
|
|
|
2009-11-25 05:25:02 +01:00
|
|
|
#
|
|
|
|
# Initialize floating point units
|
|
|
|
#
|
|
|
|
finit
|
|
|
|
fldcw ASM_PFX(mFpuControlWord)
|
2018-06-27 15:14:20 +02:00
|
|
|
|
2009-11-25 05:25:02 +01:00
|
|
|
#
|
|
|
|
# Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
|
|
|
|
# whether the processor supports SSE instruction.
|
|
|
|
#
|
|
|
|
movl $1, %eax
|
|
|
|
cpuid
|
|
|
|
btl $25, %edx
|
|
|
|
jnc Done
|
2018-06-27 15:14:20 +02:00
|
|
|
|
2009-12-17 00:29:20 +01:00
|
|
|
#
|
|
|
|
# Set OSFXSR bit 9 in CR4
|
|
|
|
#
|
2018-06-27 15:14:20 +02:00
|
|
|
movl %cr4, %eax
|
2010-01-08 22:39:54 +01:00
|
|
|
or $0x200, %eax
|
2009-12-17 00:29:20 +01:00
|
|
|
movl %eax, %cr4
|
2018-06-27 15:14:20 +02:00
|
|
|
|
2009-11-25 05:25:02 +01:00
|
|
|
#
|
|
|
|
# The processor should support SSE instruction and we can use
|
|
|
|
# ldmxcsr instruction
|
|
|
|
#
|
2009-12-17 00:29:20 +01:00
|
|
|
ldmxcsr ASM_PFX(mMmxControlWord)
|
|
|
|
|
|
|
|
Done:
|
|
|
|
popl %ebx
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
#END
|
|
|
|
|