1 /* Native-dependent code for FreeBSD/sparc64.
3 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GDB.
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.
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.
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/>. */
26 #include "sparc64-tdep.h"
27 #include "sparc-nat.h"
30 /* Support for debugging kernel virtual memory images. */
32 #include <sys/types.h>
33 #include <machine/pcb.h>
38 sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
40 /* The following is true for FreeBSD 5.4:
42 The pcb contains %sp and %pc. Since the register windows are
43 explicitly flushed, we can find the `local' and `in' registers on
46 /* The stack pointer shouldn't be zero. */
50 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
51 regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
53 /* Synthesize %npc. */
55 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM, &pcb->pcb_pc);
57 /* Read `local' and `in' registers from the stack. */
58 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
64 /* Provide a prototype to silence -Wmissing-prototypes. */
65 void _initialize_sparc64fbsd_nat (void);
68 _initialize_sparc64fbsd_nat (void)
72 /* Add some extra features to the generic SPARC target. */
74 t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
75 t->to_find_memory_regions = fbsd_find_memory_regions;
76 t->to_make_corefile_notes = fbsd_make_corefile_notes;
79 sparc_gregset = &sparc64fbsd_gregset;
81 /* Support debugging kernel virtual memory images. */
82 bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);