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
);
189 /* Read attributes of a maps entry in /proc/[pid]/adi/maps. */
192 read_maps_entry (const char *line
,
193 ULONGEST
*addr
, ULONGEST
*endaddr
)
195 const char *p
= line
;
197 *addr
= strtoulst (p
, &p
, 16);
201 *endaddr
= strtoulst (p
, &p
, 16);
204 /* Check if ADI is available. */
209 pid_t pid
= inferior_ptid
.pid ();
210 sparc64_adi_info
*proc
= get_adi_info_proc (pid
);
213 if (proc
->stat
.checked_avail
)
214 return proc
->stat
.is_avail
;
216 proc
->stat
.checked_avail
= true;
217 if (target_auxv_search (current_top_target (), AT_ADI_BLKSZ
, &value
) <= 0)
219 proc
->stat
.blksize
= value
;
220 target_auxv_search (current_top_target (), AT_ADI_NBITS
, &value
);
221 proc
->stat
.nbits
= value
;
222 proc
->stat
.max_version
= (1 << proc
->stat
.nbits
) - 2;
223 proc
->stat
.is_avail
= true;
225 return proc
->stat
.is_avail
;
228 /* Normalize a versioned address - a VA with ADI bits (63-60) set. */
231 adi_normalize_address (CORE_ADDR addr
)
233 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
237 /* Clear upper bits. */
238 addr
&= ((uint64_t) -1) >> ast
.nbits
;
241 CORE_ADDR signbit
= (uint64_t) 1 << (64 - ast
.nbits
- 1);
242 return (addr
^ signbit
) - signbit
;
247 /* Align a normalized address - a VA with bit 59 sign extended into
251 adi_align_address (CORE_ADDR naddr
)
253 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
255 return (naddr
- (naddr
% ast
.blksize
)) / ast
.blksize
;
258 /* Convert a byte count to count at a ratio of 1:adi_blksz. */
261 adi_convert_byte_count (CORE_ADDR naddr
, int nbytes
, CORE_ADDR locl
)
263 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
265 return ((naddr
+ nbytes
+ ast
.blksize
- 1) / ast
.blksize
) - locl
;
268 /* The /proc/[pid]/adi/tags file, which allows gdb to get/set ADI
269 version in a target process, maps linearly to the address space
270 of the target process at a ratio of 1:adi_blksz.
272 A read (or write) at offset K in the file returns (or modifies)
273 the ADI version tag stored in the cacheline containing address
274 K * adi_blksz, encoded as 1 version tag per byte. The allowed
275 version tag values are between 0 and adi_stat.max_version. */
280 pid_t pid
= inferior_ptid
.pid ();
281 sparc64_adi_info
*proc
= get_adi_info_proc (pid
);
283 if (proc
->stat
.tag_fd
!= 0)
284 return proc
->stat
.tag_fd
;
286 char cl_name
[MAX_PROC_NAME_SIZE
];
287 snprintf (cl_name
, sizeof(cl_name
), "/proc/%ld/adi/tags", (long) pid
);
289 proc
->stat
.tag_fd
= target_fileio_open (NULL
, cl_name
, O_RDWR
|O_EXCL
,
291 return proc
->stat
.tag_fd
;
294 /* Check if an address set is ADI enabled, using /proc/[pid]/adi/maps
295 which was exported by the kernel and contains the currently ADI
296 mapped memory regions and their access permissions. */
299 adi_is_addr_mapped (CORE_ADDR vaddr
, size_t cnt
)
301 char filename
[MAX_PROC_NAME_SIZE
];
304 pid_t pid
= inferior_ptid
.pid ();
305 snprintf (filename
, sizeof filename
, "/proc/%ld/adi/maps", (long) pid
);
306 gdb::unique_xmalloc_ptr
<char> data
307 = target_fileio_read_stralloc (NULL
, filename
);
310 adi_stat_t adi_stat
= get_adi_info (pid
);
312 for (char *line
= strtok_r (data
.get (), "\n", &saveptr
);
314 line
= strtok_r (NULL
, "\n", &saveptr
))
316 ULONGEST addr
, endaddr
;
318 read_maps_entry (line
, &addr
, &endaddr
);
320 while (((vaddr
+ i
) * adi_stat
.blksize
) >= addr
321 && ((vaddr
+ i
) * adi_stat
.blksize
) < endaddr
)
329 warning (_("unable to open /proc file '%s'"), filename
);
334 /* Read ADI version tag value for memory locations starting at "VADDR"
335 for "SIZE" number of bytes. */
338 adi_read_versions (CORE_ADDR vaddr
, size_t size
, gdb_byte
*tags
)
340 int fd
= adi_tag_fd ();
344 if (!adi_is_addr_mapped (vaddr
, size
))
346 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
347 error(_("Address at %s is not in ADI maps"),
348 paddress (target_gdbarch (), vaddr
* ast
.blksize
));
352 return target_fileio_pread (fd
, tags
, size
, vaddr
, &target_errno
);
355 /* Write ADI version tag for memory locations starting at "VADDR" for
356 "SIZE" number of bytes to "TAGS". */
359 adi_write_versions (CORE_ADDR vaddr
, size_t size
, unsigned char *tags
)
361 int fd
= adi_tag_fd ();
365 if (!adi_is_addr_mapped (vaddr
, size
))
367 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
368 error(_("Address at %s is not in ADI maps"),
369 paddress (target_gdbarch (), vaddr
* ast
.blksize
));
373 return target_fileio_pwrite (fd
, tags
, size
, vaddr
, &target_errno
);
376 /* Print ADI version tag value in "TAGS" for memory locations starting
377 at "VADDR" with number of "CNT". */
380 adi_print_versions (CORE_ADDR vaddr
, size_t cnt
, gdb_byte
*tags
)
383 const int maxelts
= 8; /* # of elements per line */
385 adi_stat_t adi_stat
= get_adi_info (inferior_ptid
.pid ());
390 printf_filtered ("%s:\t",
391 paddress (target_gdbarch (), vaddr
* adi_stat
.blksize
));
392 for (int i
= maxelts
; i
> 0 && cnt
> 0; i
--, cnt
--)
394 if (tags
[v_idx
] == 0xff) /* no version tag */
395 printf_filtered ("-");
397 printf_filtered ("%1X", tags
[v_idx
]);
399 printf_filtered (" ");
402 printf_filtered ("\n");
408 do_examine (CORE_ADDR start
, int bcnt
)
410 CORE_ADDR vaddr
= adi_normalize_address (start
);
412 CORE_ADDR vstart
= adi_align_address (vaddr
);
413 int cnt
= adi_convert_byte_count (vaddr
, bcnt
, vstart
);
414 gdb::def_vector
<gdb_byte
> buf (cnt
);
415 int read_cnt
= adi_read_versions (vstart
, cnt
, buf
.data ());
417 error (_("No ADI information"));
418 else if (read_cnt
< cnt
)
419 error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr
));
421 adi_print_versions (vstart
, cnt
, buf
.data ());
425 do_assign (CORE_ADDR start
, size_t bcnt
, int version
)
427 CORE_ADDR vaddr
= adi_normalize_address (start
);
429 CORE_ADDR vstart
= adi_align_address (vaddr
);
430 int cnt
= adi_convert_byte_count (vaddr
, bcnt
, vstart
);
431 std::vector
<unsigned char> buf (cnt
, version
);
432 int set_cnt
= adi_write_versions (vstart
, cnt
, buf
.data ());
435 error (_("No ADI information"));
436 else if (set_cnt
< cnt
)
437 error(_("No ADI information at %s"), paddress (target_gdbarch (), vaddr
));
441 /* ADI examine version tag command.
445 adi (examine|x)[/COUNT] [ADDR] */
448 adi_examine_command (const char *args
, int from_tty
)
450 /* make sure program is active and adi is available */
451 if (!target_has_execution
)
452 error (_("ADI command requires a live process/thread"));
454 if (!adi_available ())
455 error (_("No ADI information"));
458 const char *p
= args
;
462 cnt
= get_number (&p
);
465 CORE_ADDR next_address
= 0;
466 if (p
!= 0 && *p
!= 0)
467 next_address
= parse_and_eval_address (p
);
468 if (!cnt
|| !next_address
)
469 error (_("Usage: adi examine|x[/COUNT] [ADDR]"));
471 do_examine (next_address
, cnt
);
474 /* ADI assign version tag command.
478 adi (assign|a)[/COUNT] ADDR = VERSION */
481 adi_assign_command (const char *args
, int from_tty
)
483 static const char *adi_usage
484 = N_("Usage: adi assign|a[/COUNT] ADDR = VERSION");
486 /* make sure program is active and adi is available */
487 if (!target_has_execution
)
488 error (_("ADI command requires a live process/thread"));
490 if (!adi_available ())
491 error (_("No ADI information"));
493 const char *exp
= args
;
495 error_no_arg (_(adi_usage
));
497 char *q
= (char *) strchr (exp
, '=');
501 error ("%s", _(adi_usage
));
504 const char *p
= args
;
505 if (exp
&& *exp
== '/')
508 cnt
= get_number (&p
);
511 CORE_ADDR next_address
= 0;
512 if (p
!= 0 && *p
!= 0)
513 next_address
= parse_and_eval_address (p
);
515 error ("%s", _(adi_usage
));
518 if (q
!= NULL
) /* parse version tag */
520 adi_stat_t ast
= get_adi_info (inferior_ptid
.pid ());
521 version
= parse_and_eval_long (q
);
522 if (version
< 0 || version
> ast
.max_version
)
523 error (_("Invalid ADI version tag %d"), version
);
526 do_assign (next_address
, cnt
, version
);
529 void _initialize_sparc64_adi_tdep ();
531 _initialize_sparc64_adi_tdep ()
533 add_basic_prefix_cmd ("adi", class_support
,
534 _("ADI version related commands."),
535 &sparc64adilist
, "adi ", 0, &cmdlist
);
536 add_cmd ("examine", class_support
, adi_examine_command
,
537 _("Examine ADI versions."), &sparc64adilist
);
538 add_alias_cmd ("x", "examine", no_class
, 1, &sparc64adilist
);
539 add_cmd ("assign", class_support
, adi_assign_command
,
540 _("Assign ADI versions."), &sparc64adilist
);
545 /* The functions on this page are intended to be used to classify
546 function arguments. */
548 /* Check whether TYPE is "Integral or Pointer". */
551 sparc64_integral_or_pointer_p (const struct type
*type
)
553 switch (TYPE_CODE (type
))
559 case TYPE_CODE_RANGE
:
561 int len
= TYPE_LENGTH (type
);
562 gdb_assert (len
== 1 || len
== 2 || len
== 4 || len
== 8);
567 case TYPE_CODE_RVALUE_REF
:
569 int len
= TYPE_LENGTH (type
);
570 gdb_assert (len
== 8);
580 /* Check whether TYPE is "Floating". */
583 sparc64_floating_p (const struct type
*type
)
585 switch (TYPE_CODE (type
))
589 int len
= TYPE_LENGTH (type
);
590 gdb_assert (len
== 4 || len
== 8 || len
== 16);
600 /* Check whether TYPE is "Complex Floating". */
603 sparc64_complex_floating_p (const struct type
*type
)
605 switch (TYPE_CODE (type
))
607 case TYPE_CODE_COMPLEX
:
609 int len
= TYPE_LENGTH (type
);
610 gdb_assert (len
== 8 || len
== 16 || len
== 32);
620 /* Check whether TYPE is "Structure or Union".
622 In terms of Ada subprogram calls, arrays are treated the same as
623 struct and union types. So this function also returns non-zero
627 sparc64_structure_or_union_p (const struct type
*type
)
629 switch (TYPE_CODE (type
))
631 case TYPE_CODE_STRUCT
:
632 case TYPE_CODE_UNION
:
633 case TYPE_CODE_ARRAY
:
643 /* Construct types for ISA-specific registers. */
646 sparc64_pstate_type (struct gdbarch
*gdbarch
)
648 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
650 if (!tdep
->sparc64_pstate_type
)
654 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_pstate", 64);
655 append_flags_type_flag (type
, 0, "AG");
656 append_flags_type_flag (type
, 1, "IE");
657 append_flags_type_flag (type
, 2, "PRIV");
658 append_flags_type_flag (type
, 3, "AM");
659 append_flags_type_flag (type
, 4, "PEF");
660 append_flags_type_flag (type
, 5, "RED");
661 append_flags_type_flag (type
, 8, "TLE");
662 append_flags_type_flag (type
, 9, "CLE");
663 append_flags_type_flag (type
, 10, "PID0");
664 append_flags_type_flag (type
, 11, "PID1");
666 tdep
->sparc64_pstate_type
= type
;
669 return tdep
->sparc64_pstate_type
;
673 sparc64_ccr_type (struct gdbarch
*gdbarch
)
675 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
677 if (tdep
->sparc64_ccr_type
== NULL
)
681 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_ccr", 64);
682 append_flags_type_flag (type
, 0, "icc.c");
683 append_flags_type_flag (type
, 1, "icc.v");
684 append_flags_type_flag (type
, 2, "icc.z");
685 append_flags_type_flag (type
, 3, "icc.n");
686 append_flags_type_flag (type
, 4, "xcc.c");
687 append_flags_type_flag (type
, 5, "xcc.v");
688 append_flags_type_flag (type
, 6, "xcc.z");
689 append_flags_type_flag (type
, 7, "xcc.n");
691 tdep
->sparc64_ccr_type
= type
;
694 return tdep
->sparc64_ccr_type
;
698 sparc64_fsr_type (struct gdbarch
*gdbarch
)
700 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
702 if (!tdep
->sparc64_fsr_type
)
706 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_fsr", 64);
707 append_flags_type_flag (type
, 0, "NXC");
708 append_flags_type_flag (type
, 1, "DZC");
709 append_flags_type_flag (type
, 2, "UFC");
710 append_flags_type_flag (type
, 3, "OFC");
711 append_flags_type_flag (type
, 4, "NVC");
712 append_flags_type_flag (type
, 5, "NXA");
713 append_flags_type_flag (type
, 6, "DZA");
714 append_flags_type_flag (type
, 7, "UFA");
715 append_flags_type_flag (type
, 8, "OFA");
716 append_flags_type_flag (type
, 9, "NVA");
717 append_flags_type_flag (type
, 22, "NS");
718 append_flags_type_flag (type
, 23, "NXM");
719 append_flags_type_flag (type
, 24, "DZM");
720 append_flags_type_flag (type
, 25, "UFM");
721 append_flags_type_flag (type
, 26, "OFM");
722 append_flags_type_flag (type
, 27, "NVM");
724 tdep
->sparc64_fsr_type
= type
;
727 return tdep
->sparc64_fsr_type
;
731 sparc64_fprs_type (struct gdbarch
*gdbarch
)
733 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
735 if (!tdep
->sparc64_fprs_type
)
739 type
= arch_flags_type (gdbarch
, "builtin_type_sparc64_fprs", 64);
740 append_flags_type_flag (type
, 0, "DL");
741 append_flags_type_flag (type
, 1, "DU");
742 append_flags_type_flag (type
, 2, "FEF");
744 tdep
->sparc64_fprs_type
= type
;
747 return tdep
->sparc64_fprs_type
;
751 /* Register information. */
752 #define SPARC64_FPU_REGISTERS \
753 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
754 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
755 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
756 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
757 "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \
758 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62"
759 #define SPARC64_CP0_REGISTERS \
761 /* FIXME: Give "state" a name until we start using register groups. */ \
767 static const char *sparc64_fpu_register_names
[] = { SPARC64_FPU_REGISTERS
};
768 static const char *sparc64_cp0_register_names
[] = { SPARC64_CP0_REGISTERS
};
770 static const char *sparc64_register_names
[] =
772 SPARC_CORE_REGISTERS
,
773 SPARC64_FPU_REGISTERS
,
774 SPARC64_CP0_REGISTERS
777 /* Total number of registers. */
778 #define SPARC64_NUM_REGS ARRAY_SIZE (sparc64_register_names)
780 /* We provide the aliases %d0..%d62 and %q0..%q60 for the floating
781 registers as "psuedo" registers. */
783 static const char *sparc64_pseudo_register_names
[] =
785 "cwp", "pstate", "asi", "ccr",
787 "d0", "d2", "d4", "d6", "d8", "d10", "d12", "d14",
788 "d16", "d18", "d20", "d22", "d24", "d26", "d28", "d30",
789 "d32", "d34", "d36", "d38", "d40", "d42", "d44", "d46",
790 "d48", "d50", "d52", "d54", "d56", "d58", "d60", "d62",
792 "q0", "q4", "q8", "q12", "q16", "q20", "q24", "q28",
793 "q32", "q36", "q40", "q44", "q48", "q52", "q56", "q60",
796 /* Total number of pseudo registers. */
797 #define SPARC64_NUM_PSEUDO_REGS ARRAY_SIZE (sparc64_pseudo_register_names)
799 /* Return the name of pseudo register REGNUM. */
802 sparc64_pseudo_register_name (struct gdbarch
*gdbarch
, int regnum
)
804 regnum
-= gdbarch_num_regs (gdbarch
);
806 if (regnum
< SPARC64_NUM_PSEUDO_REGS
)
807 return sparc64_pseudo_register_names
[regnum
];
809 internal_error (__FILE__
, __LINE__
,
810 _("sparc64_pseudo_register_name: bad register number %d"),
814 /* Return the name of register REGNUM. */
817 sparc64_register_name (struct gdbarch
*gdbarch
, int regnum
)
819 if (tdesc_has_registers (gdbarch_target_desc (gdbarch
)))
820 return tdesc_register_name (gdbarch
, regnum
);
822 if (regnum
>= 0 && regnum
< gdbarch_num_regs (gdbarch
))
823 return sparc64_register_names
[regnum
];
825 return sparc64_pseudo_register_name (gdbarch
, regnum
);
828 /* Return the GDB type object for the "standard" data type of data in
829 pseudo register REGNUM. */
832 sparc64_pseudo_register_type (struct gdbarch
*gdbarch
, int regnum
)
834 regnum
-= gdbarch_num_regs (gdbarch
);
836 if (regnum
== SPARC64_CWP_REGNUM
)
837 return builtin_type (gdbarch
)->builtin_int64
;
838 if (regnum
== SPARC64_PSTATE_REGNUM
)
839 return sparc64_pstate_type (gdbarch
);
840 if (regnum
== SPARC64_ASI_REGNUM
)
841 return builtin_type (gdbarch
)->builtin_int64
;
842 if (regnum
== SPARC64_CCR_REGNUM
)
843 return sparc64_ccr_type (gdbarch
);
844 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
845 return builtin_type (gdbarch
)->builtin_double
;
846 if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
847 return builtin_type (gdbarch
)->builtin_long_double
;
849 internal_error (__FILE__
, __LINE__
,
850 _("sparc64_pseudo_register_type: bad register number %d"),
854 /* Return the GDB type object for the "standard" data type of data in
858 sparc64_register_type (struct gdbarch
*gdbarch
, int regnum
)
860 if (tdesc_has_registers (gdbarch_target_desc (gdbarch
)))
861 return tdesc_register_type (gdbarch
, regnum
);
864 if (regnum
== SPARC_SP_REGNUM
|| regnum
== SPARC_FP_REGNUM
)
865 return builtin_type (gdbarch
)->builtin_data_ptr
;
866 if (regnum
>= SPARC_G0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
)
867 return builtin_type (gdbarch
)->builtin_int64
;
868 if (regnum
>= SPARC_F0_REGNUM
&& regnum
<= SPARC_F31_REGNUM
)
869 return builtin_type (gdbarch
)->builtin_float
;
870 if (regnum
>= SPARC64_F32_REGNUM
&& regnum
<= SPARC64_F62_REGNUM
)
871 return builtin_type (gdbarch
)->builtin_double
;
872 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== SPARC64_NPC_REGNUM
)
873 return builtin_type (gdbarch
)->builtin_func_ptr
;
874 /* This raw register contains the contents of %cwp, %pstate, %asi
875 and %ccr as laid out in a %tstate register. */
876 if (regnum
== SPARC64_STATE_REGNUM
)
877 return builtin_type (gdbarch
)->builtin_int64
;
878 if (regnum
== SPARC64_FSR_REGNUM
)
879 return sparc64_fsr_type (gdbarch
);
880 if (regnum
== SPARC64_FPRS_REGNUM
)
881 return sparc64_fprs_type (gdbarch
);
882 /* "Although Y is a 64-bit register, its high-order 32 bits are
883 reserved and always read as 0." */
884 if (regnum
== SPARC64_Y_REGNUM
)
885 return builtin_type (gdbarch
)->builtin_int64
;
887 /* Pseudo registers. */
888 if (regnum
>= gdbarch_num_regs (gdbarch
))
889 return sparc64_pseudo_register_type (gdbarch
, regnum
);
891 internal_error (__FILE__
, __LINE__
, _("invalid regnum"));
894 static enum register_status
895 sparc64_pseudo_register_read (struct gdbarch
*gdbarch
,
896 readable_regcache
*regcache
,
897 int regnum
, gdb_byte
*buf
)
899 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
900 enum register_status status
;
902 regnum
-= gdbarch_num_regs (gdbarch
);
904 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D30_REGNUM
)
906 regnum
= SPARC_F0_REGNUM
+ 2 * (regnum
- SPARC64_D0_REGNUM
);
907 status
= regcache
->raw_read (regnum
, buf
);
908 if (status
== REG_VALID
)
909 status
= regcache
->raw_read (regnum
+ 1, buf
+ 4);
912 else if (regnum
>= SPARC64_D32_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
914 regnum
= SPARC64_F32_REGNUM
+ (regnum
- SPARC64_D32_REGNUM
);
915 return regcache
->raw_read (regnum
, buf
);
917 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q28_REGNUM
)
919 regnum
= SPARC_F0_REGNUM
+ 4 * (regnum
- SPARC64_Q0_REGNUM
);
921 status
= regcache
->raw_read (regnum
, buf
);
922 if (status
== REG_VALID
)
923 status
= regcache
->raw_read (regnum
+ 1, buf
+ 4);
924 if (status
== REG_VALID
)
925 status
= regcache
->raw_read (regnum
+ 2, buf
+ 8);
926 if (status
== REG_VALID
)
927 status
= regcache
->raw_read (regnum
+ 3, buf
+ 12);
931 else if (regnum
>= SPARC64_Q32_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
933 regnum
= SPARC64_F32_REGNUM
+ 2 * (regnum
- SPARC64_Q32_REGNUM
);
935 status
= regcache
->raw_read (regnum
, buf
);
936 if (status
== REG_VALID
)
937 status
= regcache
->raw_read (regnum
+ 1, buf
+ 8);
941 else if (regnum
== SPARC64_CWP_REGNUM
942 || regnum
== SPARC64_PSTATE_REGNUM
943 || regnum
== SPARC64_ASI_REGNUM
944 || regnum
== SPARC64_CCR_REGNUM
)
948 status
= regcache
->raw_read (SPARC64_STATE_REGNUM
, &state
);
949 if (status
!= REG_VALID
)
954 case SPARC64_CWP_REGNUM
:
955 state
= (state
>> 0) & ((1 << 5) - 1);
957 case SPARC64_PSTATE_REGNUM
:
958 state
= (state
>> 8) & ((1 << 12) - 1);
960 case SPARC64_ASI_REGNUM
:
961 state
= (state
>> 24) & ((1 << 8) - 1);
963 case SPARC64_CCR_REGNUM
:
964 state
= (state
>> 32) & ((1 << 8) - 1);
967 store_unsigned_integer (buf
, 8, byte_order
, state
);
974 sparc64_pseudo_register_write (struct gdbarch
*gdbarch
,
975 struct regcache
*regcache
,
976 int regnum
, const gdb_byte
*buf
)
978 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
980 regnum
-= gdbarch_num_regs (gdbarch
);
982 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D30_REGNUM
)
984 regnum
= SPARC_F0_REGNUM
+ 2 * (regnum
- SPARC64_D0_REGNUM
);
985 regcache
->raw_write (regnum
, buf
);
986 regcache
->raw_write (regnum
+ 1, buf
+ 4);
988 else if (regnum
>= SPARC64_D32_REGNUM
&& regnum
<= SPARC64_D62_REGNUM
)
990 regnum
= SPARC64_F32_REGNUM
+ (regnum
- SPARC64_D32_REGNUM
);
991 regcache
->raw_write (regnum
, buf
);
993 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q28_REGNUM
)
995 regnum
= SPARC_F0_REGNUM
+ 4 * (regnum
- SPARC64_Q0_REGNUM
);
996 regcache
->raw_write (regnum
, buf
);
997 regcache
->raw_write (regnum
+ 1, buf
+ 4);
998 regcache
->raw_write (regnum
+ 2, buf
+ 8);
999 regcache
->raw_write (regnum
+ 3, buf
+ 12);
1001 else if (regnum
>= SPARC64_Q32_REGNUM
&& regnum
<= SPARC64_Q60_REGNUM
)
1003 regnum
= SPARC64_F32_REGNUM
+ 2 * (regnum
- SPARC64_Q32_REGNUM
);
1004 regcache
->raw_write (regnum
, buf
);
1005 regcache
->raw_write (regnum
+ 1, buf
+ 8);
1007 else if (regnum
== SPARC64_CWP_REGNUM
1008 || regnum
== SPARC64_PSTATE_REGNUM
1009 || regnum
== SPARC64_ASI_REGNUM
1010 || regnum
== SPARC64_CCR_REGNUM
)
1012 ULONGEST state
, bits
;
1014 regcache_raw_read_unsigned (regcache
, SPARC64_STATE_REGNUM
, &state
);
1015 bits
= extract_unsigned_integer (buf
, 8, byte_order
);
1018 case SPARC64_CWP_REGNUM
:
1019 state
|= ((bits
& ((1 << 5) - 1)) << 0);
1021 case SPARC64_PSTATE_REGNUM
:
1022 state
|= ((bits
& ((1 << 12) - 1)) << 8);
1024 case SPARC64_ASI_REGNUM
:
1025 state
|= ((bits
& ((1 << 8) - 1)) << 24);
1027 case SPARC64_CCR_REGNUM
:
1028 state
|= ((bits
& ((1 << 8) - 1)) << 32);
1031 regcache_raw_write_unsigned (regcache
, SPARC64_STATE_REGNUM
, state
);
1036 /* Return PC of first real instruction of the function starting at
1040 sparc64_skip_prologue (struct gdbarch
*gdbarch
, CORE_ADDR start_pc
)
1042 struct symtab_and_line sal
;
1043 CORE_ADDR func_start
, func_end
;
1044 struct sparc_frame_cache cache
;
1046 /* This is the preferred method, find the end of the prologue by
1047 using the debugging information. */
1048 if (find_pc_partial_function (start_pc
, NULL
, &func_start
, &func_end
))
1050 sal
= find_pc_line (func_start
, 0);
1052 if (sal
.end
< func_end
1053 && start_pc
<= sal
.end
)
1057 return sparc_analyze_prologue (gdbarch
, start_pc
, 0xffffffffffffffffULL
,
1061 /* Normal frames. */
1063 static struct sparc_frame_cache
*
1064 sparc64_frame_cache (struct frame_info
*this_frame
, void **this_cache
)
1066 return sparc_frame_cache (this_frame
, this_cache
);
1070 sparc64_frame_this_id (struct frame_info
*this_frame
, void **this_cache
,
1071 struct frame_id
*this_id
)
1073 struct sparc_frame_cache
*cache
=
1074 sparc64_frame_cache (this_frame
, this_cache
);
1076 /* This marks the outermost frame. */
1077 if (cache
->base
== 0)
1080 (*this_id
) = frame_id_build (cache
->base
, cache
->pc
);
1083 static struct value
*
1084 sparc64_frame_prev_register (struct frame_info
*this_frame
, void **this_cache
,
1087 struct gdbarch
*gdbarch
= get_frame_arch (this_frame
);
1088 struct sparc_frame_cache
*cache
=
1089 sparc64_frame_cache (this_frame
, this_cache
);
1091 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== SPARC64_NPC_REGNUM
)
1093 CORE_ADDR pc
= (regnum
== SPARC64_NPC_REGNUM
) ? 4 : 0;
1096 (cache
->copied_regs_mask
& 0x80) ? SPARC_I7_REGNUM
: SPARC_O7_REGNUM
;
1097 pc
+= get_frame_register_unsigned (this_frame
, regnum
) + 8;
1098 return frame_unwind_got_constant (this_frame
, regnum
, pc
);
1101 /* Handle StackGhost. */
1103 ULONGEST wcookie
= sparc_fetch_wcookie (gdbarch
);
1105 if (wcookie
!= 0 && !cache
->frameless_p
&& regnum
== SPARC_I7_REGNUM
)
1107 CORE_ADDR addr
= cache
->base
+ (regnum
- SPARC_L0_REGNUM
) * 8;
1110 /* Read the value in from memory. */
1111 i7
= get_frame_memory_unsigned (this_frame
, addr
, 8);
1112 return frame_unwind_got_constant (this_frame
, regnum
, i7
^ wcookie
);
1116 /* The previous frame's `local' and `in' registers may have been saved
1117 in the register save area. */
1118 if (regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
1119 && (cache
->saved_regs_mask
& (1 << (regnum
- SPARC_L0_REGNUM
))))
1121 CORE_ADDR addr
= cache
->base
+ (regnum
- SPARC_L0_REGNUM
) * 8;
1123 return frame_unwind_got_memory (this_frame
, regnum
, addr
);
1126 /* The previous frame's `out' registers may be accessible as the current
1127 frame's `in' registers. */
1128 if (regnum
>= SPARC_O0_REGNUM
&& regnum
<= SPARC_O7_REGNUM
1129 && (cache
->copied_regs_mask
& (1 << (regnum
- SPARC_O0_REGNUM
))))
1130 regnum
+= (SPARC_I0_REGNUM
- SPARC_O0_REGNUM
);
1132 return frame_unwind_got_register (this_frame
, regnum
, regnum
);
1135 static const struct frame_unwind sparc64_frame_unwind
=
1138 default_frame_unwind_stop_reason
,
1139 sparc64_frame_this_id
,
1140 sparc64_frame_prev_register
,
1142 default_frame_sniffer
1147 sparc64_frame_base_address (struct frame_info
*this_frame
, void **this_cache
)
1149 struct sparc_frame_cache
*cache
=
1150 sparc64_frame_cache (this_frame
, this_cache
);
1155 static const struct frame_base sparc64_frame_base
=
1157 &sparc64_frame_unwind
,
1158 sparc64_frame_base_address
,
1159 sparc64_frame_base_address
,
1160 sparc64_frame_base_address
1163 /* Check whether TYPE must be 16-byte aligned. */
1166 sparc64_16_byte_align_p (struct type
*type
)
1168 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1170 struct type
*t
= check_typedef (TYPE_TARGET_TYPE (type
));
1172 if (sparc64_floating_p (t
))
1175 if (sparc64_floating_p (type
) && TYPE_LENGTH (type
) == 16)
1178 if (sparc64_structure_or_union_p (type
))
1182 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1184 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1186 if (sparc64_16_byte_align_p (subtype
))
1194 /* Store floating fields of element ELEMENT of an "parameter array"
1195 that has type TYPE and is stored at BITPOS in VALBUF in the
1196 appropriate registers of REGCACHE. This function can be called
1197 recursively and therefore handles floating types in addition to
1201 sparc64_store_floating_fields (struct regcache
*regcache
, struct type
*type
,
1202 const gdb_byte
*valbuf
, int element
, int bitpos
)
1204 struct gdbarch
*gdbarch
= regcache
->arch ();
1205 int len
= TYPE_LENGTH (type
);
1207 gdb_assert (element
< 16);
1209 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1212 int regnum
= SPARC_F0_REGNUM
+ element
* 2 + bitpos
/ 32;
1214 valbuf
+= bitpos
/ 8;
1217 memset (buf
, 0, 8 - len
);
1218 memcpy (buf
+ 8 - len
, valbuf
, len
);
1222 for (int n
= 0; n
< (len
+ 3) / 4; n
++)
1223 regcache
->cooked_write (regnum
+ n
, valbuf
+ n
* 4);
1225 else if (sparc64_floating_p (type
)
1226 || (sparc64_complex_floating_p (type
) && len
<= 16))
1232 gdb_assert (bitpos
== 0);
1233 gdb_assert ((element
% 2) == 0);
1235 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
+ element
/ 2;
1236 regcache
->cooked_write (regnum
, valbuf
);
1240 gdb_assert (bitpos
== 0 || bitpos
== 64);
1242 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1243 + element
+ bitpos
/ 64;
1244 regcache
->cooked_write (regnum
, valbuf
+ (bitpos
/ 8));
1248 gdb_assert (len
== 4);
1249 gdb_assert (bitpos
% 32 == 0 && bitpos
>= 0 && bitpos
< 128);
1251 regnum
= SPARC_F0_REGNUM
+ element
* 2 + bitpos
/ 32;
1252 regcache
->cooked_write (regnum
, valbuf
+ (bitpos
/ 8));
1255 else if (sparc64_structure_or_union_p (type
))
1259 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1261 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1262 int subpos
= bitpos
+ TYPE_FIELD_BITPOS (type
, i
);
1264 sparc64_store_floating_fields (regcache
, subtype
, valbuf
,
1268 /* GCC has an interesting bug. If TYPE is a structure that has
1269 a single `float' member, GCC doesn't treat it as a structure
1270 at all, but rather as an ordinary `float' argument. This
1271 argument will be stored in %f1, as required by the psABI.
1272 However, as a member of a structure the psABI requires it to
1273 be stored in %f0. This bug is present in GCC 3.3.2, but
1274 probably in older releases to. To appease GCC, if a
1275 structure has only a single `float' member, we store its
1276 value in %f1 too (we already have stored in %f0). */
1277 if (TYPE_NFIELDS (type
) == 1)
1279 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, 0));
1281 if (sparc64_floating_p (subtype
) && TYPE_LENGTH (subtype
) == 4)
1282 regcache
->cooked_write (SPARC_F1_REGNUM
, valbuf
);
1287 /* Fetch floating fields from a variable of type TYPE from the
1288 appropriate registers for BITPOS in REGCACHE and store it at BITPOS
1289 in VALBUF. This function can be called recursively and therefore
1290 handles floating types in addition to structures. */
1293 sparc64_extract_floating_fields (struct regcache
*regcache
, struct type
*type
,
1294 gdb_byte
*valbuf
, int bitpos
)
1296 struct gdbarch
*gdbarch
= regcache
->arch ();
1298 if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1300 int len
= TYPE_LENGTH (type
);
1301 int regnum
= SPARC_F0_REGNUM
+ bitpos
/ 32;
1303 valbuf
+= bitpos
/ 8;
1307 regcache
->cooked_read (regnum
, buf
);
1308 memcpy (valbuf
, buf
+ 4 - len
, len
);
1311 for (int i
= 0; i
< (len
+ 3) / 4; i
++)
1312 regcache
->cooked_read (regnum
+ i
, valbuf
+ i
* 4);
1314 else if (sparc64_floating_p (type
))
1316 int len
= TYPE_LENGTH (type
);
1321 gdb_assert (bitpos
== 0 || bitpos
== 128);
1323 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
1325 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1329 gdb_assert (bitpos
% 64 == 0 && bitpos
>= 0 && bitpos
< 256);
1331 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
+ bitpos
/ 64;
1332 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1336 gdb_assert (len
== 4);
1337 gdb_assert (bitpos
% 32 == 0 && bitpos
>= 0 && bitpos
< 256);
1339 regnum
= SPARC_F0_REGNUM
+ bitpos
/ 32;
1340 regcache
->cooked_read (regnum
, valbuf
+ (bitpos
/ 8));
1343 else if (sparc64_structure_or_union_p (type
))
1347 for (i
= 0; i
< TYPE_NFIELDS (type
); i
++)
1349 struct type
*subtype
= check_typedef (TYPE_FIELD_TYPE (type
, i
));
1350 int subpos
= bitpos
+ TYPE_FIELD_BITPOS (type
, i
);
1352 sparc64_extract_floating_fields (regcache
, subtype
, valbuf
, subpos
);
1357 /* Store the NARGS arguments ARGS and STRUCT_ADDR (if STRUCT_RETURN is
1358 non-zero) in REGCACHE and on the stack (starting from address SP). */
1361 sparc64_store_arguments (struct regcache
*regcache
, int nargs
,
1362 struct value
**args
, CORE_ADDR sp
,
1363 function_call_return_method return_method
,
1364 CORE_ADDR struct_addr
)
1366 struct gdbarch
*gdbarch
= regcache
->arch ();
1367 /* Number of extended words in the "parameter array". */
1368 int num_elements
= 0;
1372 /* Take BIAS into account. */
1375 /* First we calculate the number of extended words in the "parameter
1376 array". While doing so we also convert some of the arguments. */
1378 if (return_method
== return_method_struct
)
1381 for (i
= 0; i
< nargs
; i
++)
1383 struct type
*type
= value_type (args
[i
]);
1384 int len
= TYPE_LENGTH (type
);
1386 if (sparc64_structure_or_union_p (type
)
1387 || (sparc64_complex_floating_p (type
) && len
== 32))
1389 /* Structure or Union arguments. */
1392 if (num_elements
% 2 && sparc64_16_byte_align_p (type
))
1394 num_elements
+= ((len
+ 7) / 8);
1398 /* The psABI says that "Structures or unions larger than
1399 sixteen bytes are copied by the caller and passed
1400 indirectly; the caller will pass the address of a
1401 correctly aligned structure value. This sixty-four
1402 bit address will occupy one word in the parameter
1403 array, and may be promoted to an %o register like any
1404 other pointer value." Allocate memory for these
1405 values on the stack. */
1408 /* Use 16-byte alignment for these values. That's
1409 always correct, and wasting a few bytes shouldn't be
1413 write_memory (sp
, value_contents (args
[i
]), len
);
1414 args
[i
] = value_from_pointer (lookup_pointer_type (type
), sp
);
1418 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1420 /* Floating arguments. */
1423 /* The psABI says that "Each quad-precision parameter
1424 value will be assigned to two extended words in the
1428 /* The psABI says that "Long doubles must be
1429 quad-aligned, and thus a hole might be introduced
1430 into the parameter array to force alignment." Skip
1431 an element if necessary. */
1432 if ((num_elements
% 2) && sparc64_16_byte_align_p (type
))
1440 /* Integral and pointer arguments. */
1441 gdb_assert (sparc64_integral_or_pointer_p (type
));
1443 /* The psABI says that "Each argument value of integral type
1444 smaller than an extended word will be widened by the
1445 caller to an extended word according to the signed-ness
1446 of the argument type." */
1448 args
[i
] = value_cast (builtin_type (gdbarch
)->builtin_int64
,
1454 /* Allocate the "parameter array". */
1455 sp
-= num_elements
* 8;
1457 /* The psABI says that "Every stack frame must be 16-byte aligned." */
1460 /* Now we store the arguments in to the "parameter array". Some
1461 Integer or Pointer arguments and Structure or Union arguments
1462 will be passed in %o registers. Some Floating arguments and
1463 floating members of structures are passed in floating-point
1464 registers. However, for functions with variable arguments,
1465 floating arguments are stored in an %0 register, and for
1466 functions without a prototype floating arguments are stored in
1467 both a floating-point and an %o registers, or a floating-point
1468 register and memory. To simplify the logic here we always pass
1469 arguments in memory, an %o register, and a floating-point
1470 register if appropriate. This should be no problem since the
1471 contents of any unused memory or registers in the "parameter
1472 array" are undefined. */
1474 if (return_method
== return_method_struct
)
1476 regcache_cooked_write_unsigned (regcache
, SPARC_O0_REGNUM
, struct_addr
);
1480 for (i
= 0; i
< nargs
; i
++)
1482 const gdb_byte
*valbuf
= value_contents (args
[i
]);
1483 struct type
*type
= value_type (args
[i
]);
1484 int len
= TYPE_LENGTH (type
);
1488 if (sparc64_structure_or_union_p (type
)
1489 || (sparc64_complex_floating_p (type
) && len
== 32))
1491 /* Structure, Union or long double Complex arguments. */
1492 gdb_assert (len
<= 16);
1493 memset (buf
, 0, sizeof (buf
));
1494 memcpy (buf
, valbuf
, len
);
1497 if (element
% 2 && sparc64_16_byte_align_p (type
))
1502 regnum
= SPARC_O0_REGNUM
+ element
;
1503 if (len
> 8 && element
< 5)
1504 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1508 sparc64_store_floating_fields (regcache
, type
, valbuf
, element
, 0);
1510 else if (sparc64_complex_floating_p (type
))
1512 /* Float Complex or double Complex arguments. */
1515 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
+ element
;
1519 if (regnum
< gdbarch_num_regs (gdbarch
) + SPARC64_D30_REGNUM
)
1520 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1521 if (regnum
< gdbarch_num_regs (gdbarch
) + SPARC64_D10_REGNUM
)
1522 regcache
->cooked_write (SPARC_O0_REGNUM
+ element
+ 1,
1527 else if (sparc64_floating_p (type
))
1529 /* Floating arguments. */
1535 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_Q0_REGNUM
1541 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1546 /* The psABI says "Each single-precision parameter value
1547 will be assigned to one extended word in the
1548 parameter array, and right-justified within that
1549 word; the left half (even float register) is
1550 undefined." Even though the psABI says that "the
1551 left half is undefined", set it to zero here. */
1553 memcpy (buf
+ 4, valbuf
, 4);
1557 regnum
= gdbarch_num_regs (gdbarch
) + SPARC64_D0_REGNUM
1563 /* Integral and pointer arguments. */
1564 gdb_assert (len
== 8);
1566 regnum
= SPARC_O0_REGNUM
+ element
;
1571 regcache
->cooked_write (regnum
, valbuf
);
1573 /* If we're storing the value in a floating-point register,
1574 also store it in the corresponding %0 register(s). */
1575 if (regnum
>= gdbarch_num_regs (gdbarch
))
1577 regnum
-= gdbarch_num_regs (gdbarch
);
1579 if (regnum
>= SPARC64_D0_REGNUM
&& regnum
<= SPARC64_D10_REGNUM
)
1581 gdb_assert (element
< 6);
1582 regnum
= SPARC_O0_REGNUM
+ element
;
1583 regcache
->cooked_write (regnum
, valbuf
);
1585 else if (regnum
>= SPARC64_Q0_REGNUM
&& regnum
<= SPARC64_Q8_REGNUM
)
1587 gdb_assert (element
< 5);
1588 regnum
= SPARC_O0_REGNUM
+ element
;
1589 regcache
->cooked_write (regnum
, valbuf
);
1590 regcache
->cooked_write (regnum
+ 1, valbuf
+ 8);
1595 /* Always store the argument in memory. */
1596 write_memory (sp
+ element
* 8, valbuf
, len
);
1597 element
+= ((len
+ 7) / 8);
1600 gdb_assert (element
== num_elements
);
1602 /* Take BIAS into account. */
1608 sparc64_frame_align (struct gdbarch
*gdbarch
, CORE_ADDR address
)
1610 /* The ABI requires 16-byte alignment. */
1611 return address
& ~0xf;
1615 sparc64_push_dummy_call (struct gdbarch
*gdbarch
, struct value
*function
,
1616 struct regcache
*regcache
, CORE_ADDR bp_addr
,
1617 int nargs
, struct value
**args
, CORE_ADDR sp
,
1618 function_call_return_method return_method
,
1619 CORE_ADDR struct_addr
)
1621 /* Set return address. */
1622 regcache_cooked_write_unsigned (regcache
, SPARC_O7_REGNUM
, bp_addr
- 8);
1624 /* Set up function arguments. */
1625 sp
= sparc64_store_arguments (regcache
, nargs
, args
, sp
, return_method
,
1628 /* Allocate the register save area. */
1631 /* Stack should be 16-byte aligned at this point. */
1632 gdb_assert ((sp
+ BIAS
) % 16 == 0);
1634 /* Finally, update the stack pointer. */
1635 regcache_cooked_write_unsigned (regcache
, SPARC_SP_REGNUM
, sp
);
1641 /* Extract from an array REGBUF containing the (raw) register state, a
1642 function return value of TYPE, and copy that into VALBUF. */
1645 sparc64_extract_return_value (struct type
*type
, struct regcache
*regcache
,
1648 int len
= TYPE_LENGTH (type
);
1652 if (sparc64_structure_or_union_p (type
))
1654 /* Structure or Union return values. */
1655 gdb_assert (len
<= 32);
1657 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1658 regcache
->cooked_read (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1659 if (TYPE_CODE (type
) != TYPE_CODE_UNION
)
1660 sparc64_extract_floating_fields (regcache
, type
, buf
, 0);
1661 memcpy (valbuf
, buf
, len
);
1663 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1665 /* Floating return values. */
1666 for (i
= 0; i
< len
/ 4; i
++)
1667 regcache
->cooked_read (SPARC_F0_REGNUM
+ i
, buf
+ i
* 4);
1668 memcpy (valbuf
, buf
, len
);
1670 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1672 /* Small arrays are returned the same way as small structures. */
1673 gdb_assert (len
<= 32);
1675 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1676 regcache
->cooked_read (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1677 memcpy (valbuf
, buf
, len
);
1681 /* Integral and pointer return values. */
1682 gdb_assert (sparc64_integral_or_pointer_p (type
));
1684 /* Just stripping off any unused bytes should preserve the
1685 signed-ness just fine. */
1686 regcache
->cooked_read (SPARC_O0_REGNUM
, buf
);
1687 memcpy (valbuf
, buf
+ 8 - len
, len
);
1691 /* Write into the appropriate registers a function return value stored
1692 in VALBUF of type TYPE. */
1695 sparc64_store_return_value (struct type
*type
, struct regcache
*regcache
,
1696 const gdb_byte
*valbuf
)
1698 int len
= TYPE_LENGTH (type
);
1702 if (sparc64_structure_or_union_p (type
))
1704 /* Structure or Union return values. */
1705 gdb_assert (len
<= 32);
1707 /* Simplify matters by storing the complete value (including
1708 floating members) into %o0 and %o1. Floating members are
1709 also store in the appropriate floating-point registers. */
1710 memset (buf
, 0, sizeof (buf
));
1711 memcpy (buf
, valbuf
, len
);
1712 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1713 regcache
->cooked_write (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1714 if (TYPE_CODE (type
) != TYPE_CODE_UNION
)
1715 sparc64_store_floating_fields (regcache
, type
, buf
, 0, 0);
1717 else if (sparc64_floating_p (type
) || sparc64_complex_floating_p (type
))
1719 /* Floating return values. */
1720 memcpy (buf
, valbuf
, len
);
1721 for (i
= 0; i
< len
/ 4; i
++)
1722 regcache
->cooked_write (SPARC_F0_REGNUM
+ i
, buf
+ i
* 4);
1724 else if (TYPE_CODE (type
) == TYPE_CODE_ARRAY
)
1726 /* Small arrays are returned the same way as small structures. */
1727 gdb_assert (len
<= 32);
1729 memset (buf
, 0, sizeof (buf
));
1730 memcpy (buf
, valbuf
, len
);
1731 for (i
= 0; i
< ((len
+ 7) / 8); i
++)
1732 regcache
->cooked_write (SPARC_O0_REGNUM
+ i
, buf
+ i
* 8);
1736 /* Integral and pointer return values. */
1737 gdb_assert (sparc64_integral_or_pointer_p (type
));
1739 /* ??? Do we need to do any sign-extension here? */
1741 memcpy (buf
+ 8 - len
, valbuf
, len
);
1742 regcache
->cooked_write (SPARC_O0_REGNUM
, buf
);
1746 static enum return_value_convention
1747 sparc64_return_value (struct gdbarch
*gdbarch
, struct value
*function
,
1748 struct type
*type
, struct regcache
*regcache
,
1749 gdb_byte
*readbuf
, const gdb_byte
*writebuf
)
1751 if (TYPE_LENGTH (type
) > 32)
1752 return RETURN_VALUE_STRUCT_CONVENTION
;
1755 sparc64_extract_return_value (type
, regcache
, readbuf
);
1757 sparc64_store_return_value (type
, regcache
, writebuf
);
1759 return RETURN_VALUE_REGISTER_CONVENTION
;
1764 sparc64_dwarf2_frame_init_reg (struct gdbarch
*gdbarch
, int regnum
,
1765 struct dwarf2_frame_state_reg
*reg
,
1766 struct frame_info
*this_frame
)
1770 case SPARC_G0_REGNUM
:
1771 /* Since %g0 is always zero, there is no point in saving it, and
1772 people will be inclined omit it from the CFI. Make sure we
1773 don't warn about that. */
1774 reg
->how
= DWARF2_FRAME_REG_SAME_VALUE
;
1776 case SPARC_SP_REGNUM
:
1777 reg
->how
= DWARF2_FRAME_REG_CFA
;
1779 case SPARC64_PC_REGNUM
:
1780 reg
->how
= DWARF2_FRAME_REG_RA_OFFSET
;
1781 reg
->loc
.offset
= 8;
1783 case SPARC64_NPC_REGNUM
:
1784 reg
->how
= DWARF2_FRAME_REG_RA_OFFSET
;
1785 reg
->loc
.offset
= 12;
1790 /* sparc64_addr_bits_remove - remove useless address bits */
1793 sparc64_addr_bits_remove (struct gdbarch
*gdbarch
, CORE_ADDR addr
)
1795 return adi_normalize_address (addr
);
1799 sparc64_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
1801 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
1803 tdep
->pc_regnum
= SPARC64_PC_REGNUM
;
1804 tdep
->npc_regnum
= SPARC64_NPC_REGNUM
;
1805 tdep
->fpu_register_names
= sparc64_fpu_register_names
;
1806 tdep
->fpu_registers_num
= ARRAY_SIZE (sparc64_fpu_register_names
);
1807 tdep
->cp0_register_names
= sparc64_cp0_register_names
;
1808 tdep
->cp0_registers_num
= ARRAY_SIZE (sparc64_cp0_register_names
);
1810 /* This is what all the fuss is about. */
1811 set_gdbarch_long_bit (gdbarch
, 64);
1812 set_gdbarch_long_long_bit (gdbarch
, 64);
1813 set_gdbarch_ptr_bit (gdbarch
, 64);
1815 set_gdbarch_wchar_bit (gdbarch
, 16);
1816 set_gdbarch_wchar_signed (gdbarch
, 0);
1818 set_gdbarch_num_regs (gdbarch
, SPARC64_NUM_REGS
);
1819 set_gdbarch_register_name (gdbarch
, sparc64_register_name
);
1820 set_gdbarch_register_type (gdbarch
, sparc64_register_type
);
1821 set_gdbarch_num_pseudo_regs (gdbarch
, SPARC64_NUM_PSEUDO_REGS
);
1822 set_tdesc_pseudo_register_name (gdbarch
, sparc64_pseudo_register_name
);
1823 set_tdesc_pseudo_register_type (gdbarch
, sparc64_pseudo_register_type
);
1824 set_gdbarch_pseudo_register_read (gdbarch
, sparc64_pseudo_register_read
);
1825 set_gdbarch_pseudo_register_write (gdbarch
, sparc64_pseudo_register_write
);
1827 /* Register numbers of various important registers. */
1828 set_gdbarch_pc_regnum (gdbarch
, SPARC64_PC_REGNUM
); /* %pc */
1830 /* Call dummy code. */
1831 set_gdbarch_frame_align (gdbarch
, sparc64_frame_align
);
1832 set_gdbarch_call_dummy_location (gdbarch
, AT_ENTRY_POINT
);
1833 set_gdbarch_push_dummy_code (gdbarch
, NULL
);
1834 set_gdbarch_push_dummy_call (gdbarch
, sparc64_push_dummy_call
);
1836 set_gdbarch_return_value (gdbarch
, sparc64_return_value
);
1837 set_gdbarch_stabs_argument_has_addr
1838 (gdbarch
, default_stabs_argument_has_addr
);
1840 set_gdbarch_skip_prologue (gdbarch
, sparc64_skip_prologue
);
1841 set_gdbarch_stack_frame_destroyed_p (gdbarch
, sparc_stack_frame_destroyed_p
);
1843 /* Hook in the DWARF CFI frame unwinder. */
1844 dwarf2_frame_set_init_reg (gdbarch
, sparc64_dwarf2_frame_init_reg
);
1845 /* FIXME: kettenis/20050423: Don't enable the unwinder until the
1846 StackGhost issues have been resolved. */
1848 frame_unwind_append_unwinder (gdbarch
, &sparc64_frame_unwind
);
1849 frame_base_set_default (gdbarch
, &sparc64_frame_base
);
1851 set_gdbarch_addr_bits_remove (gdbarch
, sparc64_addr_bits_remove
);
1855 /* Helper functions for dealing with register sets. */
1857 #define TSTATE_CWP 0x000000000000001fULL
1858 #define TSTATE_ICC 0x0000000f00000000ULL
1859 #define TSTATE_XCC 0x000000f000000000ULL
1861 #define PSR_S 0x00000080
1863 #define PSR_ICC 0x00f00000
1865 #define PSR_VERS 0x0f000000
1867 #define PSR_IMPL 0xf0000000
1869 #define PSR_V8PLUS 0xff000000
1870 #define PSR_XCC 0x000f0000
1873 sparc64_supply_gregset (const struct sparc_gregmap
*gregmap
,
1874 struct regcache
*regcache
,
1875 int regnum
, const void *gregs
)
1877 struct gdbarch
*gdbarch
= regcache
->arch ();
1878 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1879 int sparc32
= (gdbarch_ptr_bit (gdbarch
) == 32);
1880 const gdb_byte
*regs
= (const gdb_byte
*) gregs
;
1881 gdb_byte zero
[8] = { 0 };
1886 if (regnum
== SPARC32_PSR_REGNUM
|| regnum
== -1)
1888 int offset
= gregmap
->r_tstate_offset
;
1889 ULONGEST tstate
, psr
;
1892 tstate
= extract_unsigned_integer (regs
+ offset
, 8, byte_order
);
1893 psr
= ((tstate
& TSTATE_CWP
) | PSR_S
| ((tstate
& TSTATE_ICC
) >> 12)
1894 | ((tstate
& TSTATE_XCC
) >> 20) | PSR_V8PLUS
);
1895 store_unsigned_integer (buf
, 4, byte_order
, psr
);
1896 regcache
->raw_supply (SPARC32_PSR_REGNUM
, buf
);
1899 if (regnum
== SPARC32_PC_REGNUM
|| regnum
== -1)
1900 regcache
->raw_supply (SPARC32_PC_REGNUM
,
1901 regs
+ gregmap
->r_pc_offset
+ 4);
1903 if (regnum
== SPARC32_NPC_REGNUM
|| regnum
== -1)
1904 regcache
->raw_supply (SPARC32_NPC_REGNUM
,
1905 regs
+ gregmap
->r_npc_offset
+ 4);
1907 if (regnum
== SPARC32_Y_REGNUM
|| regnum
== -1)
1909 int offset
= gregmap
->r_y_offset
+ 8 - gregmap
->r_y_size
;
1910 regcache
->raw_supply (SPARC32_Y_REGNUM
, regs
+ offset
);
1915 if (regnum
== SPARC64_STATE_REGNUM
|| regnum
== -1)
1916 regcache
->raw_supply (SPARC64_STATE_REGNUM
,
1917 regs
+ gregmap
->r_tstate_offset
);
1919 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== -1)
1920 regcache
->raw_supply (SPARC64_PC_REGNUM
,
1921 regs
+ gregmap
->r_pc_offset
);
1923 if (regnum
== SPARC64_NPC_REGNUM
|| regnum
== -1)
1924 regcache
->raw_supply (SPARC64_NPC_REGNUM
,
1925 regs
+ gregmap
->r_npc_offset
);
1927 if (regnum
== SPARC64_Y_REGNUM
|| regnum
== -1)
1932 memcpy (buf
+ 8 - gregmap
->r_y_size
,
1933 regs
+ gregmap
->r_y_offset
, gregmap
->r_y_size
);
1934 regcache
->raw_supply (SPARC64_Y_REGNUM
, buf
);
1937 if ((regnum
== SPARC64_FPRS_REGNUM
|| regnum
== -1)
1938 && gregmap
->r_fprs_offset
!= -1)
1939 regcache
->raw_supply (SPARC64_FPRS_REGNUM
,
1940 regs
+ gregmap
->r_fprs_offset
);
1943 if (regnum
== SPARC_G0_REGNUM
|| regnum
== -1)
1944 regcache
->raw_supply (SPARC_G0_REGNUM
, &zero
);
1946 if ((regnum
>= SPARC_G1_REGNUM
&& regnum
<= SPARC_O7_REGNUM
) || regnum
== -1)
1948 int offset
= gregmap
->r_g1_offset
;
1953 for (i
= SPARC_G1_REGNUM
; i
<= SPARC_O7_REGNUM
; i
++)
1955 if (regnum
== i
|| regnum
== -1)
1956 regcache
->raw_supply (i
, regs
+ offset
);
1961 if ((regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
) || regnum
== -1)
1963 /* Not all of the register set variants include Locals and
1964 Inputs. For those that don't, we read them off the stack. */
1965 if (gregmap
->r_l0_offset
== -1)
1969 regcache_cooked_read_unsigned (regcache
, SPARC_SP_REGNUM
, &sp
);
1970 sparc_supply_rwindow (regcache
, sp
, regnum
);
1974 int offset
= gregmap
->r_l0_offset
;
1979 for (i
= SPARC_L0_REGNUM
; i
<= SPARC_I7_REGNUM
; i
++)
1981 if (regnum
== i
|| regnum
== -1)
1982 regcache
->raw_supply (i
, regs
+ offset
);
1990 sparc64_collect_gregset (const struct sparc_gregmap
*gregmap
,
1991 const struct regcache
*regcache
,
1992 int regnum
, void *gregs
)
1994 struct gdbarch
*gdbarch
= regcache
->arch ();
1995 enum bfd_endian byte_order
= gdbarch_byte_order (gdbarch
);
1996 int sparc32
= (gdbarch_ptr_bit (gdbarch
) == 32);
1997 gdb_byte
*regs
= (gdb_byte
*) gregs
;
2002 if (regnum
== SPARC32_PSR_REGNUM
|| regnum
== -1)
2004 int offset
= gregmap
->r_tstate_offset
;
2005 ULONGEST tstate
, psr
;
2008 tstate
= extract_unsigned_integer (regs
+ offset
, 8, byte_order
);
2009 regcache
->raw_collect (SPARC32_PSR_REGNUM
, buf
);
2010 psr
= extract_unsigned_integer (buf
, 4, byte_order
);
2011 tstate
|= (psr
& PSR_ICC
) << 12;
2012 if ((psr
& (PSR_VERS
| PSR_IMPL
)) == PSR_V8PLUS
)
2013 tstate
|= (psr
& PSR_XCC
) << 20;
2014 store_unsigned_integer (buf
, 8, byte_order
, tstate
);
2015 memcpy (regs
+ offset
, buf
, 8);
2018 if (regnum
== SPARC32_PC_REGNUM
|| regnum
== -1)
2019 regcache
->raw_collect (SPARC32_PC_REGNUM
,
2020 regs
+ gregmap
->r_pc_offset
+ 4);
2022 if (regnum
== SPARC32_NPC_REGNUM
|| regnum
== -1)
2023 regcache
->raw_collect (SPARC32_NPC_REGNUM
,
2024 regs
+ gregmap
->r_npc_offset
+ 4);
2026 if (regnum
== SPARC32_Y_REGNUM
|| regnum
== -1)
2028 int offset
= gregmap
->r_y_offset
+ 8 - gregmap
->r_y_size
;
2029 regcache
->raw_collect (SPARC32_Y_REGNUM
, regs
+ offset
);
2034 if (regnum
== SPARC64_STATE_REGNUM
|| regnum
== -1)
2035 regcache
->raw_collect (SPARC64_STATE_REGNUM
,
2036 regs
+ gregmap
->r_tstate_offset
);
2038 if (regnum
== SPARC64_PC_REGNUM
|| regnum
== -1)
2039 regcache
->raw_collect (SPARC64_PC_REGNUM
,
2040 regs
+ gregmap
->r_pc_offset
);
2042 if (regnum
== SPARC64_NPC_REGNUM
|| regnum
== -1)
2043 regcache
->raw_collect (SPARC64_NPC_REGNUM
,
2044 regs
+ gregmap
->r_npc_offset
);
2046 if (regnum
== SPARC64_Y_REGNUM
|| regnum
== -1)
2050 regcache
->raw_collect (SPARC64_Y_REGNUM
, buf
);
2051 memcpy (regs
+ gregmap
->r_y_offset
,
2052 buf
+ 8 - gregmap
->r_y_size
, gregmap
->r_y_size
);
2055 if ((regnum
== SPARC64_FPRS_REGNUM
|| regnum
== -1)
2056 && gregmap
->r_fprs_offset
!= -1)
2057 regcache
->raw_collect (SPARC64_FPRS_REGNUM
,
2058 regs
+ gregmap
->r_fprs_offset
);
2062 if ((regnum
>= SPARC_G1_REGNUM
&& regnum
<= SPARC_O7_REGNUM
) || regnum
== -1)
2064 int offset
= gregmap
->r_g1_offset
;
2069 /* %g0 is always zero. */
2070 for (i
= SPARC_G1_REGNUM
; i
<= SPARC_O7_REGNUM
; i
++)
2072 if (regnum
== i
|| regnum
== -1)
2073 regcache
->raw_collect (i
, regs
+ offset
);
2078 if ((regnum
>= SPARC_L0_REGNUM
&& regnum
<= SPARC_I7_REGNUM
) || regnum
== -1)
2080 /* Not all of the register set variants include Locals and
2081 Inputs. For those that don't, we read them off the stack. */
2082 if (gregmap
->r_l0_offset
!= -1)
2084 int offset
= gregmap
->r_l0_offset
;
2089 for (i
= SPARC_L0_REGNUM
; i
<= SPARC_I7_REGNUM
; i
++)
2091 if (regnum
== i
|| regnum
== -1)
2092 regcache
->raw_collect (i
, regs
+ offset
);
2100 sparc64_supply_fpregset (const struct sparc_fpregmap
*fpregmap
,
2101 struct regcache
*regcache
,
2102 int regnum
, const void *fpregs
)
2104 int sparc32
= (gdbarch_ptr_bit (regcache
->arch ()) == 32);
2105 const gdb_byte
*regs
= (const gdb_byte
*) fpregs
;
2108 for (i
= 0; i
< 32; i
++)
2110 if (regnum
== (SPARC_F0_REGNUM
+ i
) || regnum
== -1)
2111 regcache
->raw_supply (SPARC_F0_REGNUM
+ i
,
2112 regs
+ fpregmap
->r_f0_offset
+ (i
* 4));
2117 if (regnum
== SPARC32_FSR_REGNUM
|| regnum
== -1)
2118 regcache
->raw_supply (SPARC32_FSR_REGNUM
,
2119 regs
+ fpregmap
->r_fsr_offset
);
2123 for (i
= 0; i
< 16; i
++)
2125 if (regnum
== (SPARC64_F32_REGNUM
+ i
) || regnum
== -1)
2126 regcache
->raw_supply
2127 (SPARC64_F32_REGNUM
+ i
,
2128 regs
+ fpregmap
->r_f0_offset
+ (32 * 4) + (i
* 8));
2131 if (regnum
== SPARC64_FSR_REGNUM
|| regnum
== -1)
2132 regcache
->raw_supply (SPARC64_FSR_REGNUM
,
2133 regs
+ fpregmap
->r_fsr_offset
);
2138 sparc64_collect_fpregset (const struct sparc_fpregmap
*fpregmap
,
2139 const struct regcache
*regcache
,
2140 int regnum
, void *fpregs
)
2142 int sparc32
= (gdbarch_ptr_bit (regcache
->arch ()) == 32);
2143 gdb_byte
*regs
= (gdb_byte
*) fpregs
;
2146 for (i
= 0; i
< 32; i
++)
2148 if (regnum
== (SPARC_F0_REGNUM
+ i
) || regnum
== -1)
2149 regcache
->raw_collect (SPARC_F0_REGNUM
+ i
,
2150 regs
+ fpregmap
->r_f0_offset
+ (i
* 4));
2155 if (regnum
== SPARC32_FSR_REGNUM
|| regnum
== -1)
2156 regcache
->raw_collect (SPARC32_FSR_REGNUM
,
2157 regs
+ fpregmap
->r_fsr_offset
);
2161 for (i
= 0; i
< 16; i
++)
2163 if (regnum
== (SPARC64_F32_REGNUM
+ i
) || regnum
== -1)
2164 regcache
->raw_collect (SPARC64_F32_REGNUM
+ i
,
2165 (regs
+ fpregmap
->r_f0_offset
2166 + (32 * 4) + (i
* 8)));
2169 if (regnum
== SPARC64_FSR_REGNUM
|| regnum
== -1)
2170 regcache
->raw_collect (SPARC64_FSR_REGNUM
,
2171 regs
+ fpregmap
->r_fsr_offset
);
2175 const struct sparc_fpregmap sparc64_bsd_fpregmap
=