* blockframe.c (inside_main_func): No longer use symbol_lookup()
[deliverable/binutils-gdb.git] / gdb / ia64-aix-nat.c
CommitLineData
69517000
AC
1/* Low level interface to IA-64 running AIX for GDB, the GNU debugger.
2
3 Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
d7fa2ae2
KB
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22#include "defs.h"
23#include "inferior.h"
24#include "target.h"
25#include "gdbcore.h"
4e052eda 26#include "regcache.h"
d7fa2ae2
KB
27#include <sys/procfs.h>
28
29#include "symtab.h"
30#include "bfd.h"
31#include "symfile.h"
32#include "objfiles.h"
33
34#include <sys/types.h>
35#include <fcntl.h>
36#include "gdb_stat.h"
37
38void
39supply_gregset (prgregset_t *gregsetp)
40{
41 int regi;
42
43 for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
44 {
45 supply_register (regi,
46 (char *) &(gregsetp->__gpr[regi - IA64_GR0_REGNUM]));
47 }
48
49 for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
50 {
51 supply_register (regi,
52 (char *) &(gregsetp->__br[regi - IA64_BR0_REGNUM]));
53 }
54
55 supply_register (IA64_PSR_REGNUM, (char *) &(gregsetp->__psr));
56 supply_register (IA64_IP_REGNUM, (char *) &(gregsetp->__ip));
57 supply_register (IA64_CFM_REGNUM, (char *) &(gregsetp->__ifs));
58 supply_register (IA64_RSC_REGNUM, (char *) &(gregsetp->__rsc));
59 supply_register (IA64_BSP_REGNUM, (char *) &(gregsetp->__bsp));
60 supply_register (IA64_BSPSTORE_REGNUM, (char *) &(gregsetp->__bspstore));
61 supply_register (IA64_RNAT_REGNUM, (char *) &(gregsetp->__rnat));
62 supply_register (IA64_PFS_REGNUM, (char *) &(gregsetp->__pfs));
63 supply_register (IA64_UNAT_REGNUM, (char *) &(gregsetp->__unat));
64 supply_register (IA64_PR_REGNUM, (char *) &(gregsetp->__preds));
65 supply_register (IA64_CCV_REGNUM, (char *) &(gregsetp->__ccv));
66 supply_register (IA64_LC_REGNUM, (char *) &(gregsetp->__lc));
67 supply_register (IA64_EC_REGNUM, (char *) &(gregsetp->__ec));
68 /* FIXME: __nats */
69 supply_register (IA64_FPSR_REGNUM, (char *) &(gregsetp->__fpsr));
70
71 /* These (for the most part) are pseudo registers and are obtained
72 by other means. Those that aren't are already handled by the
73 code above. */
74 for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
8262ee23 75 deprecated_register_valid[regi] = 1;
d7fa2ae2 76 for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
8262ee23 77 deprecated_register_valid[regi] = 1;
d7fa2ae2 78 for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
8262ee23 79 deprecated_register_valid[regi] = 1;
d7fa2ae2
KB
80}
81
82void
83fill_gregset (prgregset_t *gregsetp, int regno)
84{
85 int regi;
86
87#define COPY_REG(_fld_,_regi_) \
88 if ((regno == -1) || regno == _regi_) \
62700349 89 memcpy (&(gregsetp->_fld_), &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \
12c266ea 90 DEPRECATED_REGISTER_RAW_SIZE (_regi_))
d7fa2ae2
KB
91
92 for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
93 {
94 COPY_REG (__gpr[regi - IA64_GR0_REGNUM], regi);
95 }
96
97 for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
98 {
99 COPY_REG (__br[regi - IA64_BR0_REGNUM], regi);
100 }
101 COPY_REG (__psr, IA64_PSR_REGNUM);
102 COPY_REG (__ip, IA64_IP_REGNUM);
103 COPY_REG (__ifs, IA64_CFM_REGNUM);
104 COPY_REG (__rsc, IA64_RSC_REGNUM);
105 COPY_REG (__bsp, IA64_BSP_REGNUM);
106
107 /* Bad things happen if we don't update both bsp and bspstore at the
108 same time. */
109 if (regno == IA64_BSP_REGNUM || regno == -1)
110 {
111 memcpy (&(gregsetp->__bspstore),
62700349 112 &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)],
12c266ea 113 DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
62700349
AC
114 memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSPSTORE_REGNUM)],
115 &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)],
12c266ea 116 DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
d7fa2ae2
KB
117 }
118
119#if 0
120 /* We never actually write to bspstore, or we'd have to do the same thing
121 here too. */
122 COPY_REG (__bspstore, IA64_BSPSTORE_REGNUM);
123#endif
124 COPY_REG (__rnat, IA64_RNAT_REGNUM);
125 COPY_REG (__pfs, IA64_PFS_REGNUM);
126 COPY_REG (__unat, IA64_UNAT_REGNUM);
127 COPY_REG (__preds, IA64_PR_REGNUM);
128 COPY_REG (__ccv, IA64_CCV_REGNUM);
129 COPY_REG (__lc, IA64_LC_REGNUM);
130 COPY_REG (__ec, IA64_EC_REGNUM);
131 /* FIXME: __nats */
132 COPY_REG (__fpsr, IA64_FPSR_REGNUM);
133#undef COPY_REG
134}
135
136void
137supply_fpregset (prfpregset_t *fpregsetp)
138{
52f0bd74 139 int regi;
d7fa2ae2
KB
140
141 for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
142 supply_register (regi,
143 (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]));
144}
145
146void
147fill_fpregset (prfpregset_t *fpregsetp, int regno)
148{
149 int regi;
150 char *to;
151 char *from;
152
153 for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
154 {
155 if ((regno == -1) || (regno == regi))
156 {
62700349 157 from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)];
d7fa2ae2 158 to = (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]);
12c266ea 159 memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi));
d7fa2ae2
KB
160 }
161 }
162}
This page took 0.243816 seconds and 4 git commands to generate.