1 /* Target-dependent code for UltraSPARC.
3 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
6 This file is part of GDB.
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 3 of the License, or
11 (at your option) any later version.
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.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "arch-utils.h"
23 #include "dwarf2-frame.h"
24 #include "floatformat.h"
26 #include "frame-base.h"
27 #include "frame-unwind.h"
38 #include "gdb_assert.h"
39 #include "gdb_string.h"
41 #include "sparc64-tdep.h"
43 /* This file implements the SPARC 64-bit ABI as defined by the
44 section "Low-Level System Information" of the SPARC Compliance
45 Definition (SCD) 2.4.1, which is the 64-bit System V psABI for
48 /* Please use the sparc32_-prefix for 32-bit specific code, the
49 sparc64_-prefix for 64-bit specific code and the sparc_-prefix for
50 code can handle both. */
52 /* The functions on this page are intended to be used to classify
53 function arguments. */
55 /* Check whether TYPE is "Integral or Pointer". */
58 sparc64_integral_or_pointer_p (const struct type *type)
60 switch (TYPE_CODE (type))
68 int len = TYPE_LENGTH (type);
69 gdb_assert (len == 1 || len == 2 || len == 4 || len == 8);
75 int len = TYPE_LENGTH (type);
76 gdb_assert (len == 8);
86 /* Check whether TYPE is "Floating". */
89 sparc64_floating_p (const struct type *type)
91 switch (TYPE_CODE (type))
95 int len = TYPE_LENGTH (type);
96 gdb_assert (len == 4 || len == 8 || len == 16);
106 /* Check whether TYPE is "Structure or Union".
108 In terms of Ada subprogram calls, arrays are treated the same as
109 struct and union types. So this function also returns non-zero
113 sparc64_structure_or_union_p (const struct type *type)
115 switch (TYPE_CODE (type))
117 case TYPE_CODE_STRUCT:
118 case TYPE_CODE_UNION:
119 case TYPE_CODE_ARRAY:
129 /* Construct types for ISA-specific registers. */
132 sparc64_pstate_type (struct gdbarch *gdbarch)
134 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
136 if (!tdep->sparc64_pstate_type)
140 type = arch_flags_type (gdbarch, "builtin_type_sparc64_pstate", 8);
141 append_flags_type_flag (type, 0, "AG");
142 append_flags_type_flag (type, 1, "IE");
143 append_flags_type_flag (type, 2, "PRIV");
144 append_flags_type_flag (type, 3, "AM");
145 append_flags_type_flag (type, 4, "PEF");
146 append_flags_type_flag (type, 5, "RED");
147 append_flags_type_flag (type, 8, "TLE");
148 append_flags_type_flag (type, 9, "CLE");
149 append_flags_type_flag (type, 10, "PID0");
150 append_flags_type_flag (type, 11, "PID1");
152 tdep->sparc64_pstate_type = type;
155 return tdep->sparc64_pstate_type;
159 sparc64_fsr_type (struct gdbarch *gdbarch)
161 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
163 if (!tdep->sparc64_fsr_type)
167 type = arch_flags_type (gdbarch, "builtin_type_sparc64_fsr", 8);
168 append_flags_type_flag (type, 0, "NXA");
169 append_flags_type_flag (type, 1, "DZA");
170 append_flags_type_flag (type, 2, "UFA");
171 append_flags_type_flag (type, 3, "OFA");
172 append_flags_type_flag (type, 4, "NVA");
173 append_flags_type_flag (type, 5, "NXC");
174 append_flags_type_flag (type, 6, "DZC");
175 append_flags_type_flag (type, 7, "UFC");
176 append_flags_type_flag (type, 8, "OFC");
177 append_flags_type_flag (type, 9, "NVC");
178 append_flags_type_flag (type, 22, "NS");
179 append_flags_type_flag (type, 23, "NXM");
180 append_flags_type_flag (type, 24, "DZM");
181 append_flags_type_flag (type, 25, "UFM");
182 append_flags_type_flag (type, 26, "OFM");
183 append_flags_type_flag (type, 27, "NVM");
185 tdep->sparc64_fsr_type = type;
188 return tdep->sparc64_fsr_type;
192 sparc64_fprs_type (struct gdbarch *gdbarch)
194 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
196 if (!tdep->sparc64_fprs_type)
200 type = arch_flags_type (gdbarch, "builtin_type_sparc64_fprs", 8);
201 append_flags_type_flag (type, 0, "DL");
202 append_flags_type_flag (type, 1, "DU");
203 append_flags_type_flag (type, 2, "FEF");
205 tdep->sparc64_fprs_type = type;
208 return tdep->sparc64_fprs_type;
212 /* Register information. */
214 static const char *sparc64_register_names[] =
216 "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
217 "o0", "o1", "o2", "o3", "o4", "o5", "sp", "o7",
218 "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7",
219 "i0", "i1", "i2", "i3", "i4", "i5", "fp", "i7",
221 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
222 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15",
223 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23",
224 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31",
225 "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46",
226 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62",
230 /* FIXME: Give "state" a name until we start using register groups. */
237 /* Total number of registers. */
238 #define SPARC64_NUM_REGS ARRAY_SIZE (sparc64_register_names)
240 /* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
241 registers as "psuedo" registers. */
243 static const char *sparc64_pseudo_register_names[] =
245 "cwp", "pstate", "asi", "ccr",
247 "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
248 "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30",
249 "d32", "d34", "d36", "d38", "d40", "d42", "d44", "d46",
250 "d48", "d50", "d52", "d54", "d56", "d58", "d60", "d62",
252 "q0", "q4", "q8", "q12", "q16", "q20", "q24", "q28",
253 "q32", "q36", "q40", "q44", "q48", "q52", "q56", "q60",
256 /* Total number of pseudo registers. */
257 #define SPARC64_NUM_PSEUDO_REGS ARRAY_SIZE (sparc64_pseudo_register_names)
259 /* Return the name of register REGNUM. */
262 sparc64_register_name (struct gdbarch *gdbarch, int regnum)
264 if (regnum >= 0 && regnum < SPARC64_NUM_REGS)
265 return sparc64_register_names[regnum];
267 if (regnum >= SPARC64_NUM_REGS
268 && regnum < SPARC64_NUM_REGS + SPARC64_NUM_PSEUDO_REGS)
269 return sparc64_pseudo_register_names[regnum - SPARC64_NUM_REGS];
274 /* Return the GDB type object for the "standard" data type of data in
278 sparc64_register_type (struct gdbarch *gdbarch, int regnum)
282 if (regnum == SPARC_SP_REGNUM || regnum == SPARC_FP_REGNUM)
283 return builtin_type (gdbarch)->builtin_data_ptr;
284 if (regnum >= SPARC_G0_REGNUM && regnum <= SPARC_I7_REGNUM)
285 return builtin_type (gdbarch)->builtin_int64;
286 if (regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
287 return builtin_type (gdbarch)->builtin_float;
288 if (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)
289 return builtin_type (gdbarch)->builtin_double;
290 if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM)
291 return builtin_type (gdbarch)->builtin_func_ptr;
292 /* This raw register contains the contents of %cwp, %pstate, %asi
293 and %ccr as laid out in a %tstate register. */
294 if (regnum == SPARC64_STATE_REGNUM)
295 return builtin_type (gdbarch)->builtin_int64;
296 if (regnum == SPARC64_FSR_REGNUM)
297 return sparc64_fsr_type (gdbarch);
298 if (regnum == SPARC64_FPRS_REGNUM)
299 return sparc64_fprs_type (gdbarch);
300 /* "Although Y is a 64-bit register, its high-order 32 bits are
301 reserved and always read as 0." */
302 if (regnum == SPARC64_Y_REGNUM)
303 return builtin_type (gdbarch)->builtin_int64;
305 /* Pseudo registers. */
307 if (regnum == SPARC64_CWP_REGNUM)
308 return builtin_type (gdbarch)->builtin_int64;
309 if (regnum == SPARC64_PSTATE_REGNUM)
310 return sparc64_pstate_type (gdbarch);
311 if (regnum == SPARC64_ASI_REGNUM)
312 return builtin_type (gdbarch)->builtin_int64;
313 if (regnum == SPARC64_CCR_REGNUM)
314 return builtin_type (gdbarch)->builtin_int64;
315 if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D62_REGNUM)
316 return builtin_type (gdbarch)->builtin_double;
317 if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q60_REGNUM)
318 return builtin_type (gdbarch)->builtin_long_double;
320 internal_error (__FILE__, __LINE__, _("invalid regnum"));
323 static enum register_status
324 sparc64_pseudo_register_read (struct gdbarch *gdbarch,
325 struct regcache *regcache,
326 int regnum, gdb_byte *buf)
328 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
329 enum register_status status;
331 gdb_assert (regnum >= SPARC64_NUM_REGS);
333 if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D30_REGNUM)
335 regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM);
336 status = regcache_raw_read (regcache, regnum, buf);
337 if (status == REG_VALID)
338 status = regcache_raw_read (regcache, regnum + 1, buf + 4);
341 else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM)
343 regnum = SPARC64_F32_REGNUM + (regnum - SPARC64_D32_REGNUM);
344 return regcache_raw_read (regcache, regnum, buf);
346 else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q28_REGNUM)
348 regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM);
350 status = regcache_raw_read (regcache, regnum, buf);
351 if (status == REG_VALID)
352 status = regcache_raw_read (regcache, regnum + 1, buf + 4);
353 if (status == REG_VALID)
354 status = regcache_raw_read (regcache, regnum + 2, buf + 8);
355 if (status == REG_VALID)
356 status = regcache_raw_read (regcache, regnum + 3, buf + 12);
360 else if (regnum >= SPARC64_Q32_REGNUM && regnum <= SPARC64_Q60_REGNUM)
362 regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM);
364 status = regcache_raw_read (regcache, regnum, buf);
365 if (status == REG_VALID)
366 status = regcache_raw_read (regcache, regnum + 1, buf + 8);
370 else if (regnum == SPARC64_CWP_REGNUM
371 || regnum == SPARC64_PSTATE_REGNUM
372 || regnum == SPARC64_ASI_REGNUM
373 || regnum == SPARC64_CCR_REGNUM)
377 status = regcache_raw_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
378 if (status != REG_VALID)
383 case SPARC64_CWP_REGNUM:
384 state = (state >> 0) & ((1 << 5) - 1);
386 case SPARC64_PSTATE_REGNUM:
387 state = (state >> 8) & ((1 << 12) - 1);
389 case SPARC64_ASI_REGNUM:
390 state = (state >> 24) & ((1 << 8) - 1);
392 case SPARC64_CCR_REGNUM:
393 state = (state >> 32) & ((1 << 8) - 1);
396 store_unsigned_integer (buf, 8, byte_order, state);
403 sparc64_pseudo_register_write (struct gdbarch *gdbarch,
404 struct regcache *regcache,
405 int regnum, const gdb_byte *buf)
407 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
408 gdb_assert (regnum >= SPARC64_NUM_REGS);
410 if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D30_REGNUM)
412 regnum = SPARC_F0_REGNUM + 2 * (regnum - SPARC64_D0_REGNUM);
413 regcache_raw_write (regcache, regnum, buf);
414 regcache_raw_write (regcache, regnum + 1, buf + 4);
416 else if (regnum >= SPARC64_D32_REGNUM && regnum <= SPARC64_D62_REGNUM)
418 regnum = SPARC64_F32_REGNUM + (regnum - SPARC64_D32_REGNUM);
419 regcache_raw_write (regcache, regnum, buf);
421 else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q28_REGNUM)
423 regnum = SPARC_F0_REGNUM + 4 * (regnum - SPARC64_Q0_REGNUM);
424 regcache_raw_write (regcache, regnum, buf);
425 regcache_raw_write (regcache, regnum + 1, buf + 4);
426 regcache_raw_write (regcache, regnum + 2, buf + 8);
427 regcache_raw_write (regcache, regnum + 3, buf + 12);
429 else if (regnum >= SPARC64_Q32_REGNUM && regnum <= SPARC64_Q60_REGNUM)
431 regnum = SPARC64_F32_REGNUM + 2 * (regnum - SPARC64_Q32_REGNUM);
432 regcache_raw_write (regcache, regnum, buf);
433 regcache_raw_write (regcache, regnum + 1, buf + 8);
435 else if (regnum == SPARC64_CWP_REGNUM
436 || regnum == SPARC64_PSTATE_REGNUM
437 || regnum == SPARC64_ASI_REGNUM
438 || regnum == SPARC64_CCR_REGNUM)
440 ULONGEST state, bits;
442 regcache_raw_read_unsigned (regcache, SPARC64_STATE_REGNUM, &state);
443 bits = extract_unsigned_integer (buf, 8, byte_order);
446 case SPARC64_CWP_REGNUM:
447 state |= ((bits & ((1 << 5) - 1)) << 0);
449 case SPARC64_PSTATE_REGNUM:
450 state |= ((bits & ((1 << 12) - 1)) << 8);
452 case SPARC64_ASI_REGNUM:
453 state |= ((bits & ((1 << 8) - 1)) << 24);
455 case SPARC64_CCR_REGNUM:
456 state |= ((bits & ((1 << 8) - 1)) << 32);
459 regcache_raw_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
464 /* Return PC of first real instruction of the function starting at
468 sparc64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
470 struct symtab_and_line sal;
471 CORE_ADDR func_start, func_end;
472 struct sparc_frame_cache cache;
474 /* This is the preferred method, find the end of the prologue by
475 using the debugging information. */
476 if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
478 sal = find_pc_line (func_start, 0);
480 if (sal.end < func_end
481 && start_pc <= sal.end)
485 return sparc_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffULL,
491 static struct sparc_frame_cache *
492 sparc64_frame_cache (struct frame_info *this_frame, void **this_cache)
494 return sparc_frame_cache (this_frame, this_cache);
498 sparc64_frame_this_id (struct frame_info *this_frame, void **this_cache,
499 struct frame_id *this_id)
501 struct sparc_frame_cache *cache =
502 sparc64_frame_cache (this_frame, this_cache);
504 /* This marks the outermost frame. */
505 if (cache->base == 0)
508 (*this_id) = frame_id_build (cache->base, cache->pc);
511 static struct value *
512 sparc64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
515 struct gdbarch *gdbarch = get_frame_arch (this_frame);
516 struct sparc_frame_cache *cache =
517 sparc64_frame_cache (this_frame, this_cache);
519 if (regnum == SPARC64_PC_REGNUM || regnum == SPARC64_NPC_REGNUM)
521 CORE_ADDR pc = (regnum == SPARC64_NPC_REGNUM) ? 4 : 0;
523 regnum = cache->frameless_p ? SPARC_O7_REGNUM : SPARC_I7_REGNUM;
524 pc += get_frame_register_unsigned (this_frame, regnum) + 8;
525 return frame_unwind_got_constant (this_frame, regnum, pc);
528 /* Handle StackGhost. */
530 ULONGEST wcookie = sparc_fetch_wcookie (gdbarch);
532 if (wcookie != 0 && !cache->frameless_p && regnum == SPARC_I7_REGNUM)
534 CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 8;
537 /* Read the value in from memory. */
538 i7 = get_frame_memory_unsigned (this_frame, addr, 8);
539 return frame_unwind_got_constant (this_frame, regnum, i7 ^ wcookie);
543 /* The previous frame's `local' and `in' registers have been saved
544 in the register save area. */
545 if (!cache->frameless_p
546 && regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM)
548 CORE_ADDR addr = cache->base + (regnum - SPARC_L0_REGNUM) * 8;
550 return frame_unwind_got_memory (this_frame, regnum, addr);
553 /* The previous frame's `out' registers are accessable as the
554 current frame's `in' registers. */
555 if (!cache->frameless_p
556 && regnum >= SPARC_O0_REGNUM && regnum <= SPARC_O7_REGNUM)
557 regnum += (SPARC_I0_REGNUM - SPARC_O0_REGNUM);
559 return frame_unwind_got_register (this_frame, regnum, regnum);
562 static const struct frame_unwind sparc64_frame_unwind =
565 default_frame_unwind_stop_reason,
566 sparc64_frame_this_id,
567 sparc64_frame_prev_register,
569 default_frame_sniffer
574 sparc64_frame_base_address (struct frame_info *this_frame, void **this_cache)
576 struct sparc_frame_cache *cache =
577 sparc64_frame_cache (this_frame, this_cache);
582 static const struct frame_base sparc64_frame_base =
584 &sparc64_frame_unwind,
585 sparc64_frame_base_address,
586 sparc64_frame_base_address,
587 sparc64_frame_base_address
590 /* Check whether TYPE must be 16-byte aligned. */
593 sparc64_16_byte_align_p (struct type *type)
595 if (sparc64_floating_p (type) && TYPE_LENGTH (type) == 16)
598 if (sparc64_structure_or_union_p (type))
602 for (i = 0; i < TYPE_NFIELDS (type); i++)
604 struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
606 if (sparc64_16_byte_align_p (subtype))
614 /* Store floating fields of element ELEMENT of an "parameter array"
615 that has type TYPE and is stored at BITPOS in VALBUF in the
616 apropriate registers of REGCACHE. This function can be called
617 recursively and therefore handles floating types in addition to
621 sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
622 const gdb_byte *valbuf, int element, int bitpos)
624 gdb_assert (element < 16);
626 if (sparc64_floating_p (type))
628 int len = TYPE_LENGTH (type);
633 gdb_assert (bitpos == 0);
634 gdb_assert ((element % 2) == 0);
636 regnum = SPARC64_Q0_REGNUM + element / 2;
637 regcache_cooked_write (regcache, regnum, valbuf);
641 gdb_assert (bitpos == 0 || bitpos == 64);
643 regnum = SPARC64_D0_REGNUM + element + bitpos / 64;
644 regcache_cooked_write (regcache, regnum, valbuf + (bitpos / 8));
648 gdb_assert (len == 4);
649 gdb_assert (bitpos % 32 == 0 && bitpos >= 0 && bitpos < 128);
651 regnum = SPARC_F0_REGNUM + element * 2 + bitpos / 32;
652 regcache_cooked_write (regcache, regnum, valbuf + (bitpos / 8));
655 else if (sparc64_structure_or_union_p (type))
659 for (i = 0; i < TYPE_NFIELDS (type); i++)
661 struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
662 int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
664 sparc64_store_floating_fields (regcache, subtype, valbuf,
668 /* GCC has an interesting bug. If TYPE is a structure that has
669 a single `float' member, GCC doesn't treat it as a structure
670 at all, but rather as an ordinary `float' argument. This
671 argument will be stored in %f1, as required by the psABI.
672 However, as a member of a structure the psABI requires it to
673 be stored in %f0. This bug is present in GCC 3.3.2, but
674 probably in older releases to. To appease GCC, if a
675 structure has only a single `float' member, we store its
676 value in %f1 too (we already have stored in %f0). */
677 if (TYPE_NFIELDS (type) == 1)
679 struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0));
681 if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4)
682 regcache_cooked_write (regcache, SPARC_F1_REGNUM, valbuf);
687 /* Fetch floating fields from a variable of type TYPE from the
688 appropriate registers for BITPOS in REGCACHE and store it at BITPOS
689 in VALBUF. This function can be called recursively and therefore
690 handles floating types in addition to structures. */
693 sparc64_extract_floating_fields (struct regcache *regcache, struct type *type,
694 gdb_byte *valbuf, int bitpos)
696 if (sparc64_floating_p (type))
698 int len = TYPE_LENGTH (type);
703 gdb_assert (bitpos == 0 || bitpos == 128);
705 regnum = SPARC64_Q0_REGNUM + bitpos / 128;
706 regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8));
710 gdb_assert (bitpos % 64 == 0 && bitpos >= 0 && bitpos < 256);
712 regnum = SPARC64_D0_REGNUM + bitpos / 64;
713 regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8));
717 gdb_assert (len == 4);
718 gdb_assert (bitpos % 32 == 0 && bitpos >= 0 && bitpos < 256);
720 regnum = SPARC_F0_REGNUM + bitpos / 32;
721 regcache_cooked_read (regcache, regnum, valbuf + (bitpos / 8));
724 else if (sparc64_structure_or_union_p (type))
728 for (i = 0; i < TYPE_NFIELDS (type); i++)
730 struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i));
731 int subpos = bitpos + TYPE_FIELD_BITPOS (type, i);
733 sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos);
738 /* Store the NARGS arguments ARGS and STRUCT_ADDR (if STRUCT_RETURN is
739 non-zero) in REGCACHE and on the stack (starting from address SP). */
742 sparc64_store_arguments (struct regcache *regcache, int nargs,
743 struct value **args, CORE_ADDR sp,
744 int struct_return, CORE_ADDR struct_addr)
746 struct gdbarch *gdbarch = get_regcache_arch (regcache);
747 /* Number of extended words in the "parameter array". */
748 int num_elements = 0;
752 /* Take BIAS into account. */
755 /* First we calculate the number of extended words in the "parameter
756 array". While doing so we also convert some of the arguments. */
761 for (i = 0; i < nargs; i++)
763 struct type *type = value_type (args[i]);
764 int len = TYPE_LENGTH (type);
766 if (sparc64_structure_or_union_p (type))
768 /* Structure or Union arguments. */
771 if (num_elements % 2 && sparc64_16_byte_align_p (type))
773 num_elements += ((len + 7) / 8);
777 /* The psABI says that "Structures or unions larger than
778 sixteen bytes are copied by the caller and passed
779 indirectly; the caller will pass the address of a
780 correctly aligned structure value. This sixty-four
781 bit address will occupy one word in the parameter
782 array, and may be promoted to an %o register like any
783 other pointer value." Allocate memory for these
784 values on the stack. */
787 /* Use 16-byte alignment for these values. That's
788 always correct, and wasting a few bytes shouldn't be
792 write_memory (sp, value_contents (args[i]), len);
793 args[i] = value_from_pointer (lookup_pointer_type (type), sp);
797 else if (sparc64_floating_p (type))
799 /* Floating arguments. */
803 /* The psABI says that "Each quad-precision parameter
804 value will be assigned to two extended words in the
808 /* The psABI says that "Long doubles must be
809 quad-aligned, and thus a hole might be introduced
810 into the parameter array to force alignment." Skip
811 an element if necessary. */
812 if (num_elements % 2)
820 /* Integral and pointer arguments. */
821 gdb_assert (sparc64_integral_or_pointer_p (type));
823 /* The psABI says that "Each argument value of integral type
824 smaller than an extended word will be widened by the
825 caller to an extended word according to the signed-ness
826 of the argument type." */
828 args[i] = value_cast (builtin_type (gdbarch)->builtin_int64,
834 /* Allocate the "parameter array". */
835 sp -= num_elements * 8;
837 /* The psABI says that "Every stack frame must be 16-byte aligned." */
840 /* Now we store the arguments in to the "paramater array". Some
841 Integer or Pointer arguments and Structure or Union arguments
842 will be passed in %o registers. Some Floating arguments and
843 floating members of structures are passed in floating-point
844 registers. However, for functions with variable arguments,
845 floating arguments are stored in an %0 register, and for
846 functions without a prototype floating arguments are stored in
847 both a floating-point and an %o registers, or a floating-point
848 register and memory. To simplify the logic here we always pass
849 arguments in memory, an %o register, and a floating-point
850 register if appropriate. This should be no problem since the
851 contents of any unused memory or registers in the "parameter
852 array" are undefined. */
856 regcache_cooked_write_unsigned (regcache, SPARC_O0_REGNUM, struct_addr);
860 for (i = 0; i < nargs; i++)
862 const gdb_byte *valbuf = value_contents (args[i]);
863 struct type *type = value_type (args[i]);
864 int len = TYPE_LENGTH (type);
868 if (sparc64_structure_or_union_p (type))
870 /* Structure or Union arguments. */
871 gdb_assert (len <= 16);
872 memset (buf, 0, sizeof (buf));
873 valbuf = memcpy (buf, valbuf, len);
875 if (element % 2 && sparc64_16_byte_align_p (type))
880 regnum = SPARC_O0_REGNUM + element;
881 if (len > 8 && element < 5)
882 regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
886 sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
888 else if (sparc64_floating_p (type))
890 /* Floating arguments. */
896 regnum = SPARC64_Q0_REGNUM + element / 2;
901 regnum = SPARC64_D0_REGNUM + element;
905 /* The psABI says "Each single-precision parameter value
906 will be assigned to one extended word in the
907 parameter array, and right-justified within that
908 word; the left half (even floatregister) is
909 undefined." Even though the psABI says that "the
910 left half is undefined", set it to zero here. */
912 memcpy (buf + 4, valbuf, 4);
916 regnum = SPARC64_D0_REGNUM + element;
921 /* Integral and pointer arguments. */
922 gdb_assert (len == 8);
924 regnum = SPARC_O0_REGNUM + element;
929 regcache_cooked_write (regcache, regnum, valbuf);
931 /* If we're storing the value in a floating-point register,
932 also store it in the corresponding %0 register(s). */
933 if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
935 gdb_assert (element < 6);
936 regnum = SPARC_O0_REGNUM + element;
937 regcache_cooked_write (regcache, regnum, valbuf);
939 else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
941 gdb_assert (element < 6);
942 regnum = SPARC_O0_REGNUM + element;
943 regcache_cooked_write (regcache, regnum, valbuf);
944 regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
948 /* Always store the argument in memory. */
949 write_memory (sp + element * 8, valbuf, len);
950 element += ((len + 7) / 8);
953 gdb_assert (element == num_elements);
955 /* Take BIAS into account. */
961 sparc64_frame_align (struct gdbarch *gdbarch, CORE_ADDR address)
963 /* The ABI requires 16-byte alignment. */
964 return address & ~0xf;
968 sparc64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
969 struct regcache *regcache, CORE_ADDR bp_addr,
970 int nargs, struct value **args, CORE_ADDR sp,
971 int struct_return, CORE_ADDR struct_addr)
973 /* Set return address. */
974 regcache_cooked_write_unsigned (regcache, SPARC_O7_REGNUM, bp_addr - 8);
976 /* Set up function arguments. */
977 sp = sparc64_store_arguments (regcache, nargs, args, sp,
978 struct_return, struct_addr);
980 /* Allocate the register save area. */
983 /* Stack should be 16-byte aligned at this point. */
984 gdb_assert ((sp + BIAS) % 16 == 0);
986 /* Finally, update the stack pointer. */
987 regcache_cooked_write_unsigned (regcache, SPARC_SP_REGNUM, sp);
993 /* Extract from an array REGBUF containing the (raw) register state, a
994 function return value of TYPE, and copy that into VALBUF. */
997 sparc64_extract_return_value (struct type *type, struct regcache *regcache,
1000 int len = TYPE_LENGTH (type);
1004 if (sparc64_structure_or_union_p (type))
1006 /* Structure or Union return values. */
1007 gdb_assert (len <= 32);
1009 for (i = 0; i < ((len + 7) / 8); i++)
1010 regcache_cooked_read (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
1011 if (TYPE_CODE (type) != TYPE_CODE_UNION)
1012 sparc64_extract_floating_fields (regcache, type, buf, 0);
1013 memcpy (valbuf, buf, len);
1015 else if (sparc64_floating_p (type))
1017 /* Floating return values. */
1018 for (i = 0; i < len / 4; i++)
1019 regcache_cooked_read (regcache, SPARC_F0_REGNUM + i, buf + i * 4);
1020 memcpy (valbuf, buf, len);
1022 else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
1024 /* Small arrays are returned the same way as small structures. */
1025 gdb_assert (len <= 32);
1027 for (i = 0; i < ((len + 7) / 8); i++)
1028 regcache_cooked_read (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
1029 memcpy (valbuf, buf, len);
1033 /* Integral and pointer return values. */
1034 gdb_assert (sparc64_integral_or_pointer_p (type));
1036 /* Just stripping off any unused bytes should preserve the
1037 signed-ness just fine. */
1038 regcache_cooked_read (regcache, SPARC_O0_REGNUM, buf);
1039 memcpy (valbuf, buf + 8 - len, len);
1043 /* Write into the appropriate registers a function return value stored
1044 in VALBUF of type TYPE. */
1047 sparc64_store_return_value (struct type *type, struct regcache *regcache,
1048 const gdb_byte *valbuf)
1050 int len = TYPE_LENGTH (type);
1054 if (sparc64_structure_or_union_p (type))
1056 /* Structure or Union return values. */
1057 gdb_assert (len <= 32);
1059 /* Simplify matters by storing the complete value (including
1060 floating members) into %o0 and %o1. Floating members are
1061 also store in the appropriate floating-point registers. */
1062 memset (buf, 0, sizeof (buf));
1063 memcpy (buf, valbuf, len);
1064 for (i = 0; i < ((len + 7) / 8); i++)
1065 regcache_cooked_write (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
1066 if (TYPE_CODE (type) != TYPE_CODE_UNION)
1067 sparc64_store_floating_fields (regcache, type, buf, 0, 0);
1069 else if (sparc64_floating_p (type))
1071 /* Floating return values. */
1072 memcpy (buf, valbuf, len);
1073 for (i = 0; i < len / 4; i++)
1074 regcache_cooked_write (regcache, SPARC_F0_REGNUM + i, buf + i * 4);
1076 else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
1078 /* Small arrays are returned the same way as small structures. */
1079 gdb_assert (len <= 32);
1081 memset (buf, 0, sizeof (buf));
1082 memcpy (buf, valbuf, len);
1083 for (i = 0; i < ((len + 7) / 8); i++)
1084 regcache_cooked_write (regcache, SPARC_O0_REGNUM + i, buf + i * 8);
1088 /* Integral and pointer return values. */
1089 gdb_assert (sparc64_integral_or_pointer_p (type));
1091 /* ??? Do we need to do any sign-extension here? */
1093 memcpy (buf + 8 - len, valbuf, len);
1094 regcache_cooked_write (regcache, SPARC_O0_REGNUM, buf);
1098 static enum return_value_convention
1099 sparc64_return_value (struct gdbarch *gdbarch, struct type *func_type,
1100 struct type *type, struct regcache *regcache,
1101 gdb_byte *readbuf, const gdb_byte *writebuf)
1103 if (TYPE_LENGTH (type) > 32)
1104 return RETURN_VALUE_STRUCT_CONVENTION;
1107 sparc64_extract_return_value (type, regcache, readbuf);
1109 sparc64_store_return_value (type, regcache, writebuf);
1111 return RETURN_VALUE_REGISTER_CONVENTION;
1116 sparc64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
1117 struct dwarf2_frame_state_reg *reg,
1118 struct frame_info *this_frame)
1122 case SPARC_G0_REGNUM:
1123 /* Since %g0 is always zero, there is no point in saving it, and
1124 people will be inclined omit it from the CFI. Make sure we
1125 don't warn about that. */
1126 reg->how = DWARF2_FRAME_REG_SAME_VALUE;
1128 case SPARC_SP_REGNUM:
1129 reg->how = DWARF2_FRAME_REG_CFA;
1131 case SPARC64_PC_REGNUM:
1132 reg->how = DWARF2_FRAME_REG_RA_OFFSET;
1133 reg->loc.offset = 8;
1135 case SPARC64_NPC_REGNUM:
1136 reg->how = DWARF2_FRAME_REG_RA_OFFSET;
1137 reg->loc.offset = 12;
1143 sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
1145 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1147 tdep->pc_regnum = SPARC64_PC_REGNUM;
1148 tdep->npc_regnum = SPARC64_NPC_REGNUM;
1150 /* This is what all the fuss is about. */
1151 set_gdbarch_long_bit (gdbarch, 64);
1152 set_gdbarch_long_long_bit (gdbarch, 64);
1153 set_gdbarch_ptr_bit (gdbarch, 64);
1155 set_gdbarch_num_regs (gdbarch, SPARC64_NUM_REGS);
1156 set_gdbarch_register_name (gdbarch, sparc64_register_name);
1157 set_gdbarch_register_type (gdbarch, sparc64_register_type);
1158 set_gdbarch_num_pseudo_regs (gdbarch, SPARC64_NUM_PSEUDO_REGS);
1159 set_gdbarch_pseudo_register_read (gdbarch, sparc64_pseudo_register_read);
1160 set_gdbarch_pseudo_register_write (gdbarch, sparc64_pseudo_register_write);
1162 /* Register numbers of various important registers. */
1163 set_gdbarch_pc_regnum (gdbarch, SPARC64_PC_REGNUM); /* %pc */
1165 /* Call dummy code. */
1166 set_gdbarch_frame_align (gdbarch, sparc64_frame_align);
1167 set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
1168 set_gdbarch_push_dummy_code (gdbarch, NULL);
1169 set_gdbarch_push_dummy_call (gdbarch, sparc64_push_dummy_call);
1171 set_gdbarch_return_value (gdbarch, sparc64_return_value);
1172 set_gdbarch_stabs_argument_has_addr
1173 (gdbarch, default_stabs_argument_has_addr);
1175 set_gdbarch_skip_prologue (gdbarch, sparc64_skip_prologue);
1177 /* Hook in the DWARF CFI frame unwinder. */
1178 dwarf2_frame_set_init_reg (gdbarch, sparc64_dwarf2_frame_init_reg);
1179 /* FIXME: kettenis/20050423: Don't enable the unwinder until the
1180 StackGhost issues have been resolved. */
1182 frame_unwind_append_unwinder (gdbarch, &sparc64_frame_unwind);
1183 frame_base_set_default (gdbarch, &sparc64_frame_base);
1187 /* Helper functions for dealing with register sets. */
1189 #define TSTATE_CWP 0x000000000000001fULL
1190 #define TSTATE_ICC 0x0000000f00000000ULL
1191 #define TSTATE_XCC 0x000000f000000000ULL
1193 #define PSR_S 0x00000080
1194 #define PSR_ICC 0x00f00000
1195 #define PSR_VERS 0x0f000000
1196 #define PSR_IMPL 0xf0000000
1197 #define PSR_V8PLUS 0xff000000
1198 #define PSR_XCC 0x000f0000
1201 sparc64_supply_gregset (const struct sparc_gregset *gregset,
1202 struct regcache *regcache,
1203 int regnum, const void *gregs)
1205 struct gdbarch *gdbarch = get_regcache_arch (regcache);
1206 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1207 int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
1208 const gdb_byte *regs = gregs;
1209 gdb_byte zero[8] = { 0 };
1214 if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
1216 int offset = gregset->r_tstate_offset;
1217 ULONGEST tstate, psr;
1220 tstate = extract_unsigned_integer (regs + offset, 8, byte_order);
1221 psr = ((tstate & TSTATE_CWP) | PSR_S | ((tstate & TSTATE_ICC) >> 12)
1222 | ((tstate & TSTATE_XCC) >> 20) | PSR_V8PLUS);
1223 store_unsigned_integer (buf, 4, byte_order, psr);
1224 regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, buf);
1227 if (regnum == SPARC32_PC_REGNUM || regnum == -1)
1228 regcache_raw_supply (regcache, SPARC32_PC_REGNUM,
1229 regs + gregset->r_pc_offset + 4);
1231 if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
1232 regcache_raw_supply (regcache, SPARC32_NPC_REGNUM,
1233 regs + gregset->r_npc_offset + 4);
1235 if (regnum == SPARC32_Y_REGNUM || regnum == -1)
1237 int offset = gregset->r_y_offset + 8 - gregset->r_y_size;
1238 regcache_raw_supply (regcache, SPARC32_Y_REGNUM, regs + offset);
1243 if (regnum == SPARC64_STATE_REGNUM || regnum == -1)
1244 regcache_raw_supply (regcache, SPARC64_STATE_REGNUM,
1245 regs + gregset->r_tstate_offset);
1247 if (regnum == SPARC64_PC_REGNUM || regnum == -1)
1248 regcache_raw_supply (regcache, SPARC64_PC_REGNUM,
1249 regs + gregset->r_pc_offset);
1251 if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
1252 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM,
1253 regs + gregset->r_npc_offset);
1255 if (regnum == SPARC64_Y_REGNUM || regnum == -1)
1260 memcpy (buf + 8 - gregset->r_y_size,
1261 regs + gregset->r_y_offset, gregset->r_y_size);
1262 regcache_raw_supply (regcache, SPARC64_Y_REGNUM, buf);
1265 if ((regnum == SPARC64_FPRS_REGNUM || regnum == -1)
1266 && gregset->r_fprs_offset != -1)
1267 regcache_raw_supply (regcache, SPARC64_FPRS_REGNUM,
1268 regs + gregset->r_fprs_offset);
1271 if (regnum == SPARC_G0_REGNUM || regnum == -1)
1272 regcache_raw_supply (regcache, SPARC_G0_REGNUM, &zero);
1274 if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
1276 int offset = gregset->r_g1_offset;
1281 for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
1283 if (regnum == i || regnum == -1)
1284 regcache_raw_supply (regcache, i, regs + offset);
1289 if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
1291 /* Not all of the register set variants include Locals and
1292 Inputs. For those that don't, we read them off the stack. */
1293 if (gregset->r_l0_offset == -1)
1297 regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp);
1298 sparc_supply_rwindow (regcache, sp, regnum);
1302 int offset = gregset->r_l0_offset;
1307 for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
1309 if (regnum == i || regnum == -1)
1310 regcache_raw_supply (regcache, i, regs + offset);
1318 sparc64_collect_gregset (const struct sparc_gregset *gregset,
1319 const struct regcache *regcache,
1320 int regnum, void *gregs)
1322 struct gdbarch *gdbarch = get_regcache_arch (regcache);
1323 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1324 int sparc32 = (gdbarch_ptr_bit (gdbarch) == 32);
1325 gdb_byte *regs = gregs;
1330 if (regnum == SPARC32_PSR_REGNUM || regnum == -1)
1332 int offset = gregset->r_tstate_offset;
1333 ULONGEST tstate, psr;
1336 tstate = extract_unsigned_integer (regs + offset, 8, byte_order);
1337 regcache_raw_collect (regcache, SPARC32_PSR_REGNUM, buf);
1338 psr = extract_unsigned_integer (buf, 4, byte_order);
1339 tstate |= (psr & PSR_ICC) << 12;
1340 if ((psr & (PSR_VERS | PSR_IMPL)) == PSR_V8PLUS)
1341 tstate |= (psr & PSR_XCC) << 20;
1342 store_unsigned_integer (buf, 8, byte_order, tstate);
1343 memcpy (regs + offset, buf, 8);
1346 if (regnum == SPARC32_PC_REGNUM || regnum == -1)
1347 regcache_raw_collect (regcache, SPARC32_PC_REGNUM,
1348 regs + gregset->r_pc_offset + 4);
1350 if (regnum == SPARC32_NPC_REGNUM || regnum == -1)
1351 regcache_raw_collect (regcache, SPARC32_NPC_REGNUM,
1352 regs + gregset->r_npc_offset + 4);
1354 if (regnum == SPARC32_Y_REGNUM || regnum == -1)
1356 int offset = gregset->r_y_offset + 8 - gregset->r_y_size;
1357 regcache_raw_collect (regcache, SPARC32_Y_REGNUM, regs + offset);
1362 if (regnum == SPARC64_STATE_REGNUM || regnum == -1)
1363 regcache_raw_collect (regcache, SPARC64_STATE_REGNUM,
1364 regs + gregset->r_tstate_offset);
1366 if (regnum == SPARC64_PC_REGNUM || regnum == -1)
1367 regcache_raw_collect (regcache, SPARC64_PC_REGNUM,
1368 regs + gregset->r_pc_offset);
1370 if (regnum == SPARC64_NPC_REGNUM || regnum == -1)
1371 regcache_raw_collect (regcache, SPARC64_NPC_REGNUM,
1372 regs + gregset->r_npc_offset);
1374 if (regnum == SPARC64_Y_REGNUM || regnum == -1)
1378 regcache_raw_collect (regcache, SPARC64_Y_REGNUM, buf);
1379 memcpy (regs + gregset->r_y_offset,
1380 buf + 8 - gregset->r_y_size, gregset->r_y_size);
1383 if ((regnum == SPARC64_FPRS_REGNUM || regnum == -1)
1384 && gregset->r_fprs_offset != -1)
1385 regcache_raw_collect (regcache, SPARC64_FPRS_REGNUM,
1386 regs + gregset->r_fprs_offset);
1390 if ((regnum >= SPARC_G1_REGNUM && regnum <= SPARC_O7_REGNUM) || regnum == -1)
1392 int offset = gregset->r_g1_offset;
1397 /* %g0 is always zero. */
1398 for (i = SPARC_G1_REGNUM; i <= SPARC_O7_REGNUM; i++)
1400 if (regnum == i || regnum == -1)
1401 regcache_raw_collect (regcache, i, regs + offset);
1406 if ((regnum >= SPARC_L0_REGNUM && regnum <= SPARC_I7_REGNUM) || regnum == -1)
1408 /* Not all of the register set variants include Locals and
1409 Inputs. For those that don't, we read them off the stack. */
1410 if (gregset->r_l0_offset != -1)
1412 int offset = gregset->r_l0_offset;
1417 for (i = SPARC_L0_REGNUM; i <= SPARC_I7_REGNUM; i++)
1419 if (regnum == i || regnum == -1)
1420 regcache_raw_collect (regcache, i, regs + offset);
1428 sparc64_supply_fpregset (struct regcache *regcache,
1429 int regnum, const void *fpregs)
1431 int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
1432 const gdb_byte *regs = fpregs;
1435 for (i = 0; i < 32; i++)
1437 if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
1438 regcache_raw_supply (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
1443 if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
1444 regcache_raw_supply (regcache, SPARC32_FSR_REGNUM,
1445 regs + (32 * 4) + (16 * 8) + 4);
1449 for (i = 0; i < 16; i++)
1451 if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
1452 regcache_raw_supply (regcache, SPARC64_F32_REGNUM + i,
1453 regs + (32 * 4) + (i * 8));
1456 if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
1457 regcache_raw_supply (regcache, SPARC64_FSR_REGNUM,
1458 regs + (32 * 4) + (16 * 8));
1463 sparc64_collect_fpregset (const struct regcache *regcache,
1464 int regnum, void *fpregs)
1466 int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
1467 gdb_byte *regs = fpregs;
1470 for (i = 0; i < 32; i++)
1472 if (regnum == (SPARC_F0_REGNUM + i) || regnum == -1)
1473 regcache_raw_collect (regcache, SPARC_F0_REGNUM + i, regs + (i * 4));
1478 if (regnum == SPARC32_FSR_REGNUM || regnum == -1)
1479 regcache_raw_collect (regcache, SPARC32_FSR_REGNUM,
1480 regs + (32 * 4) + (16 * 8) + 4);
1484 for (i = 0; i < 16; i++)
1486 if (regnum == (SPARC64_F32_REGNUM + i) || regnum == -1)
1487 regcache_raw_collect (regcache, SPARC64_F32_REGNUM + i,
1488 regs + (32 * 4) + (i * 8));
1491 if (regnum == SPARC64_FSR_REGNUM || regnum == -1)
1492 regcache_raw_collect (regcache, SPARC64_FSR_REGNUM,
1493 regs + (32 * 4) + (16 * 8));