No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / sparcnbsd-nat.c
blob470214da987261808bdeac80d555ca4faee8d6e4
1 /* Native-dependent code for NetBSD/sparc.
3 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #include "defs.h"
23 #include "regcache.h"
24 #include "target.h"
26 #include "nbsd-nat.h"
27 #include "sparc-tdep.h"
28 #include "sparc-nat.h"
30 #include "nbsd-nat.h"
32 /* Support for debugging kernel virtual memory images. */
34 #include <sys/types.h>
35 #include <machine/pcb.h>
37 #include "bsd-kvm.h"
39 static int
40 sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
42 /* The following is true for NetBSD 1.6.2:
44 The pcb contains %sp, %pc, %psr and %wim. From this information
45 we reconstruct the register state as it would look when we just
46 returned from cpu_switch(). */
48 /* The stack pointer shouldn't be zero. */
49 if (pcb->pcb_sp == 0)
50 return 0;
52 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
53 regcache_raw_supply (regcache, SPARC_O7_REGNUM, &pcb->pcb_pc);
54 regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, &pcb->pcb_psr);
55 regcache_raw_supply (regcache, SPARC32_WIM_REGNUM, &pcb->pcb_wim);
56 regcache_raw_supply (regcache, SPARC32_PC_REGNUM, &pcb->pcb_pc);
58 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
60 return 1;
64 /* Provide a prototype to silence -Wmissing-prototypes. */
65 void _initialize_sparcnbsd_nat (void);
67 void
68 _initialize_sparcnbsd_nat (void)
70 struct target_ops *t;
72 sparc_gregset = &sparc32nbsd_gregset;
74 /* Add some extra features to the generic SPARC target. */
75 t = sparc_target ();
76 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
77 add_target (t);
79 /* Support debugging kernel virtual memory images. */
80 bsd_kvm_add_target (sparc32nbsd_supply_pcb);