From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756429AbcAZJbY (ORCPT ); Tue, 26 Jan 2016 04:31:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:59630 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933916AbcAZJbR (ORCPT ); Tue, 26 Jan 2016 04:31:17 -0500 Date: Tue, 26 Jan 2016 10:31:13 +0100 From: Borislav Petkov To: Alexander Kuleshov Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Andy Lutomirski , Denys Vlasenko , Andrey Ryabinin , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/head_64.S: do not use temporary register to check alignment Message-ID: <20160126093113.GA8475@pd.tnic> References: <1453531828-19291-1-git-send-email-kuleshovmail@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1453531828-19291-1-git-send-email-kuleshovmail@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 23, 2016 at 12:50:28PM +0600, Alexander Kuleshov wrote: > We are using temporary %rax register during checking of kernel address > alignment. We can ged rid of it since testl instruction is safe and does > not change value of the rbp register. > > Signed-off-by: Alexander Kuleshov > Suggested-by: Brian Gerst > --- > arch/x86/kernel/head_64.S | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S > index ffdc0e8..7c21029 100644 > --- a/arch/x86/kernel/head_64.S > +++ b/arch/x86/kernel/head_64.S > @@ -76,9 +76,7 @@ startup_64: > subq $_text - __START_KERNEL_map, %rbp > > /* Is the address not 2M aligned? */ > - movq %rbp, %rax > - andl $~PMD_PAGE_MASK, %eax > - testl %eax, %eax > + testl $~PMD_PAGE_MASK, %ebp > jnz bad_address > > /* > -- Applied, thanks. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --