* alpha-tdep.c (alpha_supply_int_regs, alpha_fill_int_regs,
[deliverable/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 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 2 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, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
20
21 #include "defs.h"
22 #include "target.h"
23 #include "regcache.h"
24 #include "linux-nat.h"
25
26 #include "alpha-tdep.h"
27
28 #include <sys/ptrace.h>
29 #include <alpha/ptrace.h>
30
31 #include <sys/procfs.h>
32 #include "gregset.h"
33
34 /* The address of UNIQUE for ptrace. */
35 #define ALPHA_UNIQUE_PTRACE_ADDR 65
36
37
38 /*
39 * See the comment in m68k-tdep.c regarding the utility of these functions.
40 */
41
42 void
43 supply_gregset (gdb_gregset_t *gregsetp)
44 {
45 long *regp = (long *)gregsetp;
46
47 /* PC is in slot 32, UNIQUE is in slot 33. */
48 alpha_supply_int_regs (current_regcache, -1, regp, regp + 31, regp + 32);
49 }
50
51 void
52 fill_gregset (gdb_gregset_t *gregsetp, int regno)
53 {
54 long *regp = (long *)gregsetp;
55
56 /* PC is in slot 32, UNIQUE is in slot 33. */
57 alpha_fill_int_regs (current_regcache, regno, regp, regp + 31, regp + 32);
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
65 void
66 supply_fpregset (gdb_fpregset_t *fpregsetp)
67 {
68 long *regp = (long *)fpregsetp;
69
70 /* FPCR is in slot 32. */
71 alpha_supply_fp_regs (current_regcache, -1, regp, regp + 31);
72 }
73
74 void
75 fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
76 {
77 long *regp = (long *)fpregsetp;
78
79 /* FPCR is in slot 32. */
80 alpha_fill_fp_regs (current_regcache, regno, regp, regp + 31);
81 }
82
83
84 static CORE_ADDR
85 alpha_linux_register_u_offset (int regno)
86 {
87 if (regno == PC_REGNUM)
88 return PC;
89 if (regno == ALPHA_UNIQUE_REGNUM)
90 return ALPHA_UNIQUE_PTRACE_ADDR;
91 if (regno < FP0_REGNUM)
92 return GPR_BASE + regno;
93 else
94 return FPR_BASE + regno - FP0_REGNUM;
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 }
This page took 0.032692 seconds and 5 git commands to generate.