Remove spurious gdb/ ...
[deliverable/binutils-gdb.git] / gdb / sparcnbsd-nat.c
1 /* Native-dependent code for NetBSD/sparc.
2
3 Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009
4 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 #include "defs.h"
22 #include "regcache.h"
23 #include "target.h"
24
25 #include "sparc-tdep.h"
26 #include "sparc-nat.h"
27
28 /* Support for debugging kernel virtual memory images. */
29
30 #include <sys/types.h>
31 #include <machine/pcb.h>
32
33 #include "bsd-kvm.h"
34
35 static int
36 sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
37 {
38 /* The following is true for NetBSD 1.6.2:
39
40 The pcb contains %sp, %pc, %psr and %wim. From this information
41 we reconstruct the register state as it would look when we just
42 returned from cpu_switch(). */
43
44 /* The stack pointer shouldn't be zero. */
45 if (pcb->pcb_sp == 0)
46 return 0;
47
48 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
49 regcache_raw_supply (regcache, SPARC_O7_REGNUM, &pcb->pcb_pc);
50 regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, &pcb->pcb_psr);
51 regcache_raw_supply (regcache, SPARC32_WIM_REGNUM, &pcb->pcb_wim);
52 regcache_raw_supply (regcache, SPARC32_PC_REGNUM, &pcb->pcb_pc);
53
54 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
55
56 return 1;
57 }
58 \f
59
60 /* Provide a prototype to silence -Wmissing-prototypes. */
61 void _initialize_sparcnbsd_nat (void);
62
63 void
64 _initialize_sparcnbsd_nat (void)
65 {
66 sparc_gregset = &sparc32nbsd_gregset;
67
68 /* We've got nothing to add to the generic SPARC target. */
69 add_target (sparc_target ());
70
71 /* Support debugging kernel virtual memory images. */
72 bsd_kvm_add_target (sparc32nbsd_supply_pcb);
73 }
This page took 0.031205 seconds and 4 git commands to generate.