Standard Libraries for EDK II.
This set of three packages: AppPkg, StdLib, StdLibPrivateInternalFiles; contains the implementation of libraries based upon non-UEFI standards such as ISO/IEC-9899, the library portion of the C Language Standard, POSIX, etc. AppPkg contains applications that make use of the standard libraries defined in the StdLib Package. StdLib contains header (include) files and the implementations of the standard libraries. StdLibPrivateInternalFiles contains files for the exclusive use of the library implementations in StdLib. These files should never be directly referenced from applications or other code. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11600 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
12
StdLib/LibC/Main/Ipf/FpuRmode.s
Normal file
12
StdLib/LibC/Main/Ipf/FpuRmode.s
Normal file
@@ -0,0 +1,12 @@
|
||||
.globl internal_FPU_rmode
|
||||
.proc internal_FPU_rmode
|
||||
internal_FPU_rmode::
|
||||
// get the floating point rounding control bits
|
||||
// bits 10 and 11 are the rc bits from main status field fpsr.sf0
|
||||
mov r8= ar.fpsr;;
|
||||
shr r8 = r8, 10
|
||||
mov r9 = 3;;
|
||||
and r8 = r8, r9;;
|
||||
br.sptk.few b0
|
||||
|
||||
.endp internal_FPU_rmode
|
25
StdLib/LibC/Main/Ipf/flt_rounds.c
Normal file
25
StdLib/LibC/Main/Ipf/flt_rounds.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <sys/EfiCdefs.h>
|
||||
/* __FBSDID("$FreeBSD: src/lib/libc/ia64/gen/flt_rounds.c,v 1.1 2004/07/19 08:17:24 das Exp $"); */
|
||||
|
||||
#include <float.h>
|
||||
|
||||
static const int map[] = {
|
||||
1, /* round to nearest */
|
||||
3, /* round to zero */
|
||||
2, /* round to negative infinity */
|
||||
0 /* round to positive infinity */
|
||||
};
|
||||
|
||||
int
|
||||
__flt_rounds(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm("mov %0=ar.fpsr" : "=r" (x));
|
||||
return (map[(x >> 10) & 0x03]);
|
||||
}
|
Reference in New Issue
Block a user