lkml.org 
[lkml]   [2023]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 0/6] x86: Clean up fast syscall return validation
From
On 10/6/23 11:59, H. Peter Anvin wrote:
>
> Incidentally, it is possible to save one instruction and use only *one*
> alternative immediate:
>
>     leaq (%rax,%rax),%rdx
>     xorq %rax,%rdx
>     shrq $(63 - LA),%rdx        # Yes, 63, not 64
>     # ZF=1 if canonical
>
> This works because if bit [x] is set in the output, then bit [x] and
> [x-1] in the input are different (bit [-1] considered to be zero); and
> by definition a bit is canonical if and only if all the bits [63:LA] are
> identical, thus bits [63:LA+1] in the output must all be zero.
>

Yes, I'm a doofus. Bits [63:LA-1] must be identical, so 64 is correct :$)

-hpa

\
 
 \ /
  Last update: 2023-10-07 01:59    [W:0.086 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site