]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/m68knbsd-nat.c
* alpha-nat.c (fetch_core_registers): Match Sep 4 gdbcore.h prototype
[thirdparty/binutils-gdb.git] / gdb / m68knbsd-nat.c
CommitLineData
b7f3b6d5
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
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, 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
28void
29fetch_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
48void
49store_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
d554e554
C
66struct md_core {
67 struct reg intreg;
68 struct fpreg freg;
69};
70
b7f3b6d5
C
71void
72fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
73 char *core_reg_sect;
74 unsigned core_reg_size;
75 int which;
948a9d92 76 CORE_ADDR ignore;
b7f3b6d5 77{
d554e554
C
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));
b7f3b6d5 86}