gdb/
[deliverable/binutils-gdb.git] / gdb / alpha-linux-nat.c
... / ...
CommitLineData
1/* Low level Alpha GNU/Linux interface, for GDB when running native.
2 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
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
9 the Free Software Foundation; either version 3 of the License, or
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
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "target.h"
22#include "regcache.h"
23#include "linux-nat.h"
24
25#include "alpha-tdep.h"
26
27#include <sys/ptrace.h>
28#include <alpha/ptrace.h>
29
30#include <sys/procfs.h>
31#include "gregset.h"
32
33/* The address of UNIQUE for ptrace. */
34#define ALPHA_UNIQUE_PTRACE_ADDR 65
35
36
37/* See the comment in m68k-tdep.c regarding the utility of these
38 functions. */
39
40void
41supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
42{
43 const long *regp = (const long *)gregsetp;
44
45 /* PC is in slot 32, UNIQUE is in slot 33. */
46 alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32);
47}
48
49void
50fill_gregset (const struct regcache *regcache,
51 gdb_gregset_t *gregsetp, int regno)
52{
53 long *regp = (long *)gregsetp;
54
55 /* PC is in slot 32, UNIQUE is in slot 33. */
56 alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32);
57}
58
59/* Now we do the same thing for floating-point registers.
60 Again, see the comments in m68k-tdep.c. */
61
62void
63supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
64{
65 const long *regp = (const long *)fpregsetp;
66
67 /* FPCR is in slot 32. */
68 alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
69}
70
71void
72fill_fpregset (const struct regcache *regcache,
73 gdb_fpregset_t *fpregsetp, int regno)
74{
75 long *regp = (long *)fpregsetp;
76
77 /* FPCR is in slot 32. */
78 alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
79}
80
81
82static CORE_ADDR
83alpha_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p)
84{
85 if (regno == gdbarch_pc_regnum (gdbarch))
86 return PC;
87 if (regno == ALPHA_UNIQUE_REGNUM)
88 return ALPHA_UNIQUE_PTRACE_ADDR;
89 if (regno < gdbarch_fp0_regnum (gdbarch))
90 return GPR_BASE + regno;
91 else
92 return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
93}
94
95void _initialialize_alpha_linux_nat (void);
96
97void
98_initialize_alpha_linux_nat (void)
99{
100 linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));
101}
This page took 0.02331 seconds and 4 git commands to generate.