1 /* Target-dependent definitions for AMD64.
3 Copyright (C) 2001-2017 Free Software Foundation, Inc.
4 Contributed by Jiri Smid, SuSE Labs.
6 This file is part of GDB.
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 3 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
28 #include "i386-tdep.h"
30 /* Register numbers of various important registers. */
34 AMD64_RAX_REGNUM, /* %rax */
35 AMD64_RBX_REGNUM, /* %rbx */
36 AMD64_RCX_REGNUM, /* %rcx */
37 AMD64_RDX_REGNUM, /* %rdx */
38 AMD64_RSI_REGNUM, /* %rsi */
39 AMD64_RDI_REGNUM, /* %rdi */
40 AMD64_RBP_REGNUM, /* %rbp */
41 AMD64_RSP_REGNUM, /* %rsp */
42 AMD64_R8_REGNUM, /* %r8 */
43 AMD64_R9_REGNUM, /* %r9 */
44 AMD64_R10_REGNUM, /* %r10 */
45 AMD64_R11_REGNUM, /* %r11 */
46 AMD64_R12_REGNUM, /* %r12 */
47 AMD64_R13_REGNUM, /* %r13 */
48 AMD64_R14_REGNUM, /* %r14 */
49 AMD64_R15_REGNUM, /* %r15 */
50 AMD64_RIP_REGNUM, /* %rip */
51 AMD64_EFLAGS_REGNUM, /* %eflags */
52 AMD64_CS_REGNUM, /* %cs */
53 AMD64_SS_REGNUM, /* %ss */
54 AMD64_DS_REGNUM, /* %ds */
55 AMD64_ES_REGNUM, /* %es */
56 AMD64_FS_REGNUM, /* %fs */
57 AMD64_GS_REGNUM, /* %gs */
58 AMD64_ST0_REGNUM = 24, /* %st0 */
59 AMD64_ST1_REGNUM, /* %st1 */
60 AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
61 AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
62 AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
63 AMD64_XMM0_REGNUM = 40, /* %xmm0 */
64 AMD64_XMM1_REGNUM, /* %xmm1 */
65 AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
66 AMD64_YMM0H_REGNUM, /* %ymm0h */
67 AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
68 AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
69 AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
71 AMD64_BNDSTATUS_REGNUM,
73 AMD64_XMM31_REGNUM = AMD64_XMM16_REGNUM + 15,
75 AMD64_YMM31H_REGNUM = AMD64_YMM16H_REGNUM + 15,
77 AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7,
79 AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31,
85 /* Number of general purpose registers. */
86 #define AMD64_NUM_GREGS 24
88 #define AMD64_NUM_REGS (AMD64_GSBASE_REGNUM + 1)
90 extern struct target_desc *tdesc_amd64;
92 extern struct displaced_step_closure *amd64_displaced_step_copy_insn
93 (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
94 struct regcache *regs);
95 extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch,
96 struct displaced_step_closure *closure,
97 CORE_ADDR from, CORE_ADDR to,
98 struct regcache *regs);
100 extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
101 extern void amd64_x32_init_abi (struct gdbarch_info info,
102 struct gdbarch *gdbarch);
103 extern const struct target_desc *amd64_target_description (uint64_t xcr0);
105 /* Fill register REGNUM in REGCACHE with the appropriate
106 floating-point or SSE register value from *FXSAVE. If REGNUM is
107 -1, do this for all registers. This function masks off any of the
108 reserved bits in *FXSAVE. */
110 extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
113 /* Similar to amd64_supply_fxsave, but use XSAVE extended state. */
114 extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
117 /* Fill register REGNUM (if it is a floating-point or SSE register) in
118 *FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for
119 all registers. This function doesn't touch any of the reserved
122 extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
124 /* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
125 extern void amd64_collect_xsave (const struct regcache *regcache,
126 int regnum, void *xsave, int gcore);
128 /* Floating-point register set. */
129 extern const struct regset amd64_fpregset;
131 /* Variables exported from amd64-linux-tdep.c. */
132 extern int amd64_linux_gregset_reg_offset[];
134 /* Variables exported from amd64-nbsd-tdep.c. */
135 extern int amd64nbsd_r_reg_offset[];
137 /* Variables exported from amd64-obsd-tdep.c. */
138 extern int amd64obsd_r_reg_offset[];
140 /* Variables exported from amd64-fbsd-tdep.c. */
141 extern CORE_ADDR amd64fbsd_sigtramp_start_addr;
142 extern CORE_ADDR amd64fbsd_sigtramp_end_addr;
143 extern int amd64fbsd_sc_reg_offset[];
145 #endif /* amd64-tdep.h */