]>
Commit | Line | Data |
---|---|---|
ce3e0a90 LG |
1 | ;------------------------------------------------------------------------------\r |
2 | ;*\r | |
5b78f30d | 3 | ;* Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r |
0acd8697 | 4 | ;* SPDX-License-Identifier: BSD-2-Clause-Patent\r |
ce3e0a90 LG |
5 | ;*\r |
6 | ;*\r | |
7 | ;------------------------------------------------------------------------------\r | |
8 | \r | |
5b78f30d | 9 | SECTION .rodata\r |
ce3e0a90 LG |
10 | ;\r |
11 | ; Float control word initial value:\r | |
12 | ; all exceptions masked, double-extended-precision, round-to-nearest\r | |
13 | ;\r | |
14 | mFpuControlWord: DW 0x37F\r | |
15 | ;\r | |
16 | ; Multimedia-extensions control word:\r | |
17 | ; all exceptions masked, round-to-nearest, flush to zero for masked underflow\r | |
18 | ;\r | |
19 | mMmxControlWord: DD 0x1F80\r | |
20 | \r | |
21 | DEFAULT REL\r | |
22 | SECTION .text\r | |
23 | \r | |
24 | ;\r | |
25 | ; Initializes floating point units for requirement of UEFI specification.\r | |
26 | ;\r | |
27 | ; This function initializes floating-point control word to 0x027F (all exceptions\r | |
28 | ; masked,double-precision, round-to-nearest) and multimedia-extensions control word\r | |
29 | ; (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero\r | |
30 | ; for masked underflow).\r | |
31 | ;\r | |
32 | global ASM_PFX(InitializeFloatingPointUnits)\r | |
33 | ASM_PFX(InitializeFloatingPointUnits):\r | |
34 | \r | |
35 | ;\r | |
36 | ; Initialize floating point units\r | |
37 | ;\r | |
b9dbc03e | 38 | finit\r |
ce3e0a90 LG |
39 | fldcw [mFpuControlWord]\r |
40 | \r | |
41 | ;\r | |
42 | ; Set OSFXSR bit 9 in CR4\r | |
43 | ;\r | |
44 | mov rax, cr4\r | |
45 | or rax, BIT9\r | |
46 | mov cr4, rax\r | |
47 | \r | |
48 | ldmxcsr [mMmxControlWord]\r | |
49 | \r | |
50 | ret\r | |
51 | \r |