]>
Commit | Line | Data |
---|---|---|
10d6c8cd | 1 | /* Low level Alpha GNU/Linux interface, for GDB when running native. |
6aba47ca | 2 | Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. |
10d6c8cd DJ |
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 | |
197e01b6 EZ |
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. */ | |
10d6c8cd DJ |
20 | |
21 | #include "defs.h" | |
22 | #include "target.h" | |
390c1522 | 23 | #include "regcache.h" |
10d6c8cd | 24 | #include "linux-nat.h" |
b02f9d57 UW |
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 | ||
b02f9d57 UW |
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 | |
7f7fe91e | 43 | supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp) |
b02f9d57 | 44 | { |
7f7fe91e | 45 | const long *regp = (const long *)gregsetp; |
b02f9d57 | 46 | |
efc72ef5 | 47 | /* PC is in slot 32, UNIQUE is in slot 33. */ |
7f7fe91e | 48 | alpha_supply_int_regs (regcache, -1, regp, regp + 31, regp + 32); |
b02f9d57 UW |
49 | } |
50 | ||
51 | void | |
7f7fe91e UW |
52 | fill_gregset (const struct regcache *regcache, |
53 | gdb_gregset_t *gregsetp, int regno) | |
b02f9d57 | 54 | { |
efc72ef5 | 55 | long *regp = (long *)gregsetp; |
b02f9d57 | 56 | |
efc72ef5 | 57 | /* PC is in slot 32, UNIQUE is in slot 33. */ |
7f7fe91e | 58 | alpha_fill_int_regs (regcache, regno, regp, regp + 31, regp + 32); |
b02f9d57 UW |
59 | } |
60 | ||
61 | /* | |
62 | * Now we do the same thing for floating-point registers. | |
63 | * Again, see the comments in m68k-tdep.c. | |
64 | */ | |
65 | ||
66 | void | |
7f7fe91e | 67 | supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp) |
b02f9d57 | 68 | { |
7f7fe91e | 69 | const long *regp = (const long *)fpregsetp; |
b02f9d57 UW |
70 | |
71 | /* FPCR is in slot 32. */ | |
7f7fe91e | 72 | alpha_supply_fp_regs (regcache, -1, regp, regp + 31); |
b02f9d57 UW |
73 | } |
74 | ||
75 | void | |
7f7fe91e UW |
76 | fill_fpregset (const struct regcache *regcache, |
77 | gdb_fpregset_t *fpregsetp, int regno) | |
b02f9d57 | 78 | { |
efc72ef5 | 79 | long *regp = (long *)fpregsetp; |
b02f9d57 UW |
80 | |
81 | /* FPCR is in slot 32. */ | |
7f7fe91e | 82 | alpha_fill_fp_regs (regcache, regno, regp, regp + 31); |
b02f9d57 UW |
83 | } |
84 | ||
910122bf UW |
85 | |
86 | static CORE_ADDR | |
87 | alpha_linux_register_u_offset (int regno) | |
88 | { | |
b02f9d57 UW |
89 | if (regno == PC_REGNUM) |
90 | return PC; | |
91 | if (regno == ALPHA_UNIQUE_REGNUM) | |
92 | return ALPHA_UNIQUE_PTRACE_ADDR; | |
93 | if (regno < FP0_REGNUM) | |
94 | return GPR_BASE + regno; | |
95 | else | |
96 | return FPR_BASE + regno - FP0_REGNUM; | |
910122bf | 97 | } |
10d6c8cd DJ |
98 | |
99 | void _initialialize_alpha_linux_nat (void); | |
100 | ||
101 | void | |
102 | _initialize_alpha_linux_nat (void) | |
103 | { | |
910122bf | 104 | linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset)); |
10d6c8cd | 105 | } |