1 /***********************************************************************
2 Copyright 2003-2006 Raza Microelectronics, Inc.(RMI).
3 This is a derived work from software originally provided by the external
4 entity identified below. The licensing terms and warranties specified in
5 the header of the original work apply to this derived work.
7 *****************************#RMI_1#**********************************/
8 /* Native-dependent code for MIPS systems running NetBSD.
9 Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
11 This file is part of GDB.
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. */
32 #include "mipsfbsd-tdep.h"
34 #include <sys/types.h>
35 #include <sys/ptrace.h>
36 #include <machine/reg.h>
38 /* Determine if PT_GETREGS fetches this register. */
40 getregs_supplies (int regno)
42 return ((regno) >= ZERO_REGNUM && (regno) <= PC_REGNUM);
46 fetch_inferior_registers (int regno)
48 if (regno == -1 || getregs_supplies (regno))
52 if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
53 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
54 perror_with_name ("Couldn't get registers");
56 mipsfbsd_supply_reg ((char *) ®s, regno);
61 if (regno == -1 || regno >= FP0_REGNUM)
65 if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
66 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
67 perror_with_name ("Couldn't get floating point status");
69 mipsfbsd_supply_fpreg ((char *) &fpregs, regno);
74 store_inferior_registers (int regno)
76 if (regno == -1 || getregs_supplies (regno))
80 if (ptrace (PT_GETREGS, PIDGET (inferior_ptid),
81 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
82 perror_with_name ("Couldn't get registers");
84 mipsfbsd_fill_reg ((char *) ®s, regno);
86 if (ptrace (PT_SETREGS, PIDGET (inferior_ptid),
87 (PTRACE_ARG3_TYPE) ®s, 0) == -1)
88 perror_with_name ("Couldn't write registers");
94 if (regno == -1 || regno >= FP0_REGNUM)
98 if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
99 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
100 perror_with_name ("Couldn't get floating point status");
102 mipsfbsd_fill_fpreg ((char *) &fpregs, regno);
104 if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
105 (PTRACE_ARG3_TYPE) &fpregs, 0) == -1)
106 perror_with_name ("Couldn't write floating point status");