1 /* Native-dependent code for MIPS systems running NetBSD.
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 "mipsnbsd-tdep.h"
27 #include <sys/types.h>
28 #include <sys/ptrace.h>
29 #include <machine/reg.h>
31 /* Determine if PT_GETREGS fetches this register. */
33 getregs_supplies (int regno)
35 return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM);
39 fetch_inferior_registers (int regno)
41 if (regno == -1 || getregs_supplies (regno))
45 if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
46 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
47 perror_with_name ("Couldn't get registers");
49 mipsnbsd_supply_reg ((char *) ®s, regno);
54 if (regno == -1 || regno >= FP0_REGNUM)
58 if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
59 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
60 perror_with_name ("Couldn't get floating point status");
62 mipsnbsd_supply_fpreg ((char *) &fpregs, regno);
67 store_inferior_registers (int regno)
69 if (regno == -1 || getregs_supplies (regno))
73 if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
74 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
75 perror_with_name ("Couldn't get registers");
77 mipsnbsd_fill_reg ((char *) ®s, regno);
79 if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
80 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
81 perror_with_name ("Couldn't write registers");
87 if (regno == -1 || regno >= FP0_REGNUM)
91 if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
92 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
93 perror_with_name ("Couldn't get floating point status");
95 mipsnbsd_fill_fpreg ((char *) &fpregs, regno);
97 if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
98 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
99 perror_with_name ("Couldn't write floating point status");