]>
Commit | Line | Data |
---|---|---|
386c036b MK |
1 | /* Native-dependent code for NetBSD/sparc. |
2 | ||
7b6bb8da | 3 | Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011 |
0fb0cc75 | 4 | Free Software Foundation, Inc. |
9ce5c36a JT |
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 | |
a9762ec7 | 10 | the Free Software Foundation; either version 3 of the License, or |
9ce5c36a JT |
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 | |
a9762ec7 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
9ce5c36a JT |
20 | |
21 | #include "defs.h" | |
a770d4ec | 22 | #include "regcache.h" |
1b9445c2 | 23 | #include "target.h" |
9ce5c36a | 24 | |
c139e7d9 | 25 | #include "sparc-tdep.h" |
386c036b | 26 | #include "sparc-nat.h" |
9ce5c36a | 27 | |
a770d4ec MK |
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 | ||
bd921882 | 40 | The pcb contains %sp, %pc, %psr and %wim. From this information |
a770d4ec MK |
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 | ||
386c036b MK |
60 | /* Provide a prototype to silence -Wmissing-prototypes. */ |
61 | void _initialize_sparcnbsd_nat (void); | |
9ce5c36a JT |
62 | |
63 | void | |
386c036b | 64 | _initialize_sparcnbsd_nat (void) |
9ce5c36a | 65 | { |
386c036b | 66 | sparc_gregset = &sparc32nbsd_gregset; |
a770d4ec | 67 | |
1b9445c2 MK |
68 | /* We've got nothing to add to the generic SPARC target. */ |
69 | add_target (sparc_target ()); | |
70 | ||
a770d4ec MK |
71 | /* Support debugging kernel virtual memory images. */ |
72 | bsd_kvm_add_target (sparc32nbsd_supply_pcb); | |
9ce5c36a | 73 | } |