Search
lxdream.org :: lxdream/src/xlat/disasm/floatformat.h
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 (12 years ago)
permissions -rw-r--r--
last change Merge ARM disassembler from binutils 2.22
file annotate diff log raw
nkeynes@1265
     1
/* IEEE floating point support declarations, for GDB, the GNU Debugger.
nkeynes@1265
     2
   Copyright 1991, 1994, 1995, 1997, 2000, 2003, 2005, 2010
nkeynes@1265
     3
   Free Software Foundation, Inc.
nkeynes@1265
     4
nkeynes@1265
     5
This file is part of GDB.
nkeynes@1265
     6
nkeynes@1265
     7
This program is free software; you can redistribute it and/or modify
nkeynes@1265
     8
it under the terms of the GNU General Public License as published by
nkeynes@1265
     9
the Free Software Foundation; either version 2 of the License, or
nkeynes@1265
    10
(at your option) any later version.
nkeynes@1265
    11
nkeynes@1265
    12
This program is distributed in the hope that it will be useful,
nkeynes@1265
    13
but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@1265
    14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@1265
    15
GNU General Public License for more details.
nkeynes@1265
    16
nkeynes@1265
    17
You should have received a copy of the GNU General Public License
nkeynes@1265
    18
along with this program; if not, write to the Free Software
nkeynes@1265
    19
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
nkeynes@1265
    20
nkeynes@1265
    21
#if !defined (FLOATFORMAT_H)
nkeynes@1265
    22
#define FLOATFORMAT_H 1
nkeynes@1265
    23
nkeynes@1265
    24
#include "ansidecl.h"
nkeynes@1265
    25
nkeynes@1265
    26
/* A floatformat consists of a sign bit, an exponent and a mantissa.  Once the
nkeynes@1265
    27
   bytes are concatenated according to the byteorder flag, then each of those
nkeynes@1265
    28
   fields is contiguous.  We number the bits with 0 being the most significant
nkeynes@1265
    29
   (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field
nkeynes@1265
    30
   contains with the *_start and *_len fields.  */
nkeynes@1265
    31
nkeynes@1265
    32
/* What is the order of the bytes?  */
nkeynes@1265
    33
nkeynes@1265
    34
enum floatformat_byteorders {
nkeynes@1265
    35
  /* Standard little endian byte order.
nkeynes@1265
    36
     EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
nkeynes@1265
    37
  floatformat_little,
nkeynes@1265
    38
nkeynes@1265
    39
  /* Standard big endian byte order.
nkeynes@1265
    40
     EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */
nkeynes@1265
    41
  floatformat_big,
nkeynes@1265
    42
nkeynes@1265
    43
  /* Little endian byte order but big endian word order.
nkeynes@1265
    44
     EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */
nkeynes@1265
    45
  floatformat_littlebyte_bigword,
nkeynes@1265
    46
nkeynes@1265
    47
  /* VAX byte order.  Little endian byte order with 16-bit words.  The
nkeynes@1265
    48
     following example is an illustration of the byte order only; VAX
nkeynes@1265
    49
     doesn't have a fully IEEE compliant floating-point format.
nkeynes@1265
    50
     EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */
nkeynes@1265
    51
  floatformat_vax
nkeynes@1265
    52
};
nkeynes@1265
    53
nkeynes@1265
    54
enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
nkeynes@1265
    55
nkeynes@1265
    56
struct floatformat
nkeynes@1265
    57
{
nkeynes@1265
    58
  enum floatformat_byteorders byteorder;
nkeynes@1265
    59
  unsigned int totalsize;	/* Total size of number in bits */
nkeynes@1265
    60
nkeynes@1265
    61
  /* Sign bit is always one bit long.  1 means negative, 0 means positive.  */
nkeynes@1265
    62
  unsigned int sign_start;
nkeynes@1265
    63
nkeynes@1265
    64
  unsigned int exp_start;
nkeynes@1265
    65
  unsigned int exp_len;
nkeynes@1265
    66
  /* Bias added to a "true" exponent to form the biased exponent.  It
nkeynes@1265
    67
     is intentionally signed as, otherwize, -exp_bias can turn into a
nkeynes@1265
    68
     very large number (e.g., given the exp_bias of 0x3fff and a 64
nkeynes@1265
    69
     bit long, the equation (long)(1 - exp_bias) evaluates to
nkeynes@1265
    70
     4294950914) instead of -16382).  */
nkeynes@1265
    71
  int exp_bias;
nkeynes@1265
    72
  /* Exponent value which indicates NaN.  This is the actual value stored in
nkeynes@1265
    73
     the float, not adjusted by the exp_bias.  This usually consists of all
nkeynes@1265
    74
     one bits.  */
nkeynes@1265
    75
  unsigned int exp_nan;
nkeynes@1265
    76
nkeynes@1265
    77
  unsigned int man_start;
nkeynes@1265
    78
  unsigned int man_len;
nkeynes@1265
    79
nkeynes@1265
    80
  /* Is the integer bit explicit or implicit?  */
nkeynes@1265
    81
  enum floatformat_intbit intbit;
nkeynes@1265
    82
nkeynes@1265
    83
  /* Internal name for debugging. */
nkeynes@1265
    84
  const char *name;
nkeynes@1265
    85
nkeynes@1265
    86
  /* Validator method.  */
nkeynes@1265
    87
  int (*is_valid) (const struct floatformat *fmt, const void *from);
nkeynes@1265
    88
nkeynes@1265
    89
  /* Is the format actually the sum of two smaller floating point
nkeynes@1265
    90
     formats (IBM long double, as described in
nkeynes@1265
    91
     gcc/config/rs6000/darwin-ldouble-format)?  If so, this is the
nkeynes@1265
    92
     smaller format in question, and the fields sign_start through
nkeynes@1265
    93
     intbit describe the first half.  If not, this is NULL.  */
nkeynes@1265
    94
  const struct floatformat *split_half;
nkeynes@1265
    95
};
nkeynes@1265
    96
nkeynes@1265
    97
/* floatformats for IEEE single and double, big and little endian.  */
nkeynes@1265
    98
nkeynes@1265
    99
extern const struct floatformat floatformat_ieee_half_big;
nkeynes@1265
   100
extern const struct floatformat floatformat_ieee_half_little;
nkeynes@1265
   101
extern const struct floatformat floatformat_ieee_single_big;
nkeynes@1265
   102
extern const struct floatformat floatformat_ieee_single_little;
nkeynes@1265
   103
extern const struct floatformat floatformat_ieee_double_big;
nkeynes@1265
   104
extern const struct floatformat floatformat_ieee_double_little;
nkeynes@1265
   105
nkeynes@1265
   106
/* floatformat for ARM IEEE double, little endian bytes and big endian words */
nkeynes@1265
   107
nkeynes@1265
   108
extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;
nkeynes@1265
   109
nkeynes@1265
   110
/* floatformats for VAX.  */
nkeynes@1265
   111
nkeynes@1265
   112
extern const struct floatformat floatformat_vax_f;
nkeynes@1265
   113
extern const struct floatformat floatformat_vax_d;
nkeynes@1265
   114
extern const struct floatformat floatformat_vax_g;
nkeynes@1265
   115
nkeynes@1265
   116
/* floatformats for various extendeds.  */
nkeynes@1265
   117
nkeynes@1265
   118
extern const struct floatformat floatformat_i387_ext;
nkeynes@1265
   119
extern const struct floatformat floatformat_m68881_ext;
nkeynes@1265
   120
extern const struct floatformat floatformat_i960_ext;
nkeynes@1265
   121
extern const struct floatformat floatformat_m88110_ext;
nkeynes@1265
   122
extern const struct floatformat floatformat_m88110_harris_ext;
nkeynes@1265
   123
extern const struct floatformat floatformat_arm_ext_big;
nkeynes@1265
   124
extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
nkeynes@1265
   125
/* IA-64 Floating Point register spilt into memory.  */
nkeynes@1265
   126
extern const struct floatformat floatformat_ia64_spill_big;
nkeynes@1265
   127
extern const struct floatformat floatformat_ia64_spill_little;
nkeynes@1265
   128
extern const struct floatformat floatformat_ia64_quad_big;
nkeynes@1265
   129
extern const struct floatformat floatformat_ia64_quad_little;
nkeynes@1265
   130
/* IBM long double (double+double).  */
nkeynes@1265
   131
extern const struct floatformat floatformat_ibm_long_double;
nkeynes@1265
   132
nkeynes@1265
   133
/* Convert from FMT to a double.
nkeynes@1265
   134
   FROM is the address of the extended float.
nkeynes@1265
   135
   Store the double in *TO.  */
nkeynes@1265
   136
nkeynes@1265
   137
extern void
nkeynes@1265
   138
floatformat_to_double (const struct floatformat *, const void *, double *);
nkeynes@1265
   139
nkeynes@1265
   140
/* The converse: convert the double *FROM to FMT
nkeynes@1265
   141
   and store where TO points.  */
nkeynes@1265
   142
nkeynes@1265
   143
extern void
nkeynes@1265
   144
floatformat_from_double (const struct floatformat *, const double *, void *);
nkeynes@1265
   145
nkeynes@1265
   146
/* Return non-zero iff the data at FROM is a valid number in format FMT.  */
nkeynes@1265
   147
nkeynes@1265
   148
extern int
nkeynes@1265
   149
floatformat_is_valid (const struct floatformat *fmt, const void *from);
nkeynes@1265
   150
nkeynes@1265
   151
#endif	/* defined (FLOATFORMAT_H) */
.