gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / sparc-nbsd-nat.c
CommitLineData
386c036b
MK
1/* Native-dependent code for NetBSD/sparc.
2
b811d2c2 3 Copyright (C) 2002-2020 Free Software Foundation, Inc.
9ce5c36a
JT
4
5 This file is part of GDB.
6
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
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
9ce5c36a
JT
10 (at your option) any later version.
11
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.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
9ce5c36a
JT
19
20#include "defs.h"
a770d4ec 21#include "regcache.h"
1b9445c2 22#include "target.h"
9ce5c36a 23
c139e7d9 24#include "sparc-tdep.h"
386c036b 25#include "sparc-nat.h"
9ce5c36a 26
a770d4ec
MK
27/* Support for debugging kernel virtual memory images. */
28
29#include <sys/types.h>
30#include <machine/pcb.h>
31
32#include "bsd-kvm.h"
33
34static int
35sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
36{
37 /* The following is true for NetBSD 1.6.2:
38
bd921882 39 The pcb contains %sp, %pc, %psr and %wim. From this information
a770d4ec
MK
40 we reconstruct the register state as it would look when we just
41 returned from cpu_switch(). */
42
43 /* The stack pointer shouldn't be zero. */
44 if (pcb->pcb_sp == 0)
45 return 0;
46
73e1c03f
SM
47 regcache->raw_supply (SPARC_SP_REGNUM, &pcb->pcb_sp);
48 regcache->raw_supply (SPARC_O7_REGNUM, &pcb->pcb_pc);
49 regcache->raw_supply (SPARC32_PSR_REGNUM, &pcb->pcb_psr);
50 regcache->raw_supply (SPARC32_WIM_REGNUM, &pcb->pcb_wim);
51 regcache->raw_supply (SPARC32_PC_REGNUM, &pcb->pcb_pc);
a770d4ec
MK
52
53 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
54
55 return 1;
56}
9ce5c36a 57
f6ac5f3d
PA
58static sparc_target<inf_ptrace_target> the_sparc_nbsd_nat_target;
59
6c265988 60void _initialize_sparcnbsd_nat ();
9ce5c36a 61void
6c265988 62_initialize_sparcnbsd_nat ()
9ce5c36a 63{
b4fd25c9
AA
64 sparc_gregmap = &sparc32nbsd_gregmap;
65 sparc_fpregmap = &sparc32_bsd_fpregmap;
a770d4ec 66
d9f719f1 67 add_inf_child_target (&sparc_nbsd_nat_target);
1b9445c2 68
a770d4ec
MK
69 /* Support debugging kernel virtual memory images. */
70 bsd_kvm_add_target (sparc32nbsd_supply_pcb);
9ce5c36a 71}
This page took 1.889232 seconds and 4 git commands to generate.