]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/m68knbsd-nat.c
Initial creation of sourceware repository
[thirdparty/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, Boston, MA 02111-1307, USA. */
19
20 #include <sys/types.h>
21 #include <sys/ptrace.h>
22 #include <machine/reg.h>
23 #include <machine/frame.h>
24
25 #include "defs.h"
26 #include "inferior.h"
27
28 void
29 fetch_inferior_registers(regno)
30 int regno;
31 {
32 struct reg inferior_registers;
33 struct fpreg inferior_fp_registers;
34
35 ptrace (PT_GETREGS, inferior_pid,
36 (PTRACE_ARG3_TYPE) &inferior_registers, 0);
37 memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
38 sizeof(inferior_registers));
39
40 ptrace (PT_GETFPREGS, inferior_pid,
41 (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
42 memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
43 sizeof(inferior_fp_registers));
44
45 registers_fetched ();
46 }
47
48 void
49 store_inferior_registers(regno)
50 int regno;
51 {
52 struct reg inferior_registers;
53 struct fpreg inferior_fp_registers;
54
55 memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
56 sizeof(inferior_registers));
57 ptrace (PT_SETREGS, inferior_pid,
58 (PTRACE_ARG3_TYPE) &inferior_registers, 0);
59
60 memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
61 sizeof(inferior_fp_registers));
62 ptrace (PT_SETFPREGS, inferior_pid,
63 (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
64 }
65
66 struct md_core {
67 struct reg intreg;
68 struct fpreg freg;
69 };
70
71 void
72 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
73 char *core_reg_sect;
74 unsigned core_reg_size;
75 int which;
76 CORE_ADDR ignore;
77 {
78 struct md_core *core_reg = (struct md_core *)core_reg_sect;
79
80 /* Integer registers */
81 memcpy(&registers[REGISTER_BYTE (0)],
82 &core_reg->intreg, sizeof(struct reg));
83 /* Floating point registers */
84 memcpy(&registers[REGISTER_BYTE (FP0_REGNUM)],
85 &core_reg->freg, sizeof(struct fpreg));
86 }