From: "H. Peter Anvin" <hpa@zytor.com>
To: Jiri Slaby <jslaby@suse.cz>, Stafford Horne <shorne@gmail.com>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Richard Henderson <rth@twiddle.net>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>,
Vineet Gupta <vgupta@synopsys.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Richard Kuo <rkuo@codeaurora.org>,
Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Michal Simek <monstr@monstr.eu>,
Ralf Baechle <ralf@linux-mips.org>,
Jonas Bonn <jonas@southpole.se>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
Helge Deller <deller@gmx.de>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>
Subject: Re: [PATCH 1/3] futex: remove duplicated code
Date: Mon, 6 Mar 2017 01:13:52 -0800 [thread overview]
Message-ID: <29ec8cda-02bd-fe07-340b-2bb775c8446b@zytor.com> (raw)
In-Reply-To: <3662dd60-2467-f858-dc32-0b0fb6abb33b@suse.cz>
On 03/06/17 00:46, Jiri Slaby wrote:
>
> static int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
> {
> - int op = (encoded_op >> 28) & 7;
> - int cmp = (encoded_op >> 24) & 15;
> - int oparg = (encoded_op << 8) >> 20;
> - int cmparg = (encoded_op << 20) >> 20;
> + int op = (encoded_op & 0x70000000) >> 28;
> + int cmp = (encoded_op & 0x0f000000) >> 24;
> + int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12);
> + int cmparg = sign_extend32(encoded_op & 0x00000fff, 12);
> int oldval, ret;
>
At least in the sign-extend case the mask is unnecessary.
This is why it would be nice to have both sign and zero extend for symmetry.
-hpa
next prev parent reply other threads:[~2017-03-06 9:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 12:27 Jiri Slaby
2017-03-03 12:27 ` [PATCH 2/3] futex: fix decoding of operation Jiri Slaby
2017-03-03 12:27 ` [PATCH 3/3] futex: make the encoded_op decoding readable Jiri Slaby
2017-03-05 7:55 ` Jiri Slaby
2017-03-03 14:08 ` [PATCH 1/3] futex: remove duplicated code Heiko Carstens
2017-03-03 14:48 ` Chris Metcalf
2017-03-04 12:49 ` Michael Ellerman
2017-03-04 13:05 ` Russell King - ARM Linux
2017-03-04 19:15 ` H. Peter Anvin
2017-03-04 21:38 ` Stafford Horne
2017-03-04 23:03 ` H. Peter Anvin
2017-03-04 23:08 ` H. Peter Anvin
2017-03-04 23:39 ` Stafford Horne
2017-03-06 8:46 ` Jiri Slaby
2017-03-06 9:13 ` H. Peter Anvin [this message]
2017-03-06 14:14 ` Geert Uytterhoeven
2017-03-09 4:16 ` Rob Landley
2017-03-09 4:36 ` H. Peter Anvin
2017-03-09 22:37 ` Rich Felker
2017-03-06 1:52 ` Rich Felker
2017-03-09 22:43 ` Vineet Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=29ec8cda-02bd-fe07-340b-2bb775c8446b@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=catalin.marinas@arm.com \
--cc=dalias@libc.org \
--cc=deller@gmx.de \
--cc=fenghua.yu@intel.com \
--cc=heiko.carstens@de.ibm.com \
--cc=ink@jurassic.park.msu.ru \
--cc=jejb@parisc-linux.org \
--cc=jonas@southpole.se \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mattst88@gmail.com \
--cc=monstr@monstr.eu \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=rkuo@codeaurora.org \
--cc=rth@twiddle.net \
--cc=schwidefsky@de.ibm.com \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=tony.luck@intel.com \
--cc=vgupta@synopsys.com \
--cc=will.deacon@arm.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®