aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-01-27 10:40:35 +0000
committerAndrew Burgess <aburgess@redhat.com>2024-03-25 17:14:19 +0000
commit7816b81e9b36ea0f57662bfd7446b573bf0c9e54 (patch)
tree145d42dc60604530f50dff357f92e48701e2cd0c /gdb/nat
parent0a7bb97ad2f2fe2d18a442dad265051e34eab13e (diff)
downloadgdb-7816b81e9b36ea0f57662bfd7446b573bf0c9e54.zip
gdb-7816b81e9b36ea0f57662bfd7446b573bf0c9e54.tar.gz
gdb-7816b81e9b36ea0f57662bfd7446b573bf0c9e54.tar.bz2
gdb/gdbserver: share I386_LINUX_XSAVE_XCR0_OFFSET definition
Share the definition of I386_LINUX_XSAVE_XCR0_OFFSET between GDB and gdbserver. This commit is part of a series that aims to share more of the x86 target description creation code between GDB and gdbserver. The I386_LINUX_XSAVE_XCR0_OFFSET #define is used as part of the target description creation, and I noticed that this constant is defined separately for GDB and gdbserver. This commit moves the definition into gdb/nat/x86-linux.h, which allows the #define to be shared. There should be no user visible changes after this commit. Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/nat')
-rw-r--r--gdb/nat/x86-linux.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h
index 15153ea..855a8d1 100644
--- a/gdb/nat/x86-linux.h
+++ b/gdb/nat/x86-linux.h
@@ -22,6 +22,26 @@
#include "nat/linux-nat.h"
+/* Format of XSAVE extended state is:
+ struct
+ {
+ fxsave_bytes[0..463]
+ sw_usable_bytes[464..511]
+ xstate_hdr_bytes[512..575]
+ extended state regions (AVX, MPX, AVX512, PKRU, etc.)
+ };
+
+ Same memory layout will be used for the coredump NT_X86_XSTATE
+ representing the XSAVE extended state registers.
+
+ The first 8 bytes of the sw_usable_bytes[464..467] is the OS enabled
+ extended state mask, which is the same as the extended control register
+ 0 (the XFEATURE_ENABLED_MASK register), XCR0. We can use this mask
+ together with the mask saved in the xstate_hdr_bytes to determine what
+ states the processor/OS supports and what state, used or initialized,
+ the process/thread is in. */
+#define I386_LINUX_XSAVE_XCR0_OFFSET 464
+
/* Set whether our local mirror of LWP's debug registers has been
changed since the values were last written to the thread. Nonzero
indicates that a change has been made, zero indicates no change. */