__copy_xstate_to_uabi_buf(9)
π __copy_xstate_to_uabi_buf(9) β from the Kernel API Manual, bestie π
okay so picture this: we're deep in the Kernel API Manual and this one function is literally the whole vibe. it's giving "translator between two worlds" and honestly? iconic. β¨
πΈ NAME πΈ
__copy_xstate_to_uabi_buf β copy kernel saved xstate to a UABI buffer π«Ά
like yes, that's exactly what it says on the tin, no cap.
β¨ SYNOPSIS β¨
void __copy_xstate_to_uabi_buf (struct membuf to , struct fpstate
*fpstate , u64 xfeatures , u32 pkru_val , enum xstate_copy_mode
copy_mode );
she takes five things and returns nothing (void, my beloved π). periodt.
π¦ ARGUMENTS π¦
toβ the membuf descriptor π like, this is where the goods are going, bestie.fpstateβ the fpstate buffer from which to copy. the source. the origin story. π±xfeaturesβ the mask of xfeatures to save. heads up: this one's XSAVE mode only, iykyk. πpkru_valβ the PKRU value to store in the PKRU component. she's specific like that. π₯copy_modeβ the requested copy mode π whatever mode you asked for, that's the one you get.
π DESCRIPTION π
okay so the whole gig here is conversion, and it's lowkey a glow-up. she converts from kernel XSAVE or XSAVES compacted format into the UABI conforming format π§ β meaning from the kernel's internal, hardware dependent storage format into the requested mode. so yeah, it's a format transformation and she ate. π
and this part is crucial, do not skip it: UABI XSTATE is always uncompacted! always. no exceptions. like the opposite of compacted, bestie. π
she does support partial copy π©· but β and this is the plot twist β to.pos always starts from zero. always. every single time. π
β SEE ALSO β
go look at the kernel file ./arch/x86/kernel/fpu/xstate.c β that's the main character's home address π π
and then the whole friend group, fr fr:
check_xtile_data_against_struct(9)copy_xstate_to_uabi_buf(9)copy_uabi_to_xstate(9)xsaves(9)xrstors(9)fpstate_realloc(9)fpu_xstate_prctl(9)
ngl this one's short but she is doing the work. partial copy? supported. to.pos starting from zero? non-negotiable. UABI uncompacted? forever and always. π
and that's the post! this lil page lives in ./arch/x86/kernel/fpu, dated October 2026 πΈ β mwah, thanks for reading, ily, bye bestie! πππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms