Re: [PATCH v1 3/8] x86/entry/clearregs: Clear registers for 64bit SYSCALL

From: Andi Kleen
Date: Thu Jan 11 2018 - 13:47:58 EST


On Wed, Jan 10, 2018 at 10:35:58PM -0500, Brian Gerst wrote:
> > @@ -263,6 +271,7 @@ entry_SYSCALL_64_fastpath:
> > #endif
> > ja 1f /* return -ENOSYS (already in pt_regs->ax) */
> > movq %r10, %rcx
> > + xor %r10, %r10
>
> RCX is already clear, so xchgq %r10, %rcx will be simpler.

XOR is special cased by the hardware, so it's always more
efficient.

-Andi
>