mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>,
	Matt Redfearn <matt.redfearn@imgtec.com>,
	Marcin Nowakowski <marcin.nowakowski@imgtec.com>,
	<linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@kernel.org>,
	Paul Burton <paul.burton@imgtec.com>
Subject: [PATCH v3 2/6] MIPS: microMIPS: Fix detection of addiusp instruction
Date: Tue, 8 Aug 2017 13:22:31 +0100	[thread overview]
Message-ID: <1502194955-18018-3-git-send-email-matt.redfearn@imgtec.com> (raw)
In-Reply-To: <1502194955-18018-1-git-send-email-matt.redfearn@imgtec.com>

The addiusp instruction uses the pool16d opcode, with bit 0 of the
immediate set. The test for the addiusp opcode erroneously did a logical
and of the immediate with mm_addiusp_func, which has value 1, so this
test always passes when the immediate is non-zero.

Fix the test by replacing the logical and with a bitwise and.

Fixes: 34c2f668d0f6 ("MIPS: microMIPS: Add unaligned access support.")
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>

---

Changes in v3:
- New patch to fix detection of addiusp instruction

Changes in v2: None

 arch/mips/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 5950ecf469e9..9d38faf01055 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -326,7 +326,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip)
 	 */
 	if (mm_insn_16bit(ip->halfword[1])) {
 		return (ip->mm16_r3_format.opcode == mm_pool16d_op &&
-			ip->mm16_r3_format.simmediate && mm_addiusp_func) ||
+			ip->mm16_r3_format.simmediate & mm_addiusp_func) ||
 		       (ip->mm16_r5_format.opcode == mm_pool16d_op &&
 			ip->mm16_r5_format.rt == 29);
 	}
-- 
2.7.4

  parent reply	other threads:[~2017-08-08 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 12:22 [PATCH v3 0/6] MIPS: Further microMIPS stack unwinding fixes Matt Redfearn
2017-08-08 12:22 ` [PATCH v3 1/6] MIPS: Handle non word sized instructions when examining frame Matt Redfearn
2017-08-08 12:22 ` Matt Redfearn [this message]
2017-08-08 12:22 ` [PATCH v3 3/6] MIPS: microMIPS: Fix decoding of addiusp instruction Matt Redfearn
2017-08-08 12:22 ` [PATCH v3 4/6] MIPS: microMIPS: Fix decoding of swsp16 instruction Matt Redfearn
2017-08-08 12:22 ` [PATCH v3 5/6] MIPS: Stacktrace: Fix microMIPS stack unwinding on big endian systems Matt Redfearn
2017-08-08 12:22 ` [PATCH v3 6/6] MIPS: Refactor handling of stack pointer in get_frame_info Matt Redfearn

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=1502194955-18018-3-git-send-email-matt.redfearn@imgtec.com \
    --to=matt.redfearn@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=marcin.nowakowski@imgtec.com \
    --cc=mingo@kernel.org \
    --cc=paul.burton@imgtec.com \
    --cc=ralf@linux-mips.org \
    /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®