7afa01248029af0abbc0699f072529d422dacfba
[deliverable/binutils-gdb.git] / gdb / amd64-linux-tdep.c
1 /* Target-dependent code for GNU/Linux x86-64.
2
3 Copyright (C) 2001-2017 Free Software Foundation, Inc.
4 Contributed by Jiri Smid, SuSE Labs.
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 #include "arch-utils.h"
23 #include "frame.h"
24 #include "gdbcore.h"
25 #include "regcache.h"
26 #include "osabi.h"
27 #include "symtab.h"
28 #include "gdbtypes.h"
29 #include "reggroups.h"
30 #include "regset.h"
31 #include "parser-defs.h"
32 #include "user-regs.h"
33 #include "amd64-linux-tdep.h"
34 #include "i386-linux-tdep.h"
35 #include "linux-tdep.h"
36 #include "x86-xstate.h"
37
38 #include "amd64-tdep.h"
39 #include "solib-svr4.h"
40 #include "xml-syscall.h"
41 #include "glibc-tdep.h"
42 #include "target-descriptions.h"
43
44 #include "features/i386/64bit-avx.c"
45 #include "features/i386/64bit-avx512.c"
46 #include "features/i386/64bit-core.c"
47 #include "features/i386/64bit-linux.c"
48 #include "features/i386/64bit-mpx.c"
49 #include "features/i386/64bit-pkeys.c"
50 #include "features/i386/64bit-segments.c"
51 #include "features/i386/64bit-sse.c"
52
53 #include "features/i386/x32-core.c"
54
55 /* The syscall's XML filename for i386. */
56 #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml"
57
58 #include "record-full.h"
59 #include "linux-record.h"
60
61 /* Mapping between the general-purpose registers in `struct user'
62 format and GDB's register cache layout. */
63
64 /* From <sys/reg.h>. */
65 int amd64_linux_gregset_reg_offset[] =
66 {
67 10 * 8, /* %rax */
68 5 * 8, /* %rbx */
69 11 * 8, /* %rcx */
70 12 * 8, /* %rdx */
71 13 * 8, /* %rsi */
72 14 * 8, /* %rdi */
73 4 * 8, /* %rbp */
74 19 * 8, /* %rsp */
75 9 * 8, /* %r8 ... */
76 8 * 8,
77 7 * 8,
78 6 * 8,
79 3 * 8,
80 2 * 8,
81 1 * 8,
82 0 * 8, /* ... %r15 */
83 16 * 8, /* %rip */
84 18 * 8, /* %eflags */
85 17 * 8, /* %cs */
86 20 * 8, /* %ss */
87 23 * 8, /* %ds */
88 24 * 8, /* %es */
89 25 * 8, /* %fs */
90 26 * 8, /* %gs */
91 -1, -1, -1, -1, -1, -1, -1, -1,
92 -1, -1, -1, -1, -1, -1, -1, -1,
93 -1, -1, -1, -1, -1, -1, -1, -1,
94 -1, -1, -1, -1, -1, -1, -1, -1, -1,
95 -1, -1, -1, -1, -1, -1, -1, -1,
96 -1, -1, -1, -1, -1, -1, -1, -1,
97 -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
98 -1, -1, /* MPX registers BNDCFGU and BNDSTATUS. */
99 -1, -1, -1, -1, -1, -1, -1, -1, /* xmm16 ... xmm31 (AVX512) */
100 -1, -1, -1, -1, -1, -1, -1, -1,
101 -1, -1, -1, -1, -1, -1, -1, -1, /* ymm16 ... ymm31 (AVX512) */
102 -1, -1, -1, -1, -1, -1, -1, -1,
103 -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
104 -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm31 (AVX512) */
105 -1, -1, -1, -1, -1, -1, -1, -1,
106 -1, -1, -1, -1, -1, -1, -1, -1,
107 -1, -1, -1, -1, -1, -1, -1, -1,
108 -1, /* PKEYS register pkru */
109
110 /* End of hardware registers */
111 21 * 8, 22 * 8, /* fs_base and gs_base. */
112 15 * 8 /* "orig_rax" */
113 };
114 \f
115
116 /* Support for signal handlers. */
117
118 #define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
119 #define LINUX_SIGTRAMP_OFFSET0 0
120 #define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
121 #define LINUX_SIGTRAMP_OFFSET1 7
122
123 static const gdb_byte amd64_linux_sigtramp_code[] =
124 {
125 /* mov $__NR_rt_sigreturn, %rax */
126 LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
127 /* syscall */
128 LINUX_SIGTRAMP_INSN1, 0x05
129 };
130
131 static const gdb_byte amd64_x32_linux_sigtramp_code[] =
132 {
133 /* mov $__NR_rt_sigreturn, %rax. */
134 LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x01, 0x02, 0x00, 0x40,
135 /* syscall */
136 LINUX_SIGTRAMP_INSN1, 0x05
137 };
138
139 #define LINUX_SIGTRAMP_LEN (sizeof amd64_linux_sigtramp_code)
140
141 /* If PC is in a sigtramp routine, return the address of the start of
142 the routine. Otherwise, return 0. */
143
144 static CORE_ADDR
145 amd64_linux_sigtramp_start (struct frame_info *this_frame)
146 {
147 struct gdbarch *gdbarch;
148 const gdb_byte *sigtramp_code;
149 CORE_ADDR pc = get_frame_pc (this_frame);
150 gdb_byte buf[LINUX_SIGTRAMP_LEN];
151
152 /* We only recognize a signal trampoline if PC is at the start of
153 one of the two instructions. We optimize for finding the PC at
154 the start, as will be the case when the trampoline is not the
155 first frame on the stack. We assume that in the case where the
156 PC is not at the start of the instruction sequence, there will be
157 a few trailing readable bytes on the stack. */
158
159 if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf))
160 return 0;
161
162 if (buf[0] != LINUX_SIGTRAMP_INSN0)
163 {
164 if (buf[0] != LINUX_SIGTRAMP_INSN1)
165 return 0;
166
167 pc -= LINUX_SIGTRAMP_OFFSET1;
168 if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf))
169 return 0;
170 }
171
172 gdbarch = get_frame_arch (this_frame);
173 if (gdbarch_ptr_bit (gdbarch) == 32)
174 sigtramp_code = amd64_x32_linux_sigtramp_code;
175 else
176 sigtramp_code = amd64_linux_sigtramp_code;
177 if (memcmp (buf, sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
178 return 0;
179
180 return pc;
181 }
182
183 /* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
184 routine. */
185
186 static int
187 amd64_linux_sigtramp_p (struct frame_info *this_frame)
188 {
189 CORE_ADDR pc = get_frame_pc (this_frame);
190 const char *name;
191
192 find_pc_partial_function (pc, &name, NULL, NULL);
193
194 /* If we have NAME, we can optimize the search. The trampoline is
195 named __restore_rt. However, it isn't dynamically exported from
196 the shared C library, so the trampoline may appear to be part of
197 the preceding function. This should always be sigaction,
198 __sigaction, or __libc_sigaction (all aliases to the same
199 function). */
200 if (name == NULL || strstr (name, "sigaction") != NULL)
201 return (amd64_linux_sigtramp_start (this_frame) != 0);
202
203 return (strcmp ("__restore_rt", name) == 0);
204 }
205
206 /* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
207 #define AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
208
209 /* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
210 address of the associated sigcontext structure. */
211
212 static CORE_ADDR
213 amd64_linux_sigcontext_addr (struct frame_info *this_frame)
214 {
215 struct gdbarch *gdbarch = get_frame_arch (this_frame);
216 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
217 CORE_ADDR sp;
218 gdb_byte buf[8];
219
220 get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
221 sp = extract_unsigned_integer (buf, 8, byte_order);
222
223 /* The sigcontext structure is part of the user context. A pointer
224 to the user context is passed as the third argument to the signal
225 handler, i.e. in %rdx. Unfortunately %rdx isn't preserved across
226 function calls so we can't use it. Fortunately the user context
227 is part of the signal frame and the unwound %rsp directly points
228 at it. */
229 return sp + AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
230 }
231 \f
232
233 static LONGEST
234 amd64_linux_get_syscall_number (struct gdbarch *gdbarch,
235 ptid_t ptid)
236 {
237 struct regcache *regcache = get_thread_regcache (ptid);
238 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
239 /* The content of a register. */
240 gdb_byte buf[8];
241 /* The result. */
242 LONGEST ret;
243
244 /* Getting the system call number from the register.
245 When dealing with x86_64 architecture, this information
246 is stored at %rax register. */
247 regcache_cooked_read (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, buf);
248
249 ret = extract_signed_integer (buf, 8, byte_order);
250
251 return ret;
252 }
253
254
255 /* From <asm/sigcontext.h>. */
256 static int amd64_linux_sc_reg_offset[] =
257 {
258 13 * 8, /* %rax */
259 11 * 8, /* %rbx */
260 14 * 8, /* %rcx */
261 12 * 8, /* %rdx */
262 9 * 8, /* %rsi */
263 8 * 8, /* %rdi */
264 10 * 8, /* %rbp */
265 15 * 8, /* %rsp */
266 0 * 8, /* %r8 */
267 1 * 8, /* %r9 */
268 2 * 8, /* %r10 */
269 3 * 8, /* %r11 */
270 4 * 8, /* %r12 */
271 5 * 8, /* %r13 */
272 6 * 8, /* %r14 */
273 7 * 8, /* %r15 */
274 16 * 8, /* %rip */
275 17 * 8, /* %eflags */
276
277 /* FIXME: kettenis/2002030531: The registers %cs, %fs and %gs are
278 available in `struct sigcontext'. However, they only occupy two
279 bytes instead of four, which makes using them here rather
280 difficult. Leave them out for now. */
281 -1, /* %cs */
282 -1, /* %ss */
283 -1, /* %ds */
284 -1, /* %es */
285 -1, /* %fs */
286 -1 /* %gs */
287 };
288
289 static int
290 amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
291 struct reggroup *group)
292 {
293 if (regnum == AMD64_LINUX_ORIG_RAX_REGNUM
294 || regnum == AMD64_FSBASE_REGNUM
295 || regnum == AMD64_GSBASE_REGNUM)
296 return (group == system_reggroup
297 || group == save_reggroup
298 || group == restore_reggroup);
299 return i386_register_reggroup_p (gdbarch, regnum, group);
300 }
301
302 /* Set the program counter for process PTID to PC. */
303
304 static void
305 amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
306 {
307 regcache_cooked_write_unsigned (regcache, AMD64_RIP_REGNUM, pc);
308
309 /* We must be careful with modifying the program counter. If we
310 just interrupted a system call, the kernel might try to restart
311 it when we resume the inferior. On restarting the system call,
312 the kernel will try backing up the program counter even though it
313 no longer points at the system call. This typically results in a
314 SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
315 "orig_rax" pseudo-register.
316
317 Note that "orig_rax" is saved when setting up a dummy call frame.
318 This means that it is properly restored when that frame is
319 popped, and that the interrupted system call will be restarted
320 when we resume the inferior on return from a function call from
321 within GDB. In all other cases the system call will not be
322 restarted. */
323 regcache_cooked_write_unsigned (regcache, AMD64_LINUX_ORIG_RAX_REGNUM, -1);
324 }
325
326 /* Record all registers but IP register for process-record. */
327
328 static int
329 amd64_all_but_ip_registers_record (struct regcache *regcache)
330 {
331 if (record_full_arch_list_add_reg (regcache, AMD64_RAX_REGNUM))
332 return -1;
333 if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
334 return -1;
335 if (record_full_arch_list_add_reg (regcache, AMD64_RDX_REGNUM))
336 return -1;
337 if (record_full_arch_list_add_reg (regcache, AMD64_RBX_REGNUM))
338 return -1;
339 if (record_full_arch_list_add_reg (regcache, AMD64_RSP_REGNUM))
340 return -1;
341 if (record_full_arch_list_add_reg (regcache, AMD64_RBP_REGNUM))
342 return -1;
343 if (record_full_arch_list_add_reg (regcache, AMD64_RSI_REGNUM))
344 return -1;
345 if (record_full_arch_list_add_reg (regcache, AMD64_RDI_REGNUM))
346 return -1;
347 if (record_full_arch_list_add_reg (regcache, AMD64_R8_REGNUM))
348 return -1;
349 if (record_full_arch_list_add_reg (regcache, AMD64_R9_REGNUM))
350 return -1;
351 if (record_full_arch_list_add_reg (regcache, AMD64_R10_REGNUM))
352 return -1;
353 if (record_full_arch_list_add_reg (regcache, AMD64_R11_REGNUM))
354 return -1;
355 if (record_full_arch_list_add_reg (regcache, AMD64_R12_REGNUM))
356 return -1;
357 if (record_full_arch_list_add_reg (regcache, AMD64_R13_REGNUM))
358 return -1;
359 if (record_full_arch_list_add_reg (regcache, AMD64_R14_REGNUM))
360 return -1;
361 if (record_full_arch_list_add_reg (regcache, AMD64_R15_REGNUM))
362 return -1;
363 if (record_full_arch_list_add_reg (regcache, AMD64_EFLAGS_REGNUM))
364 return -1;
365
366 return 0;
367 }
368
369 /* amd64_canonicalize_syscall maps from the native amd64 Linux set
370 of syscall ids into a canonical set of syscall ids used by
371 process record. */
372
373 static enum gdb_syscall
374 amd64_canonicalize_syscall (enum amd64_syscall syscall_number)
375 {
376 switch (syscall_number) {
377 case amd64_sys_read:
378 case amd64_x32_sys_read:
379 return gdb_sys_read;
380
381 case amd64_sys_write:
382 case amd64_x32_sys_write:
383 return gdb_sys_write;
384
385 case amd64_sys_open:
386 case amd64_x32_sys_open:
387 return gdb_sys_open;
388
389 case amd64_sys_close:
390 case amd64_x32_sys_close:
391 return gdb_sys_close;
392
393 case amd64_sys_newstat:
394 case amd64_x32_sys_newstat:
395 return gdb_sys_newstat;
396
397 case amd64_sys_newfstat:
398 case amd64_x32_sys_newfstat:
399 return gdb_sys_newfstat;
400
401 case amd64_sys_newlstat:
402 case amd64_x32_sys_newlstat:
403 return gdb_sys_newlstat;
404
405 case amd64_sys_poll:
406 case amd64_x32_sys_poll:
407 return gdb_sys_poll;
408
409 case amd64_sys_lseek:
410 case amd64_x32_sys_lseek:
411 return gdb_sys_lseek;
412
413 case amd64_sys_mmap:
414 case amd64_x32_sys_mmap:
415 return gdb_sys_mmap2;
416
417 case amd64_sys_mprotect:
418 case amd64_x32_sys_mprotect:
419 return gdb_sys_mprotect;
420
421 case amd64_sys_munmap:
422 case amd64_x32_sys_munmap:
423 return gdb_sys_munmap;
424
425 case amd64_sys_brk:
426 case amd64_x32_sys_brk:
427 return gdb_sys_brk;
428
429 case amd64_sys_rt_sigaction:
430 case amd64_x32_sys_rt_sigaction:
431 return gdb_sys_rt_sigaction;
432
433 case amd64_sys_rt_sigprocmask:
434 case amd64_x32_sys_rt_sigprocmask:
435 return gdb_sys_rt_sigprocmask;
436
437 case amd64_sys_rt_sigreturn:
438 case amd64_x32_sys_rt_sigreturn:
439 return gdb_sys_rt_sigreturn;
440
441 case amd64_sys_ioctl:
442 case amd64_x32_sys_ioctl:
443 return gdb_sys_ioctl;
444
445 case amd64_sys_pread64:
446 case amd64_x32_sys_pread64:
447 return gdb_sys_pread64;
448
449 case amd64_sys_pwrite64:
450 case amd64_x32_sys_pwrite64:
451 return gdb_sys_pwrite64;
452
453 case amd64_sys_readv:
454 case amd64_x32_sys_readv:
455 return gdb_sys_readv;
456
457 case amd64_sys_writev:
458 case amd64_x32_sys_writev:
459 return gdb_sys_writev;
460
461 case amd64_sys_access:
462 case amd64_x32_sys_access:
463 return gdb_sys_access;
464
465 case amd64_sys_pipe:
466 case amd64_x32_sys_pipe:
467 return gdb_sys_pipe;
468
469 case amd64_sys_select:
470 case amd64_x32_sys_select:
471 return gdb_sys_select;
472
473 case amd64_sys_sched_yield:
474 case amd64_x32_sys_sched_yield:
475 return gdb_sys_sched_yield;
476
477 case amd64_sys_mremap:
478 case amd64_x32_sys_mremap:
479 return gdb_sys_mremap;
480
481 case amd64_sys_msync:
482 case amd64_x32_sys_msync:
483 return gdb_sys_msync;
484
485 case amd64_sys_mincore:
486 case amd64_x32_sys_mincore:
487 return gdb_sys_mincore;
488
489 case amd64_sys_madvise:
490 case amd64_x32_sys_madvise:
491 return gdb_sys_madvise;
492
493 case amd64_sys_shmget:
494 case amd64_x32_sys_shmget:
495 return gdb_sys_shmget;
496
497 case amd64_sys_shmat:
498 case amd64_x32_sys_shmat:
499 return gdb_sys_shmat;
500
501 case amd64_sys_shmctl:
502 case amd64_x32_sys_shmctl:
503 return gdb_sys_shmctl;
504
505 case amd64_sys_dup:
506 case amd64_x32_sys_dup:
507 return gdb_sys_dup;
508
509 case amd64_sys_dup2:
510 case amd64_x32_sys_dup2:
511 return gdb_sys_dup2;
512
513 case amd64_sys_pause:
514 case amd64_x32_sys_pause:
515 return gdb_sys_pause;
516
517 case amd64_sys_nanosleep:
518 case amd64_x32_sys_nanosleep:
519 return gdb_sys_nanosleep;
520
521 case amd64_sys_getitimer:
522 case amd64_x32_sys_getitimer:
523 return gdb_sys_getitimer;
524
525 case amd64_sys_alarm:
526 case amd64_x32_sys_alarm:
527 return gdb_sys_alarm;
528
529 case amd64_sys_setitimer:
530 case amd64_x32_sys_setitimer:
531 return gdb_sys_setitimer;
532
533 case amd64_sys_getpid:
534 case amd64_x32_sys_getpid:
535 return gdb_sys_getpid;
536
537 case amd64_sys_sendfile64:
538 case amd64_x32_sys_sendfile64:
539 return gdb_sys_sendfile64;
540
541 case amd64_sys_socket:
542 case amd64_x32_sys_socket:
543 return gdb_sys_socket;
544
545 case amd64_sys_connect:
546 case amd64_x32_sys_connect:
547 return gdb_sys_connect;
548
549 case amd64_sys_accept:
550 case amd64_x32_sys_accept:
551 return gdb_sys_accept;
552
553 case amd64_sys_sendto:
554 case amd64_x32_sys_sendto:
555 return gdb_sys_sendto;
556
557 case amd64_sys_recvfrom:
558 case amd64_x32_sys_recvfrom:
559 return gdb_sys_recvfrom;
560
561 case amd64_sys_sendmsg:
562 case amd64_x32_sys_sendmsg:
563 return gdb_sys_sendmsg;
564
565 case amd64_sys_recvmsg:
566 case amd64_x32_sys_recvmsg:
567 return gdb_sys_recvmsg;
568
569 case amd64_sys_shutdown:
570 case amd64_x32_sys_shutdown:
571 return gdb_sys_shutdown;
572
573 case amd64_sys_bind:
574 case amd64_x32_sys_bind:
575 return gdb_sys_bind;
576
577 case amd64_sys_listen:
578 case amd64_x32_sys_listen:
579 return gdb_sys_listen;
580
581 case amd64_sys_getsockname:
582 case amd64_x32_sys_getsockname:
583 return gdb_sys_getsockname;
584
585 case amd64_sys_getpeername:
586 case amd64_x32_sys_getpeername:
587 return gdb_sys_getpeername;
588
589 case amd64_sys_socketpair:
590 case amd64_x32_sys_socketpair:
591 return gdb_sys_socketpair;
592
593 case amd64_sys_setsockopt:
594 case amd64_x32_sys_setsockopt:
595 return gdb_sys_setsockopt;
596
597 case amd64_sys_getsockopt:
598 case amd64_x32_sys_getsockopt:
599 return gdb_sys_getsockopt;
600
601 case amd64_sys_clone:
602 case amd64_x32_sys_clone:
603 return gdb_sys_clone;
604
605 case amd64_sys_fork:
606 case amd64_x32_sys_fork:
607 return gdb_sys_fork;
608
609 case amd64_sys_vfork:
610 case amd64_x32_sys_vfork:
611 return gdb_sys_vfork;
612
613 case amd64_sys_execve:
614 case amd64_x32_sys_execve:
615 return gdb_sys_execve;
616
617 case amd64_sys_exit:
618 case amd64_x32_sys_exit:
619 return gdb_sys_exit;
620
621 case amd64_sys_wait4:
622 case amd64_x32_sys_wait4:
623 return gdb_sys_wait4;
624
625 case amd64_sys_kill:
626 case amd64_x32_sys_kill:
627 return gdb_sys_kill;
628
629 case amd64_sys_uname:
630 case amd64_x32_sys_uname:
631 return gdb_sys_uname;
632
633 case amd64_sys_semget:
634 case amd64_x32_sys_semget:
635 return gdb_sys_semget;
636
637 case amd64_sys_semop:
638 case amd64_x32_sys_semop:
639 return gdb_sys_semop;
640
641 case amd64_sys_semctl:
642 case amd64_x32_sys_semctl:
643 return gdb_sys_semctl;
644
645 case amd64_sys_shmdt:
646 case amd64_x32_sys_shmdt:
647 return gdb_sys_shmdt;
648
649 case amd64_sys_msgget:
650 case amd64_x32_sys_msgget:
651 return gdb_sys_msgget;
652
653 case amd64_sys_msgsnd:
654 case amd64_x32_sys_msgsnd:
655 return gdb_sys_msgsnd;
656
657 case amd64_sys_msgrcv:
658 case amd64_x32_sys_msgrcv:
659 return gdb_sys_msgrcv;
660
661 case amd64_sys_msgctl:
662 case amd64_x32_sys_msgctl:
663 return gdb_sys_msgctl;
664
665 case amd64_sys_fcntl:
666 case amd64_x32_sys_fcntl:
667 return gdb_sys_fcntl;
668
669 case amd64_sys_flock:
670 case amd64_x32_sys_flock:
671 return gdb_sys_flock;
672
673 case amd64_sys_fsync:
674 case amd64_x32_sys_fsync:
675 return gdb_sys_fsync;
676
677 case amd64_sys_fdatasync:
678 case amd64_x32_sys_fdatasync:
679 return gdb_sys_fdatasync;
680
681 case amd64_sys_truncate:
682 case amd64_x32_sys_truncate:
683 return gdb_sys_truncate;
684
685 case amd64_sys_ftruncate:
686 case amd64_x32_sys_ftruncate:
687 return gdb_sys_ftruncate;
688
689 case amd64_sys_getdents:
690 case amd64_x32_sys_getdents:
691 return gdb_sys_getdents;
692
693 case amd64_sys_getcwd:
694 case amd64_x32_sys_getcwd:
695 return gdb_sys_getcwd;
696
697 case amd64_sys_chdir:
698 case amd64_x32_sys_chdir:
699 return gdb_sys_chdir;
700
701 case amd64_sys_fchdir:
702 case amd64_x32_sys_fchdir:
703 return gdb_sys_fchdir;
704
705 case amd64_sys_rename:
706 case amd64_x32_sys_rename:
707 return gdb_sys_rename;
708
709 case amd64_sys_mkdir:
710 case amd64_x32_sys_mkdir:
711 return gdb_sys_mkdir;
712
713 case amd64_sys_rmdir:
714 case amd64_x32_sys_rmdir:
715 return gdb_sys_rmdir;
716
717 case amd64_sys_creat:
718 case amd64_x32_sys_creat:
719 return gdb_sys_creat;
720
721 case amd64_sys_link:
722 case amd64_x32_sys_link:
723 return gdb_sys_link;
724
725 case amd64_sys_unlink:
726 case amd64_x32_sys_unlink:
727 return gdb_sys_unlink;
728
729 case amd64_sys_symlink:
730 case amd64_x32_sys_symlink:
731 return gdb_sys_symlink;
732
733 case amd64_sys_readlink:
734 case amd64_x32_sys_readlink:
735 return gdb_sys_readlink;
736
737 case amd64_sys_chmod:
738 case amd64_x32_sys_chmod:
739 return gdb_sys_chmod;
740
741 case amd64_sys_fchmod:
742 case amd64_x32_sys_fchmod:
743 return gdb_sys_fchmod;
744
745 case amd64_sys_chown:
746 case amd64_x32_sys_chown:
747 return gdb_sys_chown;
748
749 case amd64_sys_fchown:
750 case amd64_x32_sys_fchown:
751 return gdb_sys_fchown;
752
753 case amd64_sys_lchown:
754 case amd64_x32_sys_lchown:
755 return gdb_sys_lchown;
756
757 case amd64_sys_umask:
758 case amd64_x32_sys_umask:
759 return gdb_sys_umask;
760
761 case amd64_sys_gettimeofday:
762 case amd64_x32_sys_gettimeofday:
763 return gdb_sys_gettimeofday;
764
765 case amd64_sys_getrlimit:
766 case amd64_x32_sys_getrlimit:
767 return gdb_sys_getrlimit;
768
769 case amd64_sys_getrusage:
770 case amd64_x32_sys_getrusage:
771 return gdb_sys_getrusage;
772
773 case amd64_sys_sysinfo:
774 case amd64_x32_sys_sysinfo:
775 return gdb_sys_sysinfo;
776
777 case amd64_sys_times:
778 case amd64_x32_sys_times:
779 return gdb_sys_times;
780
781 case amd64_sys_ptrace:
782 case amd64_x32_sys_ptrace:
783 return gdb_sys_ptrace;
784
785 case amd64_sys_getuid:
786 case amd64_x32_sys_getuid:
787 return gdb_sys_getuid;
788
789 case amd64_sys_syslog:
790 case amd64_x32_sys_syslog:
791 return gdb_sys_syslog;
792
793 case amd64_sys_getgid:
794 case amd64_x32_sys_getgid:
795 return gdb_sys_getgid;
796
797 case amd64_sys_setuid:
798 case amd64_x32_sys_setuid:
799 return gdb_sys_setuid;
800
801 case amd64_sys_setgid:
802 case amd64_x32_sys_setgid:
803 return gdb_sys_setgid;
804
805 case amd64_sys_geteuid:
806 case amd64_x32_sys_geteuid:
807 return gdb_sys_geteuid;
808
809 case amd64_sys_getegid:
810 case amd64_x32_sys_getegid:
811 return gdb_sys_getegid;
812
813 case amd64_sys_setpgid:
814 case amd64_x32_sys_setpgid:
815 return gdb_sys_setpgid;
816
817 case amd64_sys_getppid:
818 case amd64_x32_sys_getppid:
819 return gdb_sys_getppid;
820
821 case amd64_sys_getpgrp:
822 case amd64_x32_sys_getpgrp:
823 return gdb_sys_getpgrp;
824
825 case amd64_sys_setsid:
826 case amd64_x32_sys_setsid:
827 return gdb_sys_setsid;
828
829 case amd64_sys_setreuid:
830 case amd64_x32_sys_setreuid:
831 return gdb_sys_setreuid;
832
833 case amd64_sys_setregid:
834 case amd64_x32_sys_setregid:
835 return gdb_sys_setregid;
836
837 case amd64_sys_getgroups:
838 case amd64_x32_sys_getgroups:
839 return gdb_sys_getgroups;
840
841 case amd64_sys_setgroups:
842 case amd64_x32_sys_setgroups:
843 return gdb_sys_setgroups;
844
845 case amd64_sys_setresuid:
846 case amd64_x32_sys_setresuid:
847 return gdb_sys_setresuid;
848
849 case amd64_sys_getresuid:
850 case amd64_x32_sys_getresuid:
851 return gdb_sys_getresuid;
852
853 case amd64_sys_setresgid:
854 case amd64_x32_sys_setresgid:
855 return gdb_sys_setresgid;
856
857 case amd64_sys_getresgid:
858 case amd64_x32_sys_getresgid:
859 return gdb_sys_getresgid;
860
861 case amd64_sys_getpgid:
862 case amd64_x32_sys_getpgid:
863 return gdb_sys_getpgid;
864
865 case amd64_sys_setfsuid:
866 case amd64_x32_sys_setfsuid:
867 return gdb_sys_setfsuid;
868
869 case amd64_sys_setfsgid:
870 case amd64_x32_sys_setfsgid:
871 return gdb_sys_setfsgid;
872
873 case amd64_sys_getsid:
874 case amd64_x32_sys_getsid:
875 return gdb_sys_getsid;
876
877 case amd64_sys_capget:
878 case amd64_x32_sys_capget:
879 return gdb_sys_capget;
880
881 case amd64_sys_capset:
882 case amd64_x32_sys_capset:
883 return gdb_sys_capset;
884
885 case amd64_sys_rt_sigpending:
886 case amd64_x32_sys_rt_sigpending:
887 return gdb_sys_rt_sigpending;
888
889 case amd64_sys_rt_sigtimedwait:
890 case amd64_x32_sys_rt_sigtimedwait:
891 return gdb_sys_rt_sigtimedwait;
892
893 case amd64_sys_rt_sigqueueinfo:
894 case amd64_x32_sys_rt_sigqueueinfo:
895 return gdb_sys_rt_sigqueueinfo;
896
897 case amd64_sys_rt_sigsuspend:
898 case amd64_x32_sys_rt_sigsuspend:
899 return gdb_sys_rt_sigsuspend;
900
901 case amd64_sys_sigaltstack:
902 case amd64_x32_sys_sigaltstack:
903 return gdb_sys_sigaltstack;
904
905 case amd64_sys_utime:
906 case amd64_x32_sys_utime:
907 return gdb_sys_utime;
908
909 case amd64_sys_mknod:
910 case amd64_x32_sys_mknod:
911 return gdb_sys_mknod;
912
913 case amd64_sys_personality:
914 case amd64_x32_sys_personality:
915 return gdb_sys_personality;
916
917 case amd64_sys_ustat:
918 case amd64_x32_sys_ustat:
919 return gdb_sys_ustat;
920
921 case amd64_sys_statfs:
922 case amd64_x32_sys_statfs:
923 return gdb_sys_statfs;
924
925 case amd64_sys_fstatfs:
926 case amd64_x32_sys_fstatfs:
927 return gdb_sys_fstatfs;
928
929 case amd64_sys_sysfs:
930 case amd64_x32_sys_sysfs:
931 return gdb_sys_sysfs;
932
933 case amd64_sys_getpriority:
934 case amd64_x32_sys_getpriority:
935 return gdb_sys_getpriority;
936
937 case amd64_sys_setpriority:
938 case amd64_x32_sys_setpriority:
939 return gdb_sys_setpriority;
940
941 case amd64_sys_sched_setparam:
942 case amd64_x32_sys_sched_setparam:
943 return gdb_sys_sched_setparam;
944
945 case amd64_sys_sched_getparam:
946 case amd64_x32_sys_sched_getparam:
947 return gdb_sys_sched_getparam;
948
949 case amd64_sys_sched_setscheduler:
950 case amd64_x32_sys_sched_setscheduler:
951 return gdb_sys_sched_setscheduler;
952
953 case amd64_sys_sched_getscheduler:
954 case amd64_x32_sys_sched_getscheduler:
955 return gdb_sys_sched_getscheduler;
956
957 case amd64_sys_sched_get_priority_max:
958 case amd64_x32_sys_sched_get_priority_max:
959 return gdb_sys_sched_get_priority_max;
960
961 case amd64_sys_sched_get_priority_min:
962 case amd64_x32_sys_sched_get_priority_min:
963 return gdb_sys_sched_get_priority_min;
964
965 case amd64_sys_sched_rr_get_interval:
966 case amd64_x32_sys_sched_rr_get_interval:
967 return gdb_sys_sched_rr_get_interval;
968
969 case amd64_sys_mlock:
970 case amd64_x32_sys_mlock:
971 return gdb_sys_mlock;
972
973 case amd64_sys_munlock:
974 case amd64_x32_sys_munlock:
975 return gdb_sys_munlock;
976
977 case amd64_sys_mlockall:
978 case amd64_x32_sys_mlockall:
979 return gdb_sys_mlockall;
980
981 case amd64_sys_munlockall:
982 case amd64_x32_sys_munlockall:
983 return gdb_sys_munlockall;
984
985 case amd64_sys_vhangup:
986 case amd64_x32_sys_vhangup:
987 return gdb_sys_vhangup;
988
989 case amd64_sys_modify_ldt:
990 case amd64_x32_sys_modify_ldt:
991 return gdb_sys_modify_ldt;
992
993 case amd64_sys_pivot_root:
994 case amd64_x32_sys_pivot_root:
995 return gdb_sys_pivot_root;
996
997 case amd64_sys_sysctl:
998 case amd64_x32_sys_sysctl:
999 return gdb_sys_sysctl;
1000
1001 case amd64_sys_prctl:
1002 case amd64_x32_sys_prctl:
1003 return gdb_sys_prctl;
1004
1005 case amd64_sys_arch_prctl:
1006 case amd64_x32_sys_arch_prctl:
1007 return gdb_sys_no_syscall; /* Note */
1008
1009 case amd64_sys_adjtimex:
1010 case amd64_x32_sys_adjtimex:
1011 return gdb_sys_adjtimex;
1012
1013 case amd64_sys_setrlimit:
1014 case amd64_x32_sys_setrlimit:
1015 return gdb_sys_setrlimit;
1016
1017 case amd64_sys_chroot:
1018 case amd64_x32_sys_chroot:
1019 return gdb_sys_chroot;
1020
1021 case amd64_sys_sync:
1022 case amd64_x32_sys_sync:
1023 return gdb_sys_sync;
1024
1025 case amd64_sys_acct:
1026 case amd64_x32_sys_acct:
1027 return gdb_sys_acct;
1028
1029 case amd64_sys_settimeofday:
1030 case amd64_x32_sys_settimeofday:
1031 return gdb_sys_settimeofday;
1032
1033 case amd64_sys_mount:
1034 case amd64_x32_sys_mount:
1035 return gdb_sys_mount;
1036
1037 case amd64_sys_umount:
1038 case amd64_x32_sys_umount:
1039 return gdb_sys_umount;
1040
1041 case amd64_sys_swapon:
1042 case amd64_x32_sys_swapon:
1043 return gdb_sys_swapon;
1044
1045 case amd64_sys_swapoff:
1046 case amd64_x32_sys_swapoff:
1047 return gdb_sys_swapoff;
1048
1049 case amd64_sys_reboot:
1050 case amd64_x32_sys_reboot:
1051 return gdb_sys_reboot;
1052
1053 case amd64_sys_sethostname:
1054 case amd64_x32_sys_sethostname:
1055 return gdb_sys_sethostname;
1056
1057 case amd64_sys_setdomainname:
1058 case amd64_x32_sys_setdomainname:
1059 return gdb_sys_setdomainname;
1060
1061 case amd64_sys_iopl:
1062 case amd64_x32_sys_iopl:
1063 return gdb_sys_iopl;
1064
1065 case amd64_sys_ioperm:
1066 case amd64_x32_sys_ioperm:
1067 return gdb_sys_ioperm;
1068
1069 case amd64_sys_init_module:
1070 case amd64_x32_sys_init_module:
1071 return gdb_sys_init_module;
1072
1073 case amd64_sys_delete_module:
1074 case amd64_x32_sys_delete_module:
1075 return gdb_sys_delete_module;
1076
1077 case amd64_sys_quotactl:
1078 case amd64_x32_sys_quotactl:
1079 return gdb_sys_quotactl;
1080
1081 case amd64_sys_nfsservctl:
1082 return gdb_sys_nfsservctl;
1083
1084 case amd64_sys_gettid:
1085 case amd64_x32_sys_gettid:
1086 return gdb_sys_gettid;
1087
1088 case amd64_sys_readahead:
1089 case amd64_x32_sys_readahead:
1090 return gdb_sys_readahead;
1091
1092 case amd64_sys_setxattr:
1093 case amd64_x32_sys_setxattr:
1094 return gdb_sys_setxattr;
1095
1096 case amd64_sys_lsetxattr:
1097 case amd64_x32_sys_lsetxattr:
1098 return gdb_sys_lsetxattr;
1099
1100 case amd64_sys_fsetxattr:
1101 case amd64_x32_sys_fsetxattr:
1102 return gdb_sys_fsetxattr;
1103
1104 case amd64_sys_getxattr:
1105 case amd64_x32_sys_getxattr:
1106 return gdb_sys_getxattr;
1107
1108 case amd64_sys_lgetxattr:
1109 case amd64_x32_sys_lgetxattr:
1110 return gdb_sys_lgetxattr;
1111
1112 case amd64_sys_fgetxattr:
1113 case amd64_x32_sys_fgetxattr:
1114 return gdb_sys_fgetxattr;
1115
1116 case amd64_sys_listxattr:
1117 case amd64_x32_sys_listxattr:
1118 return gdb_sys_listxattr;
1119
1120 case amd64_sys_llistxattr:
1121 case amd64_x32_sys_llistxattr:
1122 return gdb_sys_llistxattr;
1123
1124 case amd64_sys_flistxattr:
1125 case amd64_x32_sys_flistxattr:
1126 return gdb_sys_flistxattr;
1127
1128 case amd64_sys_removexattr:
1129 case amd64_x32_sys_removexattr:
1130 return gdb_sys_removexattr;
1131
1132 case amd64_sys_lremovexattr:
1133 case amd64_x32_sys_lremovexattr:
1134 return gdb_sys_lremovexattr;
1135
1136 case amd64_sys_fremovexattr:
1137 case amd64_x32_sys_fremovexattr:
1138 return gdb_sys_fremovexattr;
1139
1140 case amd64_sys_tkill:
1141 case amd64_x32_sys_tkill:
1142 return gdb_sys_tkill;
1143
1144 case amd64_sys_time:
1145 case amd64_x32_sys_time:
1146 return gdb_sys_time;
1147
1148 case amd64_sys_futex:
1149 case amd64_x32_sys_futex:
1150 return gdb_sys_futex;
1151
1152 case amd64_sys_sched_setaffinity:
1153 case amd64_x32_sys_sched_setaffinity:
1154 return gdb_sys_sched_setaffinity;
1155
1156 case amd64_sys_sched_getaffinity:
1157 case amd64_x32_sys_sched_getaffinity:
1158 return gdb_sys_sched_getaffinity;
1159
1160 case amd64_sys_io_setup:
1161 case amd64_x32_sys_io_setup:
1162 return gdb_sys_io_setup;
1163
1164 case amd64_sys_io_destroy:
1165 case amd64_x32_sys_io_destroy:
1166 return gdb_sys_io_destroy;
1167
1168 case amd64_sys_io_getevents:
1169 case amd64_x32_sys_io_getevents:
1170 return gdb_sys_io_getevents;
1171
1172 case amd64_sys_io_submit:
1173 case amd64_x32_sys_io_submit:
1174 return gdb_sys_io_submit;
1175
1176 case amd64_sys_io_cancel:
1177 case amd64_x32_sys_io_cancel:
1178 return gdb_sys_io_cancel;
1179
1180 case amd64_sys_lookup_dcookie:
1181 case amd64_x32_sys_lookup_dcookie:
1182 return gdb_sys_lookup_dcookie;
1183
1184 case amd64_sys_epoll_create:
1185 case amd64_x32_sys_epoll_create:
1186 return gdb_sys_epoll_create;
1187
1188 case amd64_sys_remap_file_pages:
1189 case amd64_x32_sys_remap_file_pages:
1190 return gdb_sys_remap_file_pages;
1191
1192 case amd64_sys_getdents64:
1193 case amd64_x32_sys_getdents64:
1194 return gdb_sys_getdents64;
1195
1196 case amd64_sys_set_tid_address:
1197 case amd64_x32_sys_set_tid_address:
1198 return gdb_sys_set_tid_address;
1199
1200 case amd64_sys_restart_syscall:
1201 case amd64_x32_sys_restart_syscall:
1202 return gdb_sys_restart_syscall;
1203
1204 case amd64_sys_semtimedop:
1205 case amd64_x32_sys_semtimedop:
1206 return gdb_sys_semtimedop;
1207
1208 case amd64_sys_fadvise64:
1209 case amd64_x32_sys_fadvise64:
1210 return gdb_sys_fadvise64;
1211
1212 case amd64_sys_timer_create:
1213 case amd64_x32_sys_timer_create:
1214 return gdb_sys_timer_create;
1215
1216 case amd64_sys_timer_settime:
1217 case amd64_x32_sys_timer_settime:
1218 return gdb_sys_timer_settime;
1219
1220 case amd64_sys_timer_gettime:
1221 case amd64_x32_sys_timer_gettime:
1222 return gdb_sys_timer_gettime;
1223
1224 case amd64_sys_timer_getoverrun:
1225 case amd64_x32_sys_timer_getoverrun:
1226 return gdb_sys_timer_getoverrun;
1227
1228 case amd64_sys_timer_delete:
1229 case amd64_x32_sys_timer_delete:
1230 return gdb_sys_timer_delete;
1231
1232 case amd64_sys_clock_settime:
1233 case amd64_x32_sys_clock_settime:
1234 return gdb_sys_clock_settime;
1235
1236 case amd64_sys_clock_gettime:
1237 case amd64_x32_sys_clock_gettime:
1238 return gdb_sys_clock_gettime;
1239
1240 case amd64_sys_clock_getres:
1241 case amd64_x32_sys_clock_getres:
1242 return gdb_sys_clock_getres;
1243
1244 case amd64_sys_clock_nanosleep:
1245 case amd64_x32_sys_clock_nanosleep:
1246 return gdb_sys_clock_nanosleep;
1247
1248 case amd64_sys_exit_group:
1249 case amd64_x32_sys_exit_group:
1250 return gdb_sys_exit_group;
1251
1252 case amd64_sys_epoll_wait:
1253 case amd64_x32_sys_epoll_wait:
1254 return gdb_sys_epoll_wait;
1255
1256 case amd64_sys_epoll_ctl:
1257 case amd64_x32_sys_epoll_ctl:
1258 return gdb_sys_epoll_ctl;
1259
1260 case amd64_sys_tgkill:
1261 case amd64_x32_sys_tgkill:
1262 return gdb_sys_tgkill;
1263
1264 case amd64_sys_utimes:
1265 case amd64_x32_sys_utimes:
1266 return gdb_sys_utimes;
1267
1268 case amd64_sys_mbind:
1269 case amd64_x32_sys_mbind:
1270 return gdb_sys_mbind;
1271
1272 case amd64_sys_set_mempolicy:
1273 case amd64_x32_sys_set_mempolicy:
1274 return gdb_sys_set_mempolicy;
1275
1276 case amd64_sys_get_mempolicy:
1277 case amd64_x32_sys_get_mempolicy:
1278 return gdb_sys_get_mempolicy;
1279
1280 case amd64_sys_mq_open:
1281 case amd64_x32_sys_mq_open:
1282 return gdb_sys_mq_open;
1283
1284 case amd64_sys_mq_unlink:
1285 case amd64_x32_sys_mq_unlink:
1286 return gdb_sys_mq_unlink;
1287
1288 case amd64_sys_mq_timedsend:
1289 case amd64_x32_sys_mq_timedsend:
1290 return gdb_sys_mq_timedsend;
1291
1292 case amd64_sys_mq_timedreceive:
1293 case amd64_x32_sys_mq_timedreceive:
1294 return gdb_sys_mq_timedreceive;
1295
1296 case amd64_sys_mq_notify:
1297 case amd64_x32_sys_mq_notify:
1298 return gdb_sys_mq_notify;
1299
1300 case amd64_sys_mq_getsetattr:
1301 case amd64_x32_sys_mq_getsetattr:
1302 return gdb_sys_mq_getsetattr;
1303
1304 case amd64_sys_kexec_load:
1305 case amd64_x32_sys_kexec_load:
1306 return gdb_sys_kexec_load;
1307
1308 case amd64_sys_waitid:
1309 case amd64_x32_sys_waitid:
1310 return gdb_sys_waitid;
1311
1312 case amd64_sys_add_key:
1313 case amd64_x32_sys_add_key:
1314 return gdb_sys_add_key;
1315
1316 case amd64_sys_request_key:
1317 case amd64_x32_sys_request_key:
1318 return gdb_sys_request_key;
1319
1320 case amd64_sys_keyctl:
1321 case amd64_x32_sys_keyctl:
1322 return gdb_sys_keyctl;
1323
1324 case amd64_sys_ioprio_set:
1325 case amd64_x32_sys_ioprio_set:
1326 return gdb_sys_ioprio_set;
1327
1328 case amd64_sys_ioprio_get:
1329 case amd64_x32_sys_ioprio_get:
1330 return gdb_sys_ioprio_get;
1331
1332 case amd64_sys_inotify_init:
1333 case amd64_x32_sys_inotify_init:
1334 return gdb_sys_inotify_init;
1335
1336 case amd64_sys_inotify_add_watch:
1337 case amd64_x32_sys_inotify_add_watch:
1338 return gdb_sys_inotify_add_watch;
1339
1340 case amd64_sys_inotify_rm_watch:
1341 case amd64_x32_sys_inotify_rm_watch:
1342 return gdb_sys_inotify_rm_watch;
1343
1344 case amd64_sys_migrate_pages:
1345 case amd64_x32_sys_migrate_pages:
1346 return gdb_sys_migrate_pages;
1347
1348 case amd64_sys_openat:
1349 case amd64_x32_sys_openat:
1350 return gdb_sys_openat;
1351
1352 case amd64_sys_mkdirat:
1353 case amd64_x32_sys_mkdirat:
1354 return gdb_sys_mkdirat;
1355
1356 case amd64_sys_mknodat:
1357 case amd64_x32_sys_mknodat:
1358 return gdb_sys_mknodat;
1359
1360 case amd64_sys_fchownat:
1361 case amd64_x32_sys_fchownat:
1362 return gdb_sys_fchownat;
1363
1364 case amd64_sys_futimesat:
1365 case amd64_x32_sys_futimesat:
1366 return gdb_sys_futimesat;
1367
1368 case amd64_sys_newfstatat:
1369 case amd64_x32_sys_newfstatat:
1370 return gdb_sys_newfstatat;
1371
1372 case amd64_sys_unlinkat:
1373 case amd64_x32_sys_unlinkat:
1374 return gdb_sys_unlinkat;
1375
1376 case amd64_sys_renameat:
1377 case amd64_x32_sys_renameat:
1378 return gdb_sys_renameat;
1379
1380 case amd64_sys_linkat:
1381 case amd64_x32_sys_linkat:
1382 return gdb_sys_linkat;
1383
1384 case amd64_sys_symlinkat:
1385 case amd64_x32_sys_symlinkat:
1386 return gdb_sys_symlinkat;
1387
1388 case amd64_sys_readlinkat:
1389 case amd64_x32_sys_readlinkat:
1390 return gdb_sys_readlinkat;
1391
1392 case amd64_sys_fchmodat:
1393 case amd64_x32_sys_fchmodat:
1394 return gdb_sys_fchmodat;
1395
1396 case amd64_sys_faccessat:
1397 case amd64_x32_sys_faccessat:
1398 return gdb_sys_faccessat;
1399
1400 case amd64_sys_pselect6:
1401 case amd64_x32_sys_pselect6:
1402 return gdb_sys_pselect6;
1403
1404 case amd64_sys_ppoll:
1405 case amd64_x32_sys_ppoll:
1406 return gdb_sys_ppoll;
1407
1408 case amd64_sys_unshare:
1409 case amd64_x32_sys_unshare:
1410 return gdb_sys_unshare;
1411
1412 case amd64_sys_set_robust_list:
1413 case amd64_x32_sys_set_robust_list:
1414 return gdb_sys_set_robust_list;
1415
1416 case amd64_sys_get_robust_list:
1417 case amd64_x32_sys_get_robust_list:
1418 return gdb_sys_get_robust_list;
1419
1420 case amd64_sys_splice:
1421 case amd64_x32_sys_splice:
1422 return gdb_sys_splice;
1423
1424 case amd64_sys_tee:
1425 case amd64_x32_sys_tee:
1426 return gdb_sys_tee;
1427
1428 case amd64_sys_sync_file_range:
1429 case amd64_x32_sys_sync_file_range:
1430 return gdb_sys_sync_file_range;
1431
1432 case amd64_sys_vmsplice:
1433 case amd64_x32_sys_vmsplice:
1434 return gdb_sys_vmsplice;
1435
1436 case amd64_sys_move_pages:
1437 case amd64_x32_sys_move_pages:
1438 return gdb_sys_move_pages;
1439
1440 default:
1441 return gdb_sys_no_syscall;
1442 }
1443 }
1444
1445 /* Parse the arguments of current system call instruction and record
1446 the values of the registers and memory that will be changed into
1447 "record_full_arch_list". This instruction is "syscall".
1448
1449 Return -1 if something wrong. */
1450
1451 static struct linux_record_tdep amd64_linux_record_tdep;
1452 static struct linux_record_tdep amd64_x32_linux_record_tdep;
1453
1454 #define RECORD_ARCH_GET_FS 0x1003
1455 #define RECORD_ARCH_GET_GS 0x1004
1456
1457 static int
1458 amd64_linux_syscall_record_common (struct regcache *regcache,
1459 struct linux_record_tdep *linux_record_tdep_p)
1460 {
1461 int ret;
1462 ULONGEST syscall_native;
1463 enum gdb_syscall syscall_gdb = gdb_sys_no_syscall;
1464
1465 regcache_raw_read_unsigned (regcache, AMD64_RAX_REGNUM, &syscall_native);
1466
1467 switch (syscall_native)
1468 {
1469 case amd64_sys_rt_sigreturn:
1470 case amd64_x32_sys_rt_sigreturn:
1471 if (amd64_all_but_ip_registers_record (regcache))
1472 return -1;
1473 return 0;
1474 break;
1475
1476 case amd64_sys_arch_prctl:
1477 case amd64_x32_sys_arch_prctl:
1478 {
1479 ULONGEST arg3;
1480 regcache_raw_read_unsigned (regcache, linux_record_tdep_p->arg3,
1481 &arg3);
1482 if (arg3 == RECORD_ARCH_GET_FS || arg3 == RECORD_ARCH_GET_GS)
1483 {
1484 CORE_ADDR addr;
1485
1486 regcache_raw_read_unsigned (regcache,
1487 linux_record_tdep_p->arg2,
1488 &addr);
1489 if (record_full_arch_list_add_mem
1490 (addr, linux_record_tdep_p->size_ulong))
1491 return -1;
1492 }
1493 goto record_regs;
1494 }
1495 break;
1496 }
1497
1498 syscall_gdb
1499 = amd64_canonicalize_syscall ((enum amd64_syscall) syscall_native);
1500
1501 if (syscall_gdb == gdb_sys_no_syscall)
1502 {
1503 printf_unfiltered (_("Process record and replay target doesn't "
1504 "support syscall number %s\n"),
1505 pulongest (syscall_native));
1506 return -1;
1507 }
1508 else
1509 {
1510 ret = record_linux_system_call (syscall_gdb, regcache,
1511 linux_record_tdep_p);
1512 if (ret)
1513 return ret;
1514 }
1515
1516 record_regs:
1517 /* Record the return value of the system call. */
1518 if (record_full_arch_list_add_reg (regcache, AMD64_RCX_REGNUM))
1519 return -1;
1520 if (record_full_arch_list_add_reg (regcache, AMD64_R11_REGNUM))
1521 return -1;
1522
1523 return 0;
1524 }
1525
1526 static int
1527 amd64_linux_syscall_record (struct regcache *regcache)
1528 {
1529 return amd64_linux_syscall_record_common (regcache,
1530 &amd64_linux_record_tdep);
1531 }
1532
1533 static int
1534 amd64_x32_linux_syscall_record (struct regcache *regcache)
1535 {
1536 return amd64_linux_syscall_record_common (regcache,
1537 &amd64_x32_linux_record_tdep);
1538 }
1539
1540 #define AMD64_LINUX_redzone 128
1541 #define AMD64_LINUX_xstate 512
1542 #define AMD64_LINUX_frame_size 560
1543
1544 static int
1545 amd64_linux_record_signal (struct gdbarch *gdbarch,
1546 struct regcache *regcache,
1547 enum gdb_signal signal)
1548 {
1549 ULONGEST rsp;
1550
1551 if (amd64_all_but_ip_registers_record (regcache))
1552 return -1;
1553
1554 if (record_full_arch_list_add_reg (regcache, AMD64_RIP_REGNUM))
1555 return -1;
1556
1557 /* Record the change in the stack. */
1558 regcache_raw_read_unsigned (regcache, AMD64_RSP_REGNUM, &rsp);
1559 /* redzone
1560 sp -= 128; */
1561 rsp -= AMD64_LINUX_redzone;
1562 /* This is for xstate.
1563 sp -= sizeof (struct _fpstate); */
1564 rsp -= AMD64_LINUX_xstate;
1565 /* This is for frame_size.
1566 sp -= sizeof (struct rt_sigframe); */
1567 rsp -= AMD64_LINUX_frame_size;
1568 if (record_full_arch_list_add_mem (rsp, AMD64_LINUX_redzone
1569 + AMD64_LINUX_xstate
1570 + AMD64_LINUX_frame_size))
1571 return -1;
1572
1573 if (record_full_arch_list_add_end ())
1574 return -1;
1575
1576 return 0;
1577 }
1578
1579 const target_desc *
1580 amd64_linux_read_description (uint64_t xcr0_features_bit, bool is_x32)
1581 {
1582 static target_desc *amd64_linux_tdescs \
1583 [2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {};
1584 static target_desc *x32_linux_tdescs[2/*AVX*/][2/*AVX512*/] = {};
1585
1586 target_desc **tdesc;
1587
1588 if (is_x32)
1589 {
1590 tdesc = &x32_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0 ]
1591 [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0];
1592 }
1593 else
1594 {
1595 tdesc = &amd64_linux_tdescs[(xcr0_features_bit & X86_XSTATE_AVX) ? 1 : 0]
1596 [(xcr0_features_bit & X86_XSTATE_MPX) ? 1 : 0]
1597 [(xcr0_features_bit & X86_XSTATE_AVX512) ? 1 : 0]
1598 [(xcr0_features_bit & X86_XSTATE_PKRU) ? 1 : 0];
1599 }
1600
1601 if (*tdesc == NULL)
1602 {
1603 *tdesc = allocate_target_description ();
1604
1605 set_tdesc_architecture (*tdesc,
1606 is_x32 ? "i386:x64-32" : "i386:x86-64");
1607
1608 set_tdesc_osabi (*tdesc, osabi_from_tdesc_string ("GNU/Linux"));
1609
1610 long regnum = 0;
1611
1612 if (is_x32)
1613 regnum = create_feature_i386_x32_core (*tdesc, regnum);
1614 else
1615 regnum = create_feature_i386_64bit_core (*tdesc, regnum);
1616
1617 regnum = create_feature_i386_64bit_sse (*tdesc, regnum);
1618 regnum = create_feature_i386_64bit_linux (*tdesc, regnum);
1619 regnum = create_feature_i386_64bit_segments (*tdesc, regnum);
1620
1621 if (xcr0_features_bit & X86_XSTATE_AVX)
1622 regnum = create_feature_i386_64bit_avx (*tdesc, regnum);
1623
1624 if ((xcr0_features_bit & X86_XSTATE_MPX) && !is_x32)
1625 regnum = create_feature_i386_64bit_mpx (*tdesc, regnum);
1626
1627 if (xcr0_features_bit & X86_XSTATE_AVX512)
1628 regnum = create_feature_i386_64bit_avx512 (*tdesc, regnum);
1629
1630 if ((xcr0_features_bit & X86_XSTATE_PKRU) && !is_x32)
1631 regnum = create_feature_i386_64bit_pkeys (*tdesc, regnum);
1632 }
1633
1634 return *tdesc;
1635 }
1636
1637 /* Get Linux/x86 target description from core dump. */
1638
1639 static const struct target_desc *
1640 amd64_linux_core_read_description (struct gdbarch *gdbarch,
1641 struct target_ops *target,
1642 bfd *abfd)
1643 {
1644 /* Linux/x86-64. */
1645 uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd);
1646
1647 return amd64_linux_read_description (xcr0 & X86_XSTATE_ALL_MASK,
1648 gdbarch_ptr_bit (gdbarch) == 32);
1649 }
1650
1651 /* Similar to amd64_supply_fpregset, but use XSAVE extended state. */
1652
1653 static void
1654 amd64_linux_supply_xstateregset (const struct regset *regset,
1655 struct regcache *regcache, int regnum,
1656 const void *xstateregs, size_t len)
1657 {
1658 amd64_supply_xsave (regcache, regnum, xstateregs);
1659 }
1660
1661 /* Similar to amd64_collect_fpregset, but use XSAVE extended state. */
1662
1663 static void
1664 amd64_linux_collect_xstateregset (const struct regset *regset,
1665 const struct regcache *regcache,
1666 int regnum, void *xstateregs, size_t len)
1667 {
1668 amd64_collect_xsave (regcache, regnum, xstateregs, 1);
1669 }
1670
1671 static const struct regset amd64_linux_xstateregset =
1672 {
1673 NULL,
1674 amd64_linux_supply_xstateregset,
1675 amd64_linux_collect_xstateregset
1676 };
1677
1678 /* Iterate over core file register note sections. */
1679
1680 static void
1681 amd64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
1682 iterate_over_regset_sections_cb *cb,
1683 void *cb_data,
1684 const struct regcache *regcache)
1685 {
1686 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1687
1688 cb (".reg", 27 * 8, &i386_gregset, NULL, cb_data);
1689 cb (".reg2", 512, &amd64_fpregset, NULL, cb_data);
1690 cb (".reg-xstate", X86_XSTATE_SIZE (tdep->xcr0),
1691 &amd64_linux_xstateregset, "XSAVE extended state", cb_data);
1692 }
1693
1694 /* The instruction sequences used in x86_64 machines for a
1695 disabled is-enabled probe. */
1696
1697 const gdb_byte amd64_dtrace_disabled_probe_sequence_1[] = {
1698 /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
1699 /* nop */ 0x90,
1700 /* nop */ 0x90
1701 };
1702
1703 const gdb_byte amd64_dtrace_disabled_probe_sequence_2[] = {
1704 /* xor %rax, %rax */ 0x48, 0x33, 0xc0,
1705 /* ret */ 0xc3,
1706 /* nop */ 0x90
1707 };
1708
1709 /* The instruction sequence used in x86_64 machines for enabling a
1710 DTrace is-enabled probe. */
1711
1712 const gdb_byte amd64_dtrace_enable_probe_sequence[] = {
1713 /* mov $0x1, %eax */ 0xb8, 0x01, 0x00, 0x00, 0x00
1714 };
1715
1716 /* The instruction sequence used in x86_64 machines for disabling a
1717 DTrace is-enabled probe. */
1718
1719 const gdb_byte amd64_dtrace_disable_probe_sequence[] = {
1720 /* xor %rax, %rax; nop; nop */ 0x48, 0x33, 0xC0, 0x90, 0x90
1721 };
1722
1723 /* Implementation of `gdbarch_dtrace_probe_is_enabled', as defined in
1724 gdbarch.h. */
1725
1726 static int
1727 amd64_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr)
1728 {
1729 gdb_byte buf[5];
1730
1731 /* This function returns 1 if the instructions at ADDR do _not_
1732 follow any of the amd64_dtrace_disabled_probe_sequence_*
1733 patterns.
1734
1735 Note that ADDR is offset 3 bytes from the beginning of these
1736 sequences. */
1737
1738 read_code (addr - 3, buf, 5);
1739 return (memcmp (buf, amd64_dtrace_disabled_probe_sequence_1, 5) != 0
1740 && memcmp (buf, amd64_dtrace_disabled_probe_sequence_2, 5) != 0);
1741 }
1742
1743 /* Implementation of `gdbarch_dtrace_enable_probe', as defined in
1744 gdbarch.h. */
1745
1746 static void
1747 amd64_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
1748 {
1749 /* Note also that ADDR is offset 3 bytes from the beginning of
1750 amd64_dtrace_enable_probe_sequence. */
1751
1752 write_memory (addr - 3, amd64_dtrace_enable_probe_sequence, 5);
1753 }
1754
1755 /* Implementation of `gdbarch_dtrace_disable_probe', as defined in
1756 gdbarch.h. */
1757
1758 static void
1759 amd64_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr)
1760 {
1761 /* Note also that ADDR is offset 3 bytes from the beginning of
1762 amd64_dtrace_disable_probe_sequence. */
1763
1764 write_memory (addr - 3, amd64_dtrace_disable_probe_sequence, 5);
1765 }
1766
1767 /* Implementation of `gdbarch_dtrace_parse_probe_argument', as defined
1768 in gdbarch.h. */
1769
1770 static void
1771 amd64_dtrace_parse_probe_argument (struct gdbarch *gdbarch,
1772 struct parser_state *pstate,
1773 int narg)
1774 {
1775 struct stoken str;
1776
1777 /* DTrace probe arguments can be found on the ABI-defined places for
1778 regular arguments at the current PC. The probe abstraction
1779 currently supports up to 12 arguments for probes. */
1780
1781 if (narg < 6)
1782 {
1783 static const int arg_reg_map[6] =
1784 {
1785 AMD64_RDI_REGNUM, /* Arg 1. */
1786 AMD64_RSI_REGNUM, /* Arg 2. */
1787 AMD64_RDX_REGNUM, /* Arg 3. */
1788 AMD64_RCX_REGNUM, /* Arg 4. */
1789 AMD64_R8_REGNUM, /* Arg 5. */
1790 AMD64_R9_REGNUM /* Arg 6. */
1791 };
1792 int regno = arg_reg_map[narg];
1793 const char *regname = user_reg_map_regnum_to_name (gdbarch, regno);
1794
1795 write_exp_elt_opcode (pstate, OP_REGISTER);
1796 str.ptr = regname;
1797 str.length = strlen (regname);
1798 write_exp_string (pstate, str);
1799 write_exp_elt_opcode (pstate, OP_REGISTER);
1800 }
1801 else
1802 {
1803 /* Additional arguments are passed on the stack. */
1804 const char *regname = user_reg_map_regnum_to_name (gdbarch, AMD64_RSP_REGNUM);
1805
1806 /* Displacement. */
1807 write_exp_elt_opcode (pstate, OP_LONG);
1808 write_exp_elt_type (pstate, builtin_type (gdbarch)->builtin_long);
1809 write_exp_elt_longcst (pstate, narg - 6);
1810 write_exp_elt_opcode (pstate, OP_LONG);
1811
1812 /* Register: SP. */
1813 write_exp_elt_opcode (pstate, OP_REGISTER);
1814 str.ptr = regname;
1815 str.length = strlen (regname);
1816 write_exp_string (pstate, str);
1817 write_exp_elt_opcode (pstate, OP_REGISTER);
1818
1819 write_exp_elt_opcode (pstate, BINOP_ADD);
1820
1821 /* Cast to long. */
1822 write_exp_elt_opcode (pstate, UNOP_CAST);
1823 write_exp_elt_type (pstate,
1824 lookup_pointer_type (builtin_type (gdbarch)->builtin_long));
1825 write_exp_elt_opcode (pstate, UNOP_CAST);
1826
1827 write_exp_elt_opcode (pstate, UNOP_IND);
1828 }
1829 }
1830
1831 static void
1832 amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
1833 {
1834 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1835
1836 linux_init_abi (info, gdbarch);
1837
1838 tdep->sigtramp_p = amd64_linux_sigtramp_p;
1839 tdep->sigcontext_addr = amd64_linux_sigcontext_addr;
1840 tdep->sc_reg_offset = amd64_linux_sc_reg_offset;
1841 tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset);
1842
1843 tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
1844
1845 /* Add the %orig_rax register used for syscall restarting. */
1846 set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc);
1847
1848 tdep->register_reggroup_p = amd64_linux_register_reggroup_p;
1849
1850 /* Functions for 'catch syscall'. */
1851 set_xml_syscall_file_name (gdbarch, XML_SYSCALL_FILENAME_AMD64);
1852 set_gdbarch_get_syscall_number (gdbarch,
1853 amd64_linux_get_syscall_number);
1854
1855 /* Enable TLS support. */
1856 set_gdbarch_fetch_tls_load_module_address (gdbarch,
1857 svr4_fetch_objfile_link_map);
1858
1859 /* GNU/Linux uses SVR4-style shared libraries. */
1860 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
1861
1862 /* GNU/Linux uses the dynamic linker included in the GNU C Library. */
1863 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
1864
1865 /* Iterate over core file register note sections. */
1866 set_gdbarch_iterate_over_regset_sections
1867 (gdbarch, amd64_linux_iterate_over_regset_sections);
1868
1869 set_gdbarch_core_read_description (gdbarch,
1870 amd64_linux_core_read_description);
1871
1872 /* Displaced stepping. */
1873 set_gdbarch_displaced_step_copy_insn (gdbarch,
1874 amd64_displaced_step_copy_insn);
1875 set_gdbarch_displaced_step_fixup (gdbarch, amd64_displaced_step_fixup);
1876 set_gdbarch_displaced_step_location (gdbarch,
1877 linux_displaced_step_location);
1878
1879 set_gdbarch_process_record (gdbarch, i386_process_record);
1880 set_gdbarch_process_record_signal (gdbarch, amd64_linux_record_signal);
1881
1882 set_gdbarch_get_siginfo_type (gdbarch, x86_linux_get_siginfo_type);
1883 set_gdbarch_handle_segmentation_fault (gdbarch,
1884 i386_linux_handle_segmentation_fault);
1885 }
1886
1887 static void
1888 amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
1889 {
1890 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1891 struct tdesc_arch_data *tdesc_data = info.tdesc_data;
1892 const struct tdesc_feature *feature;
1893 int valid_p;
1894
1895 gdb_assert (tdesc_data);
1896
1897 tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
1898 tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
1899 tdep->sizeof_gregset = 27 * 8;
1900
1901 amd64_init_abi (info, gdbarch,
1902 amd64_linux_read_description (X86_XSTATE_SSE_MASK, false));
1903
1904 const target_desc *tdesc = tdep->tdesc;
1905
1906 /* Reserve a number for orig_rax. */
1907 set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS);
1908
1909 feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
1910 if (feature == NULL)
1911 return;
1912
1913 valid_p = tdesc_numbered_register (feature, tdesc_data,
1914 AMD64_LINUX_ORIG_RAX_REGNUM,
1915 "orig_rax");
1916 if (!valid_p)
1917 return;
1918
1919 amd64_linux_init_abi_common (info, gdbarch);
1920
1921 /* Initialize the amd64_linux_record_tdep. */
1922 /* These values are the size of the type that will be used in a system
1923 call. They are obtained from Linux Kernel source. */
1924 amd64_linux_record_tdep.size_pointer
1925 = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
1926 amd64_linux_record_tdep.size__old_kernel_stat = 32;
1927 amd64_linux_record_tdep.size_tms = 32;
1928 amd64_linux_record_tdep.size_loff_t = 8;
1929 amd64_linux_record_tdep.size_flock = 32;
1930 amd64_linux_record_tdep.size_oldold_utsname = 45;
1931 amd64_linux_record_tdep.size_ustat = 32;
1932 /* ADM64 doesn't need this size because it doesn't have sys_sigaction
1933 but sys_rt_sigaction. */
1934 amd64_linux_record_tdep.size_old_sigaction = 32;
1935 /* ADM64 doesn't need this size because it doesn't have sys_sigpending
1936 but sys_rt_sigpending. */
1937 amd64_linux_record_tdep.size_old_sigset_t = 8;
1938 amd64_linux_record_tdep.size_rlimit = 16;
1939 amd64_linux_record_tdep.size_rusage = 144;
1940 amd64_linux_record_tdep.size_timeval = 16;
1941 amd64_linux_record_tdep.size_timezone = 8;
1942 /* ADM64 doesn't need this size because it doesn't have sys_getgroups16
1943 but sys_getgroups. */
1944 amd64_linux_record_tdep.size_old_gid_t = 2;
1945 /* ADM64 doesn't need this size because it doesn't have sys_getresuid16
1946 but sys_getresuid. */
1947 amd64_linux_record_tdep.size_old_uid_t = 2;
1948 amd64_linux_record_tdep.size_fd_set = 128;
1949 /* ADM64 doesn't need this size because it doesn't have sys_readdir. */
1950 amd64_linux_record_tdep.size_old_dirent = 280;
1951 amd64_linux_record_tdep.size_statfs = 120;
1952 amd64_linux_record_tdep.size_statfs64 = 120;
1953 amd64_linux_record_tdep.size_sockaddr = 16;
1954 amd64_linux_record_tdep.size_int
1955 = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
1956 amd64_linux_record_tdep.size_long
1957 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1958 amd64_linux_record_tdep.size_ulong
1959 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
1960 amd64_linux_record_tdep.size_msghdr = 56;
1961 amd64_linux_record_tdep.size_itimerval = 32;
1962 amd64_linux_record_tdep.size_stat = 144;
1963 amd64_linux_record_tdep.size_old_utsname = 325;
1964 amd64_linux_record_tdep.size_sysinfo = 112;
1965 amd64_linux_record_tdep.size_msqid_ds = 120;
1966 amd64_linux_record_tdep.size_shmid_ds = 112;
1967 amd64_linux_record_tdep.size_new_utsname = 390;
1968 amd64_linux_record_tdep.size_timex = 208;
1969 amd64_linux_record_tdep.size_mem_dqinfo = 24;
1970 amd64_linux_record_tdep.size_if_dqblk = 72;
1971 amd64_linux_record_tdep.size_fs_quota_stat = 80;
1972 amd64_linux_record_tdep.size_timespec = 16;
1973 amd64_linux_record_tdep.size_pollfd = 8;
1974 amd64_linux_record_tdep.size_NFS_FHSIZE = 32;
1975 amd64_linux_record_tdep.size_knfsd_fh = 132;
1976 amd64_linux_record_tdep.size_TASK_COMM_LEN = 16;
1977 amd64_linux_record_tdep.size_sigaction = 32;
1978 amd64_linux_record_tdep.size_sigset_t = 8;
1979 amd64_linux_record_tdep.size_siginfo_t = 128;
1980 amd64_linux_record_tdep.size_cap_user_data_t = 8;
1981 amd64_linux_record_tdep.size_stack_t = 24;
1982 amd64_linux_record_tdep.size_off_t = 8;
1983 amd64_linux_record_tdep.size_stat64 = 144;
1984 amd64_linux_record_tdep.size_gid_t = 4;
1985 amd64_linux_record_tdep.size_uid_t = 4;
1986 amd64_linux_record_tdep.size_PAGE_SIZE = 4096;
1987 amd64_linux_record_tdep.size_flock64 = 32;
1988 amd64_linux_record_tdep.size_user_desc = 16;
1989 amd64_linux_record_tdep.size_io_event = 32;
1990 amd64_linux_record_tdep.size_iocb = 64;
1991 amd64_linux_record_tdep.size_epoll_event = 12;
1992 amd64_linux_record_tdep.size_itimerspec = 32;
1993 amd64_linux_record_tdep.size_mq_attr = 64;
1994 amd64_linux_record_tdep.size_termios = 36;
1995 amd64_linux_record_tdep.size_termios2 = 44;
1996 amd64_linux_record_tdep.size_pid_t = 4;
1997 amd64_linux_record_tdep.size_winsize = 8;
1998 amd64_linux_record_tdep.size_serial_struct = 72;
1999 amd64_linux_record_tdep.size_serial_icounter_struct = 80;
2000 amd64_linux_record_tdep.size_hayes_esp_config = 12;
2001 amd64_linux_record_tdep.size_size_t = 8;
2002 amd64_linux_record_tdep.size_iovec = 16;
2003 amd64_linux_record_tdep.size_time_t = 8;
2004
2005 /* These values are the second argument of system call "sys_fcntl"
2006 and "sys_fcntl64". They are obtained from Linux Kernel source. */
2007 amd64_linux_record_tdep.fcntl_F_GETLK = 5;
2008 amd64_linux_record_tdep.fcntl_F_GETLK64 = 12;
2009 amd64_linux_record_tdep.fcntl_F_SETLK64 = 13;
2010 amd64_linux_record_tdep.fcntl_F_SETLKW64 = 14;
2011
2012 amd64_linux_record_tdep.arg1 = AMD64_RDI_REGNUM;
2013 amd64_linux_record_tdep.arg2 = AMD64_RSI_REGNUM;
2014 amd64_linux_record_tdep.arg3 = AMD64_RDX_REGNUM;
2015 amd64_linux_record_tdep.arg4 = AMD64_R10_REGNUM;
2016 amd64_linux_record_tdep.arg5 = AMD64_R8_REGNUM;
2017 amd64_linux_record_tdep.arg6 = AMD64_R9_REGNUM;
2018
2019 /* These values are the second argument of system call "sys_ioctl".
2020 They are obtained from Linux Kernel source. */
2021 amd64_linux_record_tdep.ioctl_TCGETS = 0x5401;
2022 amd64_linux_record_tdep.ioctl_TCSETS = 0x5402;
2023 amd64_linux_record_tdep.ioctl_TCSETSW = 0x5403;
2024 amd64_linux_record_tdep.ioctl_TCSETSF = 0x5404;
2025 amd64_linux_record_tdep.ioctl_TCGETA = 0x5405;
2026 amd64_linux_record_tdep.ioctl_TCSETA = 0x5406;
2027 amd64_linux_record_tdep.ioctl_TCSETAW = 0x5407;
2028 amd64_linux_record_tdep.ioctl_TCSETAF = 0x5408;
2029 amd64_linux_record_tdep.ioctl_TCSBRK = 0x5409;
2030 amd64_linux_record_tdep.ioctl_TCXONC = 0x540A;
2031 amd64_linux_record_tdep.ioctl_TCFLSH = 0x540B;
2032 amd64_linux_record_tdep.ioctl_TIOCEXCL = 0x540C;
2033 amd64_linux_record_tdep.ioctl_TIOCNXCL = 0x540D;
2034 amd64_linux_record_tdep.ioctl_TIOCSCTTY = 0x540E;
2035 amd64_linux_record_tdep.ioctl_TIOCGPGRP = 0x540F;
2036 amd64_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
2037 amd64_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
2038 amd64_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
2039 amd64_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
2040 amd64_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
2041 amd64_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
2042 amd64_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
2043 amd64_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
2044 amd64_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
2045 amd64_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
2046 amd64_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A;
2047 amd64_linux_record_tdep.ioctl_FIONREAD = 0x541B;
2048 amd64_linux_record_tdep.ioctl_TIOCINQ
2049 = amd64_linux_record_tdep.ioctl_FIONREAD;
2050 amd64_linux_record_tdep.ioctl_TIOCLINUX = 0x541C;
2051 amd64_linux_record_tdep.ioctl_TIOCCONS = 0x541D;
2052 amd64_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E;
2053 amd64_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541F;
2054 amd64_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
2055 amd64_linux_record_tdep.ioctl_FIONBIO = 0x5421;
2056 amd64_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
2057 amd64_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
2058 amd64_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
2059 amd64_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
2060 amd64_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
2061 amd64_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
2062 amd64_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
2063 amd64_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
2064 amd64_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
2065 amd64_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
2066 amd64_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
2067 amd64_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
2068 amd64_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
2069 amd64_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
2070 amd64_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
2071 amd64_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
2072 amd64_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
2073 amd64_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
2074 amd64_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
2075 amd64_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
2076 amd64_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
2077 amd64_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
2078 amd64_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
2079 amd64_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
2080 amd64_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545A;
2081 amd64_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545B;
2082 amd64_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545C;
2083 amd64_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545D;
2084 amd64_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545E;
2085 amd64_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545F;
2086 amd64_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
2087
2088 tdep->i386_syscall_record = amd64_linux_syscall_record;
2089
2090 /* GNU/Linux uses SVR4-style shared libraries. */
2091 set_solib_svr4_fetch_link_map_offsets
2092 (gdbarch, svr4_lp64_fetch_link_map_offsets);
2093
2094 /* Register DTrace handlers. */
2095 set_gdbarch_dtrace_parse_probe_argument (gdbarch, amd64_dtrace_parse_probe_argument);
2096 set_gdbarch_dtrace_probe_is_enabled (gdbarch, amd64_dtrace_probe_is_enabled);
2097 set_gdbarch_dtrace_enable_probe (gdbarch, amd64_dtrace_enable_probe);
2098 set_gdbarch_dtrace_disable_probe (gdbarch, amd64_dtrace_disable_probe);
2099 }
2100
2101 static void
2102 amd64_x32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
2103 {
2104 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
2105 struct tdesc_arch_data *tdesc_data = info.tdesc_data;
2106 const struct tdesc_feature *feature;
2107 int valid_p;
2108
2109 gdb_assert (tdesc_data);
2110
2111 tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
2112 tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
2113 tdep->sizeof_gregset = 27 * 8;
2114
2115 amd64_x32_init_abi (info, gdbarch,
2116 amd64_linux_read_description (X86_XSTATE_SSE_MASK,
2117 true));
2118
2119 /* Reserve a number for orig_rax. */
2120 set_gdbarch_num_regs (gdbarch, AMD64_LINUX_NUM_REGS);
2121
2122 const target_desc *tdesc = tdep->tdesc;
2123
2124 feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
2125 if (feature == NULL)
2126 return;
2127
2128 valid_p = tdesc_numbered_register (feature, tdesc_data,
2129 AMD64_LINUX_ORIG_RAX_REGNUM,
2130 "orig_rax");
2131 if (!valid_p)
2132 return;
2133
2134 amd64_linux_init_abi_common (info, gdbarch);
2135
2136 /* Initialize the amd64_x32_linux_record_tdep. */
2137 /* These values are the size of the type that will be used in a system
2138 call. They are obtained from Linux Kernel source. */
2139 amd64_x32_linux_record_tdep.size_pointer
2140 = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
2141 amd64_x32_linux_record_tdep.size__old_kernel_stat = 32;
2142 amd64_x32_linux_record_tdep.size_tms = 32;
2143 amd64_x32_linux_record_tdep.size_loff_t = 8;
2144 amd64_x32_linux_record_tdep.size_flock = 32;
2145 amd64_x32_linux_record_tdep.size_oldold_utsname = 45;
2146 amd64_x32_linux_record_tdep.size_ustat = 32;
2147 /* ADM64 doesn't need this size because it doesn't have sys_sigaction
2148 but sys_rt_sigaction. */
2149 amd64_x32_linux_record_tdep.size_old_sigaction = 16;
2150 /* ADM64 doesn't need this size because it doesn't have sys_sigpending
2151 but sys_rt_sigpending. */
2152 amd64_x32_linux_record_tdep.size_old_sigset_t = 4;
2153 amd64_x32_linux_record_tdep.size_rlimit = 16;
2154 amd64_x32_linux_record_tdep.size_rusage = 144;
2155 amd64_x32_linux_record_tdep.size_timeval = 16;
2156 amd64_x32_linux_record_tdep.size_timezone = 8;
2157 /* ADM64 doesn't need this size because it doesn't have sys_getgroups16
2158 but sys_getgroups. */
2159 amd64_x32_linux_record_tdep.size_old_gid_t = 2;
2160 /* ADM64 doesn't need this size because it doesn't have sys_getresuid16
2161 but sys_getresuid. */
2162 amd64_x32_linux_record_tdep.size_old_uid_t = 2;
2163 amd64_x32_linux_record_tdep.size_fd_set = 128;
2164 /* ADM64 doesn't need this size because it doesn't have sys_readdir. */
2165 amd64_x32_linux_record_tdep.size_old_dirent = 268;
2166 amd64_x32_linux_record_tdep.size_statfs = 120;
2167 amd64_x32_linux_record_tdep.size_statfs64 = 120;
2168 amd64_x32_linux_record_tdep.size_sockaddr = 16;
2169 amd64_x32_linux_record_tdep.size_int
2170 = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
2171 amd64_x32_linux_record_tdep.size_long
2172 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
2173 amd64_x32_linux_record_tdep.size_ulong
2174 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
2175 amd64_x32_linux_record_tdep.size_msghdr = 28;
2176 amd64_x32_linux_record_tdep.size_itimerval = 32;
2177 amd64_x32_linux_record_tdep.size_stat = 144;
2178 amd64_x32_linux_record_tdep.size_old_utsname = 325;
2179 amd64_x32_linux_record_tdep.size_sysinfo = 112;
2180 amd64_x32_linux_record_tdep.size_msqid_ds = 120;
2181 amd64_x32_linux_record_tdep.size_shmid_ds = 112;
2182 amd64_x32_linux_record_tdep.size_new_utsname = 390;
2183 amd64_x32_linux_record_tdep.size_timex = 208;
2184 amd64_x32_linux_record_tdep.size_mem_dqinfo = 24;
2185 amd64_x32_linux_record_tdep.size_if_dqblk = 72;
2186 amd64_x32_linux_record_tdep.size_fs_quota_stat = 80;
2187 amd64_x32_linux_record_tdep.size_timespec = 16;
2188 amd64_x32_linux_record_tdep.size_pollfd = 8;
2189 amd64_x32_linux_record_tdep.size_NFS_FHSIZE = 32;
2190 amd64_x32_linux_record_tdep.size_knfsd_fh = 132;
2191 amd64_x32_linux_record_tdep.size_TASK_COMM_LEN = 16;
2192 amd64_x32_linux_record_tdep.size_sigaction = 20;
2193 amd64_x32_linux_record_tdep.size_sigset_t = 8;
2194 amd64_x32_linux_record_tdep.size_siginfo_t = 128;
2195 amd64_x32_linux_record_tdep.size_cap_user_data_t = 8;
2196 amd64_x32_linux_record_tdep.size_stack_t = 12;
2197 amd64_x32_linux_record_tdep.size_off_t = 8;
2198 amd64_x32_linux_record_tdep.size_stat64 = 144;
2199 amd64_x32_linux_record_tdep.size_gid_t = 4;
2200 amd64_x32_linux_record_tdep.size_uid_t = 4;
2201 amd64_x32_linux_record_tdep.size_PAGE_SIZE = 4096;
2202 amd64_x32_linux_record_tdep.size_flock64 = 32;
2203 amd64_x32_linux_record_tdep.size_user_desc = 16;
2204 amd64_x32_linux_record_tdep.size_io_event = 32;
2205 amd64_x32_linux_record_tdep.size_iocb = 64;
2206 amd64_x32_linux_record_tdep.size_epoll_event = 12;
2207 amd64_x32_linux_record_tdep.size_itimerspec = 32;
2208 amd64_x32_linux_record_tdep.size_mq_attr = 64;
2209 amd64_x32_linux_record_tdep.size_termios = 36;
2210 amd64_x32_linux_record_tdep.size_termios2 = 44;
2211 amd64_x32_linux_record_tdep.size_pid_t = 4;
2212 amd64_x32_linux_record_tdep.size_winsize = 8;
2213 amd64_x32_linux_record_tdep.size_serial_struct = 72;
2214 amd64_x32_linux_record_tdep.size_serial_icounter_struct = 80;
2215 amd64_x32_linux_record_tdep.size_hayes_esp_config = 12;
2216 amd64_x32_linux_record_tdep.size_size_t = 4;
2217 amd64_x32_linux_record_tdep.size_iovec = 8;
2218 amd64_x32_linux_record_tdep.size_time_t = 8;
2219
2220 /* These values are the second argument of system call "sys_fcntl"
2221 and "sys_fcntl64". They are obtained from Linux Kernel source. */
2222 amd64_x32_linux_record_tdep.fcntl_F_GETLK = 5;
2223 amd64_x32_linux_record_tdep.fcntl_F_GETLK64 = 12;
2224 amd64_x32_linux_record_tdep.fcntl_F_SETLK64 = 13;
2225 amd64_x32_linux_record_tdep.fcntl_F_SETLKW64 = 14;
2226
2227 amd64_x32_linux_record_tdep.arg1 = AMD64_RDI_REGNUM;
2228 amd64_x32_linux_record_tdep.arg2 = AMD64_RSI_REGNUM;
2229 amd64_x32_linux_record_tdep.arg3 = AMD64_RDX_REGNUM;
2230 amd64_x32_linux_record_tdep.arg4 = AMD64_R10_REGNUM;
2231 amd64_x32_linux_record_tdep.arg5 = AMD64_R8_REGNUM;
2232 amd64_x32_linux_record_tdep.arg6 = AMD64_R9_REGNUM;
2233
2234 /* These values are the second argument of system call "sys_ioctl".
2235 They are obtained from Linux Kernel source. */
2236 amd64_x32_linux_record_tdep.ioctl_TCGETS = 0x5401;
2237 amd64_x32_linux_record_tdep.ioctl_TCSETS = 0x5402;
2238 amd64_x32_linux_record_tdep.ioctl_TCSETSW = 0x5403;
2239 amd64_x32_linux_record_tdep.ioctl_TCSETSF = 0x5404;
2240 amd64_x32_linux_record_tdep.ioctl_TCGETA = 0x5405;
2241 amd64_x32_linux_record_tdep.ioctl_TCSETA = 0x5406;
2242 amd64_x32_linux_record_tdep.ioctl_TCSETAW = 0x5407;
2243 amd64_x32_linux_record_tdep.ioctl_TCSETAF = 0x5408;
2244 amd64_x32_linux_record_tdep.ioctl_TCSBRK = 0x5409;
2245 amd64_x32_linux_record_tdep.ioctl_TCXONC = 0x540A;
2246 amd64_x32_linux_record_tdep.ioctl_TCFLSH = 0x540B;
2247 amd64_x32_linux_record_tdep.ioctl_TIOCEXCL = 0x540C;
2248 amd64_x32_linux_record_tdep.ioctl_TIOCNXCL = 0x540D;
2249 amd64_x32_linux_record_tdep.ioctl_TIOCSCTTY = 0x540E;
2250 amd64_x32_linux_record_tdep.ioctl_TIOCGPGRP = 0x540F;
2251 amd64_x32_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
2252 amd64_x32_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
2253 amd64_x32_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
2254 amd64_x32_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
2255 amd64_x32_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
2256 amd64_x32_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
2257 amd64_x32_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
2258 amd64_x32_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
2259 amd64_x32_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
2260 amd64_x32_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
2261 amd64_x32_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A;
2262 amd64_x32_linux_record_tdep.ioctl_FIONREAD = 0x541B;
2263 amd64_x32_linux_record_tdep.ioctl_TIOCINQ = amd64_x32_linux_record_tdep.ioctl_FIONREAD;
2264 amd64_x32_linux_record_tdep.ioctl_TIOCLINUX = 0x541C;
2265 amd64_x32_linux_record_tdep.ioctl_TIOCCONS = 0x541D;
2266 amd64_x32_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E;
2267 amd64_x32_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541F;
2268 amd64_x32_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
2269 amd64_x32_linux_record_tdep.ioctl_FIONBIO = 0x5421;
2270 amd64_x32_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
2271 amd64_x32_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
2272 amd64_x32_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
2273 amd64_x32_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
2274 amd64_x32_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
2275 amd64_x32_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
2276 amd64_x32_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
2277 amd64_x32_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
2278 amd64_x32_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
2279 amd64_x32_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
2280 amd64_x32_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
2281 amd64_x32_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
2282 amd64_x32_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
2283 amd64_x32_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
2284 amd64_x32_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
2285 amd64_x32_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
2286 amd64_x32_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
2287 amd64_x32_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
2288 amd64_x32_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
2289 amd64_x32_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
2290 amd64_x32_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
2291 amd64_x32_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
2292 amd64_x32_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
2293 amd64_x32_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
2294 amd64_x32_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545A;
2295 amd64_x32_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545B;
2296 amd64_x32_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545C;
2297 amd64_x32_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545D;
2298 amd64_x32_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545E;
2299 amd64_x32_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545F;
2300 amd64_x32_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
2301
2302 tdep->i386_syscall_record = amd64_x32_linux_syscall_record;
2303
2304 /* GNU/Linux uses SVR4-style shared libraries. */
2305 set_solib_svr4_fetch_link_map_offsets
2306 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
2307 }
2308 \f
2309
2310 /* Provide a prototype to silence -Wmissing-prototypes. */
2311 extern void _initialize_amd64_linux_tdep (void);
2312
2313 void
2314 _initialize_amd64_linux_tdep (void)
2315 {
2316 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
2317 GDB_OSABI_LINUX, amd64_linux_init_abi);
2318 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
2319 GDB_OSABI_LINUX, amd64_x32_linux_init_abi);
2320
2321 #if GDB_SELF_TEST
2322 struct
2323 {
2324 const char *xml;
2325 uint64_t mask;
2326 } xml_masks[] = {
2327 { "i386/amd64-linux.xml", X86_XSTATE_SSE_MASK },
2328 { "i386/amd64-avx-linux.xml", X86_XSTATE_AVX_MASK },
2329 { "i386/amd64-mpx-linux.xml", X86_XSTATE_MPX_MASK },
2330 { "i386/amd64-avx-mpx-linux.xml", X86_XSTATE_AVX_MPX_MASK },
2331 { "i386/amd64-avx-avx512-linux.xml", X86_XSTATE_AVX_AVX512_MASK },
2332 { "i386/amd64-avx-mpx-avx512-pku-linux.xml",
2333 X86_XSTATE_AVX_MPX_AVX512_PKU_MASK },
2334 { "i386/x32-linux.xml", X86_XSTATE_SSE_MASK },
2335 { "i386/x32-avx-linux.xml", X86_XSTATE_AVX_MASK },
2336 { "i386/x32-avx-avx512-linux.xml", X86_XSTATE_AVX_AVX512_MASK },
2337 };
2338
2339 for (auto &a : xml_masks)
2340 {
2341 auto tdesc = amd64_linux_read_description (a.mask,
2342 startswith (a.xml,
2343 "i386/x32"));
2344
2345 selftests::record_xml_tdesc (a.xml, tdesc);
2346 }
2347 #endif /* GDB_SELF_TEST */
2348 }
This page took 0.132784 seconds and 4 git commands to generate.