summaryrefslogtreecommitdiffstats
path: root/sys/x86/include/ptrace.h
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-11-21 20:53:17 +0000
committerjhb <jhb@FreeBSD.org>2014-11-21 20:53:17 +0000
commit1671ac9155f60e765c16e485d93ae02fe40656e3 (patch)
tree99aebdaca5d14d076e3c8d62e9c14bad62a4c56c /sys/x86/include/ptrace.h
parentb532057d45360838a1a3c71ee77b32fec6d971ba (diff)
downloadFreeBSD-src-1671ac9155f60e765c16e485d93ae02fe40656e3.zip
FreeBSD-src-1671ac9155f60e765c16e485d93ae02fe40656e3.tar.gz
Improve support for XSAVE with debuggers.
- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed to match what Linux does in that 1) it dumps the entire XSAVE area including the fxsave state, and 2) it stashes a copy of the current xsave mask in the unused padding between the fxsave state and the xstate header at the same location used by Linux. - Teach readelf() to recognize NT_X86_XSTATE notes. - Change PT_GET/SETXSTATE to take the entire XSAVE state instead of only the extra portion. This avoids having to always make two ptrace() calls to get or set the full XSAVE state. - Add a PT_GET_XSTATE_INFO which returns the length of the current XSTATE save area (so the size of the buffer needed for PT_GETXSTATE) and the current XSAVE mask (%xcr0). Differential Revision: https://reviews.freebsd.org/D1193 Reviewed by: kib MFC after: 2 weeks
Diffstat (limited to 'sys/x86/include/ptrace.h')
-rw-r--r--sys/x86/include/ptrace.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/x86/include/ptrace.h b/sys/x86/include/ptrace.h
index 16a04d1..16f9c62 100644
--- a/sys/x86/include/ptrace.h
+++ b/sys/x86/include/ptrace.h
@@ -37,14 +37,25 @@
/*
* On amd64 (PT_FIRSTMACH + 0) and (PT_FIRSTMACH + 1) are old values for
- * PT_GETXSTATE and PT_SETXSTATE. They should not be (re)used.
+ * PT_GETXSTATE_OLD and PT_SETXSTATE_OLD. They should not be (re)used.
*/
#ifdef __i386__
#define PT_GETXMMREGS (PT_FIRSTMACH + 0)
#define PT_SETXMMREGS (PT_FIRSTMACH + 1)
#endif
-#define PT_GETXSTATE (PT_FIRSTMACH + 2)
-#define PT_SETXSTATE (PT_FIRSTMACH + 3)
+#ifdef _KERNEL
+#define PT_GETXSTATE_OLD (PT_FIRSTMACH + 2)
+#define PT_SETXSTATE_OLD (PT_FIRSTMACH + 3)
+#endif
+#define PT_GETXSTATE_INFO (PT_FIRSTMACH + 4)
+#define PT_GETXSTATE (PT_FIRSTMACH + 5)
+#define PT_SETXSTATE (PT_FIRSTMACH + 6)
+
+/* Argument structure for PT_GETXSTATE_INFO. */
+struct ptrace_xstate_info {
+ uint64_t xsave_mask;
+ uint32_t xsave_len;
+};
#endif
OpenPOWER on IntegriCloud