Eliminate PARAMS.
[platform/upstream/binutils.git] / gdb / symm-tdep.c
1 /* Sequent Symmetry target interface, for GDB.
2    Copyright (C) 1986, 1987, 1989, 1991, 1994 Free Software Foundation, Inc.
3
4    This file is part of GDB.
5
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.
10
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.
15
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.  */
20
21 /* many 387-specific items of use taken from i386-dep.c */
22
23 #include "defs.h"
24 #include "frame.h"
25 #include "inferior.h"
26 #include "symtab.h"
27
28 #include <signal.h>
29 #include <sys/param.h>
30 #include <sys/user.h>
31 #include <sys/dir.h>
32 #include <sys/ioctl.h>
33 #include "gdb_stat.h"
34 #include "gdbcore.h"
35 #include <fcntl.h>
36
37 void
38 symmetry_extract_return_value (type, regbuf, valbuf)
39      struct type *type;
40      char *regbuf;
41      char *valbuf;
42 {
43   union
44     {
45       double d;
46       int l[2];
47     }
48   xd;
49   struct minimal_symbol *msymbol;
50   float f;
51
52   if (TYPE_CODE_FLT == TYPE_CODE (type))
53     {
54       msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
55       if (msymbol != NULL)
56         {
57           /* found "1167_flt" means 1167, %fp2-%fp3 */
58           /* float & double; 19= %fp2, 20= %fp3 */
59           /* no single precision on 1167 */
60           xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
61           xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
62           switch (TYPE_LENGTH (type))
63             {
64             case 4:
65               /* FIXME: broken for cross-debugging.  */
66               f = (float) xd.d;
67               memcpy (valbuf, &f, TYPE_LENGTH (type));
68               break;
69             case 8:
70               /* FIXME: broken for cross-debugging.  */
71               memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
72               break;
73             default:
74               error ("Unknown floating point size");
75               break;
76             }
77         }
78       else
79         {
80           /* 387 %st(0), gcc uses this */
81           i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
82                           &xd.d);
83           switch (TYPE_LENGTH (type))
84             {
85             case 4:             /* float */
86               f = (float) xd.d;
87               /* FIXME: broken for cross-debugging.  */
88               memcpy (valbuf, &f, 4);
89               break;
90             case 8:             /* double */
91               /* FIXME: broken for cross-debugging.  */
92               memcpy (valbuf, &xd.d, 8);
93               break;
94             default:
95               error ("Unknown floating point size");
96               break;
97             }
98         }
99     }
100   else
101     {
102       memcpy (valbuf, regbuf, TYPE_LENGTH (type));
103     }
104 }