* cadillac.c (kernel_dispatch): Make return type void.
[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
cab7a417 20#include "defs.h"
cab7a417
JG
21#include "frame.h"
22#include "inferior.h"
23#include "language.h"
24#include "gdbcore.h"
25#include "ieee-float.h"
26
27#ifdef USG
28#include <sys/types.h>
29#endif
30
31#include <sys/param.h>
32#include <sys/dir.h>
33#include <signal.h>
34#include <sys/user.h>
35#include <sys/ioctl.h>
36#include <fcntl.h>
37
38#include <sys/file.h>
39#include <sys/stat.h>
40
41#include <sys/reg.h>
42
43struct ext_format ext_format_i387 = {
44/* tot sbyte smask expbyte manbyte */
45 10, 9, 0x80, 9,8, 4,0 /* i387 */
46};
47
48/* FIXME: Eliminate these routines when we have the time to change all
49 the callers. */
1ab3bf1b 50
cab7a417
JG
51void
52i387_to_double (from, to)
1ab3bf1b
JG
53 char *from;
54 char *to;
cab7a417
JG
55{
56 ieee_extended_to_double (&ext_format_i387, from, (double *)to);
57}
58
59void
60double_to_i387 (from, to)
1ab3bf1b
JG
61 char *from;
62 char *to;
cab7a417 63{
afe4ca15 64 double_to_ieee_extended (&ext_format_i387, (double *)from, to);
cab7a417
JG
65}
66
67void
68print_387_control_word (control)
1ab3bf1b 69 unsigned int control;
cab7a417 70{
d8b3b00e 71 printf ("control %s: ", local_hex_string(control));
cab7a417
JG
72 printf ("compute to ");
73 switch ((control >> 8) & 3)
74 {
75 case 0: printf ("24 bits; "); break;
76 case 1: printf ("(bad); "); break;
77 case 2: printf ("53 bits; "); break;
78 case 3: printf ("64 bits; "); break;
79 }
80 printf ("round ");
81 switch ((control >> 10) & 3)
82 {
83 case 0: printf ("NEAREST; "); break;
84 case 1: printf ("DOWN; "); break;
85 case 2: printf ("UP; "); break;
86 case 3: printf ("CHOP; "); break;
87 }
88 if (control & 0x3f)
89 {
90 printf ("mask:");
91 if (control & 0x0001) printf (" INVALID");
92 if (control & 0x0002) printf (" DENORM");
93 if (control & 0x0004) printf (" DIVZ");
94 if (control & 0x0008) printf (" OVERF");
95 if (control & 0x0010) printf (" UNDERF");
96 if (control & 0x0020) printf (" LOS");
97 printf (";");
98 }
99 printf ("\n");
318bf84f 100 if (control & 0xe080) warning ("reserved bits on: %s\n",
d8b3b00e 101 local_hex_string(control & 0xe080));
cab7a417
JG
102}
103
104void
105print_387_status_word (status)
1ab3bf1b 106 unsigned int status;
cab7a417 107{
d8b3b00e 108 printf ("status %s: ", local_hex_string (status));
cab7a417
JG
109 if (status & 0xff)
110 {
111 printf ("exceptions:");
112 if (status & 0x0001) printf (" INVALID");
113 if (status & 0x0002) printf (" DENORM");
114 if (status & 0x0004) printf (" DIVZ");
115 if (status & 0x0008) printf (" OVERF");
116 if (status & 0x0010) printf (" UNDERF");
117 if (status & 0x0020) printf (" LOS");
118 if (status & 0x0040) printf (" FPSTACK");
119 printf ("; ");
120 }
121 printf ("flags: %d%d%d%d; ",
122 (status & 0x4000) != 0,
123 (status & 0x0400) != 0,
124 (status & 0x0200) != 0,
125 (status & 0x0100) != 0);
126
127 printf ("top %d\n", (status >> 11) & 7);
128}
This page took 0.058851 seconds and 4 git commands to generate.