[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180111195839.GC29272@char.us.oracle.com>
Date: Thu, 11 Jan 2018 14:58:39 -0500
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: tglx@...utronix.de, x86@...nel.org, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, dwmw@...zon.co.uk, pjt@...gle.com,
luto@...nel.org, peterz@...radead.org, thomas.lendacky@....com,
tim.c.chen@...ux.intel.com, gregkh@...ux-foundation.org,
dave.hansen@...el.com, jikos@...nel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v1 2/8] x86/entry/clearregs: Add infrastructure to clear
registers
On Tue, Jan 09, 2018 at 05:03:22PM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
>
> Add 64bit assembler macros to clear registers on kernel entry.
> Used in followon patches.
>
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> ---
> arch/x86/entry/calling.h | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h
> index 45a63e00a6af..9444e7623185 100644
> --- a/arch/x86/entry/calling.h
> +++ b/arch/x86/entry/calling.h
> @@ -172,6 +172,34 @@ For 32-bit we have the following conventions - kernel is built with
> .byte 0xf1
> .endm
>
> + .macro CLEAR_R11_TO_R15
> + xorq %r15, %r15
> + xorq %r14, %r14
> + xorq %r13, %r13
> + xorq %r12, %r12
> + xorq %r11, %r11
> + .endm
> +
> + .macro CLEAR_R8_TO_R15
> + CLEAR_R11_TO_R15
> + xorq %r10, %r10
> + xorq %r9, %r9
> + xorq %r8, %r8
> + .endm
> +
> + .macro CLEAR_ALL_REGS
> + CLEAR_R8_TO_R15
> + xorl %eax, %eax
> + xorl %ebx, %ebx
How come you use xorl vs xorq?
> + xorl %ecx, %ecx
> + xorl %edx, %edx
> + xorl %esi, %esi
> + xorl %edi, %edi
> +#ifndef CONFIG_FRAME_POINTER
> + xorl %ebp, %ebp
> +#endif
> + .endm
> +
> /*
> * This is a sneaky trick to help the unwinder find pt_regs on the stack. The
> * frame pointer is replaced with an encoded pointer to pt_regs. The encoding
> --
> 2.14.3
>
Powered by blists - more mailing lists