On 2026-01-05 01:02, Uros Bizjak wrote:
> Use MOVL when reading segment registers to avoid 0x66 operand-size
> override insn prefix. The segment value is always 16-bit and gets
> zero-extended to the full 32-bit size.
> 
> Signed-off-by: Uros Bizjak <[email protected]>
> Tested-by: Michael Kelley <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Borislav Petkov <[email protected]>
> Cc: Dave Hansen <[email protected]>
> Cc: "H. Peter Anvin" <[email protected]>
> ---
>  arch/x86/include/asm/segment.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
> index f59ae7186940..9f5be2bbd291 100644
> --- a/arch/x86/include/asm/segment.h
> +++ b/arch/x86/include/asm/segment.h
> @@ -348,7 +348,7 @@ static inline void __loadsegment_fs(unsigned short value)
>   * Save a segment register away:
>   */
>  #define savesegment(seg, value)                              \
> -     asm("mov %%" #seg ",%0":"=r" (value) : : "memory")
> +     asm("movl %%" #seg ",%k0" : "=r" (value) : : "memory")
>  
>  #endif /* !__ASSEMBLER__ */
>  #endif /* __KERNEL__ */

Looks good to me.

Reviewed-by: H. Peter Anvin (Intel) <[email protected]>


Reply via email to