Re: [PATCH v6 5/5] x86/gsseg: use the LKGS instruction if available for load_gs_index()
From: H. Peter Anvin
Date: Mon Jul 01 2024 - 02:32:25 EST
On June 30, 2024 11:08:41 PM PDT, Borislav Petkov <bp@xxxxxxxxx> wrote:
>On Sun, Jun 30, 2024 at 07:34:42PM -0700, H. Peter Anvin wrote:
>> It is much like "movl %edi,%ds"...
>
>You mean ...,%gs"... :-P
>
>But yeah, that makes more sense.
>
>Are we saying somewhere that when moving into a segreg, only the lower 16 bits
>of the source operand are used?
>
>Both docs say
>
>8E /r MOV Sreg, r/m16 Move r/m16 to segment register.
>
>and I read that strict as r16 so I'd expect a "mov %di,..." not a "mov
>%edi,..."
>
>Thx.
>
Yes, all loads into a segment register are truncated to 16 bits.