1 /* Native-dependent code for Motorola m68k's running NetBSD, for GDB.
2 Copyright 1988, 1989, 1991, 1992, 1994, 1996 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. */
21 #include <sys/types.h>
22 #include <sys/ptrace.h>
23 #include <machine/reg.h>
24 #include <machine/frame.h>
30 fetch_inferior_registers (regno
)
33 struct reg inferior_registers
;
34 struct fpreg inferior_fp_registers
;
36 ptrace (PT_GETREGS
, inferior_pid
,
37 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
38 memcpy (®isters
[REGISTER_BYTE (0)], &inferior_registers
,
39 sizeof (inferior_registers
));
41 ptrace (PT_GETFPREGS
, inferior_pid
,
42 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
43 memcpy (®isters
[REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
44 sizeof (inferior_fp_registers
));
50 store_inferior_registers (regno
)
53 struct reg inferior_registers
;
54 struct fpreg inferior_fp_registers
;
56 memcpy (&inferior_registers
, ®isters
[REGISTER_BYTE (0)],
57 sizeof (inferior_registers
));
58 ptrace (PT_SETREGS
, inferior_pid
,
59 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
61 memcpy (&inferior_fp_registers
, ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
62 sizeof (inferior_fp_registers
));
63 ptrace (PT_SETFPREGS
, inferior_pid
,
64 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
74 fetch_core_registers (core_reg_sect
, core_reg_size
, which
, ignore
)
76 unsigned core_reg_size
;
80 struct md_core
*core_reg
= (struct md_core
*) core_reg_sect
;
82 /* Integer registers */
83 memcpy (®isters
[REGISTER_BYTE (0)],
84 &core_reg
->intreg
, sizeof (struct reg
));
85 /* Floating point registers */
86 memcpy (®isters
[REGISTER_BYTE (FP0_REGNUM
)],
87 &core_reg
->freg
, sizeof (struct fpreg
));