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 supply_register (regi,
46 (char *) &(gregsetp->__gpr[regi - IA64_GR0_REGNUM]));
49 for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
51 supply_register (regi,
52 (char *) &(gregsetp->__br[regi - IA64_BR0_REGNUM]));
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));
69 supply_register (IA64_FPSR_REGNUM, (char *) &(gregsetp->__fpsr));
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
74 for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
75 deprecated_register_valid[regi] = 1;
76 for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
77 deprecated_register_valid[regi] = 1;
78 for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
79 deprecated_register_valid[regi] = 1;
83 fill_gregset (prgregset_t *gregsetp, int regno)
87 #define COPY_REG(_fld_,_regi_) \
88 if ((regno == -1) || regno == _regi_) \
89 memcpy (&(gregsetp->_fld_), &deprecated_registers[DEPRECATED_REGISTER_BYTE (_regi_)], \
90 DEPRECATED_REGISTER_RAW_SIZE (_regi_))
92 for (regi = IA64_GR0_REGNUM; regi <= IA64_GR31_REGNUM; regi++)
94 COPY_REG (__gpr[regi - IA64_GR0_REGNUM], regi);
97 for (regi = IA64_BR0_REGNUM; regi <= IA64_BR7_REGNUM; regi++)
99 COPY_REG (__br[regi - IA64_BR0_REGNUM], regi);
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);
107 /* Bad things happen if we don't update both bsp and bspstore at the
109 if (regno == IA64_BSP_REGNUM || regno == -1)
111 memcpy (&(gregsetp->__bspstore),
112 &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)],
113 DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
114 memcpy (&deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSPSTORE_REGNUM)],
115 &deprecated_registers[DEPRECATED_REGISTER_BYTE (IA64_BSP_REGNUM)],
116 DEPRECATED_REGISTER_RAW_SIZE (IA64_BSP_REGNUM));
120 /* We never actually write to bspstore, or we'd have to do the same thing
122 COPY_REG (__bspstore, IA64_BSPSTORE_REGNUM);
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);
132 COPY_REG (__fpsr, IA64_FPSR_REGNUM);
137 supply_fpregset (prfpregset_t *fpregsetp)
141 for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
142 supply_register (regi,
143 (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]));
147 fill_fpregset (prfpregset_t *fpregsetp, int regno)
153 for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
155 if ((regno == -1) || (regno == regi))
157 from = (char *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regi)];
158 to = (char *) &(fpregsetp->__fpr[regi - IA64_FR0_REGNUM]);
159 memcpy (to, from, DEPRECATED_REGISTER_RAW_SIZE (regi));