This commit was generated by cvs2svn to track changes on a CVS vendor
[deliverable/binutils-gdb.git] / gdb / alphabsd-tdep.c
1 /* Common target dependent code for GDB on Alpha systems running BSD.
2 Copyright 2000, 2001, 2002 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., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21 #include "defs.h"
22 #include "regcache.h"
23
24 #include "alpha-tdep.h"
25 #include "alphabsd-tdep.h"
26
27 /* Number of general-purpose registers. */
28 #define NUM_GREGS 32
29
30 /* Number of floating-point registers. */
31 #define NUM_FPREGS 31
32
33 /* Conviently, GDB uses the same register numbering as the
34 ptrace register structure used by BSD on Alpha. */
35
36 void
37 alphabsd_supply_reg (char *regs, int regno)
38 {
39 int i;
40
41 for (i = 0; i < NUM_GREGS; i++)
42 {
43 if (i == regno || regno == -1)
44 {
45 if (CANNOT_FETCH_REGISTER (i))
46 supply_register (i, NULL);
47 else
48 supply_register (i, regs + (i * 8));
49 }
50 }
51
52 /* The PC travels in the ZERO slot. */
53 if (regno == PC_REGNUM || regno == -1)
54 supply_register (PC_REGNUM, regs + (31 * 8));
55 }
56
57 void
58 alphabsd_fill_reg (char *regs, int regno)
59 {
60 int i;
61
62 for (i = 0; i < NUM_GREGS; i++)
63 if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
64 regcache_collect (i, regs + (i * 8));
65
66 /* The PC travels in the ZERO slot. */
67 if (regno == PC_REGNUM || regno == -1)
68 regcache_collect (PC_REGNUM, regs + (31 * 8));
69 }
70
71 void
72 alphabsd_supply_fpreg (char *fpregs, int regno)
73 {
74 int i;
75
76 for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
77 {
78 if (i == regno || regno == -1)
79 {
80 if (CANNOT_FETCH_REGISTER (i))
81 supply_register (i, NULL);
82 else
83 supply_register (i, fpregs + ((i - FP0_REGNUM) * 8));
84 }
85 }
86
87 if (regno == ALPHA_FPCR_REGNUM || regno == -1)
88 supply_register (ALPHA_FPCR_REGNUM, fpregs + (32 * 8));
89 }
90
91 void
92 alphabsd_fill_fpreg (char *fpregs, int regno)
93 {
94 int i;
95
96 for (i = FP0_REGNUM; i < FP0_REGNUM + NUM_FPREGS; i++)
97 if ((regno == i || regno == -1) && ! CANNOT_STORE_REGISTER (i))
98 regcache_collect (i, fpregs + ((i - FP0_REGNUM) * 8));
99
100 if (regno == ALPHA_FPCR_REGNUM || regno == -1)
101 regcache_collect (ALPHA_FPCR_REGNUM, fpregs + (32 * 8));
102 }
This page took 0.04077 seconds and 5 git commands to generate.