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:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Convert from a ptrace standard-format kernel buffer to kernel XSAVES format* and copy to the target thread. This is called from xstateregs_set().

Proto:int copy_kernel_to_xstate(struct xregs_state *xsave, const void *kbuf)

Type:int

Parameter:

TypeParameterName
struct xregs_state *xsave
const void *kbuf
1144  offset = offsetof(structxregs_state, header)
1145  size = size of hdr
1147  memcpy( & hdr, kbuf + offset, size)
1149  If Validate an xstate header supplied by userspace (ptrace or sigreturn) Then Return -EINVAL
1152  When i < XFEATURE_MAX cycle
1153  mask = 1 << i
1155  If xfeatures & mask Then
1158  offset = xstate_offsets[i]
1159  size = xstate_sizes[i]
1161  memcpy(dst, kbuf + offset, size)
1165  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
1166  offset = offsetof(structfxregs_state, mxcsr)
1167  size = Copy both mxcsr & mxcsr_flags with a single u64 memcpy:
1168  memcpy( & MXCSR Register State , kbuf + offset, size)
1175  xfeatures &= Supervisor features
1180  xfeatures |= xfeatures
1182  Return 0