]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/m68knbsd-nat.c
2003-01-21 Andrew Cagney <ac131313@redhat.com>
[thirdparty/binutils-gdb.git] / gdb / m68knbsd-nat.c
CommitLineData
c906108c 1/* Native-dependent code for Motorola m68k's running NetBSD, for GDB.
b6ba6518
KB
2 Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001
3 Free Software Foundation, Inc.
c906108c 4
c5aa993b 5 This file is part of GDB.
c906108c 6
c5aa993b
JM
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.
c906108c 11
c5aa993b
JM
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.
c906108c 16
c5aa993b
JM
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. */
c906108c 21
6259c7e2 22#include "defs.h"
c906108c
SS
23#include <sys/types.h>
24#include <sys/ptrace.h>
25#include <machine/reg.h>
26#include <machine/frame.h>
c906108c 27#include "inferior.h"
6259c7e2 28#include "gdbcore.h"
4e052eda 29#include "regcache.h"
c906108c
SS
30
31void
fba45db2 32fetch_inferior_registers (int regno)
c906108c
SS
33{
34 struct reg inferior_registers;
35 struct fpreg inferior_fp_registers;
36
39f77062 37 ptrace (PT_GETREGS, PIDGET (inferior_ptid),
c5aa993b 38 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
524d7c18 39 memcpy (&deprecated_registers[REGISTER_BYTE (0)], &inferior_registers,
c5aa993b 40 sizeof (inferior_registers));
c906108c 41
39f77062 42 ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
c5aa993b 43 (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
524d7c18 44 memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
c5aa993b 45 sizeof (inferior_fp_registers));
c906108c 46
2b9e5f3f 47 deprecated_registers_fetched ();
c906108c
SS
48}
49
50void
fba45db2 51store_inferior_registers (int regno)
c906108c
SS
52{
53 struct reg inferior_registers;
54 struct fpreg inferior_fp_registers;
55
524d7c18 56 memcpy (&inferior_registers, &deprecated_registers[REGISTER_BYTE (0)],
c5aa993b 57 sizeof (inferior_registers));
39f77062 58 ptrace (PT_SETREGS, PIDGET (inferior_ptid),
c5aa993b 59 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
c906108c 60
524d7c18 61 memcpy (&inferior_fp_registers, &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
c5aa993b 62 sizeof (inferior_fp_registers));
39f77062 63 ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
c5aa993b 64 (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
c906108c
SS
65}
66
c5aa993b
JM
67struct md_core
68{
69 struct reg intreg;
c906108c
SS
70 struct fpreg freg;
71};
72
eafd4536 73static void
fba45db2
KB
74fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
75 CORE_ADDR ignore)
c906108c 76{
c5aa993b
JM
77 struct md_core *core_reg = (struct md_core *) core_reg_sect;
78
c906108c 79 /* Integer registers */
524d7c18 80 memcpy (&deprecated_registers[REGISTER_BYTE (0)],
c5aa993b 81 &core_reg->intreg, sizeof (struct reg));
c906108c 82 /* Floating point registers */
524d7c18 83 memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
c5aa993b 84 &core_reg->freg, sizeof (struct fpreg));
c906108c 85}
eafd4536
C
86
87/* Register that we are able to handle m68knbsd core file formats.
88 FIXME: is this really bfd_target_unknown_flavour? */
89
90static struct core_fns m68knbsd_core_fns =
91{
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 */
96 NULL /* next */
97};
98
99void
fba45db2 100_initialize_m68knbsd_nat (void)
eafd4536
C
101{
102 add_core_fns (&m68knbsd_core_fns);
103}