]>
Commit | Line | Data |
---|---|---|
c906108c SS |
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 | ||
c5aa993b | 4 | This file is part of GDB. |
c906108c | 5 | |
c5aa993b JM |
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. | |
c906108c | 10 | |
c5aa993b JM |
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. | |
c906108c | 15 | |
c5aa993b JM |
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. */ | |
c906108c SS |
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 | |
c5aa993b | 30 | fetch_inferior_registers (regno) |
c906108c SS |
31 | int regno; |
32 | { | |
33 | struct reg inferior_registers; | |
34 | struct fpreg inferior_fp_registers; | |
35 | ||
c5aa993b JM |
36 | ptrace (PT_GETREGS, inferior_pid, |
37 | (PTRACE_ARG3_TYPE) & inferior_registers, 0); | |
38 | memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers, | |
39 | sizeof (inferior_registers)); | |
c906108c | 40 | |
c5aa993b JM |
41 | ptrace (PT_GETFPREGS, inferior_pid, |
42 | (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); | |
43 | memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers, | |
44 | sizeof (inferior_fp_registers)); | |
c906108c SS |
45 | |
46 | registers_fetched (); | |
47 | } | |
48 | ||
49 | void | |
c5aa993b | 50 | store_inferior_registers (regno) |
c906108c SS |
51 | int regno; |
52 | { | |
53 | struct reg inferior_registers; | |
54 | struct fpreg inferior_fp_registers; | |
55 | ||
56 | memcpy (&inferior_registers, ®isters[REGISTER_BYTE (0)], | |
c5aa993b JM |
57 | sizeof (inferior_registers)); |
58 | ptrace (PT_SETREGS, inferior_pid, | |
59 | (PTRACE_ARG3_TYPE) & inferior_registers, 0); | |
c906108c SS |
60 | |
61 | memcpy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)], | |
c5aa993b JM |
62 | sizeof (inferior_fp_registers)); |
63 | ptrace (PT_SETFPREGS, inferior_pid, | |
64 | (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0); | |
c906108c SS |
65 | } |
66 | ||
c5aa993b JM |
67 | struct md_core |
68 | { | |
69 | struct reg intreg; | |
c906108c SS |
70 | struct fpreg freg; |
71 | }; | |
72 | ||
73 | 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 | { | |
c5aa993b JM |
80 | struct md_core *core_reg = (struct md_core *) core_reg_sect; |
81 | ||
c906108c | 82 | /* Integer registers */ |
c5aa993b JM |
83 | memcpy (®isters[REGISTER_BYTE (0)], |
84 | &core_reg->intreg, sizeof (struct reg)); | |
c906108c | 85 | /* Floating point registers */ |
c5aa993b JM |
86 | memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], |
87 | &core_reg->freg, sizeof (struct fpreg)); | |
c906108c | 88 | } |