1 /* Low level Alpha GNU/Linux interface, for GDB when running native.
2 Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
23 #include "linux-nat.h"
25 #include "alpha-tdep.h"
27 #include <sys/ptrace.h>
28 #include <alpha/ptrace.h>
30 #include <sys/procfs.h>
33 /* Given a pointer to either a gregset_t or fpregset_t, return a
34 pointer to the first register. */
35 #define ALPHA_REGSET_BASE(regsetp) ((long *) (regsetp))
37 /* Given a pointer to a gregset_t, locate the UNIQUE value. */
38 #define ALPHA_REGSET_UNIQUE(regsetp) ((long *)(regsetp) + 32)
40 /* The address of UNIQUE for ptrace. */
41 #define ALPHA_UNIQUE_PTRACE_ADDR 65
45 * See the comment in m68k-tdep.c regarding the utility of these functions.
49 supply_gregset (gdb_gregset_t *gregsetp)
51 long *regp = ALPHA_REGSET_BASE (gregsetp);
52 void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
54 /* PC is in slot 32. */
55 alpha_supply_int_regs (-1, regp, regp + 31, unique);
59 fill_gregset (gdb_gregset_t *gregsetp, int regno)
61 long *regp = ALPHA_REGSET_BASE (gregsetp);
62 void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
64 /* PC is in slot 32. */
65 alpha_fill_int_regs (regno, regp, regp + 31, unique);
69 * Now we do the same thing for floating-point registers.
70 * Again, see the comments in m68k-tdep.c.
74 supply_fpregset (gdb_fpregset_t *fpregsetp)
76 long *regp = ALPHA_REGSET_BASE (fpregsetp);
78 /* FPCR is in slot 32. */
79 alpha_supply_fp_regs (-1, regp, regp + 31);
83 fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
85 long *regp = ALPHA_REGSET_BASE (fpregsetp);
87 /* FPCR is in slot 32. */
88 alpha_fill_fp_regs (regno, regp, regp + 31);
93 alpha_linux_register_u_offset (int regno)
95 if (regno == PC_REGNUM)
97 if (regno == ALPHA_UNIQUE_REGNUM)
98 return ALPHA_UNIQUE_PTRACE_ADDR;
99 if (regno < FP0_REGNUM)
100 return GPR_BASE + regno;
102 return FPR_BASE + regno - FP0_REGNUM;
105 void _initialialize_alpha_linux_nat (void);
108 _initialize_alpha_linux_nat (void)
110 linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));