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] [day] [month] [year] [list]
Message-Id: <1227114986.13182.12.camel@brick>
Date:	Wed, 19 Nov 2008 09:16:26 -0800
From:	Harvey Harrison <harvey.harrison@...il.com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	mm-commits@...r.kernel.org,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	bryan.wu@...log.com, "David S. Miller" <davem@...emloft.net>,
	dhowells@...hat.com, Greg Ungerer <gerg@...inux.org>,
	grundler@...isc-linux.org, heiko.carstens@...ibm.com,
	hskinnemoen@...el.com, ink@...assic.park.msu.ru, kyle@...artin.ca,
	lethal@...ux-sh.org, linux-arch@...r.kernel.org, mingo@...e.hu,
	Paul Mackerras <paulus@...ba.org>,
	Ralf Baechle <ralf@...ux-mips.org>,
	Russell King <rmk@....linux.org.uk>, rth@...ddle.net,
	schwidefsky@...ibm.com, takata@...ux-m32r.org, tglx@...utronix.de,
	tony.luck@...el.com, ysato@...rs.sourceforge.jp,
	zankel@...silica.com, Roman Zippel <zippel@...ux-m68k.org>,
	Linux Kernel Development <linux-kernel@...r.kernel.org>
Subject: Re: + unaligned-introduce-common-header.patch added to -mm tree

On Wed, 2008-11-19 at 09:21 +0100, Geert Uytterhoeven wrote:
> On Tue, 18 Nov 2008, akpm@...ux-foundation.org wrote:
> > Subject: unaligned: introduce common header
> > From: Harvey Harrison <harvey.harrison@...il.com>
> > 
> > There are two common cases in the kernel, one where unaligned access is OK
> > for an arch and one where the arch uses a packed-struct for the native
> > endianness and opencoded C byteshifting for the other endianness. 
> > Consolidate these two implementations in asm-generic/unaligned.h
> > 
> > Arches that require no special handling of unaligned access can define
> > _UNALIGNED_ACCESS_OK in their asm/unaligned.h before including the generic
> > version.
> > 
> > +static inline void __put_le32_noalign(u8 *p, u32 val)
> > +{
> > +	__put_le16_noalign(p + 2, val >> 16);
> > +	__put_le16_noalign(p, val);
> 
> Isn't it more logical to reverse the order, to store in increasing memory
> locations:
> 
> 	__put_le16_noalign(p, val);
> 	__put_le16_noalign(p + 2, val >> 16);
> 

All of the byteshifting versions were cribbed from the ARM implementation.

I'm not sure if there was a particular reason for doing it in this order, but
a lot of work seems to have gone in to minimize register usage.

See include/asm-arm/unaligned.h circa 2.6.25.

Harvey

--
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