lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250807100558.GCaJR6hvI-UY-xpZrd@fat_crate.local>
Date: Thu, 7 Aug 2025 12:05:58 +0200
From: Borislav Petkov <bp@...en8.de>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Alexey Dobriyan <adobriyan@...il.com>, tglx@...utronix.de,
	mingo@...hat.com, hpa@...or.com, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: drop REG_OUT macro from hweight functions

On Mon, Jul 29, 2019 at 12:04:47PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 29, 2019 at 11:43:29AM +0200, Peter Zijlstra wrote:
> 
> > I _think_ something like the below should also work:
> > 
> > (fwiw _ASM_ARG 5 and 6 are broken, as are all the QLWB variants)
> 
> Fixed that, because
> 
> > ---
> > diff --git a/arch/x86/include/asm/arch_hweight.h b/arch/x86/include/asm/arch_hweight.h
> > index ba88edd0d58b..88704612b2f7 100644
> > --- a/arch/x86/include/asm/arch_hweight.h
> > +++ b/arch/x86/include/asm/arch_hweight.h
> > @@ -3,22 +3,15 @@
> >  #define _ASM_X86_HWEIGHT_H
> >  
> >  #include <asm/cpufeatures.h>
> > -
> > -#ifdef CONFIG_64BIT
> > -#define REG_IN "D"
> > -#define REG_OUT "a"
> > -#else
> > -#define REG_IN "a"
> > -#define REG_OUT "a"
> > -#endif
> > +#include <asm/asm.h>
> >  
> >  static __always_inline unsigned int __arch_hweight32(unsigned int w)
> >  {
> >  	unsigned int res;
> >  
> >  	asm (ALTERNATIVE("call __sw_hweight32", "popcntl %1, %0", X86_FEATURE_POPCNT)
> > -			 : "="REG_OUT (res)
> > -			 : REG_IN (w));
> > +			 : "=a" (res)
> > +			 : _ASM_ARG1 (w));
> 
> That needs _ASM_ARG1L because popcntl..

Frankly, the ASM_ARG* thing is less readable than simply having "=a" there.

ASM_ARG<number> naming needs optimizing.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ