1 /* Native-dependent code for Motorola m68k's running NetBSD, for GDB.
2 Copyright 1988, 1989, 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
20 #include <sys/types.h>
21 #include <sys/ptrace.h>
22 #include <machine/reg.h>
23 #include <machine/frame.h>
29 fetch_inferior_registers(regno)
32 struct reg inferior_registers;
33 struct fpreg inferior_fp_registers;
35 ptrace (PT_GETREGS, inferior_pid,
36 (PTRACE_ARG3_TYPE) &inferior_registers, 0);
37 memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers,
38 sizeof(inferior_registers));
40 ptrace (PT_GETFPREGS, inferior_pid,
41 (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
42 memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
43 sizeof(inferior_fp_registers));
49 store_inferior_registers(regno)
52 struct reg inferior_registers;
53 struct fpreg inferior_fp_registers;
55 memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)],
56 sizeof(inferior_registers));
57 ptrace (PT_SETREGS, inferior_pid,
58 (PTRACE_ARG3_TYPE) &inferior_registers, 0);
60 memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)],
61 sizeof(inferior_fp_registers));
62 ptrace (PT_SETFPREGS, inferior_pid,
63 (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
72 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
74 unsigned core_reg_size;
78 struct md_core *core_reg = (struct md_core *)core_reg_sect;
80 /* Integer registers */
81 memcpy(®isters[REGISTER_BYTE (0)],
82 &core_reg->intreg, sizeof(struct reg));
83 /* Floating point registers */
84 memcpy(®isters[REGISTER_BYTE (FP0_REGNUM)],
85 &core_reg->freg, sizeof(struct fpreg));