1 /* Native-dependent code for SVR4 Unix running on i386's, for GDB.
2 Copyright 1988, 1989, 1991, 1992, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
30 #include "i387-tdep.h"
33 #ifdef HAVE_SYS_PROCFS_H
35 #include <sys/procfs.h>
37 /* Prototypes for supply_gregset etc. */
40 /* The /proc interface divides the target machine's register set up into
41 two different sets, the general register set (gregset) and the floating
42 point register set (fpregset). For each set, there is an ioctl to get
43 the current register set and another ioctl to set the current values.
45 The actual structure passed through the ioctl interface is, of course,
46 naturally machine dependent, and is different for each set of registers.
47 For the i386 for example, the general register set is typically defined
50 typedef int gregset_t[19]; (in <sys/regset.h>)
52 #define GS 0 (in <sys/reg.h>)
58 and the floating point set by:
60 typedef struct fpregset
64 struct fpchip_state // fp extension state //
66 int state[27]; // 287/387 saved state //
67 int status; // status word saved at exception //
69 struct fp_emul_space // for emulators //
74 int f_fpregs[62]; // union of the above //
76 long f_wregs[33]; // saved weitek state //
79 These routines provide the packing and unpacking of gregset_t and
80 fpregset_t formatted data.
86 /* This is a duplicate of the table in i386-xdep.c. */
96 /* Prototypes for local functions */
98 void fill_gregset (gregset_t
*, int);
100 void supply_gregset (gregset_t
*);
102 void supply_fpregset (fpregset_t
*);
104 void fill_fpregset (fpregset_t
*, int);
107 /* FIXME: These routine absolutely depends upon (NUM_REGS - NUM_FREGS)
108 being less than or equal to the number of registers that can be stored
109 in a gregset_t. Note that with the current scheme there will typically
110 be more registers actually stored in a gregset_t that what we know
111 about. This is bogus and should be fixed. */
113 /* Given a pointer to a general register set in /proc format (gregset_t *),
114 unpack the register contents and supply them as gdb's idea of the current
118 supply_gregset (gregset_t
*gregsetp
)
121 register greg_t
*regp
= (greg_t
*) gregsetp
;
124 for (regi
= 0; regi
< (NUM_REGS
- NUM_FREGS
); regi
++)
126 supply_register (regi
, (char *) (regp
+ regmap
[regi
]));
131 fill_gregset (gregset_t
*gregsetp
, int regno
)
134 register greg_t
*regp
= (greg_t
*) gregsetp
;
137 for (regi
= 0; regi
< (NUM_REGS
- NUM_FREGS
); regi
++)
139 if ((regno
== -1) || (regno
== regi
))
141 *(regp
+ regmap
[regi
]) = *(int *) ®isters
[REGISTER_BYTE (regi
)];
146 #endif /* HAVE_GREGSET_T */
148 #if defined (HAVE_FPREGSET_T)
150 /* Given a pointer to a floating point register set in /proc format
151 (fpregset_t *), unpack the register contents and supply them as gdb's
152 idea of the current floating point register values. */
154 /* FIXME: Assumes that fpregsetp contains an i387 FSAVE area. */
155 #if !defined(FPREGSET_FSAVE_OFFSET)
156 #define FPREGSET_FSAVE_OFFSET 0
160 supply_fpregset (fpregset_t
*fpregsetp
)
165 i387_supply_fsave ((char *) fpregsetp
+ FPREGSET_FSAVE_OFFSET
);
168 /* Given a pointer to a floating point register set in /proc format
169 (fpregset_t *), update the register specified by REGNO from gdb's idea
170 of the current floating point register set. If REGNO is -1, update
174 fill_fpregset (fpregset_t
*fpregsetp
, int regno
)
179 i387_fill_fsave ((char *) fpregsetp
+ FPREGSET_FSAVE_OFFSET
, regno
);
182 #endif /* defined (HAVE_FPREGSET_T) */
184 #endif /* HAVE_SYS_PROCFS_H */
This page took 0.032915 seconds and 4 git commands to generate.