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