xref: /dflybsd-src/contrib/gdb-7/gdb/amd64-tdep.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Target-dependent definitions for AMD64.
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 2001-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert    Contributed by Jiri Smid, SuSE Labs.
55796c8dcSSimon Schubert 
65796c8dcSSimon Schubert    This file is part of GDB.
75796c8dcSSimon Schubert 
85796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
95796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
105796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
115796c8dcSSimon Schubert    (at your option) any later version.
125796c8dcSSimon Schubert 
135796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
145796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
155796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
165796c8dcSSimon Schubert    GNU General Public License for more details.
175796c8dcSSimon Schubert 
185796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
195796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert #ifndef AMD64_TDEP_H
225796c8dcSSimon Schubert #define AMD64_TDEP_H
235796c8dcSSimon Schubert 
245796c8dcSSimon Schubert struct gdbarch;
255796c8dcSSimon Schubert struct frame_info;
265796c8dcSSimon Schubert struct regcache;
275796c8dcSSimon Schubert 
285796c8dcSSimon Schubert #include "i386-tdep.h"
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert /* Register numbers of various important registers.  */
315796c8dcSSimon Schubert 
325796c8dcSSimon Schubert enum amd64_regnum
335796c8dcSSimon Schubert {
345796c8dcSSimon Schubert   AMD64_RAX_REGNUM,		/* %rax */
355796c8dcSSimon Schubert   AMD64_RBX_REGNUM,		/* %rbx */
365796c8dcSSimon Schubert   AMD64_RCX_REGNUM,		/* %rcx */
375796c8dcSSimon Schubert   AMD64_RDX_REGNUM,		/* %rdx */
385796c8dcSSimon Schubert   AMD64_RSI_REGNUM,		/* %rsi */
395796c8dcSSimon Schubert   AMD64_RDI_REGNUM,		/* %rdi */
405796c8dcSSimon Schubert   AMD64_RBP_REGNUM,		/* %rbp */
415796c8dcSSimon Schubert   AMD64_RSP_REGNUM,		/* %rsp */
425796c8dcSSimon Schubert   AMD64_R8_REGNUM,		/* %r8 */
435796c8dcSSimon Schubert   AMD64_R9_REGNUM,		/* %r9 */
445796c8dcSSimon Schubert   AMD64_R10_REGNUM,		/* %r10 */
455796c8dcSSimon Schubert   AMD64_R11_REGNUM,		/* %r11 */
465796c8dcSSimon Schubert   AMD64_R12_REGNUM,		/* %r12 */
475796c8dcSSimon Schubert   AMD64_R13_REGNUM,		/* %r13 */
485796c8dcSSimon Schubert   AMD64_R14_REGNUM,		/* %r14 */
495796c8dcSSimon Schubert   AMD64_R15_REGNUM,		/* %r15 */
505796c8dcSSimon Schubert   AMD64_RIP_REGNUM,		/* %rip */
515796c8dcSSimon Schubert   AMD64_EFLAGS_REGNUM,		/* %eflags */
525796c8dcSSimon Schubert   AMD64_CS_REGNUM,		/* %cs */
535796c8dcSSimon Schubert   AMD64_SS_REGNUM,		/* %ss */
545796c8dcSSimon Schubert   AMD64_DS_REGNUM,		/* %ds */
555796c8dcSSimon Schubert   AMD64_ES_REGNUM,		/* %es */
565796c8dcSSimon Schubert   AMD64_FS_REGNUM,		/* %fs */
575796c8dcSSimon Schubert   AMD64_GS_REGNUM,		/* %gs */
585796c8dcSSimon Schubert   AMD64_ST0_REGNUM = 24,	/* %st0 */
59*ef5ccd6cSJohn Marino   AMD64_ST1_REGNUM,		/* %st1 */
605796c8dcSSimon Schubert   AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
615796c8dcSSimon Schubert   AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
62*ef5ccd6cSJohn Marino   AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
635796c8dcSSimon Schubert   AMD64_XMM0_REGNUM = 40,	/* %xmm0 */
645796c8dcSSimon Schubert   AMD64_XMM1_REGNUM,		/* %xmm1 */
65cf7f2e2dSJohn Marino   AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
66cf7f2e2dSJohn Marino   AMD64_YMM0H_REGNUM,		/* %ymm0h */
67cf7f2e2dSJohn Marino   AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15
685796c8dcSSimon Schubert };
695796c8dcSSimon Schubert 
705796c8dcSSimon Schubert /* Number of general purpose registers.  */
715796c8dcSSimon Schubert #define AMD64_NUM_GREGS		24
725796c8dcSSimon Schubert 
73cf7f2e2dSJohn Marino #define AMD64_NUM_REGS		(AMD64_YMM15H_REGNUM + 1)
74cf7f2e2dSJohn Marino 
755796c8dcSSimon Schubert extern struct displaced_step_closure *amd64_displaced_step_copy_insn
765796c8dcSSimon Schubert   (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
775796c8dcSSimon Schubert    struct regcache *regs);
785796c8dcSSimon Schubert extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch,
795796c8dcSSimon Schubert 					struct displaced_step_closure *closure,
805796c8dcSSimon Schubert 					CORE_ADDR from, CORE_ADDR to,
815796c8dcSSimon Schubert 					struct regcache *regs);
825796c8dcSSimon Schubert 
835796c8dcSSimon Schubert extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
84*ef5ccd6cSJohn Marino extern void amd64_x32_init_abi (struct gdbarch_info info,
85*ef5ccd6cSJohn Marino 				struct gdbarch *gdbarch);
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert /* Fill register REGNUM in REGCACHE with the appropriate
885796c8dcSSimon Schubert    floating-point or SSE register value from *FXSAVE.  If REGNUM is
895796c8dcSSimon Schubert    -1, do this for all registers.  This function masks off any of the
905796c8dcSSimon Schubert    reserved bits in *FXSAVE.  */
915796c8dcSSimon Schubert 
925796c8dcSSimon Schubert extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
935796c8dcSSimon Schubert 				 const void *fxsave);
945796c8dcSSimon Schubert 
95cf7f2e2dSJohn Marino /* Similar to amd64_supply_fxsave, but use XSAVE extended state.  */
96cf7f2e2dSJohn Marino extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
97cf7f2e2dSJohn Marino 				const void *xsave);
98cf7f2e2dSJohn Marino 
995796c8dcSSimon Schubert /* Fill register REGNUM (if it is a floating-point or SSE register) in
1005796c8dcSSimon Schubert    *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
1015796c8dcSSimon Schubert    all registers.  This function doesn't touch any of the reserved
1025796c8dcSSimon Schubert    bits in *FXSAVE.  */
1035796c8dcSSimon Schubert 
1045796c8dcSSimon Schubert extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
1055796c8dcSSimon Schubert 				  void *fxsave);
106cf7f2e2dSJohn Marino 
107a45ae5f8SJohn Marino /* Similar to amd64_collect_fxsave, but use XSAVE extended state.  */
108cf7f2e2dSJohn Marino extern void amd64_collect_xsave (const struct regcache *regcache,
109cf7f2e2dSJohn Marino 				 int regnum, void *xsave, int gcore);
110cf7f2e2dSJohn Marino 
111cf7f2e2dSJohn Marino void amd64_classify (struct type *type, enum amd64_reg_class class[2]);
112cf7f2e2dSJohn Marino 
1135796c8dcSSimon Schubert 
1145796c8dcSSimon Schubert 
115cf7f2e2dSJohn Marino /* Variables exported from amd64-linux-tdep.c.  */
116cf7f2e2dSJohn Marino extern int amd64_linux_gregset_reg_offset[];
117cf7f2e2dSJohn Marino 
1185796c8dcSSimon Schubert /* Variables exported from amd64nbsd-tdep.c.  */
1195796c8dcSSimon Schubert extern int amd64nbsd_r_reg_offset[];
1205796c8dcSSimon Schubert 
1215796c8dcSSimon Schubert /* Variables exported from amd64obsd-tdep.c.  */
1225796c8dcSSimon Schubert extern int amd64obsd_r_reg_offset[];
1235796c8dcSSimon Schubert 
1245796c8dcSSimon Schubert /* Variables exported from amd64fbsd-tdep.c.  */
1255796c8dcSSimon Schubert extern CORE_ADDR amd64fbsd_sigtramp_start_addr;
1265796c8dcSSimon Schubert extern CORE_ADDR amd64fbsd_sigtramp_end_addr;
1275796c8dcSSimon Schubert extern int amd64fbsd_sc_reg_offset[];
1285796c8dcSSimon Schubert 
12969e0f06dSSimon Schubert /* Variables exported from amd64dfly-tdep.c.  */
13069e0f06dSSimon Schubert extern CORE_ADDR amd64dfly_sigtramp_start_addr;
13169e0f06dSSimon Schubert extern CORE_ADDR amd64dfly_sigtramp_end_addr;
13269e0f06dSSimon Schubert extern int amd64dfly_sc_reg_offset[];
13369e0f06dSSimon Schubert 
1345796c8dcSSimon Schubert #endif /* amd64-tdep.h */
135