*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / m68knbsd-nat.c
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.
4
5 This file is part of GDB.
6
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.
11
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.
16
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. */
21
22 #include "defs.h"
23 #include <sys/types.h>
24 #include <sys/ptrace.h>
25 #include <machine/reg.h>
26 #include <machine/frame.h>
27 #include "inferior.h"
28 #include "gdbcore.h"
29 #include "regcache.h"
30
31 void
32 fetch_inferior_registers (int regno)
33 {
34 struct reg inferior_registers;
35 struct fpreg inferior_fp_registers;
36
37 ptrace (PT_GETREGS, PIDGET (inferior_ptid),
38 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
39 memcpy (&deprecated_registers[REGISTER_BYTE (0)], &inferior_registers,
40 sizeof (inferior_registers));
41
42 ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
43 (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
44 memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
45 sizeof (inferior_fp_registers));
46
47 deprecated_registers_fetched ();
48 }
49
50 void
51 store_inferior_registers (int regno)
52 {
53 struct reg inferior_registers;
54 struct fpreg inferior_fp_registers;
55
56 memcpy (&inferior_registers, &deprecated_registers[REGISTER_BYTE (0)],
57 sizeof (inferior_registers));
58 ptrace (PT_SETREGS, PIDGET (inferior_ptid),
59 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
60
61 memcpy (&inferior_fp_registers, &deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
62 sizeof (inferior_fp_registers));
63 ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
64 (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
65 }
66
67 struct md_core
68 {
69 struct reg intreg;
70 struct fpreg freg;
71 };
72
73 static void
74 fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
75 CORE_ADDR ignore)
76 {
77 struct md_core *core_reg = (struct md_core *) core_reg_sect;
78
79 /* Integer registers */
80 memcpy (&deprecated_registers[REGISTER_BYTE (0)],
81 &core_reg->intreg, sizeof (struct reg));
82 /* Floating point registers */
83 memcpy (&deprecated_registers[REGISTER_BYTE (FP0_REGNUM)],
84 &core_reg->freg, sizeof (struct fpreg));
85 }
86
87 /* Register that we are able to handle m68knbsd core file formats.
88 FIXME: is this really bfd_target_unknown_flavour? */
89
90 static 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
99 void
100 _initialize_m68knbsd_nat (void)
101 {
102 add_core_fns (&m68knbsd_core_fns);
103 }
This page took 0.032884 seconds and 4 git commands to generate.