Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 22 Dec 2018 00:17:39 +0300
From: Cyrill Gorcunov <>
To: Matthew Wilcox <>
Cc: Igor Stoppa <>,
	Andy Lutomirski <>,
	Peter Zijlstra <>,
	Dave Hansen <>,
	Mimi Zohar <>,
	Thiago Jung Bauermann <>,, Nadav Amit <>,
	Kees Cook <>,
	Ahmed Soliman <>,,,,
Subject: Re: [PATCH 01/12] x86_64: memset_user()

On Fri, Dec 21, 2018 at 01:07:21PM -0800, Matthew Wilcox wrote:
> On Fri, Dec 21, 2018 at 11:46:16PM +0300, Cyrill Gorcunov wrote:
> > Cast to unsigned char is needed in any case. And as far as I remember
> > we've been using this multiplication trick for a really long time
> > in x86 land. I'm out of sources right now but it should be somewhere
> > in assembly libs.
> x86 isn't the only CPU.  Some CPUs have slow multiplies but fast shifts.

This is x86-64 patch, not some generic code.

> Also loading 0x0101010101010101 into a register may be inefficient on
> some CPUs.

It is pretty efficient on x86-64. Moreover the self dependents as
a |= a << b is a source for data hazards inside cpu engine. Anyway
i'm not going to insist, just wanted to remind about such trick.
Up to you what to choose.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.