2001-12-17 Ben Harris <bjh21@netbsd.org>
[external/binutils.git] / gdb / armnbsd-nat.c
1 /* Native-dependent code for BSD Unix running on ARM's, for GDB.
2    Copyright 1988, 1989, 1991, 1992, 1994, 1996, 1999 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 "defs.h"
22
23 #ifdef FETCH_INFERIOR_REGISTERS
24 #include <sys/types.h>
25 #include <sys/ptrace.h>
26 #include <machine/reg.h>
27 #include <machine/frame.h>
28 #include "inferior.h"
29
30 void
31 fetch_inferior_registers (regno)
32      int regno;
33 {
34   struct reg inferior_registers;
35   struct fpreg inferior_fpregisters;
36
37   ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
38   memcpy (&registers[REGISTER_BYTE (0)], &inferior_registers,
39           16 * sizeof (unsigned int));
40   memcpy (&registers[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
41           sizeof (unsigned int));
42   ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters,
43           0);
44   memcpy (&registers[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
45           8 * sizeof (fp_reg_t));
46   memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
47           &inferior_fpregisters.fpr_fpsr, sizeof (unsigned int));
48   registers_fetched ();
49 }
50
51 void
52 store_inferior_registers (regno)
53      int regno;
54 {
55   struct reg inferior_registers;
56
57   memcpy (&inferior_registers, &registers[REGISTER_BYTE (0)],
58           16 * sizeof (unsigned int));
59   memcpy (&inferior_registers.r_cpsr, &registers[REGISTER_BYTE (PS_REGNUM)],
60           sizeof (unsigned int));
61   ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
62
63   /* XXX Set FP regs. */
64 }
65
66 struct md_core
67 {
68   struct reg intreg;
69   struct fpreg freg;
70 };
71
72 void
73 fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
74      char *core_reg_sect;
75      unsigned core_reg_size;
76      int which;
77      CORE_ADDR ignore;
78 {
79   struct md_core *core_reg = (struct md_core *) core_reg_sect;
80
81   /* integer registers */
82   memcpy (&registers[REGISTER_BYTE (0)], &core_reg->intreg,
83           sizeof (struct reg));
84   /* floating point registers */
85   /* XXX */
86 }
87
88 #else
89 #error Not FETCH_INFERIOR_REGISTERS 
90 #endif /* !FETCH_INFERIOR_REGISTERS */
91
92 int 
93 get_longjmp_target (CORE_ADDR *addr)
94 {
95   return 0;
96 }