1 ;------------------------------------------------------------------------------
3 ;* Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
4 ;* SPDX-License-Identifier: BSD-2-Clause-Patent
7 ;------------------------------------------------------------------------------
12 ; Float control word initial value:
13 ; all exceptions masked, double-precision, round-to-nearest
15 mFpuControlWord: DW 0x27F
17 ; Multimedia-extensions control word:
18 ; all exceptions masked, round-to-nearest, flush to zero for masked underflow
20 mMmxControlWord: DD 0x1F80
25 ; Initializes floating point units for requirement of UEFI specification.
27 ; This function initializes floating-point control word to 0x027F (all exceptions
28 ; masked,double-precision, round-to-nearest) and multimedia-extensions control word
29 ; (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
30 ; for masked underflow).
32 global ASM_PFX(InitializeFloatingPointUnits)
33 ASM_PFX(InitializeFloatingPointUnits):
38 ; Initialize floating point units
41 fldcw [mFpuControlWord]
44 ; Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
45 ; whether the processor supports SSE instruction.
53 ; Set OSFXSR bit 9 in CR4
60 ; The processor should support SSE instruction and we can use
63 ldmxcsr [mMmxControlWord]