* config/ppc-tdep.h (struct gdbarch_tdep): Delete
[external/binutils.git] / gdb / ppc-tdep.h
1 /* Target-dependent code for GDB, the GNU debugger.
2
3    Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
4    Inc.
5
6    This file is part of GDB.
7
8    This program is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 2 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place - Suite 330,
21    Boston, MA 02111-1307, USA.  */
22
23 #ifndef PPC_TDEP_H
24 #define PPC_TDEP_H
25
26 struct gdbarch;
27 struct frame_info;
28 struct value;
29 struct regcache;
30 struct type;
31
32 /* From ppc-linux-tdep.c... */
33 enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
34                                                         struct type *valtype,
35                                                         struct regcache *regcache,
36                                                         void *readbuf,
37                                                         const void *writebuf);
38 enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
39                                                                struct type *valtype,
40                                                                struct regcache *regcache,
41                                                                void *readbuf,
42                                                                const void *writebuf);
43 CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
44                                         CORE_ADDR func_addr,
45                                         struct regcache *regcache,
46                                         CORE_ADDR bp_addr, int nargs,
47                                         struct value **args, CORE_ADDR sp,
48                                         int struct_return,
49                                         CORE_ADDR struct_addr);
50 CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
51                                           CORE_ADDR func_addr,
52                                           struct regcache *regcache,
53                                           CORE_ADDR bp_addr, int nargs,
54                                           struct value **args, CORE_ADDR sp,
55                                           int struct_return,
56                                           CORE_ADDR struct_addr);
57 CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch,
58                                                     CORE_ADDR bpaddr);
59 int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
60 struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
61 void ppc_linux_supply_gregset (struct regcache *regcache,
62                                int regnum, const void *gregs, size_t size,
63                                int wordsize);
64 void ppc_linux_supply_fpregset (const struct regset *regset,
65                                 struct regcache *regcache,
66                                 int regnum, const void *gregs, size_t size);
67
68 enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch,
69                                                           struct type *valtype,
70                                                           struct regcache *regcache,
71                                                           void *readbuf,
72                                                           const void *writebuf);
73
74 /* From rs6000-tdep.c... */
75 int altivec_register_p (int regno);
76
77 /* Return non-zero when the architecture has an FPU (or at least when
78    the ABI is using the FPU).  */
79 int ppc_floating_point_unit_p (struct gdbarch *gdbarch);
80
81 /* Register set description.  */
82
83 struct ppc_reg_offsets
84 {
85   /* General-purpose registers.  */
86   int r0_offset;
87   int pc_offset;
88   int ps_offset;
89   int cr_offset;
90   int lr_offset;
91   int ctr_offset;
92   int xer_offset;
93   int mq_offset;
94
95   /* Floating-point registers.  */
96   int f0_offset;
97   int fpscr_offset;
98
99   /* AltiVec registers.  */
100   int vr0_offset;
101   int vscr_offset;
102   int vrsave_offset;
103 };
104
105 /* Supply register REGNUM in the general-purpose register set REGSET
106    from the buffer specified by GREGS and LEN to register cache
107    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
108
109 extern void ppc_supply_gregset (const struct regset *regset,
110                                 struct regcache *regcache,
111                                 int regnum, const void *gregs, size_t len);
112
113 /* Supply register REGNUM in the floating-point register set REGSET
114    from the buffer specified by FPREGS and LEN to register cache
115    REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
116
117 extern void ppc_supply_fpregset (const struct regset *regset,
118                                  struct regcache *regcache,
119                                  int regnum, const void *fpregs, size_t len);
120
121 /* Collect register REGNUM in the general-purpose register set
122    REGSET. from register cache REGCACHE into the buffer specified by
123    GREGS and LEN.  If REGNUM is -1, do this for all registers in
124    REGSET.  */
125
126 extern void ppc_collect_gregset (const struct regset *regset,
127                                  const struct regcache *regcache,
128                                  int regnum, void *gregs, size_t len);
129
130 /* Collect register REGNUM in the floating-point register set
131    REGSET. from register cache REGCACHE into the buffer specified by
132    FPREGS and LEN.  If REGNUM is -1, do this for all registers in
133    REGSET.  */
134
135 extern void ppc_collect_fpregset (const struct regset *regset,
136                                   const struct regcache *regcache,
137                                   int regnum, void *fpregs, size_t len);
138
139 /* Private data that this module attaches to struct gdbarch. */
140
141 struct gdbarch_tdep
142   {
143     int wordsize;              /* size in bytes of fixed-point word */
144     int *regoff;               /* byte offsets in register arrays */
145     const struct reg *regs;    /* from current variant */
146     int ppc_gp0_regnum;         /* GPR register 0 */
147     int ppc_toc_regnum;         /* TOC register */
148     int ppc_ps_regnum;          /* Processor (or machine) status (%msr) */
149     int ppc_cr_regnum;          /* Condition register */
150     int ppc_lr_regnum;          /* Link register */
151     int ppc_ctr_regnum;         /* Count register */
152     int ppc_xer_regnum;         /* Integer exception register */
153     int ppc_fpscr_regnum;       /* Floating point status and condition
154                                    register */
155     int ppc_mq_regnum;          /* Multiply/Divide extension register */
156     int ppc_vr0_regnum;         /* First AltiVec register */
157     int ppc_vrsave_regnum;      /* Last AltiVec register */
158     int ppc_ev0_regnum;         /* First ev register */
159     int ppc_ev31_regnum;        /* Last ev register */
160     int lr_frame_offset;        /* Offset to ABI specific location where
161                                    link register is saved.  */
162 };
163
164
165 /* Constants for register set sizes.  */
166 enum
167   {
168     ppc_num_gprs = 32,          /* 32 general-purpose registers */
169     ppc_num_fprs = 32           /* 32 floating-point registers */
170   };
171
172 #endif