* sparc64-tdep.h (sparc64_regnum): Fix comment.
[external/binutils.git] / gdb / sparc64fbsd-nat.c
1 /* Native-dependent code for FreeBSD/sparc64.
2
3    Copyright 2003 Free Software Foundation, Inc.
4
5    This file is part of GDB.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 59 Temple Place - Suite 330,
20    Boston, MA 02111-1307, USA.  */
21
22 #include "defs.h"
23
24 #include "sparc64-tdep.h"
25 #include "sparcbsd-nat.h"
26
27 /* Determine whether `struct reg' contains register REGNUM.  */
28
29 static int
30 sparc64fbsd_reg_supplies_p (int regnum)
31 {
32   /* Integer registers.  */
33   if ((regnum >= SPARC_G0_REGNUM && regnum <= SPARC_G7_REGNUM)
34       || (regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM)
35       || (regnum >= SPARC_L0_REGNUM && regnum <= SPARC_L7_REGNUM)
36       || (regnum >= SPARC_I0_REGNUM && regnum <= SPARC_I7_REGNUM))
37     return 1;
38
39   /* Control registers.  */
40   if (regnum == SPARC64_PC_REGNUM
41       || regnum == SPARC64_NPC_REGNUM
42       || regnum == SPARC64_STATE_REGNUM
43       || regnum == SPARC64_FPRS_REGNUM
44       || regnum == SPARC64_Y_REGNUM)
45     return 1;
46
47   return 0;
48 }
49
50 /* Determine whether `struct fpreg' contains register REGNUM.  */
51
52 static int
53 sparc64fbsd_fpreg_supplies_p (int regnum)
54 {
55   /* Floating-point registers.  */
56   if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
57       || (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM))
58     return 1;
59
60   /* Control registers.  */
61   if (regnum == SPARC64_FSR_REGNUM)
62     return 1;
63
64   return 0;
65 }
66
67 /* Provide a prototype to silence -Wmissing-prototypes.  */
68 void _initialize_sparc64fbsd_nat (void);
69
70 void
71 _initialize_sparc64fbsd_nat (void)
72 {
73   sparcbsd_supply_reg = sparc64fbsd_supply_reg;
74   sparcbsd_fill_reg = sparc64fbsd_fill_reg;
75   sparcbsd_supply_fpreg = sparc64fbsd_supply_fpreg;
76   sparcbsd_fill_fpreg = sparc64fbsd_fill_fpreg;
77
78   sparcbsd_reg_supplies_p = sparc64fbsd_reg_supplies_p;
79   sparcbsd_fpreg_supplies_p = sparc64fbsd_fpreg_supplies_p;
80 }