1 /* Native-dependent code for Alpha BSD's.
2 Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
25 #include "alpha-tdep.h"
26 #include "alphabsd-tdep.h"
28 #include <sys/types.h>
29 #include <sys/ptrace.h>
30 #include <machine/reg.h>
32 #ifdef HAVE_SYS_PROCFS_H
33 #include <sys/procfs.h>
36 #ifndef HAVE_GREGSET_T
37 typedef struct reg gregset_t
;
40 #ifndef HAVE_FPREGSET_T
41 typedef struct fpreg fpregset_t
;
46 /* Provide *regset() wrappers around the generic Alpha BSD register
47 supply/fill routines. */
50 supply_gregset (gregset_t
*gregsetp
)
52 alphabsd_supply_reg ((char *) gregsetp
, -1);
56 fill_gregset (gregset_t
*gregsetp
, int regno
)
58 alphabsd_fill_reg ((char *) gregsetp
, regno
);
62 supply_fpregset (fpregset_t
*fpregsetp
)
64 alphabsd_supply_fpreg ((char *) fpregsetp
, -1);
68 fill_fpregset (fpregset_t
*fpregsetp
, int regno
)
70 alphabsd_fill_fpreg ((char *) fpregsetp
, regno
);
73 /* Determine if PT_GETREGS fetches this register. */
76 getregs_supplies (int regno
)
78 return ((regno
>= ALPHA_V0_REGNUM
&& regno
<= ALPHA_ZERO_REGNUM
)
79 || regno
>= PC_REGNUM
);
83 /* Fetch register REGNO from the inferior. If REGNO is -1, do this
84 for all registers (including the floating point registers). */
87 fetch_inferior_registers (int regno
)
89 if (regno
== -1 || getregs_supplies (regno
))
93 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
94 (PTRACE_ARG3_TYPE
) &gregs
, 0) == -1)
95 perror_with_name ("Couldn't get registers");
97 alphabsd_supply_reg ((char *) &gregs
, regno
);
102 if (regno
== -1 || regno
>= FP0_REGNUM
)
106 if (ptrace (PT_GETFPREGS
, PIDGET (inferior_ptid
),
107 (PTRACE_ARG3_TYPE
) &fpregs
, 0) == -1)
108 perror_with_name ("Couldn't get floating point status");
110 alphabsd_supply_fpreg ((char *) &fpregs
, regno
);
114 /* Store register REGNO back into the inferior. If REGNO is -1, do
115 this for all registers (including the floating point registers). */
118 store_inferior_registers (int regno
)
120 if (regno
== -1 || getregs_supplies (regno
))
123 if (ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
124 (PTRACE_ARG3_TYPE
) &gregs
, 0) == -1)
125 perror_with_name ("Couldn't get registers");
127 alphabsd_fill_reg ((char *) &gregs
, regno
);
129 if (ptrace (PT_SETREGS
, PIDGET (inferior_ptid
),
130 (PTRACE_ARG3_TYPE
) &gregs
, 0) == -1)
131 perror_with_name ("Couldn't write registers");
137 if (regno
== -1 || regno
>= FP0_REGNUM
)
141 if (ptrace (PT_GETFPREGS
, PIDGET (inferior_ptid
),
142 (PTRACE_ARG3_TYPE
) &fpregs
, 0) == -1)
143 perror_with_name ("Couldn't get floating point status");
145 alphabsd_fill_fpreg ((char *) &fpregs
, regno
);
147 if (ptrace (PT_SETFPREGS
, PIDGET (inferior_ptid
),
148 (PTRACE_ARG3_TYPE
) &fpregs
, 0) == -1)
149 perror_with_name ("Couldn't write floating point status");
This page took 0.032574 seconds and 4 git commands to generate.