xref: /dragonfly/contrib/gdb-7/gdb/i386-tdep.h (revision ef5ccd6c)
15796c8dcSSimon Schubert /* Target-dependent code for the i386.
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 2001-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    This file is part of GDB.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
85796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
95796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
105796c8dcSSimon Schubert    (at your option) any later version.
115796c8dcSSimon Schubert 
125796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
135796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
145796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
155796c8dcSSimon Schubert    GNU General Public License for more details.
165796c8dcSSimon Schubert 
175796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
185796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert #ifndef I386_TDEP_H
215796c8dcSSimon Schubert #define I386_TDEP_H
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert struct frame_info;
245796c8dcSSimon Schubert struct gdbarch;
255796c8dcSSimon Schubert struct reggroup;
265796c8dcSSimon Schubert struct regset;
275796c8dcSSimon Schubert struct regcache;
285796c8dcSSimon Schubert 
295796c8dcSSimon Schubert /* GDB's i386 target supports both the 32-bit Intel Architecture
305796c8dcSSimon Schubert    (IA-32) and the 64-bit AMD x86-64 architecture.  Internally it uses
315796c8dcSSimon Schubert    a similar register layout for both.
325796c8dcSSimon Schubert 
335796c8dcSSimon Schubert    - General purpose registers
345796c8dcSSimon Schubert    - FPU data registers
355796c8dcSSimon Schubert    - FPU control registers
365796c8dcSSimon Schubert    - SSE data registers
375796c8dcSSimon Schubert    - SSE control register
385796c8dcSSimon Schubert 
395796c8dcSSimon Schubert    The general purpose registers for the x86-64 architecture are quite
405796c8dcSSimon Schubert    different from IA-32.  Therefore, gdbarch_fp0_regnum
415796c8dcSSimon Schubert    determines the register number at which the FPU data registers
425796c8dcSSimon Schubert    start.  The number of FPU data and control registers is the same
435796c8dcSSimon Schubert    for both architectures.  The number of SSE registers however,
445796c8dcSSimon Schubert    differs and is determined by the num_xmm_regs member of `struct
455796c8dcSSimon Schubert    gdbarch_tdep'.  */
465796c8dcSSimon Schubert 
475796c8dcSSimon Schubert /* Convention for returning structures.  */
485796c8dcSSimon Schubert 
495796c8dcSSimon Schubert enum struct_return
505796c8dcSSimon Schubert {
515796c8dcSSimon Schubert   pcc_struct_return,		/* Return "short" structures in memory.  */
525796c8dcSSimon Schubert   reg_struct_return		/* Return "short" structures in registers.  */
535796c8dcSSimon Schubert };
545796c8dcSSimon Schubert 
55cf7f2e2dSJohn Marino /* Register classes as defined in the AMD x86-64 psABI.  */
56cf7f2e2dSJohn Marino 
57cf7f2e2dSJohn Marino enum amd64_reg_class
58cf7f2e2dSJohn Marino {
59cf7f2e2dSJohn Marino   AMD64_INTEGER,
60cf7f2e2dSJohn Marino   AMD64_SSE,
61cf7f2e2dSJohn Marino   AMD64_SSEUP,
62cf7f2e2dSJohn Marino   AMD64_X87,
63cf7f2e2dSJohn Marino   AMD64_X87UP,
64cf7f2e2dSJohn Marino   AMD64_COMPLEX_X87,
65cf7f2e2dSJohn Marino   AMD64_NO_CLASS,
66cf7f2e2dSJohn Marino   AMD64_MEMORY
67cf7f2e2dSJohn Marino };
68cf7f2e2dSJohn Marino 
695796c8dcSSimon Schubert /* i386 architecture specific information.  */
705796c8dcSSimon Schubert struct gdbarch_tdep
715796c8dcSSimon Schubert {
725796c8dcSSimon Schubert   /* General-purpose registers.  */
735796c8dcSSimon Schubert   struct regset *gregset;
745796c8dcSSimon Schubert   int *gregset_reg_offset;
755796c8dcSSimon Schubert   int gregset_num_regs;
765796c8dcSSimon Schubert   size_t sizeof_gregset;
775796c8dcSSimon Schubert 
78cf7f2e2dSJohn Marino   /* The general-purpose registers used to pass integers when making
79cf7f2e2dSJohn Marino      function calls.  This only applies to amd64, as all parameters
80cf7f2e2dSJohn Marino      are passed through the stack on x86.  */
81cf7f2e2dSJohn Marino   int call_dummy_num_integer_regs;
82cf7f2e2dSJohn Marino   int *call_dummy_integer_regs;
83cf7f2e2dSJohn Marino 
84cf7f2e2dSJohn Marino   /* Used on amd64 only.  Classify TYPE according to calling conventions,
85cf7f2e2dSJohn Marino      and store the result in CLASS.  */
86cf7f2e2dSJohn Marino   void (*classify) (struct type *type, enum amd64_reg_class class[2]);
87cf7f2e2dSJohn Marino 
88cf7f2e2dSJohn Marino   /* Used on amd64 only.  Non-zero if the first few MEMORY arguments
89cf7f2e2dSJohn Marino      should be passed by pointer.
90cf7f2e2dSJohn Marino 
91cf7f2e2dSJohn Marino      More precisely, MEMORY arguments are passed through the stack.
92cf7f2e2dSJohn Marino      But certain architectures require that their address be passed
93cf7f2e2dSJohn Marino      by register as well, if there are still some integer registers
94cf7f2e2dSJohn Marino      available for argument passing.  */
95cf7f2e2dSJohn Marino   int memory_args_by_pointer;
96cf7f2e2dSJohn Marino 
97cf7f2e2dSJohn Marino   /* Used on amd64 only.
98cf7f2e2dSJohn Marino 
99cf7f2e2dSJohn Marino      If non-zero, then the callers of a function are expected to reserve
100cf7f2e2dSJohn Marino      some space in the stack just before the area where the PC is saved
101cf7f2e2dSJohn Marino      so that the callee may save the integer-parameter registers there.
102cf7f2e2dSJohn Marino      The amount of space is dependent on the list of registers used for
103cf7f2e2dSJohn Marino      integer parameter passing (see component call_dummy_num_integer_regs
104cf7f2e2dSJohn Marino      above).  */
105cf7f2e2dSJohn Marino   int integer_param_regs_saved_in_caller_frame;
106cf7f2e2dSJohn Marino 
1075796c8dcSSimon Schubert   /* Floating-point registers.  */
1085796c8dcSSimon Schubert   struct regset *fpregset;
1095796c8dcSSimon Schubert   size_t sizeof_fpregset;
1105796c8dcSSimon Schubert 
111cf7f2e2dSJohn Marino   /* XSAVE extended state.  */
112cf7f2e2dSJohn Marino   struct regset *xstateregset;
113cf7f2e2dSJohn Marino 
1145796c8dcSSimon Schubert   /* Register number for %st(0).  The register numbers for the other
1155796c8dcSSimon Schubert      registers follow from this one.  Set this to -1 to indicate the
1165796c8dcSSimon Schubert      absence of an FPU.  */
1175796c8dcSSimon Schubert   int st0_regnum;
1185796c8dcSSimon Schubert 
119cf7f2e2dSJohn Marino   /* Number of MMX registers.  */
120cf7f2e2dSJohn Marino   int num_mmx_regs;
121cf7f2e2dSJohn Marino 
1225796c8dcSSimon Schubert   /* Register number for %mm0.  Set this to -1 to indicate the absence
1235796c8dcSSimon Schubert      of MMX support.  */
1245796c8dcSSimon Schubert   int mm0_regnum;
1255796c8dcSSimon Schubert 
126cf7f2e2dSJohn Marino   /* Number of pseudo YMM registers.  */
127cf7f2e2dSJohn Marino   int num_ymm_regs;
128cf7f2e2dSJohn Marino 
129cf7f2e2dSJohn Marino   /* Register number for %ymm0.  Set this to -1 to indicate the absence
130cf7f2e2dSJohn Marino      of pseudo YMM register support.  */
131cf7f2e2dSJohn Marino   int ymm0_regnum;
132cf7f2e2dSJohn Marino 
133cf7f2e2dSJohn Marino   /* Number of byte registers.  */
134cf7f2e2dSJohn Marino   int num_byte_regs;
135cf7f2e2dSJohn Marino 
136cf7f2e2dSJohn Marino   /* Register pseudo number for %al.  */
137cf7f2e2dSJohn Marino   int al_regnum;
138cf7f2e2dSJohn Marino 
139cf7f2e2dSJohn Marino   /* Number of pseudo word registers.  */
140cf7f2e2dSJohn Marino   int num_word_regs;
141cf7f2e2dSJohn Marino 
142cf7f2e2dSJohn Marino   /* Register number for %ax.  */
143cf7f2e2dSJohn Marino   int ax_regnum;
144cf7f2e2dSJohn Marino 
145cf7f2e2dSJohn Marino   /* Number of pseudo dword registers.  */
146cf7f2e2dSJohn Marino   int num_dword_regs;
147cf7f2e2dSJohn Marino 
148cf7f2e2dSJohn Marino   /* Register number for %eax.  Set this to -1 to indicate the absence
149cf7f2e2dSJohn Marino      of pseudo dword register support.  */
150cf7f2e2dSJohn Marino   int eax_regnum;
151cf7f2e2dSJohn Marino 
152cf7f2e2dSJohn Marino   /* Number of core registers.  */
153cf7f2e2dSJohn Marino   int num_core_regs;
154cf7f2e2dSJohn Marino 
1555796c8dcSSimon Schubert   /* Number of SSE registers.  */
1565796c8dcSSimon Schubert   int num_xmm_regs;
1575796c8dcSSimon Schubert 
158cf7f2e2dSJohn Marino   /* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK
159c50c785cSJohn Marino      register), excluding the x87 bit, which are supported by this GDB.  */
160c50c785cSJohn Marino 
161cf7f2e2dSJohn Marino   uint64_t xcr0;
162cf7f2e2dSJohn Marino 
163cf7f2e2dSJohn Marino   /* Offset of XCR0 in XSAVE extended state.  */
164cf7f2e2dSJohn Marino   int xsave_xcr0_offset;
165cf7f2e2dSJohn Marino 
166cf7f2e2dSJohn Marino   /* Register names.  */
167cf7f2e2dSJohn Marino   const char **register_names;
168cf7f2e2dSJohn Marino 
169cf7f2e2dSJohn Marino   /* Register number for %ymm0h.  Set this to -1 to indicate the absence
170cf7f2e2dSJohn Marino      of upper YMM register support.  */
171cf7f2e2dSJohn Marino   int ymm0h_regnum;
172cf7f2e2dSJohn Marino 
173cf7f2e2dSJohn Marino   /* Upper YMM register names.  Only used for tdesc_numbered_register.  */
174cf7f2e2dSJohn Marino   const char **ymmh_register_names;
175cf7f2e2dSJohn Marino 
176cf7f2e2dSJohn Marino   /* Target description.  */
177cf7f2e2dSJohn Marino   const struct target_desc *tdesc;
178cf7f2e2dSJohn Marino 
179cf7f2e2dSJohn Marino   /* Register group function.  */
180cf7f2e2dSJohn Marino   const void *register_reggroup_p;
181cf7f2e2dSJohn Marino 
1825796c8dcSSimon Schubert   /* Offset of saved PC in jmp_buf.  */
1835796c8dcSSimon Schubert   int jb_pc_offset;
1845796c8dcSSimon Schubert 
1855796c8dcSSimon Schubert   /* Convention for returning structures.  */
1865796c8dcSSimon Schubert   enum struct_return struct_return;
1875796c8dcSSimon Schubert 
1885796c8dcSSimon Schubert   /* Address range where sigtramp lives.  */
1895796c8dcSSimon Schubert   CORE_ADDR sigtramp_start;
1905796c8dcSSimon Schubert   CORE_ADDR sigtramp_end;
1915796c8dcSSimon Schubert 
1925796c8dcSSimon Schubert   /* Detect sigtramp.  */
1935796c8dcSSimon Schubert   int (*sigtramp_p) (struct frame_info *);
1945796c8dcSSimon Schubert 
1955796c8dcSSimon Schubert   /* Get address of sigcontext for sigtramp.  */
1965796c8dcSSimon Schubert   CORE_ADDR (*sigcontext_addr) (struct frame_info *);
1975796c8dcSSimon Schubert 
1985796c8dcSSimon Schubert   /* Offset of registers in `struct sigcontext'.  */
1995796c8dcSSimon Schubert   int *sc_reg_offset;
2005796c8dcSSimon Schubert   int sc_num_regs;
2015796c8dcSSimon Schubert 
2025796c8dcSSimon Schubert   /* Offset of saved PC and SP in `struct sigcontext'.  Usage of these
2035796c8dcSSimon Schubert      is deprecated, please use `sc_reg_offset' instead.  */
2045796c8dcSSimon Schubert   int sc_pc_offset;
2055796c8dcSSimon Schubert   int sc_sp_offset;
2065796c8dcSSimon Schubert 
2075796c8dcSSimon Schubert   /* ISA-specific data types.  */
2085796c8dcSSimon Schubert   struct type *i386_mmx_type;
209cf7f2e2dSJohn Marino   struct type *i386_ymm_type;
2105796c8dcSSimon Schubert   struct type *i387_ext_type;
2115796c8dcSSimon Schubert 
2125796c8dcSSimon Schubert   /* Process record/replay target.  */
2135796c8dcSSimon Schubert   /* The map for registers because the AMD64's registers order
2145796c8dcSSimon Schubert      in GDB is not same as I386 instructions.  */
2155796c8dcSSimon Schubert   const int *record_regmap;
2165796c8dcSSimon Schubert   /* Parse intx80 args.  */
2175796c8dcSSimon Schubert   int (*i386_intx80_record) (struct regcache *regcache);
2185796c8dcSSimon Schubert   /* Parse sysenter args.  */
2195796c8dcSSimon Schubert   int (*i386_sysenter_record) (struct regcache *regcache);
2205796c8dcSSimon Schubert   /* Parse syscall args.  */
2215796c8dcSSimon Schubert   int (*i386_syscall_record) (struct regcache *regcache);
2225796c8dcSSimon Schubert };
2235796c8dcSSimon Schubert 
2245796c8dcSSimon Schubert /* Floating-point registers.  */
2255796c8dcSSimon Schubert 
2265796c8dcSSimon Schubert /* All FPU control regusters (except for FIOFF and FOOFF) are 16-bit
2275796c8dcSSimon Schubert    (at most) in the FPU, but are zero-extended to 32 bits in GDB's
2285796c8dcSSimon Schubert    register cache.  */
2295796c8dcSSimon Schubert 
2305796c8dcSSimon Schubert /* Return non-zero if REGNUM matches the FP register and the FP
2315796c8dcSSimon Schubert    register set is active.  */
2325796c8dcSSimon Schubert extern int i386_fp_regnum_p (struct gdbarch *, int);
2335796c8dcSSimon Schubert extern int i386_fpc_regnum_p (struct gdbarch *, int);
2345796c8dcSSimon Schubert 
2355796c8dcSSimon Schubert /* Register numbers of various important registers.  */
2365796c8dcSSimon Schubert 
2375796c8dcSSimon Schubert enum i386_regnum
2385796c8dcSSimon Schubert {
2395796c8dcSSimon Schubert   I386_EAX_REGNUM,		/* %eax */
2405796c8dcSSimon Schubert   I386_ECX_REGNUM,		/* %ecx */
2415796c8dcSSimon Schubert   I386_EDX_REGNUM,		/* %edx */
2425796c8dcSSimon Schubert   I386_EBX_REGNUM,		/* %ebx */
2435796c8dcSSimon Schubert   I386_ESP_REGNUM,		/* %esp */
2445796c8dcSSimon Schubert   I386_EBP_REGNUM,		/* %ebp */
2455796c8dcSSimon Schubert   I386_ESI_REGNUM,		/* %esi */
2465796c8dcSSimon Schubert   I386_EDI_REGNUM,		/* %edi */
2475796c8dcSSimon Schubert   I386_EIP_REGNUM,		/* %eip */
2485796c8dcSSimon Schubert   I386_EFLAGS_REGNUM,		/* %eflags */
2495796c8dcSSimon Schubert   I386_CS_REGNUM,		/* %cs */
2505796c8dcSSimon Schubert   I386_SS_REGNUM,		/* %ss */
2515796c8dcSSimon Schubert   I386_DS_REGNUM,		/* %ds */
2525796c8dcSSimon Schubert   I386_ES_REGNUM,		/* %es */
2535796c8dcSSimon Schubert   I386_FS_REGNUM,		/* %fs */
2545796c8dcSSimon Schubert   I386_GS_REGNUM,		/* %gs */
255cf7f2e2dSJohn Marino   I386_ST0_REGNUM,		/* %st(0) */
256cf7f2e2dSJohn Marino   I386_MXCSR_REGNUM = 40,	/* %mxcsr */
257cf7f2e2dSJohn Marino   I386_YMM0H_REGNUM,		/* %ymm0h */
258cf7f2e2dSJohn Marino   I386_YMM7H_REGNUM = I386_YMM0H_REGNUM + 7
2595796c8dcSSimon Schubert };
2605796c8dcSSimon Schubert 
2615796c8dcSSimon Schubert /* Register numbers of RECORD_REGMAP.  */
2625796c8dcSSimon Schubert 
2635796c8dcSSimon Schubert enum record_i386_regnum
2645796c8dcSSimon Schubert {
2655796c8dcSSimon Schubert   X86_RECORD_REAX_REGNUM,
2665796c8dcSSimon Schubert   X86_RECORD_RECX_REGNUM,
2675796c8dcSSimon Schubert   X86_RECORD_REDX_REGNUM,
2685796c8dcSSimon Schubert   X86_RECORD_REBX_REGNUM,
2695796c8dcSSimon Schubert   X86_RECORD_RESP_REGNUM,
2705796c8dcSSimon Schubert   X86_RECORD_REBP_REGNUM,
2715796c8dcSSimon Schubert   X86_RECORD_RESI_REGNUM,
2725796c8dcSSimon Schubert   X86_RECORD_REDI_REGNUM,
2735796c8dcSSimon Schubert   X86_RECORD_R8_REGNUM,
2745796c8dcSSimon Schubert   X86_RECORD_R9_REGNUM,
2755796c8dcSSimon Schubert   X86_RECORD_R10_REGNUM,
2765796c8dcSSimon Schubert   X86_RECORD_R11_REGNUM,
2775796c8dcSSimon Schubert   X86_RECORD_R12_REGNUM,
2785796c8dcSSimon Schubert   X86_RECORD_R13_REGNUM,
2795796c8dcSSimon Schubert   X86_RECORD_R14_REGNUM,
2805796c8dcSSimon Schubert   X86_RECORD_R15_REGNUM,
2815796c8dcSSimon Schubert   X86_RECORD_REIP_REGNUM,
2825796c8dcSSimon Schubert   X86_RECORD_EFLAGS_REGNUM,
2835796c8dcSSimon Schubert   X86_RECORD_CS_REGNUM,
2845796c8dcSSimon Schubert   X86_RECORD_SS_REGNUM,
2855796c8dcSSimon Schubert   X86_RECORD_DS_REGNUM,
2865796c8dcSSimon Schubert   X86_RECORD_ES_REGNUM,
2875796c8dcSSimon Schubert   X86_RECORD_FS_REGNUM,
2885796c8dcSSimon Schubert   X86_RECORD_GS_REGNUM,
2895796c8dcSSimon Schubert };
2905796c8dcSSimon Schubert 
2915796c8dcSSimon Schubert #define I386_NUM_GREGS	16
2925796c8dcSSimon Schubert #define I386_NUM_XREGS  9
2935796c8dcSSimon Schubert 
294cf7f2e2dSJohn Marino #define I386_SSE_NUM_REGS	(I386_MXCSR_REGNUM + 1)
295cf7f2e2dSJohn Marino #define I386_AVX_NUM_REGS	(I386_YMM7H_REGNUM + 1)
2965796c8dcSSimon Schubert 
2975796c8dcSSimon Schubert /* Size of the largest register.  */
2985796c8dcSSimon Schubert #define I386_MAX_REGISTER_SIZE	16
2995796c8dcSSimon Schubert 
3005796c8dcSSimon Schubert /* Types for i386-specific registers.  */
3015796c8dcSSimon Schubert extern struct type *i387_ext_type (struct gdbarch *gdbarch);
3025796c8dcSSimon Schubert 
303cf7f2e2dSJohn Marino /* Checks of different pseudo-registers.  */
304cf7f2e2dSJohn Marino extern int i386_byte_regnum_p (struct gdbarch *gdbarch, int regnum);
305cf7f2e2dSJohn Marino extern int i386_word_regnum_p (struct gdbarch *gdbarch, int regnum);
306cf7f2e2dSJohn Marino extern int i386_dword_regnum_p (struct gdbarch *gdbarch, int regnum);
307cf7f2e2dSJohn Marino extern int i386_xmm_regnum_p (struct gdbarch *gdbarch, int regnum);
308cf7f2e2dSJohn Marino extern int i386_ymm_regnum_p (struct gdbarch *gdbarch, int regnum);
309cf7f2e2dSJohn Marino 
310cf7f2e2dSJohn Marino extern const char *i386_pseudo_register_name (struct gdbarch *gdbarch,
311cf7f2e2dSJohn Marino 					      int regnum);
312*ef5ccd6cSJohn Marino extern struct type *i386_pseudo_register_type (struct gdbarch *gdbarch,
313*ef5ccd6cSJohn Marino 					       int regnum);
314cf7f2e2dSJohn Marino 
315a45ae5f8SJohn Marino extern void i386_pseudo_register_read_into_value (struct gdbarch *gdbarch,
316cf7f2e2dSJohn Marino 						  struct regcache *regcache,
317c50c785cSJohn Marino 						  int regnum,
318a45ae5f8SJohn Marino 						  struct value *result);
319a45ae5f8SJohn Marino 
320cf7f2e2dSJohn Marino extern void i386_pseudo_register_write (struct gdbarch *gdbarch,
321cf7f2e2dSJohn Marino 					struct regcache *regcache,
322cf7f2e2dSJohn Marino 					int regnum, const gdb_byte *buf);
323cf7f2e2dSJohn Marino 
3245796c8dcSSimon Schubert /* Segment selectors.  */
3255796c8dcSSimon Schubert #define I386_SEL_RPL	0x0003  /* Requester's Privilege Level mask.  */
3265796c8dcSSimon Schubert #define I386_SEL_UPL	0x0003	/* User Privilige Level.  */
3275796c8dcSSimon Schubert #define I386_SEL_KPL	0x0000	/* Kernel Privilige Level.  */
3285796c8dcSSimon Schubert 
3295796c8dcSSimon Schubert /* The length of the longest i386 instruction (according to
3305796c8dcSSimon Schubert    include/asm-i386/kprobes.h in Linux 2.6.  */
3315796c8dcSSimon Schubert #define I386_MAX_INSN_LEN (16)
3325796c8dcSSimon Schubert 
3335796c8dcSSimon Schubert /* Functions exported from i386-tdep.c.  */
3345796c8dcSSimon Schubert extern CORE_ADDR i386_pe_skip_trampoline_code (struct frame_info *frame,
3355796c8dcSSimon Schubert 					       CORE_ADDR pc, char *name);
336c50c785cSJohn Marino extern CORE_ADDR i386_skip_main_prologue (struct gdbarch *gdbarch,
337c50c785cSJohn Marino 					  CORE_ADDR pc);
3385796c8dcSSimon Schubert 
3395796c8dcSSimon Schubert /* Return whether the THIS_FRAME corresponds to a sigtramp routine.  */
3405796c8dcSSimon Schubert extern int i386_sigtramp_p (struct frame_info *this_frame);
3415796c8dcSSimon Schubert 
3425796c8dcSSimon Schubert /* Return non-zero if REGNUM is a member of the specified group.  */
3435796c8dcSSimon Schubert extern int i386_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
3445796c8dcSSimon Schubert 				     struct reggroup *group);
3455796c8dcSSimon Schubert 
3465796c8dcSSimon Schubert /* Supply register REGNUM from the general-purpose register set REGSET
3475796c8dcSSimon Schubert    to register cache REGCACHE.  If REGNUM is -1, do this for all
3485796c8dcSSimon Schubert    registers in REGSET.  */
3495796c8dcSSimon Schubert extern void i386_supply_gregset (const struct regset *regset,
3505796c8dcSSimon Schubert 				 struct regcache *regcache, int regnum,
3515796c8dcSSimon Schubert 				 const void *gregs, size_t len);
3525796c8dcSSimon Schubert 
3535796c8dcSSimon Schubert /* Collect register REGNUM from the register cache REGCACHE and store
3545796c8dcSSimon Schubert    it in the buffer specified by GREGS and LEN as described by the
3555796c8dcSSimon Schubert    general-purpose register set REGSET.  If REGNUM is -1, do this for
3565796c8dcSSimon Schubert    all registers in REGSET.  */
3575796c8dcSSimon Schubert extern void i386_collect_gregset (const struct regset *regset,
3585796c8dcSSimon Schubert 				  const struct regcache *regcache,
3595796c8dcSSimon Schubert 				  int regnum, void *gregs, size_t len);
3605796c8dcSSimon Schubert 
3615796c8dcSSimon Schubert /* Return the appropriate register set for the core section identified
3625796c8dcSSimon Schubert    by SECT_NAME and SECT_SIZE.  */
3635796c8dcSSimon Schubert extern const struct regset *
3645796c8dcSSimon Schubert   i386_regset_from_core_section (struct gdbarch *gdbarch,
3655796c8dcSSimon Schubert 				 const char *sect_name, size_t sect_size);
3665796c8dcSSimon Schubert 
3675796c8dcSSimon Schubert 
368cf7f2e2dSJohn Marino extern struct displaced_step_closure *i386_displaced_step_copy_insn
369cf7f2e2dSJohn Marino   (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
370cf7f2e2dSJohn Marino    struct regcache *regs);
3715796c8dcSSimon Schubert extern void i386_displaced_step_fixup (struct gdbarch *gdbarch,
3725796c8dcSSimon Schubert 				       struct displaced_step_closure *closure,
3735796c8dcSSimon Schubert 				       CORE_ADDR from, CORE_ADDR to,
3745796c8dcSSimon Schubert 				       struct regcache *regs);
3755796c8dcSSimon Schubert 
3765796c8dcSSimon Schubert /* Initialize a basic ELF architecture variant.  */
3775796c8dcSSimon Schubert extern void i386_elf_init_abi (struct gdbarch_info, struct gdbarch *);
3785796c8dcSSimon Schubert 
3795796c8dcSSimon Schubert /* Initialize a SVR4 architecture variant.  */
3805796c8dcSSimon Schubert extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
3815796c8dcSSimon Schubert 
3825796c8dcSSimon Schubert extern int i386_process_record (struct gdbarch *gdbarch,
3835796c8dcSSimon Schubert                                 struct regcache *regcache, CORE_ADDR addr);
384*ef5ccd6cSJohn Marino 
3855796c8dcSSimon Schubert 
3865796c8dcSSimon Schubert 
3875796c8dcSSimon Schubert /* Functions and variables exported from i386bsd-tdep.c.  */
3885796c8dcSSimon Schubert 
3895796c8dcSSimon Schubert extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *);
3905796c8dcSSimon Schubert extern CORE_ADDR i386fbsd_sigtramp_start_addr;
3915796c8dcSSimon Schubert extern CORE_ADDR i386fbsd_sigtramp_end_addr;
3925796c8dcSSimon Schubert extern CORE_ADDR i386obsd_sigtramp_start_addr;
3935796c8dcSSimon Schubert extern CORE_ADDR i386obsd_sigtramp_end_addr;
3945796c8dcSSimon Schubert extern CORE_ADDR i386dfly_sigtramp_start_addr;
3955796c8dcSSimon Schubert extern CORE_ADDR i386dfly_sigtramp_end_addr;
3965796c8dcSSimon Schubert extern int i386dfly_sc_reg_offset[];
3975796c8dcSSimon Schubert extern int i386fbsd4_sc_reg_offset[];
3985796c8dcSSimon Schubert extern int i386fbsd_sc_reg_offset[];
3995796c8dcSSimon Schubert extern int i386nbsd_sc_reg_offset[];
400*ef5ccd6cSJohn Marino extern int i386obsd_sc_reg_offset[];
401*ef5ccd6cSJohn Marino extern int i386bsd_sc_reg_offset[];
402*ef5ccd6cSJohn Marino 
403*ef5ccd6cSJohn Marino /* SystemTap related functions.  */
404*ef5ccd6cSJohn Marino 
405*ef5ccd6cSJohn Marino extern int i386_stap_is_single_operand (struct gdbarch *gdbarch,
406*ef5ccd6cSJohn Marino 					const char *s);
407*ef5ccd6cSJohn Marino 
4085796c8dcSSimon Schubert extern int i386_stap_parse_special_token (struct gdbarch *gdbarch,
409 					  struct stap_parse_info *p);
410 
411 #endif /* i386-tdep.h */
412