]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Main/Ia32/fpu_rmode.asm
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / LibC / Main / Ia32 / fpu_rmode.asm
1 ;------------------------------------------------------------------------------
2 ; Return the current FPU rounding mode.
3 ;
4 ; MASM implementation of the flt_rounds function by:
5 ; J.T. Conklin, Apr 4, 1995
6 ; Public domain.
7 ;
8 ; Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
9 ; This program and the accompanying materials
10 ; are licensed and made available under the terms and conditions of the BSD License
11 ; which accompanies this distribution. The full text of the license may be found at
12 ; http://opensource.org/licenses/bsd-license.php.
13 ;
14 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 ;
17 ; NetBSD: flt_rounds.S,v 1.6 1999/08/23 08:45:09 kleink Exp
18 ;------------------------------------------------------------------------------
19
20 .686
21 .model flat,C
22 .code
23
24 ;_map BYTE 1 ; round to nearest
25 ; BYTE 3 ; round to negative infinity
26 ; BYTE 2 ; round to positive infinity
27 ; BYTE 0 ; round to zero
28
29 ;------------------------------------------------------------------------------
30 ; int
31 ; EFIAPI
32 ; fpu_rmode( void );
33 ;
34 ;------------------------------------------------------------------------------
35
36 internal_FPU_rmode PROC
37 sub esp, 4 ; Create a local variable for fnstcw
38 fnstcw [esp]
39 mov eax, [esp]
40 shr eax, 10
41 and eax, 3
42 add esp, 4 ; Delete the local variable
43 ret
44 internal_FPU_rmode ENDP
45
46 END