* configure.ac: Switch license to GPLv3.
[deliverable/binutils-gdb.git] / gdb / i386-tdep.h
CommitLineData
5716833c
MK
1/* Target-dependent code for the i386.
2
6aba47ca 3 Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007
5ae96ec1 4 Free Software Foundation, Inc.
9a82579f
JS
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
197e01b6
EZ
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
9a82579f
JS
22
23#ifndef I386_TDEP_H
24#define I386_TDEP_H
25
da3331ec 26struct frame_info;
5716833c
MK
27struct gdbarch;
28struct reggroup;
c783cbd6 29struct regset;
5439edaa 30struct regcache;
da3331ec 31
96297dab
MK
32/* GDB's i386 target supports both the 32-bit Intel Architecture
33 (IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses
34 a similar register layout for both.
35
36 - General purpose registers
37 - FPU data registers
38 - FPU control registers
39 - SSE data registers
40 - SSE control register
41
42 The general purpose registers for the x86-64 architecture are quite
3e8c568d 43 different from IA-32. Therefore, gdbarch_fp0_regnum
96297dab
MK
44 determines the register number at which the FPU data registers
45 start. The number of FPU data and control registers is the same
46 for both architectures. The number of SSE registers however,
47 differs and is determined by the num_xmm_regs member of `struct
48 gdbarch_tdep'. */
49
8201327c 50/* Convention for returning structures. */
3ce1502b 51
8201327c
MK
52enum struct_return
53{
54 pcc_struct_return, /* Return "short" structures in memory. */
55 reg_struct_return /* Return "short" structures in registers. */
3ce1502b
MK
56};
57
96297dab
MK
58/* i386 architecture specific information. */
59struct gdbarch_tdep
60{
473f17b0
MK
61 /* General-purpose registers. */
62 struct regset *gregset;
63 int *gregset_reg_offset;
64 int gregset_num_regs;
65 size_t sizeof_gregset;
66
67 /* Floating-point registers. */
68 struct regset *fpregset;
69 size_t sizeof_fpregset;
70
5716833c
MK
71 /* Register number for %st(0). The register numbers for the other
72 registers follow from this one. Set this to -1 to indicate the
73 absence of an FPU. */
74 int st0_regnum;
75
76 /* Register number for %mm0. Set this to -1 to indicate the absence
77 of MMX support. */
78 int mm0_regnum;
79
96297dab
MK
80 /* Number of SSE registers. */
81 int num_xmm_regs;
8201327c
MK
82
83 /* Offset of saved PC in jmp_buf. */
84 int jb_pc_offset;
85
86 /* Convention for returning structures. */
87 enum struct_return struct_return;
88
8201327c
MK
89 /* Address range where sigtramp lives. */
90 CORE_ADDR sigtramp_start;
91 CORE_ADDR sigtramp_end;
92
911bc6ee
MK
93 /* Detect sigtramp. */
94 int (*sigtramp_p) (struct frame_info *);
95
21d0e8a4
MK
96 /* Get address of sigcontext for sigtramp. */
97 CORE_ADDR (*sigcontext_addr) (struct frame_info *);
98
a3386186
MK
99 /* Offset of registers in `struct sigcontext'. */
100 int *sc_reg_offset;
101 int sc_num_regs;
102
103 /* Offset of saved PC and SP in `struct sigcontext'. Usage of these
104 is deprecated, please use `sc_reg_offset' instead. */
8201327c 105 int sc_pc_offset;
21d0e8a4 106 int sc_sp_offset;
794ac428
UW
107
108 /* ISA-specific data types. */
109 struct type *i386_mmx_type;
110 struct type *i386_sse_type;
96297dab
MK
111};
112
113/* Floating-point registers. */
114
96297dab
MK
115/* All FPU control regusters (except for FIOFF and FOOFF) are 16-bit
116 (at most) in the FPU, but are zero-extended to 32 bits in GDB's
117 register cache. */
118
23a34459
AC
119/* Return non-zero if REGNUM matches the FP register and the FP
120 register set is active. */
121extern int i386_fp_regnum_p (int regnum);
122extern int i386_fpc_regnum_p (int regnum);
96297dab 123
a3386186
MK
124/* Register numbers of various important registers. */
125
bcf48cc7
MK
126enum i386_regnum
127{
128 I386_EAX_REGNUM, /* %eax */
129 I386_ECX_REGNUM, /* %ecx */
130 I386_EDX_REGNUM, /* %edx */
131 I386_EBX_REGNUM, /* %ebx */
132 I386_ESP_REGNUM, /* %esp */
133 I386_EBP_REGNUM, /* %ebp */
134 I386_ESI_REGNUM, /* %esi */
135 I386_EDI_REGNUM, /* %edi */
136 I386_EIP_REGNUM, /* %eip */
137 I386_EFLAGS_REGNUM, /* %eflags */
2666fb59
MK
138 I386_CS_REGNUM, /* %cs */
139 I386_SS_REGNUM, /* %ss */
e9ff708b
AC
140 I386_DS_REGNUM, /* %ds */
141 I386_ES_REGNUM, /* %es */
142 I386_FS_REGNUM, /* %fs */
143 I386_GS_REGNUM, /* %gs */
144 I386_ST0_REGNUM /* %st(0) */
bcf48cc7 145};
a3386186 146
8201327c
MK
147#define I386_NUM_GREGS 16
148#define I386_NUM_FREGS 16
149#define I386_NUM_XREGS 9
150
151#define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \
152 + I386_NUM_XREGS)
153
00f8375e
MK
154/* Size of the largest register. */
155#define I386_MAX_REGISTER_SIZE 16
156
5ae96ec1
MK
157/* Types for i386-specific registers. */
158extern struct type *i386_eflags_type;
878d9193 159extern struct type *i386_mxcsr_type;
5ae96ec1 160
794ac428
UW
161extern struct type *i386_mmx_type (struct gdbarch *gdbarch);
162extern struct type *i386_sse_type (struct gdbarch *gdbarch);
163
508fbfea
MK
164/* Segment selectors. */
165#define I386_SEL_RPL 0x0003 /* Requester's Privilege Level mask. */
166#define I386_SEL_UPL 0x0003 /* User Privilige Level. */
167#define I386_SEL_KPL 0x0000 /* Kernel Privilige Level. */
168
1cce71eb
JB
169/* Functions exported from i386-tdep.c. */
170extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name);
171
f6792ef4
MK
172/* Return the name of register REGNUM. */
173extern char const *i386_register_name (int regnum);
8201327c 174
38c968cf
AC
175/* Return non-zero if REGNUM is a member of the specified group. */
176extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
177 struct reggroup *group);
178
20187ed5
MK
179/* Supply register REGNUM from the general-purpose register set REGSET
180 to register cache REGCACHE. If REGNUM is -1, do this for all
181 registers in REGSET. */
182extern void i386_supply_gregset (const struct regset *regset,
183 struct regcache *regcache, int regnum,
184 const void *gregs, size_t len);
3d171c85
MK
185
186/* Collect register REGNUM from the register cache REGCACHE and store
187 it in the buffer specified by GREGS and LEN as described by the
188 general-purpose register set REGSET. If REGNUM is -1, do this for
189 all registers in REGSET. */
190extern void i386_collect_gregset (const struct regset *regset,
191 const struct regcache *regcache,
192 int regnum, void *gregs, size_t len);
20187ed5 193
8446b36a
MK
194/* Return the appropriate register set for the core section identified
195 by SECT_NAME and SECT_SIZE. */
196extern const struct regset *
197 i386_regset_from_core_section (struct gdbarch *gdbarch,
198 const char *sect_name, size_t sect_size);
199
8201327c
MK
200/* Initialize a basic ELF architecture variant. */
201extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
202
203/* Initialize a SVR4 architecture variant. */
204extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
de0b6abb 205\f
8201327c 206
de0b6abb 207/* Functions and variables exported from i386bsd-tdep.c. */
8201327c 208
3cac699e 209extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *);
5d93ae8c
MK
210extern CORE_ADDR i386fbsd_sigtramp_start_addr;
211extern CORE_ADDR i386fbsd_sigtramp_end_addr;
212extern CORE_ADDR i386obsd_sigtramp_start_addr;
213extern CORE_ADDR i386obsd_sigtramp_end_addr;
de0b6abb
MK
214extern int i386fbsd4_sc_reg_offset[];
215extern int i386fbsd_sc_reg_offset[];
216extern int i386nbsd_sc_reg_offset[];
217extern int i386obsd_sc_reg_offset[];
218extern int i386bsd_sc_reg_offset[];
3ce1502b 219
96297dab 220#endif /* i386-tdep.h */
This page took 0.521267 seconds and 4 git commands to generate.