1 /* Low level interface to IA-64 running AIX for GDB, the GNU debugger.
3 Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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. */
27 #include <sys/procfs.h>
34 #include <sys/types.h>
39 supply_gregset (prgregset_t
*gregsetp
)
43 for (regi
= IA64_GR0_REGNUM
; regi
<= IA64_GR31_REGNUM
; regi
++)
45 regcache_raw_supply (current_regcache
, regi
,
46 (char *) &(gregsetp
->__gpr
[regi
- IA64_GR0_REGNUM
]));
49 for (regi
= IA64_BR0_REGNUM
; regi
<= IA64_BR7_REGNUM
; regi
++)
51 regcache_raw_supply (current_regcache
, regi
,
52 (char *) &(gregsetp
->__br
[regi
- IA64_BR0_REGNUM
]));
55 regcache_raw_supply (current_regcache
, IA64_PSR_REGNUM
,
56 (char *) &(gregsetp
->__psr
));
57 regcache_raw_supply (current_regcache
, IA64_IP_REGNUM
,
58 (char *) &(gregsetp
->__ip
));
59 regcache_raw_supply (current_regcache
, IA64_CFM_REGNUM
,
60 (char *) &(gregsetp
->__ifs
));
61 regcache_raw_supply (current_regcache
, IA64_RSC_REGNUM
,
62 (char *) &(gregsetp
->__rsc
));
63 regcache_raw_supply (current_regcache
, IA64_BSP_REGNUM
,
64 (char *) &(gregsetp
->__bsp
));
65 regcache_raw_supply (current_regcache
, IA64_BSPSTORE_REGNUM
,
66 (char *) &(gregsetp
->__bspstore
));
67 regcache_raw_supply (current_regcache
, IA64_RNAT_REGNUM
,
68 (char *) &(gregsetp
->__rnat
));
69 regcache_raw_supply (current_regcache
, IA64_PFS_REGNUM
,
70 (char *) &(gregsetp
->__pfs
));
71 regcache_raw_supply (current_regcache
, IA64_UNAT_REGNUM
,
72 (char *) &(gregsetp
->__unat
));
73 regcache_raw_supply (current_regcache
, IA64_PR_REGNUM
,
74 (char *) &(gregsetp
->__preds
));
75 regcache_raw_supply (current_regcache
, IA64_CCV_REGNUM
,
76 (char *) &(gregsetp
->__ccv
));
77 regcache_raw_supply (current_regcache
, IA64_LC_REGNUM
,
78 (char *) &(gregsetp
->__lc
));
79 regcache_raw_supply (current_regcache
, IA64_EC_REGNUM
,
80 (char *) &(gregsetp
->__ec
));
82 regcache_raw_supply (current_regcache
, IA64_FPSR_REGNUM
,
83 (char *) &(gregsetp
->__fpsr
));
85 /* These (for the most part) are pseudo registers and are obtained
86 by other means. Those that aren't are already handled by the
88 for (regi
= IA64_GR32_REGNUM
; regi
<= IA64_GR127_REGNUM
; regi
++)
89 deprecated_register_valid
[regi
] = 1;
90 for (regi
= IA64_PR0_REGNUM
; regi
<= IA64_PR63_REGNUM
; regi
++)
91 deprecated_register_valid
[regi
] = 1;
92 for (regi
= IA64_VFP_REGNUM
; regi
<= NUM_REGS
; regi
++)
93 deprecated_register_valid
[regi
] = 1;
97 fill_gregset (prgregset_t
*gregsetp
, int regno
)
101 #define COPY_REG(_fld_,_regi_) \
102 if ((regno == -1) || regno == _regi_) \
103 memcpy (&(gregsetp->_fld_), &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \
104 register_size (current_gdbarch, _regi_))
106 for (regi
= IA64_GR0_REGNUM
; regi
<= IA64_GR31_REGNUM
; regi
++)
108 COPY_REG (__gpr
[regi
- IA64_GR0_REGNUM
], regi
);
111 for (regi
= IA64_BR0_REGNUM
; regi
<= IA64_BR7_REGNUM
; regi
++)
113 COPY_REG (__br
[regi
- IA64_BR0_REGNUM
], regi
);
115 COPY_REG (__psr
, IA64_PSR_REGNUM
);
116 COPY_REG (__ip
, IA64_IP_REGNUM
);
117 COPY_REG (__ifs
, IA64_CFM_REGNUM
);
118 COPY_REG (__rsc
, IA64_RSC_REGNUM
);
119 COPY_REG (__bsp
, IA64_BSP_REGNUM
);
121 /* Bad things happen if we don't update both bsp and bspstore at the
123 if (regno
== IA64_BSP_REGNUM
|| regno
== -1)
125 memcpy (&(gregsetp
->__bspstore
),
126 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM
)],
127 register_size (current_gdbarch
, IA64_BSP_REGNUM
));
128 memcpy (&deprecated_registers
[DEPRECATED_REGISTER_BYTE (IA64_BSPSTORE_REGNUM
)],
129 &deprecated_registers
[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM
)],
130 register_size (current_gdbarch
, IA64_BSP_REGNUM
));
134 /* We never actually write to bspstore, or we'd have to do the same thing
136 COPY_REG (__bspstore
, IA64_BSPSTORE_REGNUM
);
138 COPY_REG (__rnat
, IA64_RNAT_REGNUM
);
139 COPY_REG (__pfs
, IA64_PFS_REGNUM
);
140 COPY_REG (__unat
, IA64_UNAT_REGNUM
);
141 COPY_REG (__preds
, IA64_PR_REGNUM
);
142 COPY_REG (__ccv
, IA64_CCV_REGNUM
);
143 COPY_REG (__lc
, IA64_LC_REGNUM
);
144 COPY_REG (__ec
, IA64_EC_REGNUM
);
146 COPY_REG (__fpsr
, IA64_FPSR_REGNUM
);
151 supply_fpregset (prfpregset_t
*fpregsetp
)
155 for (regi
= IA64_FR0_REGNUM
; regi
<= IA64_FR127_REGNUM
; regi
++)
156 regcache_raw_supply (current_regcache
, regi
,
157 (char *) &(fpregsetp
->__fpr
[regi
- IA64_FR0_REGNUM
]));
161 fill_fpregset (prfpregset_t
*fpregsetp
, int regno
)
167 for (regi
= IA64_FR0_REGNUM
; regi
<= IA64_FR127_REGNUM
; regi
++)
169 if ((regno
== -1) || (regno
== regi
))
171 from
= (char *) &deprecated_registers
[DEPRECATED_REGISTER_BYTE (regi
)];
172 to
= (char *) &(fpregsetp
->__fpr
[regi
- IA64_FR0_REGNUM
]);
173 memcpy (to
, from
, register_size (current_gdbarch
, regi
));