user.h 2.2 KB

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