Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_USER_H
0003 #define _ASM_X86_USER_H
0004 
0005 #ifdef CONFIG_X86_32
0006 # include <asm/user_32.h>
0007 #else
0008 # include <asm/user_64.h>
0009 #endif
0010 
0011 #include <asm/types.h>
0012 
0013 struct user_ymmh_regs {
0014     /* 16 * 16 bytes for each YMMH-reg */
0015     __u32 ymmh_space[64];
0016 };
0017 
0018 struct user_xstate_header {
0019     __u64 xfeatures;
0020     __u64 reserved1[2];
0021     __u64 reserved2[5];
0022 };
0023 
0024 /*
0025  * The structure layout of user_xstateregs, used for exporting the
0026  * extended register state through ptrace and core-dump (NT_X86_XSTATE note)
0027  * interfaces will be same as the memory layout of xsave used by the processor
0028  * (except for the bytes 464..511, which can be used by the software) and hence
0029  * the size of this structure varies depending on the features supported by the
0030  * processor and OS. The size of the structure that users need to use can be
0031  * obtained by doing:
0032  *     cpuid_count(0xd, 0, &eax, &ptrace_xstateregs_struct_size, &ecx, &edx);
0033  * i.e., cpuid.(eax=0xd,ecx=0).ebx will be the size that user (debuggers, etc.)
0034  * need to use.
0035  *
0036  * For now, only the first 8 bytes of the software usable bytes[464..471] will
0037  * be used and will be set to OS enabled xstate mask (which is same as the
0038  * 64bit mask returned by the xgetbv's xCR0).  Users (analyzing core dump
0039  * remotely, etc.) can use this mask as well as the mask saved in the
0040  * xstate_hdr bytes and interpret what states the processor/OS supports
0041  * and what states are in modified/initialized conditions for the
0042  * particular process/thread.
0043  *
0044  * Also when the user modifies certain state FP/SSE/etc through the
0045  * ptrace interface, they must ensure that the header.xfeatures
0046  * bytes[512..519] of the memory layout are updated correspondingly.
0047  * i.e., for example when FP state is modified to a non-init state,
0048  * header.xfeatures's bit 0 must be set to '1', when SSE is modified to
0049  * non-init state, header.xfeatures's bit 1 must to be set to '1', etc.
0050  */
0051 #define USER_XSTATE_FX_SW_WORDS 6
0052 #define USER_XSTATE_XCR0_WORD   0
0053 
0054 struct user_xstateregs {
0055     struct {
0056         __u64 fpx_space[58];
0057         __u64 xstate_fx_sw[USER_XSTATE_FX_SW_WORDS];
0058     } i387;
0059     struct user_xstate_header header;
0060     struct user_ymmh_regs ymmh;
0061     /* further processor state extensions go here */
0062 };
0063 
0064 #endif /* _ASM_X86_USER_H */