Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\fpu\xstate.c Create Date:2022-07-28 07:50:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Convert from kernel XSAVES compacted format to standard format and copy* to a user-space buffer. It supports partial copy but pos always starts from* zero. This is called from xstateregs_get() and there we check the CPU* has XSAVES.

Proto:int copy_xstate_to_user(void __user *ubuf, struct xregs_state *xsave, unsigned int offset_start, unsigned int size_total)

Type:int

Parameter:

TypeParameterName
void __user *ubuf
struct xregs_state *xsave
unsigned intoffset_start
unsigned intsize_total
1074  If Value for the false possibility is greater at compile time(offset_start != 0) Then Return -EFAULT
1080  memset( & header, 0, size of header )
1081  xfeatures = xfeatures
1082  xfeatures &= ~Supervisor features
1087  offset = offsetof(structxregs_state, header)
1088  size = size of header
1090  ret = __copy_xstate_to_user(ubuf, & header, offset, size, size_total)
1091  If ret Then Return ret
1094  When i < XFEATURE_MAX cycle
1098  If xfeatures >> i & 1 Then
1101  offset = xstate_offsets[i]
1102  size = xstate_sizes[i]
1105  If offset + size > size_total Then Break
1109  If ret Then Return ret
1115  If Weird legacy quirk: SSE and YMM states store information in the* MXCSR and MXCSR_FLAGS fields of the FP area. That means if the FP* area is marked as unused in the xfeatures header, we need to copy* MXCSR and MXCSR_FLAGS if either SSE or YMM are in use. Then
1116  offset = offsetof(structfxregs_state, mxcsr)
1117  size = Copy both mxcsr & mxcsr_flags with a single u64 memcpy:
1118  __copy_xstate_to_user(ubuf, & MXCSR Register State , offset, size, size_total)
1124  offset = offsetof(structfxregs_state, sw_reserved)
1125  size = size of xstate_fx_sw_bytes
1127  ret = __copy_xstate_to_user(ubuf, xstate_fx_sw_bytes, offset, size, size_total)
1128  If ret Then Return ret
1131  Return 0