Error in build_executable_own_libs for non-native target
[deliverable/binutils-gdb.git] / gdb / i386-linux-tdep.c
CommitLineData
871fbe6a 1/* Target-dependent code for GNU/Linux i386.
ca557f44 2
ecd75fc8 3 Copyright (C) 2000-2014 Free Software Foundation, Inc.
e7ee86a9
JB
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
e7ee86a9
JB
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
e7ee86a9
JB
19
20#include "defs.h"
21#include "gdbcore.h"
22#include "frame.h"
23#include "value.h"
4e052eda 24#include "regcache.h"
c131fcee 25#include "regset.h"
6441c4a0 26#include "inferior.h"
0670c0aa 27#include "osabi.h"
38c968cf 28#include "reggroups.h"
5cb2fe25 29#include "dwarf2-frame.h"
8201327c
MK
30#include "i386-tdep.h"
31#include "i386-linux-tdep.h"
4aa995e1 32#include "linux-tdep.h"
0670c0aa 33#include "glibc-tdep.h"
871fbe6a 34#include "solib-svr4.h"
982e9687 35#include "symtab.h"
237fc4c9 36#include "arch-utils.h"
a96d9b2e
SDJ
37#include "xml-syscall.h"
38
c131fcee 39#include "i387-tdep.h"
df7e5265 40#include "x86-xstate.h"
c131fcee 41
a96d9b2e
SDJ
42/* The syscall's XML filename for i386. */
43#define XML_SYSCALL_FILENAME_I386 "syscalls/i386-linux.xml"
17ea7499 44
d02ed0bb 45#include "record-full.h"
77fcef51
HZ
46#include "linux-record.h"
47#include <stdint.h>
48
90884b2b 49#include "features/i386/i386-linux.c"
3a13a53b 50#include "features/i386/i386-mmx-linux.c"
1dbcd68c 51#include "features/i386/i386-mpx-linux.c"
c131fcee 52#include "features/i386/i386-avx-linux.c"
01f9f808 53#include "features/i386/i386-avx512-linux.c"
90884b2b 54
17ea7499
CES
55/* Supported register note sections. */
56static struct core_regset_section i386_linux_regset_sections[] =
57{
e0e0e543 58 { ".reg", 68, "general-purpose" },
1b1818e4 59 { ".reg2", 108, "floating-point" },
4ac5d44e
MK
60 { NULL, 0 }
61};
62
63static struct core_regset_section i386_linux_sse_regset_sections[] =
64{
e0e0e543 65 { ".reg", 68, "general-purpose" },
1b1818e4 66 { ".reg-xfp", 512, "extended floating-point" },
4ac5d44e
MK
67 { NULL, 0 }
68};
69
70static struct core_regset_section i386_linux_avx_regset_sections[] =
71{
e0e0e543 72 { ".reg", 68, "general-purpose" },
df7e5265 73 { ".reg-xstate", X86_XSTATE_MAX_SIZE, "XSAVE extended state" },
17ea7499
CES
74 { NULL, 0 }
75};
8201327c 76
38c968cf
AC
77/* Return non-zero, when the register is in the corresponding register
78 group. Put the LINUX_ORIG_EAX register in the system group. */
79static int
80i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
81 struct reggroup *group)
82{
83 if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
84 return (group == system_reggroup
85 || group == save_reggroup
86 || group == restore_reggroup);
87 return i386_register_reggroup_p (gdbarch, regnum, group);
88}
89
e7ee86a9
JB
90\f
91/* Recognizing signal handler frames. */
92
ca557f44 93/* GNU/Linux has two flavors of signals. Normal signal handlers, and
e7ee86a9
JB
94 "realtime" (RT) signals. The RT signals can provide additional
95 information to the signal handler if the SA_SIGINFO flag is set
96 when establishing a signal handler using `sigaction'. It is not
ca557f44
AC
97 unlikely that future versions of GNU/Linux will support SA_SIGINFO
98 for normal signals too. */
e7ee86a9
JB
99
100/* When the i386 Linux kernel calls a signal handler and the
101 SA_RESTORER flag isn't set, the return address points to a bit of
102 code on the stack. This function returns whether the PC appears to
103 be within this bit of code.
104
105 The instruction sequence for normal signals is
106 pop %eax
acd5c798 107 mov $0x77, %eax
e7ee86a9
JB
108 int $0x80
109 or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
110
111 Checking for the code sequence should be somewhat reliable, because
112 the effect is to call the system call sigreturn. This is unlikely
911bc6ee 113 to occur anywhere other than in a signal trampoline.
e7ee86a9
JB
114
115 It kind of sucks that we have to read memory from the process in
116 order to identify a signal trampoline, but there doesn't seem to be
911bc6ee
MK
117 any other way. Therefore we only do the memory reads if no
118 function name could be identified, which should be the case since
119 the code is on the stack.
e7ee86a9
JB
120
121 Detection of signal trampolines for handlers that set the
122 SA_RESTORER flag is in general not possible. Unfortunately this is
123 what the GNU C Library has been doing for quite some time now.
124 However, as of version 2.1.2, the GNU C Library uses signal
125 trampolines (named __restore and __restore_rt) that are identical
126 to the ones used by the kernel. Therefore, these trampolines are
127 supported too. */
128
acd5c798
MK
129#define LINUX_SIGTRAMP_INSN0 0x58 /* pop %eax */
130#define LINUX_SIGTRAMP_OFFSET0 0
131#define LINUX_SIGTRAMP_INSN1 0xb8 /* mov $NNNN, %eax */
132#define LINUX_SIGTRAMP_OFFSET1 1
133#define LINUX_SIGTRAMP_INSN2 0xcd /* int */
134#define LINUX_SIGTRAMP_OFFSET2 6
e7ee86a9 135
4252dc94 136static const gdb_byte linux_sigtramp_code[] =
e7ee86a9
JB
137{
138 LINUX_SIGTRAMP_INSN0, /* pop %eax */
acd5c798 139 LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
e7ee86a9
JB
140 LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
141};
142
143#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
144
10458914
DJ
145/* If THIS_FRAME is a sigtramp routine, return the address of the
146 start of the routine. Otherwise, return 0. */
e7ee86a9
JB
147
148static CORE_ADDR
10458914 149i386_linux_sigtramp_start (struct frame_info *this_frame)
e7ee86a9 150{
10458914 151 CORE_ADDR pc = get_frame_pc (this_frame);
4252dc94 152 gdb_byte buf[LINUX_SIGTRAMP_LEN];
e7ee86a9
JB
153
154 /* We only recognize a signal trampoline if PC is at the start of
155 one of the three instructions. We optimize for finding the PC at
156 the start, as will be the case when the trampoline is not the
157 first frame on the stack. We assume that in the case where the
158 PC is not at the start of the instruction sequence, there will be
159 a few trailing readable bytes on the stack. */
160
10458914 161 if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
e7ee86a9
JB
162 return 0;
163
164 if (buf[0] != LINUX_SIGTRAMP_INSN0)
165 {
166 int adjust;
167
168 switch (buf[0])
169 {
170 case LINUX_SIGTRAMP_INSN1:
171 adjust = LINUX_SIGTRAMP_OFFSET1;
172 break;
173 case LINUX_SIGTRAMP_INSN2:
174 adjust = LINUX_SIGTRAMP_OFFSET2;
175 break;
176 default:
177 return 0;
178 }
179
180 pc -= adjust;
181
10458914 182 if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_SIGTRAMP_LEN))
e7ee86a9
JB
183 return 0;
184 }
185
186 if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
187 return 0;
188
189 return pc;
190}
191
192/* This function does the same for RT signals. Here the instruction
193 sequence is
acd5c798 194 mov $0xad, %eax
e7ee86a9
JB
195 int $0x80
196 or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
197
198 The effect is to call the system call rt_sigreturn. */
199
acd5c798
MK
200#define LINUX_RT_SIGTRAMP_INSN0 0xb8 /* mov $NNNN, %eax */
201#define LINUX_RT_SIGTRAMP_OFFSET0 0
202#define LINUX_RT_SIGTRAMP_INSN1 0xcd /* int */
203#define LINUX_RT_SIGTRAMP_OFFSET1 5
e7ee86a9 204
4252dc94 205static const gdb_byte linux_rt_sigtramp_code[] =
e7ee86a9 206{
acd5c798 207 LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
e7ee86a9
JB
208 LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
209};
210
211#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
212
10458914
DJ
213/* If THIS_FRAME is an RT sigtramp routine, return the address of the
214 start of the routine. Otherwise, return 0. */
e7ee86a9
JB
215
216static CORE_ADDR
10458914 217i386_linux_rt_sigtramp_start (struct frame_info *this_frame)
e7ee86a9 218{
10458914 219 CORE_ADDR pc = get_frame_pc (this_frame);
4252dc94 220 gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
e7ee86a9
JB
221
222 /* We only recognize a signal trampoline if PC is at the start of
223 one of the two instructions. We optimize for finding the PC at
224 the start, as will be the case when the trampoline is not the
225 first frame on the stack. We assume that in the case where the
226 PC is not at the start of the instruction sequence, there will be
227 a few trailing readable bytes on the stack. */
228
10458914 229 if (!safe_frame_unwind_memory (this_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
e7ee86a9
JB
230 return 0;
231
232 if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
233 {
234 if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
235 return 0;
236
237 pc -= LINUX_RT_SIGTRAMP_OFFSET1;
238
10458914 239 if (!safe_frame_unwind_memory (this_frame, pc, buf,
8e6bed05 240 LINUX_RT_SIGTRAMP_LEN))
e7ee86a9
JB
241 return 0;
242 }
243
244 if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
245 return 0;
246
247 return pc;
248}
249
10458914
DJ
250/* Return whether THIS_FRAME corresponds to a GNU/Linux sigtramp
251 routine. */
e7ee86a9 252
8201327c 253static int
10458914 254i386_linux_sigtramp_p (struct frame_info *this_frame)
e7ee86a9 255{
10458914 256 CORE_ADDR pc = get_frame_pc (this_frame);
2c02bd72 257 const char *name;
911bc6ee
MK
258
259 find_pc_partial_function (pc, &name, NULL, NULL);
260
ef17e74b
DJ
261 /* If we have NAME, we can optimize the search. The trampolines are
262 named __restore and __restore_rt. However, they aren't dynamically
263 exported from the shared C library, so the trampoline may appear to
264 be part of the preceding function. This should always be sigaction,
265 __sigaction, or __libc_sigaction (all aliases to the same function). */
266 if (name == NULL || strstr (name, "sigaction") != NULL)
10458914
DJ
267 return (i386_linux_sigtramp_start (this_frame) != 0
268 || i386_linux_rt_sigtramp_start (this_frame) != 0);
ef17e74b
DJ
269
270 return (strcmp ("__restore", name) == 0
271 || strcmp ("__restore_rt", name) == 0);
e7ee86a9
JB
272}
273
4a4e5149
DJ
274/* Return one if the PC of THIS_FRAME is in a signal trampoline which
275 may have DWARF-2 CFI. */
12b8a2cb
DJ
276
277static int
278i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
4a4e5149 279 struct frame_info *this_frame)
12b8a2cb 280{
4a4e5149 281 CORE_ADDR pc = get_frame_pc (this_frame);
2c02bd72 282 const char *name;
12b8a2cb
DJ
283
284 find_pc_partial_function (pc, &name, NULL, NULL);
285
286 /* If a vsyscall DSO is in use, the signal trampolines may have these
287 names. */
288 if (name && (strcmp (name, "__kernel_sigreturn") == 0
289 || strcmp (name, "__kernel_rt_sigreturn") == 0))
290 return 1;
291
292 return 0;
293}
294
acd5c798
MK
295/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
296#define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
297
10458914
DJ
298/* Assuming THIS_FRAME is a GNU/Linux sigtramp routine, return the
299 address of the associated sigcontext structure. */
e7ee86a9 300
b7d15bf7 301static CORE_ADDR
10458914 302i386_linux_sigcontext_addr (struct frame_info *this_frame)
e7ee86a9 303{
e17a4113
UW
304 struct gdbarch *gdbarch = get_frame_arch (this_frame);
305 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
e7ee86a9 306 CORE_ADDR pc;
acd5c798 307 CORE_ADDR sp;
4252dc94 308 gdb_byte buf[4];
acd5c798 309
10458914 310 get_frame_register (this_frame, I386_ESP_REGNUM, buf);
e17a4113 311 sp = extract_unsigned_integer (buf, 4, byte_order);
e7ee86a9 312
10458914 313 pc = i386_linux_sigtramp_start (this_frame);
e7ee86a9
JB
314 if (pc)
315 {
acd5c798
MK
316 /* The sigcontext structure lives on the stack, right after
317 the signum argument. We determine the address of the
318 sigcontext structure by looking at the frame's stack
319 pointer. Keep in mind that the first instruction of the
320 sigtramp code is "pop %eax". If the PC is after this
321 instruction, adjust the returned value accordingly. */
10458914 322 if (pc == get_frame_pc (this_frame))
e7ee86a9
JB
323 return sp + 4;
324 return sp;
325 }
326
10458914 327 pc = i386_linux_rt_sigtramp_start (this_frame);
e7ee86a9
JB
328 if (pc)
329 {
acd5c798
MK
330 CORE_ADDR ucontext_addr;
331
332 /* The sigcontext structure is part of the user context. A
333 pointer to the user context is passed as the third argument
334 to the signal handler. */
335 read_memory (sp + 8, buf, 4);
e17a4113 336 ucontext_addr = extract_unsigned_integer (buf, 4, byte_order);
acd5c798 337 return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
e7ee86a9
JB
338 }
339
8a3fe4f8 340 error (_("Couldn't recognize signal trampoline."));
e7ee86a9
JB
341 return 0;
342}
343
6441c4a0
MK
344/* Set the program counter for process PTID to PC. */
345
8201327c 346static void
61a1198a 347i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
6441c4a0 348{
61a1198a 349 regcache_cooked_write_unsigned (regcache, I386_EIP_REGNUM, pc);
6441c4a0
MK
350
351 /* We must be careful with modifying the program counter. If we
352 just interrupted a system call, the kernel might try to restart
353 it when we resume the inferior. On restarting the system call,
354 the kernel will try backing up the program counter even though it
355 no longer points at the system call. This typically results in a
356 SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
357 "orig_eax" pseudo-register.
358
359 Note that "orig_eax" is saved when setting up a dummy call frame.
360 This means that it is properly restored when that frame is
361 popped, and that the interrupted system call will be restarted
362 when we resume the inferior on return from a function call from
363 within GDB. In all other cases the system call will not be
364 restarted. */
61a1198a 365 regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
6441c4a0 366}
77fcef51 367
8a2e0e28
HZ
368/* Record all registers but IP register for process-record. */
369
370static int
371i386_all_but_ip_registers_record (struct regcache *regcache)
372{
25ea693b 373 if (record_full_arch_list_add_reg (regcache, I386_EAX_REGNUM))
8a2e0e28 374 return -1;
25ea693b 375 if (record_full_arch_list_add_reg (regcache, I386_ECX_REGNUM))
8a2e0e28 376 return -1;
25ea693b 377 if (record_full_arch_list_add_reg (regcache, I386_EDX_REGNUM))
8a2e0e28 378 return -1;
25ea693b 379 if (record_full_arch_list_add_reg (regcache, I386_EBX_REGNUM))
8a2e0e28 380 return -1;
25ea693b 381 if (record_full_arch_list_add_reg (regcache, I386_ESP_REGNUM))
8a2e0e28 382 return -1;
25ea693b 383 if (record_full_arch_list_add_reg (regcache, I386_EBP_REGNUM))
8a2e0e28 384 return -1;
25ea693b 385 if (record_full_arch_list_add_reg (regcache, I386_ESI_REGNUM))
8a2e0e28 386 return -1;
25ea693b 387 if (record_full_arch_list_add_reg (regcache, I386_EDI_REGNUM))
8a2e0e28 388 return -1;
25ea693b 389 if (record_full_arch_list_add_reg (regcache, I386_EFLAGS_REGNUM))
8a2e0e28
HZ
390 return -1;
391
392 return 0;
393}
13b6d1d4
MS
394
395/* i386_canonicalize_syscall maps from the native i386 Linux set
396 of syscall ids into a canonical set of syscall ids used by
397 process record (a mostly trivial mapping, since the canonical
398 set was originally taken from the i386 set). */
399
400static enum gdb_syscall
401i386_canonicalize_syscall (int syscall)
402{
403 enum { i386_syscall_max = 499 };
404
405 if (syscall <= i386_syscall_max)
406 return syscall;
407 else
408 return -1;
409}
410
77fcef51
HZ
411/* Parse the arguments of current system call instruction and record
412 the values of the registers and memory that will be changed into
413 "record_arch_list". This instruction is "int 0x80" (Linux
414 Kernel2.4) or "sysenter" (Linux Kernel 2.6).
415
416 Return -1 if something wrong. */
417
8a2e0e28
HZ
418static struct linux_record_tdep i386_linux_record_tdep;
419
77fcef51 420static int
ffdf6de5 421i386_linux_intx80_sysenter_syscall_record (struct regcache *regcache)
77fcef51
HZ
422{
423 int ret;
13b6d1d4
MS
424 LONGEST syscall_native;
425 enum gdb_syscall syscall_gdb;
426
427 regcache_raw_read_signed (regcache, I386_EAX_REGNUM, &syscall_native);
77fcef51 428
13b6d1d4 429 syscall_gdb = i386_canonicalize_syscall (syscall_native);
2c543fc4 430
13b6d1d4 431 if (syscall_gdb < 0)
2c543fc4
HZ
432 {
433 printf_unfiltered (_("Process record and replay target doesn't "
13b6d1d4
MS
434 "support syscall number %s\n"),
435 plongest (syscall_native));
2c543fc4
HZ
436 return -1;
437 }
77fcef51 438
8a2e0e28
HZ
439 if (syscall_gdb == gdb_sys_sigreturn
440 || syscall_gdb == gdb_sys_rt_sigreturn)
441 {
442 if (i386_all_but_ip_registers_record (regcache))
443 return -1;
444 return 0;
445 }
446
13b6d1d4 447 ret = record_linux_system_call (syscall_gdb, regcache,
77fcef51
HZ
448 &i386_linux_record_tdep);
449 if (ret)
450 return ret;
451
452 /* Record the return value of the system call. */
25ea693b 453 if (record_full_arch_list_add_reg (regcache, I386_EAX_REGNUM))
77fcef51
HZ
454 return -1;
455
456 return 0;
457}
8a2e0e28
HZ
458
459#define I386_LINUX_xstate 270
460#define I386_LINUX_frame_size 732
461
70221824 462static int
8a2e0e28
HZ
463i386_linux_record_signal (struct gdbarch *gdbarch,
464 struct regcache *regcache,
2ea28649 465 enum gdb_signal signal)
8a2e0e28
HZ
466{
467 ULONGEST esp;
468
469 if (i386_all_but_ip_registers_record (regcache))
470 return -1;
471
25ea693b 472 if (record_full_arch_list_add_reg (regcache, I386_EIP_REGNUM))
8a2e0e28
HZ
473 return -1;
474
475 /* Record the change in the stack. */
476 regcache_raw_read_unsigned (regcache, I386_ESP_REGNUM, &esp);
477 /* This is for xstate.
478 sp -= sizeof (struct _fpstate); */
479 esp -= I386_LINUX_xstate;
480 /* This is for frame_size.
481 sp -= sizeof (struct rt_sigframe); */
482 esp -= I386_LINUX_frame_size;
25ea693b
MM
483 if (record_full_arch_list_add_mem (esp,
484 I386_LINUX_xstate + I386_LINUX_frame_size))
8a2e0e28
HZ
485 return -1;
486
25ea693b 487 if (record_full_arch_list_add_end ())
8a2e0e28
HZ
488 return -1;
489
490 return 0;
491}
6441c4a0 492\f
8201327c 493
9a7f938f
JK
494/* Core of the implementation for gdbarch get_syscall_number. Get pending
495 syscall number from REGCACHE. If there is no pending syscall -1 will be
496 returned. Pending syscall means ptrace has stepped into the syscall but
497 another ptrace call will step out. PC is right after the int $0x80
498 / syscall / sysenter instruction in both cases, PC does not change during
499 the second ptrace step. */
500
a96d9b2e 501static LONGEST
9a7f938f 502i386_linux_get_syscall_number_from_regcache (struct regcache *regcache)
a96d9b2e 503{
9a7f938f 504 struct gdbarch *gdbarch = get_regcache_arch (regcache);
a96d9b2e
SDJ
505 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
506 /* The content of a register. */
507 gdb_byte buf[4];
508 /* The result. */
509 LONGEST ret;
510
511 /* Getting the system call number from the register.
512 When dealing with x86 architecture, this information
513 is stored at %eax register. */
514 regcache_cooked_read (regcache, I386_LINUX_ORIG_EAX_REGNUM, buf);
515
516 ret = extract_signed_integer (buf, 4, byte_order);
517
518 return ret;
519}
520
9a7f938f
JK
521/* Wrapper for i386_linux_get_syscall_number_from_regcache to make it
522 compatible with gdbarch get_syscall_number method prototype. */
523
524static LONGEST
525i386_linux_get_syscall_number (struct gdbarch *gdbarch,
526 ptid_t ptid)
527{
528 struct regcache *regcache = get_thread_regcache (ptid);
529
530 return i386_linux_get_syscall_number_from_regcache (regcache);
531}
532
e9f1aad5
MK
533/* The register sets used in GNU/Linux ELF core-dumps are identical to
534 the register sets in `struct user' that are used for a.out
535 core-dumps. These are also used by ptrace(2). The corresponding
536 types are `elf_gregset_t' for the general-purpose registers (with
537 `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
538 for the floating-point registers.
539
540 Those types used to be available under the names `gregset_t' and
541 `fpregset_t' too, and GDB used those names in the past. But those
542 names are now used for the register sets used in the `mcontext_t'
543 type, which have a different size and layout. */
544
545/* Mapping between the general-purpose registers in `struct user'
546 format and GDB's register cache layout. */
547
548/* From <sys/reg.h>. */
be0d2954 549int i386_linux_gregset_reg_offset[] =
e9f1aad5
MK
550{
551 6 * 4, /* %eax */
552 1 * 4, /* %ecx */
553 2 * 4, /* %edx */
554 0 * 4, /* %ebx */
555 15 * 4, /* %esp */
556 5 * 4, /* %ebp */
557 3 * 4, /* %esi */
558 4 * 4, /* %edi */
559 12 * 4, /* %eip */
560 14 * 4, /* %eflags */
561 13 * 4, /* %cs */
562 16 * 4, /* %ss */
563 7 * 4, /* %ds */
564 8 * 4, /* %es */
565 9 * 4, /* %fs */
566 10 * 4, /* %gs */
567 -1, -1, -1, -1, -1, -1, -1, -1,
568 -1, -1, -1, -1, -1, -1, -1, -1,
569 -1, -1, -1, -1, -1, -1, -1, -1,
570 -1,
c131fcee 571 -1, -1, -1, -1, -1, -1, -1, -1,
01f9f808
MS
572 -1, -1, -1, -1, /* MPX registers BND0 ... BND3. */
573 -1, -1, /* MPX registers BNDCFGU, BNDSTATUS. */
574 -1, -1, -1, -1, -1, -1, -1, -1, /* k0 ... k7 (AVX512) */
575 -1, -1, -1, -1, -1, -1, -1, -1, /* zmm0 ... zmm7 (AVX512) */
576 11 * 4, /* "orig_eax" */
e9f1aad5
MK
577};
578
579/* Mapping between the general-purpose registers in `struct
580 sigcontext' format and GDB's register cache layout. */
581
a3386186 582/* From <asm/sigcontext.h>. */
bb489b3c 583static int i386_linux_sc_reg_offset[] =
a3386186
MK
584{
585 11 * 4, /* %eax */
586 10 * 4, /* %ecx */
587 9 * 4, /* %edx */
588 8 * 4, /* %ebx */
589 7 * 4, /* %esp */
590 6 * 4, /* %ebp */
591 5 * 4, /* %esi */
592 4 * 4, /* %edi */
593 14 * 4, /* %eip */
594 16 * 4, /* %eflags */
595 15 * 4, /* %cs */
596 18 * 4, /* %ss */
597 3 * 4, /* %ds */
598 2 * 4, /* %es */
599 1 * 4, /* %fs */
600 0 * 4 /* %gs */
601};
602
c131fcee
L
603/* Get XSAVE extended state xcr0 from core dump. */
604
605uint64_t
6df81a63 606i386_linux_core_read_xcr0 (bfd *abfd)
c131fcee
L
607{
608 asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate");
609 uint64_t xcr0;
610
611 if (xstate)
612 {
613 size_t size = bfd_section_size (abfd, xstate);
614
615 /* Check extended state size. */
df7e5265
GB
616 if (size < X86_XSTATE_AVX_SIZE)
617 xcr0 = X86_XSTATE_SSE_MASK;
c131fcee
L
618 else
619 {
620 char contents[8];
621
622 if (! bfd_get_section_contents (abfd, xstate, contents,
623 I386_LINUX_XSAVE_XCR0_OFFSET,
624 8))
625 {
1777feb0
MS
626 warning (_("Couldn't read `xcr0' bytes from "
627 "`.reg-xstate' section in core file."));
c131fcee
L
628 return 0;
629 }
630
631 xcr0 = bfd_get_64 (abfd, contents);
632 }
633 }
634 else
f335d1b3 635 xcr0 = 0;
c131fcee
L
636
637 return xcr0;
638}
639
90884b2b
L
640/* Get Linux/x86 target description from core dump. */
641
642static const struct target_desc *
643i386_linux_core_read_description (struct gdbarch *gdbarch,
644 struct target_ops *target,
645 bfd *abfd)
646{
90884b2b 647 /* Linux/i386. */
6df81a63 648 uint64_t xcr0 = i386_linux_core_read_xcr0 (abfd);
1dbcd68c 649
df7e5265 650 switch ((xcr0 & X86_XSTATE_ALL_MASK))
f335d1b3 651 {
df7e5265
GB
652 case X86_XSTATE_MPX_AVX512_MASK:
653 case X86_XSTATE_AVX512_MASK:
01f9f808 654 return tdesc_i386_avx512_linux;
df7e5265 655 case X86_XSTATE_MPX_MASK:
1dbcd68c 656 return tdesc_i386_mpx_linux;
df7e5265 657 case X86_XSTATE_AVX_MASK:
f335d1b3 658 return tdesc_i386_avx_linux;
df7e5265 659 case X86_XSTATE_SSE_MASK:
f335d1b3 660 return tdesc_i386_linux;
df7e5265 661 case X86_XSTATE_X87_MASK:
f335d1b3
L
662 return tdesc_i386_mmx_linux;
663 default:
664 break;
665 }
666
667 if (bfd_get_section_by_name (abfd, ".reg-xfp") != NULL)
c131fcee 668 return tdesc_i386_linux;
f335d1b3
L
669 else
670 return tdesc_i386_mmx_linux;
90884b2b
L
671}
672
9a7f938f
JK
673/* Linux kernel shows PC value after the 'int $0x80' instruction even if
674 inferior is still inside the syscall. On next PTRACE_SINGLESTEP it will
675 finish the syscall but PC will not change.
676
677 Some vDSOs contain 'int $0x80; ret' and during stepping out of the syscall
678 i386_displaced_step_fixup would keep PC at the displaced pad location.
679 As PC is pointing to the 'ret' instruction before the step
680 i386_displaced_step_fixup would expect inferior has just executed that 'ret'
681 and PC should not be adjusted. In reality it finished syscall instead and
682 PC should get relocated back to its vDSO address. Hide the 'ret'
683 instruction by 'nop' so that i386_displaced_step_fixup is not confused.
684
685 It is not fully correct as the bytes in struct displaced_step_closure will
686 not match the inferior code. But we would need some new flag in
687 displaced_step_closure otherwise to keep the state that syscall is finishing
688 for the later i386_displaced_step_fixup execution as the syscall execution
689 is already no longer detectable there. The new flag field would mean
690 i386-linux-tdep.c needs to wrap all the displacement methods of i386-tdep.c
691 which does not seem worth it. The same effect is achieved by patching that
692 'nop' instruction there instead. */
693
693be288 694static struct displaced_step_closure *
9a7f938f
JK
695i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
696 CORE_ADDR from, CORE_ADDR to,
697 struct regcache *regs)
698{
699 struct displaced_step_closure *closure;
700
701 closure = i386_displaced_step_copy_insn (gdbarch, from, to, regs);
702
703 if (i386_linux_get_syscall_number_from_regcache (regs) != -1)
704 {
705 /* Since we use simple_displaced_step_copy_insn, our closure is a
706 copy of the instruction. */
707 gdb_byte *insn = (gdb_byte *) closure;
708
709 /* Fake nop. */
710 insn[0] = 0x90;
711 }
712
713 return closure;
714}
715
8201327c
MK
716static void
717i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
718{
719 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
90884b2b
L
720 const struct target_desc *tdesc = info.target_desc;
721 struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
722 const struct tdesc_feature *feature;
723 int valid_p;
724
725 gdb_assert (tdesc_data);
8201327c 726
a5ee0f0c
PA
727 linux_init_abi (info, gdbarch);
728
8201327c
MK
729 /* GNU/Linux uses ELF. */
730 i386_elf_init_abi (info, gdbarch);
731
90884b2b
L
732 /* Reserve a number for orig_eax. */
733 set_gdbarch_num_regs (gdbarch, I386_LINUX_NUM_REGS);
734
735 if (! tdesc_has_registers (tdesc))
736 tdesc = tdesc_i386_linux;
737 tdep->tdesc = tdesc;
738
739 feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
740 if (feature == NULL)
741 return;
8201327c 742
90884b2b
L
743 valid_p = tdesc_numbered_register (feature, tdesc_data,
744 I386_LINUX_ORIG_EAX_REGNUM,
745 "orig_eax");
746 if (!valid_p)
747 return;
748
749 /* Add the %orig_eax register used for syscall restarting. */
8201327c 750 set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
90884b2b
L
751
752 tdep->register_reggroup_p = i386_linux_register_reggroup_p;
8201327c 753
e9f1aad5
MK
754 tdep->gregset_reg_offset = i386_linux_gregset_reg_offset;
755 tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset);
756 tdep->sizeof_gregset = 17 * 4;
757
8201327c
MK
758 tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
759
911bc6ee 760 tdep->sigtramp_p = i386_linux_sigtramp_p;
b7d15bf7 761 tdep->sigcontext_addr = i386_linux_sigcontext_addr;
a3386186 762 tdep->sc_reg_offset = i386_linux_sc_reg_offset;
bb489b3c 763 tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset);
8201327c 764
c131fcee
L
765 tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET;
766
a6b808b4 767 set_gdbarch_process_record (gdbarch, i386_process_record);
8a2e0e28 768 set_gdbarch_process_record_signal (gdbarch, i386_linux_record_signal);
a6b808b4 769
77fcef51 770 /* Initialize the i386_linux_record_tdep. */
5e31abdf
HZ
771 /* These values are the size of the type that will be used in a system
772 call. They are obtained from Linux Kernel source. */
2c543fc4
HZ
773 i386_linux_record_tdep.size_pointer
774 = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT;
5e31abdf
HZ
775 i386_linux_record_tdep.size__old_kernel_stat = 32;
776 i386_linux_record_tdep.size_tms = 16;
777 i386_linux_record_tdep.size_loff_t = 8;
778 i386_linux_record_tdep.size_flock = 16;
779 i386_linux_record_tdep.size_oldold_utsname = 45;
780 i386_linux_record_tdep.size_ustat = 20;
781 i386_linux_record_tdep.size_old_sigaction = 140;
782 i386_linux_record_tdep.size_old_sigset_t = 128;
783 i386_linux_record_tdep.size_rlimit = 8;
784 i386_linux_record_tdep.size_rusage = 72;
785 i386_linux_record_tdep.size_timeval = 8;
786 i386_linux_record_tdep.size_timezone = 8;
787 i386_linux_record_tdep.size_old_gid_t = 2;
788 i386_linux_record_tdep.size_old_uid_t = 2;
789 i386_linux_record_tdep.size_fd_set = 128;
790 i386_linux_record_tdep.size_dirent = 268;
791 i386_linux_record_tdep.size_dirent64 = 276;
792 i386_linux_record_tdep.size_statfs = 64;
793 i386_linux_record_tdep.size_statfs64 = 84;
794 i386_linux_record_tdep.size_sockaddr = 16;
2c543fc4
HZ
795 i386_linux_record_tdep.size_int
796 = gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT;
797 i386_linux_record_tdep.size_long
798 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
799 i386_linux_record_tdep.size_ulong
800 = gdbarch_long_bit (gdbarch) / TARGET_CHAR_BIT;
5e31abdf
HZ
801 i386_linux_record_tdep.size_msghdr = 28;
802 i386_linux_record_tdep.size_itimerval = 16;
803 i386_linux_record_tdep.size_stat = 88;
804 i386_linux_record_tdep.size_old_utsname = 325;
805 i386_linux_record_tdep.size_sysinfo = 64;
806 i386_linux_record_tdep.size_msqid_ds = 88;
807 i386_linux_record_tdep.size_shmid_ds = 84;
808 i386_linux_record_tdep.size_new_utsname = 390;
809 i386_linux_record_tdep.size_timex = 128;
810 i386_linux_record_tdep.size_mem_dqinfo = 24;
811 i386_linux_record_tdep.size_if_dqblk = 68;
812 i386_linux_record_tdep.size_fs_quota_stat = 68;
813 i386_linux_record_tdep.size_timespec = 8;
814 i386_linux_record_tdep.size_pollfd = 8;
815 i386_linux_record_tdep.size_NFS_FHSIZE = 32;
816 i386_linux_record_tdep.size_knfsd_fh = 132;
817 i386_linux_record_tdep.size_TASK_COMM_LEN = 16;
818 i386_linux_record_tdep.size_sigaction = 140;
819 i386_linux_record_tdep.size_sigset_t = 8;
820 i386_linux_record_tdep.size_siginfo_t = 128;
821 i386_linux_record_tdep.size_cap_user_data_t = 12;
822 i386_linux_record_tdep.size_stack_t = 12;
823 i386_linux_record_tdep.size_off_t = i386_linux_record_tdep.size_long;
824 i386_linux_record_tdep.size_stat64 = 96;
825 i386_linux_record_tdep.size_gid_t = 2;
826 i386_linux_record_tdep.size_uid_t = 2;
827 i386_linux_record_tdep.size_PAGE_SIZE = 4096;
828 i386_linux_record_tdep.size_flock64 = 24;
829 i386_linux_record_tdep.size_user_desc = 16;
830 i386_linux_record_tdep.size_io_event = 32;
831 i386_linux_record_tdep.size_iocb = 64;
832 i386_linux_record_tdep.size_epoll_event = 12;
2c543fc4
HZ
833 i386_linux_record_tdep.size_itimerspec
834 = i386_linux_record_tdep.size_timespec * 2;
5e31abdf
HZ
835 i386_linux_record_tdep.size_mq_attr = 32;
836 i386_linux_record_tdep.size_siginfo = 128;
837 i386_linux_record_tdep.size_termios = 36;
838 i386_linux_record_tdep.size_termios2 = 44;
839 i386_linux_record_tdep.size_pid_t = 4;
840 i386_linux_record_tdep.size_winsize = 8;
841 i386_linux_record_tdep.size_serial_struct = 60;
842 i386_linux_record_tdep.size_serial_icounter_struct = 80;
843 i386_linux_record_tdep.size_hayes_esp_config = 12;
2c543fc4
HZ
844 i386_linux_record_tdep.size_size_t = 4;
845 i386_linux_record_tdep.size_iovec = 8;
5e31abdf
HZ
846
847 /* These values are the second argument of system call "sys_ioctl".
848 They are obtained from Linux Kernel source. */
849 i386_linux_record_tdep.ioctl_TCGETS = 0x5401;
850 i386_linux_record_tdep.ioctl_TCSETS = 0x5402;
851 i386_linux_record_tdep.ioctl_TCSETSW = 0x5403;
852 i386_linux_record_tdep.ioctl_TCSETSF = 0x5404;
853 i386_linux_record_tdep.ioctl_TCGETA = 0x5405;
854 i386_linux_record_tdep.ioctl_TCSETA = 0x5406;
855 i386_linux_record_tdep.ioctl_TCSETAW = 0x5407;
856 i386_linux_record_tdep.ioctl_TCSETAF = 0x5408;
857 i386_linux_record_tdep.ioctl_TCSBRK = 0x5409;
858 i386_linux_record_tdep.ioctl_TCXONC = 0x540A;
859 i386_linux_record_tdep.ioctl_TCFLSH = 0x540B;
860 i386_linux_record_tdep.ioctl_TIOCEXCL = 0x540C;
861 i386_linux_record_tdep.ioctl_TIOCNXCL = 0x540D;
862 i386_linux_record_tdep.ioctl_TIOCSCTTY = 0x540E;
863 i386_linux_record_tdep.ioctl_TIOCGPGRP = 0x540F;
864 i386_linux_record_tdep.ioctl_TIOCSPGRP = 0x5410;
865 i386_linux_record_tdep.ioctl_TIOCOUTQ = 0x5411;
866 i386_linux_record_tdep.ioctl_TIOCSTI = 0x5412;
867 i386_linux_record_tdep.ioctl_TIOCGWINSZ = 0x5413;
868 i386_linux_record_tdep.ioctl_TIOCSWINSZ = 0x5414;
869 i386_linux_record_tdep.ioctl_TIOCMGET = 0x5415;
870 i386_linux_record_tdep.ioctl_TIOCMBIS = 0x5416;
871 i386_linux_record_tdep.ioctl_TIOCMBIC = 0x5417;
872 i386_linux_record_tdep.ioctl_TIOCMSET = 0x5418;
873 i386_linux_record_tdep.ioctl_TIOCGSOFTCAR = 0x5419;
874 i386_linux_record_tdep.ioctl_TIOCSSOFTCAR = 0x541A;
875 i386_linux_record_tdep.ioctl_FIONREAD = 0x541B;
876 i386_linux_record_tdep.ioctl_TIOCINQ = i386_linux_record_tdep.ioctl_FIONREAD;
877 i386_linux_record_tdep.ioctl_TIOCLINUX = 0x541C;
878 i386_linux_record_tdep.ioctl_TIOCCONS = 0x541D;
879 i386_linux_record_tdep.ioctl_TIOCGSERIAL = 0x541E;
880 i386_linux_record_tdep.ioctl_TIOCSSERIAL = 0x541F;
881 i386_linux_record_tdep.ioctl_TIOCPKT = 0x5420;
882 i386_linux_record_tdep.ioctl_FIONBIO = 0x5421;
883 i386_linux_record_tdep.ioctl_TIOCNOTTY = 0x5422;
884 i386_linux_record_tdep.ioctl_TIOCSETD = 0x5423;
885 i386_linux_record_tdep.ioctl_TIOCGETD = 0x5424;
886 i386_linux_record_tdep.ioctl_TCSBRKP = 0x5425;
887 i386_linux_record_tdep.ioctl_TIOCTTYGSTRUCT = 0x5426;
888 i386_linux_record_tdep.ioctl_TIOCSBRK = 0x5427;
889 i386_linux_record_tdep.ioctl_TIOCCBRK = 0x5428;
890 i386_linux_record_tdep.ioctl_TIOCGSID = 0x5429;
891 i386_linux_record_tdep.ioctl_TCGETS2 = 0x802c542a;
892 i386_linux_record_tdep.ioctl_TCSETS2 = 0x402c542b;
893 i386_linux_record_tdep.ioctl_TCSETSW2 = 0x402c542c;
894 i386_linux_record_tdep.ioctl_TCSETSF2 = 0x402c542d;
895 i386_linux_record_tdep.ioctl_TIOCGPTN = 0x80045430;
896 i386_linux_record_tdep.ioctl_TIOCSPTLCK = 0x40045431;
897 i386_linux_record_tdep.ioctl_FIONCLEX = 0x5450;
898 i386_linux_record_tdep.ioctl_FIOCLEX = 0x5451;
899 i386_linux_record_tdep.ioctl_FIOASYNC = 0x5452;
900 i386_linux_record_tdep.ioctl_TIOCSERCONFIG = 0x5453;
901 i386_linux_record_tdep.ioctl_TIOCSERGWILD = 0x5454;
902 i386_linux_record_tdep.ioctl_TIOCSERSWILD = 0x5455;
903 i386_linux_record_tdep.ioctl_TIOCGLCKTRMIOS = 0x5456;
904 i386_linux_record_tdep.ioctl_TIOCSLCKTRMIOS = 0x5457;
905 i386_linux_record_tdep.ioctl_TIOCSERGSTRUCT = 0x5458;
906 i386_linux_record_tdep.ioctl_TIOCSERGETLSR = 0x5459;
907 i386_linux_record_tdep.ioctl_TIOCSERGETMULTI = 0x545A;
908 i386_linux_record_tdep.ioctl_TIOCSERSETMULTI = 0x545B;
909 i386_linux_record_tdep.ioctl_TIOCMIWAIT = 0x545C;
910 i386_linux_record_tdep.ioctl_TIOCGICOUNT = 0x545D;
911 i386_linux_record_tdep.ioctl_TIOCGHAYESESP = 0x545E;
912 i386_linux_record_tdep.ioctl_TIOCSHAYESESP = 0x545F;
913 i386_linux_record_tdep.ioctl_FIOQSIZE = 0x5460;
914
915 /* These values are the second argument of system call "sys_fcntl"
916 and "sys_fcntl64". They are obtained from Linux Kernel source. */
917 i386_linux_record_tdep.fcntl_F_GETLK = 5;
918 i386_linux_record_tdep.fcntl_F_GETLK64 = 12;
919 i386_linux_record_tdep.fcntl_F_SETLK64 = 13;
920 i386_linux_record_tdep.fcntl_F_SETLKW64 = 14;
50ef67b3 921
77fcef51
HZ
922 i386_linux_record_tdep.arg1 = I386_EBX_REGNUM;
923 i386_linux_record_tdep.arg2 = I386_ECX_REGNUM;
924 i386_linux_record_tdep.arg3 = I386_EDX_REGNUM;
925 i386_linux_record_tdep.arg4 = I386_ESI_REGNUM;
926 i386_linux_record_tdep.arg5 = I386_EDI_REGNUM;
2c543fc4 927 i386_linux_record_tdep.arg6 = I386_EBP_REGNUM;
77fcef51 928
ffdf6de5
JK
929 tdep->i386_intx80_record = i386_linux_intx80_sysenter_syscall_record;
930 tdep->i386_sysenter_record = i386_linux_intx80_sysenter_syscall_record;
931 tdep->i386_syscall_record = i386_linux_intx80_sysenter_syscall_record;
77fcef51 932
203c3895 933 /* N_FUN symbols in shared libaries have 0 for their values and need
1777feb0 934 to be relocated. */
203c3895
UW
935 set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
936
871fbe6a 937 /* GNU/Linux uses SVR4-style shared libraries. */
982e9687 938 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
871fbe6a
MK
939 set_solib_svr4_fetch_link_map_offsets
940 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
941
942 /* GNU/Linux uses the dynamic linker included in the GNU C Library. */
bb41a796 943 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
12b8a2cb
DJ
944
945 dwarf2_frame_set_signal_frame_p (gdbarch, i386_linux_dwarf_signal_frame_p);
b2756930
KB
946
947 /* Enable TLS support. */
948 set_gdbarch_fetch_tls_load_module_address (gdbarch,
949 svr4_fetch_objfile_link_map);
237fc4c9 950
17ea7499 951 /* Install supported register note sections. */
01f9f808
MS
952 if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx512")
953 || tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx"))
4ac5d44e
MK
954 set_gdbarch_core_regset_sections (gdbarch, i386_linux_avx_regset_sections);
955 else if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.sse"))
956 set_gdbarch_core_regset_sections (gdbarch, i386_linux_sse_regset_sections);
957 else
958 set_gdbarch_core_regset_sections (gdbarch, i386_linux_regset_sections);
17ea7499 959
90884b2b
L
960 set_gdbarch_core_read_description (gdbarch,
961 i386_linux_core_read_description);
962
237fc4c9
PA
963 /* Displaced stepping. */
964 set_gdbarch_displaced_step_copy_insn (gdbarch,
9a7f938f 965 i386_linux_displaced_step_copy_insn);
237fc4c9
PA
966 set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
967 set_gdbarch_displaced_step_free_closure (gdbarch,
968 simple_displaced_step_free_closure);
969 set_gdbarch_displaced_step_location (gdbarch,
970 displaced_step_at_entry_point);
4aa995e1 971
a96d9b2e
SDJ
972 /* Functions for 'catch syscall'. */
973 set_xml_syscall_file_name (XML_SYSCALL_FILENAME_I386);
974 set_gdbarch_get_syscall_number (gdbarch,
975 i386_linux_get_syscall_number);
976
4aa995e1 977 set_gdbarch_get_siginfo_type (gdbarch, linux_get_siginfo_type);
8201327c
MK
978}
979
980/* Provide a prototype to silence -Wmissing-prototypes. */
981extern void _initialize_i386_linux_tdep (void);
982
983void
984_initialize_i386_linux_tdep (void)
985{
05816f70 986 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
8201327c 987 i386_linux_init_abi);
90884b2b 988
1777feb0 989 /* Initialize the Linux target description. */
90884b2b 990 initialize_tdesc_i386_linux ();
3a13a53b 991 initialize_tdesc_i386_mmx_linux ();
c131fcee 992 initialize_tdesc_i386_avx_linux ();
1dbcd68c 993 initialize_tdesc_i386_mpx_linux ();
01f9f808 994 initialize_tdesc_i386_avx512_linux ();
8201327c 995}
This page took 1.150789 seconds and 4 git commands to generate.