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