diff options
author | John Baldwin <jhb@FreeBSD.org> | 2023-08-28 14:18:19 -0700 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2023-08-28 14:18:19 -0700 |
commit | b42405a159450004f2e2497e2b2d81bcac85c947 (patch) | |
tree | 4e6c1f8c1fd38512aad4da7a990f10aa829a796d /gdb/i386-linux-tdep.h | |
parent | 24ef2641d917695470fb2d43dabb133e3ee6678f (diff) | |
download | fsf-binutils-gdb-b42405a159450004f2e2497e2b2d81bcac85c947.zip fsf-binutils-gdb-b42405a159450004f2e2497e2b2d81bcac85c947.tar.gz fsf-binutils-gdb-b42405a159450004f2e2497e2b2d81bcac85c947.tar.bz2 |
gdb: Update x86 Linux architectures to support XSAVE layouts.
Refactor i386_linux_core_read_xcr0 to fetch and return a corresponding
x86_xsave_layout as well as xcr0 using the size of an existing
NT_X86_XSTATE core dump to determine the offsets via
i387_guess_xsave_layout. Use this to add an implementation of
gdbarch_core_xfer_x86_xsave_layout.
Use tdep->xsave_layout.sizeof_xsave as the size of the XSTATE register
set.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/i386-linux-tdep.h')
-rw-r--r-- | gdb/i386-linux-tdep.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gdb/i386-linux-tdep.h b/gdb/i386-linux-tdep.h index c0fd1f7..bd8e328 100644 --- a/gdb/i386-linux-tdep.h +++ b/gdb/i386-linux-tdep.h @@ -20,6 +20,8 @@ #ifndef I386_LINUX_TDEP_H #define I386_LINUX_TDEP_H +#include "gdbsupport/x86-xstate.h" + /* The Linux kernel pretends there is an additional "orig_eax" register. Since GDB needs access to that register to be able to properly restart system calls when necessary (see @@ -34,8 +36,18 @@ /* Total number of registers for GNU/Linux. */ #define I386_LINUX_NUM_REGS (I386_LINUX_ORIG_EAX_REGNUM + 1) -/* Get XSAVE extended state xcr0 from core dump. */ -extern uint64_t i386_linux_core_read_xcr0 (bfd *abfd); +/* Read the XSAVE extended state xcr0 value from the ABFD core file. + If it appears to be valid, return it and fill LAYOUT with values + inferred from that value. + + Otherwise, return 0 to indicate no state was found and leave LAYOUT + untouched. */ +extern uint64_t i386_linux_core_read_xsave_info (bfd *abfd, + x86_xsave_layout &layout); + +/* Implement the core_read_x86_xsave_layout gdbarch method. */ +extern bool i386_linux_core_read_x86_xsave_layout (struct gdbarch *gdbarch, + x86_xsave_layout &layout); /* Handle and display information related to the MPX bound violation to the user. */ @@ -52,14 +64,7 @@ extern const struct target_desc *i386_linux_read_description (uint64_t xcr0); fxsave_bytes[0..463] sw_usable_bytes[464..511] xstate_hdr_bytes[512..575] - avx_bytes[576..831] - mpx_bytes [960..1032] - avx512_k_regs[1088..1152] - avx512_zmmh_regs0-7[1153..1407] - avx512_zmmh_regs8-15[1408..1663] - avx512_zmm_regs16-31[1664..2687] - pkru[2688..2752] - future_state etc + extended state regions (AVX, MPX, AVX512, PKRU, etc.) }; Same memory layout will be used for the coredump NT_X86_XSTATE |