]>
Commit | Line | Data |
---|---|---|
9a82579f | 1 | /* Target-dependent code for GDB, the GNU debugger. |
4be87837 | 2 | Copyright 2001, 2002, 2003 |
9a82579f JS |
3 | Free Software Foundation, Inc. |
4 | ||
5 | This file is part of GDB. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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. */ | |
21 | ||
22 | #ifndef I386_TDEP_H | |
23 | #define I386_TDEP_H | |
24 | ||
96297dab MK |
25 | /* GDB's i386 target supports both the 32-bit Intel Architecture |
26 | (IA-32) and the 64-bit AMD x86-64 architecture. Internally it uses | |
27 | a similar register layout for both. | |
28 | ||
29 | - General purpose registers | |
30 | - FPU data registers | |
31 | - FPU control registers | |
32 | - SSE data registers | |
33 | - SSE control register | |
34 | ||
35 | The general purpose registers for the x86-64 architecture are quite | |
36 | different from IA-32. Therefore, the FP0_REGNUM target macro | |
37 | determines the register number at which the FPU data registers | |
38 | start. The number of FPU data and control registers is the same | |
39 | for both architectures. The number of SSE registers however, | |
40 | differs and is determined by the num_xmm_regs member of `struct | |
41 | gdbarch_tdep'. */ | |
42 | ||
8201327c | 43 | /* Convention for returning structures. */ |
3ce1502b | 44 | |
8201327c MK |
45 | enum struct_return |
46 | { | |
47 | pcc_struct_return, /* Return "short" structures in memory. */ | |
48 | reg_struct_return /* Return "short" structures in registers. */ | |
3ce1502b MK |
49 | }; |
50 | ||
96297dab MK |
51 | /* i386 architecture specific information. */ |
52 | struct gdbarch_tdep | |
53 | { | |
54 | /* Number of SSE registers. */ | |
55 | int num_xmm_regs; | |
8201327c MK |
56 | |
57 | /* Offset of saved PC in jmp_buf. */ | |
58 | int jb_pc_offset; | |
59 | ||
60 | /* Convention for returning structures. */ | |
61 | enum struct_return struct_return; | |
62 | ||
8201327c MK |
63 | /* Address range where sigtramp lives. */ |
64 | CORE_ADDR sigtramp_start; | |
65 | CORE_ADDR sigtramp_end; | |
66 | ||
21d0e8a4 MK |
67 | /* Get address of sigcontext for sigtramp. */ |
68 | CORE_ADDR (*sigcontext_addr) (struct frame_info *); | |
69 | ||
70 | /* Offset of saved PC and SP in `struct sigcontext'. */ | |
8201327c | 71 | int sc_pc_offset; |
21d0e8a4 | 72 | int sc_sp_offset; |
96297dab MK |
73 | }; |
74 | ||
75 | /* Floating-point registers. */ | |
76 | ||
9a82579f JS |
77 | #define FPU_REG_RAW_SIZE 10 |
78 | ||
96297dab MK |
79 | /* All FPU control regusters (except for FIOFF and FOOFF) are 16-bit |
80 | (at most) in the FPU, but are zero-extended to 32 bits in GDB's | |
81 | register cache. */ | |
82 | ||
83 | /* "Generic" floating point control register. */ | |
84 | #define FPC_REGNUM (FP0_REGNUM + 8) | |
85 | ||
9a82579f | 86 | /* FPU control word. */ |
96297dab MK |
87 | #define FCTRL_REGNUM FPC_REGNUM |
88 | ||
9a82579f | 89 | /* FPU status word. */ |
96297dab MK |
90 | #define FSTAT_REGNUM (FPC_REGNUM + 1) |
91 | ||
9a82579f | 92 | /* FPU register tag word. */ |
96297dab MK |
93 | #define FTAG_REGNUM (FPC_REGNUM + 2) |
94 | ||
95 | /* FPU instruction's code segment selector, called "FPU Instruction | |
96 | Pointer Selector" in the IA-32 manuals. */ | |
97 | #define FISEG_REGNUM (FPC_REGNUM + 3) | |
98 | ||
99 | /* FPU instruction's offset within segment. */ | |
100 | #define FIOFF_REGNUM (FPC_REGNUM + 4) | |
101 | ||
9a82579f | 102 | /* FPU operand's data segment. */ |
96297dab MK |
103 | #define FOSEG_REGNUM (FPC_REGNUM + 5) |
104 | ||
105 | /* FPU operand's offset within segment */ | |
106 | #define FOOFF_REGNUM (FPC_REGNUM + 6) | |
107 | ||
9a82579f | 108 | /* FPU opcode, bottom eleven bits. */ |
96297dab | 109 | #define FOP_REGNUM (FPC_REGNUM + 7) |
9a82579f | 110 | |
23a34459 AC |
111 | /* Return non-zero if REGNUM matches the FP register and the FP |
112 | register set is active. */ | |
113 | extern int i386_fp_regnum_p (int regnum); | |
114 | extern int i386_fpc_regnum_p (int regnum); | |
96297dab MK |
115 | |
116 | /* SSE registers. */ | |
117 | ||
118 | /* First SSE data register. */ | |
119 | #define XMM0_REGNUM (FPC_REGNUM + 8) | |
120 | ||
121 | /* SSE control/status register. */ | |
122 | #define MXCSR_REGNUM \ | |
123 | (XMM0_REGNUM + gdbarch_tdep (current_gdbarch)->num_xmm_regs) | |
124 | ||
23a34459 AC |
125 | /* Return non-zero if REGNUM matches the SSE register and the SSE |
126 | register set is active. */ | |
127 | extern int i386_sse_regnum_p (int regnum); | |
128 | extern int i386_mxcsr_regnum_p (int regnum); | |
129 | ||
96297dab MK |
130 | /* FIXME: kettenis/2001-11-24: Obsolete macro's. */ |
131 | #define FCS_REGNUM FISEG_REGNUM | |
132 | #define FCOFF_REGNUM FIOFF_REGNUM | |
133 | #define FDS_REGNUM FOSEG_REGNUM | |
134 | #define FDOFF_REGNUM FOOFF_REGNUM | |
23a34459 | 135 | #define IS_FP_REGNUM(n) i386_fp_regnum_p (n) |
23a34459 | 136 | #define IS_SSE_REGNUM(n) i386_sse_regnum_p (n) |
9a82579f | 137 | |
8201327c MK |
138 | #define I386_NUM_GREGS 16 |
139 | #define I386_NUM_FREGS 16 | |
140 | #define I386_NUM_XREGS 9 | |
141 | ||
142 | #define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \ | |
143 | + I386_NUM_XREGS) | |
144 | ||
145 | /* Sizes of individual register sets. These cover the entire register | |
146 | file, so summing up the sizes of those portions actually present | |
147 | yields REGISTER_BYTES. */ | |
148 | #define I386_SIZEOF_GREGS (I386_NUM_GREGS * 4) | |
149 | #define I386_SIZEOF_FREGS (8 * 10 + 8 * 4) | |
150 | #define I386_SIZEOF_XREGS (8 * 16 + 4) | |
151 | ||
152 | #define I386_SSE_SIZEOF_REGS (I386_SIZEOF_GREGS + I386_SIZEOF_FREGS \ | |
153 | + I386_SIZEOF_XREGS) | |
154 | ||
00f8375e MK |
155 | /* Size of the largest register. */ |
156 | #define I386_MAX_REGISTER_SIZE 16 | |
157 | ||
1cce71eb JB |
158 | /* Functions exported from i386-tdep.c. */ |
159 | extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name); | |
5512c44a | 160 | extern int i386_frameless_signal_p (struct frame_info *frame); |
1cce71eb | 161 | |
8201327c | 162 | /* Return the name of register REG. */ |
fa88f677 | 163 | extern char const *i386_register_name (int reg); |
8201327c | 164 | |
38c968cf AC |
165 | /* Return non-zero if REGNUM is a member of the specified group. */ |
166 | extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum, | |
167 | struct reggroup *group); | |
168 | ||
8201327c MK |
169 | /* Initialize a basic ELF architecture variant. */ |
170 | extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *); | |
171 | ||
172 | /* Initialize a SVR4 architecture variant. */ | |
173 | extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *); | |
174 | ||
175 | /* Functions exported from i386bsd-tdep.c. */ | |
176 | ||
21d0e8a4 | 177 | extern CORE_ADDR i386bsd_sigcontext_addr (struct frame_info *frame); |
3cac699e | 178 | extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *); |
3ce1502b | 179 | |
96297dab | 180 | #endif /* i386-tdep.h */ |