]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/x86/ieee.h
ArmVirtPkg: enable non-executable DXE stack for all platforms
[mirror_edk2.git] / StdLib / Include / x86 / ieee.h
CommitLineData
2aa62f2b 1/* $NetBSD: ieee.h,v 1.9.32.1 2007/05/07 19:49:10 pavel Exp $ */\r
2\r
3/*\r
4 * Copyright (c) 1992, 1993\r
5 * The Regents of the University of California. All rights reserved.\r
6 *\r
7 * This software was developed by the Computer Systems Engineering group\r
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and\r
9 * contributed to Berkeley.\r
10 *\r
11 * All advertising materials mentioning features or use of this software\r
12 * must display the following acknowledgement:\r
13 * This product includes software developed by the University of\r
14 * California, Lawrence Berkeley Laboratory.\r
15 *\r
16 * Redistribution and use in source and binary forms, with or without\r
17 * modification, are permitted provided that the following conditions\r
18 * are met:\r
19 * 1. Redistributions of source code must retain the above copyright\r
20 * notice, this list of conditions and the following disclaimer.\r
21 * 2. Redistributions in binary form must reproduce the above copyright\r
22 * notice, this list of conditions and the following disclaimer in the\r
23 * documentation and/or other materials provided with the distribution.\r
24 * 3. Neither the name of the University nor the names of its contributors\r
25 * may be used to endorse or promote products derived from this software\r
26 * without specific prior written permission.\r
27 *\r
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
38 * SUCH DAMAGE.\r
39 *\r
40 * @(#)ieee.h 8.1 (Berkeley) 6/11/93\r
41 */\r
42\r
43/*\r
44 * ieee.h defines the machine-dependent layout of the machine's IEEE\r
45 * floating point. It does *not* define (yet?) any of the rounding\r
46 * mode bits, exceptions, and so forth.\r
47 */\r
48\r
49#include <sys/ieee754.h>\r
50\r
51#define EXT_EXPBITS 15\r
52#define EXT_FRACHBITS 32\r
53#define EXT_FRACLBITS 32\r
54#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)\r
55\r
56#define EXT_TO_ARRAY32(u, a) do { \\r
57 (a)[0] = (uint32_t)(u).extu_ext.ext_fracl; \\r
58 (a)[1] = (uint32_t)(u).extu_ext.ext_frach; \\r
59} while(/*CONSTCOND*/0)\r
60\r
61/*\r
62 * struct ieee_ext is the raw storage layout of the 80-bit\r
63 * extended-precision type as implemented by the FPU. Per the\r
64 * respective ABI specifications, it is followed by a tail padding of\r
65 *\r
66 * amd64: 48 bits,\r
67 * i386: 16 bits.\r
68 */\r
69struct ieee_ext {\r
70 u_int ext_fracl:EXT_FRACLBITS;\r
71 u_int ext_frach:EXT_FRACHBITS;\r
72#if 0\r
73 u_int ext_int:1;\r
74#endif\r
75 u_int ext_exp:EXT_EXPBITS;\r
76 u_int ext_sign:1;\r
77};\r
78\r
79/*\r
80 * Floats whose exponent is in [1..INFNAN) (of whatever type) are\r
81 * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.\r
82 * Floats whose exponent is zero are either zero (iff all fraction\r
83 * bits are zero) or subnormal values.\r
84 *\r
85 * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its\r
86 * high fraction; if the bit is set, it is a `quiet NaN'.\r
87 */\r
88#define EXT_EXP_INFNAN 32767\r
89\r
90#if 0\r
91#define SNG_QUIETNAN (1 << 22)\r
92#define DBL_QUIETNAN (1 << 19)\r
93#define EXT_QUIETNAN (1 << 30)\r
94#endif\r
95\r
96/*\r
97 * Exponent biases.\r
98 */\r
99#define EXT_EXP_BIAS 16383\r
100\r
101/*\r
102 * Convenience data structures.\r
103 */\r
104union ieee_ext_u {\r
105 long double extu_ld;\r
106 struct ieee_ext extu_ext;\r
107};\r