1130803Smarcel/* Target-dependent definitions for AMD64.
2130803Smarcel
3130803Smarcel   Copyright 2001, 2003, 2004 Free Software Foundation, Inc.
4130803Smarcel   Contributed by Jiri Smid, SuSE Labs.
5130803Smarcel
6130803Smarcel   This file is part of GDB.
7130803Smarcel
8130803Smarcel   This program is free software; you can redistribute it and/or modify
9130803Smarcel   it under the terms of the GNU General Public License as published by
10130803Smarcel   the Free Software Foundation; either version 2 of the License, or
11130803Smarcel   (at your option) any later version.
12130803Smarcel
13130803Smarcel   This program is distributed in the hope that it will be useful,
14130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
15130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16130803Smarcel   GNU General Public License for more details.
17130803Smarcel
18130803Smarcel   You should have received a copy of the GNU General Public License
19130803Smarcel   along with this program; if not, write to the Free Software
20130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
21130803Smarcel   Boston, MA 02111-1307, USA.  */
22130803Smarcel
23130803Smarcel#ifndef AMD64_TDEP_H
24130803Smarcel#define AMD64_TDEP_H
25130803Smarcel
26130803Smarcelstruct gdbarch;
27130803Smarcelstruct frame_info;
28130803Smarcelstruct regcache;
29130803Smarcel
30130803Smarcel#include "i386-tdep.h"
31130803Smarcel
32130803Smarcel/* Register numbers of various important registers.  */
33130803Smarcel
34130803Smarcelenum amd64_regnum
35130803Smarcel{
36130803Smarcel  AMD64_RAX_REGNUM,		/* %rax */
37130803Smarcel  AMD64_RBX_REGNUM,		/* %rbx */
38130803Smarcel  AMD64_RCX_REGNUM,		/* %rcx */
39130803Smarcel  AMD64_RDX_REGNUM,		/* %rdx */
40130803Smarcel  AMD64_RSI_REGNUM,		/* %rsi */
41130803Smarcel  AMD64_RDI_REGNUM,		/* %rdi */
42130803Smarcel  AMD64_RBP_REGNUM,		/* %rbp */
43130803Smarcel  AMD64_RSP_REGNUM,		/* %rsp */
44130803Smarcel  AMD64_R8_REGNUM = 8,		/* %r8 */
45130803Smarcel  AMD64_R15_REGNUM = 15,	/* %r15 */
46130803Smarcel  AMD64_RIP_REGNUM,		/* %rip */
47130803Smarcel  AMD64_EFLAGS_REGNUM,		/* %eflags */
48130803Smarcel  AMD64_ST0_REGNUM = 24,	/* %st0 */
49130803Smarcel  AMD64_XMM0_REGNUM = 40,	/* %xmm0 */
50130803Smarcel  AMD64_XMM1_REGNUM		/* %xmm1 */
51130803Smarcel};
52130803Smarcel
53130803Smarcel/* Number of general purpose registers.  */
54130803Smarcel#define AMD64_NUM_GREGS		24
55130803Smarcel
56130803Smarcelextern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
57130803Smarcel
58130803Smarcel/* Fill register REGNUM in REGCACHE with the appropriate
59130803Smarcel   floating-point or SSE register value from *FXSAVE.  If REGNUM is
60130803Smarcel   -1, do this for all registers.  This function masks off any of the
61130803Smarcel   reserved bits in *FXSAVE.  */
62130803Smarcel
63130803Smarcelextern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
64130803Smarcel				 const void *fxsave);
65130803Smarcel
66130803Smarcel/* Fill register REGNUM (if it is a floating-point or SSE register) in
67130803Smarcel   *FXSAVE with the value from REGCACHE.  If REGNUM is -1, do this for
68130803Smarcel   all registers.  This function doesn't touch any of the reserved
69130803Smarcel   bits in *FXSAVE.  */
70130803Smarcel
71130803Smarcelextern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
72130803Smarcel				  void *fxsave);
73130803Smarcel
74130803Smarcel/* Fill register REGNUM (if it is a floating-point or SSE register) in
75130803Smarcel   *FXSAVE with the value in GDB's register cache.  If REGNUM is -1, do
76130803Smarcel   this for all registers.  This function doesn't touch any of the
77130803Smarcel   reserved bits in *FXSAVE.  */
78130803Smarcel
79130803Smarcelextern void amd64_fill_fxsave (char *fxsave, int regnum);
80130803Smarcel
81130803Smarcel
82130803Smarcel/* Variables exported from amd64nbsd-tdep.c.  */
83130803Smarcelextern int amd64nbsd_r_reg_offset[];
84130803Smarcel
85130803Smarcel/* Variables exported from amd64obsd-tdep.c.  */
86130803Smarcelextern int amd64obsd_r_reg_offset[];
87130803Smarcel
88130803Smarcel/* Variables exported from amd64fbsd-tdep.c.  */
89130803Smarcelextern CORE_ADDR amd64fbsd_sigtramp_start_addr;
90130803Smarcelextern CORE_ADDR amd64fbsd_sigtramp_end_addr;
91130803Smarcelextern int amd64fbsd_sc_reg_offset[];
92130803Smarcel
93130803Smarcel#endif /* amd64-tdep.h */
94