1 /* Target-dependent code for GNU/Linux AArch64.
3 Copyright (C) 2009-2017 Free Software Foundation, Inc.
4 Contributed by ARM Ltd.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "arch-utils.h"
25 #include "glibc-tdep.h"
26 #include "linux-tdep.h"
27 #include "aarch64-tdep.h"
28 #include "aarch64-linux-tdep.h"
30 #include "solib-svr4.h"
32 #include "tramp-frame.h"
33 #include "trad-frame.h"
39 #include "cli/cli-utils.h"
40 #include "stap-probe.h"
41 #include "parser-defs.h"
42 #include "user-regs.h"
43 #include "xml-syscall.h"
46 #include "record-full.h"
47 #include "linux-record.h"
49 #include "elf/common.h"
51 /* Signal frame handling.
66 | | | SIGTRAMP_FRAME (struct rt_sigframe)
68 +--| saved sp |--> interrupted_sp
69 | | saved pc |--> interrupted_pc
72 | | saved lr |--> default_restorer (movz x8, NR_sys_rt_sigreturn; svc 0)
78 On signal delivery, the kernel will create a signal handler stack
79 frame and setup the return address in LR to point at restorer stub.
80 The signal stack frame is defined by:
93 The ucontext has the following form:
96 unsigned long uc_flags;
97 struct ucontext *uc_link;
100 struct sigcontext uc_mcontext;
103 typedef struct sigaltstack
112 unsigned long fault_address;
113 unsigned long regs[31];
114 unsigned long sp; / * 31 * /
115 unsigned long pc; / * 32 * /
116 unsigned long pstate; / * 33 * /
117 __u8 __reserved[4096]
120 The restorer stub will always have the form:
122 d28015a8 movz x8, #0xad
125 This is a system call sys_rt_sigreturn.
127 We detect signal frames by snooping the return code for the restorer
128 instruction sequence.
130 The handler then needs to recover the saved register set from
131 ucontext.uc_mcontext. */
133 /* These magic numbers need to reflect the layout of the kernel
134 defined struct rt_sigframe and ucontext. */
135 #define AARCH64_SIGCONTEXT_REG_SIZE 8
136 #define AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET 128
137 #define AARCH64_UCONTEXT_SIGCONTEXT_OFFSET 176
138 #define AARCH64_SIGCONTEXT_XO_OFFSET 8
140 /* Implement the "init" method of struct tramp_frame. */
143 aarch64_linux_sigframe_init (const struct tramp_frame *self,
144 struct frame_info *this_frame,
145 struct trad_frame_cache *this_cache,
148 CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM);
149 CORE_ADDR sigcontext_addr =
151 + AARCH64_RT_SIGFRAME_UCONTEXT_OFFSET
152 + AARCH64_UCONTEXT_SIGCONTEXT_OFFSET;
155 for (i = 0; i < 31; i++)
157 trad_frame_set_reg_addr (this_cache,
158 AARCH64_X0_REGNUM + i,
159 sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
160 + i * AARCH64_SIGCONTEXT_REG_SIZE);
162 trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM,
163 sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
164 + 31 * AARCH64_SIGCONTEXT_REG_SIZE);
165 trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM,
166 sigcontext_addr + AARCH64_SIGCONTEXT_XO_OFFSET
167 + 32 * AARCH64_SIGCONTEXT_REG_SIZE);
169 trad_frame_set_id (this_cache, frame_id_build (sp, func));
172 static const struct tramp_frame aarch64_linux_rt_sigframe =
177 /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
178 Soo1 0010 1hhi iiii iiii iiii iiir rrrr */
181 /* svc 0x0 (o=0, l=1)
182 1101 0100 oooi iiii iiii iiii iii0 00ll */
184 {TRAMP_SENTINEL_INSN, -1}
186 aarch64_linux_sigframe_init
191 static const struct regcache_map_entry aarch64_linux_gregmap[] =
193 { 31, AARCH64_X0_REGNUM, 8 }, /* x0 ... x30 */
194 { 1, AARCH64_SP_REGNUM, 8 },
195 { 1, AARCH64_PC_REGNUM, 8 },
196 { 1, AARCH64_CPSR_REGNUM, 8 },
200 static const struct regcache_map_entry aarch64_linux_fpregmap[] =
202 { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */
203 { 1, AARCH64_FPSR_REGNUM, 4 },
204 { 1, AARCH64_FPCR_REGNUM, 4 },
208 /* Register set definitions. */
210 const struct regset aarch64_linux_gregset =
212 aarch64_linux_gregmap,
213 regcache_supply_regset, regcache_collect_regset
216 const struct regset aarch64_linux_fpregset =
218 aarch64_linux_fpregmap,
219 regcache_supply_regset, regcache_collect_regset
222 /* Implement the "regset_from_core_section" gdbarch method. */
225 aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
226 iterate_over_regset_sections_cb *cb,
228 const struct regcache *regcache)
230 cb (".reg", AARCH64_LINUX_SIZEOF_GREGSET, &aarch64_linux_gregset,
232 cb (".reg2", AARCH64_LINUX_SIZEOF_FPREGSET, &aarch64_linux_fpregset,
236 /* Implement the "core_read_description" gdbarch method. */
238 static const struct target_desc *
239 aarch64_linux_core_read_description (struct gdbarch *gdbarch,
240 struct target_ops *target, bfd *abfd)
242 CORE_ADDR aarch64_hwcap = 0;
244 if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1)
247 return tdesc_aarch64;
250 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
254 aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
256 return (*s == '#' || isdigit (*s) /* Literal number. */
257 || *s == '[' /* Register indirection. */
258 || isalpha (*s)); /* Register value. */
261 /* This routine is used to parse a special token in AArch64's assembly.
263 The special tokens parsed by it are:
265 - Register displacement (e.g, [fp, #-8])
267 It returns one if the special token has been parsed successfully,
268 or zero if the current token is not considered special. */
271 aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
272 struct stap_parse_info *p)
276 /* Temporary holder for lookahead. */
277 const char *tmp = p->arg;
279 /* Used to save the register name. */
291 while (isalnum (*tmp))
298 regname = (char *) alloca (len + 2);
300 strncpy (regname, start, len);
303 if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
304 error (_("Invalid register name `%s' on expression `%s'."),
305 regname, p->saved_arg);
308 tmp = skip_spaces (tmp);
309 /* Now we expect a number. It can begin with '#' or simply
319 else if (*tmp == '+')
325 displacement = strtol (tmp, &endp, 10);
328 /* Skipping last `]'. */
332 /* The displacement. */
333 write_exp_elt_opcode (&p->pstate, OP_LONG);
334 write_exp_elt_type (&p->pstate, builtin_type (gdbarch)->builtin_long);
335 write_exp_elt_longcst (&p->pstate, displacement);
336 write_exp_elt_opcode (&p->pstate, OP_LONG);
338 write_exp_elt_opcode (&p->pstate, UNOP_NEG);
340 /* The register name. */
341 write_exp_elt_opcode (&p->pstate, OP_REGISTER);
344 write_exp_string (&p->pstate, str);
345 write_exp_elt_opcode (&p->pstate, OP_REGISTER);
347 write_exp_elt_opcode (&p->pstate, BINOP_ADD);
349 /* Casting to the expected type. */
350 write_exp_elt_opcode (&p->pstate, UNOP_CAST);
351 write_exp_elt_type (&p->pstate, lookup_pointer_type (p->arg_type));
352 write_exp_elt_opcode (&p->pstate, UNOP_CAST);
354 write_exp_elt_opcode (&p->pstate, UNOP_IND);
364 /* Implement the "get_syscall_number" gdbarch method. */
367 aarch64_linux_get_syscall_number (struct gdbarch *gdbarch,
370 struct regcache *regs = get_thread_regcache (ptid);
371 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
373 /* The content of register x8. */
374 gdb_byte buf[X_REGISTER_SIZE];
378 /* Getting the system call number from the register x8. */
379 regcache_cooked_read (regs, AARCH64_DWARF_X0 + 8, buf);
381 ret = extract_signed_integer (buf, X_REGISTER_SIZE, byte_order);
386 /* AArch64 process record-replay constructs: syscall, signal etc. */
388 struct linux_record_tdep aarch64_linux_record_tdep;
390 /* Enum that defines the AArch64 linux specific syscall identifiers used for
391 process record/replay. */
393 enum aarch64_syscall {
394 aarch64_sys_io_setup = 0,
395 aarch64_sys_io_destroy = 1,
396 aarch64_sys_io_submit = 2,
397 aarch64_sys_io_cancel = 3,
398 aarch64_sys_io_getevents = 4,
399 aarch64_sys_setxattr = 5,
400 aarch64_sys_lsetxattr = 6,
401 aarch64_sys_fsetxattr = 7,
402 aarch64_sys_getxattr = 8,
403 aarch64_sys_lgetxattr = 9,
404 aarch64_sys_fgetxattr = 10,
405 aarch64_sys_listxattr = 11,
406 aarch64_sys_llistxattr = 12,
407 aarch64_sys_flistxattr = 13,
408 aarch64_sys_removexattr = 14,
409 aarch64_sys_lremovexattr = 15,
410 aarch64_sys_fremovexattr = 16,
411 aarch64_sys_getcwd = 17,
412 aarch64_sys_lookup_dcookie = 18,
413 aarch64_sys_eventfd2 = 19,
414 aarch64_sys_epoll_create1 = 20,
415 aarch64_sys_epoll_ctl = 21,
416 aarch64_sys_epoll_pwait = 22,
417 aarch64_sys_dup = 23,
418 aarch64_sys_dup3 = 24,
419 aarch64_sys_fcntl = 25,
420 aarch64_sys_inotify_init1 = 26,
421 aarch64_sys_inotify_add_watch = 27,
422 aarch64_sys_inotify_rm_watch = 28,
423 aarch64_sys_ioctl = 29,
424 aarch64_sys_ioprio_set = 30,
425 aarch64_sys_ioprio_get = 31,
426 aarch64_sys_flock = 32,
427 aarch64_sys_mknodat = 33,
428 aarch64_sys_mkdirat = 34,
429 aarch64_sys_unlinkat = 35,
430 aarch64_sys_symlinkat = 36,
431 aarch64_sys_linkat = 37,
432 aarch64_sys_renameat = 38,
433 aarch64_sys_umount2 = 39,
434 aarch64_sys_mount = 40,
435 aarch64_sys_pivot_root = 41,
436 aarch64_sys_nfsservctl = 42,
437 aarch64_sys_statfs = 43,
438 aarch64_sys_fstatfs = 44,
439 aarch64_sys_truncate = 45,
440 aarch64_sys_ftruncate = 46,
441 aarch64_sys_fallocate = 47,
442 aarch64_sys_faccessat = 48,
443 aarch64_sys_chdir = 49,
444 aarch64_sys_fchdir = 50,
445 aarch64_sys_chroot = 51,
446 aarch64_sys_fchmod = 52,
447 aarch64_sys_fchmodat = 53,
448 aarch64_sys_fchownat = 54,
449 aarch64_sys_fchown = 55,
450 aarch64_sys_openat = 56,
451 aarch64_sys_close = 57,
452 aarch64_sys_vhangup = 58,
453 aarch64_sys_pipe2 = 59,
454 aarch64_sys_quotactl = 60,
455 aarch64_sys_getdents64 = 61,
456 aarch64_sys_lseek = 62,
457 aarch64_sys_read = 63,
458 aarch64_sys_write = 64,
459 aarch64_sys_readv = 65,
460 aarch64_sys_writev = 66,
461 aarch64_sys_pread64 = 67,
462 aarch64_sys_pwrite64 = 68,
463 aarch64_sys_preadv = 69,
464 aarch64_sys_pwritev = 70,
465 aarch64_sys_sendfile = 71,
466 aarch64_sys_pselect6 = 72,
467 aarch64_sys_ppoll = 73,
468 aarch64_sys_signalfd4 = 74,
469 aarch64_sys_vmsplice = 75,
470 aarch64_sys_splice = 76,
471 aarch64_sys_tee = 77,
472 aarch64_sys_readlinkat = 78,
473 aarch64_sys_newfstatat = 79,
474 aarch64_sys_fstat = 80,
475 aarch64_sys_sync = 81,
476 aarch64_sys_fsync = 82,
477 aarch64_sys_fdatasync = 83,
478 aarch64_sys_sync_file_range2 = 84,
479 aarch64_sys_sync_file_range = 84,
480 aarch64_sys_timerfd_create = 85,
481 aarch64_sys_timerfd_settime = 86,
482 aarch64_sys_timerfd_gettime = 87,
483 aarch64_sys_utimensat = 88,
484 aarch64_sys_acct = 89,
485 aarch64_sys_capget = 90,
486 aarch64_sys_capset = 91,
487 aarch64_sys_personality = 92,
488 aarch64_sys_exit = 93,
489 aarch64_sys_exit_group = 94,
490 aarch64_sys_waitid = 95,
491 aarch64_sys_set_tid_address = 96,
492 aarch64_sys_unshare = 97,
493 aarch64_sys_futex = 98,
494 aarch64_sys_set_robust_list = 99,
495 aarch64_sys_get_robust_list = 100,
496 aarch64_sys_nanosleep = 101,
497 aarch64_sys_getitimer = 102,
498 aarch64_sys_setitimer = 103,
499 aarch64_sys_kexec_load = 104,
500 aarch64_sys_init_module = 105,
501 aarch64_sys_delete_module = 106,
502 aarch64_sys_timer_create = 107,
503 aarch64_sys_timer_gettime = 108,
504 aarch64_sys_timer_getoverrun = 109,
505 aarch64_sys_timer_settime = 110,
506 aarch64_sys_timer_delete = 111,
507 aarch64_sys_clock_settime = 112,
508 aarch64_sys_clock_gettime = 113,
509 aarch64_sys_clock_getres = 114,
510 aarch64_sys_clock_nanosleep = 115,
511 aarch64_sys_syslog = 116,
512 aarch64_sys_ptrace = 117,
513 aarch64_sys_sched_setparam = 118,
514 aarch64_sys_sched_setscheduler = 119,
515 aarch64_sys_sched_getscheduler = 120,
516 aarch64_sys_sched_getparam = 121,
517 aarch64_sys_sched_setaffinity = 122,
518 aarch64_sys_sched_getaffinity = 123,
519 aarch64_sys_sched_yield = 124,
520 aarch64_sys_sched_get_priority_max = 125,
521 aarch64_sys_sched_get_priority_min = 126,
522 aarch64_sys_sched_rr_get_interval = 127,
523 aarch64_sys_kill = 129,
524 aarch64_sys_tkill = 130,
525 aarch64_sys_tgkill = 131,
526 aarch64_sys_sigaltstack = 132,
527 aarch64_sys_rt_sigsuspend = 133,
528 aarch64_sys_rt_sigaction = 134,
529 aarch64_sys_rt_sigprocmask = 135,
530 aarch64_sys_rt_sigpending = 136,
531 aarch64_sys_rt_sigtimedwait = 137,
532 aarch64_sys_rt_sigqueueinfo = 138,
533 aarch64_sys_rt_sigreturn = 139,
534 aarch64_sys_setpriority = 140,
535 aarch64_sys_getpriority = 141,
536 aarch64_sys_reboot = 142,
537 aarch64_sys_setregid = 143,
538 aarch64_sys_setgid = 144,
539 aarch64_sys_setreuid = 145,
540 aarch64_sys_setuid = 146,
541 aarch64_sys_setresuid = 147,
542 aarch64_sys_getresuid = 148,
543 aarch64_sys_setresgid = 149,
544 aarch64_sys_getresgid = 150,
545 aarch64_sys_setfsuid = 151,
546 aarch64_sys_setfsgid = 152,
547 aarch64_sys_times = 153,
548 aarch64_sys_setpgid = 154,
549 aarch64_sys_getpgid = 155,
550 aarch64_sys_getsid = 156,
551 aarch64_sys_setsid = 157,
552 aarch64_sys_getgroups = 158,
553 aarch64_sys_setgroups = 159,
554 aarch64_sys_uname = 160,
555 aarch64_sys_sethostname = 161,
556 aarch64_sys_setdomainname = 162,
557 aarch64_sys_getrlimit = 163,
558 aarch64_sys_setrlimit = 164,
559 aarch64_sys_getrusage = 165,
560 aarch64_sys_umask = 166,
561 aarch64_sys_prctl = 167,
562 aarch64_sys_getcpu = 168,
563 aarch64_sys_gettimeofday = 169,
564 aarch64_sys_settimeofday = 170,
565 aarch64_sys_adjtimex = 171,
566 aarch64_sys_getpid = 172,
567 aarch64_sys_getppid = 173,
568 aarch64_sys_getuid = 174,
569 aarch64_sys_geteuid = 175,
570 aarch64_sys_getgid = 176,
571 aarch64_sys_getegid = 177,
572 aarch64_sys_gettid = 178,
573 aarch64_sys_sysinfo = 179,
574 aarch64_sys_mq_open = 180,
575 aarch64_sys_mq_unlink = 181,
576 aarch64_sys_mq_timedsend = 182,
577 aarch64_sys_mq_timedreceive = 183,
578 aarch64_sys_mq_notify = 184,
579 aarch64_sys_mq_getsetattr = 185,
580 aarch64_sys_msgget = 186,
581 aarch64_sys_msgctl = 187,
582 aarch64_sys_msgrcv = 188,
583 aarch64_sys_msgsnd = 189,
584 aarch64_sys_semget = 190,
585 aarch64_sys_semctl = 191,
586 aarch64_sys_semtimedop = 192,
587 aarch64_sys_semop = 193,
588 aarch64_sys_shmget = 194,
589 aarch64_sys_shmctl = 195,
590 aarch64_sys_shmat = 196,
591 aarch64_sys_shmdt = 197,
592 aarch64_sys_socket = 198,
593 aarch64_sys_socketpair = 199,
594 aarch64_sys_bind = 200,
595 aarch64_sys_listen = 201,
596 aarch64_sys_accept = 202,
597 aarch64_sys_connect = 203,
598 aarch64_sys_getsockname = 204,
599 aarch64_sys_getpeername = 205,
600 aarch64_sys_sendto = 206,
601 aarch64_sys_recvfrom = 207,
602 aarch64_sys_setsockopt = 208,
603 aarch64_sys_getsockopt = 209,
604 aarch64_sys_shutdown = 210,
605 aarch64_sys_sendmsg = 211,
606 aarch64_sys_recvmsg = 212,
607 aarch64_sys_readahead = 213,
608 aarch64_sys_brk = 214,
609 aarch64_sys_munmap = 215,
610 aarch64_sys_mremap = 216,
611 aarch64_sys_add_key = 217,
612 aarch64_sys_request_key = 218,
613 aarch64_sys_keyctl = 219,
614 aarch64_sys_clone = 220,
615 aarch64_sys_execve = 221,
616 aarch64_sys_mmap = 222,
617 aarch64_sys_fadvise64 = 223,
618 aarch64_sys_swapon = 224,
619 aarch64_sys_swapoff = 225,
620 aarch64_sys_mprotect = 226,
621 aarch64_sys_msync = 227,
622 aarch64_sys_mlock = 228,
623 aarch64_sys_munlock = 229,
624 aarch64_sys_mlockall = 230,
625 aarch64_sys_munlockall = 231,
626 aarch64_sys_mincore = 232,
627 aarch64_sys_madvise = 233,
628 aarch64_sys_remap_file_pages = 234,
629 aarch64_sys_mbind = 235,
630 aarch64_sys_get_mempolicy = 236,
631 aarch64_sys_set_mempolicy = 237,
632 aarch64_sys_migrate_pages = 238,
633 aarch64_sys_move_pages = 239,
634 aarch64_sys_rt_tgsigqueueinfo = 240,
635 aarch64_sys_perf_event_open = 241,
636 aarch64_sys_accept4 = 242,
637 aarch64_sys_recvmmsg = 243,
638 aarch64_sys_wait4 = 260,
639 aarch64_sys_prlimit64 = 261,
640 aarch64_sys_fanotify_init = 262,
641 aarch64_sys_fanotify_mark = 263,
642 aarch64_sys_name_to_handle_at = 264,
643 aarch64_sys_open_by_handle_at = 265,
644 aarch64_sys_clock_adjtime = 266,
645 aarch64_sys_syncfs = 267,
646 aarch64_sys_setns = 268,
647 aarch64_sys_sendmmsg = 269,
648 aarch64_sys_process_vm_readv = 270,
649 aarch64_sys_process_vm_writev = 271,
650 aarch64_sys_kcmp = 272,
651 aarch64_sys_finit_module = 273,
652 aarch64_sys_sched_setattr = 274,
653 aarch64_sys_sched_getattr = 275,
656 /* aarch64_canonicalize_syscall maps syscall ids from the native AArch64
657 linux set of syscall ids into a canonical set of syscall ids used by
660 static enum gdb_syscall
661 aarch64_canonicalize_syscall (enum aarch64_syscall syscall_number)
663 #define SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
664 return gdb_sys_##SYSCALL
666 #define UNSUPPORTED_SYSCALL_MAP(SYSCALL) case aarch64_sys_##SYSCALL: \
667 return gdb_sys_no_syscall
669 switch (syscall_number)
671 SYSCALL_MAP (io_setup);
672 SYSCALL_MAP (io_destroy);
673 SYSCALL_MAP (io_submit);
674 SYSCALL_MAP (io_cancel);
675 SYSCALL_MAP (io_getevents);
677 SYSCALL_MAP (setxattr);
678 SYSCALL_MAP (lsetxattr);
679 SYSCALL_MAP (fsetxattr);
680 SYSCALL_MAP (getxattr);
681 SYSCALL_MAP (lgetxattr);
682 SYSCALL_MAP (fgetxattr);
683 SYSCALL_MAP (listxattr);
684 SYSCALL_MAP (llistxattr);
685 SYSCALL_MAP (flistxattr);
686 SYSCALL_MAP (removexattr);
687 SYSCALL_MAP (lremovexattr);
688 SYSCALL_MAP (fremovexattr);
689 SYSCALL_MAP (getcwd);
690 SYSCALL_MAP (lookup_dcookie);
691 SYSCALL_MAP (eventfd2);
692 SYSCALL_MAP (epoll_create1);
693 SYSCALL_MAP (epoll_ctl);
694 SYSCALL_MAP (epoll_pwait);
698 SYSCALL_MAP (inotify_init1);
699 SYSCALL_MAP (inotify_add_watch);
700 SYSCALL_MAP (inotify_rm_watch);
702 SYSCALL_MAP (ioprio_set);
703 SYSCALL_MAP (ioprio_get);
705 SYSCALL_MAP (mknodat);
706 SYSCALL_MAP (mkdirat);
707 SYSCALL_MAP (unlinkat);
708 SYSCALL_MAP (symlinkat);
709 SYSCALL_MAP (linkat);
710 SYSCALL_MAP (renameat);
711 UNSUPPORTED_SYSCALL_MAP (umount2);
713 SYSCALL_MAP (pivot_root);
714 SYSCALL_MAP (nfsservctl);
715 SYSCALL_MAP (statfs);
716 SYSCALL_MAP (truncate);
717 SYSCALL_MAP (ftruncate);
718 SYSCALL_MAP (fallocate);
719 SYSCALL_MAP (faccessat);
720 SYSCALL_MAP (fchdir);
721 SYSCALL_MAP (chroot);
722 SYSCALL_MAP (fchmod);
723 SYSCALL_MAP (fchmodat);
724 SYSCALL_MAP (fchownat);
725 SYSCALL_MAP (fchown);
726 SYSCALL_MAP (openat);
728 SYSCALL_MAP (vhangup);
730 SYSCALL_MAP (quotactl);
731 SYSCALL_MAP (getdents64);
736 SYSCALL_MAP (writev);
737 SYSCALL_MAP (pread64);
738 SYSCALL_MAP (pwrite64);
739 UNSUPPORTED_SYSCALL_MAP (preadv);
740 UNSUPPORTED_SYSCALL_MAP (pwritev);
741 SYSCALL_MAP (sendfile);
742 SYSCALL_MAP (pselect6);
744 UNSUPPORTED_SYSCALL_MAP (signalfd4);
745 SYSCALL_MAP (vmsplice);
746 SYSCALL_MAP (splice);
748 SYSCALL_MAP (readlinkat);
749 SYSCALL_MAP (newfstatat);
754 SYSCALL_MAP (fdatasync);
755 SYSCALL_MAP (sync_file_range);
756 UNSUPPORTED_SYSCALL_MAP (timerfd_create);
757 UNSUPPORTED_SYSCALL_MAP (timerfd_settime);
758 UNSUPPORTED_SYSCALL_MAP (timerfd_gettime);
759 UNSUPPORTED_SYSCALL_MAP (utimensat);
761 SYSCALL_MAP (capget);
762 SYSCALL_MAP (capset);
763 SYSCALL_MAP (personality);
765 SYSCALL_MAP (exit_group);
766 SYSCALL_MAP (waitid);
767 SYSCALL_MAP (set_tid_address);
768 SYSCALL_MAP (unshare);
770 SYSCALL_MAP (set_robust_list);
771 SYSCALL_MAP (get_robust_list);
772 SYSCALL_MAP (nanosleep);
774 SYSCALL_MAP (getitimer);
775 SYSCALL_MAP (setitimer);
776 SYSCALL_MAP (kexec_load);
777 SYSCALL_MAP (init_module);
778 SYSCALL_MAP (delete_module);
779 SYSCALL_MAP (timer_create);
780 SYSCALL_MAP (timer_settime);
781 SYSCALL_MAP (timer_gettime);
782 SYSCALL_MAP (timer_getoverrun);
783 SYSCALL_MAP (timer_delete);
784 SYSCALL_MAP (clock_settime);
785 SYSCALL_MAP (clock_gettime);
786 SYSCALL_MAP (clock_getres);
787 SYSCALL_MAP (clock_nanosleep);
788 SYSCALL_MAP (syslog);
789 SYSCALL_MAP (ptrace);
790 SYSCALL_MAP (sched_setparam);
791 SYSCALL_MAP (sched_setscheduler);
792 SYSCALL_MAP (sched_getscheduler);
793 SYSCALL_MAP (sched_getparam);
794 SYSCALL_MAP (sched_setaffinity);
795 SYSCALL_MAP (sched_getaffinity);
796 SYSCALL_MAP (sched_yield);
797 SYSCALL_MAP (sched_get_priority_max);
798 SYSCALL_MAP (sched_get_priority_min);
799 SYSCALL_MAP (sched_rr_get_interval);
802 SYSCALL_MAP (tgkill);
803 SYSCALL_MAP (sigaltstack);
804 SYSCALL_MAP (rt_sigsuspend);
805 SYSCALL_MAP (rt_sigaction);
806 SYSCALL_MAP (rt_sigprocmask);
807 SYSCALL_MAP (rt_sigpending);
808 SYSCALL_MAP (rt_sigtimedwait);
809 SYSCALL_MAP (rt_sigqueueinfo);
810 SYSCALL_MAP (rt_sigreturn);
811 SYSCALL_MAP (setpriority);
812 SYSCALL_MAP (getpriority);
813 SYSCALL_MAP (reboot);
814 SYSCALL_MAP (setregid);
815 SYSCALL_MAP (setgid);
816 SYSCALL_MAP (setreuid);
817 SYSCALL_MAP (setuid);
818 SYSCALL_MAP (setresuid);
819 SYSCALL_MAP (getresuid);
820 SYSCALL_MAP (setresgid);
821 SYSCALL_MAP (getresgid);
822 SYSCALL_MAP (setfsuid);
823 SYSCALL_MAP (setfsgid);
825 SYSCALL_MAP (setpgid);
826 SYSCALL_MAP (getpgid);
827 SYSCALL_MAP (getsid);
828 SYSCALL_MAP (setsid);
829 SYSCALL_MAP (getgroups);
830 SYSCALL_MAP (setgroups);
832 SYSCALL_MAP (sethostname);
833 SYSCALL_MAP (setdomainname);
834 SYSCALL_MAP (getrlimit);
835 SYSCALL_MAP (setrlimit);
836 SYSCALL_MAP (getrusage);
839 SYSCALL_MAP (getcpu);
840 SYSCALL_MAP (gettimeofday);
841 SYSCALL_MAP (settimeofday);
842 SYSCALL_MAP (adjtimex);
843 SYSCALL_MAP (getpid);
844 SYSCALL_MAP (getppid);
845 SYSCALL_MAP (getuid);
846 SYSCALL_MAP (geteuid);
847 SYSCALL_MAP (getgid);
848 SYSCALL_MAP (getegid);
849 SYSCALL_MAP (gettid);
850 SYSCALL_MAP (sysinfo);
851 SYSCALL_MAP (mq_open);
852 SYSCALL_MAP (mq_unlink);
853 SYSCALL_MAP (mq_timedsend);
854 SYSCALL_MAP (mq_timedreceive);
855 SYSCALL_MAP (mq_notify);
856 SYSCALL_MAP (mq_getsetattr);
857 SYSCALL_MAP (msgget);
858 SYSCALL_MAP (msgctl);
859 SYSCALL_MAP (msgrcv);
860 SYSCALL_MAP (msgsnd);
861 SYSCALL_MAP (semget);
862 SYSCALL_MAP (semctl);
863 SYSCALL_MAP (semtimedop);
865 SYSCALL_MAP (shmget);
866 SYSCALL_MAP (shmctl);
869 SYSCALL_MAP (socket);
870 SYSCALL_MAP (socketpair);
872 SYSCALL_MAP (listen);
873 SYSCALL_MAP (accept);
874 SYSCALL_MAP (connect);
875 SYSCALL_MAP (getsockname);
876 SYSCALL_MAP (getpeername);
877 SYSCALL_MAP (sendto);
878 SYSCALL_MAP (recvfrom);
879 SYSCALL_MAP (setsockopt);
880 SYSCALL_MAP (getsockopt);
881 SYSCALL_MAP (shutdown);
882 SYSCALL_MAP (sendmsg);
883 SYSCALL_MAP (recvmsg);
884 SYSCALL_MAP (readahead);
886 SYSCALL_MAP (munmap);
887 SYSCALL_MAP (mremap);
888 SYSCALL_MAP (add_key);
889 SYSCALL_MAP (request_key);
890 SYSCALL_MAP (keyctl);
892 SYSCALL_MAP (execve);
894 case aarch64_sys_mmap:
895 return gdb_sys_mmap2;
897 SYSCALL_MAP (fadvise64);
898 SYSCALL_MAP (swapon);
899 SYSCALL_MAP (swapoff);
900 SYSCALL_MAP (mprotect);
903 SYSCALL_MAP (munlock);
904 SYSCALL_MAP (mlockall);
905 SYSCALL_MAP (munlockall);
906 SYSCALL_MAP (mincore);
907 SYSCALL_MAP (madvise);
908 SYSCALL_MAP (remap_file_pages);
910 SYSCALL_MAP (get_mempolicy);
911 SYSCALL_MAP (set_mempolicy);
912 SYSCALL_MAP (migrate_pages);
913 SYSCALL_MAP (move_pages);
914 UNSUPPORTED_SYSCALL_MAP (rt_tgsigqueueinfo);
915 UNSUPPORTED_SYSCALL_MAP (perf_event_open);
916 UNSUPPORTED_SYSCALL_MAP (accept4);
917 UNSUPPORTED_SYSCALL_MAP (recvmmsg);
921 UNSUPPORTED_SYSCALL_MAP (prlimit64);
922 UNSUPPORTED_SYSCALL_MAP (fanotify_init);
923 UNSUPPORTED_SYSCALL_MAP (fanotify_mark);
924 UNSUPPORTED_SYSCALL_MAP (name_to_handle_at);
925 UNSUPPORTED_SYSCALL_MAP (open_by_handle_at);
926 UNSUPPORTED_SYSCALL_MAP (clock_adjtime);
927 UNSUPPORTED_SYSCALL_MAP (syncfs);
928 UNSUPPORTED_SYSCALL_MAP (setns);
929 UNSUPPORTED_SYSCALL_MAP (sendmmsg);
930 UNSUPPORTED_SYSCALL_MAP (process_vm_readv);
931 UNSUPPORTED_SYSCALL_MAP (process_vm_writev);
932 UNSUPPORTED_SYSCALL_MAP (kcmp);
933 UNSUPPORTED_SYSCALL_MAP (finit_module);
934 UNSUPPORTED_SYSCALL_MAP (sched_setattr);
935 UNSUPPORTED_SYSCALL_MAP (sched_getattr);
937 return gdb_sys_no_syscall;
941 /* Record all registers but PC register for process-record. */
944 aarch64_all_but_pc_registers_record (struct regcache *regcache)
948 for (i = AARCH64_X0_REGNUM; i < AARCH64_PC_REGNUM; i++)
949 if (record_full_arch_list_add_reg (regcache, i))
952 if (record_full_arch_list_add_reg (regcache, AARCH64_CPSR_REGNUM))
958 /* Handler for aarch64 system call instruction recording. */
961 aarch64_linux_syscall_record (struct regcache *regcache,
962 unsigned long svc_number)
965 enum gdb_syscall syscall_gdb;
968 aarch64_canonicalize_syscall ((enum aarch64_syscall) svc_number);
972 printf_unfiltered (_("Process record and replay target doesn't "
973 "support syscall number %s\n"),
974 plongest (svc_number));
978 if (syscall_gdb == gdb_sys_sigreturn
979 || syscall_gdb == gdb_sys_rt_sigreturn)
981 if (aarch64_all_but_pc_registers_record (regcache))
986 ret = record_linux_system_call (syscall_gdb, regcache,
987 &aarch64_linux_record_tdep);
991 /* Record the return value of the system call. */
992 if (record_full_arch_list_add_reg (regcache, AARCH64_X0_REGNUM))
995 if (record_full_arch_list_add_reg (regcache, AARCH64_LR_REGNUM))
998 if (record_full_arch_list_add_reg (regcache, AARCH64_CPSR_REGNUM))
1005 aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
1007 static const char *const stap_integer_prefixes[] = { "#", "", NULL };
1008 static const char *const stap_register_prefixes[] = { "", NULL };
1009 static const char *const stap_register_indirection_prefixes[] = { "[",
1011 static const char *const stap_register_indirection_suffixes[] = { "]",
1013 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1015 tdep->lowest_pc = 0x8000;
1017 linux_init_abi (info, gdbarch);
1019 set_solib_svr4_fetch_link_map_offsets (gdbarch,
1020 svr4_lp64_fetch_link_map_offsets);
1022 /* Enable TLS support. */
1023 set_gdbarch_fetch_tls_load_module_address (gdbarch,
1024 svr4_fetch_objfile_link_map);
1026 /* Shared library handling. */
1027 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
1028 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
1030 tramp_frame_prepend_unwinder (gdbarch, &aarch64_linux_rt_sigframe);
1032 /* Enable longjmp. */
1035 set_gdbarch_iterate_over_regset_sections
1036 (gdbarch, aarch64_linux_iterate_over_regset_sections);
1037 set_gdbarch_core_read_description
1038 (gdbarch, aarch64_linux_core_read_description);
1040 /* SystemTap related. */
1041 set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);
1042 set_gdbarch_stap_register_prefixes (gdbarch, stap_register_prefixes);
1043 set_gdbarch_stap_register_indirection_prefixes (gdbarch,
1044 stap_register_indirection_prefixes);
1045 set_gdbarch_stap_register_indirection_suffixes (gdbarch,
1046 stap_register_indirection_suffixes);
1047 set_gdbarch_stap_is_single_operand (gdbarch, aarch64_stap_is_single_operand);
1048 set_gdbarch_stap_parse_special_token (gdbarch,
1049 aarch64_stap_parse_special_token);
1051 /* Reversible debugging, process record. */
1052 set_gdbarch_process_record (gdbarch, aarch64_process_record);
1053 /* Syscall record. */
1054 tdep->aarch64_syscall_record = aarch64_linux_syscall_record;
1056 /* Initialize the aarch64_linux_record_tdep. */
1057 /* These values are the size of the type that will be used in a system
1058 call. They are obtained from Linux Kernel source. */
1059 aarch64_linux_record_tdep.size_pointer
1060 = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
1061 aarch64_linux_record_tdep.size__old_kernel_stat = 32;
1062 aarch64_linux_record_tdep.size_tms = 32;
1063 aarch64_linux_record_tdep.size_loff_t = 8;
1064 aarch64_linux_record_tdep.size_flock = 32;
1065 aarch64_linux_record_tdep.size_oldold_utsname = 45;
1066 aarch64_linux_record_tdep.size_ustat = 32;
1067 aarch64_linux_record_tdep.size_old_sigaction = 32;
1068 aarch64_linux_record_tdep.size_old_sigset_t = 8;
1069 aarch64_linux_record_tdep.size_rlimit = 16;
1070 aarch64_linux_record_tdep.size_rusage = 144;
1071 aarch64_linux_record_tdep.size_timeval = 16;
1072 aarch64_linux_record_tdep.size_timezone = 8;
1073 aarch64_linux_record_tdep.size_old_gid_t = 2;
1074 aarch64_linux_record_tdep.size_old_uid_t = 2;
1075 aarch64_linux_record_tdep.size_fd_set = 128;
1076 aarch64_linux_record_tdep.size_old_dirent = 280;
1077 aarch64_linux_record_tdep.size_statfs = 120;
1078 aarch64_linux_record_tdep.size_statfs64 = 120;
1079 aarch64_linux_record_tdep.size_sockaddr = 16;
1080 aarch64_linux_record_tdep.size_int
1081 = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
1082 aarch64_linux_record_tdep.size_long
1083 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1084 aarch64_linux_record_tdep.size_ulong
1085 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1086 aarch64_linux_record_tdep.size_msghdr = 56;
1087 aarch64_linux_record_tdep.size_itimerval = 32;
1088 aarch64_linux_record_tdep.size_stat = 144;
1089 aarch64_linux_record_tdep.size_old_utsname = 325;
1090 aarch64_linux_record_tdep.size_sysinfo = 112;
1091 aarch64_linux_record_tdep.size_msqid_ds = 120;
1092 aarch64_linux_record_tdep.size_shmid_ds = 112;
1093 aarch64_linux_record_tdep.size_new_utsname = 390;
1094 aarch64_linux_record_tdep.size_timex = 208;
1095 aarch64_linux_record_tdep.size_mem_dqinfo = 24;
1096 aarch64_linux_record_tdep.size_if_dqblk = 72;
1097 aarch64_linux_record_tdep.size_fs_quota_stat = 80;
1098 aarch64_linux_record_tdep.size_timespec = 16;
1099 aarch64_linux_record_tdep.size_pollfd = 8;
1100 aarch64_linux_record_tdep.size_NFS_FHSIZE = 32;
1101 aarch64_linux_record_tdep.size_knfsd_fh = 132;
1102 aarch64_linux_record_tdep.size_TASK_COMM_LEN = 16;
1103 aarch64_linux_record_tdep.size_sigaction = 32;
1104 aarch64_linux_record_tdep.size_sigset_t = 8;
1105 aarch64_linux_record_tdep.size_siginfo_t = 128;
1106 aarch64_linux_record_tdep.size_cap_user_data_t = 8;
1107 aarch64_linux_record_tdep.size_stack_t = 24;
1108 aarch64_linux_record_tdep.size_off_t = 8;
1109 aarch64_linux_record_tdep.size_stat64 = 144;
1110 aarch64_linux_record_tdep.size_gid_t = 4;
1111 aarch64_linux_record_tdep.size_uid_t = 4;
1112 aarch64_linux_record_tdep.size_PAGE_SIZE = 4096;
1113 aarch64_linux_record_tdep.size_flock64 = 32;
1114 aarch64_linux_record_tdep.size_user_desc = 16;
1115 aarch64_linux_record_tdep.size_io_event = 32;
1116 aarch64_linux_record_tdep.size_iocb = 64;
1117 aarch64_linux_record_tdep.size_epoll_event = 12;
1118 aarch64_linux_record_tdep.size_itimerspec = 32;
1119 aarch64_linux_record_tdep.size_mq_attr = 64;
1120 aarch64_linux_record_tdep.size_termios = 36;
1121 aarch64_linux_record_tdep.size_termios2 = 44;
1122 aarch64_linux_record_tdep.size_pid_t = 4;
1123 aarch64_linux_record_tdep.size_winsize = 8;
1124 aarch64_linux_record_tdep.size_serial_struct = 72;
1125 aarch64_linux_record_tdep.size_serial_icounter_struct = 80;
1126 aarch64_linux_record_tdep.size_hayes_esp_config = 12;
1127 aarch64_linux_record_tdep.size_size_t = 8;
1128 aarch64_linux_record_tdep.size_iovec = 16;
1129 aarch64_linux_record_tdep.size_time_t = 8;
1131 /* These values are the second argument of system call "sys_ioctl".
1132 They are obtained from Linux Kernel source. */
1133 aarch64_linux_record_tdep.ioctl_TCGETS = 0x5401;
1134 aarch64_linux_record_tdep.ioctl_TCSETS = 0x5402;
1135 aarch64_linux_record_tdep.ioctl_TCSETSW = 0x5403;
1136 aarch64_linux_record_tdep.ioctl_TCSETSF = 0x5404;
1137 aarch64_linux_record_tdep.ioctl_TCGETA = 0x5405;
1138 aarch64_linux_record_tdep.ioctl_TCSETA = 0x5406;
1139 aarch64_linux_record_tdep.ioctl_TCSETAW = 0x5407;
1140 aarch64_linux_record_tdep.ioctl_TCSETAF = 0x5408;
1141 aarch64_linux_record_tdep.ioctl_TCSBRK = 0x5409;
1142 aarch64_linux_record_tdep.ioctl_TCXONC = 0x540a;
1143 aarch64_linux_record_tdep.ioctl_TCFLSH = 0x540b;
1144 aarch64_linux_record_tdep.ioctl_TIOCEXCL = 0x540c;
1145 aarch64_linux_record_tdep.ioctl_TIOCNXCL = 0x540d;
1146 aarch64_linux_record_tdep.ioctl_TIOCSCTTY = 0x540e;
1147 aarch64_linux_record_tdep.ioctl_TIOCGPGRP = 0x540f;
1148 aarch64_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
1149 aarch64_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
1150 aarch64_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
1151 aarch64_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
1152 aarch64_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
1153 aarch64_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
1154 aarch64_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
1155 aarch64_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
1156 aarch64_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
1157 aarch64_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
1158 aarch64_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541a;
1159 aarch64_linux_record_tdep.ioctl_FIONREAD = 0x541b;
1160 aarch64_linux_record_tdep.ioctl_TIOCINQ = 0x541b;
1161 aarch64_linux_record_tdep.ioctl_TIOCLINUX = 0x541c;
1162 aarch64_linux_record_tdep.ioctl_TIOCCONS = 0x541d;
1163 aarch64_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541e;
1164 aarch64_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541f;
1165 aarch64_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
1166 aarch64_linux_record_tdep.ioctl_FIONBIO = 0x5421;
1167 aarch64_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
1168 aarch64_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
1169 aarch64_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
1170 aarch64_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
1171 aarch64_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
1172 aarch64_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
1173 aarch64_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
1174 aarch64_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
1175 aarch64_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
1176 aarch64_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
1177 aarch64_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
1178 aarch64_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
1179 aarch64_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
1180 aarch64_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
1181 aarch64_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
1182 aarch64_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
1183 aarch64_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
1184 aarch64_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
1185 aarch64_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
1186 aarch64_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
1187 aarch64_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
1188 aarch64_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
1189 aarch64_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
1190 aarch64_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
1191 aarch64_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545a;
1192 aarch64_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545b;
1193 aarch64_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545c;
1194 aarch64_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545d;
1195 aarch64_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545e;
1196 aarch64_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545f;
1197 aarch64_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
1199 /* These values are the second argument of system call "sys_fcntl"
1200 and "sys_fcntl64". They are obtained from Linux Kernel source. */
1201 aarch64_linux_record_tdep.fcntl_F_GETLK = 5;
1202 aarch64_linux_record_tdep.fcntl_F_GETLK64 = 12;
1203 aarch64_linux_record_tdep.fcntl_F_SETLK64 = 13;
1204 aarch64_linux_record_tdep.fcntl_F_SETLKW64 = 14;
1206 /* The AArch64 syscall calling convention: reg x0-x6 for arguments,
1207 reg x8 for syscall number and return value in reg x0. */
1208 aarch64_linux_record_tdep.arg1 = AARCH64_X0_REGNUM + 0;
1209 aarch64_linux_record_tdep.arg2 = AARCH64_X0_REGNUM + 1;
1210 aarch64_linux_record_tdep.arg3 = AARCH64_X0_REGNUM + 2;
1211 aarch64_linux_record_tdep.arg4 = AARCH64_X0_REGNUM + 3;
1212 aarch64_linux_record_tdep.arg5 = AARCH64_X0_REGNUM + 4;
1213 aarch64_linux_record_tdep.arg6 = AARCH64_X0_REGNUM + 5;
1214 aarch64_linux_record_tdep.arg7 = AARCH64_X0_REGNUM + 6;
1216 /* `catch syscall' */
1217 set_xml_syscall_file_name (gdbarch, "syscalls/aarch64-linux.xml");
1218 set_gdbarch_get_syscall_number (gdbarch, aarch64_linux_get_syscall_number);
1220 /* Displaced stepping. */
1221 set_gdbarch_max_insn_length (gdbarch, 4 * DISPLACED_MODIFIED_INSNS);
1222 set_gdbarch_displaced_step_copy_insn (gdbarch,
1223 aarch64_displaced_step_copy_insn);
1224 set_gdbarch_displaced_step_fixup (gdbarch, aarch64_displaced_step_fixup);
1225 set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
1226 set_gdbarch_displaced_step_hw_singlestep (gdbarch,
1227 aarch64_displaced_step_hw_singlestep);
1231 _initialize_aarch64_linux_tdep (void)
1233 gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_LINUX,
1234 aarch64_linux_init_abi);