* gencode.c (build_instruction) [MUL]: Cast operands to word64, to
[deliverable/binutils-gdb.git] / gdb / i386v4-nat.c
CommitLineData
4d0eabff 1/* Native-dependent code for SVR4 Unix running on i386's, for GDB.
e33aefba 2 Copyright 1988, 1989, 1991, 1992, 1996 Free Software Foundation, Inc.
4d0eabff
FF
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
6c9638b4 18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
4d0eabff 19
d58ffc6c
FF
20#include "defs.h"
21
4708ac65
FF
22#ifdef HAVE_SYS_PROCFS_H
23
4d0eabff
FF
24#include <sys/procfs.h>
25
26/* The /proc interface divides the target machine's register set up into
27 two different sets, the general register set (gregset) and the floating
28 point register set (fpregset). For each set, there is an ioctl to get
29 the current register set and another ioctl to set the current values.
30
31 The actual structure passed through the ioctl interface is, of course,
32 naturally machine dependent, and is different for each set of registers.
33 For the i386 for example, the general register set is typically defined
34 by:
35
36 typedef int gregset_t[19]; (in <sys/regset.h>)
37
38 #define GS 0 (in <sys/reg.h>)
39 #define FS 1
40 ...
41 #define UESP 17
42 #define SS 18
43
44 and the floating point set by:
45
46 typedef struct fpregset
47 {
48 union
49 {
50 struct fpchip_state // fp extension state //
51 {
52 int state[27]; // 287/387 saved state //
53 int status; // status word saved at exception //
54 } fpchip_state;
55 struct fp_emul_space // for emulators //
56 {
57 char fp_emul[246];
58 char fp_epad[2];
59 } fp_emul_space;
60 int f_fpregs[62]; // union of the above //
61 } fp_reg_set;
62 long f_wregs[33]; // saved weitek state //
63 } fpregset_t;
64
65 These routines provide the packing and unpacking of gregset_t and
66 fpregset_t formatted data.
67
68 */
69
4708ac65
FF
70#ifdef HAVE_GREGSET_T
71
4d0eabff
FF
72/* This is a duplicate of the table in i386-xdep.c. */
73
74static int regmap[] =
75{
76 EAX, ECX, EDX, EBX,
77 UESP, EBP, ESI, EDI,
78 EIP, EFL, CS, SS,
79 DS, ES, FS, GS,
80};
81
82
e33aefba
FF
83/* FIXME: These routine absolutely depends upon (NUM_REGS - NUM_FREGS)
84 being less than or equal to the number of registers that can be stored
85 in a gregset_t. Note that with the current scheme there will typically
86 be more registers actually stored in a gregset_t that what we know
87 about. This is bogus and should be fixed. */
88
4d0eabff
FF
89/* Given a pointer to a general register set in /proc format (gregset_t *),
90 unpack the register contents and supply them as gdb's idea of the current
91 register values. */
92
93void
94supply_gregset (gregsetp)
95 gregset_t *gregsetp;
96{
97 register int regi;
98 register greg_t *regp = (greg_t *) gregsetp;
99 extern int regmap[];
100
e33aefba 101 for (regi = 0 ; regi < (NUM_REGS - NUM_FREGS) ; regi++)
4d0eabff
FF
102 {
103 supply_register (regi, (char *) (regp + regmap[regi]));
104 }
105}
106
107void
108fill_gregset (gregsetp, regno)
109 gregset_t *gregsetp;
110 int regno;
111{
112 int regi;
113 register greg_t *regp = (greg_t *) gregsetp;
114 extern char registers[];
115 extern int regmap[];
116
e33aefba 117 for (regi = 0 ; regi < (NUM_REGS - NUM_FREGS) ; regi++)
4d0eabff
FF
118 {
119 if ((regno == -1) || (regno == regi))
120 {
121 *(regp + regmap[regi]) = *(int *) &registers[REGISTER_BYTE (regi)];
122 }
123 }
124}
125
4708ac65
FF
126#endif /* HAVE_GREGSET_T */
127
128#if defined (FP0_REGNUM) && defined (HAVE_FPREGSET_T)
4d0eabff
FF
129
130/* Given a pointer to a floating point register set in /proc format
131 (fpregset_t *), unpack the register contents and supply them as gdb's
132 idea of the current floating point register values. */
133
134void
135supply_fpregset (fpregsetp)
136 fpregset_t *fpregsetp;
137{
138 register int regi;
139
140 /* FIXME: see m68k-tdep.c for an example, for the m68k. */
141}
142
143/* Given a pointer to a floating point register set in /proc format
144 (fpregset_t *), update the register specified by REGNO from gdb's idea
145 of the current floating point register set. If REGNO is -1, update
146 them all. */
147
148void
149fill_fpregset (fpregsetp, regno)
150 fpregset_t *fpregsetp;
151 int regno;
152{
153 int regi;
154 char *to;
155 char *from;
156 extern char registers[];
157
158 /* FIXME: see m68k-tdep.c for an example, for the m68k. */
159}
160
4708ac65
FF
161#endif /* defined (FP0_REGNUM) && defined (HAVE_FPREGSET_T) */
162
163#endif /* HAVE_SYS_PROCFS_H */
This page took 0.210908 seconds and 4 git commands to generate.