[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1702282153030.26999@tp.orcam.me.uk>
Date: Tue, 28 Feb 2017 22:04:10 +0000
From: "Maciej W. Rozycki" <macro@...tec.com>
To: Matt Redfearn <matt.redfearn@...tec.com>
CC: Ralf Baechle <ralf@...ux-mips.org>, <linux-mips@...ux-mips.org>,
Marcin Nowakowski <marcin.nowakowski@...tec.com>,
<linux-kernel@...r.kernel.org>,
Paul Burton <paul.burton@...tec.com>
Subject: Re: [PATCH 2/4] MIPS: microMIPS: Fix decoding of addiusp
instruction
On Tue, 28 Feb 2017, Matt Redfearn wrote:
> diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
> index 5b1e932ae973..6ba5b775579c 100644
> --- a/arch/mips/kernel/process.c
> +++ b/arch/mips/kernel/process.c
> @@ -386,8 +386,9 @@ static int get_frame_info(struct mips_frame_info *info)
>
> if (ip->halfword[0] & mm_addiusp_func)
> {
> - tmp = (((ip->halfword[0] >> 1) & 0x1ff) << 2);
> - info->frame_size = -(signed short)(tmp | ((tmp & 0x100) ? 0xfe00 : 0));
> + tmp = (ip->halfword[0] >> 1) & 0x1ff;
> + tmp = tmp | ((tmp & 0x100) ? 0xfe00 : 0);
> + info->frame_size = -(signed short)(tmp << 2);
Ugh, this is unreadable -- can you please figure out a way to fit it in
79 columns? Perhaps by factoring this piece out?
Also this:
tmp = (ip->halfword[0] >> 1) & 0x1ff;
tmp = tmp | ((tmp & 0x100) ? 0xfe00 : 0);
will likely result in better code without the conditional, e.g.:
tmp = (((ip->halfword[0] >> 1) & 0x1ff) ^ 0x100) - 0x100;
(the usual way to sign-extend).
Maciej
Powered by blists - more mailing lists