Search
lxdream.org :: lxdream/src/xlat/disasm/floatformat.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/disasm/floatformat.h
changeset 1265:7c6c5d26fd2e
author nkeynes
date Tue Mar 06 12:42:33 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Merge ARM disassembler from binutils 2.22
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/xlat/disasm/floatformat.h Tue Mar 06 12:42:33 2012 +1000
1.3 @@ -0,0 +1,151 @@
1.4 +/* IEEE floating point support declarations, for GDB, the GNU Debugger.
1.5 + Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005, 2010
1.6 + Free Software Foundation, Inc.
1.7 +
1.8 +This file is part of GDB.
1.9 +
1.10 +This program is free software; you can redistribute it and/or modify
1.11 +it under the terms of the GNU General Public License as published by
1.12 +the Free Software Foundation; either version 2 of the License, or
1.13 +(at your option) any later version.
1.14 +
1.15 +This program is distributed in the hope that it will be useful,
1.16 +but WITHOUT ANY WARRANTY; without even the implied warranty of
1.17 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.18 +GNU General Public License for more details.
1.19 +
1.20 +You should have received a copy of the GNU General Public License
1.21 +along with this program; if not, write to the Free Software
1.22 +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
1.23 +
1.24 +#if !defined (FLOATFORMAT_H)
1.25 +#define FLOATFORMAT_H 1
1.26 +
1.27 +#include "ansidecl.h"
1.28 +
1.29 +/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the
1.30 + bytes are concatenated according to the byteorder flag, then each of those
1.31 + fields is contiguous. We number the bits with 0 being the most significant
1.32 + (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field
1.33 + contains with the *_start and *_len fields. */
1.34 +
1.35 +/* What is the order of the bytes? */
1.36 +
1.37 +enum floatformat_byteorders {
1.38 + /* Standard little endian byte order.
1.39 + EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
1.40 + floatformat_little,
1.41 +
1.42 + /* Standard big endian byte order.
1.43 + EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */
1.44 + floatformat_big,
1.45 +
1.46 + /* Little endian byte order but big endian word order.
1.47 + EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */
1.48 + floatformat_littlebyte_bigword,
1.49 +
1.50 + /* VAX byte order. Little endian byte order with 16-bit words. The
1.51 + following example is an illustration of the byte order only; VAX
1.52 + doesn't have a fully IEEE compliant floating-point format.
1.53 + EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */
1.54 + floatformat_vax
1.55 +};
1.56 +
1.57 +enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
1.58 +
1.59 +struct floatformat
1.60 +{
1.61 + enum floatformat_byteorders byteorder;
1.62 + unsigned int totalsize; /* Total size of number in bits */
1.63 +
1.64 + /* Sign bit is always one bit long. 1 means negative, 0 means positive. */
1.65 + unsigned int sign_start;
1.66 +
1.67 + unsigned int exp_start;
1.68 + unsigned int exp_len;
1.69 + /* Bias added to a "true" exponent to form the biased exponent. It
1.70 + is intentionally signed as, otherwize, -exp_bias can turn into a
1.71 + very large number (e.g., given the exp_bias of 0x3fff and a 64
1.72 + bit long, the equation (long)(1 - exp_bias) evaluates to
1.73 + 4294950914) instead of -16382). */
1.74 + int exp_bias;
1.75 + /* Exponent value which indicates NaN. This is the actual value stored in
1.76 + the float, not adjusted by the exp_bias. This usually consists of all
1.77 + one bits. */
1.78 + unsigned int exp_nan;
1.79 +
1.80 + unsigned int man_start;
1.81 + unsigned int man_len;
1.82 +
1.83 + /* Is the integer bit explicit or implicit? */
1.84 + enum floatformat_intbit intbit;
1.85 +
1.86 + /* Internal name for debugging. */
1.87 + const char *name;
1.88 +
1.89 + /* Validator method. */
1.90 + int (*is_valid) (const struct floatformat *fmt, const void *from);
1.91 +
1.92 + /* Is the format actually the sum of two smaller floating point
1.93 + formats (IBM long double, as described in
1.94 + gcc/config/rs6000/darwin-ldouble-format)? If so, this is the
1.95 + smaller format in question, and the fields sign_start through
1.96 + intbit describe the first half. If not, this is NULL. */
1.97 + const struct floatformat *split_half;
1.98 +};
1.99 +
1.100 +/* floatformats for IEEE single and double, big and little endian. */
1.101 +
1.102 +extern const struct floatformat floatformat_ieee_half_big;
1.103 +extern const struct floatformat floatformat_ieee_half_little;
1.104 +extern const struct floatformat floatformat_ieee_single_big;
1.105 +extern const struct floatformat floatformat_ieee_single_little;
1.106 +extern const struct floatformat floatformat_ieee_double_big;
1.107 +extern const struct floatformat floatformat_ieee_double_little;
1.108 +
1.109 +/* floatformat for ARM IEEE double, little endian bytes and big endian words */
1.110 +
1.111 +extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;
1.112 +
1.113 +/* floatformats for VAX. */
1.114 +
1.115 +extern const struct floatformat floatformat_vax_f;
1.116 +extern const struct floatformat floatformat_vax_d;
1.117 +extern const struct floatformat floatformat_vax_g;
1.118 +
1.119 +/* floatformats for various extendeds. */
1.120 +
1.121 +extern const struct floatformat floatformat_i387_ext;
1.122 +extern const struct floatformat floatformat_m68881_ext;
1.123 +extern const struct floatformat floatformat_i960_ext;
1.124 +extern const struct floatformat floatformat_m88110_ext;
1.125 +extern const struct floatformat floatformat_m88110_harris_ext;
1.126 +extern const struct floatformat floatformat_arm_ext_big;
1.127 +extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
1.128 +/* IA-64 Floating Point register spilt into memory. */
1.129 +extern const struct floatformat floatformat_ia64_spill_big;
1.130 +extern const struct floatformat floatformat_ia64_spill_little;
1.131 +extern const struct floatformat floatformat_ia64_quad_big;
1.132 +extern const struct floatformat floatformat_ia64_quad_little;
1.133 +/* IBM long double (double+double). */
1.134 +extern const struct floatformat floatformat_ibm_long_double;
1.135 +
1.136 +/* Convert from FMT to a double.
1.137 + FROM is the address of the extended float.
1.138 + Store the double in *TO. */
1.139 +
1.140 +extern void
1.141 +floatformat_to_double (const struct floatformat *, const void *, double *);
1.142 +
1.143 +/* The converse: convert the double *FROM to FMT
1.144 + and store where TO points. */
1.145 +
1.146 +extern void
1.147 +floatformat_from_double (const struct floatformat *, const double *, void *);
1.148 +
1.149 +/* Return non-zero iff the data at FROM is a valid number in format FMT. */
1.150 +
1.151 +extern int
1.152 +floatformat_is_valid (const struct floatformat *fmt, const void *from);
1.153 +
1.154 +#endif /* defined (FLOATFORMAT_H) */
.