summaryrefslogtreecommitdiffstats
path: root/sys/x86/include/fpu.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/fpu.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/fpu.h')
-rw-r--r--sys/x86/include/fpu.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/x86/include/fpu.h b/sys/x86/include/fpu.h
index 73af34c..0430108 100644
--- a/sys/x86/include/fpu.h
+++ b/sys/x86/include/fpu.h
@@ -63,15 +63,7 @@ struct save87 {
struct env87 sv_env; /* floating point control/status */
struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */
uint8_t sv_pad0[4]; /* saved status word (now unused) */
- /*
- * Bogus padding for emulators. Emulators should use their own
- * struct and arrange to store into this struct (ending here)
- * before it is inspected for ptracing or for core dumps. Some
- * emulators overwrite the whole struct. We have no good way of
- * knowing how much padding to leave. Leave just enough for the
- * GPL emulator's i387_union (176 bytes total).
- */
- uint8_t sv_pad[64]; /* padding; used by emulators */
+ uint8_t sv_pad[64];
};
/* Contents of each SSE extended accumulator. */
@@ -215,4 +207,11 @@ struct savefpu_ymm {
#define __INITIAL_MXCSR__ 0x1F80
#define __INITIAL_MXCSR_MASK__ 0xFFBF
+/*
+ * The current value of %xcr0 is saved in the sv_pad[] field of the FPU
+ * state in the NT_X86_XSTATE note in core dumps. This offset is chosen
+ * to match the offset used by NT_X86_XSTATE in other systems.
+ */
+#define X86_XSTATE_XCR0_OFFSET 464
+
#endif /* !_X86_FPU_H_ */
OpenPOWER on IntegriCloud