1/* Target-dependent definitions for AMD64.
2
3   Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
4   Contributed by Jiri Smid, SuSE Labs.
5
6   This file is part of GDB.
7
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.
12
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.
17
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/>.  */
20
21#ifndef AMD64_TDEP_H
22#define AMD64_TDEP_H
23
24struct gdbarch;
25struct frame_info;
26struct regcache;
27
28#include "i386-tdep.h"
29
30/* Register numbers of various important registers.  */
31
32enum amd64_regnum
33{
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 = 8,		/* %r8 */
43  AMD64_R15_REGNUM = 15,	/* %r15 */
44  AMD64_RIP_REGNUM,		/* %rip */
45  AMD64_EFLAGS_REGNUM,		/* %eflags */
46  AMD64_CS_REGNUM,		/* %cs */
47  AMD64_SS_REGNUM,		/* %ss */
48  AMD64_DS_REGNUM,		/* %ds */
49  AMD64_ES_REGNUM,		/* %es */
50  AMD64_FS_REGNUM,		/* %fs */
51  AMD64_GS_REGNUM,		/* %gs */
52  AMD64_ST0_REGNUM = 24,	/* %st0 */
53  AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
54  AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
55  AMD64_XMM0_REGNUM = 40,	/* %xmm0 */
56  AMD64_XMM1_REGNUM,		/* %xmm1 */
57  AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16
58};
59
60/* Number of general purpose registers.  */
61#define AMD64_NUM_GREGS		24
62
63extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
64
65/* Functions from amd64-tdep.c which may be needed on architectures
66   with extra registers.  */
67
68extern const char *amd64_register_name (int regnum);
69extern struct type *amd64_register_type (struct gdbarch *gdbarch, int regnum);
70
71/* Fill register REGNUM in REGCACHE with the appropriate
72   floating-point or SSE register value from *FXSAVE.  If REGNUM is
73   -1, do this for all registers.  This function masks off any of the
74   reserved bits in *FXSAVE.  */
75
76extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
77				 const void *fxsave);
78
79/* Fill register REGNUM (if it is a floating-point or SSE register) in
80   *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
81   all registers.  This function doesn't touch any of the reserved
82   bits in *FXSAVE.  */
83
84extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
85				  void *fxsave);
86
87
88/* Variables exported from amd64nbsd-tdep.c.  */
89extern int amd64nbsd_r_reg_offset[];
90
91/* Variables exported from amd64obsd-tdep.c.  */
92extern int amd64obsd_r_reg_offset[];
93
94/* Variables exported from amd64fbsd-tdep.c.  */
95extern CORE_ADDR amd64fbsd_sigtramp_start_addr;
96extern CORE_ADDR amd64fbsd_sigtramp_end_addr;
97extern int amd64fbsd_sc_reg_offset[];
98
99#endif /* amd64-tdep.h */
100