(display_debug_lines, case DW_LNS_const_add_pc): Multiply adv by info.li_min_insn_length.
[deliverable/binutils-gdb.git] / gdb / i387-tdep.c
CommitLineData
c906108c
SS
1/* Intel 387 floating point stuff.
2 Copyright (C) 1988, 1989, 1991, 1998 Free Software Foundation, Inc.
3
c5aa993b 4 This file is part of GDB.
c906108c 5
c5aa993b
JM
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
c906108c 10
c5aa993b
JM
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
c906108c 15
c5aa993b
JM
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
c906108c
SS
20
21#include "defs.h"
22#include "frame.h"
23#include "inferior.h"
24#include "language.h"
25#include "gdbcore.h"
26#include "floatformat.h"
27
28void i387_to_double PARAMS ((char *, char *));
29
30void double_to_i387 PARAMS ((char *, char *));
31
32/* FIXME: Eliminate these routines when we have the time to change all
33 the callers. */
34
35void
36i387_to_double (from, to)
37 char *from;
38 char *to;
39{
c5aa993b 40 floatformat_to_double (&floatformat_i387_ext, from, (double *) to);
c906108c
SS
41}
42
43void
44double_to_i387 (from, to)
45 char *from;
46 char *to;
47{
c5aa993b 48 floatformat_from_double (&floatformat_i387_ext, (double *) from, to);
c906108c
SS
49}
50
51void
52print_387_control_word (control)
53 unsigned int control;
54{
c5aa993b 55 printf_unfiltered ("control %s: ", local_hex_string (control));
c906108c 56 printf_unfiltered ("compute to ");
c5aa993b 57 switch ((control >> 8) & 3)
c906108c 58 {
c5aa993b
JM
59 case 0:
60 printf_unfiltered ("24 bits; ");
61 break;
62 case 1:
63 printf_unfiltered ("(bad); ");
64 break;
65 case 2:
66 printf_unfiltered ("53 bits; ");
67 break;
68 case 3:
69 printf_unfiltered ("64 bits; ");
70 break;
c906108c
SS
71 }
72 printf_unfiltered ("round ");
c5aa993b 73 switch ((control >> 10) & 3)
c906108c 74 {
c5aa993b
JM
75 case 0:
76 printf_unfiltered ("NEAREST; ");
77 break;
78 case 1:
79 printf_unfiltered ("DOWN; ");
80 break;
81 case 2:
82 printf_unfiltered ("UP; ");
83 break;
84 case 3:
85 printf_unfiltered ("CHOP; ");
86 break;
c906108c 87 }
c5aa993b 88 if (control & 0x3f)
c906108c
SS
89 {
90 printf_unfiltered ("mask:");
c5aa993b
JM
91 if (control & 0x0001)
92 printf_unfiltered (" INVALID");
93 if (control & 0x0002)
94 printf_unfiltered (" DENORM");
95 if (control & 0x0004)
96 printf_unfiltered (" DIVZ");
97 if (control & 0x0008)
98 printf_unfiltered (" OVERF");
99 if (control & 0x0010)
100 printf_unfiltered (" UNDERF");
101 if (control & 0x0020)
102 printf_unfiltered (" LOS");
c906108c
SS
103 printf_unfiltered (";");
104 }
105 printf_unfiltered ("\n");
c5aa993b
JM
106 if (control & 0xe080)
107 warning ("reserved bits on: %s\n",
108 local_hex_string (control & 0xe080));
c906108c
SS
109}
110
111void
112print_387_status_word (status)
113 unsigned int status;
114{
115 printf_unfiltered ("status %s: ", local_hex_string (status));
c5aa993b 116 if (status & 0xff)
c906108c
SS
117 {
118 printf_unfiltered ("exceptions:");
c5aa993b
JM
119 if (status & 0x0001)
120 printf_unfiltered (" INVALID");
121 if (status & 0x0002)
122 printf_unfiltered (" DENORM");
123 if (status & 0x0004)
124 printf_unfiltered (" DIVZ");
125 if (status & 0x0008)
126 printf_unfiltered (" OVERF");
127 if (status & 0x0010)
128 printf_unfiltered (" UNDERF");
129 if (status & 0x0020)
130 printf_unfiltered (" LOS");
131 if (status & 0x0040)
132 printf_unfiltered (" FPSTACK");
c906108c
SS
133 printf_unfiltered ("; ");
134 }
135 printf_unfiltered ("flags: %d%d%d%d; ",
c5aa993b
JM
136 (status & 0x4000) != 0,
137 (status & 0x0400) != 0,
138 (status & 0x0200) != 0,
139 (status & 0x0100) != 0);
c906108c
SS
140
141 printf_unfiltered ("top %d\n", (status >> 11) & 7);
142}
This page took 0.06484 seconds and 4 git commands to generate.