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 (int regno
)
32 struct reg inferior_registers
;
33 struct fpreg inferior_fp_registers
;
35 ptrace (PT_GETREGS
, inferior_pid
,
36 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
37 memcpy (®isters
[REGISTER_BYTE (0)], &inferior_registers
,
38 sizeof (inferior_registers
));
40 ptrace (PT_GETFPREGS
, inferior_pid
,
41 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
42 memcpy (®isters
[REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
43 sizeof (inferior_fp_registers
));
49 store_inferior_registers (int regno
)
51 struct reg inferior_registers
;
52 struct fpreg inferior_fp_registers
;
54 memcpy (&inferior_registers
, ®isters
[REGISTER_BYTE (0)],
55 sizeof (inferior_registers
));
56 ptrace (PT_SETREGS
, inferior_pid
,
57 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
59 memcpy (&inferior_fp_registers
, ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
60 sizeof (inferior_fp_registers
));
61 ptrace (PT_SETFPREGS
, inferior_pid
,
62 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
72 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
75 struct md_core
*core_reg
= (struct md_core
*) core_reg_sect
;
77 /* Integer registers */
78 memcpy (®isters
[REGISTER_BYTE (0)],
79 &core_reg
->intreg
, sizeof (struct reg
));
80 /* Floating point registers */
81 memcpy (®isters
[REGISTER_BYTE (FP0_REGNUM
)],
82 &core_reg
->freg
, sizeof (struct fpreg
));
85 /* Register that we are able to handle m68knbsd core file formats.
86 FIXME: is this really bfd_target_unknown_flavour? */
88 static struct core_fns m68knbsd_core_fns
=
90 bfd_target_unknown_flavour
, /* core_flavour */
91 default_check_format
, /* check_format */
92 default_core_sniffer
, /* core_sniffer */
93 fetch_core_registers
, /* core_read_registers */
98 _initialize_m68knbsd_nat (void)
100 add_core_fns (&m68knbsd_core_fns
);