Commit | Line | Data |
---|---|---|
611889b1 KB |
1 | /* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger. |
2 | Copyright 2003, 2004, 2005 | |
3 | Free Software Foundation, Inc. | |
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 "gdbcore.h" | |
24 | #include "gdb_string.h" | |
25 | #include "regcache.h" | |
26 | #include "mn10300-tdep.h" | |
27 | #include "gdb_assert.h" | |
28 | #include "bfd.h" | |
29 | #include "elf-bfd.h" | |
30 | #include "osabi.h" | |
31 | #include "regset.h" | |
32 | ||
33 | #include <stdlib.h> | |
34 | ||
35 | /* Transliterated from <asm-mn10300/elf.h>... */ | |
36 | #define MN10300_ELF_NGREG 28 | |
37 | #define MN10300_ELF_NFPREG 32 | |
38 | ||
39 | typedef gdb_byte mn10300_elf_greg_t[4]; | |
40 | typedef mn10300_elf_greg_t mn10300_elf_gregset_t[MN10300_ELF_NGREG]; | |
41 | ||
42 | typedef gdb_byte mn10300_elf_fpreg_t[4]; | |
43 | typedef struct | |
44 | { | |
45 | mn10300_elf_fpreg_t fpregs[MN10300_ELF_NFPREG]; | |
46 | gdb_byte fpcr[4]; | |
47 | } mn10300_elf_fpregset_t; | |
48 | ||
49 | /* elf_gregset_t register indices stolen from include/asm-mn10300/ptrace.h. */ | |
50 | #define MN10300_ELF_GREGSET_T_REG_INDEX_A3 0 | |
51 | #define MN10300_ELF_GREGSET_T_REG_INDEX_A2 1 | |
52 | #define MN10300_ELF_GREGSET_T_REG_INDEX_D3 2 | |
53 | #define MN10300_ELF_GREGSET_T_REG_INDEX_D2 3 | |
54 | #define MN10300_ELF_GREGSET_T_REG_INDEX_MCVF 4 | |
55 | #define MN10300_ELF_GREGSET_T_REG_INDEX_MCRL 5 | |
56 | #define MN10300_ELF_GREGSET_T_REG_INDEX_MCRH 6 | |
57 | #define MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ 7 | |
58 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E1 8 | |
59 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E0 9 | |
60 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E7 10 | |
61 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E6 11 | |
62 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E5 12 | |
63 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E4 13 | |
64 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E3 14 | |
65 | #define MN10300_ELF_GREGSET_T_REG_INDEX_E2 15 | |
66 | #define MN10300_ELF_GREGSET_T_REG_INDEX_SP 16 | |
67 | #define MN10300_ELF_GREGSET_T_REG_INDEX_LAR 17 | |
68 | #define MN10300_ELF_GREGSET_T_REG_INDEX_LIR 18 | |
69 | #define MN10300_ELF_GREGSET_T_REG_INDEX_MDR 19 | |
70 | #define MN10300_ELF_GREGSET_T_REG_INDEX_A1 20 | |
71 | #define MN10300_ELF_GREGSET_T_REG_INDEX_A0 21 | |
72 | #define MN10300_ELF_GREGSET_T_REG_INDEX_D1 22 | |
73 | #define MN10300_ELF_GREGSET_T_REG_INDEX_D0 23 | |
74 | #define MN10300_ELF_GREGSET_T_REG_INDEX_ORIG_D0 24 | |
75 | #define MN10300_ELF_GREGSET_T_REG_INDEX_EPSW 25 | |
76 | #define MN10300_ELF_GREGSET_T_REG_INDEX_PC 26 | |
77 | ||
78 | /* New gdbarch API for corefile registers. | |
79 | Given a section name and size, create a struct reg object | |
80 | with a supply_register and a collect_register method. */ | |
81 | ||
82 | /* Copy register value of REGNUM from regset to regcache. | |
83 | If REGNUM is -1, do this for all gp registers in regset. */ | |
84 | ||
85 | static void | |
86 | am33_supply_gregset_method (const struct regset *regset, | |
87 | struct regcache *regcache, | |
88 | int regnum, const void *gregs, size_t len) | |
89 | { | |
90 | char zerobuf[MAX_REGISTER_SIZE]; | |
91 | const mn10300_elf_greg_t *regp = (const mn10300_elf_greg_t *) gregs; | |
92 | int i; | |
93 | ||
94 | gdb_assert (len == sizeof (mn10300_elf_gregset_t)); | |
95 | ||
96 | switch (regnum) { | |
97 | case E_D0_REGNUM: | |
98 | regcache_raw_supply (regcache, E_D0_REGNUM, | |
99 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0)); | |
100 | break; | |
101 | case E_D1_REGNUM: | |
102 | regcache_raw_supply (regcache, E_D1_REGNUM, | |
103 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1)); | |
104 | break; | |
105 | case E_D2_REGNUM: | |
106 | regcache_raw_supply (regcache, E_D2_REGNUM, | |
107 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2)); | |
108 | break; | |
109 | case E_D3_REGNUM: | |
110 | regcache_raw_supply (regcache, E_D3_REGNUM, | |
111 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3)); | |
112 | break; | |
113 | case E_A0_REGNUM: | |
114 | regcache_raw_supply (regcache, E_A0_REGNUM, | |
115 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0)); | |
116 | break; | |
117 | case E_A1_REGNUM: | |
118 | regcache_raw_supply (regcache, E_A1_REGNUM, | |
119 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1)); | |
120 | break; | |
121 | case E_A2_REGNUM: | |
122 | regcache_raw_supply (regcache, E_A2_REGNUM, | |
123 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2)); | |
124 | break; | |
125 | case E_A3_REGNUM: | |
126 | regcache_raw_supply (regcache, E_A3_REGNUM, | |
127 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3)); | |
128 | break; | |
129 | case E_SP_REGNUM: | |
130 | regcache_raw_supply (regcache, E_SP_REGNUM, | |
131 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP)); | |
132 | break; | |
133 | case E_PC_REGNUM: | |
134 | regcache_raw_supply (regcache, E_PC_REGNUM, | |
135 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC)); | |
136 | break; | |
137 | case E_MDR_REGNUM: | |
138 | regcache_raw_supply (regcache, E_MDR_REGNUM, | |
139 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR)); | |
140 | break; | |
141 | case E_PSW_REGNUM: | |
142 | regcache_raw_supply (regcache, E_PSW_REGNUM, | |
143 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW)); | |
144 | break; | |
145 | case E_LIR_REGNUM: | |
146 | regcache_raw_supply (regcache, E_LIR_REGNUM, | |
147 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR)); | |
148 | break; | |
149 | case E_LAR_REGNUM: | |
150 | regcache_raw_supply (regcache, E_LAR_REGNUM, | |
151 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR)); | |
152 | break; | |
153 | case E_MDRQ_REGNUM: | |
154 | regcache_raw_supply (regcache, E_MDRQ_REGNUM, | |
155 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ)); | |
156 | break; | |
157 | case E_E0_REGNUM: | |
158 | regcache_raw_supply (regcache, E_E0_REGNUM, | |
159 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0)); | |
160 | break; | |
161 | case E_E1_REGNUM: | |
162 | regcache_raw_supply (regcache, E_E1_REGNUM, | |
163 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1)); | |
164 | break; | |
165 | case E_E2_REGNUM: | |
166 | regcache_raw_supply (regcache, E_E2_REGNUM, | |
167 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2)); | |
168 | break; | |
169 | case E_E3_REGNUM: | |
170 | regcache_raw_supply (regcache, E_E3_REGNUM, | |
171 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3)); | |
172 | break; | |
173 | case E_E4_REGNUM: | |
174 | regcache_raw_supply (regcache, E_E4_REGNUM, | |
175 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4)); | |
176 | break; | |
177 | case E_E5_REGNUM: | |
178 | regcache_raw_supply (regcache, E_E5_REGNUM, | |
179 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5)); | |
180 | break; | |
181 | case E_E6_REGNUM: | |
182 | regcache_raw_supply (regcache, E_E6_REGNUM, | |
183 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6)); | |
184 | break; | |
185 | case E_E7_REGNUM: | |
186 | regcache_raw_supply (regcache, E_E7_REGNUM, | |
187 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7)); | |
188 | break; | |
189 | ||
190 | /* ssp, msp, and usp are inaccessible. */ | |
191 | case E_E8_REGNUM: | |
192 | memset (zerobuf, 0, MAX_REGISTER_SIZE); | |
193 | regcache_raw_supply (regcache, E_E8_REGNUM, zerobuf); | |
194 | break; | |
195 | case E_E9_REGNUM: | |
196 | memset (zerobuf, 0, MAX_REGISTER_SIZE); | |
197 | regcache_raw_supply (regcache, E_E9_REGNUM, zerobuf); | |
198 | break; | |
199 | case E_E10_REGNUM: | |
200 | memset (zerobuf, 0, MAX_REGISTER_SIZE); | |
201 | regcache_raw_supply (regcache, E_E10_REGNUM, zerobuf); | |
202 | ||
203 | break; | |
204 | case E_MCRH_REGNUM: | |
205 | regcache_raw_supply (regcache, E_MCRH_REGNUM, | |
206 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH)); | |
207 | break; | |
208 | case E_MCRL_REGNUM: | |
209 | regcache_raw_supply (regcache, E_MCRL_REGNUM, | |
210 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL)); | |
211 | break; | |
212 | case E_MCVF_REGNUM: | |
213 | regcache_raw_supply (regcache, E_MCVF_REGNUM, | |
214 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF)); | |
215 | break; | |
216 | case E_FPCR_REGNUM: | |
217 | /* FPCR is numbered among the GP regs, but handled as an FP reg. | |
218 | Do nothing. */ | |
219 | break; | |
220 | case E_FPCR_REGNUM + 1: | |
221 | /* The two unused registers beyond fpcr are inaccessible. */ | |
222 | memset (zerobuf, 0, MAX_REGISTER_SIZE); | |
223 | regcache_raw_supply (regcache, E_FPCR_REGNUM + 1, zerobuf); | |
224 | break; | |
225 | case E_FPCR_REGNUM + 2: | |
226 | memset (zerobuf, 0, MAX_REGISTER_SIZE); | |
227 | regcache_raw_supply (regcache, E_FPCR_REGNUM + 2, zerobuf); | |
228 | break; | |
229 | default: /* An error, obviously, but should we error out? */ | |
230 | break; | |
231 | case -1: | |
232 | for (i = 0; i < MN10300_ELF_NGREG; i++) | |
233 | am33_supply_gregset_method (regset, regcache, i, gregs, len); | |
234 | break; | |
235 | } | |
236 | return; | |
237 | } | |
238 | ||
239 | /* Copy fp register value of REGNUM from regset to regcache. | |
240 | If REGNUM is -1, do this for all fp registers in regset. */ | |
241 | ||
242 | static void | |
243 | am33_supply_fpregset_method (const struct regset *regset, | |
244 | struct regcache *regcache, | |
245 | int regnum, const void *fpregs, size_t len) | |
246 | { | |
247 | const mn10300_elf_fpregset_t *fpregset = fpregs; | |
248 | ||
249 | gdb_assert (len == sizeof (mn10300_elf_fpregset_t)); | |
250 | ||
251 | if (regnum == -1) | |
252 | { | |
253 | int i; | |
254 | ||
255 | for (i = 0; i < MN10300_ELF_NFPREG; i++) | |
256 | am33_supply_fpregset_method (regset, regcache, | |
257 | E_FS0_REGNUM + i, fpregs, len); | |
258 | am33_supply_fpregset_method (regset, regcache, | |
259 | E_FPCR_REGNUM, fpregs, len); | |
260 | } | |
261 | else if (regnum == E_FPCR_REGNUM) | |
262 | regcache_raw_supply (current_regcache, E_FPCR_REGNUM, | |
263 | &fpregset->fpcr); | |
264 | else if (E_FS0_REGNUM <= regnum && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG) | |
265 | regcache_raw_supply (current_regcache, regnum, | |
266 | &fpregset->fpregs[regnum - E_FS0_REGNUM]); | |
267 | ||
268 | return; | |
269 | } | |
270 | ||
271 | /* Copy register values from regcache to regset. */ | |
272 | ||
273 | static void | |
274 | am33_collect_gregset_method (const struct regset *regset, | |
275 | const struct regcache *regcache, | |
276 | int regnum, void *gregs, size_t len) | |
277 | { | |
278 | mn10300_elf_gregset_t *regp = gregs; | |
279 | int i; | |
280 | ||
281 | gdb_assert (len == sizeof (mn10300_elf_gregset_t)); | |
282 | ||
283 | switch (regnum) { | |
284 | case E_D0_REGNUM: | |
285 | regcache_raw_collect (regcache, E_D0_REGNUM, | |
286 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D0)); | |
287 | break; | |
288 | case E_D1_REGNUM: | |
289 | regcache_raw_collect (regcache, E_D1_REGNUM, | |
290 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D1)); | |
291 | break; | |
292 | case E_D2_REGNUM: | |
293 | regcache_raw_collect (regcache, E_D2_REGNUM, | |
294 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D2)); | |
295 | break; | |
296 | case E_D3_REGNUM: | |
297 | regcache_raw_collect (regcache, E_D3_REGNUM, | |
298 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_D3)); | |
299 | break; | |
300 | case E_A0_REGNUM: | |
301 | regcache_raw_collect (regcache, E_A0_REGNUM, | |
302 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A0)); | |
303 | break; | |
304 | case E_A1_REGNUM: | |
305 | regcache_raw_collect (regcache, E_A1_REGNUM, | |
306 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A1)); | |
307 | break; | |
308 | case E_A2_REGNUM: | |
309 | regcache_raw_collect (regcache, E_A2_REGNUM, | |
310 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A2)); | |
311 | break; | |
312 | case E_A3_REGNUM: | |
313 | regcache_raw_collect (regcache, E_A3_REGNUM, | |
314 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_A3)); | |
315 | break; | |
316 | case E_SP_REGNUM: | |
317 | regcache_raw_collect (regcache, E_SP_REGNUM, | |
318 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_SP)); | |
319 | break; | |
320 | case E_PC_REGNUM: | |
321 | regcache_raw_collect (regcache, E_PC_REGNUM, | |
322 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_PC)); | |
323 | break; | |
324 | case E_MDR_REGNUM: | |
325 | regcache_raw_collect (regcache, E_MDR_REGNUM, | |
326 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDR)); | |
327 | break; | |
328 | case E_PSW_REGNUM: | |
329 | regcache_raw_collect (regcache, E_PSW_REGNUM, | |
330 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_EPSW)); | |
331 | break; | |
332 | case E_LIR_REGNUM: | |
333 | regcache_raw_collect (regcache, E_LIR_REGNUM, | |
334 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LIR)); | |
335 | break; | |
336 | case E_LAR_REGNUM: | |
337 | regcache_raw_collect (regcache, E_LAR_REGNUM, | |
338 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_LAR)); | |
339 | break; | |
340 | case E_MDRQ_REGNUM: | |
341 | regcache_raw_collect (regcache, E_MDRQ_REGNUM, | |
342 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MDRQ)); | |
343 | break; | |
344 | case E_E0_REGNUM: | |
345 | regcache_raw_collect (regcache, E_E0_REGNUM, | |
346 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E0)); | |
347 | break; | |
348 | case E_E1_REGNUM: | |
349 | regcache_raw_collect (regcache, E_E1_REGNUM, | |
350 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E1)); | |
351 | break; | |
352 | case E_E2_REGNUM: | |
353 | regcache_raw_collect (regcache, E_E2_REGNUM, | |
354 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E2)); | |
355 | break; | |
356 | case E_E3_REGNUM: | |
357 | regcache_raw_collect (regcache, E_E3_REGNUM, | |
358 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E3)); | |
359 | break; | |
360 | case E_E4_REGNUM: | |
361 | regcache_raw_collect (regcache, E_E4_REGNUM, | |
362 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E4)); | |
363 | break; | |
364 | case E_E5_REGNUM: | |
365 | regcache_raw_collect (regcache, E_E5_REGNUM, | |
366 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E5)); | |
367 | break; | |
368 | case E_E6_REGNUM: | |
369 | regcache_raw_collect (regcache, E_E6_REGNUM, | |
370 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E6)); | |
371 | break; | |
372 | case E_E7_REGNUM: | |
373 | regcache_raw_collect (regcache, E_E7_REGNUM, | |
374 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_E7)); | |
375 | break; | |
376 | ||
377 | /* ssp, msp, and usp are inaccessible. */ | |
378 | case E_E8_REGNUM: | |
379 | /* The gregset struct has noplace to put this: do nothing. */ | |
380 | break; | |
381 | case E_E9_REGNUM: | |
382 | /* The gregset struct has noplace to put this: do nothing. */ | |
383 | break; | |
384 | case E_E10_REGNUM: | |
385 | /* The gregset struct has noplace to put this: do nothing. */ | |
386 | break; | |
387 | case E_MCRH_REGNUM: | |
388 | regcache_raw_collect (regcache, E_MCRH_REGNUM, | |
389 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRH)); | |
390 | break; | |
391 | case E_MCRL_REGNUM: | |
392 | regcache_raw_collect (regcache, E_MCRL_REGNUM, | |
393 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCRL)); | |
394 | break; | |
395 | case E_MCVF_REGNUM: | |
396 | regcache_raw_collect (regcache, E_MCVF_REGNUM, | |
397 | (regp + MN10300_ELF_GREGSET_T_REG_INDEX_MCVF)); | |
398 | break; | |
399 | case E_FPCR_REGNUM: | |
400 | /* FPCR is numbered among the GP regs, but handled as an FP reg. | |
401 | Do nothing. */ | |
402 | break; | |
403 | case E_FPCR_REGNUM + 1: | |
404 | /* The gregset struct has noplace to put this: do nothing. */ | |
405 | break; | |
406 | case E_FPCR_REGNUM + 2: | |
407 | /* The gregset struct has noplace to put this: do nothing. */ | |
408 | break; | |
409 | default: /* An error, obviously, but should we error out? */ | |
410 | break; | |
411 | case -1: | |
412 | for (i = 0; i < MN10300_ELF_NGREG; i++) | |
413 | am33_collect_gregset_method (regset, regcache, i, gregs, len); | |
414 | break; | |
415 | } | |
416 | return; | |
417 | } | |
418 | ||
419 | /* Copy fp register values from regcache to regset. */ | |
420 | ||
421 | static void | |
422 | am33_collect_fpregset_method (const struct regset *regset, | |
423 | const struct regcache *regcache, | |
424 | int regnum, void *fpregs, size_t len) | |
425 | { | |
426 | mn10300_elf_fpregset_t *fpregset = fpregs; | |
427 | ||
428 | gdb_assert (len == sizeof (mn10300_elf_fpregset_t)); | |
429 | ||
430 | if (regnum == -1) | |
431 | { | |
432 | int i; | |
433 | for (i = 0; i < MN10300_ELF_NFPREG; i++) | |
434 | am33_collect_fpregset_method (regset, regcache, E_FS0_REGNUM + i, | |
435 | fpregs, len); | |
436 | am33_collect_fpregset_method (regset, regcache, | |
437 | E_FPCR_REGNUM, fpregs, len); | |
438 | } | |
439 | else if (regnum == E_FPCR_REGNUM) | |
440 | regcache_raw_collect (current_regcache, E_FPCR_REGNUM, | |
441 | &fpregset->fpcr); | |
442 | else if (E_FS0_REGNUM <= regnum | |
443 | && regnum < E_FS0_REGNUM + MN10300_ELF_NFPREG) | |
444 | regcache_raw_collect (current_regcache, regnum, | |
445 | &fpregset->fpregs[regnum - E_FS0_REGNUM]); | |
446 | ||
447 | return; | |
448 | } | |
449 | ||
450 | /* Create a struct regset from a corefile register section. */ | |
451 | ||
452 | static const struct regset * | |
453 | am33_regset_from_core_section (struct gdbarch *gdbarch, | |
454 | const char *sect_name, | |
455 | size_t sect_size) | |
456 | { | |
457 | /* We will call regset_alloc, and pass the names of the supply and | |
458 | collect methods. */ | |
459 | ||
460 | if (sect_size == sizeof (mn10300_elf_fpregset_t)) | |
461 | return regset_alloc (gdbarch, | |
462 | am33_supply_fpregset_method, | |
463 | am33_collect_fpregset_method); | |
464 | else | |
465 | return regset_alloc (gdbarch, | |
466 | am33_supply_gregset_method, | |
467 | am33_collect_gregset_method); | |
468 | } | |
469 | ||
470 | /* AM33 Linux osabi has been recognized. | |
471 | Now's our chance to register our corefile handling. */ | |
472 | ||
473 | static void | |
474 | am33_linux_init_osabi (struct gdbarch_info gdbinfo, struct gdbarch *gdbarch) | |
475 | { | |
476 | set_gdbarch_regset_from_core_section (gdbarch, | |
477 | am33_regset_from_core_section); | |
478 | } | |
479 | ||
480 | void | |
481 | _initialize_mn10300_linux_tdep (void) | |
482 | { | |
483 | gdbarch_register_osabi (bfd_arch_mn10300, 0, | |
484 | GDB_OSABI_LINUX, am33_linux_init_osabi); | |
485 | } | |
486 |