user.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_USER_H
  3. #define _ASM_X86_USER_H
  4. #ifdef CONFIG_X86_32
  5. # include <asm/user_32.h>
  6. #else
  7. # include <asm/user_64.h>
  8. #endif
  9. #include <asm/types.h>
  10. struct user_ymmh_regs {
  11. /* 16 * 16 bytes for each YMMH-reg */
  12. __u32 ymmh_space[64];
  13. };
  14. struct user_xstate_header {
  15. __u64 xfeatures;
  16. __u64 reserved1[2];
  17. __u64 reserved2[5];
  18. };
  19. /*
  20. * The structure layout of user_xstateregs, used for exporting the
  21. * extended register state through ptrace and core-dump (NT_X86_XSTATE note)
  22. * interfaces will be same as the memory layout of xsave used by the processor
  23. * (except for the bytes 464..511, which can be used by the software) and hence
  24. * the size of this structure varies depending on the features supported by the
  25. * processor and OS. The size of the structure that users need to use can be
  26. * obtained by doing:
  27. * cpuid_count(0xd, 0, &eax, &ptrace_xstateregs_struct_size, &ecx, &edx);
  28. * i.e., cpuid.(eax=0xd,ecx=0).ebx will be the size that user (debuggers, etc.)
  29. * need to use.
  30. *
  31. * For now, only the first 8 bytes of the software usable bytes[464..471] will
  32. * be used and will be set to OS enabled xstate mask (which is same as the
  33. * 64bit mask returned by the xgetbv's xCR0). Users (analyzing core dump
  34. * remotely, etc.) can use this mask as well as the mask saved in the
  35. * xstate_hdr bytes and interpret what states the processor/OS supports
  36. * and what states are in modified/initialized conditions for the
  37. * particular process/thread.
  38. *
  39. * Also when the user modifies certain state FP/SSE/etc through the
  40. * ptrace interface, they must ensure that the header.xfeatures
  41. * bytes[512..519] of the memory layout are updated correspondingly.
  42. * i.e., for example when FP state is modified to a non-init state,
  43. * header.xfeatures's bit 0 must be set to '1', when SSE is modified to
  44. * non-init state, header.xfeatures's bit 1 must to be set to '1', etc.
  45. */
  46. #define USER_XSTATE_FX_SW_WORDS 6
  47. #define USER_XSTATE_XCR0_WORD 0
  48. struct user_xstateregs {
  49. struct {
  50. __u64 fpx_space[58];
  51. __u64 xstate_fx_sw[USER_XSTATE_FX_SW_WORDS];
  52. } i387;
  53. struct user_xstate_header header;
  54. struct user_ymmh_regs ymmh;
  55. /* further processor state extensions go here */
  56. };
  57. #endif /* _ASM_X86_USER_H */