* rs6000-aix-tdep.c: Include "regcache.h", "regset.h", and
[deliverable/binutils-gdb.git] / gdb / alpha-linux-nat.c
CommitLineData
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"
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
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))
36
37/* Given a pointer to a gregset_t, locate the UNIQUE value. */
38#define ALPHA_REGSET_UNIQUE(regsetp) ((long *)(regsetp) + 32)
39
40/* The address of UNIQUE for ptrace. */
41#define ALPHA_UNIQUE_PTRACE_ADDR 65
42
43
44/*
45 * See the comment in m68k-tdep.c regarding the utility of these functions.
46 */
47
48void
49supply_gregset (gdb_gregset_t *gregsetp)
50{
51 long *regp = ALPHA_REGSET_BASE (gregsetp);
52 void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
53
54 /* PC is in slot 32. */
55 alpha_supply_int_regs (-1, regp, regp + 31, unique);
56}
57
58void
59fill_gregset (gdb_gregset_t *gregsetp, int regno)
60{
61 long *regp = ALPHA_REGSET_BASE (gregsetp);
62 void *unique = ALPHA_REGSET_UNIQUE (gregsetp);
63
64 /* PC is in slot 32. */
65 alpha_fill_int_regs (regno, regp, regp + 31, unique);
66}
67
68/*
69 * Now we do the same thing for floating-point registers.
70 * Again, see the comments in m68k-tdep.c.
71 */
72
73void
74supply_fpregset (gdb_fpregset_t *fpregsetp)
75{
76 long *regp = ALPHA_REGSET_BASE (fpregsetp);
77
78 /* FPCR is in slot 32. */
79 alpha_supply_fp_regs (-1, regp, regp + 31);
80}
81
82void
83fill_fpregset (gdb_fpregset_t *fpregsetp, int regno)
84{
85 long *regp = ALPHA_REGSET_BASE (fpregsetp);
86
87 /* FPCR is in slot 32. */
88 alpha_fill_fp_regs (regno, regp, regp + 31);
89}
90
910122bf
UW
91
92static CORE_ADDR
93alpha_linux_register_u_offset (int regno)
94{
b02f9d57
UW
95 if (regno == PC_REGNUM)
96 return PC;
97 if (regno == ALPHA_UNIQUE_REGNUM)
98 return ALPHA_UNIQUE_PTRACE_ADDR;
99 if (regno < FP0_REGNUM)
100 return GPR_BASE + regno;
101 else
102 return FPR_BASE + regno - FP0_REGNUM;
910122bf 103}
10d6c8cd
DJ
104
105void _initialialize_alpha_linux_nat (void);
106
107void
108_initialize_alpha_linux_nat (void)
109{
910122bf 110 linux_nat_add_target (linux_trad_target (alpha_linux_register_u_offset));
10d6c8cd 111}
This page took 0.091823 seconds and 4 git commands to generate.