1 /* Native-dependent code for FreeBSD/sparc64.
3 Copyright (C) 2003-2005, 2007-2012 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 3 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, see <http://www.gnu.org/licenses/>. */
25 #include "sparc64-tdep.h"
26 #include "sparc-nat.h"
29 /* Support for debugging kernel virtual memory images. */
31 #include <sys/types.h>
32 #include <machine/pcb.h>
37 sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
39 /* The following is true for FreeBSD 5.4:
41 The pcb contains %sp and %pc. Since the register windows are
42 explicitly flushed, we can find the `local' and `in' registers on
45 /* The stack pointer shouldn't be zero. */
49 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
50 regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
52 /* Synthesize %npc. */
54 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM, &pcb->pcb_pc);
56 /* Read `local' and `in' registers from the stack. */
57 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
63 /* Provide a prototype to silence -Wmissing-prototypes. */
64 void _initialize_sparc64fbsd_nat (void);
67 _initialize_sparc64fbsd_nat (void)
71 /* Add some extra features to the generic SPARC target. */
73 t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
74 t->to_find_memory_regions = fbsd_find_memory_regions;
75 t->to_make_corefile_notes = fbsd_make_corefile_notes;
78 sparc_gregset = &sparc64fbsd_gregset;
80 /* Support debugging kernel virtual memory images. */
81 bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);