GDB (xrefs)
Loading...
Searching...
No Matches
aarch64-linux-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for GNU/Linux AArch64.
2
3 Copyright (C) 2009-2023 Free Software Foundation, Inc.
4 Contributed by ARM Ltd.
5
6 This file is part of GDB.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21#include "defs.h"
22
23#include "gdbarch.h"
24#include "glibc-tdep.h"
25#include "linux-tdep.h"
26#include "aarch64-tdep.h"
27#include "aarch64-linux-tdep.h"
28#include "osabi.h"
29#include "solib-svr4.h"
30#include "symtab.h"
31#include "tramp-frame.h"
32#include "trad-frame.h"
33#include "target.h"
34#include "target/target.h"
35#include "expop.h"
36#include "auxv.h"
37
38#include "regcache.h"
39#include "regset.h"
40
41#include "stap-probe.h"
42#include "parser-defs.h"
43#include "user-regs.h"
44#include "xml-syscall.h"
45#include <ctype.h>
46
47#include "record-full.h"
48#include "linux-record.h"
49
52
53#include "arch-utils.h"
54#include "value.h"
55
56#include "gdbsupport/selftest.h"
57
58#include "elf/common.h"
59#include "elf/aarch64.h"
60#include "arch/aarch64-insn.h"
61
62/* For std::pow */
63#include <cmath>
64
65/* Signal frame handling.
66
67 +------------+ ^
68 | saved lr | |
69 +->| saved fp |--+
70 | | |
71 | | |
72 | +------------+
73 | | saved lr |
74 +--| saved fp |
75 ^ | |
76 | | |
77 | +------------+
78 ^ | |
79 | | signal |
80 | | | SIGTRAMP_FRAME (struct rt_sigframe)
81 | | saved regs |
82 +--| saved sp |--> interrupted_sp
83 | | saved pc |--> interrupted_pc
84 | | |
85 | +------------+
86 | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0)
87 +--| saved fp |<- FP
88 | | NORMAL_FRAME
89 | |<- SP
90 +------------+
91
92 On signal delivery, the kernel will create a signal handler stack
93 frame and setup the return address in LR to point at restorer stub.
94 The signal stack frame is defined by:
95
96 struct rt_sigframe
97 {
98 siginfo_t info;
99 struct ucontext uc;
100 };
101
102 The ucontext has the following form:
103 struct ucontext
104 {
105 unsigned long uc_flags;
106 struct ucontext *uc_link;
107 stack_t uc_stack;
108 sigset_t uc_sigmask;
109 struct sigcontext uc_mcontext;
110 };
111
112 struct sigcontext
113 {
114 unsigned long fault_address;
115 unsigned long regs[31];
116 unsigned long sp; / * 31 * /
117 unsigned long pc; / * 32 * /
118 unsigned long pstate; / * 33 * /
119 __u8 __reserved[4096]
120 };
121
122 The reserved space in sigcontext contains additional structures, each starting
123 with a aarch64_ctx, which specifies a unique identifier and the total size of
124 the structure. The final structure in reserved will start will a null
125 aarch64_ctx. The penultimate entry in reserved may be a extra_context which
126 then points to a further block of reserved space.
127
128 struct aarch64_ctx {
129 u32 magic;
130 u32 size;
131 };
132
133 The restorer stub will always have the form:
134
135 d28015a8 movz x8, #0xad
136 d4000001 svc #0x0
137
138 This is a system call sys_rt_sigreturn.
139
140 We detect signal frames by snooping the return code for the restorer
141 instruction sequence.
142
143 The handler then needs to recover the saved register set from
144 ucontext.uc_mcontext. */
145
146/* These magic numbers need to reflect the layout of the kernel
147 defined struct rt_sigframe and ucontext. */
148#define AARCH64_SIGCONTEXT_REG_SIZE 8
149#define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
150#define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
151#define AARCH64_SIGCONTEXT_XO_OFFSET 8
152#define AARCH64_SIGCONTEXT_RESERVED_OFFSET 288
153
154#define AARCH64_SIGCONTEXT_RESERVED_SIZE 4096
155
156/* Unique identifiers that may be used for aarch64_ctx.magic. */
157#define AARCH64_EXTRA_MAGIC 0x45585401
158#define AARCH64_FPSIMD_MAGIC 0x46508001
159#define AARCH64_SVE_MAGIC 0x53564501
160#define AARCH64_ZA_MAGIC 0x54366345
161#define AARCH64_TPIDR2_MAGIC 0x54504902
162#define AARCH64_ZT_MAGIC 0x5a544e01
163
164/* Defines for the extra_context that follows an AARCH64_EXTRA_MAGIC. */
165#define AARCH64_EXTRA_DATAP_OFFSET 8
166
167/* Defines for the fpsimd that follows an AARCH64_FPSIMD_MAGIC. */
168#define AARCH64_FPSIMD_FPSR_OFFSET 8
169#define AARCH64_FPSIMD_FPCR_OFFSET 12
170#define AARCH64_FPSIMD_V0_OFFSET 16
171#define AARCH64_FPSIMD_VREG_SIZE 16
172
173/* Defines for the sve structure that follows an AARCH64_SVE_MAGIC. */
174#define AARCH64_SVE_CONTEXT_VL_OFFSET 8
175#define AARCH64_SVE_CONTEXT_FLAGS_OFFSET 10
176#define AARCH64_SVE_CONTEXT_REGS_OFFSET 16
177#define AARCH64_SVE_CONTEXT_P_REGS_OFFSET(vq) (32 * vq * 16)
178#define AARCH64_SVE_CONTEXT_FFR_OFFSET(vq) \
179 (AARCH64_SVE_CONTEXT_P_REGS_OFFSET (vq) + (16 * vq * 2))
180#define AARCH64_SVE_CONTEXT_SIZE(vq) \
181 (AARCH64_SVE_CONTEXT_FFR_OFFSET (vq) + (vq * 2))
182/* Flag indicating the SVE Context describes streaming mode. */
183#define SVE_SIG_FLAG_SM 0x1
184
185/* SME constants. */
186#define AARCH64_SME_CONTEXT_SVL_OFFSET 8
187#define AARCH64_SME_CONTEXT_REGS_OFFSET 16
188#define AARCH64_SME_CONTEXT_ZA_SIZE(svq) \
189 ((sve_vl_from_vq (svq) * sve_vl_from_vq (svq)))
190#define AARCH64_SME_CONTEXT_SIZE(svq) \
191 (AARCH64_SME_CONTEXT_REGS_OFFSET + AARCH64_SME_CONTEXT_ZA_SIZE (svq))
192
193/* TPIDR2 register value offset in the TPIDR2 signal frame context. */
194#define AARCH64_TPIDR2_CONTEXT_TPIDR2_OFFSET 8
195
196/* SME2 (ZT) constants. */
197/* Offset of the field containing the number of registers in the SME2 signal
198 context state. */
199#define AARCH64_SME2_CONTEXT_NREGS_OFFSET 8
200/* Offset of the beginning of the register data for the first ZT register in
201 the signal context state. */
202#define AARCH64_SME2_CONTEXT_REGS_OFFSET 16
203
204/* Holds information about the signal frame. */
206{
207 /* The stack pointer value. */
208 CORE_ADDR sp = 0;
209 /* The sigcontext address. */
210 CORE_ADDR sigcontext_address = 0;
211 /* The start/end signal frame section addresses. */
212 CORE_ADDR section = 0;
213 CORE_ADDR section_end = 0;
214
215 /* Starting address of the section containing the general purpose
216 registers. */
217 CORE_ADDR gpr_section = 0;
218 /* Starting address of the section containing the FPSIMD registers. */
219 CORE_ADDR fpsimd_section = 0;
220 /* Starting address of the section containing the SVE registers. */
221 CORE_ADDR sve_section = 0;
222 /* Starting address of the section containing the ZA register. */
223 CORE_ADDR za_section = 0;
224 /* Starting address of the section containing the TPIDR2 register. */
225 CORE_ADDR tpidr2_section = 0;
226 /* Starting address of the section containing the ZT registers. */
227 CORE_ADDR zt_section = 0;
228 /* Starting address of the section containing extra information. */
229 CORE_ADDR extra_section = 0;
230
231 /* The vector length (SVE or SSVE). */
232 ULONGEST vl = 0;
233 /* The streaming vector length (SSVE/ZA). */
234 ULONGEST svl = 0;
235 /* Number of ZT registers in this context. */
236 unsigned int zt_register_count = 0;
237
238 /* True if we are in streaming mode, false otherwise. */
239 bool streaming_mode = false;
240 /* True if we have a ZA payload, false otherwise. */
241 bool za_payload = false;
242 /* True if we have a ZT entry in the signal context, false otherwise. */
243 bool zt_available = false;
244};
245
246/* Read an aarch64_ctx, returning the magic value, and setting *SIZE to the
247 size, or return 0 on error. */
248
249static uint32_t
250read_aarch64_ctx (CORE_ADDR ctx_addr, enum bfd_endian byte_order,
251 uint32_t *size)
252{
253 uint32_t magic = 0;
254 gdb_byte buf[4];
255
256 if (target_read_memory (ctx_addr, buf, 4) != 0)
257 return 0;
258 magic = extract_unsigned_integer (buf, 4, byte_order);
259
260 if (target_read_memory (ctx_addr + 4, buf, 4) != 0)
261 return 0;
262 *size = extract_unsigned_integer (buf, 4, byte_order);
263
264 return magic;
265}
266
267/* Given CACHE, use the trad_frame* functions to restore the FPSIMD
268 registers from a signal frame.
269
270 FPSIMD_CONTEXT is the address of the signal frame context containing FPSIMD
271 data. */
272
273static void
275 struct trad_frame_cache *cache,
276 CORE_ADDR fpsimd_context)
277{
278 /* WARNING: SIMD state is laid out in memory in target-endian format.
279
280 So we have a couple cases to consider:
281
282 1 - If the target is big endian, then SIMD state is big endian,
283 requiring a byteswap.
284
285 2 - If the target is little endian, then SIMD state is little endian, so
286 no byteswap is needed. */
287
288 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
289 int num_regs = gdbarch_num_regs (gdbarch);
290 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
291
292 for (int i = 0; i < 32; i++)
293 {
294 CORE_ADDR offset = (fpsimd_context + AARCH64_FPSIMD_V0_OFFSET
296
297 gdb_byte buf[V_REGISTER_SIZE];
298
299 /* Read the contents of the V register. */
300 if (target_read_memory (offset, buf, V_REGISTER_SIZE))
301 error (_("Failed to read fpsimd register from signal context."));
302
303 if (byte_order == BFD_ENDIAN_BIG)
304 {
305 size_t size = V_REGISTER_SIZE/2;
306
307 /* Read the two halves of the V register in reverse byte order. */
308 CORE_ADDR u64 = extract_unsigned_integer (buf, size,
309 byte_order);
310 CORE_ADDR l64 = extract_unsigned_integer (buf + size, size,
311 byte_order);
312
313 /* Copy the reversed bytes to the buffer. */
314 store_unsigned_integer (buf, size, BFD_ENDIAN_LITTLE, l64);
315 store_unsigned_integer (buf + size , size, BFD_ENDIAN_LITTLE, u64);
316
317 /* Now we can store the correct bytes for the V register. */
319 {buf, V_REGISTER_SIZE});
321 num_regs + AARCH64_Q0_REGNUM
322 + i, {buf, Q_REGISTER_SIZE});
324 num_regs + AARCH64_D0_REGNUM
325 + i, {buf, D_REGISTER_SIZE});
327 num_regs + AARCH64_S0_REGNUM
328 + i, {buf, S_REGISTER_SIZE});
330 num_regs + AARCH64_H0_REGNUM
331 + i, {buf, H_REGISTER_SIZE});
333 num_regs + AARCH64_B0_REGNUM
334 + i, {buf, B_REGISTER_SIZE});
335
336 if (tdep->has_sve ())
338 num_regs + AARCH64_SVE_V0_REGNUM
339 + i, {buf, V_REGISTER_SIZE});
340 }
341 else
342 {
343 /* Little endian, just point at the address containing the register
344 value. */
345 trad_frame_set_reg_addr (cache, AARCH64_V0_REGNUM + i, offset);
346 trad_frame_set_reg_addr (cache, num_regs + AARCH64_Q0_REGNUM + i,
347 offset);
348 trad_frame_set_reg_addr (cache, num_regs + AARCH64_D0_REGNUM + i,
349 offset);
350 trad_frame_set_reg_addr (cache, num_regs + AARCH64_S0_REGNUM + i,
351 offset);
352 trad_frame_set_reg_addr (cache, num_regs + AARCH64_H0_REGNUM + i,
353 offset);
354 trad_frame_set_reg_addr (cache, num_regs + AARCH64_B0_REGNUM + i,
355 offset);
356
357 if (tdep->has_sve ())
359 + i, offset);
360 }
361
362 if (tdep->has_sve ())
363 {
364 /* If SVE is supported for this target, zero out the Z
365 registers then copy the first 16 bytes of each of the V
366 registers to the associated Z register. Otherwise the Z
367 registers will contain uninitialized data. */
368 std::vector<gdb_byte> z_buffer (tdep->vq * 16);
369
370 /* We have already handled the endianness swap above, so we don't need
371 to worry about it here. */
372 memcpy (z_buffer.data (), buf, V_REGISTER_SIZE);
375 z_buffer);
376 }
377 }
378}
379
380/* Given a signal frame THIS_FRAME, read the signal frame information into
381 SIGNAL_FRAME. */
382
383static void
385 struct aarch64_linux_sigframe &signal_frame)
386{
387 signal_frame.sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
388 signal_frame.sigcontext_address
391 signal_frame.section
393 signal_frame.section_end
395
396 signal_frame.gpr_section
398
399 /* Search for all the other sections, stopping at null. */
400 CORE_ADDR section = signal_frame.section;
401 CORE_ADDR section_end = signal_frame.section_end;
402 uint32_t size, magic;
403 bool extra_found = false;
404 enum bfd_endian byte_order
405 = gdbarch_byte_order (get_frame_arch (this_frame));
406
407 while ((magic = read_aarch64_ctx (section, byte_order, &size)) != 0
408 && size != 0)
409 {
410 switch (magic)
411 {
413 {
414 signal_frame.fpsimd_section = section;
415 section += size;
416 break;
417 }
418
420 {
421 /* Check if the section is followed by a full SVE dump, and set
422 sve_regs if it is. */
423 gdb_byte buf[4];
424
425 /* Extract the vector length. */
427 buf, 2) != 0)
428 {
429 warning (_("Failed to read the vector length from the SVE "
430 "signal frame context."));
431 section += size;
432 break;
433 }
434
435 signal_frame.vl = extract_unsigned_integer (buf, 2, byte_order);
436
437 /* Extract the flags to check if we are in streaming mode. */
438 if (target_read_memory (section
440 buf, 2) != 0)
441 {
442 warning (_("Failed to read the flags from the SVE signal frame"
443 " context."));
444 section += size;
445 break;
446 }
447
448 uint16_t flags = extract_unsigned_integer (buf, 2, byte_order);
449
450 /* Is this SSVE data? If so, we are in streaming mode. */
451 signal_frame.streaming_mode
452 = (flags & SVE_SIG_FLAG_SM) ? true : false;
453
454 ULONGEST vq = sve_vq_from_vl (signal_frame.vl);
455 if (size >= AARCH64_SVE_CONTEXT_SIZE (vq))
456 {
457 signal_frame.sve_section
459 }
460 section += size;
461 break;
462 }
463
464 case AARCH64_ZA_MAGIC:
465 {
466 /* Check if the section is followed by a full ZA dump, and set
467 za_state if it is. */
468 gdb_byte buf[2];
469
470 /* Extract the streaming vector length. */
472 buf, 2) != 0)
473 {
474 warning (_("Failed to read the streaming vector length from "
475 "ZA signal frame context."));
476 section += size;
477 break;
478 }
479
480 signal_frame.svl = extract_unsigned_integer (buf, 2, byte_order);
481 ULONGEST svq = sve_vq_from_vl (signal_frame.svl);
482
483 if (size >= AARCH64_SME_CONTEXT_SIZE (svq))
484 {
485 signal_frame.za_section
487 signal_frame.za_payload = true;
488 }
489 section += size;
490 break;
491 }
492
494 {
495 /* This is context containing the tpidr2 register. */
496 signal_frame.tpidr2_section = section;
497 section += size;
498 break;
499 }
500 case AARCH64_ZT_MAGIC:
501 {
502 gdb_byte buf[2];
503
504 /* Extract the number of ZT registers available in this
505 context. */
507 buf, 2) != 0)
508 {
509 warning (_("Failed to read the number of ZT registers from the "
510 "ZT signal frame context."));
511 section += size;
512 break;
513 }
514
515 signal_frame.zt_register_count
516 = extract_unsigned_integer (buf, 2, byte_order);
517
518 /* This is a context containing the ZT registers. This should only
519 exist if we also have the ZA context. The presence of the ZT
520 context without the ZA context is invalid. */
521 signal_frame.zt_section = section;
522 signal_frame.zt_available = true;
523
524 section += size;
525 break;
526 }
528 {
529 /* Extra is always the last valid section in reserved and points to
530 an additional block of memory filled with more sections. Reset
531 the address to the extra section and continue looking for more
532 structures. */
533 gdb_byte buf[8];
534
536 buf, 8) != 0)
537 {
538 warning (_("Failed to read the extra section address from the"
539 " signal frame context."));
540 section += size;
541 break;
542 }
543
544 section = extract_unsigned_integer (buf, 8, byte_order);
545 signal_frame.extra_section = section;
546 extra_found = true;
547 break;
548 }
549
550 default:
551 section += size;
552 break;
553 }
554
555 /* Prevent searching past the end of the reserved section. The extra
556 section does not have a hard coded limit - we have to rely on it ending
557 with nulls. */
558 if (!extra_found && section > section_end)
559 break;
560 }
561
562 /* Sanity check that if the ZT entry exists, the ZA entry must also
563 exist. */
564 if (signal_frame.zt_available && !signal_frame.za_payload)
565 error (_("While reading signal context information, found a ZT context "
566 "without a ZA context, which is invalid."));
567}
568
569/* Implement the "init" method of struct tramp_frame. */
570
571static void
573 frame_info_ptr this_frame,
574 struct trad_frame_cache *this_cache,
575 CORE_ADDR func)
576{
577 /* Read the signal context information. */
578 struct aarch64_linux_sigframe signal_frame;
579 aarch64_linux_read_signal_frame_info (this_frame, signal_frame);
580
581 /* Now we have all the data required to restore the registers from the
582 signal frame. */
583
584 /* Restore the general purpose registers. */
585 CORE_ADDR offset = signal_frame.gpr_section;
586 for (int i = 0; i < 31; i++)
587 {
588 trad_frame_set_reg_addr (this_cache, AARCH64_X0_REGNUM + i, offset);
590 }
591 trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, offset);
593 trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, offset);
594
595 struct gdbarch *gdbarch = get_frame_arch (this_frame);
596 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
597
598 /* Restore the SVE / FPSIMD registers. */
599 if (tdep->has_sve () && signal_frame.sve_section != 0)
600 {
601 ULONGEST vq = sve_vq_from_vl (signal_frame.vl);
602 CORE_ADDR sve_regs = signal_frame.sve_section;
603
604 /* Restore VG. */
606 sve_vg_from_vl (signal_frame.vl));
607
608 int num_regs = gdbarch_num_regs (gdbarch);
609 for (int i = 0; i < 32; i++)
610 {
611 offset = sve_regs + (i * vq * 16);
613 offset);
614 trad_frame_set_reg_addr (this_cache,
615 num_regs + AARCH64_SVE_V0_REGNUM + i,
616 offset);
617 trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_Q0_REGNUM + i,
618 offset);
619 trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_D0_REGNUM + i,
620 offset);
621 trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_S0_REGNUM + i,
622 offset);
623 trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_H0_REGNUM + i,
624 offset);
625 trad_frame_set_reg_addr (this_cache, num_regs + AARCH64_B0_REGNUM + i,
626 offset);
627 }
628
629 offset = sve_regs + AARCH64_SVE_CONTEXT_P_REGS_OFFSET (vq);
630 for (int i = 0; i < 16; i++)
632 offset + (i * vq * 2));
633
634 offset = sve_regs + AARCH64_SVE_CONTEXT_FFR_OFFSET (vq);
636 }
637
638 /* Restore the FPSIMD registers. */
639 if (signal_frame.fpsimd_section != 0)
640 {
641 CORE_ADDR fpsimd = signal_frame.fpsimd_section;
642
647
648 /* If there was no SVE section then set up the V registers. */
649 if (!tdep->has_sve () || signal_frame.sve_section == 0)
650 aarch64_linux_restore_vregs (gdbarch, this_cache, fpsimd);
651 }
652
653 /* Restore the SME registers. */
654 if (tdep->has_sme ())
655 {
656 if (signal_frame.za_section != 0)
657 {
658 /* Restore the ZA state. */
659 trad_frame_set_reg_addr (this_cache, tdep->sme_za_regnum,
660 signal_frame.za_section);
661 }
662
663 /* Restore/Reconstruct SVCR. */
664 ULONGEST svcr = 0;
665 svcr |= signal_frame.za_payload ? SVCR_ZA_BIT : 0;
666 svcr |= signal_frame.streaming_mode ? SVCR_SM_BIT : 0;
667 trad_frame_set_reg_value (this_cache, tdep->sme_svcr_regnum, svcr);
668
669 /* Restore SVG. */
670 trad_frame_set_reg_value (this_cache, tdep->sme_svg_regnum,
671 sve_vg_from_vl (signal_frame.svl));
672
673 /* Handle SME2 (ZT). */
674 if (tdep->has_sme2 ()
675 && signal_frame.za_section != 0
676 && signal_frame.zt_register_count > 0)
677 {
678 /* Is ZA state available? */
679 gdb_assert (svcr & SVCR_ZA_BIT);
680
681 /* Restore the ZT state. For now we assume that we only have
682 a single ZT register. If/When more ZT registers appear, we
683 should update the code to handle that case accordingly. */
684 trad_frame_set_reg_addr (this_cache, tdep->sme2_zt0_regnum,
685 signal_frame.zt_section
687 }
688 }
689
690 /* Restore the tpidr2 register, if the target supports it and if there is
691 an entry for it. */
692 if (signal_frame.tpidr2_section != 0 && tdep->has_tls ()
693 && tdep->tls_register_count >= 2)
694 {
695 /* Restore tpidr2. */
696 trad_frame_set_reg_addr (this_cache, tdep->tls_regnum_base + 1,
697 signal_frame.tpidr2_section
699 }
700
701 trad_frame_set_id (this_cache, frame_id_build (signal_frame.sp, func));
702}
703
704/* Implements the "prev_arch" method of struct tramp_frame. */
705
706static struct gdbarch *
708 void **frame_cache)
709{
710 struct trad_frame_cache *cache
711 = (struct trad_frame_cache *) *frame_cache;
712
713 gdb_assert (cache != nullptr);
714
715 struct aarch64_linux_sigframe signal_frame;
716 aarch64_linux_read_signal_frame_info (this_frame, signal_frame);
717
718 /* The SVE vector length and the SME vector length may change from frame to
719 frame. Make sure we report the correct architecture to the previous
720 frame.
721
722 We can reuse the next frame's architecture here, as it should be mostly
723 the same, except for potential different vg and svg values. */
724 const struct target_desc *tdesc
725 = gdbarch_target_desc (get_frame_arch (this_frame));
727 features.vq = sve_vq_from_vl (signal_frame.vl);
728 features.svq = (uint8_t) sve_vq_from_vl (signal_frame.svl);
729
730 struct gdbarch_info info;
731 info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64);
732 info.target_desc = aarch64_read_description (features);
733 return gdbarch_find_by_info (info);
734}
735
737{
739 4,
740 {
741 /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
742 Soo1 0010 1hhi iiii iiii iiii iiir rrrr */
743 {0xd2801168, ULONGEST_MAX},
744
745 /* svc 0x0 (o=0, l=1)
746 1101 0100 oooi iiii iiii iiii iii0 00ll */
747 {0xd4000001, ULONGEST_MAX},
748 {TRAMP_SENTINEL_INSN, ULONGEST_MAX}
749 },
751 nullptr, /* validate */
752 aarch64_linux_sigframe_prev_arch, /* prev_arch */
753};
754
755/* Register maps. */
756
758 {
759 { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
760 { 1, AARCH64_SP_REGNUM, 8 },
761 { 1, AARCH64_PC_REGNUM, 8 },
762 { 1, AARCH64_CPSR_REGNUM, 8 },
763 { 0 }
764 };
765
767 {
768 { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
769 { 1, AARCH64_FPSR_REGNUM, 4 },
770 { 1, AARCH64_FPCR_REGNUM, 4 },
771 { 0 }
772 };
773
774/* Register set definitions. */
775
781
787
788/* The fields in an SVE header at the start of a SVE regset. */
789
790#define SVE_HEADER_SIZE_LENGTH 4
791#define SVE_HEADER_MAX_SIZE_LENGTH 4
792#define SVE_HEADER_VL_LENGTH 2
793#define SVE_HEADER_MAX_VL_LENGTH 2
794#define SVE_HEADER_FLAGS_LENGTH 2
795#define SVE_HEADER_RESERVED_LENGTH 2
796
797#define SVE_HEADER_SIZE_OFFSET 0
798#define SVE_HEADER_MAX_SIZE_OFFSET \
799 (SVE_HEADER_SIZE_OFFSET + SVE_HEADER_SIZE_LENGTH)
800#define SVE_HEADER_VL_OFFSET \
801 (SVE_HEADER_MAX_SIZE_OFFSET + SVE_HEADER_MAX_SIZE_LENGTH)
802#define SVE_HEADER_MAX_VL_OFFSET \
803 (SVE_HEADER_VL_OFFSET + SVE_HEADER_VL_LENGTH)
804#define SVE_HEADER_FLAGS_OFFSET \
805 (SVE_HEADER_MAX_VL_OFFSET + SVE_HEADER_MAX_VL_LENGTH)
806#define SVE_HEADER_RESERVED_OFFSET \
807 (SVE_HEADER_FLAGS_OFFSET + SVE_HEADER_FLAGS_LENGTH)
808#define SVE_HEADER_SIZE \
809 (SVE_HEADER_RESERVED_OFFSET + SVE_HEADER_RESERVED_LENGTH)
810
811#define SVE_HEADER_FLAG_SVE 1
812
813/* Get the vector quotient (VQ) or streaming vector quotient (SVQ) value
814 from the section named SECTION_NAME.
815
816 Return non-zero if successful and 0 otherwise. */
817
818static uint64_t
820 const char *section_name)
821{
822 gdb_assert (section_name != nullptr);
823
824 asection *section = bfd_get_section_by_name (abfd, section_name);
825
826 if (section == nullptr)
827 {
828 /* No SVE state. */
829 return 0;
830 }
831
832 size_t size = bfd_section_size (section);
833
834 /* Check extended state size. */
835 if (size < SVE_HEADER_SIZE)
836 {
837 warning (_("'%s' core file section is too small. "
838 "Expected %s bytes, got %s bytes"), section_name,
839 pulongest (SVE_HEADER_SIZE), pulongest (size));
840 return 0;
841 }
842
843 gdb_byte header[SVE_HEADER_SIZE];
844
845 if (!bfd_get_section_contents (abfd, section, header, 0, SVE_HEADER_SIZE))
846 {
847 warning (_("Couldn't read sve header from "
848 "'%s' core file section."), section_name);
849 return 0;
850 }
851
852 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
853 uint64_t vq
856 byte_order));
857
858 if (vq > AARCH64_MAX_SVE_VQ || vq == 0)
859 {
860 warning (_("SVE/SSVE vector length in core file is invalid."
861 " (max vq=%d) (detected vq=%s)"), AARCH64_MAX_SVE_VQ,
862 pulongest (vq));
863 return 0;
864 }
865
866 return vq;
867}
868
869/* Get the vector quotient (VQ) value from CORE_BFD's sections.
870
871 Return non-zero if successful and 0 otherwise. */
872
873static uint64_t
875 bfd *core_bfd)
876{
877 /* First check if we have a SSVE section. If so, check if it is active. */
878 asection *section = bfd_get_section_by_name (core_bfd, ".reg-aarch-ssve");
879
880 if (section != nullptr)
881 {
882 /* We've found a SSVE section, so now fetch its data. */
883 gdb_byte header[SVE_HEADER_SIZE];
884
885 if (bfd_get_section_contents (core_bfd, section, header, 0,
887 {
888 /* Check if the SSVE section has SVE contents. */
889 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
890 uint16_t flags
892 SVE_HEADER_FLAGS_LENGTH, byte_order);
893
895 {
896 /* The SSVE state is active, so return the vector length from the
897 the SSVE section. */
899 ".reg-aarch-ssve");
900 }
901 }
902 }
903
904 /* No valid SSVE section. Return the vq from the SVE section (if any). */
905 return aarch64_linux_core_read_vq (gdbarch, core_bfd, ".reg-aarch-sve");
906}
907
908/* Supply register REGNUM from BUF to REGCACHE, using the register map
909 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
910 If BUF is nullptr, set the registers to "unavailable" status. */
911
912static void
914 struct regcache *regcache,
915 int regnum, const void *buf, size_t size)
916{
917 gdb_byte *header = (gdb_byte *) buf;
918 struct gdbarch *gdbarch = regcache->arch ();
919 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
920
921 if (buf == nullptr)
922 return regcache->supply_regset (regset, regnum, nullptr, size);
923 gdb_assert (size > SVE_HEADER_SIZE);
924
925 /* BUF contains an SVE header followed by a register dump of either the
926 passed in SVE regset or a NEON fpregset. */
927
928 /* Extract required fields from the header. */
929 ULONGEST vl = extract_unsigned_integer (header + SVE_HEADER_VL_OFFSET,
930 SVE_HEADER_VL_LENGTH, byte_order);
933 byte_order);
934
935 if (regnum == -1 || regnum == AARCH64_SVE_VG_REGNUM)
936 {
937 gdb_byte vg_target[8];
938 store_integer ((gdb_byte *)&vg_target, sizeof (uint64_t), byte_order,
939 sve_vg_from_vl (vl));
941 }
942
944 {
945 /* Register dump is a SVE structure. */
947 (gdb_byte *) buf + SVE_HEADER_SIZE,
949 }
950 else
951 {
952 /* Register dump is a fpsimd structure. First clear the SVE
953 registers. */
954 for (int i = 0; i < AARCH64_SVE_Z_REGS_NUM; i++)
956 for (int i = 0; i < AARCH64_SVE_P_REGS_NUM; i++)
959
960 /* Then supply the fpsimd registers. */
962 (gdb_byte *) buf + SVE_HEADER_SIZE,
964 }
965}
966
967/* Collect an inactive SVE register set state. This is equivalent to a
968 fpsimd layout.
969
970 Collect the data from REGCACHE to BUF, using the register
971 map in REGSET. */
972
973static void
975 void *buf, size_t size, int vg_regnum)
976{
977 gdb_byte *header = (gdb_byte *) buf;
978 struct gdbarch *gdbarch = regcache->arch ();
979 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
980
981 gdb_assert (buf != nullptr);
982 gdb_assert (size >= SVE_CORE_DUMMY_SIZE);
983
984 /* Zero out everything first. */
985 memset ((gdb_byte *) buf, 0, SVE_CORE_DUMMY_SIZE);
986
987 /* BUF starts with a SVE header prior to the register dump. */
988
989 /* Dump the default size of an empty SVE payload. */
990 uint32_t real_size = SVE_CORE_DUMMY_SIZE;
992 SVE_HEADER_SIZE_LENGTH, byte_order, real_size);
993
994 /* Dump a dummy max size. */
995 uint32_t max_size = SVE_CORE_DUMMY_MAX_SIZE;
997 SVE_HEADER_MAX_SIZE_LENGTH, byte_order, max_size);
998
999 /* Dump the vector length. */
1000 ULONGEST vg = 0;
1001 regcache->raw_collect (vg_regnum, &vg);
1002 uint16_t vl = sve_vl_from_vg (vg);
1004 byte_order, vl);
1005
1006 /* Dump the standard maximum vector length. */
1007 uint16_t max_vl = SVE_CORE_DUMMY_MAX_VL;
1009 SVE_HEADER_MAX_VL_LENGTH, byte_order,
1010 max_vl);
1011
1012 /* The rest of the fields are zero. */
1013 uint16_t flags = SVE_CORE_DUMMY_FLAGS;
1015 SVE_HEADER_FLAGS_LENGTH, byte_order,
1016 flags);
1017 uint16_t reserved = SVE_CORE_DUMMY_RESERVED;
1019 SVE_HEADER_RESERVED_LENGTH, byte_order, reserved);
1020
1021 /* We are done with the header part of it. Now dump the register state
1022 in the FPSIMD format. */
1023
1024 /* Dump the first 128 bits of each of the Z registers. */
1026 for (int i = 0; i < AARCH64_SVE_Z_REGS_NUM; i++)
1028 header + V_REGISTER_SIZE * i);
1029
1030 /* Dump FPSR and FPCR. */
1031 header += 32 * V_REGISTER_SIZE;
1034
1035 /* Dump two reserved empty fields of 4 bytes. */
1036 header += 8;
1037 memset (header, 0, 8);
1038
1039 /* We should have a FPSIMD-formatted register dump now. */
1040}
1041
1042/* Collect register REGNUM from REGCACHE to BUF, using the register
1043 map in REGSET. If REGNUM is -1, do this for all registers in
1044 REGSET. */
1045
1046static void
1048 const struct regcache *regcache,
1049 int regnum, void *buf, size_t size)
1050{
1051 gdb_byte *header = (gdb_byte *) buf;
1052 struct gdbarch *gdbarch = regcache->arch ();
1053 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1054 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1055 uint64_t vq = tdep->vq;
1056
1057 gdb_assert (buf != NULL);
1058 gdb_assert (size > SVE_HEADER_SIZE);
1059
1060 /* BUF starts with a SVE header prior to the register dump. */
1061
1063 SVE_HEADER_SIZE_LENGTH, byte_order, size);
1064 uint32_t max_size = SVE_CORE_DUMMY_MAX_SIZE;
1066 SVE_HEADER_MAX_SIZE_LENGTH, byte_order, max_size);
1068 byte_order, sve_vl_from_vq (vq));
1069 uint16_t max_vl = SVE_CORE_DUMMY_MAX_VL;
1071 SVE_HEADER_MAX_VL_LENGTH, byte_order,
1072 max_vl);
1073 uint16_t flags = SVE_HEADER_FLAG_SVE;
1075 SVE_HEADER_FLAGS_LENGTH, byte_order,
1076 flags);
1077 uint16_t reserved = SVE_CORE_DUMMY_RESERVED;
1079 SVE_HEADER_RESERVED_LENGTH, byte_order, reserved);
1080
1081 /* The SVE register dump follows. */
1082 regcache->collect_regset (regset, regnum, (gdb_byte *) buf + SVE_HEADER_SIZE,
1084}
1085
1086/* Supply register REGNUM from BUF to REGCACHE, using the register map
1087 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
1088 If BUF is NULL, set the registers to "unavailable" status. */
1089
1090static void
1092 struct regcache *regcache,
1093 int regnum, const void *buf, size_t size)
1094{
1095 struct gdbarch *gdbarch = regcache->arch ();
1096 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1097
1098 if (tdep->has_sme ())
1099 {
1100 ULONGEST svcr = 0;
1101 regcache->raw_collect (tdep->sme_svcr_regnum, &svcr);
1102
1103 /* Is streaming mode enabled? */
1104 if (svcr & SVCR_SM_BIT)
1105 /* If so, don't load SVE data from the SVE section. The data to be
1106 used is in the SSVE section. */
1107 return;
1108 }
1109 /* If streaming mode is not enabled, load the SVE regcache data from the SVE
1110 section. */
1112}
1113
1114/* Collect register REGNUM from REGCACHE to BUF, using the register
1115 map in REGSET. If REGNUM is -1, do this for all registers in
1116 REGSET. */
1117
1118static void
1120 const struct regcache *regcache,
1121 int regnum, void *buf, size_t size)
1122{
1123 struct gdbarch *gdbarch = regcache->arch ();
1124 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1125 bool streaming_mode = false;
1126
1127 if (tdep->has_sme ())
1128 {
1129 ULONGEST svcr = 0;
1130 regcache->raw_collect (tdep->sme_svcr_regnum, &svcr);
1131
1132 /* Is streaming mode enabled? */
1133 if (svcr & SVCR_SM_BIT)
1134 {
1135 /* If so, don't dump SVE regcache data to the SVE section. The SVE
1136 data should be dumped to the SSVE section. Dump an empty SVE
1137 block instead. */
1138 streaming_mode = true;
1139 }
1140 }
1141
1142 /* If streaming mode is not enabled or there is no SME support, dump the
1143 SVE regcache data to the SVE section. */
1144
1145 /* Check if we have an active SVE state (non-zero Z/P/FFR registers).
1146 If so, then we need to dump registers in the SVE format.
1147
1148 Otherwise we should dump the registers in the FPSIMD format. */
1149 if (sve_state_is_empty (regcache) || streaming_mode)
1151 else
1153}
1154
1155/* Supply register REGNUM from BUF to REGCACHE, using the register map
1156 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
1157 If BUF is NULL, set the registers to "unavailable" status. */
1158
1159static void
1161 struct regcache *regcache,
1162 int regnum, const void *buf, size_t size)
1163{
1164 gdb_byte *header = (gdb_byte *) buf;
1165 struct gdbarch *gdbarch = regcache->arch ();
1166 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1167 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1168
1171 byte_order);
1172
1173 /* Since SVCR's bits are inferred from the data we have in the header of the
1174 SSVE section, we need to initialize it to zero first, so that it doesn't
1175 carry garbage data. */
1176 ULONGEST svcr = 0;
1177 regcache->raw_supply (tdep->sme_svcr_regnum, &svcr);
1178
1179 /* Is streaming mode enabled? */
1181 {
1182 /* Streaming mode is active, so flip the SM bit. */
1183 svcr = SVCR_SM_BIT;
1184 regcache->raw_supply (tdep->sme_svcr_regnum, &svcr);
1185
1186 /* Fetch the SVE data from the SSVE section. */
1188 }
1189}
1190
1191/* Collect register REGNUM from REGCACHE to BUF, using the register
1192 map in REGSET. If REGNUM is -1, do this for all registers in
1193 REGSET. */
1194
1195static void
1197 const struct regcache *regcache,
1198 int regnum, void *buf, size_t size)
1199{
1200 struct gdbarch *gdbarch = regcache->arch ();
1201 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1202 ULONGEST svcr = 0;
1203 regcache->raw_collect (tdep->sme_svcr_regnum, &svcr);
1204
1205 /* Is streaming mode enabled? */
1206 if (svcr & SVCR_SM_BIT)
1207 {
1208 /* If so, dump SVE regcache data to the SSVE section. */
1210 }
1211 else
1212 {
1213 /* Otherwise dump an empty SVE block to the SSVE section with the
1214 streaming vector length. */
1216 }
1217}
1218
1219/* Supply register REGNUM from BUF to REGCACHE, using the register map
1220 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
1221 If BUF is NULL, set the registers to "unavailable" status. */
1222
1223static void
1225 struct regcache *regcache,
1226 int regnum, const void *buf, size_t size)
1227{
1228 gdb_byte *header = (gdb_byte *) buf;
1229 struct gdbarch *gdbarch = regcache->arch ();
1230 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
1231
1232 /* Handle an empty buffer. */
1233 if (buf == nullptr)
1234 return regcache->supply_regset (regset, regnum, nullptr, size);
1235
1236 if (size < SVE_HEADER_SIZE)
1237 error (_("ZA state header size (%s) invalid. Should be at least %s."),
1238 pulongest (size), pulongest (SVE_HEADER_SIZE));
1239
1240 /* The ZA register note in a core file can have a couple of states:
1241
1242 1 - Just the header without the payload. This means that there is no
1243 ZA data, and we should populate only SVCR and SVG registers on GDB's
1244 side. The ZA data should be marked as unavailable.
1245
1246 2 - The header with an additional data payload. This means there is
1247 actual ZA data, and we should populate ZA, SVCR and SVG. */
1248
1249 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1250
1251 /* Populate SVG. */
1252 ULONGEST svg
1255 byte_order));
1256 regcache->raw_supply (tdep->sme_svg_regnum, &svg);
1257
1258 size_t data_size
1260 SVE_HEADER_SIZE_LENGTH, byte_order)
1262
1263 /* Populate SVCR. */
1264 bool has_za_payload = (data_size > 0);
1265 ULONGEST svcr;
1266 regcache->raw_collect (tdep->sme_svcr_regnum, &svcr);
1267
1268 /* If we have a ZA payload, enable bit 2 of SVCR, otherwise clear it. This
1269 register gets updated by the SVE/SSVE-handling functions as well, as they
1270 report the SM bit 1. */
1271 if (has_za_payload)
1272 svcr |= SVCR_ZA_BIT;
1273 else
1274 svcr &= ~SVCR_ZA_BIT;
1275
1276 /* Update SVCR in the register buffer. */
1277 regcache->raw_supply (tdep->sme_svcr_regnum, &svcr);
1278
1279 /* Populate the register cache with ZA register contents, if we have any. */
1280 buf = has_za_payload ? (gdb_byte *) buf + SVE_HEADER_SIZE : nullptr;
1281
1282 size_t za_bytes = std::pow (sve_vl_from_vg (svg), 2);
1283
1284 /* Update ZA in the register buffer. */
1285 if (has_za_payload)
1286 {
1287 /* Check that the payload size is sane. */
1288 if (size < SVE_HEADER_SIZE + za_bytes)
1289 {
1290 error (_("ZA header + payload size (%s) invalid. Should be at "
1291 "least %s."),
1292 pulongest (size), pulongest (SVE_HEADER_SIZE + za_bytes));
1293 }
1294
1295 regcache->raw_supply (tdep->sme_za_regnum, buf);
1296 }
1297 else
1298 {
1299 gdb_byte za_zeroed[za_bytes];
1300 memset (za_zeroed, 0, za_bytes);
1301 regcache->raw_supply (tdep->sme_za_regnum, za_zeroed);
1302 }
1303}
1304
1305/* Collect register REGNUM from REGCACHE to BUF, using the register
1306 map in REGSET. If REGNUM is -1, do this for all registers in
1307 REGSET. */
1308
1309static void
1311 const struct regcache *regcache,
1312 int regnum, void *buf, size_t size)
1313{
1314 gdb_assert (buf != nullptr);
1315
1316 /* Sanity check the dump size. */
1317 gdb_assert (size >= SVE_HEADER_SIZE);
1318
1319 /* The ZA register note in a core file can have a couple of states:
1320
1321 1 - Just the header without the payload. This means that there is no
1322 ZA data, and we should dump just the header.
1323
1324 2 - The header with an additional data payload. This means there is
1325 actual ZA data, and we should dump both the header and the ZA data
1326 payload. */
1327
1329 = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
1330
1331 /* Determine if we have ZA state from the SVCR register ZA bit. */
1332 ULONGEST svcr;
1333 regcache->raw_collect (tdep->sme_svcr_regnum, &svcr);
1334
1335 /* Check the ZA payload. */
1336 bool has_za_payload = (svcr & SVCR_ZA_BIT) != 0;
1337 size = has_za_payload ? size : SVE_HEADER_SIZE;
1338
1339 /* Write the size and max_size fields. */
1340 gdb_byte *header = (gdb_byte *) buf;
1341 enum bfd_endian byte_order = gdbarch_byte_order (regcache->arch ());
1343 SVE_HEADER_SIZE_LENGTH, byte_order, size);
1344
1345 uint32_t max_size
1346 = SVE_HEADER_SIZE + std::pow (sve_vl_from_vq (tdep->sme_svq), 2);
1348 SVE_HEADER_MAX_SIZE_LENGTH, byte_order, max_size);
1349
1350 /* Output the other fields of the ZA header (vl, max_vl, flags and
1351 reserved). */
1352 uint64_t svq = tdep->sme_svq;
1354 byte_order, sve_vl_from_vq (svq));
1355
1356 uint16_t max_vl = SVE_CORE_DUMMY_MAX_VL;
1358 SVE_HEADER_MAX_VL_LENGTH, byte_order,
1359 max_vl);
1360
1361 uint16_t flags = SVE_CORE_DUMMY_FLAGS;
1363 SVE_HEADER_FLAGS_LENGTH, byte_order, flags);
1364
1365 uint16_t reserved = SVE_CORE_DUMMY_RESERVED;
1367 SVE_HEADER_RESERVED_LENGTH, byte_order, reserved);
1368
1369 buf = has_za_payload ? (gdb_byte *) buf + SVE_HEADER_SIZE : nullptr;
1370
1371 /* Dump the register cache contents for the ZA register to the buffer. */
1372 regcache->collect_regset (regset, regnum, (gdb_byte *) buf,
1374}
1375
1376/* Supply register REGNUM from BUF to REGCACHE, using the register map
1377 in REGSET. If REGNUM is -1, do this for all registers in REGSET.
1378 If BUF is NULL, set the registers to "unavailable" status. */
1379
1380static void
1382 struct regcache *regcache,
1383 int regnum, const void *buf, size_t size)
1384{
1385 /* Read the ZT register note from a core file into the register buffer. */
1386
1387 /* Make sure the buffer contains at least the expected amount of data we are
1388 supposed to get. */
1389 gdb_assert (size >= AARCH64_SME2_ZT0_SIZE);
1390
1391 /* Handle an empty buffer. */
1392 if (buf == nullptr)
1393 return regcache->supply_regset (regset, regnum, nullptr, size);
1394
1396 = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
1397
1398 /* Supply the ZT0 register contents. */
1399 regcache->raw_supply (tdep->sme2_zt0_regnum, buf);
1400}
1401
1402/* Collect register REGNUM from REGCACHE to BUF, using the register
1403 map in REGSET. If REGNUM is -1, do this for all registers in
1404 REGSET. */
1405
1406static void
1408 const struct regcache *regcache,
1409 int regnum, void *buf, size_t size)
1410{
1411 /* Read the ZT register contents from the register buffer into the core
1412 file section. */
1413
1414 /* Make sure the buffer can hold the data we need to return. */
1415 gdb_assert (size >= AARCH64_SME2_ZT0_SIZE);
1416 gdb_assert (buf != nullptr);
1417
1419 = gdbarch_tdep<aarch64_gdbarch_tdep> (regcache->arch ());
1420
1421 /* Dump the register cache contents for the ZT register to the buffer. */
1424}
1425
1426/* Implement the "iterate_over_regset_sections" gdbarch method. */
1427
1428static void
1431 void *cb_data,
1432 const struct regcache *regcache)
1433{
1434 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
1435
1437 &aarch64_linux_gregset, NULL, cb_data);
1438
1439 if (tdep->has_sve ())
1440 {
1441 /* Create this on the fly in order to handle vector register sizes. */
1442 const struct regcache_map_entry sve_regmap[] =
1443 {
1444 { 32, AARCH64_SVE_Z0_REGNUM, (int) (tdep->vq * 16) },
1445 { 16, AARCH64_SVE_P0_REGNUM, (int) (tdep->vq * 16 / 8) },
1446 { 1, AARCH64_SVE_FFR_REGNUM, (int) (tdep->vq * 16 / 8) },
1447 { 1, AARCH64_FPSR_REGNUM, 4 },
1448 { 1, AARCH64_FPCR_REGNUM, 4 },
1449 { 0 }
1450 };
1451
1452 const struct regset aarch64_linux_ssve_regset =
1453 {
1454 sve_regmap,
1457 };
1458
1459 /* If SME is supported in the core file, process the SSVE section first,
1460 and the SVE section last. This is because we need information from
1461 the SSVE set to determine if streaming mode is active. If streaming
1462 mode is active, we need to extract the data from the SSVE section.
1463
1464 Otherwise, if streaming mode is not active, we fetch the data from the
1465 SVE section. */
1466 if (tdep->has_sme ())
1467 {
1468 cb (".reg-aarch-ssve",
1472 &aarch64_linux_ssve_regset, "SSVE registers", cb_data);
1473 }
1474
1475 /* Handle the SVE register set. */
1476 const struct regset aarch64_linux_sve_regset =
1477 {
1478 sve_regmap,
1481 };
1482
1483 cb (".reg-aarch-sve",
1486 &aarch64_linux_sve_regset, "SVE registers", cb_data);
1487 }
1488 else
1490 &aarch64_linux_fpregset, NULL, cb_data);
1491
1492 if (tdep->has_sme ())
1493 {
1494 /* Setup the register set information for a ZA register set core
1495 dump. */
1496
1497 /* Create this on the fly in order to handle the ZA register size. */
1498 const struct regcache_map_entry za_regmap[] =
1499 {
1500 { 1, tdep->sme_za_regnum, (int) std::pow (sve_vl_from_vq (tdep->sme_svq), 2) }
1501 };
1502
1503 const struct regset aarch64_linux_za_regset =
1504 {
1505 za_regmap,
1508 };
1509
1510 cb (".reg-aarch-za",
1512 SVE_HEADER_SIZE + std::pow (sve_vl_from_vq (tdep->sme_svq), 2),
1513 &aarch64_linux_za_regset, "ZA register", cb_data);
1514
1515 /* Handle SME2 (ZT) as well, which is only available if SME is
1516 available. */
1517 if (tdep->has_sme2 ())
1518 {
1519 const struct regcache_map_entry zt_regmap[] =
1520 {
1522 };
1523
1524 /* We set the register set size to REGSET_VARIABLE_SIZE here because
1525 in the future there might be more ZT registers. */
1526 const struct regset aarch64_linux_zt_regset =
1527 {
1528 zt_regmap,
1531 };
1532
1533 cb (".reg-aarch-zt",
1536 &aarch64_linux_zt_regset, "ZT registers", cb_data);
1537 }
1538 }
1539
1540 if (tdep->has_pauth ())
1541 {
1542 /* Create this on the fly in order to handle the variable location. */
1543 const struct regcache_map_entry pauth_regmap[] =
1544 {
1546 { 0 }
1547 };
1548
1549 const struct regset aarch64_linux_pauth_regset =
1550 {
1552 };
1553
1554 cb (".reg-aarch-pauth", AARCH64_LINUX_SIZEOF_PAUTH,
1555 AARCH64_LINUX_SIZEOF_PAUTH, &aarch64_linux_pauth_regset,
1556 "pauth registers", cb_data);
1557 }
1558
1559 /* Handle MTE registers. */
1560 if (tdep->has_mte ())
1561 {
1562 /* Create this on the fly in order to handle the variable location. */
1563 const struct regcache_map_entry mte_regmap[] =
1564 {
1565 { 1, tdep->mte_reg_base, 8},
1566 { 0 }
1567 };
1568
1569 const struct regset aarch64_linux_mte_regset =
1570 {
1572 };
1573
1574 cb (".reg-aarch-mte", AARCH64_LINUX_SIZEOF_MTE_REGSET,
1575 AARCH64_LINUX_SIZEOF_MTE_REGSET, &aarch64_linux_mte_regset,
1576 "MTE registers", cb_data);
1577 }
1578
1579 /* Handle the TLS registers. */
1580 if (tdep->has_tls ())
1581 {
1582 gdb_assert (tdep->tls_regnum_base != -1);
1583 gdb_assert (tdep->tls_register_count > 0);
1584
1585 int sizeof_tls_regset
1587
1588 const struct regcache_map_entry tls_regmap[] =
1589 {
1590 { tdep->tls_register_count, tdep->tls_regnum_base,
1592 { 0 }
1593 };
1594
1595 const struct regset aarch64_linux_tls_regset =
1596 {
1599 };
1600
1601 cb (".reg-aarch-tls", sizeof_tls_regset, sizeof_tls_regset,
1602 &aarch64_linux_tls_regset, "TLS register", cb_data);
1603 }
1604}
1605
1606/* Implement the "core_read_description" gdbarch method. */
1607
1608static const struct target_desc *
1610 struct target_ops *target, bfd *abfd)
1611{
1612 gdb::optional<gdb::byte_vector> auxv = target_read_auxv_raw (target);
1613 CORE_ADDR hwcap = linux_get_hwcap (auxv, target, gdbarch);
1614 CORE_ADDR hwcap2 = linux_get_hwcap2 (auxv, target, gdbarch);
1615
1617
1618 /* We need to extract the SVE data from the .reg-aarch-sve section or the
1619 .reg-aarch-ssve section depending on which one was active when the core
1620 file was generated.
1621
1622 If the SSVE section contains SVE data, then it is considered active.
1623 Otherwise the SVE section is considered active. This guarantees we will
1624 have the correct target description with the correct SVE vector
1625 length. */
1627 features.pauth = hwcap & AARCH64_HWCAP_PACA;
1628 features.mte = hwcap2 & HWCAP2_MTE;
1629
1630 /* Handle the TLS section. */
1631 asection *tls = bfd_get_section_by_name (abfd, ".reg-aarch-tls");
1632 if (tls != nullptr)
1633 {
1634 size_t size = bfd_section_size (tls);
1635 /* Convert the size to the number of actual registers, by
1636 dividing by 8. */
1638 }
1639
1640 features.svq
1641 = aarch64_linux_core_read_vq (gdbarch, abfd, ".reg-aarch-za");
1642
1643 /* Are the ZT registers available? */
1644 if (bfd_get_section_by_name (abfd, ".reg-aarch-zt") != nullptr)
1645 {
1646 /* Check if ZA is also available, otherwise this is an invalid
1647 combination. */
1648 if (bfd_get_section_by_name (abfd, ".reg-aarch-za") != nullptr)
1649 features.sme2 = true;
1650 else
1651 warning (_("While reading core file sections, found ZT registers entry "
1652 "but no ZA register entry. The ZT contents will be "
1653 "ignored"));
1654 }
1655
1657}
1658
1659/* Implementation of `gdbarch_stap_is_single_operand', as defined in
1660 gdbarch.h. */
1661
1662static int
1664{
1665 return (*s == '#' || isdigit (*s) /* Literal number. */
1666 || *s == '[' /* Register indirection. */
1667 || isalpha (*s)); /* Register value. */
1668}
1669
1670/* This routine is used to parse a special token in AArch64's assembly.
1671
1672 The special tokens parsed by it are:
1673
1674 - Register displacement (e.g, [fp, #-8])
1675
1676 It returns one if the special token has been parsed successfully,
1677 or zero if the current token is not considered special. */
1678
1679static expr::operation_up
1681 struct stap_parse_info *p)
1682{
1683 if (*p->arg == '[')
1684 {
1685 /* Temporary holder for lookahead. */
1686 const char *tmp = p->arg;
1687 char *endp;
1688 /* Used to save the register name. */
1689 const char *start;
1690 int len;
1691 int got_minus = 0;
1692 long displacement;
1693
1694 ++tmp;
1695 start = tmp;
1696
1697 /* Register name. */
1698 while (isalnum (*tmp))
1699 ++tmp;
1700
1701 if (*tmp != ',')
1702 return {};
1703
1704 len = tmp - start;
1705 std::string regname (start, len);
1706
1707 if (user_reg_map_name_to_regnum (gdbarch, regname.c_str (), len) == -1)
1708 error (_("Invalid register name `%s' on expression `%s'."),
1709 regname.c_str (), p->saved_arg);
1710
1711 ++tmp;
1712 tmp = skip_spaces (tmp);
1713 /* Now we expect a number. It can begin with '#' or simply
1714 a digit. */
1715 if (*tmp == '#')
1716 ++tmp;
1717
1718 if (*tmp == '-')
1719 {
1720 ++tmp;
1721 got_minus = 1;
1722 }
1723 else if (*tmp == '+')
1724 ++tmp;
1725
1726 if (!isdigit (*tmp))
1727 return {};
1728
1729 displacement = strtol (tmp, &endp, 10);
1730 tmp = endp;
1731
1732 /* Skipping last `]'. */
1733 if (*tmp++ != ']')
1734 return {};
1735 p->arg = tmp;
1736
1737 using namespace expr;
1738
1739 /* The displacement. */
1740 struct type *long_type = builtin_type (gdbarch)->builtin_long;
1741 if (got_minus)
1742 displacement = -displacement;
1743 operation_up disp = make_operation<long_const_operation> (long_type,
1744 displacement);
1745
1746 /* The register name. */
1747 operation_up reg
1748 = make_operation<register_operation> (std::move (regname));
1749
1750 operation_up sum
1751 = make_operation<add_operation> (std::move (reg), std::move (disp));
1752
1753 /* Casting to the expected type. */
1754 struct type *arg_ptr_type = lookup_pointer_type (p->arg_type);
1755 sum = make_operation<unop_cast_operation> (std::move (sum),
1756 arg_ptr_type);
1757 return make_operation<unop_ind_operation> (std::move (sum));
1758 }
1759 return {};
1760}
1761
1762/* AArch64 process record-replay constructs: syscall, signal etc. */
1763
1765
1766/* Enum that defines the AArch64 linux specific syscall identifiers used for
1767 process record/replay. */
1768
2032
2033/* aarch64_canonicalize_syscall maps syscall ids from the native AArch64
2034 linux set of syscall ids into a canonical set of syscall ids used by
2035 process record. */
2036
2037static enum gdb_syscall
2039{
2040#define SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
2041 return gdb_sys_##SYSCALL
2042
2043#define UNSUPPORTED_SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
2044 return gdb_sys_no_syscall
2045
2046 switch (syscall_number)
2047 {
2048 SYSCALL_MAP (io_setup);
2049 SYSCALL_MAP (io_destroy);
2050 SYSCALL_MAP (io_submit);
2051 SYSCALL_MAP (io_cancel);
2052 SYSCALL_MAP (io_getevents);
2053
2054 SYSCALL_MAP (setxattr);
2055 SYSCALL_MAP (lsetxattr);
2056 SYSCALL_MAP (fsetxattr);
2057 SYSCALL_MAP (getxattr);
2058 SYSCALL_MAP (lgetxattr);
2059 SYSCALL_MAP (fgetxattr);
2060 SYSCALL_MAP (listxattr);
2061 SYSCALL_MAP (llistxattr);
2062 SYSCALL_MAP (flistxattr);
2063 SYSCALL_MAP (removexattr);
2064 SYSCALL_MAP (lremovexattr);
2065 SYSCALL_MAP (fremovexattr);
2066 SYSCALL_MAP (getcwd);
2067 SYSCALL_MAP (lookup_dcookie);
2068 SYSCALL_MAP (eventfd2);
2069 SYSCALL_MAP (epoll_create1);
2070 SYSCALL_MAP (epoll_ctl);
2071 SYSCALL_MAP (epoll_pwait);
2072 SYSCALL_MAP (dup);
2073 SYSCALL_MAP (dup3);
2074 SYSCALL_MAP (fcntl);
2075 SYSCALL_MAP (inotify_init1);
2076 SYSCALL_MAP (inotify_add_watch);
2077 SYSCALL_MAP (inotify_rm_watch);
2078 SYSCALL_MAP (ioctl);
2079 SYSCALL_MAP (ioprio_set);
2080 SYSCALL_MAP (ioprio_get);
2081 SYSCALL_MAP (flock);
2082 SYSCALL_MAP (mknodat);
2083 SYSCALL_MAP (mkdirat);
2084 SYSCALL_MAP (unlinkat);
2085 SYSCALL_MAP (symlinkat);
2086 SYSCALL_MAP (linkat);
2087 SYSCALL_MAP (renameat);
2088 UNSUPPORTED_SYSCALL_MAP (umount2);
2089 SYSCALL_MAP (mount);
2090 SYSCALL_MAP (pivot_root);
2091 SYSCALL_MAP (nfsservctl);
2092 SYSCALL_MAP (statfs);
2093 SYSCALL_MAP (truncate);
2094 SYSCALL_MAP (ftruncate);
2095 SYSCALL_MAP (fallocate);
2096 SYSCALL_MAP (faccessat);
2097 SYSCALL_MAP (fchdir);
2098 SYSCALL_MAP (chroot);
2099 SYSCALL_MAP (fchmod);
2100 SYSCALL_MAP (fchmodat);
2101 SYSCALL_MAP (fchownat);
2102 SYSCALL_MAP (fchown);
2103 SYSCALL_MAP (openat);
2104 SYSCALL_MAP (close);
2105 SYSCALL_MAP (vhangup);
2106 SYSCALL_MAP (pipe2);
2107 SYSCALL_MAP (quotactl);
2108 SYSCALL_MAP (getdents64);
2109 SYSCALL_MAP (lseek);
2110 SYSCALL_MAP (read);
2111 SYSCALL_MAP (write);
2112 SYSCALL_MAP (readv);
2113 SYSCALL_MAP (writev);
2114 SYSCALL_MAP (pread64);
2115 SYSCALL_MAP (pwrite64);
2116 UNSUPPORTED_SYSCALL_MAP (preadv);
2117 UNSUPPORTED_SYSCALL_MAP (pwritev);
2118 SYSCALL_MAP (sendfile);
2119 SYSCALL_MAP (pselect6);
2120 SYSCALL_MAP (ppoll);
2121 UNSUPPORTED_SYSCALL_MAP (signalfd4);
2122 SYSCALL_MAP (vmsplice);
2123 SYSCALL_MAP (splice);
2124 SYSCALL_MAP (tee);
2125 SYSCALL_MAP (readlinkat);
2126 SYSCALL_MAP (newfstatat);
2127
2128 SYSCALL_MAP (fstat);
2129 SYSCALL_MAP (sync);
2130 SYSCALL_MAP (fsync);
2131 SYSCALL_MAP (fdatasync);
2132 SYSCALL_MAP (sync_file_range);
2133 UNSUPPORTED_SYSCALL_MAP (timerfd_create);
2134 UNSUPPORTED_SYSCALL_MAP (timerfd_settime);
2135 UNSUPPORTED_SYSCALL_MAP (timerfd_gettime);
2136 UNSUPPORTED_SYSCALL_MAP (utimensat);
2137 SYSCALL_MAP (acct);
2138 SYSCALL_MAP (capget);
2139 SYSCALL_MAP (capset);
2140 SYSCALL_MAP (personality);
2141 SYSCALL_MAP (exit);
2142 SYSCALL_MAP (exit_group);
2143 SYSCALL_MAP (waitid);
2144 SYSCALL_MAP (set_tid_address);
2145 SYSCALL_MAP (unshare);
2146 SYSCALL_MAP (futex);
2147 SYSCALL_MAP (set_robust_list);
2148 SYSCALL_MAP (get_robust_list);
2149 SYSCALL_MAP (nanosleep);
2150
2151 SYSCALL_MAP (getitimer);
2152 SYSCALL_MAP (setitimer);
2153 SYSCALL_MAP (kexec_load);
2154 SYSCALL_MAP (init_module);
2155 SYSCALL_MAP (delete_module);
2156 SYSCALL_MAP (timer_create);
2157 SYSCALL_MAP (timer_settime);
2158 SYSCALL_MAP (timer_gettime);
2159 SYSCALL_MAP (timer_getoverrun);
2160 SYSCALL_MAP (timer_delete);
2161 SYSCALL_MAP (clock_settime);
2162 SYSCALL_MAP (clock_gettime);
2163 SYSCALL_MAP (clock_getres);
2164 SYSCALL_MAP (clock_nanosleep);
2165 SYSCALL_MAP (syslog);
2167 SYSCALL_MAP (sched_setparam);
2168 SYSCALL_MAP (sched_setscheduler);
2169 SYSCALL_MAP (sched_getscheduler);
2170 SYSCALL_MAP (sched_getparam);
2171 SYSCALL_MAP (sched_setaffinity);
2172 SYSCALL_MAP (sched_getaffinity);
2173 SYSCALL_MAP (sched_yield);
2174 SYSCALL_MAP (sched_get_priority_max);
2175 SYSCALL_MAP (sched_get_priority_min);
2176 SYSCALL_MAP (sched_rr_get_interval);
2177 SYSCALL_MAP (kill);
2178 SYSCALL_MAP (tkill);
2179 SYSCALL_MAP (tgkill);
2180 SYSCALL_MAP (sigaltstack);
2181 SYSCALL_MAP (rt_sigsuspend);
2182 SYSCALL_MAP (rt_sigaction);
2183 SYSCALL_MAP (rt_sigprocmask);
2184 SYSCALL_MAP (rt_sigpending);
2185 SYSCALL_MAP (rt_sigtimedwait);
2186 SYSCALL_MAP (rt_sigqueueinfo);
2187 SYSCALL_MAP (rt_sigreturn);
2188 SYSCALL_MAP (setpriority);
2189 SYSCALL_MAP (getpriority);
2190 SYSCALL_MAP (reboot);
2191 SYSCALL_MAP (setregid);
2192 SYSCALL_MAP (setgid);
2193 SYSCALL_MAP (setreuid);
2194 SYSCALL_MAP (setuid);
2195 SYSCALL_MAP (setresuid);
2196 SYSCALL_MAP (getresuid);
2197 SYSCALL_MAP (setresgid);
2198 SYSCALL_MAP (getresgid);
2199 SYSCALL_MAP (setfsuid);
2200 SYSCALL_MAP (setfsgid);
2201 SYSCALL_MAP (times);
2202 SYSCALL_MAP (setpgid);
2203 SYSCALL_MAP (getpgid);
2204 SYSCALL_MAP (getsid);
2205 SYSCALL_MAP (setsid);
2206 SYSCALL_MAP (getgroups);
2207 SYSCALL_MAP (setgroups);
2208 SYSCALL_MAP (uname);
2209 SYSCALL_MAP (sethostname);
2210 SYSCALL_MAP (setdomainname);
2211 SYSCALL_MAP (getrlimit);
2212 SYSCALL_MAP (setrlimit);
2213 SYSCALL_MAP (getrusage);
2214 SYSCALL_MAP (umask);
2215 SYSCALL_MAP (prctl);
2216 SYSCALL_MAP (getcpu);
2217 SYSCALL_MAP (gettimeofday);
2218 SYSCALL_MAP (settimeofday);
2219 SYSCALL_MAP (adjtimex);
2220 SYSCALL_MAP (getpid);
2221 SYSCALL_MAP (getppid);
2222 SYSCALL_MAP (getuid);
2223 SYSCALL_MAP (geteuid);
2224 SYSCALL_MAP (getgid);
2225 SYSCALL_MAP (getegid);
2226 SYSCALL_MAP (gettid);
2227 SYSCALL_MAP (sysinfo);
2228 SYSCALL_MAP (mq_open);
2229 SYSCALL_MAP (mq_unlink);
2230 SYSCALL_MAP (mq_timedsend);
2231 SYSCALL_MAP (mq_timedreceive);
2232 SYSCALL_MAP (mq_notify);
2233 SYSCALL_MAP (mq_getsetattr);
2234 SYSCALL_MAP (msgget);
2235 SYSCALL_MAP (msgctl);
2236 SYSCALL_MAP (msgrcv);
2237 SYSCALL_MAP (msgsnd);
2238 SYSCALL_MAP (semget);
2239 SYSCALL_MAP (semctl);
2240 SYSCALL_MAP (semtimedop);
2241 SYSCALL_MAP (semop);
2242 SYSCALL_MAP (shmget);
2243 SYSCALL_MAP (shmctl);
2244 SYSCALL_MAP (shmat);
2245 SYSCALL_MAP (shmdt);
2246 SYSCALL_MAP (socket);
2247 SYSCALL_MAP (socketpair);
2248 SYSCALL_MAP (bind);
2249 SYSCALL_MAP (listen);
2250 SYSCALL_MAP (accept);
2251 SYSCALL_MAP (connect);
2252 SYSCALL_MAP (getsockname);
2253 SYSCALL_MAP (getpeername);
2254 SYSCALL_MAP (sendto);
2255 SYSCALL_MAP (recvfrom);
2256 SYSCALL_MAP (setsockopt);
2257 SYSCALL_MAP (getsockopt);
2258 SYSCALL_MAP (shutdown);
2259 SYSCALL_MAP (sendmsg);
2260 SYSCALL_MAP (recvmsg);
2261 SYSCALL_MAP (readahead);
2262 SYSCALL_MAP (brk);
2263 SYSCALL_MAP (munmap);
2264 SYSCALL_MAP (mremap);
2265 SYSCALL_MAP (add_key);
2266 SYSCALL_MAP (request_key);
2267 SYSCALL_MAP (keyctl);
2268 SYSCALL_MAP (clone);
2269 SYSCALL_MAP (execve);
2270
2271 case aarch64_sys_mmap:
2272 return gdb_sys_mmap2;
2273
2274 SYSCALL_MAP (fadvise64);
2275 SYSCALL_MAP (swapon);
2276 SYSCALL_MAP (swapoff);
2277 SYSCALL_MAP (mprotect);
2278 SYSCALL_MAP (msync);
2279 SYSCALL_MAP (mlock);
2280 SYSCALL_MAP (munlock);
2281 SYSCALL_MAP (mlockall);
2282 SYSCALL_MAP (munlockall);
2283 SYSCALL_MAP (mincore);
2284 SYSCALL_MAP (madvise);
2285 SYSCALL_MAP (remap_file_pages);
2286 SYSCALL_MAP (mbind);
2287 SYSCALL_MAP (get_mempolicy);
2288 SYSCALL_MAP (set_mempolicy);
2289 SYSCALL_MAP (migrate_pages);
2290 SYSCALL_MAP (move_pages);
2291 UNSUPPORTED_SYSCALL_MAP (rt_tgsigqueueinfo);
2292 UNSUPPORTED_SYSCALL_MAP (perf_event_open);
2293 UNSUPPORTED_SYSCALL_MAP (accept4);
2294 UNSUPPORTED_SYSCALL_MAP (recvmmsg);
2295
2296 SYSCALL_MAP (wait4);
2297
2298 UNSUPPORTED_SYSCALL_MAP (prlimit64);
2299 UNSUPPORTED_SYSCALL_MAP (fanotify_init);
2300 UNSUPPORTED_SYSCALL_MAP (fanotify_mark);
2301 UNSUPPORTED_SYSCALL_MAP (name_to_handle_at);
2302 UNSUPPORTED_SYSCALL_MAP (open_by_handle_at);
2303 UNSUPPORTED_SYSCALL_MAP (clock_adjtime);
2304 UNSUPPORTED_SYSCALL_MAP (syncfs);
2306 UNSUPPORTED_SYSCALL_MAP (sendmmsg);
2307 UNSUPPORTED_SYSCALL_MAP (process_vm_readv);
2308 UNSUPPORTED_SYSCALL_MAP (process_vm_writev);
2310 UNSUPPORTED_SYSCALL_MAP (finit_module);
2311 UNSUPPORTED_SYSCALL_MAP (sched_setattr);
2312 UNSUPPORTED_SYSCALL_MAP (sched_getattr);
2313 SYSCALL_MAP (getrandom);
2314 default:
2315 return gdb_sys_no_syscall;
2316 }
2317}
2318
2319/* Retrieve the syscall number at a ptrace syscall-stop, either on syscall entry
2320 or exit. Return -1 upon error. */
2321
2322static LONGEST
2324{
2325 struct regcache *regs = get_thread_regcache (thread);
2326 LONGEST ret;
2327
2328 /* Get the system call number from register x8. */
2329 regs->cooked_read (AARCH64_X0_REGNUM + 8, &ret);
2330
2331 /* On exit from a successful execve, we will be in a new process and all the
2332 registers will be cleared - x0 to x30 will be 0, except for a 1 in x7.
2333 This function will only ever get called when stopped at the entry or exit
2334 of a syscall, so by checking for 0 in x0 (arg0/retval), x1 (arg1), x8
2335 (syscall), x29 (FP) and x30 (LR) we can infer:
2336 1) Either inferior is at exit from successful execve.
2337 2) Or inferior is at entry to a call to io_setup with invalid arguments and
2338 a corrupted FP and LR.
2339 It should be safe enough to assume case 1. */
2340 if (ret == 0)
2341 {
2342 LONGEST x1 = -1, fp = -1, lr = -1;
2343 regs->cooked_read (AARCH64_X0_REGNUM + 1, &x1);
2344 regs->cooked_read (AARCH64_FP_REGNUM, &fp);
2345 regs->cooked_read (AARCH64_LR_REGNUM, &lr);
2346 if (x1 == 0 && fp ==0 && lr == 0)
2347 return aarch64_sys_execve;
2348 }
2349
2350 return ret;
2351}
2352
2353/* Record all registers but PC register for process-record. */
2354
2355static int
2357{
2358 int i;
2359
2360 for (i = AARCH64_X0_REGNUM; i < AARCH64_PC_REGNUM; i++)
2362 return -1;
2363
2365 return -1;
2366
2367 return 0;
2368}
2369
2370/* Handler for aarch64 system call instruction recording. */
2371
2372static int
2374 unsigned long svc_number)
2375{
2376 int ret = 0;
2377 enum gdb_syscall syscall_gdb;
2378
2379 syscall_gdb =
2381
2382 if (syscall_gdb < 0)
2383 {
2385 _("Process record and replay target doesn't "
2386 "support syscall number %s\n"),
2387 plongest (svc_number));
2388 return -1;
2389 }
2390
2391 if (syscall_gdb == gdb_sys_sigreturn
2392 || syscall_gdb == gdb_sys_rt_sigreturn)
2393 {
2395 return -1;
2396 return 0;
2397 }
2398
2399 ret = record_linux_system_call (syscall_gdb, regcache,
2401 if (ret != 0)
2402 return ret;
2403
2404 /* Record the return value of the system call. */
2406 return -1;
2407 /* Record LR. */
2409 return -1;
2410 /* Record CPSR. */
2412 return -1;
2413
2414 return 0;
2415}
2416
2417/* Implement the "gcc_target_options" gdbarch method. */
2418
2419static std::string
2421{
2422 /* GCC doesn't know "-m64". */
2423 return {};
2424}
2425
2426/* Helper to get the allocation tag from a 64-bit ADDRESS.
2427
2428 Return the allocation tag if successful and nullopt otherwise. */
2429
2430static gdb::optional<CORE_ADDR>
2431aarch64_mte_get_atag (CORE_ADDR address)
2432{
2433 gdb::byte_vector tags;
2434
2435 /* Attempt to fetch the allocation tag. */
2436 if (!target_fetch_memtags (address, 1, tags,
2437 static_cast<int> (memtag_type::allocation)))
2438 return {};
2439
2440 /* Only one tag should've been returned. Make sure we got exactly that. */
2441 if (tags.size () != 1)
2442 error (_("Target returned an unexpected number of tags."));
2443
2444 /* Although our tags are 4 bits in size, they are stored in a
2445 byte. */
2446 return tags[0];
2447}
2448
2449/* Implement the tagged_address_p gdbarch method. */
2450
2451static bool
2453{
2454 gdb_assert (address != nullptr);
2455
2456 CORE_ADDR addr = value_as_address (address);
2457
2458 /* Remove the top byte for the memory range check. */
2460
2461 /* Check if the page that contains ADDRESS is mapped with PROT_MTE. */
2462 if (!linux_address_in_memtag_page (addr))
2463 return false;
2464
2465 /* We have a valid tag in the top byte of the 64-bit address. */
2466 return true;
2467}
2468
2469/* Implement the memtag_matches_p gdbarch method. */
2470
2471static bool
2473 struct value *address)
2474{
2475 gdb_assert (address != nullptr);
2476
2477 /* Make sure we are dealing with a tagged address to begin with. */
2479 return true;
2480
2481 CORE_ADDR addr = value_as_address (address);
2482
2483 /* Fetch the allocation tag for ADDRESS. */
2484 gdb::optional<CORE_ADDR> atag
2486
2487 if (!atag.has_value ())
2488 return true;
2489
2490 /* Fetch the logical tag for ADDRESS. */
2491 gdb_byte ltag = aarch64_mte_get_ltag (addr);
2492
2493 /* Are the tags the same? */
2494 return ltag == *atag;
2495}
2496
2497/* Implement the set_memtags gdbarch method. */
2498
2499static bool
2501 size_t length, const gdb::byte_vector &tags,
2502 memtag_type tag_type)
2503{
2504 gdb_assert (!tags.empty ());
2505 gdb_assert (address != nullptr);
2506
2507 CORE_ADDR addr = value_as_address (address);
2508
2509 /* Set the logical tag or the allocation tag. */
2510 if (tag_type == memtag_type::logical)
2511 {
2512 /* When setting logical tags, we don't care about the length, since
2513 we are only setting a single logical tag. */
2514 addr = aarch64_mte_set_ltag (addr, tags[0]);
2515
2516 /* Update the value's content with the tag. */
2517 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
2518 gdb_byte *srcbuf = address->contents_raw ().data ();
2519 store_unsigned_integer (srcbuf, sizeof (addr), byte_order, addr);
2520 }
2521 else
2522 {
2523 /* Remove the top byte. */
2525
2526 /* Make sure we are dealing with a tagged address to begin with. */
2528 return false;
2529
2530 /* With G being the number of tag granules and N the number of tags
2531 passed in, we can have the following cases:
2532
2533 1 - G == N: Store all the N tags to memory.
2534
2535 2 - G < N : Warn about having more tags than granules, but write G
2536 tags.
2537
2538 3 - G > N : This is a "fill tags" operation. We should use the tags
2539 as a pattern to fill the granules repeatedly until we have
2540 written G tags to memory.
2541 */
2542
2543 size_t g = aarch64_mte_get_tag_granules (addr, length,
2545 size_t n = tags.size ();
2546
2547 if (g < n)
2548 warning (_("Got more tags than memory granules. Tags will be "
2549 "truncated."));
2550 else if (g > n)
2551 warning (_("Using tag pattern to fill memory range."));
2552
2553 if (!target_store_memtags (addr, length, tags,
2554 static_cast<int> (memtag_type::allocation)))
2555 return false;
2556 }
2557 return true;
2558}
2559
2560/* Implement the get_memtag gdbarch method. */
2561
2562static struct value *
2564 memtag_type tag_type)
2565{
2566 gdb_assert (address != nullptr);
2567
2568 CORE_ADDR addr = value_as_address (address);
2569 CORE_ADDR tag = 0;
2570
2571 /* Get the logical tag or the allocation tag. */
2572 if (tag_type == memtag_type::logical)
2573 tag = aarch64_mte_get_ltag (addr);
2574 else
2575 {
2576 /* Make sure we are dealing with a tagged address to begin with. */
2578 return nullptr;
2579
2580 /* Remove the top byte. */
2582 gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
2583
2584 if (!atag.has_value ())
2585 return nullptr;
2586
2587 tag = *atag;
2588 }
2589
2590 /* Convert the tag to a value. */
2591 return value_from_ulongest (builtin_type (gdbarch)->builtin_unsigned_int,
2592 tag);
2593}
2594
2595/* Implement the memtag_to_string gdbarch method. */
2596
2597static std::string
2599{
2600 if (tag_value == nullptr)
2601 return "";
2602
2603 CORE_ADDR tag = value_as_address (tag_value);
2604
2605 return string_printf ("0x%s", phex_nz (tag, sizeof (tag)));
2606}
2607
2608/* AArch64 Linux implementation of the report_signal_info gdbarch
2609 hook. Displays information about possible memory tag violations. */
2610
2611static void
2613 struct ui_out *uiout,
2614 enum gdb_signal siggnal)
2615{
2616 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
2617
2618 if (!tdep->has_mte () || siggnal != GDB_SIGNAL_SEGV)
2619 return;
2620
2621 CORE_ADDR fault_addr = 0;
2622 long si_code = 0;
2623
2624 try
2625 {
2626 /* Sigcode tells us if the segfault is actually a memory tag
2627 violation. */
2628 si_code = parse_and_eval_long ("$_siginfo.si_code");
2629
2630 fault_addr
2631 = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
2632 }
2633 catch (const gdb_exception_error &exception)
2634 {
2635 exception_print (gdb_stderr, exception);
2636 return;
2637 }
2638
2639 /* If this is not a memory tag violation, just return. */
2640 if (si_code != SEGV_MTEAERR && si_code != SEGV_MTESERR)
2641 return;
2642
2643 uiout->text ("\n");
2644
2645 uiout->field_string ("sigcode-meaning", _("Memory tag violation"));
2646
2647 /* For synchronous faults, show additional information. */
2648 if (si_code == SEGV_MTESERR)
2649 {
2650 uiout->text (_(" while accessing address "));
2651 uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
2652 uiout->text ("\n");
2653
2654 gdb::optional<CORE_ADDR> atag
2656 fault_addr));
2657 gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
2658
2659 if (!atag.has_value ())
2660 uiout->text (_("Allocation tag unavailable"));
2661 else
2662 {
2663 uiout->text (_("Allocation tag "));
2664 uiout->field_string ("allocation-tag", hex_string (*atag));
2665 uiout->text ("\n");
2666 uiout->text (_("Logical tag "));
2667 uiout->field_string ("logical-tag", hex_string (ltag));
2668 }
2669 }
2670 else
2671 {
2672 uiout->text ("\n");
2673 uiout->text (_("Fault address unavailable"));
2674 }
2675}
2676
2677/* AArch64 Linux implementation of the gdbarch_create_memtag_section hook. */
2678
2679static asection *
2681 CORE_ADDR address, size_t size)
2682{
2683 gdb_assert (obfd != nullptr);
2684 gdb_assert (size > 0);
2685
2686 /* Create the section and associated program header.
2687
2688 Make sure the section's flags has SEC_HAS_CONTENTS, otherwise BFD will
2689 refuse to write data to this section. */
2690 asection *mte_section
2691 = bfd_make_section_anyway_with_flags (obfd, "memtag", SEC_HAS_CONTENTS);
2692
2693 if (mte_section == nullptr)
2694 return nullptr;
2695
2696 bfd_set_section_vma (mte_section, address);
2697 /* The size of the memory range covered by the memory tags. We reuse the
2698 section's rawsize field for this purpose. */
2699 mte_section->rawsize = size;
2700
2701 /* Fetch the number of tags we need to save. */
2702 size_t tags_count
2704 /* Tags are stored packed as 2 tags per byte. */
2705 bfd_set_section_size (mte_section, (tags_count + 1) >> 1);
2706 /* Store program header information. */
2707 bfd_record_phdr (obfd, PT_AARCH64_MEMTAG_MTE, 1, 0, 0, 0, 0, 0, 1,
2708 &mte_section);
2709
2710 return mte_section;
2711}
2712
2713/* Maximum number of tags to request. */
2714#define MAX_TAGS_TO_TRANSFER 1024
2715
2716/* AArch64 Linux implementation of the gdbarch_fill_memtag_section hook. */
2717
2718static bool
2720{
2721 /* We only handle MTE tags for now. */
2722
2723 size_t segment_size = osec->rawsize;
2724 CORE_ADDR start_address = bfd_section_vma (osec);
2725 CORE_ADDR end_address = start_address + segment_size;
2726
2727 /* Figure out how many tags we need to store in this memory range. */
2728 size_t granules = aarch64_mte_get_tag_granules (start_address, segment_size,
2730
2731 /* If there are no tag granules to fetch, just return. */
2732 if (granules == 0)
2733 return true;
2734
2735 CORE_ADDR address = start_address;
2736
2737 /* Vector of tags. */
2738 gdb::byte_vector tags;
2739
2740 while (granules > 0)
2741 {
2742 /* Transfer tags in chunks. */
2743 gdb::byte_vector tags_read;
2744 size_t xfer_len
2745 = ((granules >= MAX_TAGS_TO_TRANSFER)
2747 : granules * AARCH64_MTE_GRANULE_SIZE);
2748
2749 if (!target_fetch_memtags (address, xfer_len, tags_read,
2750 static_cast<int> (memtag_type::allocation)))
2751 {
2752 warning (_("Failed to read MTE tags from memory range [%s,%s)."),
2753 phex_nz (start_address, sizeof (start_address)),
2754 phex_nz (end_address, sizeof (end_address)));
2755 return false;
2756 }
2757
2758 /* Transfer over the tags that have been read. */
2759 tags.insert (tags.end (), tags_read.begin (), tags_read.end ());
2760
2761 /* Adjust the remaining granules and starting address. */
2762 granules -= tags_read.size ();
2763 address += tags_read.size () * AARCH64_MTE_GRANULE_SIZE;
2764 }
2765
2766 /* Pack the MTE tag bits. */
2767 aarch64_mte_pack_tags (tags);
2768
2769 if (!bfd_set_section_contents (osec->owner, osec, tags.data (),
2770 0, tags.size ()))
2771 {
2772 warning (_("Failed to write %s bytes of corefile memory "
2773 "tag content (%s)."),
2774 pulongest (tags.size ()),
2775 bfd_errmsg (bfd_get_error ()));
2776 }
2777 return true;
2778}
2779
2780/* AArch64 Linux implementation of the gdbarch_decode_memtag_section
2781 hook. Decode a memory tag section and return the requested tags.
2782
2783 The section is guaranteed to cover the [ADDRESS, ADDRESS + length)
2784 range. */
2785
2786static gdb::byte_vector
2788 bfd_section *section,
2789 int type,
2790 CORE_ADDR address, size_t length)
2791{
2792 gdb_assert (section != nullptr);
2793
2794 /* The requested address must not be less than section->vma. */
2795 gdb_assert (section->vma <= address);
2796
2797 /* Figure out how many tags we need to fetch in this memory range. */
2798 size_t granules = aarch64_mte_get_tag_granules (address, length,
2800 /* Sanity check. */
2801 gdb_assert (granules > 0);
2802
2803 /* Fetch the total number of tags in the range [VMA, address + length). */
2804 size_t granules_from_vma
2805 = aarch64_mte_get_tag_granules (section->vma,
2806 address - section->vma + length,
2808
2809 /* Adjust the tags vector to contain the exact number of packed bytes. */
2810 gdb::byte_vector tags (((granules - 1) >> 1) + 1);
2811
2812 /* Figure out the starting offset into the packed tags data. */
2813 file_ptr offset = ((granules_from_vma - granules) >> 1);
2814
2815 if (!bfd_get_section_contents (section->owner, section, tags.data (),
2816 offset, tags.size ()))
2817 error (_("Couldn't read contents from memtag section."));
2818
2819 /* At this point, the tags are packed 2 per byte. Unpack them before
2820 returning. */
2821 bool skip_first = ((granules_from_vma - granules) % 2) != 0;
2822 aarch64_mte_unpack_tags (tags, skip_first);
2823
2824 /* Resize to the exact number of tags that was requested. */
2825 tags.resize (granules);
2826
2827 return tags;
2828}
2829
2830/* AArch64 Linux implementation of the
2831 gdbarch_use_target_description_from_corefile_notes hook. */
2832
2833static bool
2835 bfd *obfd)
2836{
2837 /* Sanity check. */
2838 gdb_assert (obfd != nullptr);
2839
2840 /* If the corefile contains any SVE or SME register data, we don't want to
2841 use the target description note, as it may be incorrect.
2842
2843 Currently the target description note contains a potentially incorrect
2844 target description if the originating program changed the SVE or SME
2845 vector lengths mid-execution.
2846
2847 Once we support per-thread target description notes in the corefiles, we
2848 can always trust those notes whenever they are available. */
2849 if (bfd_get_section_by_name (obfd, ".reg-aarch-sve") != nullptr
2850 || bfd_get_section_by_name (obfd, ".reg-aarch-za") != nullptr
2851 || bfd_get_section_by_name (obfd, ".reg-aarch-zt") != nullptr)
2852 return false;
2853
2854 return true;
2855}
2856
2857static void
2859{
2860 static const char *const stap_integer_prefixes[] = { "#", "", NULL };
2861 static const char *const stap_register_prefixes[] = { "", NULL };
2862 static const char *const stap_register_indirection_prefixes[] = { "[",
2863 NULL };
2864 static const char *const stap_register_indirection_suffixes[] = { "]",
2865 NULL };
2866 aarch64_gdbarch_tdep *tdep = gdbarch_tdep<aarch64_gdbarch_tdep> (gdbarch);
2867
2868 tdep->lowest_pc = 0x8000;
2869
2870 linux_init_abi (info, gdbarch, 1);
2871
2874
2875 /* Enable TLS support. */
2878
2879 /* Shared library handling. */
2882
2884
2885 /* Enable longjmp. */
2886 tdep->jb_pc = 11;
2887
2892
2893 /* SystemTap related. */
2894 set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
2895 set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
2903
2904 /* Reversible debugging, process record. */
2906 /* Syscall record. */
2908
2909 /* MTE-specific settings and hooks. */
2910 if (tdep->has_mte ())
2911 {
2912 /* Register a hook for checking if an address is tagged or not. */
2914
2915 /* Register a hook for checking if there is a memory tag match. */
2918
2919 /* Register a hook for setting the logical/allocation tags for
2920 a range of addresses. */
2922
2923 /* Register a hook for extracting the logical/allocation tag from an
2924 address. */
2926
2927 /* Set the allocation tag granule size to 16 bytes. */
2929
2930 /* Register a hook for converting a memory tag to a string. */
2932
2935
2936 /* Core file helpers. */
2937
2938 /* Core file helper to create a memory tag section for a particular
2939 PT_LOAD segment. */
2942
2943 /* Core file helper to fill a memory tag section with tag data. */
2946
2947 /* Core file helper to decode a memory tag section. */
2950 }
2951
2952 /* Initialize the aarch64_linux_record_tdep. */
2953 /* These values are the size of the type that will be used in a system
2954 call. They are obtained from Linux Kernel source. */
2956 = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
2977 = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
2979 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
2981 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
3026
3027 /* These values are the second argument of system call "sys_ioctl".
3028 They are obtained from Linux Kernel source. */
3094
3095 /* These values are the second argument of system call "sys_fcntl"
3096 and "sys_fcntl64". They are obtained from Linux Kernel source. */
3101
3102 /* The AArch64 syscall calling convention: reg x0-x6 for arguments,
3103 reg x8 for syscall number and return value in reg x0. */
3111
3112 /* `catch syscall' */
3113 set_xml_syscall_file_name (gdbarch, "syscalls/aarch64-linux.xml");
3115
3116 /* Displaced stepping. */
3125
3127
3128 /* Hook to decide if the target description should be obtained from
3129 corefile target description note(s) or inferred from the corefile
3130 sections. */
3133}
3134
3135#if GDB_SELF_TEST
3136
3137namespace selftests {
3138
3139/* Verify functions to read and write logical tags. */
3140
3141static void
3142aarch64_linux_ltag_tests (void)
3143{
3144 /* We have 4 bits of tags, but we test writing all the bits of the top
3145 byte of address. */
3146 for (int i = 0; i < 1 << 8; i++)
3147 {
3148 CORE_ADDR addr = ((CORE_ADDR) i << 56) | 0xdeadbeef;
3149 SELF_CHECK (aarch64_mte_get_ltag (addr) == (i & 0xf));
3150
3151 addr = aarch64_mte_set_ltag (0xdeadbeef, i);
3152 SELF_CHECK (addr = ((CORE_ADDR) (i & 0xf) << 56) | 0xdeadbeef);
3153 }
3154}
3155
3156} // namespace selftests
3157#endif /* GDB_SELF_TEST */
3158
3160void
3162{
3163 gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
3165
3166#if GDB_SELF_TEST
3167 selftests::register_test ("aarch64-linux-tagged-address",
3168 selftests::aarch64_linux_ltag_tests);
3169#endif
3170}
#define AARCH64_ZT_MAGIC
#define AARCH64_EXTRA_DATAP_OFFSET
@ aarch64_sys_sync_file_range
@ aarch64_sys_accept
@ aarch64_sys_ioprio_get
@ aarch64_sys_mq_getsetattr
@ aarch64_sys_fchown
@ aarch64_sys_msgrcv
@ aarch64_sys_getsockopt
@ aarch64_sys_setregid
@ aarch64_sys_close
@ aarch64_sys_openat
@ aarch64_sys_fgetxattr
@ aarch64_sys_lseek
@ aarch64_sys_accept4
@ aarch64_sys_mincore
@ aarch64_sys_ppoll
@ aarch64_sys_fadvise64
@ aarch64_sys_sched_setaffinity
@ aarch64_sys_getrlimit
@ aarch64_sys_execve
@ aarch64_sys_io_setup
@ aarch64_sys_migrate_pages
@ aarch64_sys_mprotect
@ aarch64_sys_setgid
@ aarch64_sys_gettid
@ aarch64_sys_signalfd4
@ aarch64_sys_timer_create
@ aarch64_sys_fanotify_mark
@ aarch64_sys_recvfrom
@ aarch64_sys_chdir
@ aarch64_sys_ftruncate
@ aarch64_sys_msync
@ aarch64_sys_io_destroy
@ aarch64_sys_sync_file_range2
@ aarch64_sys_pwrite64
@ aarch64_sys_setitimer
@ aarch64_sys_setdomainname
@ aarch64_sys_remap_file_pages
@ aarch64_sys_sched_getaffinity
@ aarch64_sys_timer_settime
@ aarch64_sys_getppid
@ aarch64_sys_timer_getoverrun
@ aarch64_sys_sched_setscheduler
@ aarch64_sys_adjtimex
@ aarch64_sys_read
@ aarch64_sys_keyctl
@ aarch64_sys_vmsplice
@ aarch64_sys_swapon
@ aarch64_sys_fremovexattr
@ aarch64_sys_settimeofday
@ aarch64_sys_rt_sigpending
@ aarch64_sys_exit
@ aarch64_sys_setxattr
@ aarch64_sys_mount
@ aarch64_sys_inotify_add_watch
@ aarch64_sys_timerfd_gettime
@ aarch64_sys_tkill
@ aarch64_sys_pselect6
@ aarch64_sys_fchmodat
@ aarch64_sys_getresgid
@ aarch64_sys_sendmsg
@ aarch64_sys_shmat
@ aarch64_sys_mq_unlink
@ aarch64_sys_recvmsg
@ aarch64_sys_mlockall
@ aarch64_sys_preadv
@ aarch64_sys_setresuid
@ aarch64_sys_inotify_init1
@ aarch64_sys_tgkill
@ aarch64_sys_setrlimit
@ aarch64_sys_setresgid
@ aarch64_sys_semop
@ aarch64_sys_symlinkat
@ aarch64_sys_lsetxattr
@ aarch64_sys_mq_timedsend
@ aarch64_sys_getpid
@ aarch64_sys_sethostname
@ aarch64_sys_mremap
@ aarch64_sys_shmctl
@ aarch64_sys_sched_getparam
@ aarch64_sys_fallocate
@ aarch64_sys_sched_get_priority_max
@ aarch64_sys_umount2
@ aarch64_sys_mbind
@ aarch64_sys_sendto
@ aarch64_sys_readv
@ aarch64_sys_setsid
@ aarch64_sys_fcntl
@ aarch64_sys_sched_get_priority_min
@ aarch64_sys_fchownat
@ aarch64_sys_process_vm_readv
@ aarch64_sys_acct
@ aarch64_sys_flistxattr
@ aarch64_sys_msgctl
@ aarch64_sys_newfstatat
@ aarch64_sys_uname
@ aarch64_sys_listen
@ aarch64_sys_faccessat
@ aarch64_sys_madvise
@ aarch64_sys_clock_settime
@ aarch64_sys_timer_delete
@ aarch64_sys_epoll_create1
@ aarch64_sys_setsockopt
@ aarch64_sys_sendmmsg
@ aarch64_sys_mq_open
@ aarch64_sys_nfsservctl
@ aarch64_sys_mknodat
@ aarch64_sys_pwritev
@ aarch64_sys_removexattr
@ aarch64_sys_msgsnd
@ aarch64_sys_getrusage
@ aarch64_sys_munlockall
@ aarch64_sys_io_cancel
@ aarch64_sys_add_key
@ aarch64_sys_sync
@ aarch64_sys_mlock
@ aarch64_sys_finit_module
@ aarch64_sys_getuid
@ aarch64_sys_get_mempolicy
@ aarch64_sys_epoll_ctl
@ aarch64_sys_mq_notify
@ aarch64_sys_capset
@ aarch64_sys_getpriority
@ aarch64_sys_socketpair
@ aarch64_sys_mmap
@ aarch64_sys_wait4
@ aarch64_sys_set_mempolicy
@ aarch64_sys_set_robust_list
@ aarch64_sys_fanotify_init
@ aarch64_sys_getgid
@ aarch64_sys_getcpu
@ aarch64_sys_readlinkat
@ aarch64_sys_getpgid
@ aarch64_sys_semget
@ aarch64_sys_msgget
@ aarch64_sys_exit_group
@ aarch64_sys_getsockname
@ aarch64_sys_nanosleep
@ aarch64_sys_timerfd_create
@ aarch64_sys_io_getevents
@ aarch64_sys_getdents64
@ aarch64_sys_rt_sigqueueinfo
@ aarch64_sys_pipe2
@ aarch64_sys_sigaltstack
@ aarch64_sys_shutdown
@ aarch64_sys_rt_sigprocmask
@ aarch64_sys_fdatasync
@ aarch64_sys_setreuid
@ aarch64_sys_fchmod
@ aarch64_sys_epoll_pwait
@ aarch64_sys_renameat
@ aarch64_sys_mkdirat
@ aarch64_sys_sched_getattr
@ aarch64_sys_llistxattr
@ aarch64_sys_tee
@ aarch64_sys_open_by_handle_at
@ aarch64_sys_fstatfs
@ aarch64_sys_getegid
@ aarch64_sys_clock_gettime
@ aarch64_sys_inotify_rm_watch
@ aarch64_sys_fstat
@ aarch64_sys_clock_adjtime
@ aarch64_sys_setgroups
@ aarch64_sys_chroot
@ aarch64_sys_getrandom
@ aarch64_sys_write
@ aarch64_sys_sched_getscheduler
@ aarch64_sys_setpriority
@ aarch64_sys_lookup_dcookie
@ aarch64_sys_dup
@ aarch64_sys_dup3
@ aarch64_sys_capget
@ aarch64_sys_swapoff
@ aarch64_sys_lremovexattr
@ aarch64_sys_fsetxattr
@ aarch64_sys_setuid
@ aarch64_sys_flock
@ aarch64_sys_kill
@ aarch64_sys_linkat
@ aarch64_sys_setfsgid
@ aarch64_sys_brk
@ aarch64_sys_eventfd2
@ aarch64_sys_reboot
@ aarch64_sys_set_tid_address
@ aarch64_sys_truncate
@ aarch64_sys_umask
@ aarch64_sys_mq_timedreceive
@ aarch64_sys_setfsuid
@ aarch64_sys_semctl
@ aarch64_sys_syslog
@ aarch64_sys_pivot_root
@ aarch64_sys_writev
@ aarch64_sys_name_to_handle_at
@ aarch64_sys_rt_sigtimedwait
@ aarch64_sys_gettimeofday
@ aarch64_sys_munlock
@ aarch64_sys_delete_module
@ aarch64_sys_pread64
@ aarch64_sys_clone
@ aarch64_sys_munmap
@ aarch64_sys_readahead
@ aarch64_sys_rt_sigreturn
@ aarch64_sys_getpeername
@ aarch64_sys_times
@ aarch64_sys_getxattr
@ aarch64_sys_ioprio_set
@ aarch64_sys_io_submit
@ aarch64_sys_sched_setparam
@ aarch64_sys_getresuid
@ aarch64_sys_recvmmsg
@ aarch64_sys_vhangup
@ aarch64_sys_request_key
@ aarch64_sys_sched_rr_get_interval
@ aarch64_sys_getgroups
@ aarch64_sys_syncfs
@ aarch64_sys_ptrace
@ aarch64_sys_setpgid
@ aarch64_sys_semtimedop
@ aarch64_sys_clock_nanosleep
@ aarch64_sys_process_vm_writev
@ aarch64_sys_lgetxattr
@ aarch64_sys_shmdt
@ aarch64_sys_clock_getres
@ aarch64_sys_unshare
@ aarch64_sys_fsync
@ aarch64_sys_prctl
@ aarch64_sys_ioctl
@ aarch64_sys_socket
@ aarch64_sys_statfs
@ aarch64_sys_init_module
@ aarch64_sys_timerfd_settime
@ aarch64_sys_bind
@ aarch64_sys_rt_tgsigqueueinfo
@ aarch64_sys_sysinfo
@ aarch64_sys_sendfile
@ aarch64_sys_geteuid
@ aarch64_sys_setns
@ aarch64_sys_unlinkat
@ aarch64_sys_futex
@ aarch64_sys_get_robust_list
@ aarch64_sys_listxattr
@ aarch64_sys_rt_sigaction
@ aarch64_sys_sched_setattr
@ aarch64_sys_prlimit64
@ aarch64_sys_waitid
@ aarch64_sys_splice
@ aarch64_sys_rt_sigsuspend
@ aarch64_sys_connect
@ aarch64_sys_timer_gettime
@ aarch64_sys_fchdir
@ aarch64_sys_perf_event_open
@ aarch64_sys_sched_yield
@ aarch64_sys_shmget
@ aarch64_sys_personality
@ aarch64_sys_getitimer
@ aarch64_sys_kcmp
@ aarch64_sys_getsid
@ aarch64_sys_utimensat
@ aarch64_sys_quotactl
@ aarch64_sys_move_pages
@ aarch64_sys_kexec_load
@ aarch64_sys_getcwd
#define MAX_TAGS_TO_TRANSFER
static linux_record_tdep aarch64_linux_record_tdep
static int aarch64_all_but_pc_registers_record(struct regcache *regcache)
static expr::operation_up aarch64_stap_parse_special_token(struct gdbarch *gdbarch, struct stap_parse_info *p)
static void aarch64_linux_collect_zt_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
#define SVE_HEADER_SIZE
static void supply_sve_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
#define SVE_HEADER_RESERVED_LENGTH
#define SVE_HEADER_MAX_VL_LENGTH
#define AARCH64_SME_CONTEXT_SVL_OFFSET
#define SVE_HEADER_RESERVED_OFFSET
#define SVE_HEADER_FLAGS_LENGTH
#define AARCH64_SIGCONTEXT_REG_SIZE
static bool aarch64_use_target_description_from_corefile_notes(gdbarch *gdbarch, bfd *obfd)
#define SVE_HEADER_SIZE_LENGTH
#define AARCH64_SVE_CONTEXT_VL_OFFSET
#define SVE_HEADER_FLAG_SVE
static std::string aarch64_linux_gcc_target_options(struct gdbarch *gdbarch)
static void aarch64_linux_collect_sve_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
static int aarch64_linux_syscall_record(struct regcache *regcache, unsigned long svc_number)
#define SVE_SIG_FLAG_SM
#define AARCH64_ZA_MAGIC
#define AARCH64_SME_CONTEXT_SIZE(svq)
static gdb::optional< CORE_ADDR > aarch64_mte_get_atag(CORE_ADDR address)
static void aarch64_linux_restore_vregs(struct gdbarch *gdbarch, struct trad_frame_cache *cache, CORE_ADDR fpsimd_context)
#define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET
static void aarch64_linux_supply_ssve_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
#define AARCH64_FPSIMD_VREG_SIZE
#define AARCH64_SVE_CONTEXT_P_REGS_OFFSET(vq)
#define SVE_HEADER_FLAGS_OFFSET
#define AARCH64_SVE_CONTEXT_FLAGS_OFFSET
static const struct regcache_map_entry aarch64_linux_fpregmap[]
static bool aarch64_linux_set_memtags(struct gdbarch *gdbarch, struct value *address, size_t length, const gdb::byte_vector &tags, memtag_type tag_type)
static struct value * aarch64_linux_get_memtag(struct gdbarch *gdbarch, struct value *address, memtag_type tag_type)
#define AARCH64_SME2_CONTEXT_NREGS_OFFSET
static const struct tramp_frame aarch64_linux_rt_sigframe
static void aarch64_linux_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
static const struct regcache_map_entry aarch64_linux_gregmap[]
#define AARCH64_SIGCONTEXT_RESERVED_SIZE
#define AARCH64_SME2_CONTEXT_REGS_OFFSET
static uint64_t aarch64_linux_core_read_vq(struct gdbarch *gdbarch, bfd *abfd, const char *section_name)
#define AARCH64_SVE_CONTEXT_FFR_OFFSET(vq)
static bool aarch64_linux_fill_memtag_section(struct gdbarch *gdbarch, asection *osec)
const struct regset aarch64_linux_fpregset
static void aarch64_linux_report_signal_info(struct gdbarch *gdbarch, struct ui_out *uiout, enum gdb_signal siggnal)
#define AARCH64_FPSIMD_FPCR_OFFSET
#define AARCH64_SVE_CONTEXT_REGS_OFFSET
static void aarch64_linux_supply_zt_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
#define SVE_HEADER_MAX_SIZE_OFFSET
static enum gdb_syscall aarch64_canonicalize_syscall(enum aarch64_syscall syscall_number)
static gdb::byte_vector aarch64_linux_decode_memtag_section(struct gdbarch *gdbarch, bfd_section *section, int type, CORE_ADDR address, size_t length)
#define AARCH64_FPSIMD_FPSR_OFFSET
#define AARCH64_SIGCONTEXT_XO_OFFSET
#define SVE_HEADER_VL_LENGTH
#define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
static void collect_inactive_sve_regset(const struct regcache *regcache, void *buf, size_t size, int vg_regnum)
static uint32_t read_aarch64_ctx(CORE_ADDR ctx_addr, enum bfd_endian byte_order, uint32_t *size)
static void aarch64_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static void aarch64_linux_sigframe_init(const struct tramp_frame *self, frame_info_ptr this_frame, struct trad_frame_cache *this_cache, CORE_ADDR func)
void _initialize_aarch64_linux_tdep()
#define SYSCALL_MAP(SYSCALL)
static bool aarch64_linux_tagged_address_p(struct gdbarch *gdbarch, struct value *address)
static void aarch64_linux_collect_za_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
#define AARCH64_TPIDR2_CONTEXT_TPIDR2_OFFSET
#define AARCH64_FPSIMD_MAGIC
#define UNSUPPORTED_SYSCALL_MAP(SYSCALL)
static void aarch64_linux_supply_za_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
#define AARCH64_SVE_CONTEXT_SIZE(vq)
static LONGEST aarch64_linux_get_syscall_number(struct gdbarch *gdbarch, thread_info *thread)
#define AARCH64_FPSIMD_V0_OFFSET
#define SVE_HEADER_SIZE_OFFSET
#define AARCH64_EXTRA_MAGIC
static int aarch64_stap_is_single_operand(struct gdbarch *gdbarch, const char *s)
#define AARCH64_SME_CONTEXT_REGS_OFFSET
static void aarch64_linux_supply_sve_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
static const struct target_desc * aarch64_linux_core_read_description(struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
#define AARCH64_SVE_MAGIC
#define SVE_HEADER_MAX_VL_OFFSET
static void aarch64_linux_read_signal_frame_info(frame_info_ptr this_frame, struct aarch64_linux_sigframe &signal_frame)
static asection * aarch64_linux_create_memtag_section(struct gdbarch *gdbarch, bfd *obfd, CORE_ADDR address, size_t size)
static uint64_t aarch64_linux_core_read_vq_from_sections(struct gdbarch *gdbarch, bfd *core_bfd)
static void collect_sve_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
static void aarch64_linux_collect_ssve_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
static std::string aarch64_linux_memtag_to_string(struct gdbarch *gdbarch, struct value *tag_value)
static bool aarch64_linux_memtag_matches_p(struct gdbarch *gdbarch, struct value *address)
#define SVE_HEADER_VL_OFFSET
const struct regset aarch64_linux_gregset
#define SVE_HEADER_MAX_SIZE_LENGTH
#define AARCH64_TPIDR2_MAGIC
#define AARCH64_SIGCONTEXT_RESERVED_OFFSET
static struct gdbarch * aarch64_linux_sigframe_prev_arch(frame_info_ptr this_frame, void **frame_cache)
#define AARCH64_LINUX_SIZEOF_GREGSET
#define AARCH64_LINUX_SIZEOF_MTE_REGSET
#define AARCH64_HWCAP_PACA
#define AARCH64_LINUX_SIZEOF_FPREGSET
#define AARCH64_LINUX_SIZEOF_PAUTH
CORE_ADDR aarch64_mte_get_ltag(CORE_ADDR address)
size_t aarch64_mte_get_tag_granules(CORE_ADDR addr, size_t len, size_t granule_size)
void aarch64_mte_unpack_tags(gdb::byte_vector &tags, bool skip_first)
CORE_ADDR aarch64_mte_set_ltag(CORE_ADDR address, CORE_ADDR tag)
void aarch64_mte_pack_tags(gdb::byte_vector &tags)
#define SEGV_MTESERR
#define HWCAP2_MTE
#define AARCH64_MTE_GRANULE_SIZE
#define SEGV_MTEAERR
bool sve_state_is_empty(const struct reg_buffer_common *reg_buf)
#define SVE_CORE_DUMMY_FLAGS
#define SVE_CORE_DUMMY_MAX_VL
#define SVCR_ZA_BIT
#define SVE_CORE_DUMMY_MAX_SIZE
#define SVCR_SM_BIT
#define SVE_CORE_DUMMY_RESERVED
#define SVE_CORE_DUMMY_SIZE
displaced_step_copy_insn_closure_up aarch64_displaced_step_copy_insn(struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
int regnum
aarch64_features aarch64_features_from_target_desc(const struct target_desc *tdesc)
bool aarch64_displaced_step_hw_singlestep(struct gdbarch *gdbarch)
const target_desc * aarch64_read_description(const aarch64_features &features)
int aarch64_process_record(struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR insn_addr)
void aarch64_displaced_step_fixup(struct gdbarch *gdbarch, struct displaced_step_copy_insn_closure *dsc_, CORE_ADDR from, CORE_ADDR to, struct regcache *regs, bool completed_p)
#define B_REGISTER_SIZE
#define AARCH64_DISPLACED_MODIFIED_INSNS
#define D_REGISTER_SIZE
#define Q_REGISTER_SIZE
#define H_REGISTER_SIZE
#define S_REGISTER_SIZE
#define AARCH64_Q0_REGNUM
Definition aarch64.h:151
#define AARCH64_H0_REGNUM
Definition aarch64.h:154
#define AARCH64_SVE_P_REGS_NUM
Definition aarch64.h:171
#define sve_vq_from_vl(vl)
Definition aarch64.h:187
#define sve_vl_from_vq(vq)
Definition aarch64.h:190
#define sve_vl_from_vg(vg)
Definition aarch64.h:185
#define AARCH64_SVE_V0_REGNUM
Definition aarch64.h:156
@ AARCH64_SVE_FFR_REGNUM
Definition aarch64.h:130
@ AARCH64_FP_REGNUM
Definition aarch64.h:116
@ AARCH64_PC_REGNUM
Definition aarch64.h:119
@ AARCH64_CPSR_REGNUM
Definition aarch64.h:120
@ AARCH64_SP_REGNUM
Definition aarch64.h:118
@ AARCH64_SVE_VG_REGNUM
Definition aarch64.h:131
@ AARCH64_SVE_Z0_REGNUM
Definition aarch64.h:123
@ AARCH64_FPSR_REGNUM
Definition aarch64.h:125
@ AARCH64_SVE_P0_REGNUM
Definition aarch64.h:127
@ AARCH64_FPCR_REGNUM
Definition aarch64.h:126
@ AARCH64_LR_REGNUM
Definition aarch64.h:117
@ AARCH64_X0_REGNUM
Definition aarch64.h:115
@ AARCH64_V0_REGNUM
Definition aarch64.h:121
#define AARCH64_B0_REGNUM
Definition aarch64.h:155
#define V_REGISTER_SIZE
Definition aarch64.h:141
#define AARCH64_TLS_REGISTER_SIZE
Definition aarch64.h:140
#define sve_vg_from_vl(vl)
Definition aarch64.h:184
#define AARCH64_S0_REGNUM
Definition aarch64.h:153
#define AARCH64_SVE_Z_REGS_NUM
Definition aarch64.h:170
#define AARCH64_MAX_SVE_VQ
Definition aarch64.h:197
#define AARCH64_D0_REGNUM
Definition aarch64.h:152
#define AARCH64_SME2_ZT0_SIZE
Definition aarch64.h:231
#define AARCH64_PAUTH_DMASK_REGNUM(pauth_reg_base)
Definition aarch64.h:158
struct gdbarch * gdbarch_find_by_info(struct gdbarch_info info)
gdb::optional< gdb::byte_vector > target_read_auxv_raw(target_ops *ops)
Definition auxv.c:377
enum register_status cooked_read(int regnum, gdb_byte *buf)
Definition regcache.c:698
gdbarch * arch() const
Definition regcache.c:231
void raw_collect(int regnum, void *buf) const override
Definition regcache.c:1127
void raw_supply(int regnum, const void *buf) override
Definition regcache.c:1062
void raw_supply_zeroed(int regnum)
Definition regcache.c:1110
void raw_collect_part(int regnum, int offset, int len, gdb_byte *out) const
Definition regcache.c:921
void collect_regset(const struct regset *regset, int regbase, int regnum, void *buf, size_t size) const
Definition regcache.c:1283
void supply_regset(const struct regset *regset, int regbase, int regnum, const void *buf, size_t size)
Definition regcache.c:1261
void field_core_addr(const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
Definition ui-out.c:478
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
Definition ui-out.c:511
void text(const char *string)
Definition ui-out.c:566
void store_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, T val)
Definition findvar.c:162
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
Definition defs.h:515
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
Definition defs.h:480
LONGEST parse_and_eval_long(const char *exp)
Definition eval.c:62
void exception_print(struct ui_file *file, const struct gdb_exception &e)
Definition exceptions.c:106
ssize_t read(int fd, void *buf, size_t count)
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
Definition frame.c:1399
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition frame.c:736
struct gdbarch * get_frame_arch(frame_info_ptr this_frame)
Definition frame.c:3027
@ SIGTRAMP_FRAME
Definition frame.h:198
#define ptrace(request, pid, addr, data)
Definition gdb_ptrace.h:141
void set_gdbarch_process_record(struct gdbarch *gdbarch, gdbarch_process_record_ftype *process_record)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition gdbarch.c:1396
void set_gdbarch_stap_parse_special_token(struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token)
void set_gdbarch_use_target_description_from_corefile_notes(struct gdbarch *gdbarch, gdbarch_use_target_description_from_corefile_notes_ftype *use_target_description_from_corefile_notes)
void set_gdbarch_stap_integer_prefixes(struct gdbarch *gdbarch, const char *const *stap_integer_prefixes)
Definition gdbarch.c:4560
void set_gdbarch_max_insn_length(struct gdbarch *gdbarch, ULONGEST max_insn_length)
Definition gdbarch.c:4093
void set_gdbarch_core_read_description(struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description)
void set_gdbarch_create_memtag_section(struct gdbarch *gdbarch, gdbarch_create_memtag_section_ftype *create_memtag_section)
void set_gdbarch_displaced_step_buffer_length(struct gdbarch *gdbarch, ULONGEST displaced_step_buffer_length)
Definition gdbarch.c:4251
void set_gdbarch_memtag_granule_size(struct gdbarch *gdbarch, CORE_ADDR memtag_granule_size)
Definition gdbarch.c:3281
void set_gdbarch_skip_trampoline_code(struct gdbarch *gdbarch, gdbarch_skip_trampoline_code_ftype *skip_trampoline_code)
void set_gdbarch_stap_is_single_operand(struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand)
void set_gdbarch_tagged_address_p(struct gdbarch *gdbarch, gdbarch_tagged_address_p_ftype *tagged_address_p)
void set_gdbarch_get_syscall_number(struct gdbarch *gdbarch, gdbarch_get_syscall_number_ftype *get_syscall_number)
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition gdbarch.c:1930
bfd * obfd
void set_gdbarch_get_memtag(struct gdbarch *gdbarch, gdbarch_get_memtag_ftype *get_memtag)
int gdbarch_int_bit(struct gdbarch *gdbarch)
Definition gdbarch.c:1449
void set_gdbarch_memtag_matches_p(struct gdbarch *gdbarch, gdbarch_memtag_matches_p_ftype *memtag_matches_p)
void set_gdbarch_displaced_step_copy_insn(struct gdbarch *gdbarch, gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn)
void set_gdbarch_stap_register_indirection_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_prefixes)
Definition gdbarch.c:4628
void set_gdbarch_gcc_target_options(struct gdbarch *gdbarch, gdbarch_gcc_target_options_ftype *gcc_target_options)
const struct target_desc * gdbarch_target_desc(struct gdbarch *gdbarch)
Definition gdbarch.c:1423
void set_gdbarch_displaced_step_fixup(struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup)
CORE_ADDR gdbarch_remove_non_address_bits(struct gdbarch *gdbarch, CORE_ADDR pointer)
Definition gdbarch.c:3169
void set_gdbarch_memtag_to_string(struct gdbarch *gdbarch, gdbarch_memtag_to_string_ftype *memtag_to_string)
void set_gdbarch_report_signal_info(struct gdbarch *gdbarch, gdbarch_report_signal_info_ftype *report_signal_info)
void set_gdbarch_fetch_tls_load_module_address(struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address)
void set_gdbarch_displaced_step_hw_singlestep(struct gdbarch *gdbarch, gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep)
int gdbarch_long_bit(struct gdbarch *gdbarch)
Definition gdbarch.c:1466
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
Definition gdbarch.c:1722
void set_gdbarch_fill_memtag_section(struct gdbarch *gdbarch, gdbarch_fill_memtag_section_ftype *fill_memtag_section)
void set_gdbarch_stap_register_prefixes(struct gdbarch *gdbarch, const char *const *stap_register_prefixes)
Definition gdbarch.c:4594
void set_gdbarch_stap_register_indirection_suffixes(struct gdbarch *gdbarch, const char *const *stap_register_indirection_suffixes)
Definition gdbarch.c:4645
void set_gdbarch_set_memtags(struct gdbarch *gdbarch, gdbarch_set_memtags_ftype *set_memtags)
void set_gdbarch_skip_solib_resolver(struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype *skip_solib_resolver)
void set_gdbarch_decode_memtag_section(struct gdbarch *gdbarch, gdbarch_decode_memtag_section_ftype *decode_memtag_section)
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections)
memtag_type
Definition gdbarch.h:130
void iterate_over_regset_sections_cb(const char *sect_name, int supply_size, int collect_size, const struct regset *regset, const char *human_name, void *cb_data)
Definition gdbarch.h:104
#define core_bfd
Definition gdbcore.h:130
struct type * lookup_pointer_type(struct type *type)
Definition gdbtypes.c:430
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
Definition gdbtypes.c:6168
CORE_ADDR glibc_skip_solib_resolver(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition glibc-tdep.c:38
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
size_t size
Definition go32-nat.c:239
int record_linux_system_call(enum gdb_syscall syscall, struct regcache *regcache, struct linux_record_tdep *tdep)
gdb_syscall
@ gdb_sys_sigreturn
@ gdb_sys_no_syscall
@ gdb_sys_rt_sigreturn
@ gdb_sys_mmap2
link_map_offsets * linux_lp64_fetch_link_map_offsets()
CORE_ADDR linux_get_hwcap2()
void linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch, int num_disp_step_buffers)
bool linux_address_in_memtag_page(CORE_ADDR address)
CORE_ADDR linux_get_hwcap()
CORE_ADDR find_solib_trampoline_target(frame_info_ptr frame, CORE_ADDR pc)
Definition minsyms.c:1554
Definition ada-exp.h:87
std::unique_ptr< operation > operation_up
Definition expression.h:82
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition osabi.c:146
@ GDB_OSABI_LINUX
Definition osabi.h:32
int record_full_arch_list_add_reg(struct regcache *regcache, int regnum)
void regcache_collect_regset(const struct regset *regset, const struct regcache *regcache, int regnum, void *buf, size_t size)
Definition regcache.c:1273
struct regcache * get_thread_regcache(process_stratum_target *target, ptid_t ptid)
Definition regcache.c:400
void regcache_supply_regset(const struct regset *regset, struct regcache *regcache, int regnum, const void *buf, size_t size)
Definition regcache.c:1251
static int regcache_map_entry_size(const struct regcache_map_entry *map)
Definition regcache.h:128
#define REGSET_VARIABLE_SIZE
Definition regset.h:52
void(* func)(remote_target *remote, char *)
static const char *const stap_register_indirection_prefixes[]
static const char *const stap_register_indirection_suffixes[]
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
uint64_t vq
Definition aarch64.h:34
int(* aarch64_syscall_record)(struct regcache *regcache, unsigned long svc_number)
bool has_sme2() const
bool has_pauth() const
struct type * builtin_long
Definition gdbtypes.h:2081
ULONGEST ioctl_TIOCGLCKTRMIOS
ULONGEST ioctl_TIOCMIWAIT
ULONGEST ioctl_TCGETA
ULONGEST ioctl_TIOCGICOUNT
ULONGEST ioctl_TIOCMBIC
ULONGEST ioctl_TIOCMBIS
ULONGEST ioctl_TCSETSW2
ULONGEST ioctl_TIOCSERGSTRUCT
ULONGEST ioctl_TIOCGPTN
ULONGEST ioctl_TIOCSERGETMULTI
ULONGEST ioctl_TIOCGSID
ULONGEST ioctl_FIOQSIZE
ULONGEST ioctl_TIOCSERCONFIG
ULONGEST ioctl_FIONCLEX
ULONGEST ioctl_TIOCSSOFTCAR
ULONGEST ioctl_TIOCSWINSZ
ULONGEST ioctl_TCSETSF
ULONGEST ioctl_TIOCLINUX
ULONGEST ioctl_TIOCTTYGSTRUCT
ULONGEST ioctl_TIOCSBRK
ULONGEST ioctl_TIOCGPGRP
ULONGEST ioctl_TIOCSERSETMULTI
ULONGEST ioctl_TCSETS
ULONGEST ioctl_TIOCSSERIAL
int size_serial_icounter_struct
ULONGEST ioctl_TIOCSPTLCK
ULONGEST ioctl_TIOCGETD
ULONGEST ioctl_FIONREAD
ULONGEST ioctl_TIOCCBRK
ULONGEST ioctl_TCGETS
ULONGEST ioctl_TIOCGSOFTCAR
ULONGEST ioctl_TIOCNOTTY
ULONGEST ioctl_TIOCSPGRP
ULONGEST ioctl_TIOCGSERIAL
ULONGEST ioctl_FIOASYNC
ULONGEST ioctl_TIOCSERGETLSR
ULONGEST ioctl_TIOCOUTQ
ULONGEST ioctl_TIOCMGET
ULONGEST ioctl_TIOCGWINSZ
ULONGEST ioctl_TIOCSERGWILD
ULONGEST ioctl_TIOCCONS
ULONGEST ioctl_TCSETSF2
ULONGEST ioctl_TIOCSCTTY
ULONGEST ioctl_TIOCSETD
ULONGEST ioctl_TIOCSLCKTRMIOS
ULONGEST ioctl_TIOCSHAYESESP
ULONGEST ioctl_TIOCGHAYESESP
ULONGEST ioctl_TIOCEXCL
ULONGEST ioctl_TIOCNXCL
ULONGEST ioctl_TCSETSW
ULONGEST ioctl_TIOCMSET
ULONGEST ioctl_TIOCSERSWILD
Definition regcache.h:111
const char * arg
Definition stap-probe.h:45
const char * saved_arg
Definition stap-probe.h:53
struct type * arg_type
Definition stap-probe.h:59
std::vector< tdesc_feature_up > features
Definition value.h:130
gdb::array_view< gdb_byte > contents_raw()
Definition value.c:1009
LONGEST offset() const
Definition value.h:222
CORE_ADDR address
Definition value.h:658
bool target_store_memtags(CORE_ADDR address, size_t len, const gdb::byte_vector &tags, int type)
Definition target.c:828
bool target_fetch_memtags(CORE_ADDR address, size_t len, gdb::byte_vector &tags, int type)
Definition target.c:821
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition target.c:1785
void trad_frame_set_reg_value_bytes(struct trad_frame_cache *this_trad_cache, int regnum, gdb::array_view< const gdb_byte > bytes)
Definition trad-frame.c:175
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
Definition trad-frame.c:110
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
Definition trad-frame.c:220
void trad_frame_set_reg_value(struct trad_frame_cache *this_trad_cache, int regnum, LONGEST val)
Definition trad-frame.c:94
void tramp_frame_prepend_unwinder(struct gdbarch *gdbarch, const struct tramp_frame *tramp_frame)
#define TRAMP_SENTINEL_INSN
Definition tramp-frame.h:44
int user_reg_map_name_to_regnum(struct gdbarch *gdbarch, const char *name, int len)
Definition user-regs.c:132
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1886
#define gdb_stderr
Definition utils.h:187
CORE_ADDR value_as_address(struct value *val)
Definition value.c:2636
struct value * value_from_ulongest(struct type *type, ULONGEST num)
Definition value.c:3450
void set_xml_syscall_file_name(struct gdbarch *gdbarch, const char *name)
Definition xml-syscall.c:50