* infrun.c (wait_for_inferior): Don't check if the PC is in a
[deliverable/binutils-gdb.git] / gdb / i387-tdep.c
CommitLineData
cab7a417
JG
1/* Intel 387 floating point stuff.
2 Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20#include <stdio.h>
21#include "defs.h"
22#include "param.h"
23#include "frame.h"
24#include "inferior.h"
25#include "language.h"
26#include "gdbcore.h"
27#include "ieee-float.h"
28
29#ifdef USG
30#include <sys/types.h>
31#endif
32
33#include <sys/param.h>
34#include <sys/dir.h>
35#include <signal.h>
36#include <sys/user.h>
37#include <sys/ioctl.h>
38#include <fcntl.h>
39
40#include <sys/file.h>
41#include <sys/stat.h>
42
43#include <sys/reg.h>
44
45struct ext_format ext_format_i387 = {
46/* tot sbyte smask expbyte manbyte */
47 10, 9, 0x80, 9,8, 4,0 /* i387 */
48};
49
50/* FIXME: Eliminate these routines when we have the time to change all
51 the callers. */
52void
53i387_to_double (from, to)
54 char *from, *to;
55{
56 ieee_extended_to_double (&ext_format_i387, from, (double *)to);
57}
58
59void
60double_to_i387 (from, to)
61 char *from, *to;
62{
63 ieee_double_to_extended (&ext_format_i387, (double *)from, to);
64}
65
66void
67print_387_control_word (control)
68unsigned short control;
69{
d8b3b00e 70 printf ("control %s: ", local_hex_string(control));
cab7a417
JG
71 printf ("compute to ");
72 switch ((control >> 8) & 3)
73 {
74 case 0: printf ("24 bits; "); break;
75 case 1: printf ("(bad); "); break;
76 case 2: printf ("53 bits; "); break;
77 case 3: printf ("64 bits; "); break;
78 }
79 printf ("round ");
80 switch ((control >> 10) & 3)
81 {
82 case 0: printf ("NEAREST; "); break;
83 case 1: printf ("DOWN; "); break;
84 case 2: printf ("UP; "); break;
85 case 3: printf ("CHOP; "); break;
86 }
87 if (control & 0x3f)
88 {
89 printf ("mask:");
90 if (control & 0x0001) printf (" INVALID");
91 if (control & 0x0002) printf (" DENORM");
92 if (control & 0x0004) printf (" DIVZ");
93 if (control & 0x0008) printf (" OVERF");
94 if (control & 0x0010) printf (" UNDERF");
95 if (control & 0x0020) printf (" LOS");
96 printf (";");
97 }
98 printf ("\n");
99 if (control & 0xe080) printf ("warning: reserved bits on: %s\n",
d8b3b00e 100 local_hex_string(control & 0xe080));
cab7a417
JG
101}
102
103void
104print_387_status_word (status)
105 unsigned short status;
106{
d8b3b00e 107 printf ("status %s: ", local_hex_string (status));
cab7a417
JG
108 if (status & 0xff)
109 {
110 printf ("exceptions:");
111 if (status & 0x0001) printf (" INVALID");
112 if (status & 0x0002) printf (" DENORM");
113 if (status & 0x0004) printf (" DIVZ");
114 if (status & 0x0008) printf (" OVERF");
115 if (status & 0x0010) printf (" UNDERF");
116 if (status & 0x0020) printf (" LOS");
117 if (status & 0x0040) printf (" FPSTACK");
118 printf ("; ");
119 }
120 printf ("flags: %d%d%d%d; ",
121 (status & 0x4000) != 0,
122 (status & 0x0400) != 0,
123 (status & 0x0200) != 0,
124 (status & 0x0100) != 0);
125
126 printf ("top %d\n", (status >> 11) & 7);
127}
This page took 0.027946 seconds and 4 git commands to generate.