]>
Commit | Line | Data |
---|---|---|
ce3e0a90 LG |
1 | ;------------------------------------------------------------------------------\r |
2 | ;*\r | |
3 | ;* Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r | |
4 | ;* This program and the accompanying materials\r | |
5 | ;* are licensed and made available under the terms and conditions of the BSD License\r | |
6 | ;* which accompanies this distribution. The full text of the license may be found at\r | |
7 | ;* http://opensource.org/licenses/bsd-license.php\r | |
8 | ;*\r | |
9 | ;* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | ;* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | ;*\r | |
12 | ;*\r | |
13 | ;------------------------------------------------------------------------------\r | |
14 | \r | |
15 | SECTION .rdata\r | |
16 | ;\r | |
17 | ; Float control word initial value:\r | |
18 | ; all exceptions masked, double-extended-precision, round-to-nearest\r | |
19 | ;\r | |
20 | mFpuControlWord: DW 0x37F\r | |
21 | ;\r | |
22 | ; Multimedia-extensions control word:\r | |
23 | ; all exceptions masked, round-to-nearest, flush to zero for masked underflow\r | |
24 | ;\r | |
25 | mMmxControlWord: DD 0x1F80\r | |
26 | \r | |
27 | DEFAULT REL\r | |
28 | SECTION .text\r | |
29 | \r | |
30 | ;\r | |
31 | ; Initializes floating point units for requirement of UEFI specification.\r | |
32 | ;\r | |
33 | ; This function initializes floating-point control word to 0x027F (all exceptions\r | |
34 | ; masked,double-precision, round-to-nearest) and multimedia-extensions control word\r | |
35 | ; (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero\r | |
36 | ; for masked underflow).\r | |
37 | ;\r | |
38 | global ASM_PFX(InitializeFloatingPointUnits)\r | |
39 | ASM_PFX(InitializeFloatingPointUnits):\r | |
40 | \r | |
41 | ;\r | |
42 | ; Initialize floating point units\r | |
43 | ;\r | |
44 | ; The following opcodes stand for instruction 'finit'\r | |
45 | ; to be supported by some 64-bit assemblers\r | |
46 | ;\r | |
47 | DB 0x9B, 0xDB, 0xE3\r | |
48 | fldcw [mFpuControlWord]\r | |
49 | \r | |
50 | ;\r | |
51 | ; Set OSFXSR bit 9 in CR4\r | |
52 | ;\r | |
53 | mov rax, cr4\r | |
54 | or rax, BIT9\r | |
55 | mov cr4, rax\r | |
56 | \r | |
57 | ldmxcsr [mMmxControlWord]\r | |
58 | \r | |
59 | ret\r | |
60 | \r |