]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/sparc64fbsd-nat.c
Updated copyright notices for most files.
[thirdparty/binutils-gdb.git] / gdb / sparc64fbsd-nat.c
CommitLineData
8b39fe56
MK
1/* Native-dependent code for FreeBSD/sparc64.
2
0fb0cc75
JB
3 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009
4 Free Software Foundation, Inc.
8b39fe56
MK
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
8b39fe56
MK
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/>. */
8b39fe56
MK
20
21#include "defs.h"
37191c9c 22#include "regcache.h"
936df4b3 23#include "target.h"
8b39fe56 24
ca5807d9 25#include "fbsd-nat.h"
8b39fe56 26#include "sparc64-tdep.h"
386c036b 27#include "sparc-nat.h"
37191c9c
MK
28\f
29
30/* Support for debugging kernel virtual memory images. */
31
32#include <sys/types.h>
33#include <machine/pcb.h>
34
35#include "bsd-kvm.h"
36
37static int
38sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
39{
40 /* The following is true for FreeBSD 5.4:
41
42 The pcb contains %sp and %pc. Since the register windows are
43 explicitly flushed, we can find the `local' and `in' registers on
44 the stack. */
45
46 /* The stack pointer shouldn't be zero. */
47 if (pcb->pcb_sp == 0)
48 return 0;
49
50 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
51 regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
52
53 /* Synthesize %npc. */
54 pcb->pcb_pc += 4;
55 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM, &pcb->pcb_pc);
56
57 /* Read `local' and `in' registers from the stack. */
58 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
59
60 return 1;
61}
62\f
8b39fe56
MK
63
64/* Provide a prototype to silence -Wmissing-prototypes. */
65void _initialize_sparc64fbsd_nat (void);
66
67void
68_initialize_sparc64fbsd_nat (void)
69{
ca5807d9
MK
70 struct target_ops *t;
71
72 /* Add some extra features to the generic SPARC target. */
73 t = 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;
77 add_target (t);
f5ccf7a2 78
ca5807d9 79 sparc_gregset = &sparc64fbsd_gregset;
37191c9c
MK
80
81 /* Support debugging kernel virtual memory images. */
82 bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
8b39fe56 83}