1 /* Target-dependent code for UltraSPARC.
3 Copyright (C) 2003-2020 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 3 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, see <http://www.gnu.org/licenses/>. */
21 #include "arch-utils.h"
22 #include "dwarf2-frame.h"
24 #include "frame-base.h"
25 #include "frame-unwind.h"
33 #include "target-descriptions.h"
37 #include "sparc64-tdep.h"
39 /* This file implements the SPARC 64-bit ABI as defined by the
40 section "Low-Level System Information" of the SPARC Compliance
41 Definition (SCD) 2.4.1, which is the 64-bit System V psABI for
44 /* Please use the sparc32_-prefix for 32-bit specific code, the
45 sparc64_-prefix for 64-bit specific code and the sparc_-prefix for
46 code can handle both. */
48 /* The M7 processor supports an Application Data Integrity (ADI) feature
49 that detects invalid data accesses. When software allocates memory and
50 enables ADI on the allocated memory, it chooses a 4-bit version number,
51 sets the version in the upper 4 bits of the 64-bit pointer to that data,
52 and stores the 4-bit version in every cacheline of the object. Hardware
53 saves the latter in spare bits in the cache and memory hierarchy. On each
54 load and store, the processor compares the upper 4 VA (virtual address) bits
55 to the cacheline's version. If there is a mismatch, the processor generates
56 a version mismatch trap which can be either precise or disrupting.
57 The trap is an error condition which the kernel delivers to the process
60 The upper 4 bits of the VA represent a version and are not part of the
61 true address. The processor clears these bits and sign extends bit 59
62 to generate the true address.
64 Note that 32-bit applications cannot use ADI. */
68 #include "cli/cli-utils.h"
72 #define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/9999/adi/lstatus")
74 /* ELF Auxiliary vectors */
76 #define AT_ADI_BLKSZ 34
79 #define AT_ADI_NBITS 35
81 #ifndef AT_ADI_UEONADI
82 #define AT_ADI_UEONADI 36
85 /* ADI command list. */
86 static struct cmd_list_element
*sparc64adilist
= NULL
;
88 /* ADI stat settings. */
91 /* The ADI block size. */
92 unsigned long blksize
;
94 /* Number of bits used for an ADI version tag which can be
95 used together with the shift value for an ADI version tag
96 to encode or extract the ADI version value in a pointer. */
99 /* The maximum ADI version tag value supported. */
102 /* ADI version tag file. */
105 /* ADI availability check has been done. */
106 bool checked_avail
= false;
108 /* ADI is available. */
109 bool is_avail
= false;
113 /* Per-process ADI stat info. */
115 typedef struct sparc64_adi_info
117 sparc64_adi_info (pid_t pid_
)
121 /* The process identifier. */
125 adi_stat_t stat
= {};
129 static std::forward_list
<sparc64_adi_info
> adi_proc_list
;
132 /* Get ADI info for process PID, creating one if it doesn't exist. */
134 static sparc64_adi_info
*
135 get_adi_info_proc (pid_t pid
)
137 auto found
= std::find_if (adi_proc_list
.begin (), adi_proc_list
.end (),
138 [&pid
] (const sparc64_adi_info
&info
)
140 return info
.pid
== pid
;
143 if (found
== adi_proc_list
.end ())
145 adi_proc_list
.emplace_front (pid
);
146 return &adi_proc_list
.front ();
155 get_adi_info (pid_t pid
)
157 sparc64_adi_info
*proc
;
159 proc
= get_adi_info_proc (pid
);
163 /* Is called when GDB is no longer debugging process PID. It
164 deletes data structure that keeps track of the ADI stat. */
167 sparc64_forget_process (pid_t pid
)
171 for (auto pit
= adi_proc_list
.before_begin (),
172 it
= std::next (pit
);
173 it
!= adi_proc_list
.end ();
176 if ((*it
).pid
== pid
)
178 if ((*it
).stat
.tag_fd
> 0)
179 target_fileio_close ((*it
).stat
.tag_fd
, &target_errno
);
180 adi_proc_list
.erase_after (pit
);
190 info_adi_command (const char *args
, int from_tty
)
192 printf_unfiltered ("\"adi\" must be followed by \"examine\" "
194 help_list (sparc64adilist
, "adi ", all_commands
, gdb_stdout
);
197 /* Read attributes of a maps entry in /proc/[pid]/adi/maps. */
200 read_maps_entry (const char *line
,
201 ULONGEST
*addr
, ULONGEST
*endaddr
)
203 const char *p
= line
;
205 *addr
= strtoulst (p
, &p
, 16);
209 *endaddr
= strtoulst (p
, &p
, 16);
212 /* Check if ADI is available. */
217 pid_t pid
= inferior_ptid
.pid ();
218 sparc64_adi_info
*proc
= get_adi_info_proc (pid
);
221 if (proc
->stat
.checked_avail
)
222 return proc
->stat
.is_avail
;
224 proc
->stat
.checked_avail
= true;
225 if (target_auxv_search (current_top_target (), AT_ADI_BLKSZ
, &value
) <= 0)
227 proc
->stat
.blksize
= value
;
228 target_auxv_search (current_top_target (), AT_ADI_NBITS
, &value
);
229 proc
->stat
.nbits
= value
;
230 proc
->stat
.max_version
= (1 << proc
->stat
.nbits
) - 2;
231 proc
->stat
.is_avail
= true;
233 return proc
->stat
.is_avail
;
236 /* Normalize a versioned address - a VA with ADI bits (63-60) set. */
239 adi_normalize_address (CORE_ADDR addr
)
241 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
245 /* Clear upper bits. */
246 addr
&= ((uint64_t) -1) >> ast
.nbits
;
249 CORE_ADDR signbit
= (uint64_t) 1 << (64 - ast
.nbits
- 1);
250 return (addr
^ signbit
) - signbit
;
255 /* Align a normalized address - a VA with bit 59 sign extended into
259 adi_align_address (CORE_ADDR naddr
)
261 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
263 return (naddr
- (naddr
% ast
.blksize
)) / ast
.blksize
;
266 /* Convert a byte count to count at a ratio of 1:adi_blksz. */
269 adi_convert_byte_count (CORE_ADDR naddr
, int nbytes
, CORE_ADDR locl
)
271 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
273 return ((naddr
+ nbytes
+ ast
.blksize
- 1) / ast
.blksize
) - locl
;
276 /* The /proc/[pid]/adi/tags file, which allows gdb to get/set ADI
277 version in a target process, maps linearly to the address space
278 of the target process at a ratio of 1:adi_blksz.
280 A read (or write) at offset K in the file returns (or modifies)
281 the ADI version tag stored in the cacheline containing address
282 K * adi_blksz, encoded as 1 version tag per byte. The allowed
283 version tag values are between 0 and adi_stat.max_version. */
288 pid_t pid
= inferior_ptid
.pid ();
289 sparc64_adi_info
*proc
= get_adi_info_proc (pid
);
291 if (proc
->stat
.tag_fd
!= 0)
292 return proc
->stat
.tag_fd
;
294 char cl_name
[MAX_PROC_NAME_SIZE
];
295 snprintf (cl_name
, sizeof(cl_name
), "/proc/%ld/adi/tags", (long) pid
);
297 proc
->stat
.tag_fd
= target_fileio_open (NULL
, cl_name
, O_RDWR
|O_EXCL
,
299 return proc
->stat
.tag_fd
;
302 /* Check if an address set is ADI enabled, using /proc/[pid]/adi/maps
303 which was exported by the kernel and contains the currently ADI
304 mapped memory regions and their access permissions. */
307 adi_is_addr_mapped (CORE_ADDR vaddr
, size_t cnt
)
309 char filename
[MAX_PROC_NAME_SIZE
];
312 pid_t pid
= inferior_ptid
.pid ();
313 snprintf (filename
, sizeof filename
, "/proc/%ld/adi/maps", (long) pid
);
314 gdb::unique_xmalloc_ptr
<char> data
315 = target_fileio_read_stralloc (NULL
, filename
);
318 adi_stat_t adi_stat
= get_adi_info (pid
);
320 for (char *line
= strtok_r (data
.get (), "\n", &saveptr
);
322 line
= strtok_r (NULL
, "\n", &saveptr
))
324 ULONGEST addr
, endaddr
;
326 read_maps_entry (line
, &addr
, &endaddr
);
328 while (((vaddr
+ i
) * adi_stat
.blksize
) >= addr
329 && ((vaddr
+ i
) * adi_stat
.blksize
) < endaddr
)
337 warning (_("unable to open /proc file '%s'"), filename
);
342 /* Read ADI version tag value for memory locations starting at "VADDR"
343 for "SIZE" number of bytes. */
346 adi_read_versions (CORE_ADDR vaddr
, size_t size
, gdb_byte
*tags
)
348 int fd
= adi_tag_fd ();
352 if (!adi_is_addr_mapped (vaddr
, size
))
354 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
355 error(_("Address at %s is not in ADI maps"),
356 paddress (target_gdbarch (), vaddr
* ast
.blksize
));
360 return target_fileio_pread (fd
, tags
, size
, vaddr
, &target_errno
);
363 /* Write ADI version tag for memory locations starting at "VADDR" for
364 "SIZE" number of bytes to "TAGS". */
367 adi_write_versions (CORE_ADDR vaddr
, size_t size
, unsigned char *tags
)
369 int fd
= adi_tag_fd ();
373 if (!adi_is_addr_mapped (vaddr
, size
))
375 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
376 error(_("Address at %s is not in ADI maps"),
377 paddress (target_gdbarch (), vaddr
* ast
.blksize
));
381 return target_fileio_pwrite (fd
, tags
, size
, vaddr
, &target_errno
);
384 /* Print ADI version tag value in "TAGS" for memory locations starting
385 at "VADDR" with number of "CNT". */
388 adi_print_versions (CORE_ADDR vaddr
, size_t cnt
, gdb_byte
*tags
)
391 const int maxelts
= 8; /* # of elements per line */
393 adi_stat_t adi_stat
= get_adi_info (inferior_ptid
.pid ());
398 printf_filtered ("%s:\t",
399 paddress (target_gdbarch (), vaddr
* adi_stat
.blksize
));
400 for (int i
= maxelts
; i
> 0 && cnt
> 0; i
--, cnt
--)
402 if (tags
[v_idx
] == 0xff) /* no version tag */
403 printf_filtered ("-");
405 printf_filtered ("%1X", tags
[v_idx
]);
407 printf_filtered (" ");
410 printf_filtered ("\n");
416 do_examine (CORE_ADDR start
, int bcnt
)
418 CORE_ADDR vaddr
= adi_normalize_address (start
);
420 CORE_ADDR vstart
= adi_align_address (vaddr
);
421 int cnt
= adi_convert_byte_count (vaddr
, bcnt
, vstart
);
422 gdb::def_vector
<gdb_byte
> buf (cnt
);
423 int read_cnt
= adi_read_versions (vstart
, cnt
, buf
.data ());
425 error (_("No ADI information"));
426 else if (read_cnt
< cnt
)
427 error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr
));
429 adi_print_versions (vstart
, cnt
, buf
.data ());
433 do_assign (CORE_ADDR start
, size_t bcnt
, int version
)
435 CORE_ADDR vaddr
= adi_normalize_address (start
);
437 CORE_ADDR vstart
= adi_align_address (vaddr
);
438 int cnt
= adi_convert_byte_count (vaddr
, bcnt
, vstart
);
439 std::vector
<unsigned char> buf (cnt
, version
);
440 int set_cnt
= adi_write_versions (vstart
, cnt
, buf
.data ());
443 error (_("No ADI information"));
444 else if (set_cnt
< cnt
)
445 error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr
));
449 /* ADI examine version tag command.
453 adi (examine|x)[/COUNT] [ADDR] */
456 adi_examine_command (const char *args
, int from_tty
)
458 /* make sure program is active and adi is available */
459 if (!target_has_execution
)
460 error (_("ADI command requires a live process/thread"));
462 if (!adi_available ())
463 error (_("No ADI information"));
466 const char *p
= args
;
470 cnt
= get_number (&p
);
473 CORE_ADDR next_address
= 0;
474 if (p
!= 0 && *p
!= 0)
475 next_address
= parse_and_eval_address (p
);
476 if (!cnt
|| !next_address
)
477 error (_("Usage: adi examine|x[/COUNT] [ADDR]"));
479 do_examine (next_address
, cnt
);
482 /* ADI assign version tag command.
486 adi (assign|a)[/COUNT] ADDR = VERSION */
489 adi_assign_command (const char *args
, int from_tty
)
491 static const char *adi_usage
492 = N_("Usage: adi assign|a[/COUNT] ADDR = VERSION");
494 /* make sure program is active and adi is available */
495 if (!target_has_execution
)
496 error (_("ADI command requires a live process/thread"));
498 if (!adi_available ())
499 error (_("No ADI information"));
501 const char *exp
= args
;
503 error_no_arg (_(adi_usage
));
505 char *q
= (char *) strchr (exp
, '=');
509 error ("%s", _(adi_usage
));
512 const char *p
= args
;
513 if (exp
&& *exp
== '/')
516 cnt
= get_number (&p
);
519 CORE_ADDR next_address
= 0;
520 if (p
!= 0 && *p
!= 0)
521 next_address
= parse_and_eval_address (p
);
523 error ("%s", _(adi_usage
));
526 if (q
!= NULL
) /* parse version tag */
528 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
529 version
= parse_and_eval_long (q
);
530 if (version
< 0 || version
> ast
.max_version
)
531 error (_("Invalid ADI version tag %d"), version
);
534 do_assign (next_address
, cnt
, version
);
537 void _initialize_sparc64_adi_tdep ();
539 _initialize_sparc64_adi_tdep ()
542 add_prefix_cmd ("adi", class_support
, info_adi_command
,
543 _("ADI version related commands."),
544 &sparc64adilist
, "adi ", 0, &cmdlist
);
545 add_cmd ("examine", class_support
, adi_examine_command
,
546 _("Examine ADI versions."), &sparc64adilist
);
547 add_alias_cmd ("x", "examine", no_class
, 1, &sparc64adilist
);
548 add_cmd ("assign", class_support
, adi_assign_command
,
549 _("Assign ADI versions."), &sparc64adilist
);
554 /* The functions on this page are intended to be used to classify
555 function arguments. */
557 /* Check whether TYPE is "Integral or Pointer". */
560 sparc64_integral_or_pointer_p (const struct type
*type
)
562 switch (TYPE_CODE (type
))
568 case TYPE_CODE_RANGE
:
570 int len
= TYPE_LENGTH (type
);
571 gdb_assert (len
== 1 || len
== 2 || len
== 4 || len
== 8);
576 case TYPE_CODE_RVALUE_REF
:
578 int len
= TYPE_LENGTH (type
);
579 gdb_assert (len
== 8);
589 /* Check whether TYPE is "Floating". */
592 sparc64_floating_p (const struct type
*type
)
594 switch (TYPE_CODE (type
))
598 int len
= TYPE_LENGTH (type
);
599 gdb_assert (len
== 4 || len
== 8 || len
== 16);
609 /* Check whether TYPE is "Complex Floating". */
612 sparc64_complex_floating_p (const struct type
*type
)
614 switch (TYPE_CODE (type
))
616 case TYPE_CODE_COMPLEX
:
618 int len
= TYPE_LENGTH (type
);
619 gdb_assert (len
== 8 || len
== 16 || len
== 32);
629 /* Check whether TYPE is "Structure or Union".
631 In terms of Ada subprogram calls, arrays are treated the same as
632 struct and union types. So this function also returns non-zero
636 sparc64_structure_or_union_p (const struct type
*type
)
638 switch (TYPE_CODE (type
))
640 case TYPE_CODE_STRUCT
:
641 case TYPE_CODE_UNION
:
642 case TYPE_CODE_ARRAY
:
652 /* Construct types for ISA-specific registers. */
655 sparc64_pstate_type (struct gdbarch
*gdbarch
)
657 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
659 if (!tdep
->sparc64_pstate_type
)
663 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_pstate", 64);
664 append_flags_type_flag (type
, 0, "AG");
665 append_flags_type_flag (type
, 1, "IE");
666 append_flags_type_flag (type
, 2, "PRIV");
667 append_flags_type_flag (type
, 3, "AM");
668 append_flags_type_flag (type
, 4, "PEF");
669 append_flags_type_flag (type
, 5, "RED");
670 append_flags_type_flag (type
, 8, "TLE");
671 append_flags_type_flag (type
, 9, "CLE");
672 append_flags_type_flag (type
, 10, "PID0");
673 append_flags_type_flag (type
, 11, "PID1");
675 tdep
->sparc64_pstate_type
= type
;
678 return tdep
->sparc64_pstate_type
;
682 sparc64_ccr_type (struct gdbarch
*gdbarch
)
684 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
686 if (tdep
->sparc64_ccr_type
== NULL
)
690 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_ccr", 64);
691 append_flags_type_flag (type
, 0, "icc.c");
692 append_flags_type_flag (type
, 1, "icc.v");
693 append_flags_type_flag (type
, 2, "icc.z");
694 append_flags_type_flag (type
, 3, "icc.n");
695 append_flags_type_flag (type
, 4, "xcc.c");
696 append_flags_type_flag (type
, 5, "xcc.v");
697 append_flags_type_flag (type
, 6, "xcc.z");
698 append_flags_type_flag (type
, 7, "xcc.n");
700 tdep
->sparc64_ccr_type
= type
;
703 return tdep
->sparc64_ccr_type
;
707 sparc64_fsr_type (struct gdbarch
*gdbarch
)
709 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
711 if (!tdep
->sparc64_fsr_type
)
715 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_fsr", 64);
716 append_flags_type_flag (type
, 0, "NXC");
717 append_flags_type_flag (type
, 1, "DZC");
718 append_flags_type_flag (type
, 2, "UFC");
719 append_flags_type_flag (type
, 3, "OFC");
720 append_flags_type_flag (type
, 4, "NVC");
721 append_flags_type_flag (type
, 5, "NXA");
722 append_flags_type_flag (type
, 6, "DZA");
723 append_flags_type_flag (type
, 7, "UFA");
724 append_flags_type_flag (type
, 8, "OFA");
725 append_flags_type_flag (type
, 9, "NVA");
726 append_flags_type_flag (type
, 22, "NS");
727 append_flags_type_flag (type
, 23, "NXM");
728 append_flags_type_flag (type
, 24, "DZM");
729 append_flags_type_flag (type
, 25, "UFM");
730 append_flags_type_flag (type
, 26, "OFM");
731 append_flags_type_flag (type
, 27, "NVM");
733 tdep
->sparc64_fsr_type
= type
;
736 return tdep
->sparc64_fsr_type
;
740 sparc64_fprs_type (struct gdbarch
*gdbarch
)
742 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
744 if (!tdep
->sparc64_fprs_type
)
748 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_fprs", 64);
749 append_flags_type_flag (type
, 0, "DL");
750 append_flags_type_flag (type
, 1, "DU");
751 append_flags_type_flag (type
, 2, "FEF");
753 tdep
->sparc64_fprs_type
= type
;
756 return tdep
->sparc64_fprs_type
;
760 /* Register information. */
761 #define SPARC64_FPU_REGISTERS \
762 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
763 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
764 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
765 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
766 "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \
767 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62"
768 #define SPARC64_CP0_REGISTERS \
770 /* FIXME: Give "state" a name until we start using register groups. */ \
776 static const char *sparc64_fpu_register_names
[] = { SPARC64_FPU_REGISTERS
};
777 static const char *sparc64_cp0_register_names
[] = { SPARC64_CP0_REGISTERS
};
779 static const char *sparc64_register_names
[] =
781 SPARC_CORE_REGISTERS
,
782 SPARC64_FPU_REGISTERS
,
783 SPARC64_CP0_REGISTERS
786 /* Total number of registers. */
787 #define SPARC64_NUM_REGS ARRAY_SIZE (sparc64_register_names)
789 /* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
790 registers as "psuedo" registers. */
792 static const char *sparc64_pseudo_register_names
[] =
794 "cwp", "pstate", "asi", "ccr",
796 "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
797 "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30",
798 "d32", "d34", "d36", "d38", "d40", "d42", "d44", "d46",
799 "d48", "d50", "d52", "d54", "d56", "d58", "d60", "d62",
801 "q0", "q4", "q8", "q12", "q16", "q20", "q24", "q28",
802 "q32", "q36", "q40", "q44", "q48", "q52", "q56", "q60",
805 /* Total number of pseudo registers. */
806 #define SPARC64_NUM_PSEUDO_REGS ARRAY_SIZE (sparc64_pseudo_register_names)
808 /* Return the name of pseudo register REGNUM. */
811 sparc64_pseudo_register_name (struct gdbarch
*gdbarch
, int regnum
)
813 regnum
-= gdbarch_num_regs (gdbarch
);
815 if (regnum
< SPARC64_NUM_PSEUDO_REGS
)
816 return sparc64_pseudo_register_names
[regnum
];
818 internal_error (__FILE__
, __LINE__
,
819 _("sparc64_pseudo_register_name: bad register number %d"),
823 /* Return the name of register REGNUM. */
826 sparc64_register_name (struct gdbarch
*gdbarch
, int regnum
)
828 if (tdesc_has_registers (gdbarch_target_desc (gdbarch
)))
829 return tdesc_register_name (gdbarch
, regnum
);
831 if (regnum
>= 0 && regnum
< gdbarch_num_regs (gdbarch
))
832 return sparc64_register_names
[regnum
];
834 return sparc64_pseudo_register_name (gdbarch
, regnum
);
837 /* Return the GDB type object for the "standard" data type of data in
838 pseudo register REGNUM. */
841 sparc64_pseudo_register_type (struct gdbarch
*gdbarch
, int regnum
)
843 regnum
-= gdbarch_num_regs (gdbarch
);
845 if (regnum
== SPARC64_CWP_REGNUM
)
846 return builtin_type (gdbarch
)->builtin_int64
;
847 if (regnum
== SPARC64_PSTATE_REGNUM
)
848 return sparc64_pstate_type (gdbarch
);
849 if (regnum
== SPARC64_ASI_REGNUM
)
850 return builtin_type (gdbarch
)->builtin_int64
;
851 if (regnum
== SPARC64_CCR_REGNUM
)
852 return sparc64_ccr_type (gdbarch
);
853 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
854 return builtin_type (gdbarch
)->builtin_double
;
855 if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
856 return builtin_type (gdbarch
)->builtin_long_double
;
858 internal_error (__FILE__
, __LINE__
,
859 _("sparc64_pseudo_register_type: bad register number %d"),
863 /* Return the GDB type object for the "standard" data type of data in
867 sparc64_register_type (struct gdbarch
*gdbarch
, int regnum
)
869 if (tdesc_has_registers (gdbarch_target_desc (gdbarch
)))
870 return tdesc_register_type (gdbarch
, regnum
);
873 if (regnum
== SPARC_SP_REGNUM
|| regnum
== SPARC_FP_REGNUM
)
874 return builtin_type (gdbarch
)->builtin_data_ptr
;
875 if (regnum
>= SPARC_G0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
)
876 return builtin_type (gdbarch
)->builtin_int64
;
877 if (regnum
>= SPARC_F0_REGNUM
&& regnum
<= SPARC_F31_REGNUM
)
878 return builtin_type (gdbarch
)->builtin_float
;
879 if (regnum
>= SPARC64_F32_REGNUM
&& regnum
<= SPARC64_F62_REGNUM
)
880 return builtin_type (gdbarch
)->builtin_double
;
881 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== SPARC64_NPC_REGNUM
)
882 return builtin_type (gdbarch
)->builtin_func_ptr
;
883 /* This raw register contains the contents of %cwp, %pstate, %asi
884 and %ccr as laid out in a %tstate register. */
885 if (regnum
== SPARC64_STATE_REGNUM
)
886 return builtin_type (gdbarch
)->builtin_int64
;
887 if (regnum
== SPARC64_FSR_REGNUM
)
888 return sparc64_fsr_type (gdbarch
);
889 if (regnum
== SPARC64_FPRS_REGNUM
)
890 return sparc64_fprs_type (gdbarch
);
891 /* "Although Y is a 64-bit register, its high-order 32 bits are
892 reserved and always read as 0." */
893 if (regnum
== SPARC64_Y_REGNUM
)
894 return builtin_type (gdbarch
)->builtin_int64
;
896 /* Pseudo registers. */
897 if (regnum
>= gdbarch_num_regs (gdbarch
))
898 return sparc64_pseudo_register_type (gdbarch
, regnum
);
900 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
903 static enum register_status
904 sparc64_pseudo_register_read (struct gdbarch
*gdbarch
,
905 readable_regcache
*regcache
,
906 int regnum
, gdb_byte
*buf
)
908 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
909 enum register_status status
;
911 regnum
-= gdbarch_num_regs (gdbarch
);
913 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D30_REGNUM
)
915 regnum
= SPARC_F0_REGNUM
+ 2 * (regnum
- SPARC64_D0_REGNUM
);
916 status
= regcache
->raw_read (regnum
, buf
);
917 if (status
== REG_VALID
)
918 status
= regcache
->raw_read (regnum
+ 1, buf
+ 4);
921 else if (regnum
>= SPARC64_D32_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
923 regnum
= SPARC64_F32_REGNUM
+ (regnum
- SPARC64_D32_REGNUM
);
924 return regcache
->raw_read (regnum
, buf
);
926 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q28_REGNUM
)
928 regnum
= SPARC_F0_REGNUM
+ 4 * (regnum
- SPARC64_Q0_REGNUM
);
930 status
= regcache
->raw_read (regnum
, buf
);
931 if (status
== REG_VALID
)
932 status
= regcache
->raw_read (regnum
+ 1, buf
+ 4);
933 if (status
== REG_VALID
)
934 status
= regcache
->raw_read (regnum
+ 2, buf
+ 8);
935 if (status
== REG_VALID
)
936 status
= regcache
->raw_read (regnum
+ 3, buf
+ 12);
940 else if (regnum
>= SPARC64_Q32_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
942 regnum
= SPARC64_F32_REGNUM
+ 2 * (regnum
- SPARC64_Q32_REGNUM
);
944 status
= regcache
->raw_read (regnum
, buf
);
945 if (status
== REG_VALID
)
946 status
= regcache
->raw_read (regnum
+ 1, buf
+ 8);
950 else if (regnum
== SPARC64_CWP_REGNUM
951 || regnum
== SPARC64_PSTATE_REGNUM
952 || regnum
== SPARC64_ASI_REGNUM
953 || regnum
== SPARC64_CCR_REGNUM
)
957 status
= regcache
->raw_read (SPARC64_STATE_REGNUM
, &state
);
958 if (status
!= REG_VALID
)
963 case SPARC64_CWP_REGNUM
:
964 state
= (state
>> 0) & ((1 << 5) - 1);
966 case SPARC64_PSTATE_REGNUM
:
967 state
= (state
>> 8) & ((1 << 12) - 1);
969 case SPARC64_ASI_REGNUM
:
970 state
= (state
>> 24) & ((1 << 8) - 1);
972 case SPARC64_CCR_REGNUM
:
973 state
= (state
>> 32) & ((1 << 8) - 1);
976 store_unsigned_integer (buf
, 8, byte_order
, state
);
983 sparc64_pseudo_register_write (struct gdbarch
*gdbarch
,
984 struct regcache
*regcache
,
985 int regnum
, const gdb_byte
*buf
)
987 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
989 regnum
-= gdbarch_num_regs (gdbarch
);
991 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D30_REGNUM
)
993 regnum
= SPARC_F0_REGNUM
+ 2 * (regnum
- SPARC64_D0_REGNUM
);
994 regcache
->raw_write (regnum
, buf
);
995 regcache
->raw_write (regnum
+ 1, buf
+ 4);
997 else if (regnum
>= SPARC64_D32_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
999 regnum
= SPARC64_F32_REGNUM
+ (regnum
- SPARC64_D32_REGNUM
);
1000 regcache
->raw_write (regnum
, buf
);
1002 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q28_REGNUM
)
1004 regnum
= SPARC_F0_REGNUM
+ 4 * (regnum
- SPARC64_Q0_REGNUM
);
1005 regcache
->raw_write (regnum
, buf
);
1006 regcache
->raw_write (regnum
+ 1, buf
+ 4);
1007 regcache
->raw_write (regnum
+ 2, buf
+ 8);
1008 regcache
->raw_write (regnum
+ 3, buf
+ 12);
1010 else if (regnum
>= SPARC64_Q32_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
1012 regnum
= SPARC64_F32_REGNUM
+ 2 * (regnum
- SPARC64_Q32_REGNUM
);
1013 regcache
->raw_write (regnum
, buf
);
1014 regcache
->raw_write (regnum
+ 1, buf
+ 8);
1016 else if (regnum
== SPARC64_CWP_REGNUM
1017 || regnum
== SPARC64_PSTATE_REGNUM
1018 || regnum
== SPARC64_ASI_REGNUM
1019 || regnum
== SPARC64_CCR_REGNUM
)
1021 ULONGEST state
, bits
;
1023 regcache_raw_read_unsigned (regcache
, SPARC64_STATE_REGNUM
, &state
);
1024 bits
= extract_unsigned_integer (buf
, 8, byte_order
);
1027 case SPARC64_CWP_REGNUM
:
1028 state
|= ((bits
& ((1 << 5) - 1)) << 0);
1030 case SPARC64_PSTATE_REGNUM
:
1031 state
|= ((bits
& ((1 << 12) - 1)) << 8);
1033 case SPARC64_ASI_REGNUM
:
1034 state
|= ((bits
& ((1 << 8) - 1)) << 24);
1036 case SPARC64_CCR_REGNUM
:
1037 state
|= ((bits
& ((1 << 8) - 1)) << 32);
1040 regcache_raw_write_unsigned (regcache
, SPARC64_STATE_REGNUM
, state
);
1045 /* Return PC of first real instruction of the function starting at
1049 sparc64_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR start_pc
)
1051 struct symtab_and_line sal
;
1052 CORE_ADDR func_start
, func_end
;
1053 struct sparc_frame_cache cache
;
1055 /* This is the preferred method, find the end of the prologue by
1056 using the debugging information. */
1057 if (find_pc_partial_function (start_pc
, NULL
, &func_start
, &func_end
))
1059 sal
= find_pc_line (func_start
, 0);
1061 if (sal
.end
< func_end
1062 && start_pc
<= sal
.end
)
1066 return sparc_analyze_prologue (gdbarch
, start_pc
, 0xffffffffffffffffULL
,
1070 /* Normal frames. */
1072 static struct sparc_frame_cache
*
1073 sparc64_frame_cache (struct frame_info
*this_frame
, void **this_cache
)
1075 return sparc_frame_cache (this_frame
, this_cache
);
1079 sparc64_frame_this_id (struct frame_info
*this_frame
, void **this_cache
,
1080 struct frame_id
*this_id
)
1082 struct sparc_frame_cache
*cache
=
1083 sparc64_frame_cache (this_frame
, this_cache
);
1085 /* This marks the outermost frame. */
1086 if (cache
->base
== 0)
1089 (*this_id
) = frame_id_build (cache
->base
, cache
->pc
);
1092 static struct value
*
1093 sparc64_frame_prev_register (struct frame_info
*this_frame
, void **this_cache
,
1096 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
1097 struct sparc_frame_cache
*cache
=
1098 sparc64_frame_cache (this_frame
, this_cache
);
1100 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== SPARC64_NPC_REGNUM
)
1102 CORE_ADDR pc
= (regnum
== SPARC64_NPC_REGNUM
) ? 4 : 0;
1105 (cache
->copied_regs_mask
& 0x80) ? SPARC_I7_REGNUM
: SPARC_O7_REGNUM
;
1106 pc
+= get_frame_register_unsigned (this_frame
, regnum
) + 8;
1107 return frame_unwind_got_constant (this_frame
, regnum
, pc
);
1110 /* Handle StackGhost. */
1112 ULONGEST wcookie
= sparc_fetch_wcookie (gdbarch
);
1114 if (wcookie
!= 0 && !cache
->frameless_p
&& regnum
== SPARC_I7_REGNUM
)
1116 CORE_ADDR addr
= cache
->base
+ (regnum
- SPARC_L0_REGNUM
) * 8;
1119 /* Read the value in from memory. */
1120 i7
= get_frame_memory_unsigned (this_frame
, addr
, 8);
1121 return frame_unwind_got_constant (this_frame
, regnum
, i7
^ wcookie
);
1125 /* The previous frame's `local' and `in' registers may have been saved
1126 in the register save area. */
1127 if (regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
1128 && (cache
->saved_regs_mask
& (1 << (regnum
- SPARC_L0_REGNUM
))))
1130 CORE_ADDR addr
= cache
->base
+ (regnum
- SPARC_L0_REGNUM
) * 8;
1132 return frame_unwind_got_memory (this_frame
, regnum
, addr
);
1135 /* The previous frame's `out' registers may be accessible as the current
1136 frame's `in' registers. */
1137 if (regnum
>= SPARC_O0_REGNUM
&& regnum
<= SPARC_O7_REGNUM
1138 && (cache
->copied_regs_mask
& (1 << (regnum
- SPARC_O0_REGNUM
))))
1139 regnum
+= (SPARC_I0_REGNUM
- SPARC_O0_REGNUM
);
1141 return frame_unwind_got_register (this_frame
, regnum
, regnum
);
1144 static const struct frame_unwind sparc64_frame_unwind
=
1147 default_frame_unwind_stop_reason
,
1148 sparc64_frame_this_id
,
1149 sparc64_frame_prev_register
,
1151 default_frame_sniffer
1156 sparc64_frame_base_address (struct frame_info
*this_frame
, void **this_cache
)
1158 struct sparc_frame_cache
*cache
=
1159 sparc64_frame_cache (this_frame
, this_cache
);
1164 static const struct frame_base sparc64_frame_base
=
1166 &sparc64_frame_unwind
,
1167 sparc64_frame_base_address
,
1168 sparc64_frame_base_address
,
1169 sparc64_frame_base_address
1172 /* Check whether TYPE must be 16-byte aligned. */
1175 sparc64_16_byte_align_p (struct type
*type
)
1177 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1179 struct type
*t
= check_typedef (TYPE_TARGET_TYPE (type
));
1181 if (sparc64_floating_p (t
))
1184 if (sparc64_floating_p (type
) && TYPE_LENGTH (type
) == 16)
1187 if (sparc64_structure_or_union_p (type
))
1191 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1193 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1195 if (sparc64_16_byte_align_p (subtype
))
1203 /* Store floating fields of element ELEMENT of an "parameter array"
1204 that has type TYPE and is stored at BITPOS in VALBUF in the
1205 appropriate registers of REGCACHE. This function can be called
1206 recursively and therefore handles floating types in addition to
1210 sparc64_store_floating_fields (struct regcache
*regcache
, struct type
*type
,
1211 const gdb_byte
*valbuf
, int element
, int bitpos
)
1213 struct gdbarch
*gdbarch
= regcache
->arch ();
1214 int len
= TYPE_LENGTH (type
);
1216 gdb_assert (element
< 16);
1218 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1221 int regnum
= SPARC_F0_REGNUM
+ element
* 2 + bitpos
/ 32;
1223 valbuf
+= bitpos
/ 8;
1226 memset (buf
, 0, 8 - len
);
1227 memcpy (buf
+ 8 - len
, valbuf
, len
);
1231 for (int n
= 0; n
< (len
+ 3) / 4; n
++)
1232 regcache
->cooked_write (regnum
+ n
, valbuf
+ n
* 4);
1234 else if (sparc64_floating_p (type
)
1235 || (sparc64_complex_floating_p (type
) && len
<= 16))
1241 gdb_assert (bitpos
== 0);
1242 gdb_assert ((element
% 2) == 0);
1244 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
+ element
/ 2;
1245 regcache
->cooked_write (regnum
, valbuf
);
1249 gdb_assert (bitpos
== 0 || bitpos
== 64);
1251 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1252 + element
+ bitpos
/ 64;
1253 regcache
->cooked_write (regnum
, valbuf
+ (bitpos
/ 8));
1257 gdb_assert (len
== 4);
1258 gdb_assert (bitpos
% 32 == 0 && bitpos
>= 0 && bitpos
< 128);
1260 regnum
= SPARC_F0_REGNUM
+ element
* 2 + bitpos
/ 32;
1261 regcache
->cooked_write (regnum
, valbuf
+ (bitpos
/ 8));
1264 else if (sparc64_structure_or_union_p (type
))
1268 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1270 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1271 int subpos
= bitpos
+ TYPE_FIELD_BITPOS (type
, i
);
1273 sparc64_store_floating_fields (regcache
, subtype
, valbuf
,
1277 /* GCC has an interesting bug. If TYPE is a structure that has
1278 a single `float' member, GCC doesn't treat it as a structure
1279 at all, but rather as an ordinary `float' argument. This
1280 argument will be stored in %f1, as required by the psABI.
1281 However, as a member of a structure the psABI requires it to
1282 be stored in %f0. This bug is present in GCC 3.3.2, but
1283 probably in older releases to. To appease GCC, if a
1284 structure has only a single `float' member, we store its
1285 value in %f1 too (we already have stored in %f0). */
1286 if (TYPE_NFIELDS (type
) == 1)
1288 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, 0));
1290 if (sparc64_floating_p (subtype
) && TYPE_LENGTH (subtype
) == 4)
1291 regcache
->cooked_write (SPARC_F1_REGNUM
, valbuf
);
1296 /* Fetch floating fields from a variable of type TYPE from the
1297 appropriate registers for BITPOS in REGCACHE and store it at BITPOS
1298 in VALBUF. This function can be called recursively and therefore
1299 handles floating types in addition to structures. */
1302 sparc64_extract_floating_fields (struct regcache
*regcache
, struct type
*type
,
1303 gdb_byte
*valbuf
, int bitpos
)
1305 struct gdbarch
*gdbarch
= regcache
->arch ();
1307 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1309 int len
= TYPE_LENGTH (type
);
1310 int regnum
= SPARC_F0_REGNUM
+ bitpos
/ 32;
1312 valbuf
+= bitpos
/ 8;
1316 regcache
->cooked_read (regnum
, buf
);
1317 memcpy (valbuf
, buf
+ 4 - len
, len
);
1320 for (int i
= 0; i
< (len
+ 3) / 4; i
++)
1321 regcache
->cooked_read (regnum
+ i
, valbuf
+ i
* 4);
1323 else if (sparc64_floating_p (type
))
1325 int len
= TYPE_LENGTH (type
);
1330 gdb_assert (bitpos
== 0 || bitpos
== 128);
1332 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
1334 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1338 gdb_assert (bitpos
% 64 == 0 && bitpos
>= 0 && bitpos
< 256);
1340 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
+ bitpos
/ 64;
1341 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1345 gdb_assert (len
== 4);
1346 gdb_assert (bitpos
% 32 == 0 && bitpos
>= 0 && bitpos
< 256);
1348 regnum
= SPARC_F0_REGNUM
+ bitpos
/ 32;
1349 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1352 else if (sparc64_structure_or_union_p (type
))
1356 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1358 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1359 int subpos
= bitpos
+ TYPE_FIELD_BITPOS (type
, i
);
1361 sparc64_extract_floating_fields (regcache
, subtype
, valbuf
, subpos
);
1366 /* Store the NARGS arguments ARGS and STRUCT_ADDR (if STRUCT_RETURN is
1367 non-zero) in REGCACHE and on the stack (starting from address SP). */
1370 sparc64_store_arguments (struct regcache
*regcache
, int nargs
,
1371 struct value
**args
, CORE_ADDR sp
,
1372 function_call_return_method return_method
,
1373 CORE_ADDR struct_addr
)
1375 struct gdbarch
*gdbarch
= regcache
->arch ();
1376 /* Number of extended words in the "parameter array". */
1377 int num_elements
= 0;
1381 /* Take BIAS into account. */
1384 /* First we calculate the number of extended words in the "parameter
1385 array". While doing so we also convert some of the arguments. */
1387 if (return_method
== return_method_struct
)
1390 for (i
= 0; i
< nargs
; i
++)
1392 struct type
*type
= value_type (args
[i
]);
1393 int len
= TYPE_LENGTH (type
);
1395 if (sparc64_structure_or_union_p (type
)
1396 || (sparc64_complex_floating_p (type
) && len
== 32))
1398 /* Structure or Union arguments. */
1401 if (num_elements
% 2 && sparc64_16_byte_align_p (type
))
1403 num_elements
+= ((len
+ 7) / 8);
1407 /* The psABI says that "Structures or unions larger than
1408 sixteen bytes are copied by the caller and passed
1409 indirectly; the caller will pass the address of a
1410 correctly aligned structure value. This sixty-four
1411 bit address will occupy one word in the parameter
1412 array, and may be promoted to an %o register like any
1413 other pointer value." Allocate memory for these
1414 values on the stack. */
1417 /* Use 16-byte alignment for these values. That's
1418 always correct, and wasting a few bytes shouldn't be
1422 write_memory (sp
, value_contents (args
[i
]), len
);
1423 args
[i
] = value_from_pointer (lookup_pointer_type (type
), sp
);
1427 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1429 /* Floating arguments. */
1432 /* The psABI says that "Each quad-precision parameter
1433 value will be assigned to two extended words in the
1437 /* The psABI says that "Long doubles must be
1438 quad-aligned, and thus a hole might be introduced
1439 into the parameter array to force alignment." Skip
1440 an element if necessary. */
1441 if ((num_elements
% 2) && sparc64_16_byte_align_p (type
))
1449 /* Integral and pointer arguments. */
1450 gdb_assert (sparc64_integral_or_pointer_p (type
));
1452 /* The psABI says that "Each argument value of integral type
1453 smaller than an extended word will be widened by the
1454 caller to an extended word according to the signed-ness
1455 of the argument type." */
1457 args
[i
] = value_cast (builtin_type (gdbarch
)->builtin_int64
,
1463 /* Allocate the "parameter array". */
1464 sp
-= num_elements
* 8;
1466 /* The psABI says that "Every stack frame must be 16-byte aligned." */
1469 /* Now we store the arguments in to the "parameter array". Some
1470 Integer or Pointer arguments and Structure or Union arguments
1471 will be passed in %o registers. Some Floating arguments and
1472 floating members of structures are passed in floating-point
1473 registers. However, for functions with variable arguments,
1474 floating arguments are stored in an %0 register, and for
1475 functions without a prototype floating arguments are stored in
1476 both a floating-point and an %o registers, or a floating-point
1477 register and memory. To simplify the logic here we always pass
1478 arguments in memory, an %o register, and a floating-point
1479 register if appropriate. This should be no problem since the
1480 contents of any unused memory or registers in the "parameter
1481 array" are undefined. */
1483 if (return_method
== return_method_struct
)
1485 regcache_cooked_write_unsigned (regcache
, SPARC_O0_REGNUM
, struct_addr
);
1489 for (i
= 0; i
< nargs
; i
++)
1491 const gdb_byte
*valbuf
= value_contents (args
[i
]);
1492 struct type
*type
= value_type (args
[i
]);
1493 int len
= TYPE_LENGTH (type
);
1497 if (sparc64_structure_or_union_p (type
)
1498 || (sparc64_complex_floating_p (type
) && len
== 32))
1500 /* Structure, Union or long double Complex arguments. */
1501 gdb_assert (len
<= 16);
1502 memset (buf
, 0, sizeof (buf
));
1503 memcpy (buf
, valbuf
, len
);
1506 if (element
% 2 && sparc64_16_byte_align_p (type
))
1511 regnum
= SPARC_O0_REGNUM
+ element
;
1512 if (len
> 8 && element
< 5)
1513 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1517 sparc64_store_floating_fields (regcache
, type
, valbuf
, element
, 0);
1519 else if (sparc64_complex_floating_p (type
))
1521 /* Float Complex or double Complex arguments. */
1524 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
+ element
;
1528 if (regnum
< gdbarch_num_regs (gdbarch
) + SPARC64_D30_REGNUM
)
1529 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1530 if (regnum
< gdbarch_num_regs (gdbarch
) + SPARC64_D10_REGNUM
)
1531 regcache
->cooked_write (SPARC_O0_REGNUM
+ element
+ 1,
1536 else if (sparc64_floating_p (type
))
1538 /* Floating arguments. */
1544 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
1550 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1555 /* The psABI says "Each single-precision parameter value
1556 will be assigned to one extended word in the
1557 parameter array, and right-justified within that
1558 word; the left half (even float register) is
1559 undefined." Even though the psABI says that "the
1560 left half is undefined", set it to zero here. */
1562 memcpy (buf
+ 4, valbuf
, 4);
1566 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1572 /* Integral and pointer arguments. */
1573 gdb_assert (len
== 8);
1575 regnum
= SPARC_O0_REGNUM
+ element
;
1580 regcache
->cooked_write (regnum
, valbuf
);
1582 /* If we're storing the value in a floating-point register,
1583 also store it in the corresponding %0 register(s). */
1584 if (regnum
>= gdbarch_num_regs (gdbarch
))
1586 regnum
-= gdbarch_num_regs (gdbarch
);
1588 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D10_REGNUM
)
1590 gdb_assert (element
< 6);
1591 regnum
= SPARC_O0_REGNUM
+ element
;
1592 regcache
->cooked_write (regnum
, valbuf
);
1594 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q8_REGNUM
)
1596 gdb_assert (element
< 5);
1597 regnum
= SPARC_O0_REGNUM
+ element
;
1598 regcache
->cooked_write (regnum
, valbuf
);
1599 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1604 /* Always store the argument in memory. */
1605 write_memory (sp
+ element
* 8, valbuf
, len
);
1606 element
+= ((len
+ 7) / 8);
1609 gdb_assert (element
== num_elements
);
1611 /* Take BIAS into account. */
1617 sparc64_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR address
)
1619 /* The ABI requires 16-byte alignment. */
1620 return address
& ~0xf;
1624 sparc64_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
1625 struct regcache
*regcache
, CORE_ADDR bp_addr
,
1626 int nargs
, struct value
**args
, CORE_ADDR sp
,
1627 function_call_return_method return_method
,
1628 CORE_ADDR struct_addr
)
1630 /* Set return address. */
1631 regcache_cooked_write_unsigned (regcache
, SPARC_O7_REGNUM
, bp_addr
- 8);
1633 /* Set up function arguments. */
1634 sp
= sparc64_store_arguments (regcache
, nargs
, args
, sp
, return_method
,
1637 /* Allocate the register save area. */
1640 /* Stack should be 16-byte aligned at this point. */
1641 gdb_assert ((sp
+ BIAS
) % 16 == 0);
1643 /* Finally, update the stack pointer. */
1644 regcache_cooked_write_unsigned (regcache
, SPARC_SP_REGNUM
, sp
);
1650 /* Extract from an array REGBUF containing the (raw) register state, a
1651 function return value of TYPE, and copy that into VALBUF. */
1654 sparc64_extract_return_value (struct type
*type
, struct regcache
*regcache
,
1657 int len
= TYPE_LENGTH (type
);
1661 if (sparc64_structure_or_union_p (type
))
1663 /* Structure or Union return values. */
1664 gdb_assert (len
<= 32);
1666 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1667 regcache
->cooked_read (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1668 if (TYPE_CODE (type
) != TYPE_CODE_UNION
)
1669 sparc64_extract_floating_fields (regcache
, type
, buf
, 0);
1670 memcpy (valbuf
, buf
, len
);
1672 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1674 /* Floating return values. */
1675 for (i
= 0; i
< len
/ 4; i
++)
1676 regcache
->cooked_read (SPARC_F0_REGNUM
+ i
, buf
+ i
* 4);
1677 memcpy (valbuf
, buf
, len
);
1679 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1681 /* Small arrays are returned the same way as small structures. */
1682 gdb_assert (len
<= 32);
1684 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1685 regcache
->cooked_read (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1686 memcpy (valbuf
, buf
, len
);
1690 /* Integral and pointer return values. */
1691 gdb_assert (sparc64_integral_or_pointer_p (type
));
1693 /* Just stripping off any unused bytes should preserve the
1694 signed-ness just fine. */
1695 regcache
->cooked_read (SPARC_O0_REGNUM
, buf
);
1696 memcpy (valbuf
, buf
+ 8 - len
, len
);
1700 /* Write into the appropriate registers a function return value stored
1701 in VALBUF of type TYPE. */
1704 sparc64_store_return_value (struct type
*type
, struct regcache
*regcache
,
1705 const gdb_byte
*valbuf
)
1707 int len
= TYPE_LENGTH (type
);
1711 if (sparc64_structure_or_union_p (type
))
1713 /* Structure or Union return values. */
1714 gdb_assert (len
<= 32);
1716 /* Simplify matters by storing the complete value (including
1717 floating members) into %o0 and %o1. Floating members are
1718 also store in the appropriate floating-point registers. */
1719 memset (buf
, 0, sizeof (buf
));
1720 memcpy (buf
, valbuf
, len
);
1721 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1722 regcache
->cooked_write (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1723 if (TYPE_CODE (type
) != TYPE_CODE_UNION
)
1724 sparc64_store_floating_fields (regcache
, type
, buf
, 0, 0);
1726 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1728 /* Floating return values. */
1729 memcpy (buf
, valbuf
, len
);
1730 for (i
= 0; i
< len
/ 4; i
++)
1731 regcache
->cooked_write (SPARC_F0_REGNUM
+ i
, buf
+ i
* 4);
1733 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1735 /* Small arrays are returned the same way as small structures. */
1736 gdb_assert (len
<= 32);
1738 memset (buf
, 0, sizeof (buf
));
1739 memcpy (buf
, valbuf
, len
);
1740 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1741 regcache
->cooked_write (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1745 /* Integral and pointer return values. */
1746 gdb_assert (sparc64_integral_or_pointer_p (type
));
1748 /* ??? Do we need to do any sign-extension here? */
1750 memcpy (buf
+ 8 - len
, valbuf
, len
);
1751 regcache
->cooked_write (SPARC_O0_REGNUM
, buf
);
1755 static enum return_value_convention
1756 sparc64_return_value (struct gdbarch
*gdbarch
, struct value
*function
,
1757 struct type
*type
, struct regcache
*regcache
,
1758 gdb_byte
*readbuf
, const gdb_byte
*writebuf
)
1760 if (TYPE_LENGTH (type
) > 32)
1761 return RETURN_VALUE_STRUCT_CONVENTION
;
1764 sparc64_extract_return_value (type
, regcache
, readbuf
);
1766 sparc64_store_return_value (type
, regcache
, writebuf
);
1768 return RETURN_VALUE_REGISTER_CONVENTION
;
1773 sparc64_dwarf2_frame_init_reg (struct gdbarch
*gdbarch
, int regnum
,
1774 struct dwarf2_frame_state_reg
*reg
,
1775 struct frame_info
*this_frame
)
1779 case SPARC_G0_REGNUM
:
1780 /* Since %g0 is always zero, there is no point in saving it, and
1781 people will be inclined omit it from the CFI. Make sure we
1782 don't warn about that. */
1783 reg
->how
= DWARF2_FRAME_REG_SAME_VALUE
;
1785 case SPARC_SP_REGNUM
:
1786 reg
->how
= DWARF2_FRAME_REG_CFA
;
1788 case SPARC64_PC_REGNUM
:
1789 reg
->how
= DWARF2_FRAME_REG_RA_OFFSET
;
1790 reg
->loc
.offset
= 8;
1792 case SPARC64_NPC_REGNUM
:
1793 reg
->how
= DWARF2_FRAME_REG_RA_OFFSET
;
1794 reg
->loc
.offset
= 12;
1799 /* sparc64_addr_bits_remove - remove useless address bits */
1802 sparc64_addr_bits_remove (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
1804 return adi_normalize_address (addr
);
1808 sparc64_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1810 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1812 tdep
->pc_regnum
= SPARC64_PC_REGNUM
;
1813 tdep
->npc_regnum
= SPARC64_NPC_REGNUM
;
1814 tdep
->fpu_register_names
= sparc64_fpu_register_names
;
1815 tdep
->fpu_registers_num
= ARRAY_SIZE (sparc64_fpu_register_names
);
1816 tdep
->cp0_register_names
= sparc64_cp0_register_names
;
1817 tdep
->cp0_registers_num
= ARRAY_SIZE (sparc64_cp0_register_names
);
1819 /* This is what all the fuss is about. */
1820 set_gdbarch_long_bit (gdbarch
, 64);
1821 set_gdbarch_long_long_bit (gdbarch
, 64);
1822 set_gdbarch_ptr_bit (gdbarch
, 64);
1824 set_gdbarch_wchar_bit (gdbarch
, 16);
1825 set_gdbarch_wchar_signed (gdbarch
, 0);
1827 set_gdbarch_num_regs (gdbarch
, SPARC64_NUM_REGS
);
1828 set_gdbarch_register_name (gdbarch
, sparc64_register_name
);
1829 set_gdbarch_register_type (gdbarch
, sparc64_register_type
);
1830 set_gdbarch_num_pseudo_regs (gdbarch
, SPARC64_NUM_PSEUDO_REGS
);
1831 set_tdesc_pseudo_register_name (gdbarch
, sparc64_pseudo_register_name
);
1832 set_tdesc_pseudo_register_type (gdbarch
, sparc64_pseudo_register_type
);
1833 set_gdbarch_pseudo_register_read (gdbarch
, sparc64_pseudo_register_read
);
1834 set_gdbarch_pseudo_register_write (gdbarch
, sparc64_pseudo_register_write
);
1836 /* Register numbers of various important registers. */
1837 set_gdbarch_pc_regnum (gdbarch
, SPARC64_PC_REGNUM
); /* %pc */
1839 /* Call dummy code. */
1840 set_gdbarch_frame_align (gdbarch
, sparc64_frame_align
);
1841 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
1842 set_gdbarch_push_dummy_code (gdbarch
, NULL
);
1843 set_gdbarch_push_dummy_call (gdbarch
, sparc64_push_dummy_call
);
1845 set_gdbarch_return_value (gdbarch
, sparc64_return_value
);
1846 set_gdbarch_stabs_argument_has_addr
1847 (gdbarch
, default_stabs_argument_has_addr
);
1849 set_gdbarch_skip_prologue (gdbarch
, sparc64_skip_prologue
);
1850 set_gdbarch_stack_frame_destroyed_p (gdbarch
, sparc_stack_frame_destroyed_p
);
1852 /* Hook in the DWARF CFI frame unwinder. */
1853 dwarf2_frame_set_init_reg (gdbarch
, sparc64_dwarf2_frame_init_reg
);
1854 /* FIXME: kettenis/20050423: Don't enable the unwinder until the
1855 StackGhost issues have been resolved. */
1857 frame_unwind_append_unwinder (gdbarch
, &sparc64_frame_unwind
);
1858 frame_base_set_default (gdbarch
, &sparc64_frame_base
);
1860 set_gdbarch_addr_bits_remove (gdbarch
, sparc64_addr_bits_remove
);
1864 /* Helper functions for dealing with register sets. */
1866 #define TSTATE_CWP 0x000000000000001fULL
1867 #define TSTATE_ICC 0x0000000f00000000ULL
1868 #define TSTATE_XCC 0x000000f000000000ULL
1870 #define PSR_S 0x00000080
1872 #define PSR_ICC 0x00f00000
1874 #define PSR_VERS 0x0f000000
1876 #define PSR_IMPL 0xf0000000
1878 #define PSR_V8PLUS 0xff000000
1879 #define PSR_XCC 0x000f0000
1882 sparc64_supply_gregset (const struct sparc_gregmap
*gregmap
,
1883 struct regcache
*regcache
,
1884 int regnum
, const void *gregs
)
1886 struct gdbarch
*gdbarch
= regcache
->arch ();
1887 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1888 int sparc32
= (gdbarch_ptr_bit (gdbarch
) == 32);
1889 const gdb_byte
*regs
= (const gdb_byte
*) gregs
;
1890 gdb_byte zero
[8] = { 0 };
1895 if (regnum
== SPARC32_PSR_REGNUM
|| regnum
== -1)
1897 int offset
= gregmap
->r_tstate_offset
;
1898 ULONGEST tstate
, psr
;
1901 tstate
= extract_unsigned_integer (regs
+ offset
, 8, byte_order
);
1902 psr
= ((tstate
& TSTATE_CWP
) | PSR_S
| ((tstate
& TSTATE_ICC
) >> 12)
1903 | ((tstate
& TSTATE_XCC
) >> 20) | PSR_V8PLUS
);
1904 store_unsigned_integer (buf
, 4, byte_order
, psr
);
1905 regcache
->raw_supply (SPARC32_PSR_REGNUM
, buf
);
1908 if (regnum
== SPARC32_PC_REGNUM
|| regnum
== -1)
1909 regcache
->raw_supply (SPARC32_PC_REGNUM
,
1910 regs
+ gregmap
->r_pc_offset
+ 4);
1912 if (regnum
== SPARC32_NPC_REGNUM
|| regnum
== -1)
1913 regcache
->raw_supply (SPARC32_NPC_REGNUM
,
1914 regs
+ gregmap
->r_npc_offset
+ 4);
1916 if (regnum
== SPARC32_Y_REGNUM
|| regnum
== -1)
1918 int offset
= gregmap
->r_y_offset
+ 8 - gregmap
->r_y_size
;
1919 regcache
->raw_supply (SPARC32_Y_REGNUM
, regs
+ offset
);
1924 if (regnum
== SPARC64_STATE_REGNUM
|| regnum
== -1)
1925 regcache
->raw_supply (SPARC64_STATE_REGNUM
,
1926 regs
+ gregmap
->r_tstate_offset
);
1928 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== -1)
1929 regcache
->raw_supply (SPARC64_PC_REGNUM
,
1930 regs
+ gregmap
->r_pc_offset
);
1932 if (regnum
== SPARC64_NPC_REGNUM
|| regnum
== -1)
1933 regcache
->raw_supply (SPARC64_NPC_REGNUM
,
1934 regs
+ gregmap
->r_npc_offset
);
1936 if (regnum
== SPARC64_Y_REGNUM
|| regnum
== -1)
1941 memcpy (buf
+ 8 - gregmap
->r_y_size
,
1942 regs
+ gregmap
->r_y_offset
, gregmap
->r_y_size
);
1943 regcache
->raw_supply (SPARC64_Y_REGNUM
, buf
);
1946 if ((regnum
== SPARC64_FPRS_REGNUM
|| regnum
== -1)
1947 && gregmap
->r_fprs_offset
!= -1)
1948 regcache
->raw_supply (SPARC64_FPRS_REGNUM
,
1949 regs
+ gregmap
->r_fprs_offset
);
1952 if (regnum
== SPARC_G0_REGNUM
|| regnum
== -1)
1953 regcache
->raw_supply (SPARC_G0_REGNUM
, &zero
);
1955 if ((regnum
>= SPARC_G1_REGNUM
&& regnum
<= SPARC_O7_REGNUM
) || regnum
== -1)
1957 int offset
= gregmap
->r_g1_offset
;
1962 for (i
= SPARC_G1_REGNUM
; i
<= SPARC_O7_REGNUM
; i
++)
1964 if (regnum
== i
|| regnum
== -1)
1965 regcache
->raw_supply (i
, regs
+ offset
);
1970 if ((regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
) || regnum
== -1)
1972 /* Not all of the register set variants include Locals and
1973 Inputs. For those that don't, we read them off the stack. */
1974 if (gregmap
->r_l0_offset
== -1)
1978 regcache_cooked_read_unsigned (regcache
, SPARC_SP_REGNUM
, &sp
);
1979 sparc_supply_rwindow (regcache
, sp
, regnum
);
1983 int offset
= gregmap
->r_l0_offset
;
1988 for (i
= SPARC_L0_REGNUM
; i
<= SPARC_I7_REGNUM
; i
++)
1990 if (regnum
== i
|| regnum
== -1)
1991 regcache
->raw_supply (i
, regs
+ offset
);
1999 sparc64_collect_gregset (const struct sparc_gregmap
*gregmap
,
2000 const struct regcache
*regcache
,
2001 int regnum
, void *gregs
)
2003 struct gdbarch
*gdbarch
= regcache
->arch ();
2004 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
2005 int sparc32
= (gdbarch_ptr_bit (gdbarch
) == 32);
2006 gdb_byte
*regs
= (gdb_byte
*) gregs
;
2011 if (regnum
== SPARC32_PSR_REGNUM
|| regnum
== -1)
2013 int offset
= gregmap
->r_tstate_offset
;
2014 ULONGEST tstate
, psr
;
2017 tstate
= extract_unsigned_integer (regs
+ offset
, 8, byte_order
);
2018 regcache
->raw_collect (SPARC32_PSR_REGNUM
, buf
);
2019 psr
= extract_unsigned_integer (buf
, 4, byte_order
);
2020 tstate
|= (psr
& PSR_ICC
) << 12;
2021 if ((psr
& (PSR_VERS
| PSR_IMPL
)) == PSR_V8PLUS
)
2022 tstate
|= (psr
& PSR_XCC
) << 20;
2023 store_unsigned_integer (buf
, 8, byte_order
, tstate
);
2024 memcpy (regs
+ offset
, buf
, 8);
2027 if (regnum
== SPARC32_PC_REGNUM
|| regnum
== -1)
2028 regcache
->raw_collect (SPARC32_PC_REGNUM
,
2029 regs
+ gregmap
->r_pc_offset
+ 4);
2031 if (regnum
== SPARC32_NPC_REGNUM
|| regnum
== -1)
2032 regcache
->raw_collect (SPARC32_NPC_REGNUM
,
2033 regs
+ gregmap
->r_npc_offset
+ 4);
2035 if (regnum
== SPARC32_Y_REGNUM
|| regnum
== -1)
2037 int offset
= gregmap
->r_y_offset
+ 8 - gregmap
->r_y_size
;
2038 regcache
->raw_collect (SPARC32_Y_REGNUM
, regs
+ offset
);
2043 if (regnum
== SPARC64_STATE_REGNUM
|| regnum
== -1)
2044 regcache
->raw_collect (SPARC64_STATE_REGNUM
,
2045 regs
+ gregmap
->r_tstate_offset
);
2047 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== -1)
2048 regcache
->raw_collect (SPARC64_PC_REGNUM
,
2049 regs
+ gregmap
->r_pc_offset
);
2051 if (regnum
== SPARC64_NPC_REGNUM
|| regnum
== -1)
2052 regcache
->raw_collect (SPARC64_NPC_REGNUM
,
2053 regs
+ gregmap
->r_npc_offset
);
2055 if (regnum
== SPARC64_Y_REGNUM
|| regnum
== -1)
2059 regcache
->raw_collect (SPARC64_Y_REGNUM
, buf
);
2060 memcpy (regs
+ gregmap
->r_y_offset
,
2061 buf
+ 8 - gregmap
->r_y_size
, gregmap
->r_y_size
);
2064 if ((regnum
== SPARC64_FPRS_REGNUM
|| regnum
== -1)
2065 && gregmap
->r_fprs_offset
!= -1)
2066 regcache
->raw_collect (SPARC64_FPRS_REGNUM
,
2067 regs
+ gregmap
->r_fprs_offset
);
2071 if ((regnum
>= SPARC_G1_REGNUM
&& regnum
<= SPARC_O7_REGNUM
) || regnum
== -1)
2073 int offset
= gregmap
->r_g1_offset
;
2078 /* %g0 is always zero. */
2079 for (i
= SPARC_G1_REGNUM
; i
<= SPARC_O7_REGNUM
; i
++)
2081 if (regnum
== i
|| regnum
== -1)
2082 regcache
->raw_collect (i
, regs
+ offset
);
2087 if ((regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
) || regnum
== -1)
2089 /* Not all of the register set variants include Locals and
2090 Inputs. For those that don't, we read them off the stack. */
2091 if (gregmap
->r_l0_offset
!= -1)
2093 int offset
= gregmap
->r_l0_offset
;
2098 for (i
= SPARC_L0_REGNUM
; i
<= SPARC_I7_REGNUM
; i
++)
2100 if (regnum
== i
|| regnum
== -1)
2101 regcache
->raw_collect (i
, regs
+ offset
);
2109 sparc64_supply_fpregset (const struct sparc_fpregmap
*fpregmap
,
2110 struct regcache
*regcache
,
2111 int regnum
, const void *fpregs
)
2113 int sparc32
= (gdbarch_ptr_bit (regcache
->arch ()) == 32);
2114 const gdb_byte
*regs
= (const gdb_byte
*) fpregs
;
2117 for (i
= 0; i
< 32; i
++)
2119 if (regnum
== (SPARC_F0_REGNUM
+ i
) || regnum
== -1)
2120 regcache
->raw_supply (SPARC_F0_REGNUM
+ i
,
2121 regs
+ fpregmap
->r_f0_offset
+ (i
* 4));
2126 if (regnum
== SPARC32_FSR_REGNUM
|| regnum
== -1)
2127 regcache
->raw_supply (SPARC32_FSR_REGNUM
,
2128 regs
+ fpregmap
->r_fsr_offset
);
2132 for (i
= 0; i
< 16; i
++)
2134 if (regnum
== (SPARC64_F32_REGNUM
+ i
) || regnum
== -1)
2135 regcache
->raw_supply
2136 (SPARC64_F32_REGNUM
+ i
,
2137 regs
+ fpregmap
->r_f0_offset
+ (32 * 4) + (i
* 8));
2140 if (regnum
== SPARC64_FSR_REGNUM
|| regnum
== -1)
2141 regcache
->raw_supply (SPARC64_FSR_REGNUM
,
2142 regs
+ fpregmap
->r_fsr_offset
);
2147 sparc64_collect_fpregset (const struct sparc_fpregmap
*fpregmap
,
2148 const struct regcache
*regcache
,
2149 int regnum
, void *fpregs
)
2151 int sparc32
= (gdbarch_ptr_bit (regcache
->arch ()) == 32);
2152 gdb_byte
*regs
= (gdb_byte
*) fpregs
;
2155 for (i
= 0; i
< 32; i
++)
2157 if (regnum
== (SPARC_F0_REGNUM
+ i
) || regnum
== -1)
2158 regcache
->raw_collect (SPARC_F0_REGNUM
+ i
,
2159 regs
+ fpregmap
->r_f0_offset
+ (i
* 4));
2164 if (regnum
== SPARC32_FSR_REGNUM
|| regnum
== -1)
2165 regcache
->raw_collect (SPARC32_FSR_REGNUM
,
2166 regs
+ fpregmap
->r_fsr_offset
);
2170 for (i
= 0; i
< 16; i
++)
2172 if (regnum
== (SPARC64_F32_REGNUM
+ i
) || regnum
== -1)
2173 regcache
->raw_collect (SPARC64_F32_REGNUM
+ i
,
2174 (regs
+ fpregmap
->r_f0_offset
2175 + (32 * 4) + (i
* 8)));
2178 if (regnum
== SPARC64_FSR_REGNUM
|| regnum
== -1)
2179 regcache
->raw_collect (SPARC64_FSR_REGNUM
,
2180 regs
+ fpregmap
->r_fsr_offset
);
2184 const struct sparc_fpregmap sparc64_bsd_fpregmap
=