1 /* Native-dependent code for Unix SVR4 running on i386's.
3 Copyright 1988, 1989, 1991, 1992, 1996, 1997, 1998, 1999, 2000,
5 Free Software Foundation, Inc.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
33 #include "i386-tdep.h"
34 #include "i387-tdep.h"
36 #ifdef HAVE_SYS_PROCFS_H
38 #include <sys/procfs.h>
40 /* We must not compile this code for 64-bit Solaris x86. */
41 #if !defined (PR_MODEL_NATIVE) || (PR_MODEL_NATIVE == PR_MODEL_ILP32)
45 /* The `/proc' interface divides the target machine's register set up
46 into two different sets, the general purpose register set (gregset)
47 and the floating-point register set (fpregset). For each set,
48 there is an ioctl to get the current register set and another ioctl
49 to set the current values.
51 The actual structure passed through the ioctl interface is, of
52 course, naturally machine dependent, and is different for each set
53 of registers. For the i386 for example, the general-purpose
54 register set is typically defined by:
56 typedef int gregset_t[19]; (in <sys/regset.h>)
58 #define GS 0 (in <sys/reg.h>)
64 and the floating-point set by:
66 typedef struct fpregset {
68 struct fpchip_state // fp extension state //
70 int state[27]; // 287/387 saved state //
71 int status; // status word saved at //
74 struct fp_emul_space // for emulators //
79 int f_fpregs[62]; // union of the above //
81 long f_wregs[33]; // saved weitek state //
84 Incidentally fpchip_state contains the FPU state in the same format
85 as used by the "fsave" instruction, and that's the only thing we
86 support here. I don't know how the emulator stores it state. The
87 Weitek stuff definitely isn't supported.
89 The routines defined here, provide the packing and unpacking of
90 gregset_t and fpregset_t formatted data. */
94 /* Mapping between the general-purpose registers in `/proc'
95 format and GDB's register array layout. */
104 /* Fill GDB's register array with the general-purpose register values
108 supply_gregset (gregset_t
*gregsetp
)
110 greg_t
*regp
= (greg_t
*) gregsetp
;
113 for (regnum
= 0; regnum
< I386_NUM_GREGS
; regnum
++)
114 regcache_raw_supply (current_regcache
, regnum
, regp
+ regmap
[regnum
]);
117 /* Fill register REGNUM (if it is a general-purpose register) in
118 *GREGSETPS with the value in GDB's register array. If REGNUM is -1,
119 do this for all registers. */
122 fill_gregset (gregset_t
*gregsetp
, int regnum
)
124 greg_t
*regp
= (greg_t
*) gregsetp
;
127 for (i
= 0; i
< I386_NUM_GREGS
; i
++)
128 if (regnum
== -1 || regnum
== i
)
129 regcache_raw_collect (current_regcache
, i
, regp
+ regmap
[i
]);
132 #endif /* HAVE_GREGSET_T */
134 #ifdef HAVE_FPREGSET_T
136 /* Fill GDB's register array with the floating-point register values in
140 supply_fpregset (fpregset_t
*fpregsetp
)
145 i387_supply_fsave (current_regcache
, -1, fpregsetp
);
148 /* Fill register REGNO (if it is a floating-point register) in
149 *FPREGSETP with the value in GDB's register array. If REGNO is -1,
150 do this for all registers. */
153 fill_fpregset (fpregset_t
*fpregsetp
, int regno
)
158 i387_fill_fsave ((char *) fpregsetp
, regno
);
161 #endif /* HAVE_FPREGSET_T */
163 #endif /* not 64-bit. */
165 #endif /* HAVE_SYS_PROCFS_H */
This page took 0.031713 seconds and 4 git commands to generate.