]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/alpha-linux-nat.c
* win32-low.c (win32_add_one_solib): If the dll name is
[thirdparty/binutils-gdb.git] / gdb / alpha-linux-nat.c
1 /* Low level Alpha GNU/Linux interface, for GDB when running native.
2 Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #include "defs.h"
20 #include "target.h"
21 #include "regcache.h"
22 #include "linux-nat.h"
23
24 #include "alpha-tdep.h"
25
26 #include <sys/ptrace.h>
27 #include <alpha/ptrace.h>
28
29 #include <sys/procfs.h>
30 #include "gregset.h"
31
32 /* The address of UNIQUE for ptrace. */
33 #define ALPHA_UNIQUE_PTRACE_ADDR 65
34
35
36 /*
37 * See the comment in m68k-tdep.c regarding the utility of these functions.
38 */
39
40 void
41 supply_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
49 void
50 fill_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 /*
60 * Now we do the same thing for floating-point registers.
61 * Again, see the comments in m68k-tdep.c.
62 */
63
64 void
65 supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
66 {
67 const long *regp = (const long *)fpregsetp;
68
69 /* FPCR is in slot 32. */
70 alpha_supply_fp_regs (regcache, -1, regp, regp + 31);
71 }
72
73 void
74 fill_fpregset (const struct regcache *regcache,
75 gdb_fpregset_t *fpregsetp, int regno)
76 {
77 long *regp = (long *)fpregsetp;
78
79 /* FPCR is in slot 32. */
80 alpha_fill_fp_regs (regcache, regno, regp, regp + 31);
81 }
82
83
84 static CORE_ADDR
85 alpha_linux_register_u_offset (struct gdbarch *gdbarch, int regno, int store_p)
86 {
87 if (regno == gdbarch_pc_regnum (gdbarch))
88 return PC;
89 if (regno == ALPHA_UNIQUE_REGNUM)
90 return ALPHA_UNIQUE_PTRACE_ADDR;
91 if (regno < gdbarch_fp0_regnum (gdbarch))
92 return GPR_BASE + regno;
93 else
94 return FPR_BASE + regno - gdbarch_fp0_regnum (gdbarch);
95 }
96
97 void _initialialize_alpha_linux_nat (void);
98
99 void
100 _initialize_alpha_linux_nat (void)
101 {
102 linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));
103 }