1 /* Native-dependent code for Motorola m68k's running NetBSD, for GDB.
2 Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #include <sys/types.h>
24 #include <sys/ptrace.h>
25 #include <machine/reg.h>
26 #include <machine/frame.h>
32 fetch_inferior_registers (int regno
)
34 struct reg inferior_registers
;
35 struct fpreg inferior_fp_registers
;
37 ptrace (PT_GETREGS
, PIDGET (inferior_ptid
),
38 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
39 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (0)], &inferior_registers
,
40 sizeof (inferior_registers
));
42 ptrace (PT_GETFPREGS
, PIDGET (inferior_ptid
),
43 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
44 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
45 sizeof (inferior_fp_registers
));
47 deprecated_registers_fetched ();
51 store_inferior_registers (int regno
)
53 struct reg inferior_registers
;
54 struct fpreg inferior_fp_registers
;
56 memcpy (&inferior_registers
, &deprecated_registers
[DEPRECATED_REGISTER_BYTE (0)],
57 sizeof (inferior_registers
));
58 ptrace (PT_SETREGS
, PIDGET (inferior_ptid
),
59 (PTRACE_ARG3_TYPE
) & inferior_registers
, 0);
61 memcpy (&inferior_fp_registers
, &deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)],
62 sizeof (inferior_fp_registers
));
63 ptrace (PT_SETFPREGS
, PIDGET (inferior_ptid
),
64 (PTRACE_ARG3_TYPE
) & inferior_fp_registers
, 0);
74 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
77 struct md_core
*core_reg
= (struct md_core
*) core_reg_sect
;
79 /* Integer registers */
80 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (0)],
81 &core_reg
->intreg
, sizeof (struct reg
));
82 /* Floating point registers */
83 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (FP0_REGNUM
)],
84 &core_reg
->freg
, sizeof (struct fpreg
));
87 /* Register that we are able to handle m68knbsd core file formats.
88 FIXME: is this really bfd_target_unknown_flavour? */
90 static struct core_fns m68knbsd_core_fns
=
92 bfd_target_unknown_flavour
, /* core_flavour */
93 default_check_format
, /* check_format */
94 default_core_sniffer
, /* core_sniffer */
95 fetch_core_registers
, /* core_read_registers */
100 _initialize_m68knbsd_nat (void)
102 add_core_fns (&m68knbsd_core_fns
);