1 |
578 |
markom |
/* Functions specific to running gdb native on IA-64 running AIX.
|
2 |
|
|
Copyright 2000, 2001 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 "inferior.h"
|
23 |
|
|
#include "target.h"
|
24 |
|
|
#include "gdbcore.h"
|
25 |
|
|
#include "regcache.h"
|
26 |
|
|
#include <sys/procfs.h>
|
27 |
|
|
|
28 |
|
|
#include "symtab.h"
|
29 |
|
|
#include "bfd.h"
|
30 |
|
|
#include "symfile.h"
|
31 |
|
|
#include "objfiles.h"
|
32 |
|
|
|
33 |
|
|
#include <sys/types.h>
|
34 |
|
|
#include <fcntl.h>
|
35 |
|
|
#include "gdb_stat.h"
|
36 |
|
|
|
37 |
|
|
void
|
38 |
|
|
supply_gregset (prgregset_t *gregsetp)
|
39 |
|
|
{
|
40 |
|
|
int regi;
|
41 |
|
|
|
42 |
|
|
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
|
43 |
|
|
{
|
44 |
|
|
supply_register (regi,
|
45 |
|
|
(char *) &(gregsetp->__gpr[regi - IA64_GR0_REGNUM]));
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
|
49 |
|
|
{
|
50 |
|
|
supply_register (regi,
|
51 |
|
|
(char *) &(gregsetp->__br[regi - IA64_BR0_REGNUM]));
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
supply_register (IA64_PSR_REGNUM, (char *) &(gregsetp->__psr));
|
55 |
|
|
supply_register (IA64_IP_REGNUM, (char *) &(gregsetp->__ip));
|
56 |
|
|
supply_register (IA64_CFM_REGNUM, (char *) &(gregsetp->__ifs));
|
57 |
|
|
supply_register (IA64_RSC_REGNUM, (char *) &(gregsetp->__rsc));
|
58 |
|
|
supply_register (IA64_BSP_REGNUM, (char *) &(gregsetp->__bsp));
|
59 |
|
|
supply_register (IA64_BSPSTORE_REGNUM, (char *) &(gregsetp->__bspstore));
|
60 |
|
|
supply_register (IA64_RNAT_REGNUM, (char *) &(gregsetp->__rnat));
|
61 |
|
|
supply_register (IA64_PFS_REGNUM, (char *) &(gregsetp->__pfs));
|
62 |
|
|
supply_register (IA64_UNAT_REGNUM, (char *) &(gregsetp->__unat));
|
63 |
|
|
supply_register (IA64_PR_REGNUM, (char *) &(gregsetp->__preds));
|
64 |
|
|
supply_register (IA64_CCV_REGNUM, (char *) &(gregsetp->__ccv));
|
65 |
|
|
supply_register (IA64_LC_REGNUM, (char *) &(gregsetp->__lc));
|
66 |
|
|
supply_register (IA64_EC_REGNUM, (char *) &(gregsetp->__ec));
|
67 |
|
|
/* FIXME: __nats */
|
68 |
|
|
supply_register (IA64_FPSR_REGNUM, (char *) &(gregsetp->__fpsr));
|
69 |
|
|
|
70 |
|
|
/* These (for the most part) are pseudo registers and are obtained
|
71 |
|
|
by other means. Those that aren't are already handled by the
|
72 |
|
|
code above. */
|
73 |
|
|
for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
|
74 |
|
|
register_valid[regi] = 1;
|
75 |
|
|
for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
|
76 |
|
|
register_valid[regi] = 1;
|
77 |
|
|
for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
|
78 |
|
|
register_valid[regi] = 1;
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
void
|
82 |
|
|
fill_gregset (prgregset_t *gregsetp, int regno)
|
83 |
|
|
{
|
84 |
|
|
int regi;
|
85 |
|
|
|
86 |
|
|
#define COPY_REG(_fld_,_regi_) \
|
87 |
|
|
if ((regno == -1) || regno == _regi_) \
|
88 |
|
|
memcpy (&(gregsetp->_fld_), ®isters[REGISTER_BYTE (_regi_)], \
|
89 |
|
|
REGISTER_RAW_SIZE (_regi_))
|
90 |
|
|
|
91 |
|
|
for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
|
92 |
|
|
{
|
93 |
|
|
COPY_REG (__gpr[regi - IA64_GR0_REGNUM], regi);
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
|
97 |
|
|
{
|
98 |
|
|
COPY_REG (__br[regi - IA64_BR0_REGNUM], regi);
|
99 |
|
|
}
|
100 |
|
|
COPY_REG (__psr, IA64_PSR_REGNUM);
|
101 |
|
|
COPY_REG (__ip, IA64_IP_REGNUM);
|
102 |
|
|
COPY_REG (__ifs, IA64_CFM_REGNUM);
|
103 |
|
|
COPY_REG (__rsc, IA64_RSC_REGNUM);
|
104 |
|
|
COPY_REG (__bsp, IA64_BSP_REGNUM);
|
105 |
|
|
|
106 |
|
|
/* Bad things happen if we don't update both bsp and bspstore at the
|
107 |
|
|
same time. */
|
108 |
|
|
if (regno == IA64_BSP_REGNUM || regno == -1)
|
109 |
|
|
{
|
110 |
|
|
memcpy (&(gregsetp->__bspstore),
|
111 |
|
|
®isters[REGISTER_BYTE (IA64_BSP_REGNUM)],
|
112 |
|
|
REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
|
113 |
|
|
memcpy (®isters[REGISTER_BYTE (IA64_BSPSTORE_REGNUM)],
|
114 |
|
|
®isters[REGISTER_BYTE (IA64_BSP_REGNUM)],
|
115 |
|
|
REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
#if 0
|
119 |
|
|
/* We never actually write to bspstore, or we'd have to do the same thing
|
120 |
|
|
here too. */
|
121 |
|
|
COPY_REG (__bspstore, IA64_BSPSTORE_REGNUM);
|
122 |
|
|
#endif
|
123 |
|
|
COPY_REG (__rnat, IA64_RNAT_REGNUM);
|
124 |
|
|
COPY_REG (__pfs, IA64_PFS_REGNUM);
|
125 |
|
|
COPY_REG (__unat, IA64_UNAT_REGNUM);
|
126 |
|
|
COPY_REG (__preds, IA64_PR_REGNUM);
|
127 |
|
|
COPY_REG (__ccv, IA64_CCV_REGNUM);
|
128 |
|
|
COPY_REG (__lc, IA64_LC_REGNUM);
|
129 |
|
|
COPY_REG (__ec, IA64_EC_REGNUM);
|
130 |
|
|
/* FIXME: __nats */
|
131 |
|
|
COPY_REG (__fpsr, IA64_FPSR_REGNUM);
|
132 |
|
|
#undef COPY_REG
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
void
|
136 |
|
|
supply_fpregset (prfpregset_t *fpregsetp)
|
137 |
|
|
{
|
138 |
|
|
register int regi;
|
139 |
|
|
|
140 |
|
|
for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
|
141 |
|
|
supply_register (regi,
|
142 |
|
|
(char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]));
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
void
|
146 |
|
|
fill_fpregset (prfpregset_t *fpregsetp, int regno)
|
147 |
|
|
{
|
148 |
|
|
int regi;
|
149 |
|
|
char *to;
|
150 |
|
|
char *from;
|
151 |
|
|
|
152 |
|
|
for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
|
153 |
|
|
{
|
154 |
|
|
if ((regno == -1) || (regno == regi))
|
155 |
|
|
{
|
156 |
|
|
from = (char *) ®isters[REGISTER_BYTE (regi)];
|
157 |
|
|
to = (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]);
|
158 |
|
|
memcpy (to, from, REGISTER_RAW_SIZE (regi));
|
159 |
|
|
}
|
160 |
|
|
}
|
161 |
|
|
}
|