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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 28 Apr 2009 16:58:39 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <andi@...stfloor.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [GIT PULL] x86: cleanup alternative.h


* Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca> wrote:

> Ingo, do you think the cleanup below would be worth merging ? It 
> adds the ability to use ALTERNATIVE() directly in gcc inline 
> assembly _and_ cleans up the current alternative*() cut-and-paste 
> coding style. :)

Sure it's worth it! Your patch removes quite a bit of code:

   1 file changed, 22 insertions(+), 36 deletions(-)

One small style detail:

> +/* alternative assembly primitive */
> +#define ALTERNATIVE(oldinstr, newinstr, feature) \
> +	      "661:\n\t" oldinstr "\n662:\n"			\
> +	      ".section .altinstructions,\"a\"\n"		\
> +	      _ASM_ALIGN "\n"					\
> +	      _ASM_PTR "661b\n"		/* label */		\
> +	      _ASM_PTR "663f\n"		/* new instruction */	\
> +	      "	 .byte " __stringify(feature) "\n"	/* feature bit */ \
> +	      "	 .byte 662b-661b\n"	/* sourcelen */		\
> +	      "	 .byte 664f-663f\n"	/* replacementlen */	\
> +	      ".previous\n"					\
> +	      ".section .altinstr_replacement,\"ax\"\n"		\
> +	      "663:\n\t" newinstr "\n664:\n"  /* replacement */	\
> +	      ".previous"

Please try to align both the continuation backslashes and the 
comments vertically. Something like:

> +#define ALTERNATIVE(oldinstr, newinstr, feature)			 \
> +									 \
> +	"661:\n\t" oldinstr "\n662:\n"					 \
> +	".section .altinstructions,\"a\"\n"			 	 \
> +	_ASM_ALIGN "\n"						 	 \
> +	_ASM_PTR "661b\n"			   /* label           */ \
> +	_ASM_PTR "663f\n"			   /* new instruction */ \
> +	 "	 .byte " __stringify(feature) "\n" /* feature bit     */ \
> +	 "	 .byte 662b-661b\n"		   /* sourcelen       */ \
> +	 "	 .byte 664f-663f\n"		   /* replacementlen  */ \ 

... should do the trick. (also note the extra line after the #define)

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ