Skip to main content

stac

Function stac 

Source
pub fn stac()
Expand description

Set AC flag in RFLAGS to temporarily disable SMAP.

Must be paired with clac() after the user-memory access is complete. Only needed when CR4.SMAP is set.

#CPUID guard: QEMU TCG raises #UD on CLAC/STAC when the CPU model does not advertise CPUID.(7,0):EBX.SMAP (e.g. plain -cpu qemu64), even though real Ivy Bridge+ CPUs execute them unconditionally. Gate both instructions on the detected feature so kernels built with SMAP-aware user accessors boot on any CPU model.