* sol-thread.c (GET_LWP, GET_THREAD, BUILD_LWP, BUILD_THREAD):
[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 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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. */
20
21 #include <sys/types.h>
22 #include <sys/ptrace.h>
23 #include <machine/reg.h>
24 #include <machine/frame.h>
25
26 #include "defs.h"
27 #include "inferior.h"
28
29 void
30 fetch_inferior_registers (regno)
31 int regno;
32 {
33 struct reg inferior_registers;
34 struct fpreg inferior_fp_registers;
35
36 ptrace (PT_GETREGS, inferior_pid,
37 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
38 memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
39 sizeof (inferior_registers));
40
41 ptrace (PT_GETFPREGS, inferior_pid,
42 (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
43 memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
44 sizeof (inferior_fp_registers));
45
46 registers_fetched ();
47 }
48
49 void
50 store_inferior_registers (regno)
51 int regno;
52 {
53 struct reg inferior_registers;
54 struct fpreg inferior_fp_registers;
55
56 memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
57 sizeof (inferior_registers));
58 ptrace (PT_SETREGS, inferior_pid,
59 (PTRACE_ARG3_TYPE) & inferior_registers, 0);
60
61 memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
62 sizeof (inferior_fp_registers));
63 ptrace (PT_SETFPREGS, inferior_pid,
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 (core_reg_sect, core_reg_size, which, ignore)
75 char *core_reg_sect;
76 unsigned core_reg_size;
77 int which;
78 CORE_ADDR ignore;
79 {
80 struct md_core *core_reg = (struct md_core *) core_reg_sect;
81
82 /* Integer registers */
83 memcpy (&registers[REGISTER_BYTE (0)],
84 &core_reg->intreg, sizeof (struct reg));
85 /* Floating point registers */
86 memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
87 &core_reg->freg, sizeof (struct fpreg));
88 }
89
90 /* Register that we are able to handle m68knbsd core file formats.
91 FIXME: is this really bfd_target_unknown_flavour? */
92
93 static struct core_fns m68knbsd_core_fns =
94 {
95 bfd_target_unknown_flavour, /* core_flavour */
96 default_check_format, /* check_format */
97 default_core_sniffer, /* core_sniffer */
98 fetch_core_registers, /* core_read_registers */
99 NULL /* next */
100 };
101
102 void
103 _initialize_m68knbsd_nat ()
104 {
105 add_core_fns (&m68knbsd_core_fns);
106 }
This page took 0.031934 seconds and 4 git commands to generate.